| | |
| | | <template> |
| | | <view class="container"> |
| | | <search-bar :placeholder=placeholder></search-bar> |
| | | <view class="sort-wrap"> |
| | | <view @click="filterCustom(1)"> |
| | | <text>本月到店次数</text> |
| | | <text class="iconfont iconjiantouarrow486 gray"></text> |
| | | </view> |
| | | <view @click="filterCustom(3)"> |
| | | <text>筛选</text> |
| | | <text class="iconfont iconshaixuan gray"></text> |
| | | </view> |
| | | </view> |
| | | <filter-dropdown ref="filterDropdownEl" :list="filterList" :type="filterType"></filter-dropdown> |
| | | <view class="flex justify-between" @click="toDetail"> |
| | | <view class="flex-1 mr-10"> |
| | | <view class="member-list flex align-center" v-for="(item, index) in 15"> |
| | | <text class="first-name" :style="{background: caculateBgcolor(index)}">李</text> |
| | | <view class="flex-1 flex align-center justify-between member-list-con"> |
| | | <view> |
| | | <text>李广</text> |
| | | <text class="ml-10">152****9645</text> |
| | | </view> |
| | | <view> |
| | | <text class="blue">30天未到店</text> |
| | | <text class="iconfont iconarrow-backimg gray"></text> |
| | | </view> |
| | | </view> |
| | | |
| | | <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> |
| | | <indexed-list></indexed-list> |
| | | </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"> |
| | | <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> |
| | | <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 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 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> --> |
| | | </view> |
| | | <view class="quick-entry"> |
| | | <navigator url="./editMember" hover-class="navigator-hover"> |
| | | <text class="iconfont iconjiahao"></text> |
| | | <text class="iconfont iconjia"></text> |
| | | </navigator> |
| | | </view> |
| | | </view> |
| | |
| | | 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 { |
| | | placeholder:"请输入会员姓名、手机号、编号查询", |
| | | isFocus: false, |
| | | colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4'], |
| | | filterType: 1, |
| | | filterList: [], |
| | | filter1: ['本月到店次数(由低到高)','本月到店次数(由高到低)','本年到店次数(由低到高)','本年到店次数(由高到低)','本月消费(由高到低)','本月消费(由低到高)','本月消耗(由高到低)','本月消耗(由低到高)'], |
| | | filter2: ['7天内卡项到期','15天内卡项到期','30天内卡项到期'], |
| | | filter3: [{ |
| | | title: '到店途径', |
| | | filterText: '本月到店次数(由高到低)', |
| | | filter1: [{ |
| | | title: '本月到店次数(由高到低)', |
| | | key: 'monthArrived', |
| | | value: 'desc' |
| | | },{ |
| | | title: '本月到店次数(由低到高)', |
| | | key: 'monthArrived', |
| | | value: 'asc' |
| | | },{ |
| | | title: '本年到店次数(由高到低)', |
| | | key: 'yearArrived', |
| | | value: 'desc' |
| | | },{ |
| | | title: '本年到店次数(由低到高)', |
| | | key: 'yearArrived', |
| | | value: 'asc' |
| | | },{ |
| | | title: '本月消费(由高到低)', |
| | | key: 'used', |
| | | value: 'desc' |
| | | },{ |
| | | title: '本月消费(由低到高)', |
| | | key: 'used', |
| | | value: 'asc' |
| | | },{ |
| | | title: '本月消耗(由高到低)', |
| | | key: 'consume', |
| | | value: 'desc' |
| | | },{ |
| | | title: '本月消耗(由低到高)', |
| | | key: 'consume', |
| | | value: 'asc' |
| | | },{ |
| | | title: '会员级别(由高到低)', |
| | | key: 'vipLevel', |
| | | value: 'desc' |
| | | },{ |
| | | title: '会员级别(由低到高)', |
| | | key: 'vipLevel', |
| | | value: 'asc' |
| | | },{ |
| | | title: '上次到店时间(由近到远)', |
| | | key: 'arriveTime', |
| | | value: 'desc' |
| | | },{ |
| | | title: '上次到店时间(由远到近)', |
| | | key: 'arriveTime', |
| | | value: 'asc' |
| | | }], |
| | | filterKeys: {birthType: '', vipType: '', other: ''}, |
| | | filter2: [{ |
| | | title: '生日', |
| | | key: 'birthType', |
| | | list: [ |
| | | { |
| | | 'title': '美团预约', |
| | | 'value': '' |
| | | 'title': '三天内生日', |
| | | 'value': 1 |
| | | }, |
| | | { |
| | | 'title': '网络预约', |
| | | 'value': '' |
| | | 'title': '本月生日', |
| | | 'value': 2 |
| | | }, |
| | | { |
| | | 'title': '下月生日', |
| | | 'value': 3 |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | title: '会员等级', |
| | | list: [ |
| | | { |
| | | 'title': '一级会员', |
| | | 'value': '' |
| | | }, |
| | | { |
| | | 'title': '二级会员', |
| | | 'value': '' |
| | | }, |
| | | { |
| | | 'title': '三级会员', |
| | | 'value': '' |
| | | } |
| | | ] |
| | | title: '会员类型', |
| | | key: 'vipType', |
| | | list: [] |
| | | }, |
| | | { |
| | | title: '活跃度', |
| | | title: '其他', |
| | | key: 'other', |
| | | list: [ |
| | | { |
| | | 'title': '活跃', |
| | | 'value': '' |
| | | 'title': '老客户', |
| | | 'value': 1 |
| | | }, |
| | | { |
| | | 'title': '不活跃', |
| | | 'value': '' |
| | | }, |
| | | { |
| | | 'title': '睡眠', |
| | | 'value': '' |
| | | }, |
| | | { |
| | | 'title': '沉睡', |
| | | 'value': '' |
| | | 'title': '新客户', |
| | | 'value': 2 |
| | | } |
| | | ] |
| | | }] |
| | | }], |
| | | queryKey: '', |
| | | 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]; |
| | | }, |
| | | toDetail(){ |
| | | uni.navigateTo({ |
| | | url:'./detail' |
| | | }) |
| | | }, |
| | | filterCustom(type){ |
| | | showFilterCustom(type){ |
| | | this.$refs.filterDropdownEl.show(); |
| | | if(type===1){ |
| | | this.filterList = this.filter1; |
| | | this.filterType = 1; |
| | | } else if(type===2){ |
| | | this.filterList = this.filter2; |
| | | this.filterType = 1; |
| | | } else { |
| | | this.filterList = this.filter3; |
| | | this.filterList = this.filter2; |
| | | this.filterType = 0; |
| | | } |
| | | }, |
| | | |
| | | // 搜索 |
| | | search(val){ |
| | | this.$refs.filterDropdownEl.hide(); |
| | | this.queryKey = val; |
| | | this.reloadData(); |
| | | }, |
| | | // 重置筛选 |
| | | resetFilter(){ |
| | | this.filterKeys = {birthType: '', vipType: '', other: ''}; |
| | | this.reloadData(); |
| | | }, |
| | | // 全部筛选 |
| | | confirmFilter(val){ |
| | | if(this.filterType == 1){ |
| | | this.sort = val.key; |
| | | this.order = val.value; |
| | | this.filterText = val.title; |
| | | } else { |
| | | this.filterKeys = val; |
| | | } |
| | | this.reloadData(); |
| | | }, |
| | | // 获取会员类型 |
| | | loadMemberType(){ |
| | | this.$httpUtils.request('/api/vip/findVipType').then((res) => { |
| | | if(res.status == 200){ |
| | | let result = res.rows.map((item) => { |
| | | return { |
| | | title: item.levelName, |
| | | value: item.id |
| | | } |
| | | }); |
| | | this.filter2[1].list = result; |
| | | } |
| | | }) |
| | | }, |
| | | loadMemberList(){ |
| | | if(this.loadStatus!=='more'){ |
| | | return; |
| | | } |
| | | let parma = Object.assign({ |
| | | order: this.order, |
| | | queryKey: this.queryKey, |
| | | sort: this.sort, |
| | | pageNum: this.pageNum, |
| | | pageSize: 10 |
| | | }, this.filterKeys) |
| | | this.$httpUtils.request('/api/vip/findVipInfoList', parma, 'POST').then((res) => { |
| | | if(res.status == 200){ |
| | | 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 = []; |
| | | }) |
| | | } |
| | | }, |
| | | filters:{ |
| | | formatName(val){ |
| | | if(!val){ |
| | | return '无' |
| | | } |
| | | val = val.trim(); |
| | | return val.substr(0, 1) |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | <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; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | font-size: 14px; |
| | | font-size: 13px; |
| | | padding: 10px 0; |
| | | } |
| | | .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; |
| | |
| | | border-radius: 50%; |
| | | text-align: center; |
| | | color: #FFFFFF; |
| | | font-size: 16px; |
| | | } |
| | | .member-list{ |
| | | font-size: 15px; |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 14px; |
| | | } |
| | | .member-list-con{ |
| | | padding: 20px 0 20px 5px; |
| | | 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; |
| | |
| | | border-radius: 50%; |
| | | background: #518EFF; |
| | | color: #FFFFFF; |
| | | box-shadow: 4px 4px 5px #ddd; |
| | | } |
| | | .quick-entry .iconfont{ |
| | | font-size: 24px; |