调整业绩账户,新增微信支付渠道

This commit is contained in:
唐明明
2023-03-07 14:48:29 +08:00
parent df747b9f0a
commit c40a262154
7 changed files with 165 additions and 55 deletions

View File

@@ -22,14 +22,14 @@
付款码支付
</view>
<radio class="choose-radio" value="code"></radio>
</label>
</label> -->
<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="wx"></radio>
</label> -->
<radio class="choose-radio" value="wx" :checked="payMethod == 'wx'"></radio>
</label>
<label class="choose-item nowrap">
<view class="choose-text">
<image src="@/static/icons/pay_ali.png" mode="aspectFill"></image>
@@ -111,7 +111,7 @@
mask : true
})
if(this.$Route.query.paytype === 'free'){
this.payMethod = "ali"
this.payMethod = "wx"
umsFreeInfo(this.$Route.query.serviceId).then(res => {
let { order_id, price, order_no } = res;
this.orderId = order_id
@@ -157,10 +157,9 @@
})
break;
case 'wx':
uni.showToast({
title: '微信支付暂未开放,请敬期待',
icon : 'none'
})
if(this.payType == 'price') this.onUmsPay('mp')
if(this.payType == 'diff') this.onDiffUmsPay('mp')
if(this.payType == 'free') this.onFreePay('mp')
break;
case 'ali':
if(this.payType == 'price') this.onUmsPay('mp_alipay')
@@ -179,8 +178,13 @@
uni.hideLoading()
this.getState = true
this.trade_id = res.trade_id
if(res.alipay){
plus.runtime.openURL(res.alipay)
switch (type){
case 'mp':
this.onMiniWx()
break;
case 'mp_alipay':
plus.runtime.openURL(res.alipay)
break;
}
}).catch(err => {
uni.showToast({
@@ -199,8 +203,38 @@
uni.hideLoading()
this.getState = true
this.trade_id = res.trade_id
if(res.alipay){
plus.runtime.openURL(res.alipay)
switch (type){
case 'mp':
this.onMiniWx()
break;
case 'mp_alipay':
plus.runtime.openURL(res.alipay)
break;
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 银联三方自由服务包支付
onFreePay(type){
wx.showLoading({
title: '加载中...',
mask : true
})
umsFree(this.orderId, type).then(res => {
uni.hideLoading()
this.getState = true
this.trade_id = res.trade_id
switch (type){
case 'mp':
this.onMiniWx()
break;
case 'mp_alipay':
plus.runtime.openURL(res.alipay)
break;
}
}).catch(err => {
uni.showToast({
@@ -251,24 +285,23 @@
})
})
},
// 银联三方自由服务包支付
onFreePay(type){
wx.showLoading({
title: '加载中...',
mask : true
})
umsFree(this.orderId, type).then(res => {
uni.hideLoading()
this.getState = true
this.trade_id = res.trade_id
if(res.alipay){
plus.runtime.openURL(res.alipay)
// 打开微信小程序收银台
onMiniWx(){
let token = this.$store.getters.getToken
let tradeId = res.trade_id
plus.share.getServices(e => {
let wxIndex = e.findIndex(val => val.id == 'weixin')
let sweixin = null
if(wxIndex >= 0){
sweixin = e[wxIndex]
sweixin ? sweixin.launchMiniProgram({
id : 'gh_918c81628d6f',
path: 'pages/pay/pay?type=app&trade_id=' + tradeId + '&token=' + token,
}): uni.showToast({
title: '当前环境暂不支持微信支付',
icon : 'none'
})
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 更新订单列表