From 20365ba048f4042dfdc223cf2a6fa8c2d5a699f3 Mon Sep 17 00:00:00 2001 From: zhaoxiaoqiang <287285524@qq.com> Date: Tue, 31 Aug 2021 09:42:45 +0800 Subject: [PATCH] 接口修改 --- src/views/mine/stores/storeOprs.vue | 69 +++++++++------------------------- 1 files changed, 18 insertions(+), 51 deletions(-) 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