| @@ -6,6 +6,7 @@ App({ | |||
| // logs.unshift(Date.now()) | |||
| // wx.setStorageSync('logs', logs) | |||
| var openid = wx.getStorageSync('openid') || ""; | |||
| wx.setStorageSync('state',-1); | |||
| // 登录 | |||
| if (!openid){ | |||
| wx.login({ | |||
| @@ -53,9 +54,9 @@ App({ | |||
| this.wxRequest(this.globalData.httpUrl + 'getinfo', {},e=>{ | |||
| console.log(e) | |||
| if(e.code==201){//未注册跳到注册页面 | |||
| this.globalData.state = 0 | |||
| wx.getStorageSync('state', 0); | |||
| } else if (e.code == 202) {//已注册 | |||
| this.globalData.state = 1 | |||
| wx.getStorageSync('state', 1); | |||
| this.globalData.userInfo = e.data; | |||
| } | |||
| if(this.globalData.userInfoBackFn){ | |||
| @@ -64,7 +65,6 @@ App({ | |||
| },this) | |||
| }, | |||
| globalData: { | |||
| state:-1, | |||
| openidSuccessFuc: null,//方法回调 | |||
| userInfoSuccessFuc: null,//方法回调 | |||
| userInfo: null, | |||
| @@ -12,7 +12,8 @@ Page({ | |||
| ticketUser: [],//优惠券信息 | |||
| orderUser:[],//下单信息 | |||
| sign_num:"",//确认支付参数 | |||
| id:"" | |||
| id:"", | |||
| yesClick:false,//防止购买按钮多次点击 | |||
| }, | |||
| /** | |||
| @@ -103,7 +104,11 @@ Page({ | |||
| } | |||
| }, | |||
| buySuccess:function(){//购买下单 | |||
| if (this.data.yesClick){ | |||
| return; | |||
| } | |||
| app.wxRequest(app.globalData.httpUrl + 'order/set', { coupon_sell_id: this.data.ticketUser.coupon_sell_id, buy_num: this.data.buyNumber}, e => { | |||
| this.data.yesClick = true; | |||
| console.log(e) | |||
| if (e.code == 200) { | |||
| this.setData({ | |||
| @@ -124,6 +129,7 @@ Page({ | |||
| } else if (e.code == -3003){ | |||
| wx.showToast({ | |||
| title: e.message, | |||
| icon:"none", | |||
| duration:500 | |||
| }) | |||
| } | |||
| @@ -133,6 +139,7 @@ Page({ | |||
| app.wxRequest(app.globalData.httpUrl + 'order/paid', { sign_num: this.data.sign_num}, e => { | |||
| console.log(e) | |||
| if (e.code == 200) { | |||
| this.data.yesClick = false; | |||
| wx.reLaunch({ | |||
| url: '/pages/personalCenter/personalCenter' | |||
| }) | |||
| @@ -173,8 +173,9 @@ Page({ | |||
| }) | |||
| } else{ | |||
| wx.showToast({ | |||
| title: "您赠送数量太大", | |||
| duration:1000 | |||
| title: "您赠送数量不能大于您已有数量", | |||
| icon: "none", | |||
| duration:2000 | |||
| }) | |||
| setTimeout(() => { | |||
| this.setData({ | |||
| @@ -43,7 +43,7 @@ | |||
| <view class="line" style="margin-top:40rpx"></view> | |||
| <view class="myTicketTop" bindtap="lookHistory"> | |||
| <image class="historyIcon" src="../images/historyIcon.png"></image> | |||
| <view class="myTicket" style="margin-left:-310rpx;">优惠券使用记录</view> | |||
| <view class="myTicket" style="margin-right: 310rpx;">优惠券使用记录</view> | |||
| <image class="ticketArrows" src="../images/ticketArrows.png" style="transform:rotate({{historydeg}}deg)"></image> | |||
| </view> | |||
| @@ -76,7 +76,7 @@ page{ | |||
| height: 19rpx; | |||
| } | |||
| .myTicket{ | |||
| margin-left: -350rpx; | |||
| margin-right: 350rpx; | |||
| font-size:30rpx; | |||
| font-family:SourceHanSansCN; | |||
| font-weight:bold; | |||
| @@ -28,7 +28,8 @@ Page({ | |||
| }) | |||
| if (app.globalData.state == 1) {//已注册 | |||
| var state = wx.getStorageSync('state'); | |||
| if (state == 1) {//已注册 | |||
| if (app.globalData.openId) { | |||
| this.getTicketUser(); | |||
| } else { | |||
| @@ -37,11 +38,11 @@ Page({ | |||
| this.setData({ | |||
| showAll:true | |||
| }) | |||
| } else if (app.globalData.state == 0) {//未注册 | |||
| } else if (state == 0) {//未注册 | |||
| wx.switchTab({ | |||
| url: '/pages/register/register' | |||
| }) | |||
| } else if (app.globalData.state == -1) { | |||
| } else if (state == -1) { | |||
| app.globalData.userInfoBackFn = res => {//等待结果 | |||
| if (res) { | |||
| if (app.globalData.openId) { | |||
| @@ -21,15 +21,16 @@ Page({ | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function (options) { | |||
| if (app.globalData.state==1){//已注册 | |||
| var state = wx.getStorageSync('state'); | |||
| if (state==1){//已注册 | |||
| wx.switchTab({ | |||
| url: '/pages/index/index' | |||
| }) | |||
| } else if (app.globalData.state == 0){//未注册 | |||
| } else if (state == 0){//未注册 | |||
| this.setData({ | |||
| showAll:true | |||
| }) | |||
| } else if (app.globalData.state == -1){ | |||
| } else if (state == -1){ | |||
| app.globalData.userInfoBackFn = res=>{//等待结果 | |||
| console.log(res) | |||
| if (res){ | |||
| @@ -73,6 +73,11 @@ Page({ | |||
| app.globalData.openidSuccessFuc = this.getShopList; | |||
| // app.globalData.openidSuccessFuc = this.searchShop; | |||
| } | |||
| var hig = wx.getSystemInfoSync().windowHeight; | |||
| this.setData({ | |||
| scrollHig: hig-70 | |||
| }) | |||
| }, | |||
| getShopList:function(){//获取所有门店省市 | |||
| @@ -186,19 +191,21 @@ Page({ | |||
| * 页面上拉触底事件的处理函数 | |||
| */ | |||
| onReachBottom: function () { | |||
| }, | |||
| lower:function(){ | |||
| console.log("到底了") | |||
| if (this.data.getDataArr!=""){ | |||
| if (this.data.getDataArr != "") { | |||
| this.data.pageNum++; | |||
| this.searchShop(); | |||
| }else{ | |||
| } else { | |||
| wx.showToast({ | |||
| title: '没有更多数据了', | |||
| icon:"none", | |||
| duration:1000 | |||
| icon: "none", | |||
| duration: 1000 | |||
| }) | |||
| } | |||
| }, | |||
| /** | |||
| * 用户点击右上角分享 | |||
| */ | |||
| @@ -17,8 +17,8 @@ | |||
| <view class="searchBtn" bindtap="searchFn">搜索</view> | |||
| </view> | |||
| <view class="content"> | |||
| <!-- <scroll-view scroll-y="true" style="height:{{scrollHig}}px" bindtouchend=""> --> | |||
| <!-- <view class="content"> --> | |||
| <scroll-view scroll-y="true" style="height:{{scrollHig}}px" bindscrolltolower="lower"> | |||
| <view> | |||
| <view class="getData" wx:for="{{showDataArr}}"> | |||
| <view class="imgView"> | |||
| @@ -37,7 +37,7 @@ | |||
| <view class="line"></view> | |||
| </view> | |||
| </view> | |||
| <!-- </scroll-view> --> | |||
| </view> | |||
| </scroll-view> | |||
| <!-- </view> --> | |||
| </view> | |||
| @@ -11,10 +11,6 @@ page{ | |||
| .searchAll{ | |||
| width: 686rpx; | |||
| padding-bottom: 50rpx; | |||
| position: fixed; | |||
| top: 0; | |||
| background: #ffffff; | |||
| z-index: 9; | |||
| display: flex; | |||
| justify-content: space-between; | |||
| align-items: center; | |||