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

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

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