新增汇付天下支付

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) => {
console.log(data)
return request({
url: 'pay/diff/' + orderId + '/ums',
data
@@ -59,7 +58,32 @@ const umsFree = (orderNo, type) => {
return request({
url : 'app/services/recharge/' + orderNo + '/ums',
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,
umsState,
umsFree,
umsFreeInfo
umsFreeInfo,
dgPay,
diffDgPay,
dgFree
}

View File

@@ -23,6 +23,14 @@
</view>
<radio class="choose-radio" value="code"></radio>
</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">
<view class="choose-text">
<image src="@/static/icons/pay_wechat.png" mode="aspectFill"></image>
@@ -30,16 +38,23 @@
</view>
<radio class="choose-radio" value="wx" :checked="payMethod == 'wx'"></radio>
</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">
<image src="@/static/icons/pay_ali.png" mode="aspectFill"></image>
支付宝支付
支付宝支付(汇付)
</view>
<radio class="choose-radio" value="ali" :checked="payMethod == 'ali'"></radio>
<radio class="choose-radio" value="dgali" :checked="payMethod == 'dgali'"></radio>
</label>
</radio-group>
</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-label">
<view class="title">使用火力值抵扣</view>
@@ -68,8 +83,8 @@
<script>
import { info } from '@/apis/interfaces/order.js'
import { coinPay, diffCoinPay, umsPay, umsState, diffUmsPay, umsFree, umsFreeInfo } from '@/apis/interfaces/pay.js'
import mixin from 'uview-ui/libs/mixin/mixin';
import { coinPay, diffCoinPay, umsPay, umsState, diffUmsPay, umsFree, umsFreeInfo, dgPay, diffDgPay, dgFree } from '@/apis/interfaces/pay.js'
import mixin from 'uview-ui/libs/mixin/mixin';
export default {
data() {
return {
@@ -204,10 +219,98 @@ import mixin from 'uview-ui/libs/mixin/mixin';
if(this.payType == 'diff') this.onDiffUmsPay('app_alipay')
if(this.payType == 'free') this.onFreePay('app_alipay')
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){
uni.showLoading({