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 | 146 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 110 insertions(+), 36 deletions(-) diff --git a/hive-app/pages/member/index.vue b/hive-app/pages/member/index.vue index 760503e..ef80594 100644 --- a/hive-app/pages/member/index.vue +++ b/hive-app/pages/member/index.vue @@ -1,38 +1,47 @@ <template> <view class="container"> - <!-- #ifndef H5 --> - <view class="status_bar"></view> - <!-- #endif --> - <search-bar @confirm="search"></search-bar> - <view class="sort-wrap"> - <view @click="showFilterCustom(1)"> - <text>{{filterText}}</text> - <text class="iconfont iconjiantouarrow486 gray"></text> - </view> - <view @click="showFilterCustom(2)"> - <text>筛选</text> - <text class="iconfont iconshaixuan gray"></text> + + <view class="sticky-header"> + <search-bar @confirm="search" :focus="isFocus" class="mt-10"></search-bar> + <view class="sort-wrap"> + <view @click="showFilterCustom(1)"> + <text>{{filterText}}</text> + <text class="iconfont iconjiantouarrow486 gray"></text> + </view> + <view @click="showFilterCustom(2)"> + <text>筛选</text> + <text class="iconfont iconshaixuan gray"></text> + </view> </view> </view> <filter-dropdown ref="filterDropdownEl" :list="filterList" :filterKey="filterKeys" :type="filterType" @confirm="confirmFilter" @reset="resetFilter"></filter-dropdown> - <view class="flex justify-between"> - <view class="flex-1 mr-10"> + <view class="content flex justify-between"> + <view class="flex-1"> <navigator :url="'./detail?id='+item.id" hover-class="none" class="member-list" v-for="(item, index) in list"> - <text class="first-name" :style="{background: caculateBgcolor(index)}">{{item.vipName | formatName}}</text> + <template> + <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"> <view class="flex flex-v"> - <text>{{item.vipName}}</text> - <text class="font-13 gray mt-5">{{$utils.encryptAccount(item.phone)}}</text> + <text class="mb-10"> + <text>{{item.vipName}}</text> + <text class="vip-level" v-if="item.vipLevel">{{item.vipLevel}}</text> + </text> + <text class="font-13 gray">{{$utils.encryptAccount(item.phone)}}</text> </view> - <view> + <view class="member-list--con-right"> <text class="blue">到店{{item.arriveCnt || 0}}次</text> <text class="iconfont iconarrow-backimg light-gray"></text> </view> </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"> @@ -46,23 +55,22 @@ 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 { + isFocus: false, colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4'], filterType: 1, filterList: [], - filterText: '首字母排序', + filterText: '本月到店次数(由高到低)', filter1: [{ - title: '首字母排序', - key: '', - value: '' - },{ title: '本月到店次数(由高到低)', key: 'monthArrived', value: 'desc' @@ -150,19 +158,42 @@ ] }], queryKey: '', - sort: '', - order: '', - list: [] + sort: 'monthArrived', + order: 'desc', + list: [], + loadStatus: 'more', + pageNum: 1 }; }, onLoad() { this.loadMemberType() this.loadMemberList() }, + onShow() { + this.isFocus = getApp().globalData.isFocus + }, onHide(){ 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]; }, @@ -179,13 +210,14 @@ // 搜索 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){ @@ -196,7 +228,7 @@ } else { this.filterKeys = val; } - this.loadMemberList(); + this.reloadData(); }, // 获取会员类型 loadMemberType(){ @@ -213,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').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 = []; @@ -243,7 +285,16 @@ <style scoped> .container{ - padding: 10px 10px 0; + padding: var(--status-bar-height) 10px 0; + } + .sticky-header{ + position: fixed; + top: 0; + left: 0; + right: 0; + padding: var(--status-bar-height) 10px 0; + background: #FFFFFF; + z-index: 99; } .sort-wrap{ display: flex; @@ -255,6 +306,15 @@ .sort-wrap .iconfont{ font-size: 14px; padding-left: 4px; + } + .content{ + padding-top: 92px + } + .avatar{ + display: inline-block; + width: 38px; + height: 38px; + border-radius: 50%; } .first-name{ display: inline-block; @@ -276,6 +336,20 @@ padding: 15px 0 15px 5px; border-bottom: 1px solid #EDEAF4; } + .member-list--con-right{ + width: 90px; + flex: 0 0 90px; + text-align: right; + } + .member-list .vip-level{ + border: 1px solid #666; + margin-left: 10px; + font-size: 12px; + border-radius: 12px; + padding: 2px 12px; + color: #666666; + word-break: keep-all; + } .quick-entry{ position: fixed; bottom: 80px; -- Gitblit v1.9.1