// 盘点-任务状态 // 任务状态 1.未开始,2.进行中,3.已完成,4.已取消 export const taskStatusList = [ { value: "", name: "全部任务", name2: "", className: "", }, { value: 1, name: "待盘点", name2: "未开始", className: "tips-red", }, { value: 2, name: "盘点中", name2: "进行中", className: "tips-green", }, { value: 3, name: "已盘点", name2: "已完成", className: "tips-hui", }, { value: 4, name: "已取消", name2: "已取消", className: "tips-yellow", }, ]; export function getTaskStatusInfoByVal(val) { const target = taskStatusList.find((item) => item.value === val); return target || {}; } export const taskTypeList = [ { value: 1, name: "全盘", }, { value: 2, name: "抽盘", }, ]; export function getTaskTypeInfoByVal(val) { const target = taskTypeList.find((item) => item.value === val); return target || {}; } // 盘点状态 商品盘点类型:1.未盘,2.盘盈,3.盘亏 4.无差异 其余为全部 export const goodsInventoryStatus = [ { name: "未盘", value: 1, }, { name: "盘盈", value: 2, }, { name: "盘亏", value: 3, }, { name: "无差异", value: 4, }, ]; export function getGoodsInventoryStatusInfoByVal(val) { const target = goodsInventoryStatus.find((item) => item.value === val); return target || {}; } /** * @des 前端计算系统库存、已盘库存数量 获取盘点状态信息 * @parms inventory 系统库存 * @parms newInventory 系统库存 */ export function getGoodsInventoryStatusInfo(inventory, newInventory) { const goodsInventoryStatus = [ { label: "去盘点", value: "1", }, { label: "盘盈", value: "2", }, { label: "盘亏", value: "3", }, { label: "无差异", value: "4", }, ]; let val; const a = inventory || 0; // 系统库存 const b = newInventory || 0; // 已盘库存 const diffVal = Number(a) - Number(b); if (b === 0) { val = "1"; } else if (diffVal === 0 && a !== 0) { val = "4"; } else if (diffVal > 0) { val = "3"; } else { val = "2"; } const target = goodsInventoryStatus.find((item) => item.value === val); if (target) { return { ...target, inventory: a, newInventory: b, }; } return { inventory: a, newInventory: b, }; }