本地商家ID170的走另外一个支付

This commit is contained in:
wangxiaowei 2024-11-30 17:08:51 +08:00
parent 9f48b3f423
commit 1a8c07cb96

@ -176,8 +176,10 @@
import {
payTest,
huifu,
wxPay
} from '@/api/local_store.js'
wxPay,
gtpay,
checkOrder
} from '@/api/local_store'
import {
getLocalShopById
} from "@/api/shop"
@ -390,7 +392,6 @@
// this.handleWechatPay(pay);
// }
// })
if (this.lstore_id === 0) return this.$toast({
title: "商家ID不存在"
})
@ -404,29 +405,8 @@
mask: true
})
// localShopPayWeixin({
// money: this.money,
// lid: this.lstore_id,
// user_id: this.user_id,
// spec_item_id: this.spec_item_id,
// goods_num: this.goods ? this.goods.goods_num : 1,
// lsg_order_id: this.lsg_order_id,
// remark: this.remark,
// post_station_id: this.post_station_id,
// post_station_time: this.post_station_time
// }).then((result) => {
// if (result.code == 1) {
// const pay = {
// nonceStr: result.data.nonceStr,
// package: result.data.package,
// paySign: result.data.paySign,
// signType: result.data.signType,
// timeStamp: result.data.timeStamp,
// }
// this.handleWechatPay(pay);
// }
// })
wxPay({
let pay_data = {
user_id: this.user_id,
money: this.money,
lid: this.lstore_id,
user_id: this.user_id,
@ -435,19 +415,41 @@
lsg_order_id: this.lsg_order_id,
remark: this.remark,
post_station_id: this.post_station_id,
post_station_time: this.post_station_time
}).then((result) => {
if (result.code == 1) {
const pay = {
nonceStr: result.data.nonceStr,
package: result.data.package,
paySign: result.data.paySign,
signType: result.data.signType,
timeStamp: result.data.timeStamp,
post_station_time: this.post_station_time,
local_goods_id: this.goods_id,
}
if (this.lstore_id == 170) {
gtpay(pay_data).then((result) => {
if (result.code == 1) {
console.log('result=', result)
const pay = {
nonceStr: result.data.nonceStr,
package: result.data.package,
paySign: result.data.paySign,
signType: result.data.signType,
timeStamp: result.data.timeStamp,
}
pay_data.id = result.data.id
console.log('pay_data', pay_data)
this.handleWechatPay(pay, pay_data);
}
this.handleWechatPay(pay);
}
})
})
} else {
localShopPayWeixin(pay_data).then((result) => {
if (result.code == 1) {
const pay = {
nonceStr: result.data.nonceStr,
package: result.data.package,
paySign: result.data.paySign,
signType: result.data.signType,
timeStamp: result.data.timeStamp,
}
this.handleWechatPay(pay);
}
})
}
uni.hideLoading()
@ -463,27 +465,30 @@
},
// 微信支付
handleWechatPay(data) {
wxpay(data).then(res => {
console.log('res=', res)
this.handPayResult(res)
handleWechatPay(pay, data = []) {
wxpay(pay).then(res => {
this.handPayResult(res, data)
}).catch(err => {
console.log('err=', err)
})
},
// 支付后处理
handPayResult(result) {
handPayResult(result, data) {
this.payMoney = this.money
if (result === 'success') {
if (this.lstore_id == 170) {
checkOrder({
post: data
})
}
this.money = ''
this.successPopup = true
} else if (result === 'fail') {
if (this.goods_id == 0) {
this.money = ''
}
this.cancelPopup = true
}