fix: 切换客户种类时重新拉取对应种类客户列表
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Agent
2026-03-29 05:39:18 +00:00
parent f90152f010
commit 293d2dd8fe

View File

@@ -216,7 +216,7 @@ export default {
} }
}, },
onLoad(options) { onLoad(options) {
this.loadCustomers() this.loadCustomersByType()
this.loadProducts() this.loadProducts()
if (options.orderId) { if (options.orderId) {
this.editingOrderId = options.orderId this.editingOrderId = options.orderId
@@ -302,8 +302,21 @@ export default {
const idx = e.detail.value const idx = e.detail.value
this.selectedType = this.typeOptions[idx].value this.selectedType = this.typeOptions[idx].value
this.selectedTypeLabel = this.typeOptions[idx].label this.selectedTypeLabel = this.typeOptions[idx].label
// 切换种类后清除已选客户 // 切换种类后清除已选客户,重新拉取该种类的客户
this.selectedCustomer = null 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() { goToSelectProduct() {
uni.navigateTo({ url: '/pages/product/select' }) uni.navigateTo({ url: '/pages/product/select' })