|
@@ -67,14 +67,14 @@ Page({ |
|
|
payOrderUpdate: (orderId, payOrderId, status, reason) => { |
|
|
payOrderUpdate: (orderId, payOrderId, status, reason) => { |
|
|
// 支付成功 |
|
|
// 支付成功 |
|
|
Http.post({ |
|
|
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 => { |
|
|
.then(res => { |
|
|
console.log("payOrderUpdate then", res); |
|
|
console.log("payOrderUpdate then", res); |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
@@ -149,68 +149,73 @@ Page({ |
|
|
wx.showLoading({ |
|
|
wx.showLoading({ |
|
|
title: "加载中..." |
|
|
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); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
}); |