浏览代码

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

tags/富茂链客_2.2.6
meo 6 年前
父节点
当前提交
68e74d8091
共有 3 个文件被更改,包括 16 次插入32 次删除
  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 查看文件

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

+ 8
- 25
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; let that=this;
// 支付成功 // 支付成功
Http.post({ Http.post({
@@ -145,7 +145,6 @@ Page({
} }
}) })
.then(res => { .then(res => {
console.log(that.payOrderUpdate());
console.log("成功"); console.log("成功");
if(!type){ if(!type){
setTimeout(() => { setTimeout(() => {
@@ -158,7 +157,10 @@ Page({
} }
}) })
.catch(err => { .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", signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign, paySign: res.data.paySign,
success: res => { 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") { if (res.errMsg == "requestPayment:ok") {
setTimeout(function () { setTimeout(function () {
wx.hideLoading(); wx.hideLoading();
@@ -331,14 +324,10 @@ Page({
wx.switchTab({ wx.switchTab({
url: '/pages/passCar/passCar' url: '/pages/passCar/passCar'
}); });
}, 1600);
// this.initUsrCarList()
// 领取 5.停车券
// TODO 选取用户下的车牌
}, 1600);
} }
} }
}, },

fail: res => { fail: res => {
that.payOrderUpdate(that.data.orderId, payOrderId, 2,'','fail'); // 支付失败 that.payOrderUpdate(that.data.orderId, payOrderId, 2,'','fail'); // 支付失败
return; return;
@@ -346,16 +335,10 @@ Page({
complete: res => { complete: res => {
} }
}); });
/// End payment --------

///// virtual pay
//var payOrderId = "" + res.data.out_trade_no;
//that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功
///// end virtual pay
}); });
} else { } else {
// 免费券 // 免费券
that.payOrderUpdate(orderId, "0", 1);
that.payOrderUpdate(orderId, "0", 1, '', 'fail');
wx.setStorage({ wx.setStorage({
key: 'couponNum', key: 'couponNum',
data: "couponNum" data: "couponNum"


+ 7
- 6
pages/order/detail/index.js 查看文件

@@ -116,9 +116,7 @@ Page({
signType: (res.data.signType) ? res.data.signType : "MD5", signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign, paySign: res.data.paySign,
success: res => { 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 => { fail: res => {
that.payOrderUpdate(that.data.orderId, payOrderId, 2,'','fail'); that.payOrderUpdate(that.data.orderId, payOrderId, 2,'','fail');
@@ -130,7 +128,7 @@ Page({
}); });
} else { } else {
// 免费券 // 免费券
that.payOrderUpdate(orderId, "0", 1) // 支付成功
that.payOrderUpdate(orderId, "0", 1,'','fail') // 支付成功
wx.showToast({ wx.showToast({
title: "支付成功", title: "支付成功",
duration: 2000, duration: 2000,
@@ -141,7 +139,7 @@ Page({
/** /**
* 支付订单更新 * 支付订单更新
*/ */
payOrderUpdate: (orderId, payOrderId, status, reason,type) => {
payOrderUpdate: (orderId, payOrderId, status, reason,type,_this) => {
// 支付成功 // 支付成功
Http.post({ Http.post({
url: config.api.payOrderUpdate, url: config.api.payOrderUpdate,
@@ -176,7 +174,10 @@ Page({
} }
}) })
.catch(err => { .catch(err => {
console.log("payOrderUpdate catch", err);
console.log(_this);
setTimeout(function () {
_this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this);
}, 1500)
}); });
}, },




正在加载...
取消
保存