新增汇付天下支付

This commit is contained in:
唐明明
2023-04-26 17:02:15 +08:00
parent 048b9987a7
commit 25896ec86f
2 changed files with 141 additions and 11 deletions

View File

@@ -32,7 +32,6 @@ const umsPay = (orderId, data) => {
// 银联支付补差价 // 银联支付补差价
const diffUmsPay = (orderId, data) => { const diffUmsPay = (orderId, data) => {
console.log(data)
return request({ return request({
url: 'pay/diff/' + orderId + '/ums', url: 'pay/diff/' + orderId + '/ums',
data data
@@ -59,7 +58,32 @@ const umsFree = (orderNo, type) => {
return request({ return request({
url : 'app/services/recharge/' + orderNo + '/ums', url : 'app/services/recharge/' + orderNo + '/ums',
data : { type }, data : { type },
method: 'POST' method: 'POST'
})
}
// 斗拱支付
const dgPay = (orderId, data) => {
return request({
url : 'pay/order/' + orderId + '/dg',
data
})
}
// 斗拱支付补差价
const diffDgPay = (orderId, data) => {
return request({
url: 'pay/diff/' + orderId + '/dg',
data
})
}
// 斗拱支付自由服务包
const dgFree = (orderNo, type) => {
return request({
url : 'app/services/recharge/' + orderNo + '/dg',
data : { ...type },
method: 'POST'
}) })
} }
@@ -70,5 +94,8 @@ export {
diffUmsPay, diffUmsPay,
umsState, umsState,
umsFree, umsFree,
umsFreeInfo umsFreeInfo,
dgPay,
diffDgPay,
dgFree
} }

View File

@@ -23,6 +23,14 @@
</view> </view>
<radio class="choose-radio" value="code"></radio> <radio class="choose-radio" value="code"></radio>
</label> --> </label> -->
<!--
<label class="choose-item nowrap" v-if="Number(total) <= 5000">
<view class="choose-text">
<image src="@/static/icons/pay_ali.png" mode="aspectFill"></image>
支付宝支付
</view>
<radio class="choose-radio" value="ali" :checked="payMethod == 'ali'"></radio>
</label> -->
<label class="choose-item nowrap"> <label class="choose-item nowrap">
<view class="choose-text"> <view class="choose-text">
<image src="@/static/icons/pay_wechat.png" mode="aspectFill"></image> <image src="@/static/icons/pay_wechat.png" mode="aspectFill"></image>
@@ -30,16 +38,23 @@
</view> </view>
<radio class="choose-radio" value="wx" :checked="payMethod == 'wx'"></radio> <radio class="choose-radio" value="wx" :checked="payMethod == 'wx'"></radio>
</label> </label>
<label class="choose-item nowrap" v-if="Number(total) <= 5000"> <label class="choose-item nowrap">
<view class="choose-text">
<image src="@/static/icons/pay_wechat.png" mode="aspectFill"></image>
微信支付(汇付)
</view>
<radio class="choose-radio" value="dgwx" :checked="payMethod == 'dgwx'"></radio>
</label>
<label class="choose-item nowrap">
<view class="choose-text"> <view class="choose-text">
<image src="@/static/icons/pay_ali.png" mode="aspectFill"></image> <image src="@/static/icons/pay_ali.png" mode="aspectFill"></image>
支付宝支付 支付宝支付(汇付)
</view> </view>
<radio class="choose-radio" value="ali" :checked="payMethod == 'ali'"></radio> <radio class="choose-radio" value="dgali" :checked="payMethod == 'dgali'"></radio>
</label> </label>
</radio-group> </radio-group>
</view> </view>
<view class="deduction" v-if="(payMethod == 'wx' || payMethod == 'ali') && payType != 'free'"> <view class="deduction" v-if="(payMethod == 'wx' || payMethod == 'ali' || payMethod == 'dgwx' || payMethod == 'dgali') && payType != 'free'">
<view class="deduction-item"> <view class="deduction-item">
<view class="deduction-label"> <view class="deduction-label">
<view class="title">使用火力值抵扣</view> <view class="title">使用火力值抵扣</view>
@@ -68,8 +83,8 @@
<script> <script>
import { info } from '@/apis/interfaces/order.js' import { info } from '@/apis/interfaces/order.js'
import { coinPay, diffCoinPay, umsPay, umsState, diffUmsPay, umsFree, umsFreeInfo } from '@/apis/interfaces/pay.js' import { coinPay, diffCoinPay, umsPay, umsState, diffUmsPay, umsFree, umsFreeInfo, dgPay, diffDgPay, dgFree } from '@/apis/interfaces/pay.js'
import mixin from 'uview-ui/libs/mixin/mixin'; import mixin from 'uview-ui/libs/mixin/mixin';
export default { export default {
data() { data() {
return { return {
@@ -204,10 +219,98 @@ import mixin from 'uview-ui/libs/mixin/mixin';
if(this.payType == 'diff') this.onDiffUmsPay('app_alipay') if(this.payType == 'diff') this.onDiffUmsPay('app_alipay')
if(this.payType == 'free') this.onFreePay('app_alipay') if(this.payType == 'free') this.onFreePay('app_alipay')
break; break;
case 'dgwx':
if(this.payType == 'price') this.onDgPay('app')
if(this.payType == 'diff') this.onDgDiffPay('app')
if(this.payType == 'free') this.onDgFreePay('app')
break;
case 'dgali':
if(this.payType == 'price') this.onDgPay('app_alipay')
if(this.payType == 'diff') this.onDgDiffPay('app_alipay')
if(this.payType == 'free') this.onDgFreePay('app_alipay')
break
} }
}, },
// 混合支付 // 斗拱支付
onDgPay(type){
uni.showLoading({
title: '加载中...',
mask : true
})
dgPay(this.orderId, {
type,
use_fire : this.isDeduction ? 1 : 0,
fire : this.deductionVal || 0,
app_schema : 'doufire://'
}).then(res => {
if(type == 'app'){
let jumpUrl = JSON.parse(res.miniapp_data)
plus.runtime.openURL(jumpUrl.scheme_code)
}
if(type == 'app_alipay'){
plus.runtime.openURL(res.jump_url)
}
}).catch(err => {
console.log(err)
uni.showToast({
title: err.message,
icon : 'none'
})
}).finally(() => {
uni.hideLoading()
})
},
// 斗拱补差价
onDgDiffPay(type){
uni.showLoading({
title: '加载中...',
mask : true
})
diffDgPay(this.orderId, {
type,
use_fire : this.isDeduction ? 1 : 0,
fire : this.deductionVal || 0,
app_schema : 'doufire://'
}).then(res => {
if(type == 'app'){
let jumpUrl = JSON.parse(res.miniapp_data)
plus.runtime.openURL(jumpUrl.scheme_code)
}
if(type == 'app_alipay'){
plus.runtime.openURL(res.jump_url)
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
}).finally(() => {
uni.hideLoading()
})
},
// 斗拱自由服务包
onDgFreePay(type){
dgFree(this.orderId, {
type,
app_schema : 'doufire://'
}).then(res => {
if(type == 'app'){
let jumpUrl = JSON.parse(res.miniapp_data)
plus.runtime.openURL(jumpUrl.scheme_code)
}
if(type == 'app_alipay'){
plus.runtime.openURL(res.jump_url)
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
}).finally(() => {
uni.hideLoading()
})
},
// 银联三方支付 // 银联三方支付
onUmsPay(type){ onUmsPay(type){
uni.showLoading({ uni.showLoading({