diff --git a/pages/exchange/exchange.js b/pages/exchange/exchange.js index 58673e1..6e76116 100644 --- a/pages/exchange/exchange.js +++ b/pages/exchange/exchange.js @@ -9,7 +9,15 @@ Page({ * 页面的初始数据 */ data: { - navigationBarHeight + navigationBarHeight, + exchange:"" + }, + onLoad(options){ + if (options&&options.exchange){ + this.setData({ + exchange: options.exchange + }) + } }, // 兑换 exchange(e){ @@ -24,7 +32,7 @@ Page({ }) return; } - that.checkPhoneStatus(e.detail.value.code,formId = e.detail.formId); + that.checkPhoneStatus(e.detail.value.code,e.detail.formId); }, checkPhoneStatus: function (password, formId) { let that = this; @@ -42,7 +50,7 @@ Page({ * */ wx.redirectTo({ - url: "/pages/getphoneInfo/index", + url: `/pages/getphoneInfo/index?exchange=${password}`, }) } else { wx.showToast({ @@ -55,10 +63,16 @@ Page({ }, getCouponOrderByPassword(password, formId) { let that = this; + let passwords; + if(that.data.exchange){ + passwords = that.data.exchange + }else{ + passwords = password + } Http.post({ url: config.api.getCouponOrderByPassword, data: { - password: password, + password: passwords, formId: formId } }) diff --git a/pages/exchange/exchange.wxml b/pages/exchange/exchange.wxml index d72f224..0b3af9a 100644 --- a/pages/exchange/exchange.wxml +++ b/pages/exchange/exchange.wxml @@ -1,7 +1,7 @@
- +
diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index eb4b156..f740ed2 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -25,7 +25,11 @@ Page({ couponChannelId: options.couponChannelId }); } - + if (options && options.exchange) { + that.setData({ + exchange: options.exchange + }); + } if (options && options.mineFlag) { that.setData({ mineFlag: options.mineFlag @@ -123,6 +127,16 @@ Page({ wx.switchTab({ url: '/index/user' }); + } + // 兑换 + else if (that.data.exchange) { + wx.redirectTo({ + url: `/pages/exchange/exchange?exchange=${that.data.exchange}` + }) + } else if (that.data.mineFlag == 'mine') { + wx.switchTab({ + url: '/index/user' + }); } else { wx.showToast({ title: res.data.msg,