@@ -1,4 +1,4 @@ | |||||
<navigator url="/pages/coupon/detail/index?id={{data.id}}"> | |||||
<navigator url="/pages/coupon/detail/index?id={{data.id}}&couponId={{data.couponId}}"> | |||||
<!-- 首页优惠券列表页面 --> | <!-- 首页优惠券列表页面 --> | ||||
<view class="coupons"> | <view class="coupons"> | ||||
<view class="coupons-img"> | <view class="coupons-img"> | ||||
@@ -5,6 +5,8 @@ const util = require("../../../utils/util"); | |||||
Page({ | Page({ | ||||
data: { | data: { | ||||
data: {}, | data: {}, | ||||
couponChannelId: null, | |||||
couponId: null, | |||||
orderId: "", | orderId: "", | ||||
day: "", | day: "", | ||||
hour: "", | hour: "", | ||||
@@ -13,6 +15,10 @@ Page({ | |||||
onLoad(options) { | onLoad(options) { | ||||
let that = this; | let that = this; | ||||
console.log(options.id); | console.log(options.id); | ||||
that.setData({ | |||||
couponChannelId: options.id, | |||||
couponId: options.couponId | |||||
}) | |||||
wx.showLoading({ | wx.showLoading({ | ||||
title: "加载中..." | title: "加载中..." | ||||
}); | }); | ||||
@@ -160,8 +166,8 @@ Page({ | |||||
return Http.post({ | return Http.post({ | ||||
url: config.api.orderSave, | url: config.api.orderSave, | ||||
data: { | data: { | ||||
couponChannelId: '' + that.data.data.id, | |||||
couponId: '' + that.data.data.couponId | |||||
couponChannelId: '' + that.data.couponChannelId, | |||||
couponId: '' + that.data.couponId | |||||
} | } | ||||
}); | }); | ||||
}) | }) | ||||
@@ -170,13 +176,13 @@ Page({ | |||||
if (err.code == 11005) { | if (err.code == 11005) { | ||||
// 用户手机未授权 | // 用户手机未授权 | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: "../../getphoneInfo/index?couponChannelId=" + that.data.id | |||||
url: "../../getphoneInfo/index?couponChannelId=" + that.data.couponChannelId + "&couponId=" + that.data.couponId | |||||
}); | }); | ||||
} | } | ||||
if (err.code == 11006) { | if (err.code == 11006) { | ||||
// 用户手机已加密 | // 用户手机已加密 | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: "../../phoneinput/phoneinput?couponChannelId=" + that.data.id | |||||
url: "../../phoneinput/phoneinput?couponChannelId=" + that.data.couponChannelId + "& couponId=" + that.data.couponId | |||||
}); | }); | ||||
} | } | ||||
}) | }) | ||||
@@ -197,8 +203,8 @@ Page({ | |||||
console.log(res); | console.log(res); | ||||
var payOrderId = "" + res.data.out_trade_no; | var payOrderId = "" + res.data.out_trade_no; | ||||
wx.hideLoading(); | wx.hideLoading(); | ||||
//payment(res); | |||||
that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | |||||
payment(res); | |||||
//that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | |||||
}); | }); | ||||
} else { | } else { | ||||
// 免费券 | // 免费券 | ||||
@@ -5,12 +5,14 @@ Page({ | |||||
data: { | data: { | ||||
canIUse: wx.canIUse('button.open-type.getPhoneNumber'), | canIUse: wx.canIUse('button.open-type.getPhoneNumber'), | ||||
couponChannelId: null, | couponChannelId: null, | ||||
couponId: null | |||||
}, | }, | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
var that = this; | var that = this; | ||||
console.log(options); | console.log(options); | ||||
that.setData({ | that.setData({ | ||||
couponChannelId: options.couponChannelId | |||||
couponChannelId: options.couponChannelId, | |||||
couponId: options.couponId | |||||
}) | }) | ||||
}, | }, | ||||
getPhoneNumber: function(e) { | getPhoneNumber: function(e) { | ||||
@@ -32,7 +34,8 @@ Page({ | |||||
icon: "success", | icon: "success", | ||||
success: function(res) { | success: function(res) { | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: '/pages/coupon/detail/index?id=' + that.data.couponChannelId + "&flag=pay", | |||||
url: '/pages/coupon/detail/index?id=' | |||||
+ that.data.couponChannelId + '&couponId='+ that.data.couponId +'&flag=pay", | |||||
}) | }) | ||||
} | } | ||||
}) | }) | ||||
@@ -36,12 +36,12 @@ Component({ | |||||
gotodetail: function(e) { | gotodetail: function(e) { | ||||
console.log(e); | console.log(e); | ||||
console.log("出错啦 大哥"); | console.log("出错啦 大哥"); | ||||
console.log(e.currentTarget.dataset.couponid); | |||||
console.log(e.currentTarget.dataset.id); | |||||
console.log(e.currentTarget.dataset.targetad); | console.log(e.currentTarget.dataset.targetad); | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: `/pages/coupon/detail/index?id=${ | url: `/pages/coupon/detail/index?id=${ | ||||
e.currentTarget.dataset.couponid | |||||
}&targetAd=${e.currentTarget.dataset.targetad}` | |||||
e.currentTarget.dataset.id | |||||
}&couponId=${e.currentTarget.dataset.couponId}` | |||||
}); | }); | ||||
} | } | ||||
}, | }, | ||||
@@ -10,12 +10,14 @@ Page({ | |||||
retry: false, | retry: false, | ||||
time: 60, | time: 60, | ||||
couponChannelId: null, | couponChannelId: null, | ||||
couponId:null | |||||
}, | }, | ||||
onLoad: function (options) { | onLoad: function (options) { | ||||
var that = this; | var that = this; | ||||
console.log(options); | console.log(options); | ||||
that.setData({ | that.setData({ | ||||
couponChannelId: options.couponChannelId | |||||
couponChannelId: options.couponChannelId, | |||||
couponId: options.couponId, | |||||
}) | }) | ||||
}, | }, | ||||
getYZM(e) { | getYZM(e) { | ||||