From 4300b5c714bb7e09f53f7d722c953dec9c809d8e Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Mon, 04 Jan 2021 17:08:59 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/jyyforjava/hive-app into master

---
 hive-app/pages/member/index.vue |  293 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 291 insertions(+), 2 deletions(-)

diff --git a/hive-app/pages/member/index.vue b/hive-app/pages/member/index.vue
index 4646a47..7fe43e2 100644
--- a/hive-app/pages/member/index.vue
+++ b/hive-app/pages/member/index.vue
@@ -1,9 +1,298 @@
 <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>
+		</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">
+				<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>
+					<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>
+						</view>
+						<view>
+							<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>
+			<indexed-list></indexed-list>
+		</view>
+		<view class="quick-entry">
+			<navigator url="./editMember" hover-class="navigator-hover">
+				<text class="iconfont iconjia"></text>
+			</navigator>
+		</view>
+	</view>
 </template>
 
 <script>
+	import searchBar from '../../components/searchBar/index.vue';
+	import indexedList from '../../components/indexedList/index.vue';
+	import filterDropdown from '../../components/filterDropdown/index.vue';
+	export default {
+		components:{
+			searchBar,
+			indexedList,
+			filterDropdown
+		},
+		data() {
+			return {
+				colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4'],
+				filterType: 1,
+				filterList: [],
+				filterText: '首字母排序',
+				filter1: [{
+					title: '首字母排序',
+					key: '',
+					value: ''
+				},{
+					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': 1
+						},
+						{
+							'title': '本月生日',
+							'value': 2
+						},
+						{
+							'title': '下月生日',
+							'value': 3
+						}
+					]
+				},
+				{
+					title: '会员类型',
+					key: 'vipType',
+					list: []
+				},
+				{
+					title: '其他',
+					key: 'other',
+					list: [
+						{
+							'title': '老客户',
+							'value': 1
+						},
+						{
+							'title': '新客户',
+							'value': 2
+						}
+					]
+				}],
+				queryKey: '',
+				sort: '',
+				order: '',
+				list: []
+			};
+		},
+		onLoad() {
+			this.loadMemberType()
+			this.loadMemberList()
+		},
+		onHide(){
+			this.$refs.filterDropdownEl.hide();
+		},
+		methods:{
+			caculateBgcolor(index){
+				return this.colors[index%8];
+			},
+			showFilterCustom(type){
+				this.$refs.filterDropdownEl.show();
+				if(type===1){
+					this.filterList = this.filter1;
+					this.filterType = 1;
+				} else {
+					this.filterList = this.filter2;
+					this.filterType = 0;
+				}
+			},
+			
+			// 搜索
+			search(val){
+				this.$refs.filterDropdownEl.hide();
+				this.queryKey = val;
+				this.loadMemberList();
+			},
+			// 重置筛选
+			resetFilter(){
+				this.filterKeys = {birthType: '', vipType: '', other: ''};
+				this.loadMemberList();
+			},
+			// 全部筛选
+			confirmFilter(val){
+				if(this.filterType == 1){
+					this.sort = val.key;
+					this.order = val.value;
+					this.filterText = val.title;
+				} else {
+					this.filterKeys = val;
+				}
+				this.loadMemberList();
+			},
+			// 获取会员类型
+			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(){
+				let parma = Object.assign({
+					order: this.order,
+					queryKey: this.queryKey,
+					sort: this.sort
+				}, this.filterKeys)
+				this.$httpUtils.request('/api/vip/findVipInfoList', parma, 'POST').then((res) => {
+					if(res.status == 200){
+						this.list = res.rows;
+					} else {
+						this.list = [];
+					}
+				}).catch((err) => {
+					this.list = [];
+				})
+			}
+		},
+		filters:{
+			formatName(val){
+				if(!val){
+					return '无'
+				}
+				val = val.trim();
+				return val.substr(0, 1)
+			}
+		}
+	}
 </script>
 
-<style>
+<style scoped>
+	.container{
+		padding: 10px 10px 0;
+	}
+	.sort-wrap{
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		font-size: 13px;
+		padding: 10px 0;
+	}
+	.sort-wrap .iconfont{
+		font-size: 14px;
+		padding-left: 4px;
+	}
+	.first-name{
+		display: inline-block;
+		width: 38px;
+		height: 38px;
+		line-height: 38px;
+		margin-right: 10px;
+		border-radius: 50%;
+		text-align: center;
+		color: #FFFFFF;
+		font-size: 16px;
+	}
+	.member-list{
+		display: flex;
+		align-items: center;
+		font-size: 14px;
+	}
+	.member-list-con{
+		padding: 15px 0 15px 5px;
+		border-bottom: 1px solid #EDEAF4;
+	}
+	.quick-entry{
+		position: fixed;
+		bottom: 80px;
+		right: 15px;
+		width: 50px;
+		height: 50px;
+		line-height: 50px;
+		text-align: center;
+		border-radius: 50%;
+		background: #518EFF;
+		color: #FFFFFF;
+	}
+	.quick-entry .iconfont{
+		font-size: 24px;
+	}
+	.navigator-hover{
+		border-radius: 50%;
+	}
 </style>

--
Gitblit v1.9.1