emis-app/common/scanUtil.js

44 lines
927 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
liuCang: 70, // 签收
zhuanJian: 80, // 转件
2024-05-30 10:33:54 +00:00
qingGuan: 20, // 清关
baoGUan: 20, // 报关
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,
}
}