emis-app/common/scanUtil.js
2024-06-12 23:41:48 +08:00

46 lines
1.0 KiB
JavaScript

import dayjs from "dayjs"
import { showToast } from "@/common/untool"
export const scanTypeEnum = {
lanShou: 10, // 揽收
faJian: 20, // 发件
daoJian: 30, // 到件
paiJian: 40, // 派件
qianShou: 50, // 签收
zhuangChe: 301, // 装车、装柜、整车
xieChe: 302, // 卸车
liuCang: 70, // 留仓
zhuanJian: 80, // 转件
heBao: 200, // 合包
chaiBao: 201, // 拆包
qingGuan: 800, // 清关
baoGUan: 700, // 报关
}
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] || {}
resItem.data && ( Object.assign(resItem, { ...resItem.data }) )
let result = resItem?.result
let bl = false
if(result == "success") {
bl = true
title && showToast(`${title}成功`)
} else {
showToast(resItem?.message || `${title}失败`)
}
return {
bl,
resItem,
}
}