| @@ -9,7 +9,15 @@ Page({ | |||||
| * 页面的初始数据 | * 页面的初始数据 | ||||
| */ | */ | ||||
| data: { | data: { | ||||
| navigationBarHeight | |||||
| navigationBarHeight, | |||||
| exchange:"" | |||||
| }, | |||||
| onLoad(options){ | |||||
| if (options&&options.exchange){ | |||||
| this.setData({ | |||||
| exchange: options.exchange | |||||
| }) | |||||
| } | |||||
| }, | }, | ||||
| // 兑换 | // 兑换 | ||||
| exchange(e){ | exchange(e){ | ||||
| @@ -24,7 +32,7 @@ Page({ | |||||
| }) | }) | ||||
| return; | return; | ||||
| } | } | ||||
| that.checkPhoneStatus(e.detail.value.code,formId = e.detail.formId); | |||||
| that.checkPhoneStatus(e.detail.value.code,e.detail.formId); | |||||
| }, | }, | ||||
| checkPhoneStatus: function (password, formId) { | checkPhoneStatus: function (password, formId) { | ||||
| let that = this; | let that = this; | ||||
| @@ -42,7 +50,7 @@ Page({ | |||||
| * | * | ||||
| */ | */ | ||||
| wx.redirectTo({ | wx.redirectTo({ | ||||
| url: "/pages/getphoneInfo/index", | |||||
| url: `/pages/getphoneInfo/index?exchange=${password}`, | |||||
| }) | }) | ||||
| } else { | } else { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| @@ -55,10 +63,16 @@ Page({ | |||||
| }, | }, | ||||
| getCouponOrderByPassword(password, formId) { | getCouponOrderByPassword(password, formId) { | ||||
| let that = this; | let that = this; | ||||
| let passwords; | |||||
| if(that.data.exchange){ | |||||
| passwords = that.data.exchange | |||||
| }else{ | |||||
| passwords = password | |||||
| } | |||||
| Http.post({ | Http.post({ | ||||
| url: config.api.getCouponOrderByPassword, | url: config.api.getCouponOrderByPassword, | ||||
| data: { | data: { | ||||
| password: password, | |||||
| password: passwords, | |||||
| formId: formId | formId: formId | ||||
| } | } | ||||
| }) | }) | ||||
| @@ -1,7 +1,7 @@ | |||||
| <navbar text="兑换" home back background='#FD832D' color="white"></navbar> | <navbar text="兑换" home back background='#FD832D' color="white"></navbar> | ||||
| <form bindsubmit='exchange' report-submit='true'> | <form bindsubmit='exchange' report-submit='true'> | ||||
| <view class="section" style="padding-top:{{navigationBarHeight}};"> | <view class="section" style="padding-top:{{navigationBarHeight}};"> | ||||
| <input name='code'placeholder="请输入兑换码" clearable/> | |||||
| <input name='code' value="{{exchange}}" placeholder="请输入兑换码" clearable/> | |||||
| <button size="{{primarySize}}" style="background:#FD832D;color:#fff;" hover-class="opcaity" form-type="submit">兑换</button> | <button size="{{primarySize}}" style="background:#FD832D;color:#fff;" hover-class="opcaity" form-type="submit">兑换</button> | ||||
| </view> | </view> | ||||
| </form> | </form> | ||||
| @@ -25,7 +25,11 @@ Page({ | |||||
| couponChannelId: options.couponChannelId | couponChannelId: options.couponChannelId | ||||
| }); | }); | ||||
| } | } | ||||
| if (options && options.exchange) { | |||||
| that.setData({ | |||||
| exchange: options.exchange | |||||
| }); | |||||
| } | |||||
| if (options && options.mineFlag) { | if (options && options.mineFlag) { | ||||
| that.setData({ | that.setData({ | ||||
| mineFlag: options.mineFlag | mineFlag: options.mineFlag | ||||
| @@ -123,6 +127,16 @@ Page({ | |||||
| wx.switchTab({ | wx.switchTab({ | ||||
| url: '/index/user' | 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 { | } else { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| title: res.data.msg, | title: res.data.msg, | ||||