From b83ba3cc4687f21d744e9866e10e30e91229e8a4 Mon Sep 17 00:00:00 2001 From: queenwuli <942534046@qq.com> Date: Thu, 28 Jan 2021 16:23:30 +0800 Subject: [PATCH] gx --- hive-app/pages/member/index.vue | 71 +++++++++++++++++++++++++---------- 1 files changed, 51 insertions(+), 20 deletions(-) diff --git a/hive-app/pages/member/index.vue b/hive-app/pages/member/index.vue index c0b5f98..ef80594 100644 --- a/hive-app/pages/member/index.vue +++ b/hive-app/pages/member/index.vue @@ -16,10 +16,10 @@ </view> <filter-dropdown ref="filterDropdownEl" :list="filterList" :filterKey="filterKeys" :type="filterType" @confirm="confirmFilter" @reset="resetFilter"></filter-dropdown> <view class="content flex justify-between"> - <view class="flex-1 mr-10"> + <view class="flex-1"> <navigator :url="'./detail?id='+item.id" hover-class="none" class="member-list" v-for="(item, index) in list"> <template> - <image v-if="item.photo" src="item.photo" class="avatar"></image> + <image v-if="item.photo" :src="item.photo" class="avatar"></image> <text v-else class="first-name" :style="{background: caculateBgcolor(index)}">{{item.vipName | formatName}}</text> </template> <view class="flex-1 flex align-center justify-between member-list-con"> @@ -37,8 +37,11 @@ </view> </navigator> <no-record :isShow="!list.length"></no-record> + <view v-if="list.length"> + <uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more> + </view> </view> - <indexed-list></indexed-list> + <!-- <indexed-list></indexed-list> --> </view> <view class="quick-entry"> <navigator url="./editMember" hover-class="navigator-hover"> @@ -52,11 +55,13 @@ import searchBar from '../../components/searchBar/index.vue'; import indexedList from '../../components/indexedList/index.vue'; import filterDropdown from '../../components/filterDropdown/index.vue'; + import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'; export default { components:{ searchBar, indexedList, - filterDropdown + filterDropdown, + uniLoadMore }, data() { return { @@ -64,12 +69,8 @@ colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4'], filterType: 1, filterList: [], - filterText: '首字母排序', + filterText: '本月到店次数(由高到低)', filter1: [{ - title: '首字母排序', - key: '', - value: '' - },{ title: '本月到店次数(由高到低)', key: 'monthArrived', value: 'desc' @@ -157,9 +158,11 @@ ] }], queryKey: '', - sort: '', - order: '', - list: [] + sort: 'monthArrived', + order: 'desc', + list: [], + loadStatus: 'more', + pageNum: 1 }; }, onLoad() { @@ -173,7 +176,24 @@ this.$refs.filterDropdownEl.hide(); getApp().globalData.isFocus = false; }, + onPullDownRefresh(){ + this.reloadData(); + let timer = setTimeout(function () { + uni.stopPullDownRefresh(); + clearTimeout(timer); + timer = null; + }, 800); + }, + onReachBottom(){ + this.loadMemberList() + }, methods:{ + reloadData(){ + this.list = []; + this.pageNum = 1; + this.loadStatus = 'more'; + this.loadMemberList(); + }, caculateBgcolor(index){ return this.colors[index%8]; }, @@ -192,12 +212,12 @@ search(val){ this.$refs.filterDropdownEl.hide(); this.queryKey = val; - this.loadMemberList(); + this.reloadData(); }, // 重置筛选 resetFilter(){ this.filterKeys = {birthType: '', vipType: '', other: ''}; - this.loadMemberList(); + this.reloadData(); }, // 全部筛选 confirmFilter(val){ @@ -208,7 +228,7 @@ } else { this.filterKeys = val; } - this.loadMemberList(); + this.reloadData(); }, // 获取会员类型 loadMemberType(){ @@ -225,16 +245,26 @@ }) }, loadMemberList(){ + if(this.loadStatus!=='more'){ + return; + } let parma = Object.assign({ order: this.order, queryKey: this.queryKey, - sort: this.sort + sort: this.sort, + pageNum: this.pageNum, + pageSize: 10 }, this.filterKeys) - this.$httpUtils.request('/api/vip/findVipInfoList', parma, 'POST', {isShowLoad: true}).then((res) => { + this.$httpUtils.request('/api/vip/findVipInfoList', parma, 'POST').then((res) => { if(res.status == 200){ - this.list = res.rows; - } else { - this.list = []; + let result = res.rows; + if(result.length < 10){ + this.loadStatus = 'noMore'; + } else { + this.pageNum ++ ; + this.loadStatus = 'more'; + } + this.list = this.list.concat(result); } }).catch((err) => { this.list = []; @@ -264,6 +294,7 @@ right: 0; padding: var(--status-bar-height) 10px 0; background: #FFFFFF; + z-index: 99; } .sort-wrap{ display: flex; -- Gitblit v1.9.1