|
|
|
@ -8,7 +8,7 @@ |
|
|
|
<view> |
|
|
|
<text class="lf-iconfont icon-jifen lf-font-50"></text> |
|
|
|
</view> |
|
|
|
<view class="point">78326478</view> |
|
|
|
<view class="point">{{point_data.point}}</view> |
|
|
|
<view class="head-menu"> |
|
|
|
<view @click="$url('/pages/point/shoppingMall/shoppingMall')"> |
|
|
|
<text class="lf-m-r-10">兑换礼品</text> |
|
|
|
@ -26,20 +26,29 @@ |
|
|
|
<view class="lf-font-32 lf-color-black lf-font-bold">积分变动明细</view> |
|
|
|
<picker mode='date' :value="date" @change="dateChange"> |
|
|
|
<view style="width: 440rpx; text-align: right;"> |
|
|
|
<text>{{ date || '2021-09-01' }}</text> |
|
|
|
<text>{{ date || nowDate }}</text> |
|
|
|
<text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10"></text> |
|
|
|
</view> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
<view class="item" v-for="(item, index) in 10" :key="index"> |
|
|
|
<view class="lf-row-between"> |
|
|
|
<text class="lf-font-36 lf-color-black lf-font-bold" :class="{'lf-color-price': index % 2}">{{ index % 2 ? '-250' : '+80' }}</text> |
|
|
|
<text class="lf-font-24 lf-color-777">2021-09-01 18:27:58</text> |
|
|
|
</view> |
|
|
|
<view class="lf-m-t-20"> |
|
|
|
<text class="lf-font-24 lf-color-555">商城内消费</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" |
|
|
|
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh"> |
|
|
|
<view class="item" v-for="(item, index) in list" :key="index"> |
|
|
|
<view class="lf-row-between"> |
|
|
|
<text class="lf-font-36 lf-color-black lf-font-bold" :class="{'lf-color-price': item.ifNegative}">{{ item.value }}</text> |
|
|
|
<text class="lf-font-24 lf-color-777">{{item.created_at}}</text> |
|
|
|
</view> |
|
|
|
<view class="lf-m-t-20"> |
|
|
|
<text class="lf-font-24 lf-color-555">{{item.note}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 空数据的情况 --> |
|
|
|
<view class="loading-more"> |
|
|
|
<text v-if="list.length != 0" |
|
|
|
:class="{'loading-more-text': loadingClass}">{{ loadingText }}</text> |
|
|
|
<lf-nocontent src="/static/images/empty.png" v-else></lf-nocontent> |
|
|
|
</view> |
|
|
|
</scroll-view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
@ -48,15 +57,117 @@ |
|
|
|
export default { |
|
|
|
data(){ |
|
|
|
return { |
|
|
|
date: '' |
|
|
|
date: '', |
|
|
|
nowDate: '', |
|
|
|
point_data: '', |
|
|
|
list: [], |
|
|
|
page: 1, |
|
|
|
isPage: true, |
|
|
|
loadingClass: true, |
|
|
|
loadingText: '正在加载中', |
|
|
|
scrollH: 0, |
|
|
|
nav_height: 0, |
|
|
|
isRefresher: true, |
|
|
|
pageSize: 10 |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
autoHeight(){ |
|
|
|
return `calc(${this.scrollH}px - ${this.nav_height}px - 660rpx)`; |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(){ |
|
|
|
|
|
|
|
let info = uni.getSystemInfoSync(); |
|
|
|
this.scrollH = info.screenHeight; |
|
|
|
var date1 = new Date(); |
|
|
|
var date2 = new Date(date1); |
|
|
|
date2.setDate(date1.getDate()); |
|
|
|
this.nowDate = this.$shared.recordTime(date2, '-', 'date') |
|
|
|
this.getPointNum(); |
|
|
|
this.getPointList(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
dateChange(event){ |
|
|
|
this.date = event.detail.value; |
|
|
|
this.getPointList(); |
|
|
|
}, |
|
|
|
getPointNum(){ |
|
|
|
this.$http.get({ |
|
|
|
api: 'api/users/point', |
|
|
|
header: { |
|
|
|
Authorization: this.$cookieStorage.get('user_token') |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
this.point_data = res.data.data |
|
|
|
console.log(this.point_data) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 页面触底,加载下一页 |
|
|
|
onScrolltolower(){ |
|
|
|
if(this.isPage){ |
|
|
|
this.page = this.page + 1; |
|
|
|
this.getPointList(); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 下拉刷新处理 |
|
|
|
refreshFn(options){ |
|
|
|
this.page = 1; |
|
|
|
this.isPage = true; |
|
|
|
this.loadingClass = true; |
|
|
|
this.list = [] |
|
|
|
this.loadingText = '正在加载中'; |
|
|
|
this.getPointList(options); |
|
|
|
}, |
|
|
|
// scroll-view 下拉刷新 |
|
|
|
onRefresherrefresh(){ |
|
|
|
this.isRefresher = true; |
|
|
|
this.refreshFn({type: 'scrollRefresh'}); |
|
|
|
}, |
|
|
|
getPointList(options = {}){ |
|
|
|
this.$http.get({ |
|
|
|
api: 'api/users/point/list', |
|
|
|
data: { |
|
|
|
day: this.date || this.nowDate |
|
|
|
}, |
|
|
|
header: { |
|
|
|
Authorization: this.$cookieStorage.get('user_token') |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
console.log("----", res); |
|
|
|
let isPage = this.page < res.data.meta.pagination.total_pages?true:false; |
|
|
|
this.isPage = isPage; |
|
|
|
if(!isPage) { |
|
|
|
this.loadingClass = false; |
|
|
|
this.loadingText = '没有更多数据啦~'; |
|
|
|
} |
|
|
|
if(options.type == 'pageRefresh') { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
}else if(options.type == 'scrollRefresh') { |
|
|
|
this.isRefresher = false; |
|
|
|
} |
|
|
|
if(this.page == 1) { |
|
|
|
let list = res.data.data; |
|
|
|
list.forEach((item,index) => { |
|
|
|
if(item.value.indexOf('-') != -1) { |
|
|
|
this.$set(item,'ifNegative',true) |
|
|
|
}else { |
|
|
|
this.$set(item,'ifNegative',false) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.list = list; |
|
|
|
}else { |
|
|
|
let list = res.data.data; |
|
|
|
list.forEach((item,index) => { |
|
|
|
if(item.value.indexOf('-') != -1) { |
|
|
|
this.$set(item,'ifNegative',true) |
|
|
|
}else { |
|
|
|
this.$set(item,'ifNegative',false) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.list.push(...list); |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|