From 45fb4b11ad51bb38306765b11a6747402e382cee Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Sat, 20 Feb 2021 17:37:33 +0800
Subject: [PATCH] fix

---
 hive-app/pages/workbench/selectCustomer.vue |  116 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 102 insertions(+), 14 deletions(-)

diff --git a/hive-app/pages/workbench/selectCustomer.vue b/hive-app/pages/workbench/selectCustomer.vue
index 60b4e15..73d3b0d 100644
--- a/hive-app/pages/workbench/selectCustomer.vue
+++ b/hive-app/pages/workbench/selectCustomer.vue
@@ -1,23 +1,36 @@
 <template>
 	<view class="container">
-		<search-bar placeholder="客户姓名、手机、卡号、拼音"></search-bar>
+		<search-bar @confirm="search"></search-bar>
 		<view class="flex justify-between">
-			<navigator :url="'./customerInfo?type='+type" hover-class="none"  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">
+				<navigator class="member-list flex align-center" 
+					:url="'./customerInfo?type='+type+'&id='+item.id" 
+					hover-class="none"
+					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>
-							<text>李广</text>
-							<text class="ml-10">152****9645</text>
+						<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>
-							<text class="blue">东莞店</text>
-							<text class="iconfont iconarrow-backimg gray"></text>
+							<text class="blue">{{item.shopName}}</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>
-			</navigator>
-			<indexed-list></indexed-list>
+			</view>
+			<!-- <indexed-list></indexed-list> -->
 		</view>
 	</view>
 </template>
@@ -25,26 +38,87 @@
 <script>
 	import searchBar from '../../components/searchBar/index.vue';
 	import indexedList from '../../components/indexedList/index.vue';
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
 	export default {
 		components:{
 			searchBar,
-			indexedList
+			indexedList,
+			uniLoadMore
 		},
 		data() {
 			return {
 				type: 1 ,//1新建订单 2新建服务单
-				colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4']
+				colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4'],
+				queryKey: '',
+				list: [],
+				loadStatus: 'more',
+				pageNum: 1
 			};
 		},
 		onLoad(options) {
 			if(options.type){
 				this.type = options.type;
 			}
+			this.loadMemberList()
+		},
+		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];
 			},
+			search(val){
+				this.queryKey = val;
+				this.reloadData();
+			},
+			loadMemberList(){
+				if(this.loadStatus!=='more'){
+					return;
+				}
+				let parma = Object.assign({
+					order: this.order,
+					queryKey: this.queryKey,
+					sort: this.sort,
+					pageNum: this.pageNum,
+					pageSize: 15
+				})
+				this.$httpUtils.request('/api/vip/findVipInfoList', parma, 'POST').then((res) => {
+					if(res.status == 200){
+						let result = res.rows;
+						if(result.length < 15){
+							this.loadStatus = 'noMore';
+						} else {
+							this.pageNum ++ ;
+							this.loadStatus = 'more';
+						}
+						this.list = this.list.concat(result);
+					}
+				})
+			}
+		},
+		filters:{
+			formatName(val){
+				if(!val){
+					return '无'
+				}
+				val = val.trim();
+				return val.substr(0, 1)
+			}
 		}
 	}
 </script>
@@ -63,6 +137,12 @@
 		font-size: 14px;
 		padding-left: 4px;
 	}
+	.avatar{
+		display: inline-block;
+		width: 38px;
+		height: 38px;
+		border-radius: 50%;
+	}
 	.first-name{
 		display: inline-block;
 		width: 38px;
@@ -78,9 +158,17 @@
 		font-size: 14px;
 	}
 	.member-list-con{
-		padding: 18px 0 18px 5px;
+		padding: 15px 0 15px 5px;
 		border-bottom: 1px solid #EDEAF4;
 	}
+	.member-list .vip-level{
+		border: 1px solid #666;
+		margin-left: 10px;
+		font-size: 12px;
+		border-radius: 12px;
+		padding: 2px 12px;
+		color: #666666;
+	}
 	.quick-entry{
 		position: fixed;
 		bottom: 80px;

--
Gitblit v1.9.1