From 29211f6a3754b947fea7fbd13808ef722ee140c5 Mon Sep 17 00:00:00 2001 From: zhangdi <1104545947@qq.com> Date: Fri, 27 Mar 2026 15:22:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/logistics/delivery.vue | 40 ++++---- pages/logistics/packaging.vue | 166 ++++++++++++++++++++++++++-------- 2 files changed, 147 insertions(+), 59 deletions(-) diff --git a/pages/logistics/delivery.vue b/pages/logistics/delivery.vue index bd93f97..214ffa1 100644 --- a/pages/logistics/delivery.vue +++ b/pages/logistics/delivery.vue @@ -18,9 +18,9 @@ @@ -63,10 +63,9 @@ range-key="name" :value="endCenterIndex" @change="handleEndChange" - :disabled="!boxData" class="uni-input-border" > - + {{ endCenter || "请选择终点" }} @@ -78,14 +77,12 @@ - 箱 {{ boxData.boxBarcode }} 明细 + 箱 {{ boxData.boxBarcode }} 明细 @@ -130,7 +127,7 @@ export default { ST002: { stationCode: "ST002", stationName: "A区暂存点" }, }, workCenters: [], - yieldOrderList:[],//订单明细 + yieldOrderList: [], //订单明细 }; }, computed: { @@ -147,13 +144,14 @@ export default { }, methods: { // 获取订单明细 - detailsFn(){ + detailsFn() { this.showDetails = true; - this.$u.api.boxbarcodeDetails({boxBarcode:this.boxData.boxBarcode}).then(res=>{ - console.log(9999,res.data) - this.yieldOrderList = res.data.yieldOrderList - - }) + this.$u.api + .boxbarcodeDetails({ boxBarcode: this.boxData.boxBarcode }) + .then((res) => { + console.log(9999, res.data); + this.yieldOrderList = res.data.yieldOrderList; + }); }, handleBoxConfirm() { const code = this.boxCode.trim(); @@ -217,17 +215,20 @@ export default { }, handleSubmit() { + uni.showLoading({ + title: "提交中...", + }); let query_ = { - boxBarcode: this.boxData.boxBarcode, //箱条码 + boxBarcode: this.boxBarcode||'', //箱条码 startStationCode: this.startData.stationCode, //开始站点 endWcId: this.endCenterIndex, //终点作业中心 }; this.$u.api.boxBindingTesk(query_).then((res) => { - console.log(89898989898, res.data); uni.showToast({ title: `成功配送至 ${this.endCenter}!`, icon: "success", }); + uni.hideLoading() this.boxCode = ""; this.boxData = null; @@ -236,8 +237,9 @@ export default { this.endCenter = ""; this.boxInputFocus = true; this.startInputFocus = false; - }); - + }).catch(err=>{ + uni.hideLoading() + }) }, }, }; diff --git a/pages/logistics/packaging.vue b/pages/logistics/packaging.vue index 6f5b5cb..d729d92 100644 --- a/pages/logistics/packaging.vue +++ b/pages/logistics/packaging.vue @@ -16,7 +16,6 @@ @confirm="handleBoxConfirm" placeholder="物料箱条码" class="uni-input-border" - confirm-type="done" :focus="boxInputFocus" /> @@ -51,7 +50,6 @@ placeholder="流程卡号" class="uni-input-border" :class="{ 'input-disabled': !activeBox }" - confirm-type="done" :focus="cardInputFocus" /> @@ -79,7 +77,10 @@ class="order-card" :class="{ 'order-latest': index === 0 }" > - 最新 + + + + {{ order.woOrder }}订单号 {{ order.cardNo }} @@ -133,62 +134,111 @@ export default { }, }, methods: { + // 删除订单 + handleDeleteOrder(order, index) { + uni.showModal({ + title: "确认删除", + content: `确定要删除流程卡 ${order.cardNo} 吗?`, + success: (res) => { + if (res.confirm) { + this.boxInfo.yieldOrderList.splice(index, 1); + uni.showToast({ + title: "删除成功", + icon: "success", + }); + } + }, + }); + }, // 扫描物料箱条码 handleBoxConfirm() { const code = this.boxCode.trim(); if (!code) return; + uni.showLoading({ + title: "查询中...", + }); + + this.boxInfo = { + yieldOrderList: [], + }; this.$u.api .boxbarcodeDetails({ boxBarcode: this.boxCode }) .then((res) => { this.boxInfo = res.data; + if (res.data.yieldOrderList == null) { + this.boxInfo.yieldOrderList = []; + } + uni.hideLoading(); + this.activeBox = code; + // 加载已有数据,如果没有则为空箱 + uni.showToast({ + title: `物料箱 ${code} 已就绪`, + icon: "success", + }); + this.boxCode = ""; + this.$nextTick(() => { + this.boxInputFocus = false; + this.cardInputFocus = true; + }); }); - this.activeBox = code; - // 加载已有数据,如果没有则为空箱 - uni.showToast({ - title: `物料箱 ${code} 已就绪`, - icon: "success", - }); - this.boxCode = ""; - this.boxInputFocus = false; - this.cardInputFocus = true; }, handleCardConfirm() { - const code = this.cardCode.trim(); - if (!code) return; + // const code = this.cardCode.trim(); + // if (!code) return; + if (this.cardCode) { + if (!this.activeBox) { + uni.showToast({ + title: "请先扫描物料箱条码", + icon: "none", + }); + this.$nextTick(() => { + this.boxInputFocus = true; + }); - if (!this.activeBox) { - uni.showToast({ - title: "请先扫描物料箱条码", - icon: "none", - }); - this.boxInputFocus = true; - return; - } - if (this.boxInfo.yieldOrderList.some((o) => o.cardNo === this.cardCode)) { - uni.showToast({ - title: `订单 ${this.cardCode} 已在该箱中!`, - icon: "none", - }); - this.cardCode = ""; - return; - } - this.$u.api.queryCardNo({ cardNo: this.cardCode }).then((res) => { - this.boxInfo.yieldOrderList.push(res.data); - if (!res.data.cardNo) { + return; + } + if ( + this.boxInfo.yieldOrderList.some((o) => o.cardNo === this.cardCode) + ) { uni.showToast({ - title: `流程卡 ${code} 不存在或未称重`, + title: `订单 ${this.cardCode} 已在该箱中!`, icon: "none", }); this.cardCode = ""; + this.cardInputFocus = false; + this.$nextTick(() => { + this.cardInputFocus = true; + }); return; } - uni.showToast({ - title: `流程卡 ${code} 装箱成功`, - icon: "success", + uni.showLoading({ + title: "查询中...", }); - this.cardCode = ""; - }); + this.$u.api + .queryCardNo({ cardNo: this.cardCode }) + .then((res) => { + uni.hideLoading(); + this.boxInfo.yieldOrderList.push(res.data); + uni.showToast({ + title: `流程卡 ${code} 装箱成功`, + icon: "success", + }); + this.cardCode = ""; + this.cardInputFocus = false; + this.$nextTick(() => { + this.cardInputFocus = true; + }); + }) + .catch((err) => { + uni.hideLoading(); + this.cardCode = ""; + this.cardInputFocus = false; + this.$nextTick(() => { + this.cardInputFocus = true; + }); + }); + } }, handleResetBox() { @@ -197,21 +247,30 @@ export default { this.orders = []; this.boxInputFocus = true; this.cardInputFocus = false; + this.boxInfo.yieldOrderList = []; }, // 装箱确认 handleSubmit() { + uni.showLoading({ + title: "提交中...", + }); + this.$u.api .boxBinding({ boxBarcode: this.activeBox, //箱条码 orderIdList: this.boxInfo.yieldOrderList.map((o) => o.cardNo), }) .then((res) => { + uni.hideLoading(); uni.showToast({ title: `装箱成功`, icon: "success", }); this.cardCode = ""; this.boxInfo.yieldOrderList = []; + }) + .catch((err) => { + uni.hideLoading(); }); }, }, @@ -322,7 +381,7 @@ export default { } .order-latest { - border-color: #fb923c; + /* border-color: #fb923c; */ box-shadow: 0 0 0 2rpx rgba(251, 146, 60, 0.2); } @@ -435,4 +494,31 @@ export default { .submit-btn.disabled { opacity: 0.5; } +/* 在 style scoped 中添加 */ +.delete-btn { + position: absolute; + top: -20rpx; + right: 0rpx; + width: 40rpx; + height: 40rpx; + background-color: #ff4444; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + z-index: 10; + box-shadow: 0 2rpx 8rpx rgba(255, 68, 68, 0.3); +} + +.delete-icon { + color: #ffffff; + font-size: 24rpx; + font-weight: bold; + line-height: 1; +} + +.delete-btn:active { + background-color: #cc0000; + transform: scale(0.95); +}