This commit is contained in:
aihe 2024-06-15 23:17:03 +08:00
parent e736a46267
commit 422aa69500
6 changed files with 79 additions and 30 deletions

View File

@ -156,4 +156,9 @@ export const registerProblemInfo = (data = {})=> {
export const queryScanWaybillList = (data = {})=> { export const queryScanWaybillList = (data = {})=> {
return coreRequest(url.queryScanWaybillList, data, {}, "GET") return coreRequest(url.queryScanWaybillList, data, {}, "GET")
} }
// 运单附件上传
export const uploadWaybillAttach = (data = {})=> {
return coreRequest(url.uploadWaybillAttach, data, {})
}

View File

@ -51,5 +51,7 @@ export default {
queryProblemTypeList: `/emis/emisProblemType/listSimple`, // 问题件类型列表 queryProblemTypeList: `/emis/emisProblemType/listSimple`, // 问题件类型列表
registerProblemInfo: `/emis/emisWaybillProblemInfo/registerProblemInfo`, // 问题件登记 registerProblemInfo: `/emis/emisWaybillProblemInfo/registerProblemInfo`, // 问题件登记
queryScanWaybillList: `/emis/emisWaybill/queryScanWaybillList`, // 1-发件清单 2-到件清单 3-派件清单 queryScanWaybillList: `/emis/emisWaybill/queryScanWaybillList`, // 1-发件清单 2-到件清单 3-派件清单
uploadWaybillAttach: `/emis/emisWaybillAttachment/uploadWaybillAttach`, // 运单附件上传
} }

View File

@ -1,6 +1,7 @@
import dayjs from "dayjs" import dayjs from "dayjs"
import { showToast, playAudio } from "@/common/untool" import { showToast, playAudio } from "@/common/untool"
import { audioTypeEnum } from "@/common/enum" import { audioTypeEnum } from "@/common/enum"
import * as apiService from "@/common/api"
export const scanTypeEnum = { export const scanTypeEnum = {
lanShou: 10, // 揽收 lanShou: 10, // 揽收
@ -18,15 +19,16 @@ export const scanTypeEnum = {
baoGUan: 700, // 报关 baoGUan: 700, // 报关
} }
export const getScanParams = (type, model = {})=> { export const getScanParams = (type, model = {}, extModel = {})=> {
let scanDate = dayjs().format("YYYY-MM-DD HH:mm:ss") let scanDate = dayjs().format("YYYY-MM-DD HH:mm:ss")
return { return {
scanType: type, // 扫描类型 scanType: type, // 扫描类型
opType: model._opType || 2, // 动作, 1 检查; 2 确认 opType: 2, // 动作, 1 检查; 2 确认
scanData: [{ scanData: [{
scanDate, scanDate,
...model, ...model,
}] }],
...extModel,
} }
} }
@ -59,4 +61,33 @@ export const ansScanResponse = ({ res, title })=> {
bl, bl,
resItem, resItem,
} }
}
// 扫描预检-- 接口
export const preCheckScan = async ({ param, extParam, list, scanType })=> {
let scnParam = getScanParams(scanType, { ...param }, { ...(extParam || {}), opType: 1 })
let res = await apiService.scanRecord({...scnParam, _loading: true})
let { bl, resItem } = ansScanResponse({ res })
if(bl) {
// 更新list
if(list) {
let existItem = list.filter(t=> t.billCode == resItem.billCode)[0]
if(existItem?.billCode) {
bl = false // 已扫描, list已存在
playAudio(audioTypeEnum.repetitive)
showToast('重复扫描')
} else {
list.unshift({ ...resItem })
}
}
}
return bl
}
// 扫描确认-- 接口
export const confirmScanUpload = async ({ param, extParam, list, scanType })=> {
let scnParam = getScanParams(scanType, { ...param }, { ...(extParam || {}) })
let res = await apiService.scanRecord({...scnParam, _loading: true})
let { bl, resItem } = ansScanResponse({ res })
return bl
} }

View File

@ -56,7 +56,7 @@
import { debounce } from "@/common/util" import { debounce } from "@/common/util"
import dayjs from "dayjs" import dayjs from "dayjs"
import * as apiService from "@/common/api" import * as apiService from "@/common/api"
import { scanTypeEnum, getScanParams, ansScanResponse } from "@/common/scanUtil" import { scanTypeEnum, getScanParams, ansScanResponse, preCheckScan } from "@/common/scanUtil"
import { checkParams } from "@/common/validate" import { checkParams } from "@/common/validate"
export default { export default {
@ -106,9 +106,9 @@
this.submitParam.billCode = this.queryOption.billCode || this.queryOption.orderSn this.submitParam.billCode = this.queryOption.billCode || this.queryOption.orderSn
}, },
handleScanValChange: debounce(async function(val){ handleScanValChange: debounce(async function(val){
let scnParam = getScanParams(scanTypeEnum.qianShou, { ...this.submitParam, _opType: 1 }) if(val) {
let res = await apiService.scanRecord({...scnParam, _loading: true}) let preBl = await preCheckScan({ scanType: scanTypeEnum.qianShou, param: { ...this.submitParam, billCode: val } })
let { bl, resItem } = ansScanResponse({ res }) }
}), }),
async handleSubmit() { async handleSubmit() {
await checkParams(this.submitParam, this.submitValidConfig) await checkParams(this.submitParam, this.submitValidConfig)

View File

@ -12,7 +12,7 @@
</u-row> </u-row>
<view class="mt-20"> <view class="mt-20">
<bpe-goodphoto-tmp title="照片" :value="submitParam" filedName="picUrl"></bpe-goodphoto-tmp> <bpe-goodphoto-tmp title="照片" :value="submitParam" filedName="fileUrl"></bpe-goodphoto-tmp>
</view> </view>
</view> </view>
@ -38,12 +38,19 @@
import { scanTypeEnum, getScanParams, ansScanResponse } from "@/common/scanUtil" import { scanTypeEnum, getScanParams, ansScanResponse } from "@/common/scanUtil"
import { checkParams } from "@/common/validate" import { checkParams } from "@/common/validate"
// attachType: 0-商品图片 1-寄件图片 2-签收图片 3-清关文件
const pageTypeMap = { const pageTypeMap = {
'1': { '1': {
title: '货物图片', title: '货物图片',
extData: {
attachType: 0
},
}, },
'2': { '2': {
title: '签收图片', title: '签收图片',
extData: {
attachType: 2
},
} }
} }
@ -65,10 +72,10 @@
curPageType: {}, curPageType: {},
submitParam: { submitParam: {
billCode: "", billCode: "",
picUrl: '', fileUrl: [],
}, },
submitValidConfig: { submitValidConfig: {
picUrl: { required: true, requiredMsg: '图片不能为空' }, fileUrl: { required: true, requiredMsg: '图片不能为空' },
// dispatchOrSendManCode: { required: true, requiredMsg: '请选择派件员' }, // dispatchOrSendManCode: { required: true, requiredMsg: '请选择派件员' },
billCode: { required: true, requiredMsg: '运单号不能为空' }, billCode: { required: true, requiredMsg: '运单号不能为空' },
}, },
@ -98,17 +105,18 @@
}), }),
async handleSubmit() { async handleSubmit() {
await checkParams(this.submitParam, this.submitValidConfig) await checkParams(this.submitParam, this.submitValidConfig)
this.submitParam.picUrl = this.submitParam.picUrl?.join?.(",") || '' let extParams = {
let scnParam = getScanParams(scanTypeEnum.qianShou, { ...this.submitParam }) ...this.curPageType.extData
let res = await apiService.scanRecord({...scnParam, _loading: true})
let { bl, resItem } = ansScanResponse({ res, title: "操作" })
if(bl) {
this.resetForm()
} }
extParams.fileUrl = this.submitParam.fileUrl?.join?.(",") || ''
await apiService.uploadWaybillAttach({ ...this.submitParam, ...extParams, _loading: true })
this.showToast('操作成功')
this.resetForm()
}, },
resetForm() { resetForm() {
this.submitParam = { this.submitParam = {
picUrl: '' fileUrl: [],
billCode: ''
} }
} }
} }

View File

@ -25,7 +25,7 @@
</view> </view>
</u-row> </u-row>
<u-button custom-style="height:74rpx;font-size: 28rpx;margin-top: 30rpx;" type="primary">合包完成</u-button> <u-button @click="handleSubmit" custom-style="height:74rpx;font-size: 28rpx;margin-top: 30rpx;" type="primary">合包完成</u-button>
</view> </view>
<view class="blcok-white-noradius"> <view class="blcok-white-noradius">
@ -59,7 +59,7 @@
import BoOperatorTmp from "@/components/buns-order-templates/bo-operator-tmp" import BoOperatorTmp from "@/components/buns-order-templates/bo-operator-tmp"
import BoScanlistTmp from "@/components/buns-order-templates/bo-scanlist-tmp" import BoScanlistTmp from "@/components/buns-order-templates/bo-scanlist-tmp"
import * as apiService from "@/common/api" import * as apiService from "@/common/api"
import { scanTypeEnum, getScanParams, ansScanResponse } from "@/common/scanUtil" import { scanTypeEnum, getScanParams, ansScanResponse, preCheckScan, confirmScanUpload } from "@/common/scanUtil"
import { checkParams } from "@/common/validate" import { checkParams } from "@/common/validate"
export default { export default {
@ -111,21 +111,24 @@
async handleCreatePaNo() { async handleCreatePaNo() {
}, },
async handleSubmit(val) { async handleSubmit() {
let extParam = {} let extParam = {}
val && (extParam.billCode = val); let param = JSON.parse(JSON.stringify(this.submitParam))
await checkParams(this.submitParam, this.submitValidConfig) param.billCode = this.resData.list.map(t=>t.billCode).join(",")
let scnParam = getScanParams(scanTypeEnum.heBao, { ...this.submitParam, ...extParam }) await checkParams(param, this.submitValidConfig)
let res = await apiService.scanRecord({...scnParam, _loading: true}) let scCfBl = await confirmScanUpload({ scanType: scanTypeEnum.heBao, param, list: this.resData.list })
let { bl, resItem } = ansScanResponse({ res, title: "合包" }) if(scCfBl) {
if(bl) { this.showToast('合包操作成功')
this.curScanItem = resItem
this.resData.list.unshift({ ...resItem })
this.resetForm() this.resetForm()
} }
}, },
handleScanValChange: debounce(function(val){ handleScanValChange: debounce(async function(val){
if(val) {
let preBl = await preCheckScan({ scanType: scanTypeEnum.heBao, param: { ...this.submitParam, billCode: val }, list: this.resData.list })
if(preBl) {
// this.submitParam.billCode = ''
}
}
}), }),
resetForm() { resetForm() {
this.submitParam.billCode = '' this.submitParam.billCode = ''