From 02f192cac67b780cedee3f7af8a70575fa2586ce Mon Sep 17 00:00:00 2001 From: litianyou Date: Sat, 4 Jul 2026 11:19:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(storefabric):=20=E9=99=90=E5=88=B6=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E5=8D=95=E4=BD=8D=E4=B8=8B=E6=8B=89=E4=BB=85=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=BB=87=E5=8E=82=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- src/common/storeFabricBusinessOut.js | 3 + .../storeFabricBusinessOutList.vue | 57 ++++++++++++------- .../storeFabricBusinessOutMixin.js | 3 +- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/common/storeFabricBusinessOut.js b/src/common/storeFabricBusinessOut.js index 665dbc5..96a88b4 100644 --- a/src/common/storeFabricBusinessOut.js +++ b/src/common/storeFabricBusinessOut.js @@ -69,6 +69,9 @@ export const BILL_TYPES = [ /** 列表分页拉取每页条数 */ export const LIST_PAGE_SIZE = 100; +/** 往来单位类型:织厂(接收单位下拉筛选) */ +export const BUSINESS_UNIT_TYPE_KNITTING_FACTORY = 11; + export function getStatusOptions() { return Object.keys(AUDIT_STATUS_MAP).map((value) => ({ value, diff --git a/src/pages/storefabric/storeFabricBusinessOutList.vue b/src/pages/storefabric/storeFabricBusinessOutList.vue index 233202c..ebc284c 100644 --- a/src/pages/storefabric/storeFabricBusinessOutList.vue +++ b/src/pages/storefabric/storeFabricBusinessOutList.vue @@ -70,6 +70,7 @@ import { getStatusOptions, AUDIT_STATUS_MAP, BILL_TYPES, + BUSINESS_UNIT_TYPE_KNITTING_FACTORY, formatRoll, mapToSelectOptions, fetchAllOrderList, @@ -86,7 +87,8 @@ export default { statusSelectShow: false, unitSelectShow: false, unitSelectType: '', - unitOptions: [], + deliveryUnitOptions: [], + businessUnitOptions: [], unitOptionsLoading: false, billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单', filters: { @@ -117,7 +119,8 @@ export default { return this.filters.business_unit_name || ''; }, unitSelectList() { - return [{ value: '', label: '全部' }, ...this.unitOptions]; + const options = this.unitSelectType === 'delivery' ? this.deliveryUnitOptions : this.businessUnitOptions; + return [{ value: '', label: '全部' }, ...options]; }, }, onLoad() { @@ -127,39 +130,53 @@ export default { this.scrollHeight = `${res.windowHeight - 50}px`; }, }); - this.loadUnitOptions(); this.loadList(); }, onShow() { this.loadList(); }, methods: { - loadUnitOptions() { - if (this.unitOptions.length || this.unitOptionsLoading) return Promise.resolve(this.unitOptions); - this.unitOptionsLoading = true; + loadDeliveryUnitOptions() { + if (this.deliveryUnitOptions.length) return Promise.resolve(this.deliveryUnitOptions); return this.$u.api.businessUnit.list({}) .then((res) => { - this.unitOptions = mapToSelectOptions(res); - return this.unitOptions; + this.deliveryUnitOptions = mapToSelectOptions(res); + return this.deliveryUnitOptions; }) .catch(() => { - this.unitOptions = []; - return this.unitOptions; + this.deliveryUnitOptions = []; + return this.deliveryUnitOptions; + }); + }, + loadBusinessUnitOptions() { + if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions); + return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_KNITTING_FACTORY }) + .then((res) => { + this.businessUnitOptions = mapToSelectOptions(res); + return this.businessUnitOptions; + }) + .catch(() => { + this.businessUnitOptions = []; + return this.businessUnitOptions; + }); + }, + openUnitSelect(type) { + if (this.unitOptionsLoading) return; + this.unitOptionsLoading = true; + const loadFn = type === 'delivery' ? this.loadDeliveryUnitOptions : this.loadBusinessUnitOptions; + loadFn.call(this) + .then((list) => { + if (!list.length) { + uni.showToast({ title: '暂无可选单位', icon: 'none' }); + return; + } + this.unitSelectType = type; + this.unitSelectShow = true; }) .finally(() => { this.unitOptionsLoading = false; }); }, - openUnitSelect(type) { - this.loadUnitOptions().then((list) => { - if (!list.length) { - uni.showToast({ title: '暂无可选单位', icon: 'none' }); - return; - } - this.unitSelectType = type; - this.unitSelectShow = true; - }); - }, openDeliveryUnitSelect() { this.openUnitSelect('delivery'); }, diff --git a/src/pages/storefabric/storeFabricBusinessOutMixin.js b/src/pages/storefabric/storeFabricBusinessOutMixin.js index 780f30b..5a0ade6 100644 --- a/src/pages/storefabric/storeFabricBusinessOutMixin.js +++ b/src/pages/storefabric/storeFabricBusinessOutMixin.js @@ -13,6 +13,7 @@ import scanMixin from '@/common/scanMixin.js'; import { AUDIT_STATUS_MAP, BILL_TYPES, + BUSINESS_UNIT_TYPE_KNITTING_FACTORY, normalizeOrder, mapToSelectOptions, getFineCodeScanCode, @@ -135,7 +136,7 @@ export default { }, ensureBusinessUnitOptions() { if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions); - return this.$u.api.businessUnit.list({}) + return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_KNITTING_FACTORY }) .then((res) => { this.businessUnitOptions = mapToSelectOptions(res); return this.businessUnitOptions;