From d12b432f4a009d87a9946ae81bdea5c9895a2bfe Mon Sep 17 00:00:00 2001
From: zhaoxiaoqiang
Date: Tue, 18 May 2021 14:47:04 +0800
Subject: [PATCH] 店员搜索
---
src/views/mine/stores/storeOprs.vue | 69 +++++++++-------------------------
src/views/mine/account/account.vue | 26 ++++++------
2 files changed, 31 insertions(+), 64 deletions(-)
diff --git a/src/views/mine/account/account.vue b/src/views/mine/account/account.vue
index 1fbad7a..65d1f4d 100644
--- a/src/views/mine/account/account.vue
+++ b/src/views/mine/account/account.vue
@@ -9,21 +9,21 @@
<div class="account ">
<v-navbar title="账号管理" fixed></v-navbar>
<van-search v-model="value" class="search" placeholder="请输入姓名/手机号" shape='round'/>
-
- <div class="item-box">
- <div class="account-item flex-start-g" v-for="(item, index) in calcList" :key="index" @click="go(item.id)">
- <p class="icon-box flex-center-g" :style="{background:$store.state.backColor}">
- <svg class="icon" aria-hidden="true" style="width:25px;height:25px;fill:#fff" >
- <use xlink:href="#iconyonghu"></use>
- </svg>
- </p>
+
+ <div class="item-box">
+ <div class="account-item flex-start-g" v-for="(item, index) in calcList" :key="index" @click="go(item.id)">
+ <p class="icon-box flex-center-g" :style="{background:$store.state.backColor}">
+ <svg class="icon" aria-hidden="true" style="width:25px;height:25px;fill:#fff" >
+ <use xlink:href="#iconyonghu"></use>
+ </svg>
+ </p>
- <div>
- <p class="name">{{item.name}}</p>
- <p class="c-text-666-g font-12-g">{{item.mblNo}}</p>
- </div>
- </div>
+ <div>
+ <p class="name">{{item.name}}</p>
+ <p class="c-text-666-g font-12-g">{{item.mblNo}}</p>
</div>
+ </div>
+ </div>
<van-button class="btn" @click="$router.push('/mine/account-add?isAdd=1')" :style="{background:$store.state.backColor}">
<div class="inner" >
diff --git a/src/views/mine/stores/storeOprs.vue b/src/views/mine/stores/storeOprs.vue
index bc25800..a78e593 100644
--- a/src/views/mine/stores/storeOprs.vue
+++ b/src/views/mine/stores/storeOprs.vue
@@ -6,17 +6,9 @@
<template>
<div class="stores-box h-100-g">
<v-navbar title="店员管理" fixed></v-navbar>
- <van-search class="search" placeholder="负责人姓名/负责人手机号" v-model="value" shape='round' @search="onSearch"/>
+ <van-search class="search" placeholder="负责人姓名/负责人手机号" v-model="value" shape='round' />
<div class="item-box">
- <van-list
- v-model="loading"
- :finished="finished"
- immediate-check='false'
- offset="50"
- finished-text="没有更多了"
- @load="onLoad"
- >
- <div class="stores-item flex-start-g" v-for="(item, index) in list" :key="index" @click="go(item.id)">
+ <div class="stores-item flex-start-g" v-for="(item, index) in calcList" :key="index" @click="go(item.id)">
<p class="icon-box flex-center-g">
<svg class="icon" aria-hidden="true" style="width:25px;height:25px;fill:#fff" >
<use xlink:href="#iconyonghu"></use>
@@ -27,7 +19,6 @@
<p class="c-text-666-g font-12-g" v-text="item.mblNo || ''">13586695442</p>
</div>
</div>
- </van-list>
</div>
<van-button class="btn" @click="goAdd">
<div class="inner">
@@ -51,63 +42,39 @@
queryStoreId:""
}
},
-
+ computed:{
+ // 根据搜索关键字获取 对应的数据
+ calcList(){
+ let v = this.value;
+ let arr = this.list.filter(item=>{
+ return item.name.indexOf(v) > -1 || item.mblNo.indexOf(v) > -1;
+ })
+ if(arr){
+ return arr
+ }
+ return this.list;
+ }
+ },
created(){
this.queryStoreId =this.$route.query.storeId;
this.init();
},
methods: {
init(){
- this.loading = true
+ this.loading =true;
this.$api.storeStorePersonList({
- searchKey:this.value,
orgId:this.queryStoreId,
}).then((res) => {
- if(res.body.length < 10){
- this.list = [...this.list,...res.body]
- this.storeId = ''
- this.finished = true
- this.loading = false
- }else{
- this.list = [...this.list,...res.body]
- this.storeId = this.list[this.list.length-1].storeId
- this.finished = false
- this.loading = false
- }
+ this.loading =false;
+ this.list = res.body ||[];
})
},
go(id) {
this.$router.push({path:'/mine/storeOprs-detail',query:{mgrId:id,storeId:this.queryStoreId}});
},
goAdd(){
- console.log(this.storeId)
this.$router.push({path:'/mine/storeOprs-add',query:{storeId:this.queryStoreId}})
- },
- onLoad(){
- this.init()
- },
- onSearch(val){
- this.list = []
- this.loading = true
- this.$api.storeStorePersonList({
- searchKey:this.value,
- orgId:this.queryStoreId,
- }).then(res=>{
- if(res.body.length < 10){
- this.list = [...this.list,...res.body]
- this.storeId = ''
- this.finished = true
- this.loading = false
- }else{
- this.list = [...this.list,...res.body]
- this.storeId = this.list[this.list.length-1].storeId
- this.finished = false
- this.loading = false
- }
- })
}
-
-
}
}
</script>
--
Gitblit v1.8.0