ソースを参照

add todo for 停车券

tags/2.2.4
Stormeye.Wu 6年前
コミット
49594b4216
1個のファイルの変更72行の追加67行の削除
  1. +72
    -67
      pages/coupon/detail/index.js

+ 72
- 67
pages/coupon/detail/index.js ファイルの表示

@@ -67,14 +67,14 @@ Page({
payOrderUpdate: (orderId, payOrderId, status, reason) => {
// 支付成功
Http.post({
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
.then(res => {
console.log("payOrderUpdate then", res);
wx.showToast({
@@ -149,68 +149,73 @@ Page({
wx.showLoading({
title: "加载中..."
});
Http.post({
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
return Http.post({
url: config.api.orderSave,
data: {
couponId: that.data.couponId
}
});
if (that.data.type == 5) {
// 领取 5.停车券
// TODO 选取用户下的车牌
} else {
Http.post({
url: config.api.checkPhoneStatus,
data: {}
})
.catch(err => {
console.log(err);
if (err.code == 11005) {
// 用户手机未授权
wx.redirectTo({
url: "../../getphoneInfo/index?couponId=" + that.data.couponId
});
}
if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "../../phoneinput/phoneinput?couponId=" + that.data.couponId
.then(res => {
return Http.post({
url: config.api.orderSave,
data: {
couponId: that.data.couponId
}
});
}
})
.then(res => {
if (res != "undefined") {
const orderId = "" + res.data.id;
that.setData({
orderId: orderId
});
if (res.data.payment > 0) {
// 支付金额不为0
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
}).then(res => {
console.log(res);
var payOrderId = "" + res.data.out_trade_no;
wx.hideLoading();
//payment(res);
that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功
})
.catch(err => {
console.log(err);
if (err.code == 11005) {
// 用户手机未授权
wx.redirectTo({
url: "../../getphoneInfo/index?couponId=" + that.data.couponId
});
} else {
// 免费券
that
.payOrderUpdate(orderId, "0", 1) // 支付成功
.then(res => {
wx.showToast({
title: "支付成功",
duration: 3000
});
}
if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "../../phoneinput/phoneinput?couponId=" + that.data.couponId
});
}
})
.then(res => {
if (res != "undefined") {
const orderId = "" + res.data.id;
that.setData({
orderId: orderId
});
if (res.data.payment > 0) {
// 支付金额不为0
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
}).then(res => {
console.log(res);
var payOrderId = "" + res.data.out_trade_no;
wx.hideLoading();
//payment(res);
that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功
});
} else {
// 免费券
that
.payOrderUpdate(orderId, "0", 1) // 支付成功
.then(res => {
wx.showToast({
title: "支付成功",
duration: 3000
});
});
}
}
}
})
.catch(err => {
console.log(err);
});
})
.catch(err => {
console.log(err);
});
}
}
});
});

読み込み中…
キャンセル
保存