Compare commits
3 Commits
c94a009caf
...
ab9d199fe3
| Author | SHA1 | Date | |
|---|---|---|---|
| ab9d199fe3 | |||
| 863f0fe850 | |||
| ce5f5a956f |
@ -9,13 +9,7 @@ const install = (Vue, vm) => {
|
||||
console.log('install u',config)
|
||||
|
||||
// 接口前缀统一走 hcscm(apiurl 已在 config.js 配置为 hcscm 服务)
|
||||
// 部分基础资料(往来单位、营销体系)仍在 hcscm_weave
|
||||
const getApiUrl = () => String(vm.$store.state.apiurl || '');
|
||||
const getWeaveApiUrl = () => {
|
||||
const url = getApiUrl();
|
||||
if (url.indexOf('hcscm_weave') !== -1) return url;
|
||||
return url.replace('/hcscm/', '/hcscm_weave/');
|
||||
};
|
||||
|
||||
const GFM_OTHER_DELIVERY_PREFIX = '/grey_fabric_manage/gfmOtherDeliveryOrder/';
|
||||
const gfmOtherDeliveryUrl = (name) => getApiUrl() + GFM_OTHER_DELIVERY_PREFIX + name;
|
||||
@ -32,6 +26,9 @@ const install = (Vue, vm) => {
|
||||
const FPM_PROCESS_OUT_PREFIX = '/product/fpmProcessOutOrder/';
|
||||
const fpmProcessOutUrl = (name) => getApiUrl() + FPM_PROCESS_OUT_PREFIX + name;
|
||||
|
||||
const FPM_PRC_IN_PREFIX = '/product/fpmPrcInOrder/';
|
||||
const fpmPrcInUrl = (name) => getApiUrl() + FPM_PRC_IN_PREFIX + name;
|
||||
|
||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||
vm.$u.api = {
|
||||
|
||||
@ -100,6 +97,18 @@ const install = (Vue, vm) => {
|
||||
getOutTypeEnum: (params = {}) => vm.$u.get(getApiUrl() + '/product/enum/getProcessOutTypeTypeEnum', params),
|
||||
},
|
||||
|
||||
// 成品采购进仓单
|
||||
fpmPrcInOrder: {
|
||||
list: (params = {}) => vm.$u.get(fpmPrcInUrl('getFpmPrcInOrderList'), params),
|
||||
detail: (params = {}) => vm.$u.get(fpmPrcInUrl('getFpmPrcInOrder'), params),
|
||||
add: (params = {}) => vm.$u.postJson(fpmPrcInUrl('addFpmPrcInOrder'), params),
|
||||
scanUpdate: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrder'), params),
|
||||
statusPass: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusPass'), params),
|
||||
statusWait: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusWait'), params),
|
||||
statusReject: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusReject'), params),
|
||||
statusCancel: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusCancel'), params),
|
||||
},
|
||||
|
||||
// 物理仓库下拉
|
||||
physicalWarehouse: {
|
||||
getDropdownList: (params = {}) => vm.$u.get('/warehouse/physicalWarehouse/getPhysicalWarehouseDropdownList', params),
|
||||
@ -110,9 +119,9 @@ const install = (Vue, vm) => {
|
||||
getByQrCode: (params = {}) => vm.$u.get('/warehouse/warehouseBin/getWarehouseBin', params),
|
||||
},
|
||||
|
||||
// 营销体系下拉(基础资料在 hcscm_weave)
|
||||
// 营销体系下拉
|
||||
saleSystem: {
|
||||
getDropdownList: (params = {}) => vm.$u.get(getWeaveApiUrl() + '/saleSystem/getSaleSystemDropdownList', params),
|
||||
getDropdownList: (params = {}) => vm.$u.get(getApiUrl() + '/saleSystem/getSaleSystemDropdownList', params),
|
||||
},
|
||||
|
||||
// 往来单位列表
|
||||
|
||||
@ -31,6 +31,25 @@ export const ARRANGE_TYPE = {
|
||||
/** 入仓类型:加工进仓单 */
|
||||
export const IN_ORDER_TYPE_PROCESS = 5;
|
||||
|
||||
/** 入仓类型:返修进仓 */
|
||||
export const IN_ORDER_TYPE_REPAIR = 6;
|
||||
|
||||
export const IN_ORDER_TYPE_MAP = {
|
||||
[IN_ORDER_TYPE_PROCESS]: '加工进仓单',
|
||||
[IN_ORDER_TYPE_REPAIR]: '返修进仓',
|
||||
};
|
||||
|
||||
export const IN_ORDER_TYPE_OPTIONS = [
|
||||
{ value: IN_ORDER_TYPE_PROCESS, label: IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PROCESS] },
|
||||
{ value: IN_ORDER_TYPE_REPAIR, label: IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_REPAIR] },
|
||||
];
|
||||
|
||||
/** 默认纸筒重量(公斤,表单展示值) */
|
||||
export const DEFAULT_PAPER_TUBE_WEIGHT = 1.5;
|
||||
|
||||
/** 默认包装重量(公斤,表单展示值) */
|
||||
export const DEFAULT_PACKAGE_WEIGHT = 0.3;
|
||||
|
||||
/** 往来单位类型:加工单位 */
|
||||
export const BUSINESS_UNIT_TYPE_PROCESS = 12;
|
||||
|
||||
@ -75,6 +94,11 @@ export function formatWeightKg(value) {
|
||||
return Number(n.toFixed(2));
|
||||
}
|
||||
|
||||
/** 公斤展示值转后端存储(×10000) */
|
||||
export function toWeightStorage(value) {
|
||||
return Math.round(Number(value || 0) * 10000);
|
||||
}
|
||||
|
||||
export function normalizeOrder(order) {
|
||||
if (!order) return null;
|
||||
return {
|
||||
@ -89,7 +113,11 @@ export function normalizeOrder(order) {
|
||||
sale_system_id: order.sale_system_id || '',
|
||||
sale_system_name: order.sale_system_name || '',
|
||||
in_order_type: order.in_order_type || IN_ORDER_TYPE_PROCESS,
|
||||
in_order_type_name: order.in_order_type_name || '加工进仓单',
|
||||
in_order_type_name: order.in_order_type_name
|
||||
|| IN_ORDER_TYPE_MAP[order.in_order_type]
|
||||
|| IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PROCESS],
|
||||
paper_tube_weight: formatWeightKg(order.paper_tube_weight),
|
||||
package_weight: formatWeightKg(order.package_weight),
|
||||
remark: order.remark || '',
|
||||
warehouse_in_time: (order.warehouse_in_time || '').slice(0, 10),
|
||||
creator_name: order.creator_name || '',
|
||||
@ -109,17 +137,28 @@ export function normalizeFineCode(fc) {
|
||||
const weightRaw = fc.base_unit_weight != null
|
||||
? fc.base_unit_weight
|
||||
: (fc.settle_weight != null ? fc.settle_weight : fc.weight);
|
||||
const qrCode = fc.qr_code || fc.long_code || '';
|
||||
const barCode = fc.bar_code || fc.digital_code || fc.short_code || '';
|
||||
return {
|
||||
id: fc.id,
|
||||
volume_number: fc.volume_number != null && fc.volume_number !== '' ? String(fc.volume_number) : '',
|
||||
roll: formatRoll(fc.roll),
|
||||
weight: formatWeightKg(weightRaw),
|
||||
bar_code: fc.bar_code || '',
|
||||
qr_code: fc.qr_code || '',
|
||||
bar_code: barCode,
|
||||
qr_code: qrCode,
|
||||
digital_code: fc.digital_code || '',
|
||||
long_code: fc.long_code || '',
|
||||
short_code: fc.short_code || '',
|
||||
dye_factory_dyelot_number: fc.dye_factory_dyelot_number || fc.dyelot_number || '',
|
||||
warehouse_bin_name: fc.warehouse_bin_name || '',
|
||||
shelf_no: fc.shelf_no || '',
|
||||
scan_code: fc.qr_code || fc.bar_code || '',
|
||||
scan_code: qrCode || barCode || '',
|
||||
paper_tube_weight: fc.paper_tube_weight != null && fc.paper_tube_weight !== ''
|
||||
? formatWeightKg(fc.paper_tube_weight)
|
||||
: null,
|
||||
package_weight: fc.package_weight != null && fc.package_weight !== ''
|
||||
? formatWeightKg(fc.package_weight)
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
@ -213,6 +252,16 @@ export function getEmptyScanDetail() {
|
||||
};
|
||||
}
|
||||
|
||||
/** 刚扫细码的数量(公斤存储值):优先细码 weight */
|
||||
function pickScannedFineWeight(res) {
|
||||
if (!res) return 0;
|
||||
if (res.weight != null && res.weight !== '') return res.weight;
|
||||
if (res.base_unit_weight != null && res.base_unit_weight !== '') return res.base_unit_weight;
|
||||
if (res.settle_weight != null && res.settle_weight !== '') return res.settle_weight;
|
||||
if (res.actually_weight != null && res.actually_weight !== '') return res.actually_weight;
|
||||
return res.item_weight;
|
||||
}
|
||||
|
||||
/** 从扫码接口返回构建详情区(匹数÷100,数量÷10000) */
|
||||
export function buildScanDetailFromScanResponse(res) {
|
||||
if (!res) return getEmptyScanDetail();
|
||||
@ -225,16 +274,39 @@ export function buildScanDetailFromScanResponse(res) {
|
||||
order_roll: formatRoll(res.order_roll != null ? res.order_roll : res.total_roll),
|
||||
item_roll: formatRoll(res.item_roll != null ? res.item_roll : res.roll),
|
||||
order_weight: formatWeightKg(res.order_weight != null ? res.order_weight : res.total_weight),
|
||||
item_weight: formatWeightKg(res.item_weight != null ? res.item_weight : res.weight),
|
||||
// 本行数量:刚扫这条细码的重量(weight),不是明细行合计
|
||||
item_weight: formatWeightKg(pickScannedFineWeight(res)),
|
||||
};
|
||||
}
|
||||
|
||||
/** 构建扫码请求参数 */
|
||||
export function buildScanUpdateParams({ id, scanCode, arrangeType, warehouseBinId }) {
|
||||
/** 校验纸筒/包装重量(扫码时提交) */
|
||||
export function validateScanWeights(paperTubeWeight, packageWeight) {
|
||||
if (paperTubeWeight === '' || paperTubeWeight == null) {
|
||||
return '请输入纸筒重量';
|
||||
}
|
||||
if (Number.isNaN(Number(paperTubeWeight))) return '纸筒重量格式不正确';
|
||||
if (packageWeight === '' || packageWeight == null) {
|
||||
return '请输入包装重量';
|
||||
}
|
||||
if (Number.isNaN(Number(packageWeight))) return '包装重量格式不正确';
|
||||
return '';
|
||||
}
|
||||
|
||||
/** 构建扫码请求参数(纸筒/包装重量在扫码时提交,公斤值需 ×10000) */
|
||||
export function buildScanUpdateParams({
|
||||
id,
|
||||
scanCode,
|
||||
arrangeType,
|
||||
warehouseBinId,
|
||||
paperTubeWeight,
|
||||
packageWeight,
|
||||
}) {
|
||||
const code = (scanCode || '').trim();
|
||||
const params = {
|
||||
id: Number(id),
|
||||
arrange_type: arrangeType,
|
||||
paper_tube_weight: toWeightStorage(paperTubeWeight),
|
||||
package_weight: toWeightStorage(packageWeight),
|
||||
};
|
||||
if (warehouseBinId) {
|
||||
params.warehouse_bin_id = Number(warehouseBinId);
|
||||
@ -326,6 +398,14 @@ export function orderToFormFields(order) {
|
||||
process_name: order.process_name,
|
||||
warehouse_id: order.warehouse_id,
|
||||
warehouse_name: order.warehouse_name,
|
||||
sale_system_id: order.sale_system_id,
|
||||
sale_system_name: order.sale_system_name,
|
||||
in_order_type: order.in_order_type || IN_ORDER_TYPE_PROCESS,
|
||||
in_order_type_name: order.in_order_type_name
|
||||
|| IN_ORDER_TYPE_MAP[order.in_order_type]
|
||||
|| IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PROCESS],
|
||||
paper_tube_weight: String(DEFAULT_PAPER_TUBE_WEIGHT),
|
||||
package_weight: String(DEFAULT_PACKAGE_WEIGHT),
|
||||
remark: order.remark,
|
||||
item_data: order.item_data,
|
||||
};
|
||||
|
||||
@ -213,6 +213,16 @@ export function getEmptyScanDetail() {
|
||||
};
|
||||
}
|
||||
|
||||
/** 刚扫细码的数量(公斤存储值):优先细码 weight */
|
||||
function pickScannedFineWeight(res) {
|
||||
if (!res) return 0;
|
||||
if (res.weight != null && res.weight !== '') return res.weight;
|
||||
if (res.base_unit_weight != null && res.base_unit_weight !== '') return res.base_unit_weight;
|
||||
if (res.settle_weight != null && res.settle_weight !== '') return res.settle_weight;
|
||||
if (res.actually_weight != null && res.actually_weight !== '') return res.actually_weight;
|
||||
return res.item_weight;
|
||||
}
|
||||
|
||||
/** 从扫码接口返回构建详情区(匹数÷100,数量÷10000) */
|
||||
export function buildScanDetailFromScanResponse(res) {
|
||||
if (!res) return getEmptyScanDetail();
|
||||
@ -225,7 +235,7 @@ export function buildScanDetailFromScanResponse(res) {
|
||||
order_roll: formatRoll(res.order_roll != null ? res.order_roll : res.total_roll),
|
||||
item_roll: formatRoll(res.item_roll != null ? res.item_roll : res.roll),
|
||||
order_weight: formatWeightKg(res.order_weight != null ? res.order_weight : res.total_weight),
|
||||
item_weight: formatWeightKg(res.item_weight != null ? res.item_weight : res.weight),
|
||||
item_weight: formatWeightKg(pickScannedFineWeight(res)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
473
src/common/storeGoodsPurchaseIn.js
Normal file
473
src/common/storeGoodsPurchaseIn.js
Normal file
@ -0,0 +1,473 @@
|
||||
/**
|
||||
* 成品采购进仓单常量与数据工具
|
||||
*
|
||||
* 真实接口请求统一注册在 src/common/http.api.js 的 vm.$u.api.fpmPrcInOrder 下。
|
||||
*/
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export const AUDIT_STATUS = {
|
||||
PENDING: 1,
|
||||
APPROVED: 2,
|
||||
REJECTED: 3,
|
||||
VOIDED: 4,
|
||||
};
|
||||
|
||||
export const DRAFT_AUDIT_STATUS = 0;
|
||||
export const DRAFT_AUDIT_STATUS_NAME = '待保存';
|
||||
|
||||
export const AUDIT_STATUS_MAP = {
|
||||
1: '待审核',
|
||||
2: '已审核',
|
||||
3: '已驳回',
|
||||
4: '已作废',
|
||||
};
|
||||
|
||||
/** 操作类型:1录入 3删除 */
|
||||
export const ARRANGE_TYPE = {
|
||||
IN: 1,
|
||||
DEL: 3,
|
||||
};
|
||||
|
||||
/** 入仓类型:采购进仓单 */
|
||||
export const IN_ORDER_TYPE_PURCHASE = 4;
|
||||
|
||||
export const IN_ORDER_TYPE_MAP = {
|
||||
[IN_ORDER_TYPE_PURCHASE]: '采购进仓单',
|
||||
};
|
||||
|
||||
/** 订单类型:1大货 2剪板 3客订大货 4客订剪板 */
|
||||
export const SALE_MODE = {
|
||||
BULK: 1,
|
||||
SHEAR: 2,
|
||||
CUSTOMER_BULK: 3,
|
||||
CUSTOMER_SHEAR: 4,
|
||||
};
|
||||
|
||||
export const SALE_MODE_MAP = {
|
||||
[SALE_MODE.BULK]: '大货',
|
||||
[SALE_MODE.SHEAR]: '剪板',
|
||||
[SALE_MODE.CUSTOMER_BULK]: '客订大货',
|
||||
[SALE_MODE.CUSTOMER_SHEAR]: '客订剪板',
|
||||
};
|
||||
|
||||
export const SALE_MODE_OPTIONS = [
|
||||
{ value: SALE_MODE.BULK, label: SALE_MODE_MAP[SALE_MODE.BULK] },
|
||||
{ value: SALE_MODE.SHEAR, label: SALE_MODE_MAP[SALE_MODE.SHEAR] },
|
||||
{ value: SALE_MODE.CUSTOMER_BULK, label: SALE_MODE_MAP[SALE_MODE.CUSTOMER_BULK] },
|
||||
{ value: SALE_MODE.CUSTOMER_SHEAR, label: SALE_MODE_MAP[SALE_MODE.CUSTOMER_SHEAR] },
|
||||
];
|
||||
|
||||
/** 往来单位类型:成品供应商 */
|
||||
export const BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER = 15;
|
||||
|
||||
/** 成品物理仓类型 */
|
||||
export const WAREHOUSE_TYPE_FINISHED = 103;
|
||||
|
||||
/** 默认仓库名称 */
|
||||
export const DEFAULT_WAREHOUSE_NAME = '成品仓';
|
||||
|
||||
/** 默认纸筒重量(公斤,表单展示值) */
|
||||
export const DEFAULT_PAPER_TUBE_WEIGHT = 1.5;
|
||||
|
||||
/** 默认包装重量(公斤,表单展示值) */
|
||||
export const DEFAULT_PACKAGE_WEIGHT = 0.3;
|
||||
|
||||
export const LIST_PAGE_SIZE = 100;
|
||||
|
||||
export const STATUS_ACTION_CONFIG = {
|
||||
approve: { status: AUDIT_STATUS.APPROVED, msg: '确认审核该单据?', apiKey: 'statusPass' },
|
||||
void: { status: AUDIT_STATUS.VOIDED, msg: '确认作废该单据?', apiKey: 'statusCancel' },
|
||||
unapprove: { status: AUDIT_STATUS.PENDING, msg: '确认消审该单据?', apiKey: 'statusWait' },
|
||||
};
|
||||
|
||||
export function getStatusOptions() {
|
||||
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
||||
value,
|
||||
label: AUDIT_STATUS_MAP[value],
|
||||
}));
|
||||
}
|
||||
|
||||
export function mapToSelectOptions(data) {
|
||||
const list = Array.isArray(data) ? data : (data && (data.list || data.items || data.records)) || [];
|
||||
return list.map((item) => ({
|
||||
value: item.id,
|
||||
label: item.name || item.label || item.code || String(item.id),
|
||||
}));
|
||||
}
|
||||
|
||||
/** 匹数:后端 ×100 存储 */
|
||||
export function formatRoll(value) {
|
||||
const n = Number(value || 0) / 100;
|
||||
return Number.isInteger(n) ? n : Number(n.toFixed(2));
|
||||
}
|
||||
|
||||
/** 数量(公斤):后端 ×10000 存储 */
|
||||
export function formatWeightKg(value) {
|
||||
const n = Number(value || 0) / 10000;
|
||||
return Number(n.toFixed(2));
|
||||
}
|
||||
|
||||
/** 公斤展示值转后端存储(×10000) */
|
||||
export function toWeightStorage(value) {
|
||||
return Math.round(Number(value || 0) * 10000);
|
||||
}
|
||||
|
||||
export function normalizeOrder(order) {
|
||||
if (!order) return null;
|
||||
return {
|
||||
id: order.id,
|
||||
order_no: order.order_no || '',
|
||||
audit_status: order.audit_status,
|
||||
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[order.audit_status] || '',
|
||||
biz_unit_id: order.biz_unit_id || '',
|
||||
biz_unit_name: order.biz_unit_name || '',
|
||||
warehouse_id: order.warehouse_id || '',
|
||||
warehouse_name: order.warehouse_name || '',
|
||||
sale_system_id: order.sale_system_id || '',
|
||||
sale_system_name: order.sale_system_name || '',
|
||||
sale_mode: order.sale_mode || '',
|
||||
sale_mode_name: order.sale_mode_name || SALE_MODE_MAP[order.sale_mode] || '',
|
||||
in_order_type: order.in_order_type || IN_ORDER_TYPE_PURCHASE,
|
||||
in_order_type_name: order.in_order_type_name
|
||||
|| IN_ORDER_TYPE_MAP[order.in_order_type]
|
||||
|| IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PURCHASE],
|
||||
paper_tube_weight: formatWeightKg(order.paper_tube_weight),
|
||||
package_weight: formatWeightKg(order.package_weight),
|
||||
remark: order.remark || '',
|
||||
warehouse_in_time: (order.warehouse_in_time || '').slice(0, 10),
|
||||
creator_name: order.creator_name || '',
|
||||
create_time: order.create_time || '',
|
||||
auditor_name: order.auditor_name || '',
|
||||
audit_time: order.audit_time || '',
|
||||
total_roll: formatRoll(order.total_roll),
|
||||
total_weight: formatWeightKg(order.total_weight),
|
||||
total_length: formatRoll(order.total_length),
|
||||
item_data: (order.item_data || []).map(normalizeItem),
|
||||
_raw: order,
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeFineCode(fc) {
|
||||
if (!fc) return null;
|
||||
const weightRaw = fc.base_unit_weight != null
|
||||
? fc.base_unit_weight
|
||||
: (fc.settle_weight != null ? fc.settle_weight : fc.weight);
|
||||
const qrCode = fc.qr_code || fc.long_code || '';
|
||||
const barCode = fc.bar_code || fc.digital_code || fc.short_code || '';
|
||||
return {
|
||||
id: fc.id,
|
||||
volume_number: fc.volume_number != null && fc.volume_number !== '' ? String(fc.volume_number) : '',
|
||||
roll: formatRoll(fc.roll),
|
||||
weight: formatWeightKg(weightRaw),
|
||||
bar_code: barCode,
|
||||
qr_code: qrCode,
|
||||
digital_code: fc.digital_code || '',
|
||||
long_code: fc.long_code || '',
|
||||
short_code: fc.short_code || '',
|
||||
dye_factory_dyelot_number: fc.dye_factory_dyelot_number || fc.dyelot_number || '',
|
||||
warehouse_bin_name: fc.warehouse_bin_name || '',
|
||||
shelf_no: fc.shelf_no || '',
|
||||
scan_code: qrCode || barCode || '',
|
||||
paper_tube_weight: fc.paper_tube_weight != null && fc.paper_tube_weight !== ''
|
||||
? formatWeightKg(fc.paper_tube_weight)
|
||||
: null,
|
||||
package_weight: fc.package_weight != null && fc.package_weight !== ''
|
||||
? formatWeightKg(fc.package_weight)
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeItem(item) {
|
||||
const weightRaw = item.in_weight != null ? item.in_weight : item.total_weight;
|
||||
return {
|
||||
id: item.id,
|
||||
quote_order_no: item.quote_order_no || '',
|
||||
product_code: item.product_code || '',
|
||||
product_name: item.product_name || '',
|
||||
product_color_code: item.product_color_code || '',
|
||||
product_color_name: item.product_color_name || '',
|
||||
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||
dye_factory_color_code: item.dye_factory_color_code || '',
|
||||
in_roll: formatRoll(item.in_roll),
|
||||
in_weight: formatWeightKg(weightRaw),
|
||||
item_fc_data: (item.item_fc_data || []).map(normalizeFineCode).filter(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细分组:成品编号 → 成品色号 → 细码
|
||||
*/
|
||||
export function buildItemGroups(items) {
|
||||
const productMap = new Map();
|
||||
(items || []).forEach((item) => {
|
||||
const productKey = item.product_code || '-';
|
||||
if (!productMap.has(productKey)) {
|
||||
productMap.set(productKey, {
|
||||
group_key: `p:${productKey}`,
|
||||
product_code: item.product_code || '',
|
||||
product_name: item.product_name || '',
|
||||
in_roll: 0,
|
||||
in_weight: 0,
|
||||
colors: new Map(),
|
||||
});
|
||||
}
|
||||
const productGroup = productMap.get(productKey);
|
||||
if (!productGroup.product_name && item.product_name) {
|
||||
productGroup.product_name = item.product_name;
|
||||
}
|
||||
|
||||
const colorKey = item.product_color_code || item.product_color_name || '-';
|
||||
if (!productGroup.colors.has(colorKey)) {
|
||||
productGroup.colors.set(colorKey, {
|
||||
group_key: `p:${productKey}|c:${colorKey}`,
|
||||
product_color_code: item.product_color_code || '',
|
||||
product_color_name: item.product_color_name || '',
|
||||
quote_order_no: item.quote_order_no || '',
|
||||
dye_factory_dyelot_number: item.dye_factory_dyelot_number || '',
|
||||
in_roll: 0,
|
||||
in_weight: 0,
|
||||
fine_codes: [],
|
||||
});
|
||||
}
|
||||
const colorGroup = productGroup.colors.get(colorKey);
|
||||
productGroup.in_roll = Number((productGroup.in_roll + Number(item.in_roll || 0)).toFixed(2));
|
||||
productGroup.in_weight = Number((productGroup.in_weight + Number(item.in_weight || 0)).toFixed(2));
|
||||
colorGroup.in_roll = Number((colorGroup.in_roll + Number(item.in_roll || 0)).toFixed(2));
|
||||
colorGroup.in_weight = Number((colorGroup.in_weight + Number(item.in_weight || 0)).toFixed(2));
|
||||
if (item.quote_order_no) colorGroup.quote_order_no = item.quote_order_no;
|
||||
if (item.dye_factory_dyelot_number) {
|
||||
colorGroup.dye_factory_dyelot_number = item.dye_factory_dyelot_number;
|
||||
}
|
||||
if (!colorGroup.product_color_name && item.product_color_name) {
|
||||
colorGroup.product_color_name = item.product_color_name;
|
||||
}
|
||||
colorGroup.fine_codes.push(...(item.item_fc_data || []));
|
||||
});
|
||||
|
||||
return Array.from(productMap.values()).map((product) => ({
|
||||
group_key: product.group_key,
|
||||
product_code: product.product_code,
|
||||
product_name: product.product_name,
|
||||
in_roll: product.in_roll,
|
||||
in_weight: product.in_weight,
|
||||
colors: Array.from(product.colors.values()),
|
||||
}));
|
||||
}
|
||||
|
||||
export function getEmptyScanDetail() {
|
||||
return {
|
||||
quote_order_no: '',
|
||||
dyelot_number: '',
|
||||
volume_number: '',
|
||||
product_code: '',
|
||||
product_color_code: '',
|
||||
order_roll: 0,
|
||||
item_roll: 0,
|
||||
order_weight: 0,
|
||||
item_weight: 0,
|
||||
};
|
||||
}
|
||||
|
||||
/** 刚扫细码的数量(公斤存储值):优先细码 weight */
|
||||
function pickScannedFineWeight(res) {
|
||||
if (!res) return 0;
|
||||
if (res.weight != null && res.weight !== '') return res.weight;
|
||||
if (res.base_unit_weight != null && res.base_unit_weight !== '') return res.base_unit_weight;
|
||||
if (res.settle_weight != null && res.settle_weight !== '') return res.settle_weight;
|
||||
if (res.actually_weight != null && res.actually_weight !== '') return res.actually_weight;
|
||||
return res.item_weight;
|
||||
}
|
||||
|
||||
/** 从扫码接口返回构建详情区(匹数÷100,数量÷10000) */
|
||||
export function buildScanDetailFromScanResponse(res) {
|
||||
if (!res) return getEmptyScanDetail();
|
||||
return {
|
||||
quote_order_no: res.quote_order_no || '',
|
||||
dyelot_number: res.dyelot_number || '',
|
||||
volume_number: res.volume_number != null && res.volume_number !== '' ? String(res.volume_number) : '',
|
||||
product_code: res.product_code || '',
|
||||
product_color_code: res.product_color_code || '',
|
||||
order_roll: formatRoll(res.order_roll != null ? res.order_roll : res.total_roll),
|
||||
item_roll: formatRoll(res.item_roll != null ? res.item_roll : res.roll),
|
||||
order_weight: formatWeightKg(res.order_weight != null ? res.order_weight : res.total_weight),
|
||||
// 本行数量:刚扫这条细码的重量(weight),不是明细行合计
|
||||
item_weight: formatWeightKg(pickScannedFineWeight(res)),
|
||||
};
|
||||
}
|
||||
|
||||
/** 校验纸筒/包装重量(扫码时提交) */
|
||||
export function validateScanWeights(paperTubeWeight, packageWeight) {
|
||||
if (paperTubeWeight === '' || paperTubeWeight == null) {
|
||||
return '请输入纸筒重量';
|
||||
}
|
||||
if (Number.isNaN(Number(paperTubeWeight))) return '纸筒重量格式不正确';
|
||||
if (packageWeight === '' || packageWeight == null) {
|
||||
return '请输入包装重量';
|
||||
}
|
||||
if (Number.isNaN(Number(packageWeight))) return '包装重量格式不正确';
|
||||
return '';
|
||||
}
|
||||
|
||||
/** 构建扫码请求参数(纸筒/包装重量在扫码时提交,公斤值需 ×10000) */
|
||||
export function buildScanUpdateParams({
|
||||
id,
|
||||
scanCode,
|
||||
arrangeType,
|
||||
warehouseBinId,
|
||||
paperTubeWeight,
|
||||
packageWeight,
|
||||
}) {
|
||||
const code = (scanCode || '').trim();
|
||||
const params = {
|
||||
id: Number(id),
|
||||
arrange_type: arrangeType,
|
||||
paper_tube_weight: toWeightStorage(paperTubeWeight),
|
||||
package_weight: toWeightStorage(packageWeight),
|
||||
};
|
||||
if (warehouseBinId) {
|
||||
params.warehouse_bin_id = Number(warehouseBinId);
|
||||
}
|
||||
// 长度大于25走二维码,否则走条码
|
||||
if (code.length > 25) {
|
||||
params.qr_code = code;
|
||||
} else {
|
||||
params.bar_code = code;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
export function buildStatusParam(id) {
|
||||
return { id: String(id) };
|
||||
}
|
||||
|
||||
export function formatDisplayTime(value, format = 'YYYY-MM-DD') {
|
||||
if (!value) return '';
|
||||
const parsed = dayjs(value);
|
||||
return parsed.isValid() ? parsed.format(format) : String(value).slice(0, 10);
|
||||
}
|
||||
|
||||
export function canScanAtStatus(status) {
|
||||
return [AUDIT_STATUS.PENDING, AUDIT_STATUS.REJECTED].includes(status);
|
||||
}
|
||||
|
||||
export function isLockedOrderStatus(status) {
|
||||
return [AUDIT_STATUS.APPROVED, AUDIT_STATUS.VOIDED].includes(status);
|
||||
}
|
||||
|
||||
export function fetchAllOrderList(listFn, params = {}, pageSize = LIST_PAGE_SIZE) {
|
||||
const pickBatch = (res) => {
|
||||
if (Array.isArray(res)) return res;
|
||||
if (!res || typeof res !== 'object') return [];
|
||||
return res.list || res.records || res.items || [];
|
||||
};
|
||||
const loadPage = (page, acc) => listFn({ ...params, page, size: pageSize })
|
||||
.then((res) => {
|
||||
const batch = pickBatch(res);
|
||||
if (!batch.length) return acc;
|
||||
// 一次返回超过 pageSize:后端忽略分页,视为全量,避免死循环翻页
|
||||
if (batch.length > pageSize) return acc.concat(batch);
|
||||
// 翻页后与首页首条相同:后端忽略 page,避免死循环
|
||||
if (
|
||||
page > 1
|
||||
&& acc.length
|
||||
&& batch[0]
|
||||
&& acc[0]
|
||||
&& String(batch[0].id) === String(acc[0].id)
|
||||
) {
|
||||
return acc;
|
||||
}
|
||||
const merged = acc.concat(batch);
|
||||
const total = !Array.isArray(res) && res != null ? Number(res.total) : NaN;
|
||||
if (!Number.isNaN(total) && merged.length >= total) return merged;
|
||||
if (batch.length < pageSize) return merged;
|
||||
return loadPage(page + 1, merged);
|
||||
});
|
||||
return loadPage(1, []);
|
||||
}
|
||||
|
||||
export function getFormStatusActionButtons(headerSaved, orderId, status) {
|
||||
if (!headerSaved || !orderId || !canScanAtStatus(status)) return [];
|
||||
return [
|
||||
{ label: '审核', action: 'approve' },
|
||||
{ label: '作废', action: 'void' },
|
||||
];
|
||||
}
|
||||
|
||||
export function getViewStatusActionButtons(status) {
|
||||
if (status === AUDIT_STATUS.PENDING || status === AUDIT_STATUS.REJECTED) {
|
||||
return [
|
||||
{ label: '编辑', action: 'edit' },
|
||||
{ label: '审核', action: 'approve' },
|
||||
{ label: '作废', action: 'void' },
|
||||
];
|
||||
}
|
||||
if (status === AUDIT_STATUS.APPROVED) {
|
||||
return [{ label: '消审', action: 'unapprove' }];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function orderToFormFields(order) {
|
||||
return {
|
||||
order_no: order.order_no,
|
||||
biz_unit_id: order.biz_unit_id,
|
||||
biz_unit_name: order.biz_unit_name,
|
||||
warehouse_id: order.warehouse_id,
|
||||
warehouse_name: order.warehouse_name,
|
||||
sale_system_id: order.sale_system_id,
|
||||
sale_system_name: order.sale_system_name,
|
||||
sale_mode: order.sale_mode || '',
|
||||
sale_mode_name: order.sale_mode_name || SALE_MODE_MAP[order.sale_mode] || '',
|
||||
in_order_type: order.in_order_type || IN_ORDER_TYPE_PURCHASE,
|
||||
in_order_type_name: order.in_order_type_name
|
||||
|| IN_ORDER_TYPE_MAP[order.in_order_type]
|
||||
|| IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PURCHASE],
|
||||
paper_tube_weight: String(DEFAULT_PAPER_TUBE_WEIGHT),
|
||||
package_weight: String(DEFAULT_PACKAGE_WEIGHT),
|
||||
remark: order.remark,
|
||||
item_data: order.item_data,
|
||||
};
|
||||
}
|
||||
|
||||
/** 从仓库下拉中选出默认成品仓 */
|
||||
export function pickDefaultWarehouse(options, loginWarehouseId, loginWarehouseName) {
|
||||
const list = options || [];
|
||||
const byName = list.find((item) => item.label === DEFAULT_WAREHOUSE_NAME);
|
||||
if (byName) return byName;
|
||||
if (loginWarehouseId) {
|
||||
const byId = list.find((item) => String(item.value) === String(loginWarehouseId));
|
||||
if (byId) return byId;
|
||||
if (loginWarehouseName) {
|
||||
return { value: loginWarehouseId, label: loginWarehouseName };
|
||||
}
|
||||
}
|
||||
return list[0] || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认并执行审核状态变更
|
||||
*/
|
||||
export function confirmOrderStatusAction(vm, { orderId, action, onSuccess }) {
|
||||
const cfg = STATUS_ACTION_CONFIG[action];
|
||||
if (!cfg || !orderId) return;
|
||||
const api = vm.$u.api.fpmPrcInOrder;
|
||||
const requestFn = api[cfg.apiKey];
|
||||
if (typeof requestFn !== 'function') return;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: cfg.msg,
|
||||
success: (res) => {
|
||||
if (!res.confirm) return;
|
||||
uni.showLoading({ title: '处理中...' });
|
||||
requestFn(buildStatusParam(orderId))
|
||||
.then(() => {
|
||||
if (typeof onSuccess === 'function') return onSuccess();
|
||||
uni.hideLoading();
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading();
|
||||
if (vm.showError) vm.showError(e.message || '操作失败');
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
67
src/components/card/storeGoodsPurchaseInItem.vue
Normal file
67
src/components/card/storeGoodsPurchaseInItem.vue
Normal file
@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<view class="myCard">
|
||||
<view class="cardTopName">
|
||||
<text>{{ item.order_no }}</text>
|
||||
<text class="statusTag" :class="'status-' + item.audit_status">{{ item.audit_status_name }}</text>
|
||||
</view>
|
||||
<view class="cardRow">
|
||||
<view>供 应 商:</view>
|
||||
<view>{{ item.biz_unit_name || '-' }}</view>
|
||||
</view>
|
||||
<view class="cardRow">
|
||||
<view>仓库名称:</view>
|
||||
<view>{{ item.warehouse_name || '-' }}</view>
|
||||
</view>
|
||||
<view class="cardRow">
|
||||
<view>匹数总计:</view>
|
||||
<view>{{ item.total_roll != null ? item.total_roll : '-' }}</view>
|
||||
</view>
|
||||
<view class="cardRow">
|
||||
<view>创 建 人:</view>
|
||||
<view>{{ item.create_user_name }} {{ formatTime(item.create_time, 'YYYY-MM-DD') }}</view>
|
||||
</view>
|
||||
<view v-if="item.auditor_name" class="cardRow">
|
||||
<view>审 核 人:</view>
|
||||
<view>{{ item.auditor_name }} {{ formatTime(item.audit_date, 'YYYY-MM-DD') }}</view>
|
||||
</view>
|
||||
<view v-if="!isDetail && !isSelect" class="lookDetail">
|
||||
<text>查看详情</text>
|
||||
<u-icon name="arrow-right" size="36" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatDisplayTime } from '@/common/storeGoodsPurchaseIn';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
item: { type: Object, default: () => ({}) },
|
||||
index: { type: Number, default: 0 },
|
||||
isSelect: { type: Boolean, default: false },
|
||||
isDetail: { type: Boolean, default: false },
|
||||
},
|
||||
methods: {
|
||||
formatTime: formatDisplayTime,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cardTopName {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.statusTag {
|
||||
font-size: 24rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 6rpx;
|
||||
font-weight: normal;
|
||||
}
|
||||
.status-0 { background: #f0f0f0; color: #666; }
|
||||
.status-1 { background: #fff7e6; color: #fa8c16; }
|
||||
.status-2 { background: #f6ffed; color: #52c41a; }
|
||||
.status-3 { background: #fff1f0; color: #f5222d; }
|
||||
.status-4 { background: #f5f5f5; color: #999; }
|
||||
</style>
|
||||
@ -89,19 +89,33 @@ const FINE_COLUMNS = [
|
||||
{ label: '缸号', key: 'dye_factory_dyelot_number', width: 140 },
|
||||
];
|
||||
|
||||
const TARE_COLUMNS = [
|
||||
{ label: '纸筒重量', key: 'paper_tube_weight', width: 120 },
|
||||
{ label: '包装重量', key: 'package_weight', width: 120 },
|
||||
];
|
||||
|
||||
export default {
|
||||
props: {
|
||||
list: { type: Array, default: () => [] },
|
||||
title: { type: String, default: '进仓明细' },
|
||||
deletable: { type: Boolean, default: false },
|
||||
/** 加工/采购进仓:细码行展示扫码时提交的纸筒、包装重量 */
|
||||
showTareColumns: { type: Boolean, default: false },
|
||||
},
|
||||
computed: {
|
||||
groups() {
|
||||
return buildItemGroups(this.list);
|
||||
},
|
||||
fineColumns() {
|
||||
if (!this.deletable) return FINE_COLUMNS;
|
||||
return [...FINE_COLUMNS, { label: '操作', key: 'action', width: 90 }];
|
||||
const cols = [...FINE_COLUMNS];
|
||||
if (this.showTareColumns) {
|
||||
const idx = cols.findIndex((col) => col.key === 'weight');
|
||||
cols.splice(idx + 1, 0, ...TARE_COLUMNS);
|
||||
}
|
||||
if (this.deletable) {
|
||||
cols.push({ label: '操作', key: 'action', width: 90 });
|
||||
}
|
||||
return cols;
|
||||
},
|
||||
fineTableWidth() {
|
||||
const total = this.fineColumns.reduce((sum, col) => sum + (col.width || 100), 0);
|
||||
|
||||
@ -10,15 +10,11 @@
|
||||
</view>
|
||||
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||
<text class="fabric-out-scanDetailCell">成品色号:{{ detail.product_color_code || '-' }}</text>
|
||||
<text class="fabric-out-scanDetailCell">本行匹数:{{ detail.item_roll != null ? detail.item_roll : '-' }}</text>
|
||||
<text class="fabric-out-scanDetailCell">本行数量:{{ detail.item_weight != null ? detail.item_weight : '-' }}</text>
|
||||
</view>
|
||||
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||
<text class="fabric-out-scanDetailCell">本行数量:{{ detail.item_weight != null ? detail.item_weight : '-' }}</text>
|
||||
<text class="fabric-out-scanDetailCell">本单匹数:{{ detail.order_roll != null ? detail.order_roll : '-' }}</text>
|
||||
</view>
|
||||
<view class="fabric-out-scanDetailRow">
|
||||
<text class="fabric-out-scanDetailLabel">本单数量:</text>
|
||||
<text class="fabric-out-scanDetailValue">{{ detail.order_weight != null ? detail.order_weight : '-' }}</text>
|
||||
<text class="fabric-out-scanDetailCell">本单数量:{{ detail.order_weight != null ? detail.order_weight : '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -449,6 +449,34 @@
|
||||
"navigationBarTitleText": "查看加工进仓单",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsPurchaseInList",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "成品采购进仓",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsPurchaseInAdd",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "新增采购进仓单",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsPurchaseInEdit",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "编辑采购进仓单",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsPurchaseInView",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "采购进仓单详情",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsProcessReturnInList",
|
||||
"style" :
|
||||
|
||||
@ -6,9 +6,12 @@
|
||||
<text class="mr26">进仓单号</text>
|
||||
<u-input disabled placeholder="保存后自动生成" v-model="form.order_no" />
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">进仓类型</text>
|
||||
<view>加工进仓单</view>
|
||||
<view @click="pickerSelectFun('进仓类型')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">进仓类型<text class="redXingh">*</text></text>
|
||||
<view :class="form.in_order_type_name ? '' : 'cBlack'">
|
||||
{{ form.in_order_type_name || '请选择' }}
|
||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="pickerSelectFun('加工单位')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">加工单位<text class="redXingh">*</text></text>
|
||||
@ -24,6 +27,37 @@
|
||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5 process-in-weight-row">
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">纸筒重量</text>
|
||||
<u-input
|
||||
v-model="form.paper_tube_weight"
|
||||
type="digit"
|
||||
:disabled="!canEditWeights"
|
||||
placeholder="1.5"
|
||||
:custom-style="weightInputStyle"
|
||||
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||
/>
|
||||
</view>
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">包装重量</text>
|
||||
<u-input
|
||||
v-model="form.package_weight"
|
||||
type="digit"
|
||||
:disabled="!canEditWeights"
|
||||
placeholder="0.3"
|
||||
:custom-style="weightInputStyle"
|
||||
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="pickerSelectFun('营销体系')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">营销体系<text class="redXingh">*</text></text>
|
||||
<view :class="form.sale_system_name ? '' : 'cBlack'">
|
||||
{{ form.sale_system_name || '请选择' }}
|
||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-white-plr26-column ptb20 mt32">
|
||||
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
||||
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||
@ -57,6 +91,7 @@
|
||||
<ProcessInDetailList
|
||||
:list="form.item_data"
|
||||
:deletable="canScan"
|
||||
show-tare-columns
|
||||
@delete="onDeleteFineCode"
|
||||
/>
|
||||
|
||||
@ -95,6 +130,13 @@ export default {
|
||||
ProcessInBinBar,
|
||||
},
|
||||
mixins: [formMixin],
|
||||
data() {
|
||||
return {
|
||||
weightInputStyle: {
|
||||
fontSize: '36rpx',
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
uni.setNavigationBarTitle({ title: '新增加工进仓单' });
|
||||
this.pageMode = 'add';
|
||||
@ -109,4 +151,17 @@ page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
.process-in-weight-row {
|
||||
gap: 20rpx;
|
||||
}
|
||||
.process-in-weight-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
|
||||
::v-deep .u-input__input {
|
||||
font-size: 36rpx !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">进仓类型</text>
|
||||
<text>加工进仓单</text>
|
||||
<text>{{ form.in_order_type_name || '加工进仓单' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">加工单位</text>
|
||||
@ -18,6 +18,34 @@
|
||||
<text class="mr26">仓库名称</text>
|
||||
<text>{{ form.warehouse_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5 process-in-weight-row">
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">纸筒重量</text>
|
||||
<u-input
|
||||
v-model="form.paper_tube_weight"
|
||||
type="digit"
|
||||
:disabled="!canEditWeights"
|
||||
placeholder="1.5"
|
||||
:custom-style="weightInputStyle"
|
||||
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||
/>
|
||||
</view>
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">包装重量</text>
|
||||
<u-input
|
||||
v-model="form.package_weight"
|
||||
type="digit"
|
||||
:disabled="!canEditWeights"
|
||||
placeholder="0.3"
|
||||
:custom-style="weightInputStyle"
|
||||
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">营销体系</text>
|
||||
<text>{{ form.sale_system_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">单据备注</text>
|
||||
<text>{{ form.remark || '-' }}</text>
|
||||
@ -51,6 +79,7 @@
|
||||
<ProcessInDetailList
|
||||
:list="form.item_data"
|
||||
:deletable="canScan"
|
||||
show-tare-columns
|
||||
@delete="onDeleteFineCode"
|
||||
/>
|
||||
|
||||
@ -79,6 +108,13 @@ export default {
|
||||
ProcessInBinBar,
|
||||
},
|
||||
mixins: [formMixin],
|
||||
data() {
|
||||
return {
|
||||
weightInputStyle: {
|
||||
fontSize: '36rpx',
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
uni.setNavigationBarTitle({ title: '编辑加工进仓单' });
|
||||
this.pageMode = 'edit';
|
||||
@ -95,4 +131,17 @@ page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
.process-in-weight-row {
|
||||
gap: 20rpx;
|
||||
}
|
||||
.process-in-weight-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
|
||||
::v-deep .u-input__input {
|
||||
font-size: 36rpx !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* 加工进仓单表单 mixin(新增/编辑共用)
|
||||
*
|
||||
* 1. 先填表头(加工单位 / 仓库 / 备注)提交 add,拿到 id 后可扫码
|
||||
* 1. 先填表头(进仓类型 / 加工单位 / 仓库 / 营销体系 / 备注)提交 add,拿到 id 后可扫码
|
||||
* 2. 先扫仓位(getWarehouseBin:传 qr_code + warehouse_id),校验后扫布匹二维码
|
||||
* 3. 扫码走 updateFpmProcessInOrder(arrange_type: 1 录入 / 3 删除,带 warehouse_bin_id)
|
||||
* 3. 扫码走 updateFpmProcessInOrder(arrange_type: 1 录入 / 3 删除,带 warehouse_bin_id、纸筒/包装重量)
|
||||
* 4. 手机扫码成功展示详情后自动再次调起扫码,形成连续扫
|
||||
*/
|
||||
import util from '@/common/util';
|
||||
@ -15,6 +15,10 @@ import {
|
||||
BUSINESS_UNIT_TYPE_PROCESS,
|
||||
WAREHOUSE_TYPE_FINISHED,
|
||||
IN_ORDER_TYPE_PROCESS,
|
||||
IN_ORDER_TYPE_MAP,
|
||||
IN_ORDER_TYPE_OPTIONS,
|
||||
DEFAULT_PAPER_TUBE_WEIGHT,
|
||||
DEFAULT_PACKAGE_WEIGHT,
|
||||
normalizeOrder,
|
||||
mapToSelectOptions,
|
||||
canScanAtStatus,
|
||||
@ -28,6 +32,7 @@ import {
|
||||
buildScanDetailFromScanResponse,
|
||||
buildScanUpdateParams,
|
||||
pickDefaultWarehouse,
|
||||
validateScanWeights,
|
||||
} from '@/common/storeGoodsProcessIn';
|
||||
|
||||
export default {
|
||||
@ -49,6 +54,8 @@ export default {
|
||||
auditStatus: 0,
|
||||
processUnitOptions: [],
|
||||
warehouseOptions: [],
|
||||
saleSystemOptions: [],
|
||||
inOrderTypeOptions: IN_ORDER_TYPE_OPTIONS,
|
||||
dropdownLoading: false,
|
||||
/** 仓位 */
|
||||
warehouseBinId: 0,
|
||||
@ -70,6 +77,10 @@ export default {
|
||||
headerEditable() {
|
||||
return this.pageMode === 'add' && !this.headerSaved;
|
||||
},
|
||||
/** 纸筒/包装重量随扫码提交,保存前后及可扫编辑态均可改 */
|
||||
canEditWeights() {
|
||||
return this.isEditable && (this.headerEditable || this.canScan);
|
||||
},
|
||||
statusActionButtons() {
|
||||
return getFormStatusActionButtons(this.headerSaved, this.orderId, this.auditStatus);
|
||||
},
|
||||
@ -243,6 +254,7 @@ export default {
|
||||
loadBaseDropdowns() {
|
||||
if (this.dropdownLoading) return Promise.resolve();
|
||||
this.dropdownLoading = true;
|
||||
if (this.headerEditable) this.applyDefaultSaleSystem();
|
||||
return Promise.all([
|
||||
this.ensureProcessUnitOptions().catch((e) => {
|
||||
console.error('加载加工单位失败', e);
|
||||
@ -252,6 +264,10 @@ export default {
|
||||
console.error('加载仓库失败', e);
|
||||
return [];
|
||||
}),
|
||||
this.ensureSaleSystemOptions().catch((e) => {
|
||||
console.error('加载营销体系失败', e);
|
||||
return [];
|
||||
}),
|
||||
]).finally(() => {
|
||||
this.dropdownLoading = false;
|
||||
});
|
||||
@ -275,6 +291,15 @@ export default {
|
||||
return this.warehouseOptions;
|
||||
});
|
||||
},
|
||||
ensureSaleSystemOptions() {
|
||||
if (this.saleSystemOptions.length) return Promise.resolve(this.saleSystemOptions);
|
||||
return this.$u.api.saleSystem.getDropdownList()
|
||||
.then((res) => {
|
||||
this.saleSystemOptions = mapToSelectOptions(res);
|
||||
if (this.headerEditable) this.applyDefaultSaleSystem();
|
||||
return this.saleSystemOptions;
|
||||
});
|
||||
},
|
||||
applyDefaultWarehouse() {
|
||||
const app = getApp();
|
||||
const picked = pickDefaultWarehouse(
|
||||
@ -286,13 +311,42 @@ export default {
|
||||
this.form.warehouse_id = picked.value;
|
||||
this.form.warehouse_name = picked.label;
|
||||
},
|
||||
applyDefaultSaleSystem() {
|
||||
if (this.form.sale_system_id) {
|
||||
if (!this.form.sale_system_name && this.saleSystemOptions.length) {
|
||||
const found = this.saleSystemOptions.find(
|
||||
(item) => String(item.value) === String(this.form.sale_system_id),
|
||||
);
|
||||
if (found) this.form.sale_system_name = found.label;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const app = getApp();
|
||||
const gd = app && app.globalData ? app.globalData : {};
|
||||
const id = gd.PlanDepartmentID;
|
||||
if (!id) return;
|
||||
this.form.sale_system_id = id;
|
||||
this.form.sale_system_name = gd.PlanDepartmentName || '';
|
||||
if (!this.form.sale_system_name && this.saleSystemOptions.length) {
|
||||
const found = this.saleSystemOptions.find((item) => String(item.value) === String(id));
|
||||
if (found) this.form.sale_system_name = found.label;
|
||||
}
|
||||
},
|
||||
getEmptyForm() {
|
||||
const app = getApp();
|
||||
const gd = app && app.globalData ? app.globalData : {};
|
||||
return {
|
||||
order_no: '',
|
||||
process_unit_id: '',
|
||||
process_name: '',
|
||||
warehouse_id: '',
|
||||
warehouse_name: '',
|
||||
sale_system_id: gd.PlanDepartmentID || '',
|
||||
sale_system_name: gd.PlanDepartmentName || '',
|
||||
in_order_type: IN_ORDER_TYPE_PROCESS,
|
||||
in_order_type_name: IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PROCESS],
|
||||
paper_tube_weight: String(DEFAULT_PAPER_TUBE_WEIGHT),
|
||||
package_weight: String(DEFAULT_PACKAGE_WEIGHT),
|
||||
remark: '',
|
||||
item_data: [],
|
||||
};
|
||||
@ -336,7 +390,9 @@ export default {
|
||||
this.selectList = list;
|
||||
this.selectShow = true;
|
||||
};
|
||||
if (type === '加工单位') {
|
||||
if (type === '进仓类型') {
|
||||
openPicker(this.inOrderTypeOptions);
|
||||
} else if (type === '加工单位') {
|
||||
this.ensureProcessUnitOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载加工单位失败'));
|
||||
@ -344,33 +400,41 @@ export default {
|
||||
this.ensureWarehouseOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载仓库失败'));
|
||||
} else if (type === '营销体系') {
|
||||
this.ensureSaleSystemOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载营销体系失败'));
|
||||
}
|
||||
},
|
||||
selectConfirmFun(e) {
|
||||
const item = e[0];
|
||||
if (this.selectType === '加工单位') {
|
||||
if (this.selectType === '进仓类型') {
|
||||
this.form.in_order_type = item.value;
|
||||
this.form.in_order_type_name = item.label;
|
||||
} else if (this.selectType === '加工单位') {
|
||||
this.form.process_unit_id = item.value;
|
||||
this.form.process_name = item.label;
|
||||
} else if (this.selectType === '仓库名称') {
|
||||
this.form.warehouse_id = item.value;
|
||||
this.form.warehouse_name = item.label;
|
||||
} else if (this.selectType === '营销体系') {
|
||||
this.form.sale_system_id = item.value;
|
||||
this.form.sale_system_name = item.label;
|
||||
}
|
||||
},
|
||||
validateForm() {
|
||||
if (!this.form.in_order_type) return '请选择进仓类型';
|
||||
if (!this.form.process_unit_id) return '请选择加工单位';
|
||||
if (!this.form.warehouse_id) return '请选择仓库名称';
|
||||
const app = getApp();
|
||||
const saleSystemId = app && app.globalData ? app.globalData.PlanDepartmentID : '';
|
||||
if (!saleSystemId) return '缺少营销体系,请重新登录';
|
||||
if (!this.form.sale_system_id) return '请选择营销体系';
|
||||
return '';
|
||||
},
|
||||
buildAddParam() {
|
||||
const app = getApp();
|
||||
return {
|
||||
inOrderType: IN_ORDER_TYPE_PROCESS,
|
||||
inOrderType: Number(this.form.in_order_type),
|
||||
process_unit_id: Number(this.form.process_unit_id),
|
||||
warehouse_id: Number(this.form.warehouse_id),
|
||||
sale_system_id: Number(app.globalData.PlanDepartmentID),
|
||||
sale_system_id: Number(this.form.sale_system_id),
|
||||
remark: this.form.remark || '',
|
||||
item_data: [],
|
||||
};
|
||||
@ -397,7 +461,7 @@ export default {
|
||||
.then((detail) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(detail);
|
||||
this.applyOrder(order);
|
||||
this.applyOrder(order, { keepWeights: true });
|
||||
this.headerSaved = true;
|
||||
this.clearWarehouseBin();
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
@ -409,10 +473,16 @@ export default {
|
||||
this.showError(e.message || '保存失败');
|
||||
});
|
||||
},
|
||||
applyOrder(order) {
|
||||
applyOrder(order, options = {}) {
|
||||
if (!order) return;
|
||||
this.auditStatus = order.audit_status;
|
||||
const paperTubeWeight = this.form.paper_tube_weight;
|
||||
const packageWeight = this.form.package_weight;
|
||||
Object.assign(this.form, orderToFormFields(order));
|
||||
if (options.keepWeights) {
|
||||
this.form.paper_tube_weight = paperTubeWeight;
|
||||
this.form.package_weight = packageWeight;
|
||||
}
|
||||
},
|
||||
handleScan(options = {}) {
|
||||
const fromPhone = !!options.fromPhone;
|
||||
@ -444,7 +514,13 @@ export default {
|
||||
},
|
||||
getFineCodeScanCode(fineCode) {
|
||||
if (!fineCode) return '';
|
||||
return fineCode.qr_code || fineCode.scan_code || fineCode.bar_code || '';
|
||||
return fineCode.qr_code
|
||||
|| fineCode.long_code
|
||||
|| fineCode.scan_code
|
||||
|| fineCode.digital_code
|
||||
|| fineCode.bar_code
|
||||
|| fineCode.short_code
|
||||
|| '';
|
||||
},
|
||||
onDeleteFineCode(fineCode) {
|
||||
if (!this.canScan || !this.orderId) {
|
||||
@ -468,6 +544,15 @@ export default {
|
||||
doScanUpdate(scanCode, arrangeType, options = {}) {
|
||||
const { fromPhone = false } = options;
|
||||
const isDelete = arrangeType === ARRANGE_TYPE.DEL;
|
||||
if (!isDelete) {
|
||||
const weightErr = validateScanWeights(this.form.paper_tube_weight, this.form.package_weight);
|
||||
if (weightErr) {
|
||||
this.showError(weightErr);
|
||||
this.QRBarCode = '';
|
||||
this.phoneContinuousScan = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
uni.showLoading({ title: isDelete ? '删除中...' : '处理中...' });
|
||||
return this.$u.api.fpmProcessInOrder.scanUpdate(buildScanUpdateParams({
|
||||
id: this.orderId,
|
||||
@ -475,6 +560,8 @@ export default {
|
||||
arrangeType,
|
||||
// 删除不强制仓位;录入带当前仓位
|
||||
warehouseBinId: isDelete ? 0 : this.warehouseBinId,
|
||||
paperTubeWeight: this.form.paper_tube_weight,
|
||||
packageWeight: this.form.package_weight,
|
||||
}))
|
||||
.then((scanRes) => {
|
||||
this.scanDetail = buildScanDetailFromScanResponse(scanRes);
|
||||
|
||||
@ -18,6 +18,20 @@
|
||||
<text class="mr26">仓库名称</text>
|
||||
<text>{{ order.warehouse_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5 process-in-weight-row">
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">纸筒重量</text>
|
||||
<text>{{ order.paper_tube_weight != null ? order.paper_tube_weight : '-' }}</text>
|
||||
</view>
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">包装重量</text>
|
||||
<text>{{ order.package_weight != null ? order.package_weight : '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">营销体系</text>
|
||||
<text>{{ order.sale_system_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">单据备注</text>
|
||||
<text>{{ order.remark || '-' }}</text>
|
||||
@ -34,6 +48,7 @@
|
||||
<ProcessInDetailList
|
||||
:title="detailTitle"
|
||||
:list="order.item_data"
|
||||
show-tare-columns
|
||||
/>
|
||||
|
||||
<FabricOutFooter :buttons="actionButtons" @action="handleAction" />
|
||||
@ -126,4 +141,13 @@ page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
.process-in-weight-row {
|
||||
gap: 20rpx;
|
||||
}
|
||||
.process-in-weight-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
167
src/pages/storegoods/storeGoodsPurchaseInAdd.vue
Normal file
167
src/pages/storegoods/storeGoodsPurchaseInAdd.vue
Normal file
@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<view class="fabric-out-page">
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
||||
<text class="mr26">进仓单号</text>
|
||||
<u-input disabled placeholder="保存后自动生成" v-model="form.order_no" />
|
||||
</view>
|
||||
<view @click="pickerSelectFun('供应商')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">供应商<text class="redXingh">*</text></text>
|
||||
<view :class="form.biz_unit_name ? '' : 'cBlack'">
|
||||
{{ form.biz_unit_name || '请选择' }}
|
||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="pickerSelectFun('仓库名称')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">仓库名称<text class="redXingh">*</text></text>
|
||||
<view :class="form.warehouse_name ? '' : 'cBlack'">
|
||||
{{ form.warehouse_name || '请选择' }}
|
||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5 process-in-weight-row">
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">纸筒重量</text>
|
||||
<u-input
|
||||
v-model="form.paper_tube_weight"
|
||||
type="digit"
|
||||
:disabled="!canEditWeights"
|
||||
placeholder="1.5"
|
||||
:custom-style="weightInputStyle"
|
||||
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||
/>
|
||||
</view>
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">包装重量</text>
|
||||
<u-input
|
||||
v-model="form.package_weight"
|
||||
type="digit"
|
||||
:disabled="!canEditWeights"
|
||||
placeholder="0.3"
|
||||
:custom-style="weightInputStyle"
|
||||
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="pickerSelectFun('营销体系')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">营销体系<text class="redXingh">*</text></text>
|
||||
<view :class="form.sale_system_name ? '' : 'cBlack'">
|
||||
{{ form.sale_system_name || '请选择' }}
|
||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="pickerSelectFun('订单类型')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">订单类型<text class="redXingh">*</text></text>
|
||||
<view :class="form.sale_mode_name ? '' : 'cBlack'">
|
||||
{{ form.sale_mode_name || '请选择' }}
|
||||
<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-white-plr26-column ptb20 mt32">
|
||||
<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
|
||||
<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
|
||||
</view>
|
||||
|
||||
<ProcessInBinBar
|
||||
:can-scan="canScan"
|
||||
:bin-id="warehouseBinId"
|
||||
:code="warehouseBinCode"
|
||||
:name="warehouseBinName"
|
||||
:show-phone-scan="canScan"
|
||||
@code-input="warehouseBinCode = $event"
|
||||
@confirm="resolveWarehouseBin"
|
||||
@phone-scan="handleBinPhoneScan"
|
||||
@clear="clearWarehouseBin"
|
||||
/>
|
||||
<FabricOutScanBar
|
||||
:can-scan="showQrScanBar"
|
||||
:value="QRBarCode"
|
||||
:delete-mode="BarCodeDelStatus"
|
||||
:message="BillDataMessage"
|
||||
:disabled-tip="qrDisabledTip"
|
||||
:show-phone-scan="canScanQr"
|
||||
@input="QRBarCode = $event"
|
||||
@scan="handleScan"
|
||||
@phone-scan="handlePhoneScan"
|
||||
@delete-mode-change="BarCodeDelChange"
|
||||
/>
|
||||
<ProcessInScanDetail :detail="scanDetail" />
|
||||
|
||||
<ProcessInDetailList
|
||||
:list="form.item_data"
|
||||
:deletable="canScan"
|
||||
show-tare-columns
|
||||
@delete="onDeleteFineCode"
|
||||
/>
|
||||
|
||||
<FabricOutFooter
|
||||
v-if="!headerSaved"
|
||||
:buttons="[{ label: '提交保存', action: 'save' }]"
|
||||
single
|
||||
@action="submitSave"
|
||||
/>
|
||||
<FabricOutFooter
|
||||
v-else
|
||||
:buttons="statusActionButtons"
|
||||
@action="handleStatusAction"
|
||||
/>
|
||||
|
||||
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import formMixin from './storeGoodsPurchaseInMixin.js';
|
||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
|
||||
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
OrderStatusBar,
|
||||
FabricOutScanBar,
|
||||
FabricOutFooter,
|
||||
ProcessInScanDetail,
|
||||
ProcessInDetailList,
|
||||
ProcessInBinBar,
|
||||
},
|
||||
mixins: [formMixin],
|
||||
data() {
|
||||
return {
|
||||
weightInputStyle: {
|
||||
fontSize: '36rpx',
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
uni.setNavigationBarTitle({ title: '新增采购进仓单' });
|
||||
this.pageMode = 'add';
|
||||
this.loadBaseDropdowns();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
.process-in-weight-row {
|
||||
gap: 20rpx;
|
||||
}
|
||||
.process-in-weight-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
|
||||
::v-deep .u-input__input {
|
||||
font-size: 36rpx !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
147
src/pages/storegoods/storeGoodsPurchaseInEdit.vue
Normal file
147
src/pages/storegoods/storeGoodsPurchaseInEdit.vue
Normal file
@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<view class="fabric-out-page">
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
||||
<text class="mr26">进仓单号</text>
|
||||
<text>{{ form.order_no }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">供应商</text>
|
||||
<text>{{ form.biz_unit_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">仓库名称</text>
|
||||
<text>{{ form.warehouse_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5 process-in-weight-row">
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">纸筒重量</text>
|
||||
<u-input
|
||||
v-model="form.paper_tube_weight"
|
||||
type="digit"
|
||||
:disabled="!canEditWeights"
|
||||
placeholder="1.5"
|
||||
:custom-style="weightInputStyle"
|
||||
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||
/>
|
||||
</view>
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">包装重量</text>
|
||||
<u-input
|
||||
v-model="form.package_weight"
|
||||
type="digit"
|
||||
:disabled="!canEditWeights"
|
||||
placeholder="0.3"
|
||||
:custom-style="weightInputStyle"
|
||||
placeholder-style="color: #c0c4cc; font-size: 36rpx;"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">营销体系</text>
|
||||
<text>{{ form.sale_system_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">订单类型</text>
|
||||
<text>{{ form.sale_mode_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">单据备注</text>
|
||||
<text>{{ form.remark || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<ProcessInBinBar
|
||||
:can-scan="canScan"
|
||||
:bin-id="warehouseBinId"
|
||||
:code="warehouseBinCode"
|
||||
:name="warehouseBinName"
|
||||
:show-phone-scan="canScan"
|
||||
@code-input="warehouseBinCode = $event"
|
||||
@confirm="resolveWarehouseBin"
|
||||
@phone-scan="handleBinPhoneScan"
|
||||
@clear="clearWarehouseBin"
|
||||
/>
|
||||
<FabricOutScanBar
|
||||
:can-scan="showQrScanBar"
|
||||
:value="QRBarCode"
|
||||
:delete-mode="BarCodeDelStatus"
|
||||
:message="BillDataMessage"
|
||||
:disabled-tip="qrDisabledTip"
|
||||
:show-phone-scan="canScanQr"
|
||||
@input="QRBarCode = $event"
|
||||
@scan="handleScan"
|
||||
@phone-scan="handlePhoneScan"
|
||||
@delete-mode-change="BarCodeDelChange"
|
||||
/>
|
||||
<ProcessInScanDetail :detail="scanDetail" />
|
||||
|
||||
<ProcessInDetailList
|
||||
:list="form.item_data"
|
||||
:deletable="canScan"
|
||||
show-tare-columns
|
||||
@delete="onDeleteFineCode"
|
||||
/>
|
||||
|
||||
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
||||
|
||||
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import formMixin from './storeGoodsPurchaseInMixin.js';
|
||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
|
||||
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
OrderStatusBar,
|
||||
FabricOutScanBar,
|
||||
FabricOutFooter,
|
||||
ProcessInScanDetail,
|
||||
ProcessInDetailList,
|
||||
ProcessInBinBar,
|
||||
},
|
||||
mixins: [formMixin],
|
||||
data() {
|
||||
return {
|
||||
weightInputStyle: {
|
||||
fontSize: '36rpx',
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
uni.setNavigationBarTitle({ title: '编辑采购进仓单' });
|
||||
this.pageMode = 'edit';
|
||||
if (e.id) {
|
||||
this.loadOrder(Number(e.id), { rejectIfLocked: true });
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
.process-in-weight-row {
|
||||
gap: 20rpx;
|
||||
}
|
||||
.process-in-weight-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
|
||||
::v-deep .u-input__input {
|
||||
font-size: 36rpx !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
263
src/pages/storegoods/storeGoodsPurchaseInList.vue
Normal file
263
src/pages/storegoods/storeGoodsPurchaseInList.vue
Normal file
@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="filterBar">
|
||||
<u-search v-model="filters.order_no" placeholder="进仓单号" :show-action="false" @search="loadList" @custom="loadList" />
|
||||
<view class="filterBtn" @click="filterShow = true">
|
||||
<u-icon name="list" size="40" color="#666"></u-icon>
|
||||
<text>筛选</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y :style="{ height: scrollHeight }" refresher-enabled
|
||||
:refresher-triggered="triggered" @refresherrefresh="onRefresh">
|
||||
<dataNull v-if="list.length === 0" src="/src/static/img/chahua/gjNull.png"
|
||||
title="暂无采购进仓单" title1="请点击右下角按钮新增">
|
||||
</dataNull>
|
||||
<view v-for="(item, index) in list" :key="item.id" @click="goView(item)">
|
||||
<PurchaseInItem :item="item" :index="index" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<addBtn url="./storeGoodsPurchaseInAdd"></addBtn>
|
||||
|
||||
<u-popup v-model="filterShow" mode="right" width="580rpx" :safe-area-inset-bottom="true">
|
||||
<view class="filterPanel">
|
||||
<view class="filterTitle">筛选条件</view>
|
||||
<view class="filterItem">
|
||||
<text class="filterLabel">进仓单号</text>
|
||||
<u-input v-model="filters.order_no" placeholder="请输入进仓单号" />
|
||||
</view>
|
||||
<view class="filterItem" @click="openSupplierSelect">
|
||||
<text class="filterLabel">供应商</text>
|
||||
<view class="filterValue">{{ supplierLabel || '全部' }} <u-icon name="arrow-right" size="28"></u-icon></view>
|
||||
</view>
|
||||
<view class="filterItem" @click="openWarehouseSelect">
|
||||
<text class="filterLabel">仓库</text>
|
||||
<view class="filterValue">{{ warehouseLabel || '全部' }} <u-icon name="arrow-right" size="28"></u-icon></view>
|
||||
</view>
|
||||
<view class="filterItem" @click="openStatusSelect">
|
||||
<text class="filterLabel">订单状态</text>
|
||||
<view class="filterValue">{{ statusLabel || '全部' }} <u-icon name="arrow-right" size="28"></u-icon></view>
|
||||
</view>
|
||||
<view class="filterActions">
|
||||
<u-button type="warning" size="medium" @click="resetFilter">重置</u-button>
|
||||
<u-button type="primary" size="medium" @click="applyFilter">确定</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<u-select v-model="statusSelectShow" :list="statusSelectList" @confirm="onStatusConfirm"></u-select>
|
||||
<u-select v-model="unitSelectShow" :list="unitSelectList" @confirm="onUnitConfirm"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addBtn from '@/components/addBtn/addBtn.vue';
|
||||
import PurchaseInItem from '@/components/card/storeGoodsPurchaseInItem.vue';
|
||||
import {
|
||||
getStatusOptions,
|
||||
AUDIT_STATUS_MAP,
|
||||
BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER,
|
||||
WAREHOUSE_TYPE_FINISHED,
|
||||
formatRoll,
|
||||
mapToSelectOptions,
|
||||
fetchAllOrderList,
|
||||
} from '@/common/storeGoodsPurchaseIn';
|
||||
|
||||
export default {
|
||||
components: { addBtn, PurchaseInItem },
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
scrollHeight: '667px',
|
||||
triggered: false,
|
||||
listLoading: false,
|
||||
filterShow: false,
|
||||
statusSelectShow: false,
|
||||
unitSelectShow: false,
|
||||
unitSelectType: '',
|
||||
supplierOptions: [],
|
||||
warehouseOptions: [],
|
||||
unitOptionsLoading: false,
|
||||
filters: {
|
||||
order_no: '',
|
||||
supplier_id: '',
|
||||
supplier_name: '',
|
||||
warehouse_id: '',
|
||||
warehouse_name: '',
|
||||
audit_status: '',
|
||||
},
|
||||
statusSelectList: [
|
||||
{ value: '', label: '全部' },
|
||||
...getStatusOptions(),
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
statusLabel() {
|
||||
if (this.filters.audit_status === '' || this.filters.audit_status === null) return '';
|
||||
return AUDIT_STATUS_MAP[Number(this.filters.audit_status)] || '';
|
||||
},
|
||||
supplierLabel() {
|
||||
return this.filters.supplier_name || '';
|
||||
},
|
||||
warehouseLabel() {
|
||||
return this.filters.warehouse_name || '';
|
||||
},
|
||||
unitSelectList() {
|
||||
const options = this.unitSelectType === 'warehouse' ? this.warehouseOptions : this.supplierOptions;
|
||||
return [{ value: '', label: '全部' }, ...options];
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
uni.setNavigationBarTitle({ title: '成品采购进仓' });
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||
},
|
||||
});
|
||||
},
|
||||
onShow() {
|
||||
this.loadList();
|
||||
},
|
||||
methods: {
|
||||
loadSupplierOptions() {
|
||||
if (this.supplierOptions.length) return Promise.resolve(this.supplierOptions);
|
||||
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER })
|
||||
.then((res) => {
|
||||
this.supplierOptions = mapToSelectOptions(res);
|
||||
return this.supplierOptions;
|
||||
})
|
||||
.catch(() => {
|
||||
this.supplierOptions = [];
|
||||
return this.supplierOptions;
|
||||
});
|
||||
},
|
||||
loadWarehouseOptions() {
|
||||
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||
.then((res) => {
|
||||
this.warehouseOptions = mapToSelectOptions(res);
|
||||
return this.warehouseOptions;
|
||||
})
|
||||
.catch(() => {
|
||||
this.warehouseOptions = [];
|
||||
return this.warehouseOptions;
|
||||
});
|
||||
},
|
||||
openUnitSelect(type) {
|
||||
if (this.unitOptionsLoading) return;
|
||||
this.unitOptionsLoading = true;
|
||||
const loadFn = type === 'warehouse' ? this.loadWarehouseOptions : this.loadSupplierOptions;
|
||||
loadFn.call(this)
|
||||
.then((list) => {
|
||||
if (!list.length) {
|
||||
uni.showToast({ title: '暂无可选数据', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.unitSelectType = type;
|
||||
this.unitSelectShow = true;
|
||||
})
|
||||
.finally(() => {
|
||||
this.unitOptionsLoading = false;
|
||||
});
|
||||
},
|
||||
openSupplierSelect() {
|
||||
this.openUnitSelect('supplier');
|
||||
},
|
||||
openWarehouseSelect() {
|
||||
this.openUnitSelect('warehouse');
|
||||
},
|
||||
onUnitConfirm(e) {
|
||||
const item = e[0] || {};
|
||||
if (this.unitSelectType === 'warehouse') {
|
||||
this.filters.warehouse_id = item.value;
|
||||
this.filters.warehouse_name = item.value ? item.label : '';
|
||||
} else {
|
||||
this.filters.supplier_id = item.value;
|
||||
this.filters.supplier_name = item.value ? item.label : '';
|
||||
}
|
||||
},
|
||||
loadList() {
|
||||
if (this.listLoading) return;
|
||||
this.listLoading = true;
|
||||
const params = {};
|
||||
if (this.filters.order_no) params.order_no = this.filters.order_no;
|
||||
if (this.filters.supplier_id) params.supplier_id = this.filters.supplier_id;
|
||||
if (this.filters.warehouse_id) params.warehouse_id = this.filters.warehouse_id;
|
||||
if (this.filters.audit_status !== '' && this.filters.audit_status !== null) {
|
||||
params.audit_status = this.filters.audit_status;
|
||||
}
|
||||
fetchAllOrderList((p) => this.$u.api.fpmPrcInOrder.list(p), params)
|
||||
.then((rows) => {
|
||||
this.list = rows.map(this.mapToCard);
|
||||
})
|
||||
.catch((err) => {
|
||||
this.list = [];
|
||||
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
|
||||
})
|
||||
.finally(() => {
|
||||
this.listLoading = false;
|
||||
this.triggered = false;
|
||||
// 避免并发请求下 uView 全局 loading 遮罩关不掉
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
mapToCard(order) {
|
||||
return {
|
||||
id: order.id,
|
||||
order_no: order.order_no || '',
|
||||
biz_unit_id: order.biz_unit_id || '',
|
||||
biz_unit_name: order.biz_unit_name || '',
|
||||
warehouse_id: order.warehouse_id || '',
|
||||
warehouse_name: order.warehouse_name || '',
|
||||
create_user_name: order.creator_name || '',
|
||||
create_time: order.create_time || '',
|
||||
auditor_name: order.auditor_name || '',
|
||||
audit_date: order.audit_time || '',
|
||||
audit_status: order.audit_status,
|
||||
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[order.audit_status] || '',
|
||||
total_roll: formatRoll(order.total_roll),
|
||||
};
|
||||
},
|
||||
onRefresh() {
|
||||
this.triggered = true;
|
||||
this.loadList();
|
||||
},
|
||||
goView(item) {
|
||||
const page = Number(item.audit_status) === 1
|
||||
? 'storeGoodsPurchaseInEdit'
|
||||
: 'storeGoodsPurchaseInView';
|
||||
uni.navigateTo({ url: `./${page}?id=${item.id}` });
|
||||
},
|
||||
openStatusSelect() { this.statusSelectShow = true; },
|
||||
onStatusConfirm(e) { this.filters.audit_status = e[0].value; },
|
||||
resetFilter() {
|
||||
this.filters = {
|
||||
order_no: '',
|
||||
supplier_id: '',
|
||||
supplier_name: '',
|
||||
warehouse_id: '',
|
||||
warehouse_name: '',
|
||||
audit_status: '',
|
||||
};
|
||||
},
|
||||
applyFilter() {
|
||||
this.filterShow = false;
|
||||
this.loadList();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page { background-color: #F8F8F8; }
|
||||
.filterBar { display: flex; align-items: center; padding: 16rpx 20rpx; background: #fff; gap: 16rpx; }
|
||||
.filterBtn { display: flex; flex-direction: column; align-items: center; font-size: 22rpx; color: #666; min-width: 80rpx; }
|
||||
.filterPanel { padding: 30rpx; }
|
||||
.filterTitle { font-size: 32rpx; font-weight: bold; margin-bottom: 30rpx; }
|
||||
.filterItem { margin-bottom: 24rpx; }
|
||||
.filterLabel { display: block; font-size: 28rpx; color: #666; margin-bottom: 12rpx; }
|
||||
.filterValue { display: flex; align-items: center; justify-content: space-between; padding: 16rpx; background: #f5f5f5; border-radius: 8rpx; font-size: 28rpx; }
|
||||
.filterActions { display: flex; gap: 20rpx; margin-top: 40rpx; }
|
||||
</style>
|
||||
627
src/pages/storegoods/storeGoodsPurchaseInMixin.js
Normal file
627
src/pages/storegoods/storeGoodsPurchaseInMixin.js
Normal file
@ -0,0 +1,627 @@
|
||||
/**
|
||||
* 成品采购进仓单表单 mixin(新增/编辑共用)
|
||||
*
|
||||
* 1. 先填表头(供应商 / 仓库 / 营销体系 / 订单类型 / 备注)提交 add,拿到 id 后可扫码
|
||||
* 2. 先扫仓位(getWarehouseBin:传 qr_code + warehouse_id),校验后扫布匹二维码
|
||||
* 3. 扫码走 updateFpmPrcInOrder(arrange_type: 1 录入 / 3 删除,带 warehouse_bin_id、纸筒/包装重量)
|
||||
* 4. 手机扫码成功展示详情后自动再次调起扫码,形成连续扫
|
||||
*/
|
||||
import util from '@/common/util';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
import { initTts, speak } from '@/common/tts.js';
|
||||
import {
|
||||
AUDIT_STATUS_MAP,
|
||||
ARRANGE_TYPE,
|
||||
BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER,
|
||||
WAREHOUSE_TYPE_FINISHED,
|
||||
IN_ORDER_TYPE_PURCHASE,
|
||||
IN_ORDER_TYPE_MAP,
|
||||
SALE_MODE,
|
||||
SALE_MODE_MAP,
|
||||
SALE_MODE_OPTIONS,
|
||||
DEFAULT_PAPER_TUBE_WEIGHT,
|
||||
DEFAULT_PACKAGE_WEIGHT,
|
||||
normalizeOrder,
|
||||
mapToSelectOptions,
|
||||
canScanAtStatus,
|
||||
isLockedOrderStatus,
|
||||
getFormStatusActionButtons,
|
||||
orderToFormFields,
|
||||
confirmOrderStatusAction,
|
||||
DRAFT_AUDIT_STATUS,
|
||||
DRAFT_AUDIT_STATUS_NAME,
|
||||
getEmptyScanDetail,
|
||||
buildScanDetailFromScanResponse,
|
||||
buildScanUpdateParams,
|
||||
pickDefaultWarehouse,
|
||||
validateScanWeights,
|
||||
} from '@/common/storeGoodsPurchaseIn';
|
||||
|
||||
export default {
|
||||
mixins: [scanMixin],
|
||||
data() {
|
||||
return {
|
||||
pageMode: 'add',
|
||||
orderId: 0,
|
||||
form: this.getEmptyForm(),
|
||||
headerSaved: false,
|
||||
selectShow: false,
|
||||
selectList: [],
|
||||
selectType: '',
|
||||
canScan: false,
|
||||
QRBarCode: '',
|
||||
BarCodeDelStatus: false,
|
||||
BillDataMessage: '',
|
||||
scanDetail: getEmptyScanDetail(),
|
||||
auditStatus: 0,
|
||||
supplierOptions: [],
|
||||
warehouseOptions: [],
|
||||
saleSystemOptions: [],
|
||||
saleModeOptions: SALE_MODE_OPTIONS,
|
||||
dropdownLoading: false,
|
||||
/** 仓位 */
|
||||
warehouseBinId: 0,
|
||||
warehouseBinCode: '',
|
||||
warehouseBinName: '',
|
||||
/** 手机连续扫码开关:成功后自动再调起;取消/失败则关闭 */
|
||||
phoneContinuousScan: false,
|
||||
/** 手机扫当前目标:bin | qr */
|
||||
phoneScanTarget: 'bin',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isReadonly() {
|
||||
return this.pageMode === 'view';
|
||||
},
|
||||
isEditable() {
|
||||
return this.pageMode === 'add' || this.pageMode === 'edit';
|
||||
},
|
||||
headerEditable() {
|
||||
return this.pageMode === 'add' && !this.headerSaved;
|
||||
},
|
||||
/** 纸筒/包装重量随扫码提交,保存前后及可扫编辑态均可改 */
|
||||
canEditWeights() {
|
||||
return this.isEditable && (this.headerEditable || this.canScan);
|
||||
},
|
||||
statusActionButtons() {
|
||||
return getFormStatusActionButtons(this.headerSaved, this.orderId, this.auditStatus);
|
||||
},
|
||||
displayAuditStatus() {
|
||||
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS;
|
||||
return this.auditStatus;
|
||||
},
|
||||
displayAuditStatusName() {
|
||||
if (this.pageMode === 'add' && !this.headerSaved) return DRAFT_AUDIT_STATUS_NAME;
|
||||
return AUDIT_STATUS_MAP[this.auditStatus] || '';
|
||||
},
|
||||
/** 录入需先选仓位;删除模式仅需单据可扫 */
|
||||
canScanQr() {
|
||||
if (!this.canScan) return false;
|
||||
if (this.BarCodeDelStatus) return true;
|
||||
return !!this.warehouseBinId;
|
||||
},
|
||||
/** 扫码栏在可扫状态下始终展示(含删除勾选) */
|
||||
showQrScanBar() {
|
||||
return this.canScan;
|
||||
},
|
||||
qrDisabledTip() {
|
||||
if (!this.canScan) return '请先提交保存后再扫码';
|
||||
if (!this.warehouseBinId && !this.BarCodeDelStatus) return '请先扫描仓位后再扫布匹二维码';
|
||||
return '当前状态不可扫码';
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.isPageActive = true;
|
||||
initTts();
|
||||
if (this.canScan && this.isEditable) {
|
||||
this.registerOrderScanBroadcast();
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
this.isPageActive = false;
|
||||
this.phoneContinuousScan = false;
|
||||
this.unregisterScanBroadcast();
|
||||
},
|
||||
onUnload() {
|
||||
this.isPageActive = false;
|
||||
this.phoneContinuousScan = false;
|
||||
this.unregisterScanBroadcast();
|
||||
},
|
||||
methods: {
|
||||
clearWarehouseBin() {
|
||||
this.warehouseBinId = 0;
|
||||
this.warehouseBinCode = '';
|
||||
this.warehouseBinName = '';
|
||||
this.phoneContinuousScan = false;
|
||||
},
|
||||
handleBinPhoneScan() {
|
||||
if (!this.canScan || !this.orderId) {
|
||||
this.showError('请先提交保存后再扫码');
|
||||
return;
|
||||
}
|
||||
this.phoneContinuousScan = false;
|
||||
this.phoneScanTarget = 'bin';
|
||||
this.openPhoneScan({
|
||||
callback: (scanResult) => {
|
||||
this.warehouseBinCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||
this.$nextTick(() => this.resolveWarehouseBin());
|
||||
},
|
||||
fail: () => {},
|
||||
});
|
||||
},
|
||||
handlePhoneScan() {
|
||||
if (!this.canScan || !this.orderId) {
|
||||
this.showError('请先提交保存后再扫码');
|
||||
return;
|
||||
}
|
||||
// 删除模式可直接扫布匹码;录入模式无仓位时先扫仓位
|
||||
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
|
||||
this.handleBinPhoneScan();
|
||||
return;
|
||||
}
|
||||
this.phoneScanTarget = 'qr';
|
||||
this.phoneContinuousScan = true;
|
||||
this.openContinuousPhoneScan();
|
||||
},
|
||||
openContinuousPhoneScan() {
|
||||
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||
this.phoneContinuousScan = false;
|
||||
return;
|
||||
}
|
||||
this.openPhoneScan({
|
||||
callback: (scanResult) => {
|
||||
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||
this.$nextTick(() => this.handleScan({ fromPhone: true }));
|
||||
},
|
||||
fail: () => {
|
||||
this.phoneContinuousScan = false;
|
||||
},
|
||||
});
|
||||
},
|
||||
scheduleNextPhoneScan() {
|
||||
if (!this.phoneContinuousScan || !this.canScanQr || !this.isPageActive) {
|
||||
this.phoneContinuousScan = false;
|
||||
return;
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.openContinuousPhoneScan();
|
||||
}, 400);
|
||||
},
|
||||
registerOrderScanBroadcast() {
|
||||
this.registerScanBroadcast((scanResult) => {
|
||||
const code = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||
if (!code) return;
|
||||
// 删除模式:直接按布匹码删除;未扫仓位时枪扫优先解析为仓位
|
||||
if (!this.BarCodeDelStatus && !this.warehouseBinId) {
|
||||
this.warehouseBinCode = code;
|
||||
this.$nextTick(() => this.resolveWarehouseBin());
|
||||
return;
|
||||
}
|
||||
this.QRBarCode = code;
|
||||
this.$nextTick(() => this.handleScan());
|
||||
});
|
||||
},
|
||||
resolveWarehouseBin() {
|
||||
const code = (this.warehouseBinCode || '').trim();
|
||||
if (!this.canScan || !this.orderId) {
|
||||
this.showError('请先提交保存后再扫码');
|
||||
return;
|
||||
}
|
||||
if (!code) return;
|
||||
if (!this.form.warehouse_id) {
|
||||
this.showError('单据缺少仓库信息');
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: '识别仓位...' });
|
||||
return this.$u.api.warehouseBin.getByQrCode({
|
||||
qr_code: code,
|
||||
warehouse_id: Number(this.form.warehouse_id),
|
||||
})
|
||||
.then((data) => {
|
||||
uni.hideLoading();
|
||||
if (!data || !data.id) {
|
||||
throw new Error('未识别到仓位');
|
||||
}
|
||||
// 返回 physical_warehouse_id,与单据仓库校验
|
||||
if (
|
||||
data.physical_warehouse_id
|
||||
&& String(data.physical_warehouse_id) !== String(this.form.warehouse_id)
|
||||
) {
|
||||
this.warehouseBinId = 0;
|
||||
this.warehouseBinName = '';
|
||||
throw new Error('该仓位不属于当前仓库');
|
||||
}
|
||||
this.warehouseBinId = data.id;
|
||||
this.warehouseBinCode = data.code || data.qr_code || code;
|
||||
this.warehouseBinName = data.name || '';
|
||||
this.BillDataMessage = '';
|
||||
speak('仓位成功');
|
||||
uni.showToast({ title: '仓位识别成功', icon: 'success' });
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading();
|
||||
this.warehouseBinId = 0;
|
||||
this.warehouseBinName = '';
|
||||
this.showError(e.message || '仓位识别失败');
|
||||
});
|
||||
},
|
||||
syncCanScanFromStatus(status) {
|
||||
const nextCanScan = this.isEditable && canScanAtStatus(status);
|
||||
if (this.canScan && !nextCanScan) {
|
||||
this.phoneContinuousScan = false;
|
||||
this.unregisterScanBroadcast();
|
||||
}
|
||||
this.canScan = nextCanScan;
|
||||
},
|
||||
loadBaseDropdowns() {
|
||||
if (this.dropdownLoading) return Promise.resolve();
|
||||
this.dropdownLoading = true;
|
||||
if (this.headerEditable) this.applyDefaultSaleSystem();
|
||||
return Promise.all([
|
||||
this.ensureSupplierOptions().catch((e) => {
|
||||
console.error('加载供应商失败', e);
|
||||
return [];
|
||||
}),
|
||||
this.ensureWarehouseOptions().catch((e) => {
|
||||
console.error('加载仓库失败', e);
|
||||
return [];
|
||||
}),
|
||||
this.ensureSaleSystemOptions().catch((e) => {
|
||||
console.error('加载营销体系失败', e);
|
||||
return [];
|
||||
}),
|
||||
]).finally(() => {
|
||||
this.dropdownLoading = false;
|
||||
});
|
||||
},
|
||||
ensureSupplierOptions() {
|
||||
if (this.supplierOptions.length) return Promise.resolve(this.supplierOptions);
|
||||
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER })
|
||||
.then((res) => {
|
||||
this.supplierOptions = mapToSelectOptions(res);
|
||||
return this.supplierOptions;
|
||||
});
|
||||
},
|
||||
ensureWarehouseOptions() {
|
||||
if (this.warehouseOptions.length) return Promise.resolve(this.warehouseOptions);
|
||||
return this.$u.api.physicalWarehouse.getDropdownList({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED })
|
||||
.then((res) => {
|
||||
this.warehouseOptions = mapToSelectOptions(res);
|
||||
if (this.headerEditable && !this.form.warehouse_id) {
|
||||
this.applyDefaultWarehouse();
|
||||
}
|
||||
return this.warehouseOptions;
|
||||
});
|
||||
},
|
||||
ensureSaleSystemOptions() {
|
||||
if (this.saleSystemOptions.length) return Promise.resolve(this.saleSystemOptions);
|
||||
return this.$u.api.saleSystem.getDropdownList()
|
||||
.then((res) => {
|
||||
this.saleSystemOptions = mapToSelectOptions(res);
|
||||
if (this.headerEditable) this.applyDefaultSaleSystem();
|
||||
return this.saleSystemOptions;
|
||||
});
|
||||
},
|
||||
applyDefaultWarehouse() {
|
||||
const app = getApp();
|
||||
const picked = pickDefaultWarehouse(
|
||||
this.warehouseOptions,
|
||||
app && app.globalData ? app.globalData.StoreNameID : '',
|
||||
app && app.globalData ? app.globalData.StoreName : '',
|
||||
);
|
||||
if (!picked) return;
|
||||
this.form.warehouse_id = picked.value;
|
||||
this.form.warehouse_name = picked.label;
|
||||
},
|
||||
applyDefaultSaleSystem() {
|
||||
if (this.form.sale_system_id) {
|
||||
if (!this.form.sale_system_name && this.saleSystemOptions.length) {
|
||||
const found = this.saleSystemOptions.find(
|
||||
(item) => String(item.value) === String(this.form.sale_system_id),
|
||||
);
|
||||
if (found) this.form.sale_system_name = found.label;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const app = getApp();
|
||||
const gd = app && app.globalData ? app.globalData : {};
|
||||
const id = gd.PlanDepartmentID;
|
||||
if (!id) return;
|
||||
this.form.sale_system_id = id;
|
||||
this.form.sale_system_name = gd.PlanDepartmentName || '';
|
||||
if (!this.form.sale_system_name && this.saleSystemOptions.length) {
|
||||
const found = this.saleSystemOptions.find((item) => String(item.value) === String(id));
|
||||
if (found) this.form.sale_system_name = found.label;
|
||||
}
|
||||
},
|
||||
getEmptyForm() {
|
||||
const app = getApp();
|
||||
const gd = app && app.globalData ? app.globalData : {};
|
||||
return {
|
||||
order_no: '',
|
||||
biz_unit_id: '',
|
||||
biz_unit_name: '',
|
||||
warehouse_id: '',
|
||||
warehouse_name: '',
|
||||
sale_system_id: gd.PlanDepartmentID || '',
|
||||
sale_system_name: gd.PlanDepartmentName || '',
|
||||
sale_mode: SALE_MODE.BULK,
|
||||
sale_mode_name: SALE_MODE_MAP[SALE_MODE.BULK],
|
||||
in_order_type: IN_ORDER_TYPE_PURCHASE,
|
||||
in_order_type_name: IN_ORDER_TYPE_MAP[IN_ORDER_TYPE_PURCHASE],
|
||||
paper_tube_weight: String(DEFAULT_PAPER_TUBE_WEIGHT),
|
||||
package_weight: String(DEFAULT_PACKAGE_WEIGHT),
|
||||
remark: '',
|
||||
item_data: [],
|
||||
};
|
||||
},
|
||||
loadOrder(id, options = {}) {
|
||||
const { rejectIfLocked = false } = options;
|
||||
return this.$u.api.fpmPrcInOrder.detail({ id })
|
||||
.then((res) => {
|
||||
const order = normalizeOrder(res);
|
||||
if (!order) {
|
||||
this.showError('单据不存在');
|
||||
return null;
|
||||
}
|
||||
if (rejectIfLocked && isLockedOrderStatus(order.audit_status)) {
|
||||
this.showError('当前状态不可编辑');
|
||||
setTimeout(() => uni.navigateBack(), 1500);
|
||||
return null;
|
||||
}
|
||||
this.orderId = order.id;
|
||||
this.auditStatus = order.audit_status;
|
||||
this.headerSaved = true;
|
||||
this.form = orderToFormFields(order);
|
||||
this.clearWarehouseBin();
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
if (this.canScan) this.registerOrderScanBroadcast();
|
||||
return order;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.showError(e.message || '加载单据失败');
|
||||
return null;
|
||||
});
|
||||
},
|
||||
pickerSelectFun(type) {
|
||||
if (!this.headerEditable) return;
|
||||
this.selectType = type;
|
||||
const openPicker = (list) => {
|
||||
if (!list.length) {
|
||||
this.showError('暂无可选数据');
|
||||
return;
|
||||
}
|
||||
this.selectList = list;
|
||||
this.selectShow = true;
|
||||
};
|
||||
if (type === '供应商') {
|
||||
this.ensureSupplierOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载供应商失败'));
|
||||
} else if (type === '仓库名称') {
|
||||
this.ensureWarehouseOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载仓库失败'));
|
||||
} else if (type === '营销体系') {
|
||||
this.ensureSaleSystemOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载营销体系失败'));
|
||||
} else if (type === '订单类型') {
|
||||
openPicker(this.saleModeOptions);
|
||||
}
|
||||
},
|
||||
selectConfirmFun(e) {
|
||||
const item = e[0];
|
||||
if (this.selectType === '供应商') {
|
||||
this.form.biz_unit_id = item.value;
|
||||
this.form.biz_unit_name = item.label;
|
||||
} else if (this.selectType === '仓库名称') {
|
||||
this.form.warehouse_id = item.value;
|
||||
this.form.warehouse_name = item.label;
|
||||
} else if (this.selectType === '营销体系') {
|
||||
this.form.sale_system_id = item.value;
|
||||
this.form.sale_system_name = item.label;
|
||||
} else if (this.selectType === '订单类型') {
|
||||
this.form.sale_mode = item.value;
|
||||
this.form.sale_mode_name = item.label;
|
||||
}
|
||||
},
|
||||
validateForm() {
|
||||
if (!this.form.biz_unit_id) return '请选择供应商';
|
||||
if (!this.form.warehouse_id) return '请选择仓库名称';
|
||||
if (!this.form.sale_system_id) return '请选择营销体系';
|
||||
if (!this.form.sale_mode) return '请选择订单类型';
|
||||
return '';
|
||||
},
|
||||
buildAddParam() {
|
||||
return {
|
||||
inOrderType: IN_ORDER_TYPE_PURCHASE,
|
||||
biz_unit_id: Number(this.form.biz_unit_id),
|
||||
warehouse_id: Number(this.form.warehouse_id),
|
||||
sale_system_id: Number(this.form.sale_system_id),
|
||||
sale_mode: Number(this.form.sale_mode),
|
||||
remark: this.form.remark || '',
|
||||
item_data: [],
|
||||
};
|
||||
},
|
||||
submitSave() {
|
||||
if (this.headerSaved) {
|
||||
this.showError('表头已保存,请直接扫码');
|
||||
return;
|
||||
}
|
||||
const err = this.validateForm();
|
||||
if (err) {
|
||||
this.showError(err);
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: '保存中...' });
|
||||
this.$u.api.fpmPrcInOrder.add(this.buildAddParam())
|
||||
.then((res) => {
|
||||
this.orderId = (res && res.id) || 0;
|
||||
if (!this.orderId) {
|
||||
throw new Error('保存失败,未返回单据ID');
|
||||
}
|
||||
return this.$u.api.fpmPrcInOrder.detail({ id: this.orderId });
|
||||
})
|
||||
.then((detail) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(detail);
|
||||
this.applyOrder(order, { keepWeights: true });
|
||||
this.headerSaved = true;
|
||||
this.clearWarehouseBin();
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
this.showSuccess('保存成功,请先扫描仓位');
|
||||
this.registerOrderScanBroadcast();
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading();
|
||||
this.showError(e.message || '保存失败');
|
||||
});
|
||||
},
|
||||
applyOrder(order, options = {}) {
|
||||
if (!order) return;
|
||||
this.auditStatus = order.audit_status;
|
||||
const paperTubeWeight = this.form.paper_tube_weight;
|
||||
const packageWeight = this.form.package_weight;
|
||||
Object.assign(this.form, orderToFormFields(order));
|
||||
if (options.keepWeights) {
|
||||
this.form.paper_tube_weight = paperTubeWeight;
|
||||
this.form.package_weight = packageWeight;
|
||||
}
|
||||
},
|
||||
handleScan(options = {}) {
|
||||
const fromPhone = !!options.fromPhone;
|
||||
const code = (this.QRBarCode || '').trim();
|
||||
if (!this.canScan || !this.orderId) {
|
||||
this.showError('请先提交保存后再扫码');
|
||||
this.QRBarCode = '';
|
||||
this.phoneContinuousScan = false;
|
||||
return;
|
||||
}
|
||||
const isDelete = this.BarCodeDelStatus;
|
||||
if (!isDelete && !this.warehouseBinId) {
|
||||
this.showError('请先扫描仓位');
|
||||
this.QRBarCode = '';
|
||||
this.phoneContinuousScan = false;
|
||||
return;
|
||||
}
|
||||
if (!code) {
|
||||
this.QRBarCode = '';
|
||||
if (fromPhone) this.scheduleNextPhoneScan();
|
||||
return;
|
||||
}
|
||||
const arrangeType = isDelete ? ARRANGE_TYPE.DEL : ARRANGE_TYPE.IN;
|
||||
this.doScanUpdate(code, arrangeType, { fromPhone });
|
||||
},
|
||||
BarCodeDelChange(e) {
|
||||
this.BarCodeDelStatus = (e.detail.value || []).length > 0;
|
||||
this.BillDataMessage = this.BarCodeDelStatus ? '删除模式:扫描细码即可删除' : '';
|
||||
},
|
||||
getFineCodeScanCode(fineCode) {
|
||||
if (!fineCode) return '';
|
||||
return fineCode.qr_code
|
||||
|| fineCode.long_code
|
||||
|| fineCode.scan_code
|
||||
|| fineCode.digital_code
|
||||
|| fineCode.bar_code
|
||||
|| fineCode.short_code
|
||||
|| '';
|
||||
},
|
||||
onDeleteFineCode(fineCode) {
|
||||
if (!this.canScan || !this.orderId) {
|
||||
this.showError('当前状态不可删除');
|
||||
return;
|
||||
}
|
||||
const scanCode = this.getFineCodeScanCode(fineCode);
|
||||
if (!scanCode) {
|
||||
this.showError('该细码缺少条码,无法删除');
|
||||
return;
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `确认删除细码 ${scanCode}?`,
|
||||
success: (res) => {
|
||||
if (!res.confirm) return;
|
||||
this.doScanUpdate(scanCode, ARRANGE_TYPE.DEL);
|
||||
},
|
||||
});
|
||||
},
|
||||
doScanUpdate(scanCode, arrangeType, options = {}) {
|
||||
const { fromPhone = false } = options;
|
||||
const isDelete = arrangeType === ARRANGE_TYPE.DEL;
|
||||
if (!isDelete) {
|
||||
const weightErr = validateScanWeights(this.form.paper_tube_weight, this.form.package_weight);
|
||||
if (weightErr) {
|
||||
this.showError(weightErr);
|
||||
this.QRBarCode = '';
|
||||
this.phoneContinuousScan = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
uni.showLoading({ title: isDelete ? '删除中...' : '处理中...' });
|
||||
return this.$u.api.fpmPrcInOrder.scanUpdate(buildScanUpdateParams({
|
||||
id: this.orderId,
|
||||
scanCode,
|
||||
arrangeType,
|
||||
// 删除不强制仓位;录入带当前仓位
|
||||
warehouseBinId: isDelete ? 0 : this.warehouseBinId,
|
||||
paperTubeWeight: this.form.paper_tube_weight,
|
||||
packageWeight: this.form.package_weight,
|
||||
}))
|
||||
.then((scanRes) => {
|
||||
this.scanDetail = buildScanDetailFromScanResponse(scanRes);
|
||||
this.BillDataMessage = isDelete ? '删除成功' : '扫描成功';
|
||||
this.QRBarCode = '';
|
||||
if (isDelete) {
|
||||
speak('已删除');
|
||||
uni.showToast({ title: '删除成功', icon: 'success' });
|
||||
} else {
|
||||
speak('成功');
|
||||
}
|
||||
return this.$u.api.fpmPrcInOrder.detail({ id: this.orderId })
|
||||
.then((detail) => {
|
||||
const order = normalizeOrder(detail);
|
||||
if (order) {
|
||||
this.form.item_data = order.item_data;
|
||||
this.auditStatus = order.audit_status;
|
||||
}
|
||||
})
|
||||
.catch(() => null);
|
||||
})
|
||||
.then(() => {
|
||||
uni.hideLoading();
|
||||
if (fromPhone) this.scheduleNextPhoneScan();
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading();
|
||||
this.phoneContinuousScan = false;
|
||||
const message = e.message || (isDelete ? '删除失败' : '扫码失败');
|
||||
this.showError(message);
|
||||
this.QRBarCode = '';
|
||||
});
|
||||
},
|
||||
handleStatusAction(action) {
|
||||
confirmOrderStatusAction(this, {
|
||||
orderId: this.orderId,
|
||||
action,
|
||||
onSuccess: () => this.$u.api.fpmPrcInOrder.detail({ id: this.orderId })
|
||||
.then((detail) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(detail);
|
||||
if (!order) return;
|
||||
this.applyOrder(order);
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
this.showSuccess('操作成功');
|
||||
}),
|
||||
});
|
||||
},
|
||||
showError(message) {
|
||||
util.playErrorAudio();
|
||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||
},
|
||||
showSuccess(message) {
|
||||
util.playSuccessAudio();
|
||||
uni.showToast({ title: message, icon: 'success' });
|
||||
},
|
||||
},
|
||||
};
|
||||
153
src/pages/storegoods/storeGoodsPurchaseInView.vue
Normal file
153
src/pages/storegoods/storeGoodsPurchaseInView.vue
Normal file
@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<view class="fabric-out-page">
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="order.audit_status" :name="order.audit_status_name" />
|
||||
|
||||
<view class="flex-white-plr26 ptb10 bdb_f5">
|
||||
<text class="mr26">进仓单号</text>
|
||||
<text>{{ order.order_no }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">供应商</text>
|
||||
<text>{{ order.biz_unit_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">仓库名称</text>
|
||||
<text>{{ order.warehouse_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5 process-in-weight-row">
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">纸筒重量</text>
|
||||
<text>{{ order.paper_tube_weight != null ? order.paper_tube_weight : '-' }}</text>
|
||||
</view>
|
||||
<view class="process-in-weight-col">
|
||||
<text class="mr16">包装重量</text>
|
||||
<text>{{ order.package_weight != null ? order.package_weight : '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">营销体系</text>
|
||||
<text>{{ order.sale_system_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">订单类型</text>
|
||||
<text>{{ order.sale_mode_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">单据备注</text>
|
||||
<text>{{ order.remark || '-' }}</text>
|
||||
</view>
|
||||
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">创建人</text>
|
||||
<text>{{ order.creator_name }} {{ formatTime(order.create_time, 'YYYY-MM-DD') }}</text>
|
||||
</view>
|
||||
<view v-if="order.auditor_name" class="flex-white-plr26 ptb20 bdb_f5">
|
||||
<text class="mr26">审核人</text>
|
||||
<text>{{ order.auditor_name }} {{ formatTime(order.audit_time, 'YYYY-MM-DD') }}</text>
|
||||
</view>
|
||||
|
||||
<ProcessInDetailList
|
||||
:title="detailTitle"
|
||||
:list="order.item_data"
|
||||
show-tare-columns
|
||||
/>
|
||||
|
||||
<FabricOutFooter :buttons="actionButtons" @action="handleAction" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import util from '@/common/util';
|
||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
|
||||
import {
|
||||
normalizeOrder,
|
||||
getViewStatusActionButtons,
|
||||
confirmOrderStatusAction,
|
||||
formatDisplayTime,
|
||||
} from '@/common/storeGoodsPurchaseIn';
|
||||
|
||||
export default {
|
||||
components: { OrderStatusBar, FabricOutFooter, ProcessInDetailList },
|
||||
data() {
|
||||
return {
|
||||
orderId: 0,
|
||||
order: { item_data: [] },
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
actionButtons() {
|
||||
return getViewStatusActionButtons(this.order.audit_status);
|
||||
},
|
||||
detailTitle() {
|
||||
return `进仓明细(共 ${this.order.total_roll || 0} 匹)`;
|
||||
},
|
||||
},
|
||||
onLoad(e) {
|
||||
uni.setNavigationBarTitle({ title: '采购进仓单详情' });
|
||||
if (e.id) {
|
||||
this.orderId = Number(e.id);
|
||||
this.refreshOrder();
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
if (this.orderId) this.refreshOrder();
|
||||
},
|
||||
methods: {
|
||||
formatTime: formatDisplayTime,
|
||||
refreshOrder() {
|
||||
this.$u.api.fpmPrcInOrder.detail({ id: this.orderId })
|
||||
.then((res) => {
|
||||
const order = normalizeOrder(res);
|
||||
if (!order) {
|
||||
this.showError('单据不存在');
|
||||
return;
|
||||
}
|
||||
this.order = order;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.showError(err.message || '加载单据失败');
|
||||
});
|
||||
},
|
||||
handleAction(action) {
|
||||
if (action === 'edit') {
|
||||
uni.navigateTo({ url: `./storeGoodsPurchaseInEdit?id=${this.orderId}` });
|
||||
return;
|
||||
}
|
||||
confirmOrderStatusAction(this, {
|
||||
orderId: this.orderId,
|
||||
action,
|
||||
onSuccess: () => this.$u.api.fpmPrcInOrder.detail({ id: this.orderId })
|
||||
.then((res) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(res);
|
||||
if (order) this.order = order;
|
||||
util.playSuccessAudio();
|
||||
uni.showToast({ title: '操作成功', icon: 'success' });
|
||||
}),
|
||||
});
|
||||
},
|
||||
showError(message) {
|
||||
util.playErrorAudio();
|
||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
.process-in-weight-row {
|
||||
gap: 20rpx;
|
||||
}
|
||||
.process-in-weight-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
</style>
|
||||
@ -45,6 +45,12 @@
|
||||
</view>
|
||||
<view class="grid-text">加工退货进仓</view>
|
||||
</u-grid-item>
|
||||
<u-grid-item :index="5" @click="navTo('/pages/storegoods/storeGoodsPurchaseInList')">
|
||||
<view class="home-icon icon-color03">
|
||||
<i class="iconfont icon-hetongguanli"></i>
|
||||
</view>
|
||||
<view class="grid-text">采购进仓</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user