From c607d0b894faf6c021eaf80383b44d05743aeff4 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 13 May 2022 17:40:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=AE=A2=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/clientDetail/clientDetail.vue | 95 +++++++++++++++++++++++++++-- pages/clients/clients.vue | 4 +- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/pages/clientDetail/clientDetail.vue b/pages/clientDetail/clientDetail.vue index 03837f2..c48037c 100644 --- a/pages/clientDetail/clientDetail.vue +++ b/pages/clientDetail/clientDetail.vue @@ -13,7 +13,7 @@ - + {{ form.customerName || '请选择学校' }} @@ -71,6 +71,16 @@ 订单 + + + + 请选择学校 + + + + {{ item.schoolName }} + + @@ -95,7 +105,11 @@ value: 3 }], nameRepeat: false, + schoolVisible: false, + keyword: '', + searchTimer: null, schoolList: [], + schoolListAll: [], industryClassList: [], industryList: [], form: { @@ -153,6 +167,14 @@ customerType: '', } }, + watch: { + keyword () { + clearTimeout(this.searchTimer) + this.searchTimer = setTimeout(() => { + this.filterSchool() + }, 500) + } + }, onLoad(option) { this.customerId = option.customerId this.isDetail = !!option.show @@ -195,20 +217,34 @@ provinceId: '', cityId: '' }).then(({ list }) => { + this.schoolListAll = list this.schoolList = list }).catch(res => {}) }, + // 学校模糊匹配 + filterSchool() { + const { keyword } = this + this.schoolList = keyword ? + this.schoolListAll.filter(e => e.schoolName.includes(keyword)) : + this.schoolListAll + }, + // 关闭学校弹框 + closeSchool() { + this.schoolVisible = false + this.keyword = '' + }, // 客户名称选择回调 - schoolChange() { + schoolChange(school) { const { form } = this const { schoolId } = form - console.log(33, form) - const school = this.schoolList.find(e => e.schoolId === schoolId) + form.schoolId = school.schoolId form.customerName = school.schoolName form.provinceId = school.provinceId form.provinceName = school.provinceName form.cityId = school.cityId form.cityName = school.cityName + this.closeSchool() + // 客户名称判重 queryCustomerIsExists({ schoolId }).then(res => { @@ -306,4 +342,55 @@ color: #959595; } } +.school-input { + padding: 0 10px; + font-size: 12px; + line-height: 34px; + color: #ccc; + border: 1px solid #e5e5e5; + border-radius: 4px; + &.active { + color: #333; + } +} +.mask { + z-index: 9; + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + background-color: rgba(0, 0, 0, .5); +} +.school-popup { + z-index: 10; + position: fixed; + bottom: 0%; + width: 100%; + height: 90vh; + background-color: #fff; + border-top-left-radius: 8px; + border-top-right-radius: 8px; + .top { + text-align: center; + line-height: 50px; + font-size: 14px; + color: #333; + border-bottom: 1px solid #f1f1f1; + } + .close { + position: absolute; + top: 15px; + right: 15px; + } + .list { + max-height: calc(90vh - 103px); + padding: 0 15px; + overflow: auto; + .item { + line-height: 34px; + font-size: 12px; + } + } +} diff --git a/pages/clients/clients.vue b/pages/clients/clients.vue index 80cb13f..d7e4d2e 100644 --- a/pages/clients/clients.vue +++ b/pages/clients/clients.vue @@ -6,7 +6,7 @@ - + @@ -85,7 +85,7 @@ slFilter }, watch: { - keyword (newName, oldName) { + keyword () { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { this.initList()