Commit 0ea5d429 authored by lvtz's avatar lvtz

fix

parent 7a3cdf6b
......@@ -25,7 +25,6 @@ Page({
sid
})
this.pointsExchangeRecordGet('init');
wx.hideShareMenu();
},
onPullDownRefresh: function () {
this.setData({
......@@ -60,20 +59,15 @@ Page({
} else {
if (data.total) {
this.setData({
recordTotal: data.total
})
this.data.recordTotal = data.total;
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
recordList: data.list || []
recordList: [data.list]
}, () => {
if (this.data.recordTotal > this.data.recordList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
if (this.data.recordTotal > this.caculateArrLength(this.data.recordList)) {
this.data.page += 1;
} else { // 没有更多了
this.setData({
hasmore: false
......@@ -83,13 +77,10 @@ Page({
break;
case 'down': // 页面下拉刷新
this.setData({
recordList: data.list || []
recordList: [data.list]
}, () => {
if (this.data.recordTotal > this.data.recordList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
if (this.data.recordTotal > this.caculateArrLength(this.data.recordList)) {
this.data.page += 1;
} else { // 没有更多了
this.setData({
hasmore: false
......@@ -102,13 +93,10 @@ Page({
let list = this.data.recordList;
let _list = list.concat(data.list);
this.setData({
recordList: _list
[`recordList[${this.data.page - 1}]`]: data.list
}, () => {
if (this.data.recordTotal > this.data.recordList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
if (this.data.recordTotal > this.caculateArrLength(this.data.recordList)) {
this.data.page += 1;
} else { // 没有更多了
this.setData({
hasmore: false
......@@ -119,7 +107,7 @@ Page({
default:
break;
}
if (this.data.recordList.length == 0) {
if (this.caculateArrLength(this.data.recordList) == 0) {
this.setData({
emptyPage: true
})
......@@ -150,5 +138,12 @@ Page({
// that.setData({
// recordList: this.data.recordList
// })
}
},
caculateArrLength(array) {
let _length = 0;
array.forEach(ele => {
_length = _length + ele.length;
})
return _length;
},
})
\ No newline at end of file
<wxs src="./../../../filter/index.wxs" module="filter" />
<view class="container points-exchange-record">
<view class="record-list" wx:if="{{recordList.length!=0}}">
<view class="record-item" wx:for="{{recordList}}" wx:key="" data-info="{{item}}" bindtap="toCheckRecord">
<image class="item-points-pic" src="{{filter.imagify(item.good.cover)}}" mode="aspectFit|aspectFill|widthFix"></image>
<view class="item-content-box">
<view class="item-top">
<view class="item-title">{{item.good.title}}</view>
<view class="item-points">{{item.price}}积分</view>
<block wx:for="{{recordList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="record-item" wx:for="{{bigitem}}" wx:key="" data-info="{{item}}" bindtap="toCheckRecord">
<image class="item-points-pic" src="{{filter.imagify(item.good.cover)}}" mode="aspectFit|aspectFill|widthFix"></image>
<view class="item-content-box">
<view class="item-top">
<view class="item-title">{{item.good.title}}</view>
<view class="item-points">{{item.price}}积分</view>
</view>
<view class="item-checkperson">
<view class="checkpeople">兑换人: {{item.nickname}}</view>
<view wx:if="{{item.verify_status==1}}" class="checkstatus">待核销</view>
</view>
<image class="checkstatus-icon" wx:if="{{item.verify_status==2}}" src="{{imageRoot}}2c/mall/hasexchange.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix"></image>
</view>
<view class="item-checkperson">
<view class="checkpeople">兑换人: {{item.nickname}}</view>
<view wx:if="{{item.verify_status==1}}" class="checkstatus">待核销</view>
</view>
<image class="checkstatus-icon" wx:if="{{item.verify_status==2}}" src="{{imageRoot}}2c/mall/hasexchange.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix"></image>
</view>
</view>
</block>
</view>
<empty-content text="暂无兑换记录~" emptyimg="" wx:if="{{recordList.length==0}}"></empty-content>
<view class="has-nomore" wx:if="{{!emptyPage && !hasmore}}">没有更多了</view>
</view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment