Ver a proveniência

[我的券包 我的订单][修改]:我的券包 我的订单上拉加载的修改

tags/2.2.4
meo há 6 anos
ascendente
cometimento
b120cff8f1
6 ficheiros alterados com 80 adições e 96 eliminações
  1. +0
    -1
      pages/coupon/detail/index.js
  2. +29
    -46
      pages/couponorder/index/index.js
  3. +12
    -10
      pages/order/index/index.js
  4. +4
    -1
      pages/order/index/index.wxml
  5. +31
    -36
      pages/rushToBuy/index.js
  6. +4
    -2
      pages/rushToBuy/index.wxml

+ 0
- 1
pages/coupon/detail/index.js Ver ficheiro

@@ -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,


+ 29
- 46
pages/couponorder/index/index.js Ver ficheiro

@@ -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);
} }
});
});

+ 12
- 10
pages/order/index/index.js Ver ficheiro

@@ -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);
}, },


+ 4
- 1
pages/order/index/index.wxml Ver ficheiro

@@ -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}}">


+ 31
- 36
pages/rushToBuy/index.js Ver ficheiro

@@ -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 () {}
});

+ 4
- 2
pages/rushToBuy/index.wxml Ver ficheiro

@@ -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>

Carregando…
Cancelar
Guardar