Procházet zdrojové kódy

[支付订单状态的更新][修改]:支付订单状态更新回调

tags/富茂链客_2.2.6
meo před 6 roky
rodič
revize
68e74d8091
3 změnil soubory, kde provedl 16 přidání a 32 odebrání
  1. +1
    -1
      app.json
  2. +8
    -25
      pages/coupon/detail/index.js
  3. +7
    -6
      pages/order/detail/index.js

+ 1
- 1
app.json Zobrazit soubor

@@ -64,7 +64,7 @@
"navigationBarTextStyle": "white"
},
"networkTimeout": {
"request": 10000,
"request": 30000,
"downloadFile": 10000
},
"debug": false

+ 8
- 25
pages/coupon/detail/index.js Zobrazit soubor

@@ -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"


+ 7
- 6
pages/order/detail/index.js Zobrazit soubor

@@ -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)
});
},



Načítá se…
Zrušit
Uložit