|
@@ -75,6 +75,7 @@
|
|
<script>
|
|
<script>
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { VSelect } from '@/components'
|
|
import { VSelect } from '@/components'
|
|
|
|
+import debounce from 'lodash/debounce'
|
|
import warehouse from '@/views/common/chooseWarehouse.js'
|
|
import warehouse from '@/views/common/chooseWarehouse.js'
|
|
import { dealerSubareaScopeList, dealerDetailBySn } from '@/api/dealer'
|
|
import { dealerSubareaScopeList, dealerDetailBySn } from '@/api/dealer'
|
|
import { getDefaultWarehouse } from '@/api/warehouse'
|
|
import { getDefaultWarehouse } from '@/api/warehouse'
|
|
@@ -87,6 +88,8 @@ export default {
|
|
show: [Boolean]
|
|
show: [Boolean]
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
|
|
+ this.lastFetchId = 0
|
|
|
|
+ this.fetchUser = debounce(this.fetchUser, 800)
|
|
return {
|
|
return {
|
|
opened: this.show,
|
|
opened: this.show,
|
|
spinning: false,
|
|
spinning: false,
|
|
@@ -122,18 +125,18 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- // 搜索经销商
|
|
|
|
- fetchUser (value) {
|
|
|
|
- console.log('fetching user', value)
|
|
|
|
|
|
+ fetchUser (dealerName) {
|
|
|
|
+ if (dealerName == '') return
|
|
|
|
+ this.lastFetchId += 1
|
|
|
|
+ const fetchId = this.lastFetchId
|
|
|
|
+ this.dealerData = []
|
|
this.fetching = true
|
|
this.fetching = true
|
|
- dealerSubareaScopeList({ nameLike: value.replace(/\s+/g, ''), pageNo: 1, pageSize: 20 }).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.dealerData = res.data && res.data.list ? res.data.list : []
|
|
|
|
- this.fetching = false
|
|
|
|
- } else {
|
|
|
|
- this.dealerData = []
|
|
|
|
- this.fetching = false
|
|
|
|
|
|
+ dealerSubareaScopeList({ nameLike: dealerName.replace(/\s+/g, ''), pageNo: 1, pageSize: 20 }).then(res => {
|
|
|
|
+ if (fetchId !== this.lastFetchId) {
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
+ this.dealerData = res.data && res.data.list ? res.data.list : []
|
|
|
|
+ this.fetching = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 客户 change
|
|
// 客户 change
|