feat: 新增采购退货出仓并升至1.1.22
This commit is contained in:
+16
-1
@@ -29,6 +29,9 @@ const install = (Vue, vm) => {
|
||||
const FPM_PRC_IN_PREFIX = '/product/fpmPrcInOrder/';
|
||||
const fpmPrcInUrl = (name) => getApiUrl() + FPM_PRC_IN_PREFIX + name;
|
||||
|
||||
const FPM_PRT_OUT_PREFIX = '/product/fpmPrtOutOrder/';
|
||||
const fpmPrtOutUrl = (name) => getApiUrl() + FPM_PRT_OUT_PREFIX + name;
|
||||
|
||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||
vm.$u.api = {
|
||||
|
||||
@@ -109,6 +112,18 @@ const install = (Vue, vm) => {
|
||||
statusCancel: (params = {}) => vm.$u.putJson(fpmPrcInUrl('updateFpmPrcInOrderStatusCancel'), params),
|
||||
},
|
||||
|
||||
// 成品采购退货出仓单
|
||||
fpmPrtOutOrder: {
|
||||
list: (params = {}) => vm.$u.get(fpmPrtOutUrl('getFpmPrtOutOrderList'), params),
|
||||
detail: (params = {}) => vm.$u.get(fpmPrtOutUrl('getFpmPrtOutOrder'), params),
|
||||
add: (params = {}) => vm.$u.postJson(fpmPrtOutUrl('addFpmPrtOutOrder'), params),
|
||||
scanUpdate: (params = {}) => vm.$u.putJson(fpmPrtOutUrl('updateFpmPrtOutOrder'), params),
|
||||
statusPass: (params = {}) => vm.$u.putJson(fpmPrtOutUrl('updateFpmPrtOutOrderStatusPass'), params),
|
||||
statusWait: (params = {}) => vm.$u.putJson(fpmPrtOutUrl('updateFpmPrtOutOrderStatusWait'), params),
|
||||
statusReject: (params = {}) => vm.$u.putJson(fpmPrtOutUrl('updateFpmPrtOutOrderStatusReject'), params),
|
||||
statusCancel: (params = {}) => vm.$u.putJson(fpmPrtOutUrl('updateFpmPrtOutOrderStatusCancel'), params),
|
||||
},
|
||||
|
||||
// 物理仓库下拉
|
||||
physicalWarehouse: {
|
||||
getDropdownList: (params = {}) => vm.$u.get('/warehouse/physicalWarehouse/getPhysicalWarehouseDropdownList', params),
|
||||
@@ -142,7 +157,7 @@ const install = (Vue, vm) => {
|
||||
// PDA登录接口
|
||||
pdaLogin: (params = {}) => vm.$u.postJson('/login', params),
|
||||
pdaLogout: (params = {}) => vm.$u.postJson('/logout', params),
|
||||
// 修改密码:PUT pda/v1/user/updatePassword
|
||||
// 修改密码:PUT pda/v1/user/updatePassword(system.UpdateUserPasswordParam: password, user_id)
|
||||
updatePassword: (params = {}) => vm.$u.putJson('/user/updatePassword', params),
|
||||
// 登录后获取当前用户信息、菜单与按钮权限
|
||||
pdaGetInformation: (params = {}) => vm.$u.get('/information', params),
|
||||
|
||||
@@ -1,14 +1,37 @@
|
||||
@import '@/common/pda-typography.scss';
|
||||
|
||||
page { background-color: #F8F8F8; }
|
||||
.filterBar { display: flex; align-items: center; padding: 16rpx 20rpx; background: #fff; gap: 16rpx; }
|
||||
.filterBar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 20rpx;
|
||||
background: #fff;
|
||||
gap: 16rpx;
|
||||
}
|
||||
/* 列表顶栏搜索框统一放大(覆盖 u-search 默认 64rpx) */
|
||||
.filterBar ::v-deep .u-search {
|
||||
flex: 1;
|
||||
}
|
||||
.filterBar ::v-deep .u-content {
|
||||
height: $pda-row-min-height !important;
|
||||
}
|
||||
.filterBar ::v-deep .u-input {
|
||||
font-size: $pda-font-body !important;
|
||||
}
|
||||
.filterBar ::v-deep .u-placeholder-class {
|
||||
font-size: $pda-font-placeholder !important;
|
||||
}
|
||||
.filterBar ::v-deep .u-icon-wrap .u-icon,
|
||||
.filterBar ::v-deep .u-clear-icon {
|
||||
font-size: 40rpx !important;
|
||||
}
|
||||
.filterBtn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 88rpx;
|
||||
min-height: 76rpx;
|
||||
min-width: 96rpx;
|
||||
min-height: $pda-row-min-height;
|
||||
padding: 8rpx 10rpx;
|
||||
border: 2rpx solid transparent;
|
||||
border-radius: 12rpx;
|
||||
@@ -62,10 +85,10 @@ page { background-color: #F8F8F8; }
|
||||
.filterInput {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: $pda-row-min-height;
|
||||
padding: 0 18rpx;
|
||||
min-height: 112rpx;
|
||||
padding: 0 22rpx;
|
||||
background: #f5f6f8;
|
||||
border-radius: 8rpx;
|
||||
border-radius: 12rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
::v-deep .filterInput .u-input__input {
|
||||
@@ -80,10 +103,10 @@ page { background-color: #F8F8F8; }
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: $pda-row-min-height;
|
||||
padding: 0 18rpx;
|
||||
min-height: 112rpx;
|
||||
padding: 0 22rpx;
|
||||
background: #f5f6f8;
|
||||
border-radius: 8rpx;
|
||||
border-radius: 12rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: $pda-font-body;
|
||||
color: #202328;
|
||||
|
||||
@@ -0,0 +1,429 @@
|
||||
/**
|
||||
* 成品采购退货出仓单常量与数据工具
|
||||
*
|
||||
* 真实接口请求统一注册在 src/common/http.api.js 的 vm.$u.api.fpmPrtOutOrder 下。
|
||||
*/
|
||||
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 function toAuditStatus(status) {
|
||||
const n = Number(status);
|
||||
return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS;
|
||||
}
|
||||
|
||||
export const AUDIT_STATUS_MAP = {
|
||||
1: '待审核',
|
||||
2: '已审核',
|
||||
3: '已驳回',
|
||||
4: '已作废',
|
||||
};
|
||||
|
||||
/** 操作类型:1录入 3删除 */
|
||||
export const ARRANGE_TYPE = {
|
||||
IN: 1,
|
||||
DEL: 3,
|
||||
};
|
||||
|
||||
/** 出仓类型:采购退货出仓单 WarehouseGoodOutTypePurchaseReturn = 4 */
|
||||
export const OUT_ORDER_TYPE_PURCHASE_RETURN = 4;
|
||||
export const OUT_ORDER_TYPE_PURCHASE_RETURN_NAME = '采购退货出仓单';
|
||||
|
||||
/** 订单类型: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 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 { mapToSelectOptions } from '@/common/remoteSelect';
|
||||
|
||||
/** 匹数:后端 ×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;
|
||||
const outType = order.out_order_type || OUT_ORDER_TYPE_PURCHASE_RETURN;
|
||||
return {
|
||||
id: order.id,
|
||||
order_no: order.order_no || '',
|
||||
audit_status: toAuditStatus(order.audit_status),
|
||||
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[toAuditStatus(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] || '',
|
||||
out_order_type: outType,
|
||||
out_order_type_name: order.out_order_type_name
|
||||
|| order.in_order_type_name
|
||||
|| OUT_ORDER_TYPE_PURCHASE_RETURN_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 || 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) : '',
|
||||
extern_volume_number: fc.extern_volume_number != null && fc.extern_volume_number !== ''
|
||||
? String(fc.extern_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 || '',
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeItem(item) {
|
||||
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: '',
|
||||
extern_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) : '',
|
||||
extern_volume_number: res.extern_volume_number != null && res.extern_volume_number !== ''
|
||||
? String(res.extern_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),
|
||||
};
|
||||
}
|
||||
|
||||
/** 构建扫码请求参数(OpenAPI: PDAUpdateFpmPrtOutOrderParam) */
|
||||
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 > 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) {
|
||||
const s = toAuditStatus(status);
|
||||
return s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED;
|
||||
}
|
||||
|
||||
export function isLockedOrderStatus(status) {
|
||||
const s = toAuditStatus(status);
|
||||
return s === AUDIT_STATUS.APPROVED || s === AUDIT_STATUS.VOIDED;
|
||||
}
|
||||
|
||||
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;
|
||||
if (batch.length > pageSize) return acc.concat(batch);
|
||||
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) return [];
|
||||
const s = toAuditStatus(status);
|
||||
if (s === AUDIT_STATUS.APPROVED) {
|
||||
return [{ label: '消审', action: 'unapprove' }];
|
||||
}
|
||||
if (!canScanAtStatus(s)) return [];
|
||||
return [
|
||||
{ label: '审核', action: 'approve' },
|
||||
{ label: '作废', action: 'void' },
|
||||
];
|
||||
}
|
||||
|
||||
export function getViewStatusActionButtons(status) {
|
||||
const s = toAuditStatus(status);
|
||||
if (s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED) {
|
||||
return [
|
||||
{ label: '编辑', action: 'edit' },
|
||||
{ label: '审核', action: 'approve' },
|
||||
{ label: '作废', action: 'void' },
|
||||
];
|
||||
}
|
||||
if (s === 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] || '',
|
||||
out_order_type: order.out_order_type || OUT_ORDER_TYPE_PURCHASE_RETURN,
|
||||
out_order_type_name: order.out_order_type_name || OUT_ORDER_TYPE_PURCHASE_RETURN_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.fpmPrtOutOrder;
|
||||
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 || '操作失败');
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<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/storeGoodsPurchaseReturnOut';
|
||||
|
||||
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 lang="scss">
|
||||
@import '@/common/status-tag.scss';
|
||||
|
||||
.cardTopName {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
overflow: visible;
|
||||
white-space: normal;
|
||||
}
|
||||
</style>
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name" : "浩拓ERP",
|
||||
"appid" : "__UNI__F79F300",
|
||||
"description" : "浩拓ERP",
|
||||
"versionName" : "1.1.21",
|
||||
"versionCode" : 121,
|
||||
"versionName" : "1.1.22",
|
||||
"versionCode" : 122,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"optimization" : {
|
||||
|
||||
@@ -480,6 +480,34 @@
|
||||
"navigationBarTitleText": "采购进仓单详情",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsPurchaseReturnOutList",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "成品采购退货出仓",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsPurchaseReturnOutAdd",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "新增采购退货出仓单",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsPurchaseReturnOutEdit",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "编辑采购退货出仓单",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsPurchaseReturnOutView",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "查看采购退货出仓单",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},{
|
||||
"path" : "pages/storegoods/storeGoodsProcessReturnInList",
|
||||
"style" :
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<view class="fabric-out-page">
|
||||
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no || '保存后自动生成'">
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||
<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 @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>
|
||||
</OrderHeaderFold>
|
||||
|
||||
<PlusBarcodePanel
|
||||
:visible.sync="phoneScanPanelOpen"
|
||||
hint-text="连续扫码退货出仓,扫完可继续下一条"
|
||||
:scan-time-space="1200"
|
||||
@success="onPlusBarcodeSuccess"
|
||||
/>
|
||||
<FabricOutScanBar
|
||||
:can-scan="showQrScanBar"
|
||||
:value="QRBarCode"
|
||||
:delete-mode="BarCodeDelStatus"
|
||||
:message="BillDataMessage"
|
||||
:disabled-tip="qrDisabledTip"
|
||||
:show-phone-scan="canScanQr"
|
||||
:scanning="phoneScanPanelOpen"
|
||||
@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" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import formMixin from './storeGoodsPurchaseReturnOutMixin.js';
|
||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.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 PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
PlusBarcodePanel,
|
||||
OrderStatusBar,
|
||||
OrderHeaderFold,
|
||||
FabricOutScanBar,
|
||||
FabricOutFooter,
|
||||
ProcessOutScanDetail,
|
||||
ProcessOutDetailList,
|
||||
},
|
||||
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>
|
||||
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<view class="fabric-out-page">
|
||||
<OrderHeaderFold v-model="headerCollapsed" :summary="form.order_no">
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />
|
||||
<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 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>
|
||||
</OrderHeaderFold>
|
||||
|
||||
<PlusBarcodePanel
|
||||
:visible.sync="phoneScanPanelOpen"
|
||||
hint-text="连续扫码退货出仓,扫完可继续下一条"
|
||||
:scan-time-space="1200"
|
||||
@success="onPlusBarcodeSuccess"
|
||||
/>
|
||||
<FabricOutScanBar
|
||||
:can-scan="showQrScanBar"
|
||||
:value="QRBarCode"
|
||||
:delete-mode="BarCodeDelStatus"
|
||||
:message="BillDataMessage"
|
||||
:disabled-tip="qrDisabledTip"
|
||||
:show-phone-scan="canScanQr"
|
||||
:scanning="phoneScanPanelOpen"
|
||||
@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" :remote="isRemoteSelect" :loading="selectSearching" @search="onSelectSearch" @confirm="selectConfirmFun"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import formMixin from './storeGoodsPurchaseReturnOutMixin.js';
|
||||
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
|
||||
import OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.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 PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
PlusBarcodePanel,
|
||||
OrderStatusBar,
|
||||
OrderHeaderFold,
|
||||
FabricOutScanBar,
|
||||
FabricOutFooter,
|
||||
ProcessOutScanDetail,
|
||||
ProcessOutDetailList,
|
||||
},
|
||||
mixins: [formMixin],
|
||||
data() {
|
||||
return {
|
||||
headerCollapsed: true,
|
||||
};
|
||||
},
|
||||
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>
|
||||
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="filterBar">
|
||||
<u-search v-model="filters.order_no" placeholder="出仓单号" :show-action="false" @search="applySearch" @custom="applySearch" @clear="applySearch" />
|
||||
<view class="filterBtn" :class="{ 'filter-active': hasActiveFilter }" @click="filterShow = true">
|
||||
<view class="filterBtn__icon">
|
||||
<u-icon :key="filterIconColor" name="list" size="44" :color="filterIconColor"></u-icon>
|
||||
<view v-if="hasActiveFilter" class="filterBtn__badge"></view>
|
||||
</view>
|
||||
<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)">
|
||||
<PurchaseReturnOutItem :item="item" :index="index" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<addBtn url="./storeGoodsPurchaseReturnOutAdd"></addBtn>
|
||||
|
||||
<u-popup v-model="filterShow" mode="right" width="580rpx" :safe-area-inset-bottom="true" @close="cancelFilterEdit">
|
||||
<view class="filterPanel">
|
||||
<view class="filterTitle">筛选条件</view>
|
||||
<view class="filterItem">
|
||||
<text class="filterLabel">出仓单号</text>
|
||||
<view class="filterInput">
|
||||
<u-input v-model="filters.order_no" placeholder="请输入出仓单号" :height="100" :custom-style="{ fontSize: '36rpx', color: '#202328' }" placeholder-style="color: #aeb4bf; font-size: 34rpx;" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="filterItem" @click="openSupplierSelect">
|
||||
<text class="filterLabel">供应商</text>
|
||||
<view class="filterValue">{{ supplierLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||
</view>
|
||||
<view class="filterItem" @click="openWarehouseSelect">
|
||||
<text class="filterLabel">仓库</text>
|
||||
<view class="filterValue">{{ warehouseLabel || '全部' }} <u-icon name="arrow-right" size="36"></u-icon></view>
|
||||
</view>
|
||||
<view class="filterItem" @click="openStatusSelect">
|
||||
<text class="filterLabel">订单状态</text>
|
||||
<view class="filterValue">{{ statusLabel || '全部' }} <u-icon name="arrow-right" size="36"></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 class="pdaSelect" v-model="statusSelectShow" title="选择订单状态" :list="statusSelectList" :default-value="statusSelectDefault" @confirm="onStatusConfirm"></u-select>
|
||||
<u-select class="pdaSelect" v-model="unitSelectShow" :list="unitSelectList" :default-value="unitSelectDefault" remote :loading="selectSearching" @search="onUnitSearch" @confirm="onUnitConfirm"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addBtn from '@/components/addBtn/addBtn.vue';
|
||||
import PurchaseReturnOutItem from '@/components/card/storeGoodsPurchaseReturnOutItem.vue';
|
||||
import {
|
||||
getStatusOptions,
|
||||
AUDIT_STATUS,
|
||||
AUDIT_STATUS_MAP,
|
||||
BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER,
|
||||
WAREHOUSE_TYPE_FINISHED,
|
||||
formatRoll,
|
||||
mapToSelectOptions,
|
||||
fetchAllOrderList,
|
||||
} from '@/common/storeGoodsPurchaseReturnOut';
|
||||
import { withNameParam } from '@/common/remoteSelect';
|
||||
import listFilterMixin from '@/mixins/listFilterMixin';
|
||||
|
||||
export default {
|
||||
components: { addBtn, PurchaseReturnOutItem },
|
||||
mixins: [listFilterMixin],
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
scrollHeight: '667px',
|
||||
triggered: false,
|
||||
listLoading: false,
|
||||
filterShow: false,
|
||||
statusSelectShow: false,
|
||||
unitSelectShow: false,
|
||||
unitSelectType: '',
|
||||
supplierOptions: [],
|
||||
warehouseOptions: [],
|
||||
unitOptionsLoading: false,
|
||||
selectSearching: false,
|
||||
unitSearchSeq: 0,
|
||||
unitSelectList: [{ value: '', label: '全部' }],
|
||||
filterStorageKey: 'storeGoodsPurchaseReturnOutListFilters_v1',
|
||||
filters: {
|
||||
order_no: '',
|
||||
supplier_id: '',
|
||||
supplier_name: '',
|
||||
warehouse_id: '',
|
||||
warehouse_name: '',
|
||||
audit_status: AUDIT_STATUS.PENDING,
|
||||
},
|
||||
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 || '';
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
uni.setNavigationBarTitle({ title: '成品采购退货出仓' });
|
||||
this.restoreFilterCache();
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||
},
|
||||
});
|
||||
},
|
||||
onShow() {
|
||||
this.loadList();
|
||||
},
|
||||
methods: {
|
||||
createDefaultFilters() {
|
||||
return {
|
||||
order_no: '',
|
||||
supplier_id: '',
|
||||
supplier_name: '',
|
||||
warehouse_id: '',
|
||||
warehouse_name: '',
|
||||
audit_status: AUDIT_STATUS.PENDING,
|
||||
};
|
||||
},
|
||||
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) {
|
||||
this.unitSelectType = type;
|
||||
const cache = type === 'warehouse' ? this.warehouseOptions : this.supplierOptions;
|
||||
this.applyUnitSelectList(cache);
|
||||
this.unitSelectShow = true;
|
||||
},
|
||||
onUnitSearch(keyword) {
|
||||
const seq = ++this.unitSearchSeq;
|
||||
const type = this.unitSelectType;
|
||||
const empty = !String(keyword || '').trim();
|
||||
this.selectSearching = true;
|
||||
const req = type === 'warehouse'
|
||||
? this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||
: this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER }, keyword));
|
||||
req.then((res) => {
|
||||
if (seq !== this.unitSearchSeq) return;
|
||||
const list = mapToSelectOptions(res);
|
||||
if (empty) {
|
||||
if (type === 'warehouse') this.warehouseOptions = list;
|
||||
else this.supplierOptions = list;
|
||||
}
|
||||
this.applyUnitSelectList(list, empty);
|
||||
}).catch((e) => {
|
||||
if (seq !== this.unitSearchSeq) return;
|
||||
uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' });
|
||||
}).then(() => {
|
||||
if (seq === this.unitSearchSeq) this.selectSearching = false;
|
||||
}, () => {
|
||||
if (seq === this.unitSearchSeq) this.selectSearching = 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 filters = this.appliedFilters || this.filters;
|
||||
const params = {};
|
||||
if (filters.order_no) params.order_no = filters.order_no;
|
||||
if (filters.supplier_id) params.supplier_id = filters.supplier_id;
|
||||
if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id;
|
||||
if (this.hasFilterValue(filters.audit_status)) {
|
||||
params.audit_status = filters.audit_status;
|
||||
}
|
||||
fetchAllOrderList((p) => this.$u.api.fpmPrtOutOrder.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;
|
||||
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
|
||||
? 'storeGoodsPurchaseReturnOutEdit'
|
||||
: 'storeGoodsPurchaseReturnOutView';
|
||||
uni.navigateTo({ url: `./${page}?id=${item.id}` });
|
||||
},
|
||||
openStatusSelect() { this.statusSelectShow = true; },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/common/list-filter.scss';
|
||||
</style>
|
||||
@@ -0,0 +1,542 @@
|
||||
/**
|
||||
* 成品采购退货出仓单表单 mixin(新增/编辑共用)
|
||||
*
|
||||
* 1. 先填表头(供应商 / 仓库 / 营销体系 / 订单类型 / 备注)提交 add,拿到 id 后可扫码
|
||||
* 2. 扫码走 updateFpmPrtOutOrder(arrange_type: 1 录入 / 3 删除),不强制扫仓位
|
||||
* 3. 手机扫码成功展示详情后自动再次调起扫码,形成连续扫
|
||||
*/
|
||||
import util from '@/common/util';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
import PlusBarcodePanel from '@/components/common/PlusBarcodePanel.vue';
|
||||
import remoteSelectMixin from '@/common/remoteSelectMixin.js';
|
||||
import { withNameParam } from '@/common/remoteSelect';
|
||||
import { initTts, speak } from '@/common/tts.js';
|
||||
import {
|
||||
AUDIT_STATUS_MAP,
|
||||
ARRANGE_TYPE,
|
||||
BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER,
|
||||
WAREHOUSE_TYPE_FINISHED,
|
||||
OUT_ORDER_TYPE_PURCHASE_RETURN,
|
||||
OUT_ORDER_TYPE_PURCHASE_RETURN_NAME,
|
||||
SALE_MODE,
|
||||
SALE_MODE_MAP,
|
||||
SALE_MODE_OPTIONS,
|
||||
normalizeOrder,
|
||||
mapToSelectOptions,
|
||||
canScanAtStatus,
|
||||
isLockedOrderStatus,
|
||||
getFormStatusActionButtons,
|
||||
orderToFormFields,
|
||||
confirmOrderStatusAction,
|
||||
DRAFT_AUDIT_STATUS,
|
||||
DRAFT_AUDIT_STATUS_NAME,
|
||||
getEmptyScanDetail,
|
||||
buildScanDetailFromScanResponse,
|
||||
buildScanUpdateParams,
|
||||
pickDefaultWarehouse,
|
||||
formatDisplayTime,
|
||||
} from '@/common/storeGoodsPurchaseReturnOut';
|
||||
|
||||
export default {
|
||||
components: { PlusBarcodePanel },
|
||||
mixins: [scanMixin, remoteSelectMixin],
|
||||
data() {
|
||||
return {
|
||||
pageMode: 'add',
|
||||
orderId: 0,
|
||||
form: this.getEmptyForm(),
|
||||
headerSaved: false,
|
||||
headerCollapsed: false,
|
||||
selectShow: false,
|
||||
selectList: [],
|
||||
selectType: '',
|
||||
canScan: false,
|
||||
QRBarCode: '',
|
||||
BarCodeDelStatus: false,
|
||||
BillDataMessage: '',
|
||||
scanDetail: getEmptyScanDetail(),
|
||||
auditStatus: 0,
|
||||
supplierOptions: [],
|
||||
warehouseOptions: [],
|
||||
saleSystemOptions: [],
|
||||
saleModeOptions: SALE_MODE_OPTIONS,
|
||||
dropdownLoading: false,
|
||||
/** 手机连续扫码开关:成功后自动再调起;取消/失败则关闭 */
|
||||
phoneContinuousScan: false,
|
||||
};
|
||||
},
|
||||
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() {
|
||||
return this.canScan;
|
||||
},
|
||||
showQrScanBar() {
|
||||
return this.canScan;
|
||||
},
|
||||
qrDisabledTip() {
|
||||
if (!this.canScan) 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: {
|
||||
handlePhoneScan() {
|
||||
if (!this.canScan || !this.orderId) {
|
||||
this.showError('请先提交保存后再扫码');
|
||||
return;
|
||||
}
|
||||
this.phoneContinuousScan = false;
|
||||
this.togglePhoneScanPanel();
|
||||
},
|
||||
onPlusBarcodeSuccess(scanResult) {
|
||||
this.QRBarCode = String(scanResult || '').trim().replace(/[\r\n]/g, '');
|
||||
this.$nextTick(() => this.handleScan());
|
||||
},
|
||||
openContinuousPhoneScan() {
|
||||
if (this.phoneScanPanelOpen) return;
|
||||
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.phoneScanPanelOpen) return;
|
||||
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;
|
||||
this.QRBarCode = code;
|
||||
this.$nextTick(() => this.handleScan());
|
||||
});
|
||||
},
|
||||
syncCanScanFromStatus(status) {
|
||||
const nextCanScan = this.isEditable && canScanAtStatus(status);
|
||||
if (this.canScan && !nextCanScan) {
|
||||
this.phoneContinuousScan = false;
|
||||
this.closePhoneScanPanel();
|
||||
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;
|
||||
});
|
||||
},
|
||||
fetchRemoteSelectOptions(type, keyword) {
|
||||
const empty = !String(keyword || '').trim();
|
||||
if (type === '供应商') {
|
||||
return this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER }, keyword))
|
||||
.then((res) => {
|
||||
const list = mapToSelectOptions(res);
|
||||
if (empty) this.supplierOptions = list;
|
||||
return list;
|
||||
});
|
||||
}
|
||||
if (type === '仓库名称') {
|
||||
return this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||
.then((res) => {
|
||||
const list = mapToSelectOptions(res);
|
||||
if (empty) this.warehouseOptions = list;
|
||||
return list;
|
||||
});
|
||||
}
|
||||
if (type === '营销体系') {
|
||||
return this.$u.api.saleSystem.getDropdownList(withNameParam({}, keyword))
|
||||
.then((res) => {
|
||||
const list = mapToSelectOptions(res);
|
||||
if (empty) this.saleSystemOptions = list;
|
||||
return list;
|
||||
});
|
||||
}
|
||||
return Promise.resolve([]);
|
||||
},
|
||||
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],
|
||||
out_order_type: OUT_ORDER_TYPE_PURCHASE_RETURN,
|
||||
out_order_type_name: OUT_ORDER_TYPE_PURCHASE_RETURN_NAME,
|
||||
remark: '',
|
||||
item_data: [],
|
||||
};
|
||||
},
|
||||
loadOrder(id, options = {}) {
|
||||
const { rejectIfLocked = false } = options;
|
||||
return this.$u.api.fpmPrtOutOrder.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.headerCollapsed = true;
|
||||
this.form = orderToFormFields(order);
|
||||
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;
|
||||
if (type === '订单类型') {
|
||||
this.selectType = type;
|
||||
if (!this.saleModeOptions.length) {
|
||||
this.showError('暂无可选数据');
|
||||
return;
|
||||
}
|
||||
this.selectList = this.saleModeOptions;
|
||||
this.selectShow = true;
|
||||
return;
|
||||
}
|
||||
const cache = {
|
||||
'供应商': this.supplierOptions,
|
||||
'仓库名称': this.warehouseOptions,
|
||||
'营销体系': this.saleSystemOptions,
|
||||
};
|
||||
if (cache[type]) this.openSelectPicker(type, cache[type]);
|
||||
},
|
||||
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 {
|
||||
// OpenAPI: product.AddFpmOutOrderParam
|
||||
outOrderType: OUT_ORDER_TYPE_PURCHASE_RETURN,
|
||||
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),
|
||||
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.fpmPrtOutOrder.add(this.buildAddParam())
|
||||
.then((res) => {
|
||||
this.orderId = (res && res.id) || 0;
|
||||
if (!this.orderId) {
|
||||
throw new Error('保存失败,未返回单据ID');
|
||||
}
|
||||
return this.$u.api.fpmPrtOutOrder.detail({ id: this.orderId });
|
||||
})
|
||||
.then((detail) => {
|
||||
uni.hideLoading();
|
||||
const order = normalizeOrder(detail);
|
||||
this.applyOrder(order);
|
||||
this.headerSaved = true;
|
||||
this.headerCollapsed = true;
|
||||
this.syncCanScanFromStatus(order.audit_status);
|
||||
this.showSuccess('保存成功,请开始扫码', '保存成功', { voiceOnly: true });
|
||||
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;
|
||||
}
|
||||
if (!code) {
|
||||
this.QRBarCode = '';
|
||||
if (fromPhone) this.scheduleNextPhoneScan();
|
||||
return;
|
||||
}
|
||||
const arrangeType = this.BarCodeDelStatus ? 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.fpmPrtOutOrder.scanUpdate(buildScanUpdateParams({
|
||||
id: this.orderId,
|
||||
scanCode,
|
||||
arrangeType,
|
||||
}))
|
||||
.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.fpmPrtOutOrder.detail({ id: this.orderId })
|
||||
.then((detail) => {
|
||||
const order = normalizeOrder(detail);
|
||||
if (order) {
|
||||
this.form.item_data = order.item_data;
|
||||
this.auditStatus = order.audit_status;
|
||||
this.scanDetail = {
|
||||
...this.scanDetail,
|
||||
order_roll: order.total_roll,
|
||||
order_weight: order.total_weight,
|
||||
};
|
||||
}
|
||||
})
|
||||
.catch(() => null);
|
||||
})
|
||||
.then(() => {
|
||||
uni.hideLoading();
|
||||
if (fromPhone) this.scheduleNextPhoneScan();
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.hideLoading();
|
||||
this.phoneContinuousScan = false;
|
||||
const message = e.message || (isDelete ? '删除失败' : '扫码失败');
|
||||
speak(isDelete ? '删除失败' : '扫码失败');
|
||||
uni.showToast({ title: message, icon: 'none', duration: 2500 });
|
||||
this.QRBarCode = '';
|
||||
});
|
||||
},
|
||||
handleStatusAction(action) {
|
||||
confirmOrderStatusAction(this, {
|
||||
orderId: this.orderId,
|
||||
action,
|
||||
onSuccess: () => this.$u.api.fpmPrtOutOrder.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(util.statusSuccessVoice(action));
|
||||
}),
|
||||
});
|
||||
},
|
||||
showError(message) {
|
||||
util.playErrorAudio(message);
|
||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||
},
|
||||
showSuccess(message, voiceText, options) {
|
||||
util.playSuccessAudio(voiceText || message, options);
|
||||
uni.showToast({ title: message, icon: 'success' });
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<view class="fabric-out-page">
|
||||
<OrderHeaderFold v-model="headerCollapsed" :summary="order.order_no">
|
||||
<OrderStatusBar class="fabric-out-mt32" :status="order.audit_status" :name="order.audit_status_name" />
|
||||
<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">
|
||||
<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>
|
||||
</OrderHeaderFold>
|
||||
|
||||
<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 OrderHeaderFold from '@/components/storefabric/OrderHeaderFold.vue';
|
||||
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
|
||||
import ProcessOutDetailList from '@/components/storegoods/ProcessOutDetailList.vue';
|
||||
import {
|
||||
normalizeOrder,
|
||||
getViewStatusActionButtons,
|
||||
confirmOrderStatusAction,
|
||||
formatDisplayTime,
|
||||
} from '@/common/storeGoodsPurchaseReturnOut';
|
||||
|
||||
export default {
|
||||
components: { OrderStatusBar, OrderHeaderFold, FabricOutFooter, ProcessOutDetailList },
|
||||
data() {
|
||||
return {
|
||||
orderId: 0,
|
||||
headerCollapsed: true,
|
||||
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.fpmPrtOutOrder.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: `./storeGoodsPurchaseReturnOutEdit?id=${this.orderId}` });
|
||||
return;
|
||||
}
|
||||
confirmOrderStatusAction(this, {
|
||||
orderId: this.orderId,
|
||||
action,
|
||||
onSuccess: () => {
|
||||
uni.hideLoading();
|
||||
const voice = util.statusSuccessVoice(action);
|
||||
util.playSuccessAudio(voice);
|
||||
uni.showToast({ title: voice, icon: 'success' });
|
||||
if (action === 'unapprove') {
|
||||
uni.redirectTo({ url: `./storeGoodsPurchaseReturnOutEdit?id=${this.orderId}` });
|
||||
return;
|
||||
}
|
||||
return this.$u.api.fpmPrtOutOrder.detail({ id: this.orderId })
|
||||
.then((res) => {
|
||||
const order = normalizeOrder(res);
|
||||
if (order) this.order = order;
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
showError(message) {
|
||||
util.playErrorAudio(message);
|
||||
uni.showModal({ title: '提示', content: message, showCancel: false });
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
|
||||
page {
|
||||
background-color: #F8F8F8;
|
||||
padding-bottom: 260rpx;
|
||||
}
|
||||
</style>
|
||||
+25
-46
@@ -3,19 +3,10 @@
|
||||
<view class="remind-text">请设置登录密码<br>
|
||||
定期更新密码提高安全性</view>
|
||||
<u-form class="form" :model="model" :rules="rules" ref="uForm">
|
||||
<u-form-item label="旧密码" prop="oldPassword" label-width="180">
|
||||
<u-input type="password" v-model="model.oldPassword" placeholder="请输入旧密码"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="新密码" prop="newPassword" label-width="180">
|
||||
<u-input type="password" v-model="model.newPassword" placeholder="请输入新密码"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="确认密码" prop="confirmPassword" label-width="180">
|
||||
<u-input type="password" v-model="model.confirmPassword" placeholder="请确认新密码"></u-input>
|
||||
<u-form-item label="密码" prop="password" label-width="180">
|
||||
<u-input type="password" v-model="model.password" placeholder="请输入密码"></u-input>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<view class="remind-text">
|
||||
<u-icon name="question-circle" color="#2767dc" size="28"></u-icon>
|
||||
密码必须是8-16位的数字,字符组合(不能是纯数字)</view>
|
||||
<view class="form-footer">
|
||||
<u-button class="btn" type="primary" @click="submit">提交</u-button>
|
||||
<!-- <u-button class="btn" type="default" @click="cancel">关闭</u-button> -->
|
||||
@@ -26,46 +17,19 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
|
||||
*/
|
||||
import base64 from '@/common/base64.js';
|
||||
import { getUserInformation, getLoginData } from '@/common/userSession.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
model: {
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
password: ''
|
||||
},
|
||||
rules: {
|
||||
oldPassword: [
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入旧密码',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
newPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入新密码',
|
||||
trigger: ['change','blur'],
|
||||
},
|
||||
{
|
||||
pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\S{5,12}$/,
|
||||
message: '需同时含有字母和数字,长度在6-12之间',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
confirmPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '请重新输入密码',
|
||||
trigger: ['change','blur'],
|
||||
},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
return value === this.model.newPassword;
|
||||
},
|
||||
message: '两次输入的密码不相等',
|
||||
message: '请输入密码',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
@@ -76,18 +40,33 @@ export default {
|
||||
this.$refs.uForm.setRules(this.rules);
|
||||
},
|
||||
methods: {
|
||||
getCurrentUserId() {
|
||||
const info = getUserInformation();
|
||||
if (info && info.user_id != null) return Number(info.user_id);
|
||||
const login = getLoginData();
|
||||
if (login && login.user_id != null) return Number(login.user_id);
|
||||
const app = getApp();
|
||||
const loginId = app && app.globalData ? app.globalData.LoginID : 0;
|
||||
return Number(loginId || 0);
|
||||
},
|
||||
submit() {
|
||||
this.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
const userId = this.getCurrentUserId();
|
||||
if (!userId) {
|
||||
this.$u.toast('缺少用户信息,请重新登录');
|
||||
return;
|
||||
}
|
||||
// OpenAPI: system.UpdateUserPasswordParam
|
||||
this.$u.api.updatePassword({
|
||||
old_password: this.model.oldPassword,
|
||||
new_password: this.model.newPassword
|
||||
password: this.model.password,
|
||||
user_id: userId,
|
||||
}).then(() => {
|
||||
const saved = uni.getStorageSync('UserInfo');
|
||||
if (saved && typeof saved === 'object') {
|
||||
uni.setStorageSync('UserInfo', {
|
||||
...saved,
|
||||
password: this.model.newPassword
|
||||
password: this.model.password
|
||||
});
|
||||
}
|
||||
uni.showModal({
|
||||
|
||||
@@ -117,6 +117,15 @@ export default {
|
||||
router: 'FinishPurchaseWarehouseEntry',
|
||||
icon: 'icon-hetongguanli',
|
||||
color: 'icon-color03'
|
||||
},
|
||||
{
|
||||
name: '采购退货出仓',
|
||||
subtitle: 'PURCHASE RETURN OUT',
|
||||
backgroundImage: '/static/workbench/processing-out.png',
|
||||
url: '/pages/storegoods/storeGoodsPurchaseReturnOutList',
|
||||
router: 'FpPurchaseReturnDeliverGodown',
|
||||
icon: 'icon-hetongguanli',
|
||||
color: 'icon-color05'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user