From 68e74d8091fd4c3160c5c01dacb301d538c6d973 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Thu, 1 Nov 2018 16:47:17 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=94=AF=E4=BB=98=E8=AE=A2=E5=8D=95=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=9A=84=E6=9B=B4=E6=96=B0][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 2 +- pages/coupon/detail/index.js | 33 ++++++++------------------------- pages/order/detail/index.js | 13 +++++++------ 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/app.json b/app.json index fab9bca..6267ad7 100644 --- a/app.json +++ b/app.json @@ -64,7 +64,7 @@ "navigationBarTextStyle": "white" }, "networkTimeout": { - "request": 10000, + "request": 30000, "downloadFile": 10000 }, "debug": false diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index cb21584..e1d41d1 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -132,7 +132,7 @@ Page({ /** * 支付订单更新 */ - payOrderUpdate: (orderId, payOrderId, status, reason,type) => { + payOrderUpdate: (orderId, payOrderId, status, reason,type,_this) => { let that=this; // 支付成功 Http.post({ @@ -145,7 +145,6 @@ Page({ } }) .then(res => { - console.log(that.payOrderUpdate()); console.log("成功"); if(!type){ setTimeout(() => { @@ -158,7 +157,10 @@ Page({ } }) .catch(err => { - + console.log(_this); + setTimeout(function(){ + _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this); + },2000) }); }, /** @@ -305,16 +307,7 @@ Page({ signType: (res.data.signType) ? res.data.signType : "MD5", paySign: res.data.paySign, success: res => { - - var timesRun = 0; - var interval = setInterval(function () { - timesRun += 1; - if (timesRun === 3) { - clearInterval(interval); - } - that.payOrderUpdate(that.data.orderId, payOrderId, 1, ); - }, 2000); - + that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that); if (res.errMsg == "requestPayment:ok") { setTimeout(function () { wx.hideLoading(); @@ -331,14 +324,10 @@ Page({ wx.switchTab({ url: '/pages/passCar/passCar' }); - }, 1600); - // this.initUsrCarList() - // 领取 5.停车券 - // TODO 选取用户下的车牌 + }, 1600); } } }, - fail: res => { that.payOrderUpdate(that.data.orderId, payOrderId, 2,'','fail'); // 支付失败 return; @@ -346,16 +335,10 @@ Page({ complete: res => { } }); - /// End payment -------- - - ///// virtual pay - //var payOrderId = "" + res.data.out_trade_no; - //that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 - ///// end virtual pay }); } else { // 免费券 - that.payOrderUpdate(orderId, "0", 1); + that.payOrderUpdate(orderId, "0", 1, '', 'fail'); wx.setStorage({ key: 'couponNum', data: "couponNum" diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js index bee8b73..cc73ca9 100644 --- a/pages/order/detail/index.js +++ b/pages/order/detail/index.js @@ -116,9 +116,7 @@ Page({ signType: (res.data.signType) ? res.data.signType : "MD5", paySign: res.data.paySign, success: res => { - console.log(res); - that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 - console.log(res); + that.payOrderUpdate(that.data.orderId, payOrderId, 1,'','',that); // 支付成功 }, fail: res => { that.payOrderUpdate(that.data.orderId, payOrderId, 2,'','fail'); @@ -130,7 +128,7 @@ Page({ }); } else { // 免费券 - that.payOrderUpdate(orderId, "0", 1) // 支付成功 + that.payOrderUpdate(orderId, "0", 1,'','fail') // 支付成功 wx.showToast({ title: "支付成功", duration: 2000, @@ -141,7 +139,7 @@ Page({ /** * 支付订单更新 */ - payOrderUpdate: (orderId, payOrderId, status, reason,type) => { + payOrderUpdate: (orderId, payOrderId, status, reason,type,_this) => { // 支付成功 Http.post({ url: config.api.payOrderUpdate, @@ -176,7 +174,10 @@ Page({ } }) .catch(err => { - console.log("payOrderUpdate catch", err); + console.log(_this); + setTimeout(function () { + _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this); + }, 1500) }); },