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