From 1a8c07cb96758241b27d613122006fecc79cdba5 Mon Sep 17 00:00:00 2001 From: wangxiaowei <1121133807@qq.com> Date: Sat, 30 Nov 2024 17:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=95=86=E5=AE=B6ID170?= =?UTF-8?q?=E7=9A=84=E8=B5=B0=E5=8F=A6=E5=A4=96=E4=B8=80=E4=B8=AA=E6=94=AF?= =?UTF-8?q?=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bundle_b/pages/local_shop/local_pay.vue | 93 +++++++++++++------------ 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/bundle_b/pages/local_shop/local_pay.vue b/bundle_b/pages/local_shop/local_pay.vue index e421933..dc4efc2 100644 --- a/bundle_b/pages/local_shop/local_pay.vue +++ b/bundle_b/pages/local_shop/local_pay.vue @@ -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 }