|
|
@@ -16,18 +16,59 @@ Page({ |
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
orderfunc(){
|
|
|
|
orderfunc() {
|
|
|
|
/*
|
|
|
|
var couponOrderId = '189631451703017472';
|
|
|
|
var orderId = '189631451640102912';
|
|
|
|
var payOrderId = '189631462532710400';
|
|
|
|
var status = 1;
|
|
|
|
var reason = '';
|
|
|
|
Common.refundCouponOrder(couponOrderId)
|
|
|
|
.then(res => {
|
|
|
|
console.log(res);
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
Common.refundOrderCreate(orderId, payOrderId)
|
|
|
|
.then(res => {
|
|
|
|
console.log(res);
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
wx.showToast({
|
|
|
|
title: res.data.message,
|
|
|
|
duration: 3000
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
Common.payOrderUpdate(orderId, payOrderId, status, reason)
|
|
|
|
.then(res =>{
|
|
|
|
console.log(res);
|
|
|
|
})
|
|
|
|
*/
|
|
|
|
|
|
|
|
wx.showLoading({
|
|
|
|
title: '加载中...',
|
|
|
|
})
|
|
|
|
console.log(this.data.couponId)
|
|
|
|
Common.orderSave(''+this.data.couponId)
|
|
|
|
.then(res => {
|
|
|
|
wx.hideLoading();
|
|
|
|
console.log(res)
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
return res;
|
|
|
|
var couponId = '' + this.data.couponId;
|
|
|
|
console.log("order coupon: " + couponId)
|
|
|
|
Common.orderSave(couponId)
|
|
|
|
.then(res => {
|
|
|
|
console.log(res)
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
var orderId = '' + res.data.data.id;
|
|
|
|
if (res.data.data.payment > 0) {
|
|
|
|
return Common.payOrderCreate(orderId)
|
|
|
|
} else {
|
|
|
|
Common.payOrderUpdate(orderId, "0", 1) // 支付成功
|
|
|
|
.then(res =>{
|
|
|
|
wx.showToast({
|
|
|
|
title: res.data.message,
|
|
|
|
duration: 3000
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
wx.hideLoading();
|
|
|
|
wx.showToast({
|
|
|
|
title: res.data.message,
|
|
|
|
duration: 3000
|
|
|
@@ -35,12 +76,8 @@ Page({ |
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
orderId = '' + res.data.data.id;
|
|
|
|
return Common.payOrderCreate(orderId)
|
|
|
|
})
|
|
|
|
.then(res =>{
|
|
|
|
console.log(res)
|
|
|
|
payOrderId = res.data.data.payOrderId;
|
|
|
|
var payOrderId = '' + res.data.data.payOrderId;
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
wx.requestPayment({
|
|
|
|
timeStamp: res.data.data.timeStamp,
|
|
|
@@ -48,7 +85,7 @@ Page({ |
|
|
|
package: res.data.data.package,
|
|
|
|
signType: 'MD5',
|
|
|
|
paySign: res.data.data.paySign,
|
|
|
|
'success': function (res) {
|
|
|
|
'success': function(res) {
|
|
|
|
Common.payOrderUpdate(orderId, payOrderId, 1); // 支付成功
|
|
|
|
console.log(res);
|
|
|
|
console.log('支付成功');
|
|
|
@@ -60,13 +97,13 @@ Page({ |
|
|
|
delta: 2
|
|
|
|
})
|
|
|
|
},
|
|
|
|
'fail': function (res) {
|
|
|
|
'fail': function(res) {
|
|
|
|
Common.payOrderUpdate(orderId, payOrderId, 2); // 支付失败
|
|
|
|
console.log(res)
|
|
|
|
console.log('支付失败');
|
|
|
|
return;
|
|
|
|
},
|
|
|
|
'complete': function (res) {
|
|
|
|
'complete': function(res) {
|
|
|
|
console.log(res);
|
|
|
|
console.log('支付完成');
|
|
|
|
var url = that.data.url;
|
|
|
@@ -96,7 +133,13 @@ Page({ |
|
|
|
return;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
wx.showModal({
|
|
|
|
title: '错误提示',
|
|
|
|
content: res.data.message
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
wx.hideLoading();
|
|
|
|
}
|
|
|
|
}) |