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()