| @@ -172,7 +172,6 @@ Page({ | |||
| // 领取 5.停车券 | |||
| // TODO 选取用户下的车牌 | |||
| console.log(1111111111111) | |||
| } else { | |||
| Http.post({ | |||
| url: config.api.checkPhoneStatus, | |||
| @@ -3,8 +3,7 @@ const config = require("../../../config/config.js"); | |||
| const Http = require("../../../utils/HttpBasics"); | |||
| Page({ | |||
| data: { | |||
| tabs: [ | |||
| { | |||
| tabs: [{ | |||
| key: 0, | |||
| name: "未使用" | |||
| }, | |||
| @@ -28,10 +27,10 @@ Page({ | |||
| allow_load: true, | |||
| loading: true, //"上拉加载"的变量,默认false,隐藏 | |||
| content: "", | |||
| mystatus:'' | |||
| mystatus: '' | |||
| }, | |||
| onLoad() { | |||
| this.getList(0, 0); | |||
| this.getList(0, 1); | |||
| }, | |||
| onShow: function () { | |||
| wx.setStorage({ | |||
| @@ -40,16 +39,13 @@ Page({ | |||
| }) | |||
| }, | |||
| //点击跳转到券详情页面 | |||
| gotouse: function(e) { | |||
| gotouse: function (e) { | |||
| console.log(e.currentTarget.dataset.couponorderstatus); | |||
| console.log("点击跳转到券详情"); | |||
| if(this.data.mystatus==''||this.data.mystatus=='undefined'){ | |||
| if (this.data.mystatus == '' || this.data.mystatus == 'undefined') { | |||
| var mystatus = e.currentTarget.dataset.couponorderstatus; | |||
| }else{ | |||
| } else { | |||
| var mystatus = this.data.mystatus; | |||
| } | |||
| console.log(mystatus); | |||
| wx.navigateTo({ | |||
| url: `/pages/couponorder/detail/index?quancode=${ | |||
| e.currentTarget.dataset.quancode}&couponorderstatus=${mystatus}` | |||
| @@ -57,12 +53,10 @@ Page({ | |||
| }, | |||
| getList(key, pageNum) { | |||
| var that = this; | |||
| // console.log(key); | |||
| // console.log(pageNum); | |||
| if (that.data.allow_load) { | |||
| that.setData({ | |||
| loading: true, | |||
| content: "小主,我在玩命加载中...", | |||
| content: "小主,我在玩命加载中...", | |||
| }); | |||
| Http.get({ | |||
| url: config.api.couponOrderList, | |||
| @@ -76,70 +70,59 @@ Page({ | |||
| res.data.list.map(file => { | |||
| file.expiredTime = util.fmtDate(file.expiredTime); | |||
| }); | |||
| setTimeout(function() { | |||
| setTimeout(function () { | |||
| that.setData({ | |||
| loading: false | |||
| }); | |||
| }, 1400); | |||
| if (pageNum > res.data.pages) { | |||
| console.log(pageNum); | |||
| if (pageNum >= res.data.pages) { | |||
| that.setData({ | |||
| allow_load: false | |||
| }); | |||
| setTimeout(function() { | |||
| that.setData({ | |||
| loading: false | |||
| }); | |||
| }, 1400); | |||
| } | |||
| /** | |||
| * 先赋值后渲染页面 | |||
| * concat 不会改变原数组值 | |||
| * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 | |||
| */ | |||
| that.data.list = that.data.list.concat(res.data.list); | |||
| if (pageNum == 1) { | |||
| that.setData({ | |||
| list: [] | |||
| }) | |||
| } | |||
| var tmpArr = that.data.list; | |||
| tmpArr.push.apply(tmpArr, res.data.list); | |||
| that.setData({ | |||
| list: that.data.list | |||
| }); | |||
| list: tmpArr | |||
| }) | |||
| }); | |||
| } else { | |||
| console.log("加载完成allow_load设置成false"); | |||
| that.setData({ | |||
| loading: true, | |||
| content: "——— 在拉裤子就掉了啦 ———" | |||
| }); | |||
| setTimeout(function() { | |||
| setTimeout(function () { | |||
| that.setData({ | |||
| loading: false | |||
| }); | |||
| }, 1400); | |||
| } | |||
| }, | |||
| handleChange({ detail }) { | |||
| console.log(detail); | |||
| this.setData({ | |||
| current: detail.key | |||
| }); | |||
| }, | |||
| handleChangeScroll({ detail }) { | |||
| handleChangeScroll({ | |||
| detail | |||
| }) { | |||
| this.setData({ | |||
| list: [], | |||
| allow_load: true, | |||
| current_scroll: detail.key | |||
| current_scroll: detail.key, | |||
| page:1, | |||
| }); | |||
| this.getList(detail.key, 1); | |||
| this.setData({ | |||
| current_scroll: detail.key | |||
| }); | |||
| }, | |||
| onReachBottom: function() { | |||
| onReachBottom: function () { | |||
| var that = this; | |||
| console.log(that.data.page); | |||
| that.data.page++; | |||
| console.log(that.data.page); | |||
| that.setData({ | |||
| page: that.data.page | |||
| }); | |||
| console.info("after++ " + that.data.page); | |||
| console.log(that.data.page+"页数"); | |||
| console.log(that.data.current_scroll+"点击的tab数") | |||
| that.getList(that.data.current_scroll, that.data.page); | |||
| } | |||
| }); | |||
| }); | |||
| @@ -72,7 +72,7 @@ Page({ | |||
| data: variable | |||
| }).then(res => { | |||
| console.log(res); | |||
| if (pageNum > res.data.pages) { | |||
| if (pageNum >= res.data.pages) { | |||
| that.setData({ | |||
| allow_load: false | |||
| }); | |||
| @@ -87,15 +87,16 @@ Page({ | |||
| loading: false, | |||
| }) | |||
| }, 1400); | |||
| /** | |||
| * 先赋值后渲染页面 | |||
| * concat 不会改变原数组值 | |||
| * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 | |||
| */ | |||
| that.data.list = that.data.list.concat(res.data.list); | |||
| if (pageNum == 1) { | |||
| that.setData({ | |||
| list: [] | |||
| }) | |||
| } | |||
| var tmpArr = that.data.list; | |||
| tmpArr.push.apply(tmpArr, res.data.list); | |||
| that.setData({ | |||
| list: that.data.list | |||
| }); | |||
| list: tmpArr | |||
| }) | |||
| for (let i = 0; i < that.data.list.length; i++) { | |||
| that.setData({ | |||
| createDate: util.fmtDate(that.data.list[i].createDate) | |||
| @@ -128,7 +129,8 @@ Page({ | |||
| this.setData({ | |||
| list: [], | |||
| allow_load: true, | |||
| current_scroll: detail.key | |||
| current_scroll: detail.key, | |||
| page:1 | |||
| }) | |||
| this.getList(detail.key, 1); | |||
| }, | |||
| @@ -12,6 +12,7 @@ | |||
| <view> | |||
| <text>{{item.title}}</text> | |||
| <text wx:if="{{item.orderStatus==0}}">待付款</text> | |||
| <text wx:if="{{item.orderStatus==3}}">已退款</text> | |||
| <text wx:if="{{item.orderStatus==1&&item.salePrice==0}}">免费领取</text> | |||
| <text wx:if="{{item.orderStatus==1&&item.salePrice!=0}}">已付款</text> | |||
| <text wx:if="{{item.orderStatus==2}}">已过期</text> | |||
| @@ -42,7 +43,9 @@ | |||
| <view wx:if="{{item.orderStatus==2}}" style="background:#999;opacity: .6;" class="btn"> | |||
| <text>已过期</text> | |||
| </view> | |||
| <view wx:if="{{item.orderStatus==3}}" style="background:#999;opacity: .6;" class="btn"> | |||
| <text>已退款</text> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <view class="dingdan" wx:if="{{list.length==0}}"> | |||
| @@ -14,34 +14,26 @@ Page({ | |||
| hour: "", | |||
| minute: "", | |||
| loading: true, //"上拉加载"的变量,默认false,隐藏 | |||
| content:"", | |||
| content: "", | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function(options) {}, | |||
| onLoad: function (options) {}, | |||
| //列表 | |||
| getList: function(page) { | |||
| getList: function (page) { | |||
| let that = this; | |||
| app.couponChannelListCallback = token => { | |||
| Http.setToken(token); | |||
| /** | |||
| * 判断用户是否加载完成 | |||
| */ | |||
| if (that.data.allow_load) { | |||
| // wx.showLoading({ | |||
| // title: "加载中" | |||
| // }); | |||
| that.setData({ | |||
| loading:true, | |||
| content:'小主,我在玩命加载中...' | |||
| loading: true, | |||
| content: '小主,我在玩命加载中...' | |||
| }) | |||
| // setTimeout(function() { | |||
| // wx.hideLoading(); | |||
| // }, 1200); | |||
| Http.get({ | |||
| url: config.api.couponChannelList, | |||
| data: { | |||
| @@ -51,30 +43,33 @@ Page({ | |||
| } | |||
| }).then(res => { | |||
| console.log(res); | |||
| if (page > res.data.pages) { | |||
| if (page >= res.data.pages) { | |||
| that.setData({ | |||
| allow_load: false | |||
| }); | |||
| setTimeout(function() { | |||
| setTimeout(function () { | |||
| that.setData({ | |||
| loading:false, | |||
| loading: false, | |||
| }) | |||
| }, 1400); | |||
| } else { | |||
| setTimeout(function() { | |||
| setTimeout(function () { | |||
| that.setData({ | |||
| loading:false, | |||
| loading: false, | |||
| }) | |||
| }, 1400); | |||
| /** | |||
| * 页面上显示的时间 | |||
| */ | |||
| console.log(that.data.list); | |||
| that.data.list = that.data.list.concat(res.data.list); | |||
| console.log(pageNum); | |||
| if (pageNum == 1) { | |||
| that.setData({ | |||
| list: [] | |||
| }) | |||
| } | |||
| var tmpArr = that.data.list; | |||
| tmpArr.push.apply(tmpArr, res.data.list); | |||
| that.setData({ | |||
| list: that.data.list | |||
| }); | |||
| console.log(that.data.list); | |||
| list: tmpArr | |||
| }) | |||
| console.log(tmpArr); | |||
| for (let i = 0; i < that.data.list.length; i++) { | |||
| var startTime = util.fmtDate(that.data.list[i].endTime); | |||
| util.timechuo(startTime); | |||
| @@ -93,14 +88,14 @@ Page({ | |||
| } else { | |||
| console.info("allow_load==false 已禁止加载"); | |||
| that.setData({ | |||
| loading:true, | |||
| loading: true, | |||
| content: "——— 在拉裤子就掉了啦 ———" | |||
| }) | |||
| setTimeout(function(){ | |||
| setTimeout(function () { | |||
| that.setData({ | |||
| loading:false, | |||
| loading: false, | |||
| }) | |||
| },1400) | |||
| }, 1400) | |||
| } | |||
| }; | |||
| if (app.globalData.token && app.globalData.token != null) { | |||
| @@ -108,7 +103,7 @@ Page({ | |||
| app.couponChannelListCallback(app.globalData.token); | |||
| } | |||
| }, | |||
| onReady: function() { | |||
| onReady: function () { | |||
| let that = this; | |||
| that.setData({ | |||
| list: [] | |||
| @@ -116,7 +111,7 @@ Page({ | |||
| that.getList(2); | |||
| }, | |||
| //限时抢购的详情页面 | |||
| gotodetail: function(e) { | |||
| gotodetail: function (e) { | |||
| wx.navigateTo({ | |||
| url: `/pages/coupon/detail/index?couponChannelId=${ | |||
| e.currentTarget.dataset.couponchannelid | |||
| @@ -126,12 +121,12 @@ Page({ | |||
| /** | |||
| * 页面相关事件处理函数--监听用户下拉动作 | |||
| */ | |||
| onPullDownRefresh: function() {}, | |||
| onPullDownRefresh: function () {}, | |||
| /** | |||
| * 页面上拉触底事件的处理函数 | |||
| */ | |||
| onReachBottom: function() { | |||
| onReachBottom: function () { | |||
| let that = this; | |||
| that.data.page++; | |||
| console.log(that.data.page); | |||
| @@ -142,5 +137,5 @@ Page({ | |||
| /** | |||
| * 用户点击右上角分享 | |||
| */ | |||
| onShareAppMessage: function() {} | |||
| }); | |||
| onShareAppMessage: function () {} | |||
| }); | |||
| @@ -1,6 +1,7 @@ | |||
| <!-- 限时抢购 查看更多对应的页面 --> | |||
| <view class='flashSale'> | |||
| <view wx:for="{{list}}" class='flashSaleItemWrap' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" wx:key="index"> | |||
| <view wx:for="{{list}}" class='flashSaleItemWrap' data-couponId="{{item.couponId}}" data-couponChannelId="{{item.id}}" | |||
| data-targetAd="{{item.targetAd}}" bindtap="gotodetail" wx:key="index"> | |||
| <view class='flashSaleItem'> | |||
| <view class='flashSaleItemTop'> | |||
| <view class='flashSaleItemTopL'> | |||
| @@ -34,5 +35,6 @@ | |||
| </view> | |||
| </view> | |||
| <view class="loading" wx:if="{{loading}}"> | |||
| <image src="./../../assets/img/loading.gif" mode="widthFix"></image>{{content}}</view> | |||
| <image src="./../../assets/img/loading.gif" mode="widthFix"></image>{{content}} | |||
| </view> | |||
| </view> | |||