|
@@ -24,7 +24,6 @@ Page({ |
|
|
|
|
|
|
|
|
phone: function () { |
|
|
phone: function () { |
|
|
let that = this; |
|
|
let that = this; |
|
|
console.log(that.data); |
|
|
|
|
|
if (that.data.data.merchantLinkPhone) { |
|
|
if (that.data.data.merchantLinkPhone) { |
|
|
wx.makePhoneCall({ |
|
|
wx.makePhoneCall({ |
|
|
phoneNumber: that.data.data.merchantLinkPhone |
|
|
phoneNumber: that.data.data.merchantLinkPhone |
|
@@ -99,7 +98,6 @@ Page({ |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
Http.get(parmer).then(res => { |
|
|
Http.get(parmer).then(res => { |
|
|
console.log(res.data); |
|
|
|
|
|
if (res.data.endTime){ |
|
|
if (res.data.endTime){ |
|
|
that.countdown(res.data.endTime); |
|
|
that.countdown(res.data.endTime); |
|
|
//当前时间与优惠券下架时间做计算 |
|
|
//当前时间与优惠券下架时间做计算 |
|
@@ -121,8 +119,8 @@ Page({ |
|
|
}); |
|
|
}); |
|
|
if (res.data.validType == 1) { |
|
|
if (res.data.validType == 1) { |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dddd"), |
|
|
|
|
|
validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dddd"), |
|
|
|
|
|
|
|
|
validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"), |
|
|
|
|
|
validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dd"), |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
that.setData({ |
|
|
that.setData({ |
|
@@ -134,7 +132,8 @@ Page({ |
|
|
/** |
|
|
/** |
|
|
* 支付订单更新 |
|
|
* 支付订单更新 |
|
|
*/ |
|
|
*/ |
|
|
payOrderUpdate: (orderId, payOrderId, status, reason) => { |
|
|
|
|
|
|
|
|
payOrderUpdate: (orderId, payOrderId, status, reason,type) => { |
|
|
|
|
|
let that=this; |
|
|
// 支付成功 |
|
|
// 支付成功 |
|
|
Http.post({ |
|
|
Http.post({ |
|
|
url: config.api.payOrderUpdate, |
|
|
url: config.api.payOrderUpdate, |
|
@@ -145,12 +144,22 @@ Page({ |
|
|
reason: reason |
|
|
reason: reason |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.then(res => { |
|
|
|
|
|
console.log("payOrderUpdate then", res); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
console.log("payOrderUpdate catch", err); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
.then(res => { |
|
|
|
|
|
console.log(that.payOrderUpdate()); |
|
|
|
|
|
console.log("成功"); |
|
|
|
|
|
if(!type){ |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: `/pages/order/detail/index?orderId=${ |
|
|
|
|
|
orderId |
|
|
|
|
|
}` |
|
|
|
|
|
}); |
|
|
|
|
|
}, 1000) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* 发起支付 |
|
|
* 发起支付 |
|
@@ -166,7 +175,6 @@ Page({ |
|
|
data: {} |
|
|
data: {} |
|
|
}) |
|
|
}) |
|
|
.then(res => { |
|
|
.then(res => { |
|
|
console.log(res); |
|
|
|
|
|
var data = { |
|
|
var data = { |
|
|
couponChannelId: "" + that.data.couponChannelId, |
|
|
couponChannelId: "" + that.data.couponChannelId, |
|
|
couponId: "" + that.data.couponId |
|
|
couponId: "" + that.data.couponId |
|
@@ -185,7 +193,6 @@ Page({ |
|
|
}); |
|
|
}); |
|
|
}) |
|
|
}) |
|
|
.catch(err => { |
|
|
.catch(err => { |
|
|
console.log(err); |
|
|
|
|
|
if (err.code == "2011") { |
|
|
if (err.code == "2011") { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: "商户信息没找到", |
|
|
title: "商户信息没找到", |
|
@@ -272,10 +279,7 @@ Page({ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.then(res => { |
|
|
.then(res => { |
|
|
console.log(res); |
|
|
|
|
|
console.log("点击领取卡券一直在loading"); |
|
|
|
|
|
if (typeof (res) != "undefined") { |
|
|
if (typeof (res) != "undefined") { |
|
|
console.log("", res); |
|
|
|
|
|
let orderId = "" + res.data.id; |
|
|
let orderId = "" + res.data.id; |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
orderId: orderId |
|
|
orderId: orderId |
|
@@ -291,7 +295,6 @@ Page({ |
|
|
orderId: orderId |
|
|
orderId: orderId |
|
|
} |
|
|
} |
|
|
}).then(res => { |
|
|
}).then(res => { |
|
|
console.log(res); |
|
|
|
|
|
/// Begin payment ---- |
|
|
/// Begin payment ---- |
|
|
var payOrderId = "" + res.data.payOrderId; |
|
|
var payOrderId = "" + res.data.payOrderId; |
|
|
wx.hideLoading(); |
|
|
wx.hideLoading(); |
|
@@ -302,19 +305,20 @@ 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 => { |
|
|
that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var timesRun = 0; |
|
|
|
|
|
var interval = setInterval(function () { |
|
|
|
|
|
timesRun += 1; |
|
|
|
|
|
if (timesRun === 3) { |
|
|
|
|
|
clearInterval(interval); |
|
|
|
|
|
} |
|
|
|
|
|
that.payOrderUpdate(that.data.orderId, payOrderId, 1, ); |
|
|
|
|
|
}, 2000); |
|
|
|
|
|
|
|
|
if (res.errMsg == "requestPayment:ok") { |
|
|
if (res.errMsg == "requestPayment:ok") { |
|
|
setTimeout(function () { |
|
|
setTimeout(function () { |
|
|
wx.hideLoading(); |
|
|
wx.hideLoading(); |
|
|
}, 2000); |
|
|
}, 2000); |
|
|
setTimeout(() => { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: `/pages/order/detail/index?orderId=${ |
|
|
|
|
|
that.data.orderId |
|
|
|
|
|
}` |
|
|
|
|
|
}); |
|
|
|
|
|
}, 1000) |
|
|
|
|
|
/** |
|
|
/** |
|
|
* 用户支付成功以后跳转到券包列表 |
|
|
* 用户支付成功以后跳转到券包列表 |
|
|
*/ |
|
|
*/ |
|
@@ -336,8 +340,7 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
fail: res => { |
|
|
fail: res => { |
|
|
that.payOrderUpdate(that.data.orderId, payOrderId, 2); // 支付失败 |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
|
|
|
that.payOrderUpdate(that.data.orderId, payOrderId, 2,'','fail'); // 支付失败 |
|
|
return; |
|
|
return; |
|
|
}, |
|
|
}, |
|
|
complete: res => { |
|
|
complete: res => { |
|
@@ -364,8 +367,6 @@ Page({ |
|
|
}` |
|
|
}` |
|
|
}); |
|
|
}); |
|
|
}, 1000) |
|
|
}, 1000) |
|
|
//////////////////////////停车券 |
|
|
|
|
|
console.log(that.data.data.type) |
|
|
|
|
|
if (that.data.data.type == 5) { |
|
|
if (that.data.data.type == 5) { |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
wx.switchTab({ |
|
|
wx.switchTab({ |
|
@@ -388,20 +389,16 @@ Page({ |
|
|
path: '/pages/index/index', |
|
|
path: '/pages/index/index', |
|
|
success: function (res) { |
|
|
success: function (res) { |
|
|
if (res.errMsg == 'shareAppMessage:ok') { |
|
|
if (res.errMsg == 'shareAppMessage:ok') { |
|
|
console.log(res) |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
fail: function (error) { |
|
|
fail: function (error) { |
|
|
if (res.errMsg == 'shareAppMessage:fail cancel') { |
|
|
if (res.errMsg == 'shareAppMessage:fail cancel') { |
|
|
console.log(error) |
|
|
|
|
|
} else if (res.errMsg == 'shareAppMessage:fail') { |
|
|
} else if (res.errMsg == 'shareAppMessage:fail') { |
|
|
console.log(error) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
// 来自页面内的按钮的转发 |
|
|
// 来自页面内的按钮的转发 |
|
|
if (options.from == 'button') { |
|
|
if (options.from == 'button') { |
|
|
console.log(options) |
|
|
|
|
|
var eData = options.target.dataset.id; |
|
|
var eData = options.target.dataset.id; |
|
|
var couponId = options.target.dataset.couponid; |
|
|
var couponId = options.target.dataset.couponid; |
|
|
// shareObj.path = `/pages/index/index?couponChannelId=${eData}&couponId=${couponId}`; |
|
|
// shareObj.path = `/pages/index/index?couponChannelId=${eData}&couponId=${couponId}`; |
|
|