| @@ -41,7 +41,7 @@ App({ | |||
| } | |||
| }) | |||
| }else{ | |||
| this.globalData.openid = openid; | |||
| this.globalData.openId = openid; | |||
| } | |||
| this.getUserType(); | |||
| // 获取用户信息 | |||
| @@ -110,7 +110,7 @@ App({ | |||
| }, | |||
| wxRequest: function (url, params, callback, thisArg, methods, openid) { | |||
| let that = this; | |||
| // console.log(this.globalData.openid) | |||
| // console.log(this.globalData.openId) | |||
| var httpUrl = url; | |||
| var str = ""; | |||
| var count = 0; | |||
| @@ -135,7 +135,7 @@ App({ | |||
| method: methods, | |||
| header: { | |||
| "content-type": "application/x-www-form-urlencoded", | |||
| "openid": this.globalData.openid | |||
| "openid": this.globalData.openId | |||
| }, | |||
| success: function (re) { | |||
| // if (re.data.code == -1002) { | |||
| @@ -156,7 +156,7 @@ App({ | |||
| url: httpUrl, | |||
| method: methods, | |||
| header: { | |||
| "openid": this.globalData.openid, | |||
| "openid": this.globalData.openId, | |||
| }, | |||
| success: function (re) { | |||
| // if (re.data.code == -1002) { | |||
| @@ -18,7 +18,7 @@ Page({ | |||
| */ | |||
| onLoad: function (options) { | |||
| console.log(options.id) | |||
| if (app.globalData.openid) { | |||
| if (app.globalData.openId) { | |||
| this.getTicketUser(options.id, 1) | |||
| this.getCodeFn(options.id) | |||
| } else { | |||
| @@ -23,9 +23,15 @@ | |||
| width: 100%; | |||
| height: 190rpx; | |||
| display: flex; | |||
| justify-content: center; | |||
| justify-content: space-between; | |||
| align-items: center; | |||
| } | |||
| .ticketName{ | |||
| margin-left: 96rpx; | |||
| } | |||
| .lineRig{ | |||
| margin-right: 55rpx; | |||
| } | |||
| .line{ | |||
| margin-left: 94rpx; | |||
| margin-right: 46rpx; | |||
| @@ -94,7 +100,7 @@ | |||
| } | |||
| .codeImg{ | |||
| width: 200rpx; | |||
| height: 200rpx; | |||
| height: 200rpx | |||
| } | |||
| /* .scrollY{ | |||
| @@ -19,7 +19,7 @@ Page({ | |||
| */ | |||
| onLoad: function (options) { | |||
| console.log(options) | |||
| if (app.globalData.openid) { | |||
| if (app.globalData.openId) { | |||
| this.getTicketUser(options.index, 1) | |||
| } else { | |||
| app.globalData.openidSuccessFuc = this.getTicketUser; | |||
| @@ -132,4 +132,22 @@ Page({ | |||
| } | |||
| }, 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) | |||
| }, | |||
| }) | |||
| @@ -12,7 +12,8 @@ | |||
| <view bindtap="subtractFn" class="subtractView"> | |||
| <image class="subtract" src="../images/subtract.png"></image> | |||
| </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> | |||
| </view> | |||
| </view> | |||
| @@ -23,7 +23,7 @@ | |||
| width: 100%; | |||
| height: 190rpx; | |||
| display: flex; | |||
| justify-content: center; | |||
| justify-content: space-between; | |||
| align-items: center; | |||
| } | |||
| .line{ | |||
| @@ -36,14 +36,17 @@ | |||
| .chooseNum{ | |||
| display: flex; | |||
| align-items: center; | |||
| margin-right: 50rpx; | |||
| } | |||
| .chooseNum text{ | |||
| font-size: 30rpx; | |||
| font-weight:bold; | |||
| color:rgba(51,51,51,1); | |||
| } | |||
| .textNum{ | |||
| margin: 0 25rpx; | |||
| .inputNum{ | |||
| width: 70rpx; | |||
| margin: 0 15rpx; | |||
| text-align: center; | |||
| } | |||
| .subtract{ | |||
| width: 28rpx; | |||
| @@ -66,6 +69,7 @@ | |||
| font-family:SourceHanSansCN; | |||
| font-weight:bold; | |||
| color:rgba(51,51,51,1); | |||
| margin-left:96rpx; | |||
| } | |||
| .title{ | |||
| @@ -22,7 +22,7 @@ Page({ | |||
| onLoad: function (options) { | |||
| console.log(options.id) | |||
| if (app.globalData.openid) { | |||
| if (app.globalData.openId) { | |||
| this.getTicketUser(options.id, 2) | |||
| } else { | |||
| app.globalData.openidSuccessFuc = this.getTicketUser; | |||
| @@ -117,4 +117,35 @@ Page({ | |||
| }) | |||
| } | |||
| }, | |||
| 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) | |||
| } | |||
| }, | |||
| }) | |||
| @@ -20,7 +20,8 @@ | |||
| <view bindtap="subtractFn" class="subtractView"> | |||
| <image class="subtract" src="../images/subtract.png"></image> | |||
| </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> | |||
| </view> | |||
| </view> | |||
| @@ -29,7 +29,7 @@ page{ | |||
| width: 100%; | |||
| height: 190rpx; | |||
| display: flex; | |||
| justify-content: center; | |||
| justify-content: space-between; | |||
| align-items: center; | |||
| } | |||
| .line{ | |||
| @@ -48,8 +48,10 @@ page{ | |||
| font-weight:bold; | |||
| color:rgba(51,51,51,1); | |||
| } | |||
| .textNum{ | |||
| margin: 0 25rpx; | |||
| .inputNum{ | |||
| width: 70rpx; | |||
| margin: 0 15rpx; | |||
| text-align: center; | |||
| } | |||
| .subtract{ | |||
| width: 28rpx; | |||
| @@ -72,6 +74,10 @@ page{ | |||
| font-family:SourceHanSansCN; | |||
| font-weight:bold; | |||
| color:rgba(51,51,51,1); | |||
| margin-left: 96rpx; | |||
| } | |||
| .lineRig{ | |||
| margin-right: 35rpx; | |||
| } | |||
| .giveFrind{ | |||
| padding: 47rpx 41rpx 47rpx 32rpx; | |||
| @@ -8,7 +8,7 @@ Page({ | |||
| }, | |||
| //事件处理函数 | |||
| onLoad: function () { | |||
| if (app.globalData.openid){ | |||
| if (app.globalData.openId){ | |||
| this.getDataList(); | |||
| }else{ | |||
| app.globalData.openidSuccessFuc = this.getDataList; | |||
| @@ -28,7 +28,7 @@ Page({ | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function (options) { | |||
| if (app.globalData.openid) { | |||
| if (app.globalData.openId) { | |||
| this.myTicket(); | |||
| this.historyTicket(); | |||
| } else { | |||
| @@ -24,7 +24,7 @@ Page({ | |||
| ticketNum: options.number | |||
| }) | |||
| if (app.globalData.openid) { | |||
| if (app.globalData.openId) { | |||
| this.getTicketUser(options.shareId, options.number); | |||
| } else { | |||
| app.globalData.openidSuccessFuc = this.getTicketUser; | |||
| @@ -102,7 +102,7 @@ Page({ | |||
| time = setInterval(this.setIntervalFn,1000) | |||
| } | |||
| if (app.globalData.openid) { | |||
| if (app.globalData.openId) { | |||
| this.yesCodeFn(); | |||
| } else { | |||
| app.globalData.openidSuccessFuc = this.yesCodeFn; | |||
| @@ -131,7 +131,7 @@ Page({ | |||
| console.log(this.data.minter) | |||
| }, | |||
| registerBtn:function(){//点击按钮注册 | |||
| if (app.globalData.openid) { | |||
| if (app.globalData.openId) { | |||
| this.registerFn(); | |||
| } else { | |||
| app.globalData.openidSuccessFuc = this.registerFn; | |||
| @@ -67,12 +67,12 @@ Page({ | |||
| */ | |||
| onLoad: function (options) { | |||
| console.log(options) | |||
| if (app.globalData.openid) { | |||
| if (app.globalData.openId) { | |||
| this.getShopList(); | |||
| this.searchShop(true); | |||
| } else { | |||
| this.globalData.openidSuccessFuc = this.getShopList; | |||
| this.globalData.openidSuccessFuc = this.searchShop; | |||
| app.globalData.openidSuccessFuc = this.getShopList; | |||
| app.globalData.openidSuccessFuc = this.searchShop; | |||
| } | |||
| }, | |||
| @@ -231,13 +231,43 @@ Page({ | |||
| this.data.pageNum = 1; | |||
| this.data.dataArr = []; | |||
| 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(){//清空搜索框 | |||
| this.setData({ | |||
| inputVal:"" | |||
| }) | |||
| this.data.pageNum = 1; | |||
| this.data.dataArr = []; | |||
| 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 | |||
| }) | |||
| } | |||
| }) | |||
| @@ -12,7 +12,7 @@ | |||
| <view class="searchView"> | |||
| <image class="searchIcon" src="../images/searchIcon.png"></image> | |||
| <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 class="searchBtn" bindtap="searchFn">搜索</view> | |||
| </view> | |||
| @@ -26,9 +26,9 @@ | |||
| <image bindtap="callPhone" data-index="{{index}}" class="ringUp" src="../images/ringUp.png" ></image> | |||
| </view> | |||
| <view class="shopName">{{item.shop_name}}</view> | |||
| <view class="address"> | |||
| <view class="address" bindtap="openAddress"> | |||
| <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 class="phone"> | |||
| <image class="phoneIcon" src="../images/phoneIcon.png"></image> | |||