|
|
@@ -35,70 +35,75 @@ Page({ |
|
|
|
title: "加载中..." |
|
|
|
}); |
|
|
|
|
|
|
|
if (options.flag) { |
|
|
|
this.orderFunc(); |
|
|
|
} else { |
|
|
|
if (options.couponChannelId == "iambannercoupon") { |
|
|
|
that.setData({ |
|
|
|
couponId: options.couponId |
|
|
|
}); |
|
|
|
/** |
|
|
|
* 待解决 |
|
|
|
*/ |
|
|
|
var parmer = { |
|
|
|
url: config.api.bannercoupondetai, |
|
|
|
data: { |
|
|
|
couponId: options.couponId |
|
|
|
} |
|
|
|
}; |
|
|
|
} else { |
|
|
|
that.setData({ |
|
|
|
couponChannelId: options.couponChannelId, |
|
|
|
/** |
|
|
|
* 暂时注销 |
|
|
|
* this.orderFunc() |
|
|
|
*/ |
|
|
|
// if (options.flag) { |
|
|
|
// // this.orderFunc(); |
|
|
|
// } |
|
|
|
// else { |
|
|
|
if (options.couponChannelId == "iambannercoupon") { |
|
|
|
that.setData({ |
|
|
|
couponId: options.couponId |
|
|
|
}); |
|
|
|
/** |
|
|
|
* 待解决 |
|
|
|
*/ |
|
|
|
var parmer = { |
|
|
|
url: config.api.bannercoupondetai, |
|
|
|
data: { |
|
|
|
couponId: options.couponId |
|
|
|
}); |
|
|
|
var parmer = { |
|
|
|
url: config.api.couponDetail, |
|
|
|
data: { |
|
|
|
couponChannelId: options.couponChannelId |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
Http.get(parmer).then(res => { |
|
|
|
console.log(res); |
|
|
|
console.log("details"); |
|
|
|
//当前时间与优惠券下架时间做计算 |
|
|
|
var startTime = util.fmtDate(res.data.endTime); |
|
|
|
console.log(startTime); |
|
|
|
var s1 = new Date(startTime.replace(/-/g, "/")); |
|
|
|
var s2 = new Date(); |
|
|
|
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); |
|
|
|
var year = Math.floor(runTime / 86400 / 365); |
|
|
|
var runTime = runTime % (86400 * 365); |
|
|
|
var month = Math.floor(runTime / 86400 / 30); |
|
|
|
var runTime = runTime % (86400 * 30); |
|
|
|
var day = Math.floor(runTime / 86400); |
|
|
|
var runTime = runTime % 86400; |
|
|
|
var hour = Math.floor(runTime / 3600); |
|
|
|
var runTime = runTime % 3600; |
|
|
|
var minute = Math.floor(runTime / 60); |
|
|
|
var runTime = runTime % 60; |
|
|
|
var second = runTime; |
|
|
|
console.log(year, month, day, hour, minute, second); |
|
|
|
that.setData({ |
|
|
|
year: year, |
|
|
|
month: month, |
|
|
|
day: day, |
|
|
|
hour: hour, |
|
|
|
minute: minute |
|
|
|
}); |
|
|
|
console.log(that.data.day); |
|
|
|
wx.hideLoading(); |
|
|
|
that.setData({ |
|
|
|
data: res.data |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
} else { |
|
|
|
that.setData({ |
|
|
|
couponChannelId: options.couponChannelId, |
|
|
|
couponId: options.couponId |
|
|
|
}); |
|
|
|
var parmer = { |
|
|
|
url: config.api.couponDetail, |
|
|
|
data: { |
|
|
|
couponChannelId: options.couponChannelId |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
Http.get(parmer).then(res => { |
|
|
|
console.log(res); |
|
|
|
console.log("details"); |
|
|
|
//当前时间与优惠券下架时间做计算 |
|
|
|
var startTime = util.fmtDate(res.data.endTime); |
|
|
|
console.log(startTime); |
|
|
|
var s1 = new Date(startTime.replace(/-/g, "/")); |
|
|
|
var s2 = new Date(); |
|
|
|
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); |
|
|
|
var year = Math.floor(runTime / 86400 / 365); |
|
|
|
var runTime = runTime % (86400 * 365); |
|
|
|
var month = Math.floor(runTime / 86400 / 30); |
|
|
|
var runTime = runTime % (86400 * 30); |
|
|
|
var day = Math.floor(runTime / 86400); |
|
|
|
var runTime = runTime % 86400; |
|
|
|
var hour = Math.floor(runTime / 3600); |
|
|
|
var runTime = runTime % 3600; |
|
|
|
var minute = Math.floor(runTime / 60); |
|
|
|
var runTime = runTime % 60; |
|
|
|
var second = runTime; |
|
|
|
console.log(year, month, day, hour, minute, second); |
|
|
|
that.setData({ |
|
|
|
year: year, |
|
|
|
month: month, |
|
|
|
day: day, |
|
|
|
hour: hour, |
|
|
|
minute: minute |
|
|
|
}); |
|
|
|
console.log(that.data.day); |
|
|
|
wx.hideLoading(); |
|
|
|
that.setData({ |
|
|
|
data: res.data |
|
|
|
}); |
|
|
|
}); |
|
|
|
// } |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 支付订单更新 |
|
|
@@ -143,12 +148,13 @@ Page({ |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
console.log(res); |
|
|
|
console.log("姐姐在检查手机号是否授权的情况"); |
|
|
|
var data = { |
|
|
|
couponChannelId: "" + that.data.couponChannelId, |
|
|
|
couponId: "" + that.data.couponId |
|
|
|
}; |
|
|
|
if (that.data.couponChannelId == null) { |
|
|
|
data = { |
|
|
|
var data = { |
|
|
|
couponId: "" + that.data.couponId |
|
|
|
}; |
|
|
|
} |
|
|
@@ -162,11 +168,18 @@ Page({ |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.log(err); |
|
|
|
console.log(that.data.couponChannelId); |
|
|
|
console.log(that.data.couponId); |
|
|
|
console.log("我即将要跳转到用户手机号授权的页面"); |
|
|
|
if (err.code == 11005) { |
|
|
|
// 用户手机未授权 |
|
|
|
/** |
|
|
|
* 将值传到用户手机号授权的页面 |
|
|
|
* |
|
|
|
*/ |
|
|
|
wx.redirectTo({ |
|
|
|
url: |
|
|
|
"../../getphoneInfo/index?couponChannelId=" + |
|
|
|
"/pages/getphoneInfo/index?couponChannelId=" + |
|
|
|
that.data.couponChannelId + |
|
|
|
"&couponId=" + |
|
|
|
that.data.couponId |
|
|
@@ -176,9 +189,9 @@ Page({ |
|
|
|
// 用户手机已加密 |
|
|
|
wx.redirectTo({ |
|
|
|
url: |
|
|
|
"../../phoneinput/phoneinput?couponChannelId=" + |
|
|
|
"/pages/phoneinput/phoneinput?couponChannelId=" + |
|
|
|
that.data.couponChannelId + |
|
|
|
"& couponId=" + |
|
|
|
"&couponId=" + |
|
|
|
that.data.couponId |
|
|
|
}); |
|
|
|
} |
|
|
@@ -187,7 +200,8 @@ Page({ |
|
|
|
console.log(res); |
|
|
|
console.log("点击领取卡券一直在loading"); |
|
|
|
if (res != "undefined") { |
|
|
|
const orderId = "" + res.data.id; |
|
|
|
console.log(res); |
|
|
|
let orderId = "" + res.data.id; |
|
|
|
that.setData({ |
|
|
|
orderId: orderId |
|
|
|
}); |
|
|
@@ -203,7 +217,6 @@ Page({ |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
console.log(res); |
|
|
|
|
|
|
|
/// Begin payment ---- |
|
|
|
var payOrderId = "" + res.data.payOrderId; |
|
|
|
wx.hideLoading(); |
|
|
@@ -223,11 +236,13 @@ Page({ |
|
|
|
title: "购买成功", |
|
|
|
duration: 2500 |
|
|
|
}); |
|
|
|
/** |
|
|
|
* 用户支付成功以后跳转到券包列表 |
|
|
|
*/ |
|
|
|
wx.redirectTo({ |
|
|
|
url: '/pages/couponorder/index/index', |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
wx.navigateBack({ |
|
|
|
delta: 2 |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
fail: res => { |
|
|
|