emis-sapp/common/scanUtil.js
2024-05-31 18:42:15 +08:00

45 lines
975 B
JavaScript

import dayjs from "dayjs"
import { showToast } from "@/common/untool"
export const scanTypeEnum = {
lanShou: 10, // 揽收
faJian: 20, // 发件
daoJian: 30, // 到件
paiJian: 40, // 派件
qianShou: 50, // 签收
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,
}
}