From aaaa63663f58e6170f249a401dbb55a4618fe16a Mon Sep 17 00:00:00 2001
From: aihe <961836564@qq.com>
Date: Wed, 8 May 2024 15:27:30 +0800
Subject: [PATCH] uu
---
components/tpx-text-dic/tpx-text-dic.vue | 10 ++--
components/tpx-text-item/tpx-text-item.vue | 10 ++--
pages/deliveryDeal/arriveDeliveryScanning.vue | 49 ++++++++++++++-----
pages/deliveryDeal/arriveScanning.vue | 29 ++++++++---
pages/deliveryDeal/deliveryScanning.vue | 37 +++++++++++---
pages/deliveryDeal/pickUp.vue | 23 +++++----
pages/deliveryDeal/qutgoingScanning.vue | 31 +++++-------
pages/deliveryDeal/scanUtil.js | 36 ++++++++++++++
8 files changed, 164 insertions(+), 61 deletions(-)
create mode 100644 pages/deliveryDeal/scanUtil.js
diff --git a/components/tpx-text-dic/tpx-text-dic.vue b/components/tpx-text-dic/tpx-text-dic.vue
index 14d2c21..43be7d1 100644
--- a/components/tpx-text-dic/tpx-text-dic.vue
+++ b/components/tpx-text-dic/tpx-text-dic.vue
@@ -7,9 +7,13 @@
computed: {
title() {
let title = this.value
- !this.value && this.list && (title = '-');
- if(this.value && this.list) {
- title = this.list.filter(t=> t.val == this.value || this.value.indexOf(t.val) > -1).map(t=> t.title).join(",")
+ let val = this.value
+ !val && this.list && (title = '-');
+ if(val && this.list) {
+ if(!Array.isArray() && val.split) {
+ val = val.split(",")
+ }
+ title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
}
return title
}
diff --git a/components/tpx-text-item/tpx-text-item.vue b/components/tpx-text-item/tpx-text-item.vue
index abdd529..b7f1208 100644
--- a/components/tpx-text-item/tpx-text-item.vue
+++ b/components/tpx-text-item/tpx-text-item.vue
@@ -22,9 +22,13 @@
computed: {
title() {
let title = this.value
- !this.value && this.list && (title = '请选择');
- if(this.value && this.list) {
- title = this.list.filter(t=> t.val == this.value || this.value.indexOf(t.val) > -1).map(t=> t.title).join(",")
+ let val = this.value
+ !val && this.list && (title = '请选择');
+ if(val && this.list) {
+ if(!Array.isArray() && val.split) {
+ val = val.split(",")
+ }
+ title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
}
return title
}
diff --git a/pages/deliveryDeal/arriveDeliveryScanning.vue b/pages/deliveryDeal/arriveDeliveryScanning.vue
index 42c44d2..57f9d27 100644
--- a/pages/deliveryDeal/arriveDeliveryScanning.vue
+++ b/pages/deliveryDeal/arriveDeliveryScanning.vue
@@ -3,15 +3,15 @@
-
+
-
-
+
@@ -50,10 +50,10 @@
- T2919292
+ {{item.billCode}}
- 12-18 13:18
+ {{item.scanDate}}
@@ -67,7 +67,6 @@
-
diff --git a/pages/deliveryDeal/arriveScanning.vue b/pages/deliveryDeal/arriveScanning.vue
index 624ff26..52ce4d8 100644
--- a/pages/deliveryDeal/arriveScanning.vue
+++ b/pages/deliveryDeal/arriveScanning.vue
@@ -5,7 +5,7 @@
-
@@ -40,10 +40,10 @@
- T2919292
+ {{item.billCode}}
- 12-18 13:18
+ {{item.scanDate}}
@@ -64,6 +64,7 @@
import dayjs from "dayjs"
import BoOperatorTmp from "@/components/buns-order-templates/bo-operator-tmp"
import * as apiService from "@/common/api"
+ import { scanTypeEnum, getScanParams, ansScanResponse } from "./scanUtil"
export default {
components:{ BoOperatorTmp },
props: {
@@ -74,7 +75,9 @@
},
data() {
return {
- orderNo: '',
+ submitParam: {
+ billCode: ''
+ },
pageLoading: true,
queryOption: {
billCode: '', // 运单id
@@ -100,11 +103,25 @@
},
methods: {
initData() {
- this.orderNo = this.queryOption.billCode || this.queryOption.orderSn
+ this.submitParam.billCode = this.queryOption.billCode || this.queryOption.orderSn
+ },
+ async handleSubmit(val) {
+ let extParam = {}
+ val && (extParam.billCode = val);
+ let scnParam = getScanParams(scanTypeEnum.daoJian, { ...this.submitParam, ...extParam })
+ let res = await apiService.scanRecord({...scnParam, _loading: true})
+ let { bl, resItem } = ansScanResponse({ res, title: "到件" })
+ if(bl) {
+ this.resData.list.push({ ...resItem })
+ this.resetForm()
+ }
},
handleScanValChange: debounce(function(val){
- val
+ val && (this.handleSubmit(val))
}),
+ resetForm() {
+ this.submitParam.billCode = ''
+ }
}
}
diff --git a/pages/deliveryDeal/deliveryScanning.vue b/pages/deliveryDeal/deliveryScanning.vue
index b0b2179..1a84bba 100644
--- a/pages/deliveryDeal/deliveryScanning.vue
+++ b/pages/deliveryDeal/deliveryScanning.vue
@@ -3,15 +3,15 @@
-
+
-
-
+
@@ -50,10 +50,10 @@
- T2919292
+ {{item.billCode}}
- 12-18 13:18
+ {{item.scanDate}}
@@ -74,6 +74,8 @@
import dayjs from "dayjs"
import BoOperatorTmp from "@/components/buns-order-templates/bo-operator-tmp"
import * as apiService from "@/common/api"
+ import { scanTypeEnum, getScanParams, ansScanResponse } from "./scanUtil"
+
export default {
components:{ BoOperatorTmp },
props: {
@@ -84,7 +86,11 @@
},
data() {
return {
- orderNo: '',
+ paiRes: { list: [] } ,
+ submitParam: {
+ billCode: '',
+ dispatchOrSendManCode: '',
+ },
pageLoading: true,
queryOption: {
billCode: '', // 运单id
@@ -108,12 +114,27 @@
},
methods: {
+ getRSDStaffList: apiService.getRSDStaffList,
initData() {
- this.orderNo = this.queryOption.billCode || this.queryOption.orderSn
+ this.submitParam.billCode = this.queryOption.billCode || this.queryOption.orderSn
+ },
+ async handleSubmit(val) {
+ let extParam = {}
+ val && (extParam.billCode = val);
+ let scnParam = getScanParams(scanTypeEnum.paiJian, { ...this.submitParam, ...extParam })
+ let res = await apiService.scanRecord({...scnParam, _loading: true})
+ let { bl, resItem } = ansScanResponse({ res, title: "派件" })
+ if(bl) {
+ this.resData.list.push({ ...resItem })
+ this.resetForm()
+ }
},
handleScanValChange: debounce(function(val){
- val
+ val && (this.handleSubmit(val))
}),
+ resetForm() {
+ this.submitParam.billCode = ''
+ }
}
}
diff --git a/pages/deliveryDeal/pickUp.vue b/pages/deliveryDeal/pickUp.vue
index 4ff9781..63f7502 100644
--- a/pages/deliveryDeal/pickUp.vue
+++ b/pages/deliveryDeal/pickUp.vue
@@ -73,6 +73,7 @@
import BoDetailTmp from "@/components/buns-order-templates/bo-detail-tmp"
import BpeGoodsizeTmp from "@/components/buns-post-edit-templates/bpe-goodsize-tmp"
import * as apiService from "@/common/api"
+ import { scanTypeEnum, getScanParams, ansScanResponse } from "./scanUtil"
export default {
components: { BpeAddressjiamiTmp, BpeGooditemEditTmp, BpeGoodphotoTmp, BoDetailTmp, BpeGoodsizeTmp },
@@ -131,17 +132,19 @@
},
async handleLanShou() {
await apiService.submitOrder({...this.submitParam, _loading: true})
- let scnParam = {
- scanType: 10, // 揽收
- opType: 2,
- scanData: [{
- billCode: this.submitParam.billCode,
- dispatchOrSendManCode: this.submitParam.dispatchOrSendManCode,
- scanDate: dayjs().format("YYYY-MM-DD HH:mm:ss")
- }]
+ let scnParam = getScanParams(scanTypeEnum.lanShou, {
+ billCode: this.submitParam.billCode,
+ dispatchOrSendManCode: this.submitParam.dispatchOrSendManCode,
+ })
+ let res = await apiService.scanRecord({...scnParam, _loading: true})
+ let { bl, resItem } = ansScanResponse({ res, title: "揽收" })
+ if(bl) {
+ this.resetForm()
}
- await apiService.scanRecord({...scnParam, _loading: true})
- this.showToast('揽收成功')
+ },
+ resetForm() {
+ this.submitParam = {}
+ this.orderNo = ''
}
}
}
diff --git a/pages/deliveryDeal/qutgoingScanning.vue b/pages/deliveryDeal/qutgoingScanning.vue
index e9e8adf..6efb629 100644
--- a/pages/deliveryDeal/qutgoingScanning.vue
+++ b/pages/deliveryDeal/qutgoingScanning.vue
@@ -71,6 +71,8 @@
import dayjs from "dayjs"
import BoOperatorTmp from "@/components/buns-order-templates/bo-operator-tmp"
import * as apiService from "@/common/api"
+ import { scanTypeEnum, getScanParams, ansScanResponse } from "./scanUtil"
+
export default {
components:{ BoOperatorTmp },
props: {
@@ -115,29 +117,22 @@
this.submitParam.billCode = this.queryOption.billCode || this.queryOption.orderSn
},
async handleSubmit(val) {
- this.submitParam.scanDate = dayjs().format("YYYY-MM-DD HH:mm:ss")
- let scnParam = {
- scanType: 20, // 发件
- opType: 2,
- scanData: [{
- ...this.submitParam
- }]
- }
- val && (scnParam.billCode = val);
+ let extParam = {}
+ val && (extParam.billCode = val);
+ let scnParam = getScanParams(scanTypeEnum.faJian, { ...this.submitParam, ...extParam })
let res = await apiService.scanRecord({...scnParam, _loading: true})
- let result = res?.data?.scanResult?.[0]?.result
- if(result == "success") {
- this.resData.list.push({
- ...this.submitParam
- })
- this.showToast('发件成功')
- } else {
- this.showToast(res?.data?.scanResult?.[0]?.message || '发件失败')
+ let { bl, resItem } = ansScanResponse({ res, title: "发件" })
+ if(bl) {
+ this.resData.list.push({ ...resItem })
+ this.resetForm()
}
},
handleScanValChange: debounce(function(val){
- this.handleSubmit(val)
+ val && (this.handleSubmit(val))
}),
+ resetForm() {
+ this.submitParam.billCode = ''
+ }
}
}
diff --git a/pages/deliveryDeal/scanUtil.js b/pages/deliveryDeal/scanUtil.js
new file mode 100644
index 0000000..dbb632d
--- /dev/null
+++ b/pages/deliveryDeal/scanUtil.js
@@ -0,0 +1,36 @@
+import dayjs from "dayjs"
+import { showToast } from "@/common/untool"
+
+export const scanTypeEnum = {
+ lanShou: 10, // 揽收
+ faJian: 20, // 发件
+ daoJian: 30, // 到件
+ paiJian: 40, // 派件
+}
+
+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] || {}
+ let result = resItem?.result
+ let bl = false
+ if(result == "success") {
+ bl = true
+ title && showToast(`${title}成功`)
+ } else {
+ this.showToast(res?.data?.scanResult?.[0]?.message || `${title}失败`)
+ }
+ return {
+ bl,
+ resItem,
+ }
+}
\ No newline at end of file