From 422aa6950080ecce597c926a4d37e866fb2242b6 Mon Sep 17 00:00:00 2001 From: aihe <961836564@qq.com> Date: Sat, 15 Jun 2024 23:17:03 +0800 Subject: [PATCH] uu --- common/api/order.js | 5 ++++ common/api/url.js | 2 ++ common/scanUtil.js | 37 ++++++++++++++++++++++++--- pages/deliveryDeal/signedScanning.vue | 8 +++--- pages/post/updateBillPicture.vue | 28 ++++++++++++-------- pages/tms/coPackingScanning.vue | 29 +++++++++++---------- 6 files changed, 79 insertions(+), 30 deletions(-) diff --git a/common/api/order.js b/common/api/order.js index 38d243c..6c48a31 100644 --- a/common/api/order.js +++ b/common/api/order.js @@ -156,4 +156,9 @@ export const registerProblemInfo = (data = {})=> { export const queryScanWaybillList = (data = {})=> { return coreRequest(url.queryScanWaybillList, data, {}, "GET") } + +// 运单附件上传 +export const uploadWaybillAttach = (data = {})=> { + return coreRequest(url.uploadWaybillAttach, data, {}) +} \ No newline at end of file diff --git a/common/api/url.js b/common/api/url.js index 1d40df7..90d45ba 100644 --- a/common/api/url.js +++ b/common/api/url.js @@ -51,5 +51,7 @@ export default { queryProblemTypeList: `/emis/emisProblemType/listSimple`, // 问题件类型列表 registerProblemInfo: `/emis/emisWaybillProblemInfo/registerProblemInfo`, // 问题件登记 queryScanWaybillList: `/emis/emisWaybill/queryScanWaybillList`, // 1-发件清单 2-到件清单 3-派件清单 + uploadWaybillAttach: `/emis/emisWaybillAttachment/uploadWaybillAttach`, // 运单附件上传 + } diff --git a/common/scanUtil.js b/common/scanUtil.js index e74b54e..2aa56c7 100644 --- a/common/scanUtil.js +++ b/common/scanUtil.js @@ -1,6 +1,7 @@ import dayjs from "dayjs" import { showToast, playAudio } from "@/common/untool" import { audioTypeEnum } from "@/common/enum" +import * as apiService from "@/common/api" export const scanTypeEnum = { lanShou: 10, // 揽收 @@ -18,15 +19,16 @@ export const scanTypeEnum = { baoGUan: 700, // 报关 } -export const getScanParams = (type, model = {})=> { +export const getScanParams = (type, model = {}, extModel = {})=> { let scanDate = dayjs().format("YYYY-MM-DD HH:mm:ss") return { scanType: type, // 扫描类型 - opType: model._opType || 2, // 动作, 1 检查; 2 确认 + opType: 2, // 动作, 1 检查; 2 确认 scanData: [{ scanDate, ...model, - }] + }], + ...extModel, } } @@ -59,4 +61,33 @@ export const ansScanResponse = ({ res, title })=> { bl, 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 } \ No newline at end of file diff --git a/pages/deliveryDeal/signedScanning.vue b/pages/deliveryDeal/signedScanning.vue index 2621cd9..4ee54ca 100644 --- a/pages/deliveryDeal/signedScanning.vue +++ b/pages/deliveryDeal/signedScanning.vue @@ -56,7 +56,7 @@ import { debounce } from "@/common/util" import dayjs from "dayjs" 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" export default { @@ -106,9 +106,9 @@ this.submitParam.billCode = this.queryOption.billCode || this.queryOption.orderSn }, handleScanValChange: debounce(async function(val){ - let scnParam = getScanParams(scanTypeEnum.qianShou, { ...this.submitParam, _opType: 1 }) - let res = await apiService.scanRecord({...scnParam, _loading: true}) - let { bl, resItem } = ansScanResponse({ res }) + if(val) { + let preBl = await preCheckScan({ scanType: scanTypeEnum.qianShou, param: { ...this.submitParam, billCode: val } }) + } }), async handleSubmit() { await checkParams(this.submitParam, this.submitValidConfig) diff --git a/pages/post/updateBillPicture.vue b/pages/post/updateBillPicture.vue index f2e6e6d..1090299 100644 --- a/pages/post/updateBillPicture.vue +++ b/pages/post/updateBillPicture.vue @@ -12,7 +12,7 @@ - + @@ -38,12 +38,19 @@ import { scanTypeEnum, getScanParams, ansScanResponse } from "@/common/scanUtil" import { checkParams } from "@/common/validate" + // attachType: 0-商品图片 1-寄件图片 2-签收图片 3-清关文件 const pageTypeMap = { '1': { title: '货物图片', + extData: { + attachType: 0 + }, }, '2': { title: '签收图片', + extData: { + attachType: 2 + }, } } @@ -65,10 +72,10 @@ curPageType: {}, submitParam: { billCode: "", - picUrl: '', + fileUrl: [], }, submitValidConfig: { - picUrl: { required: true, requiredMsg: '图片不能为空' }, + fileUrl: { required: true, requiredMsg: '图片不能为空' }, // dispatchOrSendManCode: { required: true, requiredMsg: '请选择派件员' }, billCode: { required: true, requiredMsg: '运单号不能为空' }, }, @@ -98,17 +105,18 @@ }), async handleSubmit() { await checkParams(this.submitParam, this.submitValidConfig) - this.submitParam.picUrl = this.submitParam.picUrl?.join?.(",") || '' - let scnParam = getScanParams(scanTypeEnum.qianShou, { ...this.submitParam }) - let res = await apiService.scanRecord({...scnParam, _loading: true}) - let { bl, resItem } = ansScanResponse({ res, title: "操作" }) - if(bl) { - this.resetForm() + let extParams = { + ...this.curPageType.extData } + extParams.fileUrl = this.submitParam.fileUrl?.join?.(",") || '' + await apiService.uploadWaybillAttach({ ...this.submitParam, ...extParams, _loading: true }) + this.showToast('操作成功') + this.resetForm() }, resetForm() { this.submitParam = { - picUrl: '' + fileUrl: [], + billCode: '' } } } diff --git a/pages/tms/coPackingScanning.vue b/pages/tms/coPackingScanning.vue index 5bd7a0f..0220809 100644 --- a/pages/tms/coPackingScanning.vue +++ b/pages/tms/coPackingScanning.vue @@ -25,7 +25,7 @@ - 合包完成 + 合包完成 @@ -59,7 +59,7 @@ import BoOperatorTmp from "@/components/buns-order-templates/bo-operator-tmp" import BoScanlistTmp from "@/components/buns-order-templates/bo-scanlist-tmp" 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" export default { @@ -111,21 +111,24 @@ async handleCreatePaNo() { }, - async handleSubmit(val) { + async handleSubmit() { let extParam = {} - val && (extParam.billCode = val); - await checkParams(this.submitParam, this.submitValidConfig) - let scnParam = getScanParams(scanTypeEnum.heBao, { ...this.submitParam, ...extParam }) - let res = await apiService.scanRecord({...scnParam, _loading: true}) - let { bl, resItem } = ansScanResponse({ res, title: "合包" }) - if(bl) { - this.curScanItem = resItem - this.resData.list.unshift({ ...resItem }) + let param = JSON.parse(JSON.stringify(this.submitParam)) + param.billCode = this.resData.list.map(t=>t.billCode).join(",") + await checkParams(param, this.submitValidConfig) + let scCfBl = await confirmScanUpload({ scanType: scanTypeEnum.heBao, param, list: this.resData.list }) + if(scCfBl) { + this.showToast('合包操作成功') 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() { this.submitParam.billCode = ''