From 0907abab726976b53437ab75fcd6169cdebc5798 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Wed, 21 Feb 2024 09:53:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BagStation/pages/makeOrder/orderPaying.vue | 61 ++++++++++------------ api/pay.js | 8 +++ 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/BagStation/pages/makeOrder/orderPaying.vue b/BagStation/pages/makeOrder/orderPaying.vue index d7abbc9..bd345a6 100644 --- a/BagStation/pages/makeOrder/orderPaying.vue +++ b/BagStation/pages/makeOrder/orderPaying.vue @@ -183,7 +183,7 @@ }, data() { return { - userIp:null, + userIp: null, showtitles: "", imgURL: this.global.imgURL, order: uni.getStorageSync('orderMade'), @@ -223,13 +223,13 @@ onShow() { this.datatime = this.timF(this.order.createTime); const that = this - wx.request({ - url: 'http://ip-api.com/json', - success:function(e){ - console.log(e.data.query); - that.userIp = e.data.query - } - }) + wx.request({ + url: 'http://ip-api.com/json', + success: function(e) { + console.log(e.data.query); + that.userIp = e.data.query + } + }) }, onReady() { if (this.isCompany) { @@ -315,41 +315,34 @@ payCode: 'WECHAT_ORDER_PAY_WECHAT', //APP填WECHAT_ORDER_PAY_APP,小程序填 orderId: this.order.orderSerialNumber, payClient: 'XOIL_DRIVER_WECHAT_APPLET', //"支付端。安卓XOIL_DRIVER_ANDROID,小程序 - userIp: (this.userIp?this.userIp:"36.57.160.59") , - merchantNo:'10089027856' + userIp: (this.userIp ? this.userIp : "36.57.160.59"), + merchantNo: '10089027856' } - console.log(payData,'payDatapayData') + console.log(payData, 'payDatapayData') oilPayApi.aggregatePay(payData).then(res => { if (res.code == 20000) { uni.requestPayment({ provider: 'wxpay', ...res.data.baseWxOrderVo, - success: (res1) => { - console.log(res) - if (res.code == 20000) { - uni.showToast({ - title: res.msg - }) - - uni.redirectTo({ - url: '/BagStation/pages/makeOrder/payResult?status=success&&payMethod=' + - this.payMethod, - fail: (err) => { - // console.log(err) - } - }) - - } else { - uni.showToast({ - title: res.msg, - icon: 'none' - }) - } + success: (_res) => { + uni.showToast({ + title: res.msg + }) + oilPayApi.wxPayIntegral({ + appId: 'wx2f203fde39b883bc', + orderId: this.order.orderSerialNumber + }) + uni.redirectTo({ + url: '/BagStation/pages/makeOrder/payResult?status=success&&payMethod=' + + this.payMethod + }) }, - fail: function(err) { - } }) } else { + uni.showToast({ + title: res.msg, + icon: 'none' + }) } }) diff --git a/api/pay.js b/api/pay.js index 003be19..3e0c033 100644 --- a/api/pay.js +++ b/api/pay.js @@ -10,4 +10,12 @@ export default { data: data }) }, + // 积分处理 + wxPayIntegral(data) { + return request({ + url: '/oil-pay/yiBaoPay/wxPayIntegral', + method: 'post', + data: data + }) + }, }