| } | } | ||||
| }) | }) | ||||
| }else{ | }else{ | ||||
| this.globalData.openid = openid; | |||||
| this.globalData.openId = openid; | |||||
| } | } | ||||
| this.getUserType(); | this.getUserType(); | ||||
| // 获取用户信息 | // 获取用户信息 | ||||
| }, | }, | ||||
| wxRequest: function (url, params, callback, thisArg, methods, openid) { | wxRequest: function (url, params, callback, thisArg, methods, openid) { | ||||
| let that = this; | let that = this; | ||||
| // console.log(this.globalData.openid) | |||||
| // console.log(this.globalData.openId) | |||||
| var httpUrl = url; | var httpUrl = url; | ||||
| var str = ""; | var str = ""; | ||||
| var count = 0; | var count = 0; | ||||
| method: methods, | method: methods, | ||||
| header: { | header: { | ||||
| "content-type": "application/x-www-form-urlencoded", | "content-type": "application/x-www-form-urlencoded", | ||||
| "openid": this.globalData.openid | |||||
| "openid": this.globalData.openId | |||||
| }, | }, | ||||
| success: function (re) { | success: function (re) { | ||||
| // if (re.data.code == -1002) { | // if (re.data.code == -1002) { | ||||
| url: httpUrl, | url: httpUrl, | ||||
| method: methods, | method: methods, | ||||
| header: { | header: { | ||||
| "openid": this.globalData.openid, | |||||
| "openid": this.globalData.openId, | |||||
| }, | }, | ||||
| success: function (re) { | success: function (re) { | ||||
| // if (re.data.code == -1002) { | // if (re.data.code == -1002) { |
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(options.id) | console.log(options.id) | ||||
| if (app.globalData.openid) { | |||||
| if (app.globalData.openId) { | |||||
| this.getTicketUser(options.id, 1) | this.getTicketUser(options.id, 1) | ||||
| this.getCodeFn(options.id) | this.getCodeFn(options.id) | ||||
| } else { | } else { |
| width: 100%; | width: 100%; | ||||
| height: 190rpx; | height: 190rpx; | ||||
| display: flex; | display: flex; | ||||
| justify-content: center; | |||||
| justify-content: space-between; | |||||
| align-items: center; | align-items: center; | ||||
| } | } | ||||
| .ticketName{ | |||||
| margin-left: 96rpx; | |||||
| } | |||||
| .lineRig{ | |||||
| margin-right: 55rpx; | |||||
| } | |||||
| .line{ | .line{ | ||||
| margin-left: 94rpx; | margin-left: 94rpx; | ||||
| margin-right: 46rpx; | margin-right: 46rpx; | ||||
| } | } | ||||
| .codeImg{ | .codeImg{ | ||||
| width: 200rpx; | width: 200rpx; | ||||
| height: 200rpx; | |||||
| height: 200rpx | |||||
| } | } | ||||
| /* .scrollY{ | /* .scrollY{ |
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(options) | console.log(options) | ||||
| if (app.globalData.openid) { | |||||
| if (app.globalData.openId) { | |||||
| this.getTicketUser(options.index, 1) | this.getTicketUser(options.index, 1) | ||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
| } | } | ||||
| }, this,"POST") | }, this,"POST") | ||||
| }, | }, | ||||
| getInputVal:function(e){ | |||||
| if (e.detail.value < 1) { | |||||
| wx.showToast({ | |||||
| title: "购买量最小为1", | |||||
| duration: 1000 | |||||
| }) | |||||
| this.setData({ | |||||
| buyNumber: 1, | |||||
| ticketNum: 1 | |||||
| }) | |||||
| } else { | |||||
| this.setData({ | |||||
| buyNumber: e.detail.value, | |||||
| num: e.detail.value | |||||
| }) | |||||
| } | |||||
| console.log(this.data.buyNumber) | |||||
| }, | |||||
| }) | }) |
| <view bindtap="subtractFn" class="subtractView"> | <view bindtap="subtractFn" class="subtractView"> | ||||
| <image class="subtract" src="../images/subtract.png"></image> | <image class="subtract" src="../images/subtract.png"></image> | ||||
| </view> | </view> | ||||
| <text class="textNum">{{buyNumber}}</text> | |||||
| <!-- <text class="textNum">{{buyNumber}}</text> --> | |||||
| <input class="inputNum" type="number" bindinput="getInputVal" value="{{buyNumber}}"></input> | |||||
| <image bindtap="addFn" class="textAdd" src="../images/add.png"></image> | <image bindtap="addFn" class="textAdd" src="../images/add.png"></image> | ||||
| </view> | </view> | ||||
| </view> | </view> |
| width: 100%; | width: 100%; | ||||
| height: 190rpx; | height: 190rpx; | ||||
| display: flex; | display: flex; | ||||
| justify-content: center; | |||||
| justify-content: space-between; | |||||
| align-items: center; | align-items: center; | ||||
| } | } | ||||
| .line{ | .line{ | ||||
| .chooseNum{ | .chooseNum{ | ||||
| display: flex; | display: flex; | ||||
| align-items: center; | align-items: center; | ||||
| margin-right: 50rpx; | |||||
| } | } | ||||
| .chooseNum text{ | .chooseNum text{ | ||||
| font-size: 30rpx; | font-size: 30rpx; | ||||
| font-weight:bold; | font-weight:bold; | ||||
| color:rgba(51,51,51,1); | color:rgba(51,51,51,1); | ||||
| } | } | ||||
| .textNum{ | |||||
| margin: 0 25rpx; | |||||
| .inputNum{ | |||||
| width: 70rpx; | |||||
| margin: 0 15rpx; | |||||
| text-align: center; | |||||
| } | } | ||||
| .subtract{ | .subtract{ | ||||
| width: 28rpx; | width: 28rpx; | ||||
| font-family:SourceHanSansCN; | font-family:SourceHanSansCN; | ||||
| font-weight:bold; | font-weight:bold; | ||||
| color:rgba(51,51,51,1); | color:rgba(51,51,51,1); | ||||
| margin-left:96rpx; | |||||
| } | } | ||||
| .title{ | .title{ |
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(options.id) | console.log(options.id) | ||||
| if (app.globalData.openid) { | |||||
| if (app.globalData.openId) { | |||||
| this.getTicketUser(options.id, 2) | this.getTicketUser(options.id, 2) | ||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; | ||||
| }) | }) | ||||
| } | } | ||||
| }, | }, | ||||
| getInputVal: function (e) { | |||||
| if (e.detail.value <= this.data.surplusNum){ | |||||
| console.log(this.data.buyNumber) | |||||
| if (e.detail.value < 1) { | |||||
| wx.showToast({ | |||||
| title: "赠送量最小为1", | |||||
| duration: 1000 | |||||
| }) | |||||
| this.setData({ | |||||
| buyNumber: 1, | |||||
| ticketNum: 1 | |||||
| }) | |||||
| }else{ | |||||
| this.setData({ | |||||
| buyNumber: e.detail.value, | |||||
| ticketNum: e.detail.value | |||||
| }) | |||||
| } | |||||
| } else{ | |||||
| wx.showToast({ | |||||
| title: "您赠送数量太大", | |||||
| duration:1000 | |||||
| }) | |||||
| setTimeout(() => { | |||||
| this.setData({ | |||||
| buyNumber: 1, | |||||
| ticketNum: 1 | |||||
| }) | |||||
| },1000) | |||||
| } | |||||
| }, | |||||
| }) | }) |
| <view bindtap="subtractFn" class="subtractView"> | <view bindtap="subtractFn" class="subtractView"> | ||||
| <image class="subtract" src="../images/subtract.png"></image> | <image class="subtract" src="../images/subtract.png"></image> | ||||
| </view> | </view> | ||||
| <text class="textNum">{{buyNumber}}</text> | |||||
| <!-- <text class="textNum">{{buyNumber}}</text> --> | |||||
| <input class="inputNum" type="number" bindinput="getInputVal" value="{{buyNumber}}"></input> | |||||
| <image bindtap="addFn" class="textAdd" src="../images/add.png"></image> | <image bindtap="addFn" class="textAdd" src="../images/add.png"></image> | ||||
| </view> | </view> | ||||
| </view> | </view> |
| width: 100%; | width: 100%; | ||||
| height: 190rpx; | height: 190rpx; | ||||
| display: flex; | display: flex; | ||||
| justify-content: center; | |||||
| justify-content: space-between; | |||||
| align-items: center; | align-items: center; | ||||
| } | } | ||||
| .line{ | .line{ | ||||
| font-weight:bold; | font-weight:bold; | ||||
| color:rgba(51,51,51,1); | color:rgba(51,51,51,1); | ||||
| } | } | ||||
| .textNum{ | |||||
| margin: 0 25rpx; | |||||
| .inputNum{ | |||||
| width: 70rpx; | |||||
| margin: 0 15rpx; | |||||
| text-align: center; | |||||
| } | } | ||||
| .subtract{ | .subtract{ | ||||
| width: 28rpx; | width: 28rpx; | ||||
| font-family:SourceHanSansCN; | font-family:SourceHanSansCN; | ||||
| font-weight:bold; | font-weight:bold; | ||||
| color:rgba(51,51,51,1); | color:rgba(51,51,51,1); | ||||
| margin-left: 96rpx; | |||||
| } | |||||
| .lineRig{ | |||||
| margin-right: 35rpx; | |||||
| } | } | ||||
| .giveFrind{ | .giveFrind{ | ||||
| padding: 47rpx 41rpx 47rpx 32rpx; | padding: 47rpx 41rpx 47rpx 32rpx; |
| }, | }, | ||||
| //事件处理函数 | //事件处理函数 | ||||
| onLoad: function () { | onLoad: function () { | ||||
| if (app.globalData.openid){ | |||||
| if (app.globalData.openId){ | |||||
| this.getDataList(); | this.getDataList(); | ||||
| }else{ | }else{ | ||||
| app.globalData.openidSuccessFuc = this.getDataList; | app.globalData.openidSuccessFuc = this.getDataList; |
| * 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| if (app.globalData.openid) { | |||||
| if (app.globalData.openId) { | |||||
| this.myTicket(); | this.myTicket(); | ||||
| this.historyTicket(); | this.historyTicket(); | ||||
| } else { | } else { |
| ticketNum: options.number | ticketNum: options.number | ||||
| }) | }) | ||||
| if (app.globalData.openid) { | |||||
| if (app.globalData.openId) { | |||||
| this.getTicketUser(options.shareId, options.number); | this.getTicketUser(options.shareId, options.number); | ||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.getTicketUser; | app.globalData.openidSuccessFuc = this.getTicketUser; |
| time = setInterval(this.setIntervalFn,1000) | time = setInterval(this.setIntervalFn,1000) | ||||
| } | } | ||||
| if (app.globalData.openid) { | |||||
| if (app.globalData.openId) { | |||||
| this.yesCodeFn(); | this.yesCodeFn(); | ||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.yesCodeFn; | app.globalData.openidSuccessFuc = this.yesCodeFn; | ||||
| console.log(this.data.minter) | console.log(this.data.minter) | ||||
| }, | }, | ||||
| registerBtn:function(){//点击按钮注册 | registerBtn:function(){//点击按钮注册 | ||||
| if (app.globalData.openid) { | |||||
| if (app.globalData.openId) { | |||||
| this.registerFn(); | this.registerFn(); | ||||
| } else { | } else { | ||||
| app.globalData.openidSuccessFuc = this.registerFn; | app.globalData.openidSuccessFuc = this.registerFn; |
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(options) | console.log(options) | ||||
| if (app.globalData.openid) { | |||||
| if (app.globalData.openId) { | |||||
| this.getShopList(); | this.getShopList(); | ||||
| this.searchShop(true); | this.searchShop(true); | ||||
| } else { | } else { | ||||
| this.globalData.openidSuccessFuc = this.getShopList; | |||||
| this.globalData.openidSuccessFuc = this.searchShop; | |||||
| app.globalData.openidSuccessFuc = this.getShopList; | |||||
| app.globalData.openidSuccessFuc = this.searchShop; | |||||
| } | } | ||||
| }, | }, | ||||
| this.data.pageNum = 1; | this.data.pageNum = 1; | ||||
| this.data.dataArr = []; | this.data.dataArr = []; | ||||
| this.searchShop(true); | this.searchShop(true); | ||||
| if (this.data.provinceCityArr[0][0] == "") { | |||||
| this.data.provinceCityArr[0][0] = "全部" | |||||
| } | |||||
| if (this.data.provinceCityArr[1][0] == "") { | |||||
| this.data.provinceCityArr[1][0] = "全部"; | |||||
| } | |||||
| }, | }, | ||||
| deleteVal:function(){//清空搜索框 | deleteVal:function(){//清空搜索框 | ||||
| this.setData({ | this.setData({ | ||||
| inputVal:"" | inputVal:"" | ||||
| }) | }) | ||||
| this.data.pageNum = 1; | this.data.pageNum = 1; | ||||
| this.data.dataArr = []; | this.data.dataArr = []; | ||||
| this.searchShop(true); | this.searchShop(true); | ||||
| if (this.data.provinceCityArr[0][0] == "") { | |||||
| this.data.provinceCityArr[0][0] = "全部" | |||||
| } | |||||
| if (this.data.provinceCityArr[1][0] == "") { | |||||
| this.data.provinceCityArr[1][0] = "全部"; | |||||
| } | |||||
| }, | }, | ||||
| openAddress:function(e){//打开地图 | |||||
| var index = e.target.dataset.index; | |||||
| console.log(index) | |||||
| var latitude = this.data.showDataArr[index].shop_latitude; | |||||
| var longitude = this.data.showDataArr[index].shop_longtitude; | |||||
| latitude = parseFloat(latitude); | |||||
| longitude = parseFloat(longitude); | |||||
| var addressName = this.data.showDataArr[index].shop_name | |||||
| wx.openLocation({ | |||||
| latitude: latitude, | |||||
| longitude: longitude, | |||||
| scale: 18, | |||||
| name: addressName | |||||
| }) | |||||
| } | |||||
| }) | }) |
| <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> | |||||
| <image wx:if="{{inputVal}}" class="delete" bindtap="deleteVal" src="../images/delete.jpg"></image> | |||||
| </view> | </view> | ||||
| <view class="searchBtn" bindtap="searchFn">搜索</view> | <view class="searchBtn" bindtap="searchFn">搜索</view> | ||||
| </view> | </view> | ||||
| <image bindtap="callPhone" data-index="{{index}}" class="ringUp" src="../images/ringUp.png" ></image> | <image bindtap="callPhone" data-index="{{index}}" class="ringUp" src="../images/ringUp.png" ></image> | ||||
| </view> | </view> | ||||
| <view class="shopName">{{item.shop_name}}</view> | <view class="shopName">{{item.shop_name}}</view> | ||||
| <view class="address"> | |||||
| <view class="address" bindtap="openAddress"> | |||||
| <image class="addressIcon" src="../images/addressIcon.png"></image> | <image class="addressIcon" src="../images/addressIcon.png"></image> | ||||
| <view class="iconRig">{{item.shop_addr}}</view> | |||||
| <view class="iconRig" data-index="{{index}}">{{item.shop_addr}}</view> | |||||
| </view> | </view> | ||||
| <view class="phone"> | <view class="phone"> | ||||
| <image class="phoneIcon" src="../images/phoneIcon.png"></image> | <image class="phoneIcon" src="../images/phoneIcon.png"></image> |