diff --git a/src/pages/order/create.vue b/src/pages/order/create.vue index 9fb97ff..f989e24 100644 --- a/src/pages/order/create.vue +++ b/src/pages/order/create.vue @@ -216,7 +216,7 @@ export default { } }, onLoad(options) { - this.loadCustomers() + this.loadCustomersByType() this.loadProducts() if (options.orderId) { this.editingOrderId = options.orderId @@ -302,8 +302,21 @@ export default { const idx = e.detail.value this.selectedType = this.typeOptions[idx].value this.selectedTypeLabel = this.typeOptions[idx].label - // 切换种类后清除已选客户 + // 切换种类后清除已选客户,重新拉取该种类的客户 this.selectedCustomer = null + this.loadCustomersByType() + }, + async loadCustomersByType() { + try { + const res = await customerApi.getCustomers({ + type: this.selectedType, + page: 1, + pageSize: 100 + }) + this.customers = res.records || [] + } catch (e) { + console.error(e) + } }, goToSelectProduct() { uni.navigateTo({ url: '/pages/product/select' })