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/member/selectCustomer.vue | 50 ++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/hive-app/pages/member/selectCustomer.vue b/hive-app/pages/member/selectCustomer.vue
index df1f8a7..45a5820 100644
--- a/hive-app/pages/member/selectCustomer.vue
+++ b/hive-app/pages/member/selectCustomer.vue
@@ -3,7 +3,7 @@
<search-bar @confirm="search"></search-bar>
<view class="member-list flex align-center" v-for="(item, index) in list" @click="checkOnchange(item)">
<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">
@@ -19,8 +19,11 @@
</view>
</view>
<no-record :isShow="!list.length"></no-record>
+ <view v-if="list.length">
+ <uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
+ </view>
<view class="footer">
- <text>已选:{{selectItems.length?selectItems.length:0}}人</text>
+ <text>已选:{{selectIds?selectIds.split(',').length:0}}人</text>
<button class="blue-btn btn mr-0" @click="confirm">确定</button>
</view>
</view>
@@ -28,8 +31,10 @@
<script>
import searchBar from '../../components/searchBar/index.vue';
+ import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
export default {
components:{
+ uniLoadMore,
searchBar
},
data() {
@@ -40,6 +45,8 @@
selectIds: '',
selectItems: [],
multiSelect: false, //单选/多选,默认多选
+ loadStatus: 'more',
+ pageNum: 1
};
},
onLoad(options) {
@@ -50,26 +57,51 @@
if(options.multiSelect){
this.multiSelect = new Boolean(options.multiSelect);
}
+ },
+ onShow() {
+ this.loadMemberList()
+ },
+ 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.loadMemberList();
+ this.reloadData();
},
loadMemberList(){
+ if(this.loadStatus!=='more'){
+ return;
+ }
+ let selectedArr = this.selectIds?this.selectIds.split(','):[];
this.$httpUtils.request('/api/vip/findVipInfoList', {
+ pageNum: this.pageNum,
+ pageSize: 15,
queryKey: this.queryKey
}, 'POST').then((res) => {
if(res.status == 200){
- this.list = res.rows.map((item) => {
+ let result = res.rows;
+ if(result.length < 15){
+ this.loadStatus = 'noMore';
+ } else {
+ this.pageNum ++ ;
+ this.loadStatus = 'more';
+ }
+
+ result = result.map((item) => {
let index = this.selectItems.findIndex((op) => {
return op.id == item.id
});
- if(this.selectIds && this.selectIds.indexOf(item.id) > -1){
+ if(this.selectIds && selectedArr.includes(item.id.toString())){
if(index == -1){
this.selectItems.push(item);
}
@@ -77,6 +109,7 @@
}
return Object.assign(item, {isCheck: false})
});
+ this.list = this.list.concat(result);
}
})
},
@@ -86,6 +119,10 @@
}else{
this.singChange(item)
}
+ let selectedArr = this.selectItems.map((item) => {
+ return item.id;
+ })
+ this.selectIds = selectedArr.length?selectedArr.join(','):'';
},
singChange(item){
if(!item.isCheck){
@@ -98,6 +135,7 @@
item.isCheck = false;
this.selectItems = [];
}
+
},
multiChange(item){
let index = this.selectItems.findIndex((op) => {
@@ -196,7 +234,7 @@
}
.footer .btn{
border-radius: 20px;
- line-height: 34px;
+ line-height: 36px;
padding: 0 40px;
font-size: 14px;
}
--
Gitblit v1.9.1