| this.getTicketUser(options.id, 1) | this.getTicketUser(options.id, 1) | ||||
| this.getCodeFn(options.id) | this.getCodeFn(options.id) | ||||
| } else { | } else { | ||||
| this.globalData.openidSuccessFuc = this.getTicketUser; | |||||
| this.globalData.openidSuccessFuc = this.getCodeFn; | |||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | |||||
| app.globalData.openidSuccessFuc = this.getCodeFn; | |||||
| } | } | ||||
| }, | }, | ||||
| getTicketUser: function (id,from) {//获取优惠券信息 | getTicketUser: function (id,from) {//获取优惠券信息 |
| if (app.globalData.openid) { | if (app.globalData.openid) { | ||||
| this.getTicketUser(options.index, 1) | this.getTicketUser(options.index, 1) | ||||
| } else { | } else { | ||||
| this.globalData.openidSuccessFuc = this.getTicketUser; | |||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | |||||
| } | } | ||||
| }, | }, | ||||
| app.wxRequest(app.globalData.httpUrl + 'order/paid', { sign_num: this.data.sign_num}, e => { | app.wxRequest(app.globalData.httpUrl + 'order/paid', { sign_num: this.data.sign_num}, e => { | ||||
| console.log(e) | console.log(e) | ||||
| if (e.code == 200) { | if (e.code == 200) { | ||||
| wx.switchTab({ | |||||
| url: '../buyTicket/buyTicket' | |||||
| wx.reLaunch({ | |||||
| url: '/pages/personalCenter/personalCenter' | |||||
| }) | }) | ||||
| } | } | ||||
| }, this,"POST") | }, this,"POST") |
| if (app.globalData.openid) { | if (app.globalData.openid) { | ||||
| this.getTicketUser(options.id, 2) | this.getTicketUser(options.id, 2) | ||||
| } else { | } else { | ||||
| this.globalData.openidSuccessFuc = this.getTicketUser; | |||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | |||||
| } | } | ||||
| this.data.sellId = options.id; | this.data.sellId = options.id; | ||||
| }, | }, |
| if (app.globalData.openid){ | if (app.globalData.openid){ | ||||
| this.getDataList(); | this.getDataList(); | ||||
| }else{ | }else{ | ||||
| this.globalData.openidSuccessFuc = this.getDataList; | |||||
| app.globalData.openidSuccessFuc = this.getDataList; | |||||
| } | } | ||||
| }, | }, |
| this.myTicket(); | this.myTicket(); | ||||
| this.historyTicket(); | this.historyTicket(); | ||||
| } else { | } else { | ||||
| this.globalData.openidSuccessFuc = this.myTicket; | |||||
| this.globalData.openidSuccessFuc = this.historyTicket; | |||||
| app.globalData.openidSuccessFuc = this.myTicket; | |||||
| app.globalData.openidSuccessFuc = this.historyTicket; | |||||
| } | } | ||||
| }, | }, | ||||
| myTicket:function(){//获取我的优惠券列表 | myTicket:function(){//获取我的优惠券列表 |
| if (app.globalData.openid) { | if (app.globalData.openid) { | ||||
| this.getTicketUser(options.shareId, options.number); | this.getTicketUser(options.shareId, options.number); | ||||
| } else { | } else { | ||||
| this.globalData.openidSuccessFuc = this.getTicketUser; | |||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | |||||
| } | } | ||||
| }, | }, | ||||
| num:60, | num:60, | ||||
| phone: "",//手机号 | phone: "",//手机号 | ||||
| phoneCode: "",//验证码 | phoneCode: "",//验证码 | ||||
| yesRegister:false,//防止重复点击注册 | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
| */ | */ | ||||
| onShow: function () { | onShow: function () { | ||||
| if (wx.canIUse('hideHomeButton')) { | |||||
| wx.hideHomeButton() | |||||
| } | |||||
| }, | }, | ||||
| /** | /** | ||||
| if (app.globalData.openid) { | if (app.globalData.openid) { | ||||
| this.yesCodeFn(); | this.yesCodeFn(); | ||||
| } else { | } else { | ||||
| this.globalData.openidSuccessFuc = this.yesCodeFn; | |||||
| app.globalData.openidSuccessFuc = this.yesCodeFn; | |||||
| } | } | ||||
| }, | }, | ||||
| if (app.globalData.openid) { | if (app.globalData.openid) { | ||||
| this.registerFn(); | this.registerFn(); | ||||
| } else { | } else { | ||||
| this.globalData.openidSuccessFuc = this.registerFn; | |||||
| app.globalData.openidSuccessFuc = this.registerFn; | |||||
| } | } | ||||
| }, | }, | ||||
| registerFn:function(){//注册接口 | registerFn:function(){//注册接口 | ||||
| if (this.data.yesRegister){ | |||||
| return; | |||||
| } | |||||
| this.data.yesRegister = true; | |||||
| app.wxRequest(app.globalData.httpUrl + 'register', { user_phone: this.data.phone, code_num: this.data.phoneCode }, e => { | app.wxRequest(app.globalData.httpUrl + 'register', { user_phone: this.data.phone, code_num: this.data.phoneCode }, e => { | ||||
| console.log(e) | console.log(e) | ||||
| if (e.code == 200) { | if (e.code == 200) { | ||||
| clearInterval(time); | clearInterval(time); | ||||
| app.globalData.userInfo = e.data.user_phone | app.globalData.userInfo = e.data.user_phone | ||||
| this.data.yesRegister = false; | |||||
| this.setData({ | this.setData({ | ||||
| minter: 60, | minter: 60, | ||||
| num: 60 | num: 60 |
| { | { | ||||
| "usingComponents": {} | |||||
| "usingComponents": {}, | |||||
| "navigationBarTitleText": "注册" | |||||
| } | } |
| this.data.dataArr = []; | this.data.dataArr = []; | ||||
| this.searchShop(true); | this.searchShop(true); | ||||
| }, | }, | ||||
| deleteVal:function(){//清空搜索框 | |||||
| this.setData({ | |||||
| inputVal:"" | |||||
| }) | |||||
| this.data.pageNum = 1; | |||||
| this.data.dataArr = []; | |||||
| this.searchShop(true); | |||||
| }, | |||||
| }) | }) |
| <view class="searchView"> | <view class="searchView"> | ||||
| <image class="searchIcon" src="../images/searchIcon.png"></image> | <image class="searchIcon" src="../images/searchIcon.png"></image> | ||||
| <input class="int" bindinput="getInputVal" value="{{inputVal}}" placeholder="输入搜索内容" placeholder-class="placeholderInt"></input> | <input class="int" bindinput="getInputVal" value="{{inputVal}}" placeholder="输入搜索内容" placeholder-class="placeholderInt"></input> | ||||
| <image class="delete" bindtap="deleteVal" src="../images/delete.png"></image> | |||||
| </view> | </view> | ||||
| <view class="searchBtn" bindtap="searchFn">搜索</view> | <view class="searchBtn" bindtap="searchFn">搜索</view> | ||||
| </view> | </view> |
| margin-bottom: 40rpx; | margin-bottom: 40rpx; | ||||
| } | } | ||||
| .delete{ | |||||
| width: 35rpx; | |||||
| height: 38rpx; | |||||
| position: absolute; | |||||
| right: 0; | |||||
| top: 12rpx; | |||||
| z-index: 9; | |||||
| } |