feat(storegoods): 新增加工出仓并去除仓位重复提示
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d660d6fcf1
commit
066f1c623c
@ -26,6 +26,9 @@ const install = (Vue, vm) => {
|
|||||||
const FPM_PROCESS_IN_PREFIX = '/product/fpmProcessInOrder/';
|
const FPM_PROCESS_IN_PREFIX = '/product/fpmProcessInOrder/';
|
||||||
const fpmProcessInUrl = (name) => getApiUrl() + FPM_PROCESS_IN_PREFIX + name;
|
const fpmProcessInUrl = (name) => getApiUrl() + FPM_PROCESS_IN_PREFIX + name;
|
||||||
|
|
||||||
|
const FPM_PROCESS_OUT_PREFIX = '/product/fpmProcessOutOrder/';
|
||||||
|
const fpmProcessOutUrl = (name) => getApiUrl() + FPM_PROCESS_OUT_PREFIX + name;
|
||||||
|
|
||||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||||
vm.$u.api = {
|
vm.$u.api = {
|
||||||
|
|
||||||
@ -68,6 +71,18 @@ const install = (Vue, vm) => {
|
|||||||
statusCancel: (params = {}) => vm.$u.putJson(fpmProcessInUrl('updateFpmProcessInOrderStatusCancel'), params),
|
statusCancel: (params = {}) => vm.$u.putJson(fpmProcessInUrl('updateFpmProcessInOrderStatusCancel'), params),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 加工出仓单
|
||||||
|
fpmProcessOutOrder: {
|
||||||
|
list: (params = {}) => vm.$u.get(fpmProcessOutUrl('getFpmProcessOutOrderList'), params),
|
||||||
|
detail: (params = {}) => vm.$u.get(fpmProcessOutUrl('getFpmProcessOutOrder'), params),
|
||||||
|
add: (params = {}) => vm.$u.postJson(fpmProcessOutUrl('addFpmProcessOutOrder'), params),
|
||||||
|
scanUpdate: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrder'), params),
|
||||||
|
statusPass: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrderStatusPass'), params),
|
||||||
|
statusWait: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrderStatusWait'), params),
|
||||||
|
statusReject: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrderStatusReject'), params),
|
||||||
|
statusCancel: (params = {}) => vm.$u.putJson(fpmProcessOutUrl('updateFpmProcessOutOrderStatusCancel'), params),
|
||||||
|
},
|
||||||
|
|
||||||
// 物理仓库下拉
|
// 物理仓库下拉
|
||||||
physicalWarehouse: {
|
physicalWarehouse: {
|
||||||
getDropdownList: (params = {}) => vm.$u.get('/warehouse/physicalWarehouse/getPhysicalWarehouseDropdownList', params),
|
getDropdownList: (params = {}) => vm.$u.get('/warehouse/physicalWarehouse/getPhysicalWarehouseDropdownList', params),
|
||||||
|
|||||||
386
src/common/storeGoodsProcessOut.js
Normal file
386
src/common/storeGoodsProcessOut.js
Normal file
@ -0,0 +1,386 @@
|
|||||||
|
/**
|
||||||
|
* 加工出仓单常量与数据工具
|
||||||
|
*
|
||||||
|
* 真实接口请求统一注册在 src/common/http.api.js 的 vm.$u.api.fpmProcessOutOrder 下。
|
||||||
|
*/
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 出仓类型:正常加工出仓单 WarehouseGoodOutTypeProcess = 5 */
|
||||||
|
export const OUT_ORDER_TYPE_PROCESS = 5;
|
||||||
|
export const OUT_ORDER_TYPE_PROCESS_NAME = '正常加工出仓单';
|
||||||
|
|
||||||
|
/** 往来单位类型:加工单位 */
|
||||||
|
export const BUSINESS_UNIT_TYPE_PROCESS = 12;
|
||||||
|
|
||||||
|
/** 成品物理仓类型 */
|
||||||
|
export const WAREHOUSE_TYPE_FINISHED = 103;
|
||||||
|
|
||||||
|
/** 默认仓库名称 */
|
||||||
|
export const DEFAULT_WAREHOUSE_NAME = '成品仓';
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
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] || '',
|
||||||
|
process_unit_id: order.process_unit_id || '',
|
||||||
|
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 || '',
|
||||||
|
out_order_type: order.out_order_type || OUT_ORDER_TYPE_PROCESS,
|
||||||
|
out_order_type_name: order.out_order_type_name || OUT_ORDER_TYPE_PROCESS_NAME,
|
||||||
|
remark: order.remark || '',
|
||||||
|
warehouse_out_time: (order.warehouse_out_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 || '';
|
||||||
|
const digitalCode = fc.digital_code || '';
|
||||||
|
const barCode = fc.bar_code || digitalCode || '';
|
||||||
|
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: digitalCode,
|
||||||
|
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 || digitalCode || '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeItem(item) {
|
||||||
|
// 明细数量字段:OpenAPI 为 total_weight / settle_weight(×10000),匹数为 out_roll(×100)
|
||||||
|
const weightRaw = item.total_weight != null
|
||||||
|
? item.total_weight
|
||||||
|
: (item.settle_weight != null ? item.settle_weight : item.out_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 || '',
|
||||||
|
out_roll: formatRoll(item.out_roll),
|
||||||
|
out_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 || '',
|
||||||
|
out_roll: 0,
|
||||||
|
out_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 || '',
|
||||||
|
out_roll: 0,
|
||||||
|
out_weight: 0,
|
||||||
|
fine_codes: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const colorGroup = productGroup.colors.get(colorKey);
|
||||||
|
productGroup.out_roll = Number((productGroup.out_roll + Number(item.out_roll || 0)).toFixed(2));
|
||||||
|
productGroup.out_weight = Number((productGroup.out_weight + Number(item.out_weight || 0)).toFixed(2));
|
||||||
|
colorGroup.out_roll = Number((colorGroup.out_roll + Number(item.out_roll || 0)).toFixed(2));
|
||||||
|
colorGroup.out_weight = Number((colorGroup.out_weight + Number(item.out_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,
|
||||||
|
out_roll: product.out_roll,
|
||||||
|
out_weight: product.out_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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从扫码接口返回构建详情区(匹数÷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),
|
||||||
|
item_weight: formatWeightKg(res.item_weight != null ? res.item_weight : res.weight),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 构建扫码请求参数 */
|
||||||
|
export function buildScanUpdateParams({ id, scanCode, arrangeType, warehouseBinId }) {
|
||||||
|
const code = (scanCode || '').trim();
|
||||||
|
const params = {
|
||||||
|
id: Number(id),
|
||||||
|
arrange_type: arrangeType,
|
||||||
|
};
|
||||||
|
if (warehouseBinId) {
|
||||||
|
params.warehouse_bin_id = Number(warehouseBinId);
|
||||||
|
}
|
||||||
|
// 长码走二维码,短码走条码
|
||||||
|
if (code.length > 20) {
|
||||||
|
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,
|
||||||
|
process_unit_id: order.process_unit_id,
|
||||||
|
process_name: order.process_name,
|
||||||
|
warehouse_id: order.warehouse_id,
|
||||||
|
warehouse_name: order.warehouse_name,
|
||||||
|
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.fpmProcessOutOrder;
|
||||||
|
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/storeGoodsProcessOutItem.vue
Normal file
67
src/components/card/storeGoodsProcessOutItem.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.process_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/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
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>
|
||||||
@ -23,7 +23,6 @@
|
|||||||
</view>
|
</view>
|
||||||
<view v-else-if="showDisabledTip" class="fabric-out-scanTip">{{ disabledTip }}</view>
|
<view v-else-if="showDisabledTip" class="fabric-out-scanTip">{{ disabledTip }}</view>
|
||||||
<view v-if="canScan && !binId" class="fabric-out-scanTip">请先扫描仓位,再扫描布匹二维码</view>
|
<view v-if="canScan && !binId" class="fabric-out-scanTip">请先扫描仓位,再扫描布匹二维码</view>
|
||||||
<view v-if="canScan && binId" class="fabric-out-msgTip">当前仓位:{{ name || code }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
71
src/components/storegoods/ProcessOutBinBar.vue
Normal file
71
src/components/storegoods/ProcessOutBinBar.vue
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view v-if="canScan" class="flex-white-plr26 ptb20 bdb_f5 fabric-out-scanRow process-in-binRow">
|
||||||
|
<text class="mr26 process-in-binLabel">仓位<text class="redXingh">*</text></text>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
:value="code"
|
||||||
|
class="fabric-out-scanInput"
|
||||||
|
placeholder="请先扫描仓位"
|
||||||
|
@input="$emit('code-input', $event.detail.value)"
|
||||||
|
@confirm="$emit('confirm')"
|
||||||
|
/>
|
||||||
|
<text v-if="name" class="process-in-binName">{{ name }}</text>
|
||||||
|
<u-icon
|
||||||
|
v-if="showPhoneScan"
|
||||||
|
class="fabric-out-phoneScanIcon"
|
||||||
|
name="scan"
|
||||||
|
size="44"
|
||||||
|
color="#2979ff"
|
||||||
|
@click="$emit('phone-scan')"
|
||||||
|
/>
|
||||||
|
<text v-if="binId" class="process-in-binClear" @click="$emit('clear')">更换</text>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="showDisabledTip" class="fabric-out-scanTip">{{ disabledTip }}</view>
|
||||||
|
<view v-if="canScan && !binId" class="fabric-out-scanTip">请先扫描仓位,再扫描布匹二维码</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
canScan: { type: Boolean, default: false },
|
||||||
|
binId: { type: [Number, String], default: 0 },
|
||||||
|
code: { type: String, default: '' },
|
||||||
|
name: { type: String, default: '' },
|
||||||
|
showPhoneScan: { type: Boolean, default: false },
|
||||||
|
showDisabledTip: { type: Boolean, default: true },
|
||||||
|
disabledTip: { type: String, default: '请先提交保存后再扫仓位' },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
|
||||||
|
.process-in-binRow {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.process-in-binLabel {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.fabric-out-phoneScanIcon {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.process-in-binName {
|
||||||
|
margin-left: 12rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #333;
|
||||||
|
max-width: 200rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.process-in-binClear {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #2979ff;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
251
src/components/storegoods/ProcessOutDetailList.vue
Normal file
251
src/components/storegoods/ProcessOutDetailList.vue
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="fabric-out-sectionTitle">{{ title }}</view>
|
||||||
|
<slot name="before-list" />
|
||||||
|
<view class="fabric-out-detailList">
|
||||||
|
<dataNull
|
||||||
|
v-if="!groups.length"
|
||||||
|
src="/src/static/img/chahua/gjNull.png"
|
||||||
|
title="暂无出仓明细"
|
||||||
|
title1="扫码后将在此展示"
|
||||||
|
/>
|
||||||
|
<view
|
||||||
|
v-for="product in groups"
|
||||||
|
:key="product.group_key"
|
||||||
|
class="fabric-out-detailCard process-in-productCard"
|
||||||
|
>
|
||||||
|
<view class="process-in-productHead">
|
||||||
|
<text class="process-in-productTitle">
|
||||||
|
{{ product.product_code || '-' }}
|
||||||
|
<text v-if="product.product_name" class="process-in-subText"> {{ product.product_name }}</text>
|
||||||
|
</text>
|
||||||
|
<text class="process-in-productSum">
|
||||||
|
匹数 {{ product.out_roll }} / 数量 {{ product.out_weight }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view
|
||||||
|
v-for="color in product.colors"
|
||||||
|
:key="color.group_key"
|
||||||
|
class="process-in-colorBlock"
|
||||||
|
>
|
||||||
|
<view class="process-in-colorHead">
|
||||||
|
<text class="process-in-colorTitle">
|
||||||
|
色号 {{ color.product_color_code || '-' }}
|
||||||
|
<text v-if="color.product_color_name" class="process-in-subText">
|
||||||
|
{{ color.product_color_name }}
|
||||||
|
</text>
|
||||||
|
</text>
|
||||||
|
<text class="process-in-colorSum">
|
||||||
|
匹数 {{ color.out_roll }} / 数量 {{ color.out_weight }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="process-in-colorMeta">
|
||||||
|
<text>染整单:{{ color.quote_order_no || '-' }}</text>
|
||||||
|
<text>缸号:{{ color.dye_factory_dyelot_number || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="process-in-fcTitle">细码({{ color.fine_codes.length }})</view>
|
||||||
|
<view v-if="!color.fine_codes.length" class="process-in-fcEmpty">暂无细码</view>
|
||||||
|
<scroll-view v-else scroll-x class="process-in-fcScroll">
|
||||||
|
<view class="process-in-fcTable" :style="{ width: fineTableWidth }">
|
||||||
|
<view class="process-in-fcRow process-in-fcHead">
|
||||||
|
<view
|
||||||
|
v-for="col in fineColumns"
|
||||||
|
:key="col.key"
|
||||||
|
class="process-in-fcCell"
|
||||||
|
:style="cellStyle(col)"
|
||||||
|
>{{ col.label }}</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-for="(fc, fcIndex) in color.fine_codes"
|
||||||
|
:key="fc.id || fcIndex"
|
||||||
|
class="process-in-fcRow"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
v-for="col in fineColumns"
|
||||||
|
:key="col.key"
|
||||||
|
class="process-in-fcCell"
|
||||||
|
:class="{ 'process-in-fcAction': col.key === 'action' }"
|
||||||
|
:style="cellStyle(col)"
|
||||||
|
@click="onCellTap(col.key, fc)"
|
||||||
|
>{{ formatFineCell(fc, col.key) }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view v-if="deletable && color.fine_codes.length" class="process-in-fcTip">
|
||||||
|
勾选上方「删除」后扫码,或点击「删除」列移除细码
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { buildItemGroups } from '@/common/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
const FINE_COLUMNS = [
|
||||||
|
{ label: '卷号', key: 'volume_number', width: 90 },
|
||||||
|
{ label: '匹数', key: 'roll', width: 90 },
|
||||||
|
{ label: '数量', key: 'weight', width: 110 },
|
||||||
|
{ label: '条码', key: 'bar_code', width: 220 },
|
||||||
|
{ label: '仓位', key: 'warehouse_bin_name', width: 120 },
|
||||||
|
{ label: '缸号', key: 'dye_factory_dyelot_number', width: 140 },
|
||||||
|
];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
list: { type: Array, default: () => [] },
|
||||||
|
title: { type: String, default: '出仓明细' },
|
||||||
|
deletable: { 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 }];
|
||||||
|
},
|
||||||
|
fineTableWidth() {
|
||||||
|
const total = this.fineColumns.reduce((sum, col) => sum + (col.width || 100), 0);
|
||||||
|
return `${total}rpx`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
cellStyle(col) {
|
||||||
|
return {
|
||||||
|
width: `${col.width}rpx`,
|
||||||
|
minWidth: `${col.width}rpx`,
|
||||||
|
maxWidth: `${col.width}rpx`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
formatFineCell(fc, key) {
|
||||||
|
if (key === 'action') return '删除';
|
||||||
|
const val = fc[key];
|
||||||
|
if (val === 0) return '0';
|
||||||
|
return val != null && val !== '' ? val : '-';
|
||||||
|
},
|
||||||
|
onCellTap(key, fc) {
|
||||||
|
if (!this.deletable || key !== 'action') return;
|
||||||
|
this.$emit('delete', fc);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
|
||||||
|
.process-in-productCard {
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.process-in-productHead {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx;
|
||||||
|
background: #f0f7ff;
|
||||||
|
border-bottom: 1rpx solid #e6f0ff;
|
||||||
|
}
|
||||||
|
.process-in-productTitle {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #1a1a1a;
|
||||||
|
flex: 1;
|
||||||
|
padding-right: 16rpx;
|
||||||
|
}
|
||||||
|
.process-in-productSum,
|
||||||
|
.process-in-colorSum {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.process-in-subText {
|
||||||
|
font-weight: normal;
|
||||||
|
color: #666;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
.process-in-colorBlock {
|
||||||
|
padding: 16rpx 20rpx 20rpx;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
}
|
||||||
|
.process-in-colorBlock:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
.process-in-colorHead {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
.process-in-colorTitle {
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
flex: 1;
|
||||||
|
padding-right: 12rpx;
|
||||||
|
}
|
||||||
|
.process-in-colorMeta {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16rpx 24rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #888;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
.process-in-fcTitle {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #2979ff;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
.process-in-fcEmpty {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #bbb;
|
||||||
|
padding: 8rpx 0;
|
||||||
|
}
|
||||||
|
.process-in-fcScroll {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.process-in-fcTable {
|
||||||
|
border: 1rpx solid #eee;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.process-in-fcRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
}
|
||||||
|
.process-in-fcRow:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
.process-in-fcHead {
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
.process-in-fcCell {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 10rpx 8rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #333;
|
||||||
|
border-right: 1rpx solid #f0f0f0;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.process-in-fcHead .process-in-fcCell {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.process-in-fcCell:last-child {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
.process-in-fcAction {
|
||||||
|
color: #f5222d;
|
||||||
|
}
|
||||||
|
.process-in-fcTip {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
36
src/components/storegoods/ProcessOutScanDetail.vue
Normal file
36
src/components/storegoods/ProcessOutScanDetail.vue
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<view class="fabric-out-scanDetail">
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">染整单号:{{ detail.quote_order_no || '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">缸号:{{ detail.dyelot_number || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="fabric-out-scanDetailRow fabric-out-scanDetailRow--2col">
|
||||||
|
<text class="fabric-out-scanDetailCell">卷号:{{ detail.volume_number || '-' }}</text>
|
||||||
|
<text class="fabric-out-scanDetailCell">成品编号:{{ detail.product_code || '-' }}</text>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
detail: { type: Object, default: () => ({}) },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||||
|
</style>
|
||||||
@ -449,6 +449,34 @@
|
|||||||
"navigationBarTitleText": "查看加工进仓单",
|
"navigationBarTitleText": "查看加工进仓单",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessOutList",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "加工出仓列表",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessOutAdd",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "新增加工出仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessOutEdit",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "编辑加工出仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/storegoods/storeGoodsProcessOutView",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "查看加工出仓单",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
},{
|
},{
|
||||||
"path" : "pages/storegoods/storeGoodsBusinessIn",
|
"path" : "pages/storegoods/storeGoodsBusinessIn",
|
||||||
"style" :
|
"style" :
|
||||||
|
|||||||
@ -221,7 +221,7 @@ export default {
|
|||||||
this.warehouseBinId = data.id;
|
this.warehouseBinId = data.id;
|
||||||
this.warehouseBinCode = data.code || data.qr_code || code;
|
this.warehouseBinCode = data.code || data.qr_code || code;
|
||||||
this.warehouseBinName = data.name || '';
|
this.warehouseBinName = data.name || '';
|
||||||
this.BillDataMessage = `仓位已选择:${this.warehouseBinName || this.warehouseBinCode}`;
|
this.BillDataMessage = '';
|
||||||
speak('仓位成功');
|
speak('仓位成功');
|
||||||
uni.showToast({ title: '仓位识别成功', icon: 'success' });
|
uni.showToast({ title: '仓位识别成功', icon: 'success' });
|
||||||
})
|
})
|
||||||
|
|||||||
112
src/pages/storegoods/storeGoodsProcessOutAdd.vue
Normal file
112
src/pages/storegoods/storeGoodsProcessOutAdd.vue
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<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 class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">出仓类型</text>
|
||||||
|
<view>正常加工出仓单</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pickerSelectFun('加工单位')" class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位<text class="redXingh">*</text></text>
|
||||||
|
<view :class="form.process_name ? '' : 'cBlack'">
|
||||||
|
{{ form.process_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-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>
|
||||||
|
|
||||||
|
<ProcessOutBinBar
|
||||||
|
: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"
|
||||||
|
/>
|
||||||
|
<ProcessOutScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessOutDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
@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 './storeGoodsProcessOutMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessOutScanDetail from '@/components/storegoods/ProcessOutScanDetail.vue';
|
||||||
|
import ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
|
||||||
|
import ProcessOutBinBar from '@/components/storegoods/ProcessOutBinBar.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
OrderStatusBar,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessOutScanDetail,
|
||||||
|
ProcessOutDetailList,
|
||||||
|
ProcessOutBinBar,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
98
src/pages/storegoods/storeGoodsProcessOutEdit.vue
Normal file
98
src/pages/storegoods/storeGoodsProcessOutEdit.vue
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<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>正常加工出仓单</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位</text>
|
||||||
|
<text>{{ form.process_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 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">单据备注</text>
|
||||||
|
<text>{{ form.remark || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<ProcessOutBinBar
|
||||||
|
: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"
|
||||||
|
/>
|
||||||
|
<ProcessOutScanDetail :detail="scanDetail" />
|
||||||
|
|
||||||
|
<ProcessOutDetailList
|
||||||
|
:list="form.item_data"
|
||||||
|
:deletable="canScan"
|
||||||
|
@delete="onDeleteFineCode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FabricOutFooter :buttons="statusActionButtons" @action="handleStatusAction" />
|
||||||
|
|
||||||
|
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import formMixin from './storeGoodsProcessOutMixin.js';
|
||||||
|
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||||
|
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
|
||||||
|
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||||
|
import ProcessOutScanDetail from '@/components/storegoods/ProcessOutScanDetail.vue';
|
||||||
|
import ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
|
||||||
|
import ProcessOutBinBar from '@/components/storegoods/ProcessOutBinBar.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
OrderStatusBar,
|
||||||
|
FabricOutScanBar,
|
||||||
|
FabricOutFooter,
|
||||||
|
ProcessOutScanDetail,
|
||||||
|
ProcessOutDetailList,
|
||||||
|
ProcessOutBinBar,
|
||||||
|
},
|
||||||
|
mixins: [formMixin],
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
260
src/pages/storegoods/storeGoodsProcessOutList.vue
Normal file
260
src/pages/storegoods/storeGoodsProcessOutList.vue
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
<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)">
|
||||||
|
<ProcessOutItem :item="item" :index="index" />
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<addBtn url="./storeGoodsProcessOutAdd"></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="openProcessUnitSelect">
|
||||||
|
<text class="filterLabel">加工单位</text>
|
||||||
|
<view class="filterValue">{{ processUnitLabel || '全部' }} <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 ProcessOutItem from '@/components/card/storeGoodsProcessOutItem.vue';
|
||||||
|
import {
|
||||||
|
getStatusOptions,
|
||||||
|
AUDIT_STATUS_MAP,
|
||||||
|
BUSINESS_UNIT_TYPE_PROCESS,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
formatRoll,
|
||||||
|
mapToSelectOptions,
|
||||||
|
fetchAllOrderList,
|
||||||
|
} from '@/common/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { addBtn, ProcessOutItem },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
scrollHeight: '667px',
|
||||||
|
triggered: false,
|
||||||
|
listLoading: false,
|
||||||
|
filterShow: false,
|
||||||
|
statusSelectShow: false,
|
||||||
|
unitSelectShow: false,
|
||||||
|
unitSelectType: '',
|
||||||
|
processUnitOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
unitOptionsLoading: false,
|
||||||
|
filters: {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_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)] || '';
|
||||||
|
},
|
||||||
|
processUnitLabel() {
|
||||||
|
return this.filters.process_name || '';
|
||||||
|
},
|
||||||
|
warehouseLabel() {
|
||||||
|
return this.filters.warehouse_name || '';
|
||||||
|
},
|
||||||
|
unitSelectList() {
|
||||||
|
const options = this.unitSelectType === 'warehouse' ? this.warehouseOptions : this.processUnitOptions;
|
||||||
|
return [{ value: '', label: '全部' }, ...options];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
uni.setNavigationBarTitle({ title: '加工出仓列表' });
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.loadList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadProcessUnitOptions() {
|
||||||
|
if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS })
|
||||||
|
.then((res) => {
|
||||||
|
this.processUnitOptions = mapToSelectOptions(res);
|
||||||
|
return this.processUnitOptions;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.processUnitOptions = [];
|
||||||
|
return this.processUnitOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
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.loadProcessUnitOptions;
|
||||||
|
loadFn.call(this)
|
||||||
|
.then((list) => {
|
||||||
|
if (!list.length) {
|
||||||
|
uni.showToast({ title: '暂无可选数据', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.unitSelectType = type;
|
||||||
|
this.unitSelectShow = true;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.unitOptionsLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openProcessUnitSelect() {
|
||||||
|
this.openUnitSelect('process');
|
||||||
|
},
|
||||||
|
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.process_unit_id = item.value;
|
||||||
|
this.filters.process_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.process_unit_id) params.process_unit_id = this.filters.process_unit_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.fpmProcessOutOrder.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 || '',
|
||||||
|
process_unit_id: order.process_unit_id || '',
|
||||||
|
process_name: order.process_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) {
|
||||||
|
uni.navigateTo({ url: `./storeGoodsProcessOutView?id=${item.id}` });
|
||||||
|
},
|
||||||
|
openStatusSelect() { this.statusSelectShow = true; },
|
||||||
|
onStatusConfirm(e) { this.filters.audit_status = e[0].value; },
|
||||||
|
resetFilter() {
|
||||||
|
this.filters = {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_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>
|
||||||
542
src/pages/storegoods/storeGoodsProcessOutMixin.js
Normal file
542
src/pages/storegoods/storeGoodsProcessOutMixin.js
Normal file
@ -0,0 +1,542 @@
|
|||||||
|
/**
|
||||||
|
* 加工出仓单表单 mixin(新增/编辑共用)
|
||||||
|
*
|
||||||
|
* 1. 先填表头(加工单位 / 仓库 / 备注)提交 add,拿到 id 后可扫码
|
||||||
|
* 2. 先扫仓位(getWarehouseBin:传 qr_code + warehouse_id),校验后扫布匹二维码
|
||||||
|
* 3. 扫码走 updateFpmProcessOutOrder(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_PROCESS,
|
||||||
|
WAREHOUSE_TYPE_FINISHED,
|
||||||
|
OUT_ORDER_TYPE_PROCESS,
|
||||||
|
normalizeOrder,
|
||||||
|
mapToSelectOptions,
|
||||||
|
canScanAtStatus,
|
||||||
|
isLockedOrderStatus,
|
||||||
|
getFormStatusActionButtons,
|
||||||
|
orderToFormFields,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
DRAFT_AUDIT_STATUS,
|
||||||
|
DRAFT_AUDIT_STATUS_NAME,
|
||||||
|
getEmptyScanDetail,
|
||||||
|
buildScanDetailFromScanResponse,
|
||||||
|
buildScanUpdateParams,
|
||||||
|
pickDefaultWarehouse,
|
||||||
|
formatDisplayTime,
|
||||||
|
} from '@/common/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
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,
|
||||||
|
processUnitOptions: [],
|
||||||
|
warehouseOptions: [],
|
||||||
|
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;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
return Promise.all([
|
||||||
|
this.ensureProcessUnitOptions().catch((e) => {
|
||||||
|
console.error('加载加工单位失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
this.ensureWarehouseOptions().catch((e) => {
|
||||||
|
console.error('加载仓库失败', e);
|
||||||
|
return [];
|
||||||
|
}),
|
||||||
|
]).finally(() => {
|
||||||
|
this.dropdownLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ensureProcessUnitOptions() {
|
||||||
|
if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions);
|
||||||
|
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS })
|
||||||
|
.then((res) => {
|
||||||
|
this.processUnitOptions = mapToSelectOptions(res);
|
||||||
|
return this.processUnitOptions;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
},
|
||||||
|
getEmptyForm() {
|
||||||
|
return {
|
||||||
|
order_no: '',
|
||||||
|
process_unit_id: '',
|
||||||
|
process_name: '',
|
||||||
|
warehouse_id: '',
|
||||||
|
warehouse_name: '',
|
||||||
|
remark: '',
|
||||||
|
item_data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
loadOrder(id, options = {}) {
|
||||||
|
const { rejectIfLocked = false } = options;
|
||||||
|
return this.$u.api.fpmProcessOutOrder.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.ensureProcessUnitOptions()
|
||||||
|
.then(openPicker)
|
||||||
|
.catch((e) => this.showError(e.message || '加载加工单位失败'));
|
||||||
|
} else if (type === '仓库名称') {
|
||||||
|
this.ensureWarehouseOptions()
|
||||||
|
.then(openPicker)
|
||||||
|
.catch((e) => this.showError(e.message || '加载仓库失败'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectConfirmFun(e) {
|
||||||
|
const item = e[0];
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateForm() {
|
||||||
|
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 '缺少营销体系,请重新登录';
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
buildAddParam() {
|
||||||
|
const app = getApp();
|
||||||
|
return {
|
||||||
|
// OpenAPI: product.AddFpmProcessOutOrderParam
|
||||||
|
out_order_type: OUT_ORDER_TYPE_PROCESS, // WarehouseGoodOutTypeProcess = 5
|
||||||
|
process_unit_id: Number(this.form.process_unit_id),
|
||||||
|
warehouse_id: Number(this.form.warehouse_id),
|
||||||
|
sale_system_id: Number(app.globalData.PlanDepartmentID),
|
||||||
|
warehouse_out_time: formatDisplayTime(new Date(), 'YYYY-MM-DD'),
|
||||||
|
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.fpmProcessOutOrder.add(this.buildAddParam())
|
||||||
|
.then((res) => {
|
||||||
|
this.orderId = (res && res.id) || 0;
|
||||||
|
if (!this.orderId) {
|
||||||
|
throw new Error('保存失败,未返回单据ID');
|
||||||
|
}
|
||||||
|
return this.$u.api.fpmProcessOutOrder.detail({ id: this.orderId });
|
||||||
|
})
|
||||||
|
.then((detail) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
const order = normalizeOrder(detail);
|
||||||
|
this.applyOrder(order);
|
||||||
|
this.headerSaved = true;
|
||||||
|
this.clearWarehouseBin();
|
||||||
|
this.syncCanScanFromStatus(order.audit_status);
|
||||||
|
this.showSuccess('保存成功,请先扫描仓位');
|
||||||
|
this.registerOrderScanBroadcast();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
this.showError(e.message || '保存失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
applyOrder(order) {
|
||||||
|
if (!order) return;
|
||||||
|
this.auditStatus = order.audit_status;
|
||||||
|
Object.assign(this.form, orderToFormFields(order));
|
||||||
|
},
|
||||||
|
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.scan_code
|
||||||
|
|| fineCode.digital_code
|
||||||
|
|| fineCode.bar_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;
|
||||||
|
uni.showLoading({ title: isDelete ? '删除中...' : '处理中...' });
|
||||||
|
return this.$u.api.fpmProcessOutOrder.scanUpdate(buildScanUpdateParams({
|
||||||
|
id: this.orderId,
|
||||||
|
scanCode,
|
||||||
|
arrangeType,
|
||||||
|
// 删除不强制仓位;录入带当前仓位
|
||||||
|
warehouseBinId: isDelete ? 0 : this.warehouseBinId,
|
||||||
|
}))
|
||||||
|
.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.fpmProcessOutOrder.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.fpmProcessOutOrder.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' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
129
src/pages/storegoods/storeGoodsProcessOutView.vue
Normal file
129
src/pages/storegoods/storeGoodsProcessOutView.vue
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<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.out_order_type_name || '正常加工出仓单' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-white-plr26 ptb20 bdb_f5">
|
||||||
|
<text class="mr26">加工单位</text>
|
||||||
|
<text>{{ order.process_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">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ProcessOutDetailList
|
||||||
|
:title="detailTitle"
|
||||||
|
:list="order.item_data"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<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 ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
|
||||||
|
import {
|
||||||
|
normalizeOrder,
|
||||||
|
getViewStatusActionButtons,
|
||||||
|
confirmOrderStatusAction,
|
||||||
|
formatDisplayTime,
|
||||||
|
} from '@/common/storeGoodsProcessOut';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { OrderStatusBar, FabricOutFooter, ProcessOutDetailList },
|
||||||
|
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.fpmProcessOutOrder.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: `./storeGoodsProcessOutEdit?id=${this.orderId}` });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
confirmOrderStatusAction(this, {
|
||||||
|
orderId: this.orderId,
|
||||||
|
action,
|
||||||
|
onSuccess: () => this.$u.api.fpmProcessOutOrder.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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -33,6 +33,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="grid-text">加工进仓</view>
|
<view class="grid-text">加工进仓</view>
|
||||||
</u-grid-item>
|
</u-grid-item>
|
||||||
|
<u-grid-item :index="3" @click="navTo('/pages/storegoods/storeGoodsProcessOutList')">
|
||||||
|
<view class="home-icon icon-color05">
|
||||||
|
<i class="iconfont icon-hetongguanli"></i>
|
||||||
|
</view>
|
||||||
|
<view class="grid-text">加工出仓</view>
|
||||||
|
</u-grid-item>
|
||||||
</u-grid>
|
</u-grid>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user