emis-app/common/scanUtil.js

45 lines
975 B
JavaScript
Raw Normal View History

2024-05-08 07:27:30 +00:00
import dayjs from "dayjs"
import { showToast } from "@/common/untool"
export const scanTypeEnum = {
lanShou: 10, // 揽收
faJian: 20, // 发件
daoJian: 30, // 到件
paiJian: 40, // 派件
2024-05-08 07:51:44 +00:00
qianShou: 50, // 签收
2024-05-30 10:19:13 +00:00
2024-05-30 10:49:05 +00:00
liuCang: 70, // 留仓
2024-05-30 10:19:13 +00:00
zhuanJian: 80, // 转件
2024-05-30 11:24:27 +00:00
heBao: 200, // 合包
chaiBao: 201, // 拆包
2024-05-30 10:49:05 +00:00
qingGuan: 800, // 清关
baoGUan: 700, // 报关
2024-05-08 07:27:30 +00:00
}
export const getScanParams = (type, model = {})=> {
return {
scanType: type, // 扫描类型
opType: 2, // 确认 动作
scanData: [{
...model,
scanDate: dayjs().format("YYYY-MM-DD HH:mm:ss")
}]
}
}
export const ansScanResponse = ({ res, title })=> {
let resItem = res?.data?.scanResult?.[0] || {}
2024-05-10 01:25:24 +00:00
resItem.data && ( Object.assign(resItem, { ...resItem.data }) )
2024-05-08 07:27:30 +00:00
let result = resItem?.result
let bl = false
if(result == "success") {
bl = true
title && showToast(`${title}成功`)
} else {
2024-05-08 09:39:40 +00:00
showToast(resItem?.message || `${title}失败`)
2024-05-08 07:27:30 +00:00
}
return {
bl,
resItem,
}
}