修改逻辑

master
zhangdi 3 weeks ago
parent aefea7d75d
commit 29211f6a37
  1. 40
      pages/logistics/delivery.vue
  2. 122
      pages/logistics/packaging.vue

@ -18,9 +18,9 @@
</view> </view>
<button <button
@click="handleSubmit" @click="handleSubmit"
:disabled="!boxData || !startData || !endCenter" :disabled="!startData || !endCenter"
class="submit-btn" class="submit-btn"
:class="{ 'btn-disabled': !boxData || !startData || !endCenter }" :class="{ 'btn-disabled': !startData || !endCenter }"
> >
配送 配送
</button> </button>
@ -63,10 +63,9 @@
range-key="name" range-key="name"
:value="endCenterIndex" :value="endCenterIndex"
@change="handleEndChange" @change="handleEndChange"
:disabled="!boxData"
class="uni-input-border" class="uni-input-border"
> >
<view class="picker-input" :class="{ 'picker-disabled': !boxData }"> <view class="picker-input">
<text :class="endCenter ? 'picker-value' : 'picker-placeholder'"> <text :class="endCenter ? 'picker-value' : 'picker-placeholder'">
{{ endCenter || "请选择终点" }} {{ endCenter || "请选择终点" }}
</text> </text>
@ -78,14 +77,12 @@
<view v-if="showDetails" class="popup-overlay" @click="showDetails = false"> <view v-if="showDetails" class="popup-overlay" @click="showDetails = false">
<view class="popup-content" @click.stop> <view class="popup-content" @click.stop>
<view class="popup-header"> <view class="popup-header">
<text class="popup-title" <text class="popup-title"> {{ boxData.boxBarcode }} 明细</text>
> {{ boxData.boxBarcode }} 明细</text
>
</view> </view>
<scroll-view class="popup-scroll" scroll-y> <scroll-view class="popup-scroll" scroll-y>
<view class="popup-orders"> <view class="popup-orders">
<view <view
v-for="(order,index) in yieldOrderList" v-for="(order, index) in yieldOrderList"
:key="index" :key="index"
class="popup-order-item" class="popup-order-item"
> >
@ -130,7 +127,7 @@ export default {
ST002: { stationCode: "ST002", stationName: "A区暂存点" }, ST002: { stationCode: "ST002", stationName: "A区暂存点" },
}, },
workCenters: [], workCenters: [],
yieldOrderList:[],// yieldOrderList: [], //
}; };
}, },
computed: { computed: {
@ -147,13 +144,14 @@ export default {
}, },
methods: { methods: {
// //
detailsFn(){ detailsFn() {
this.showDetails = true; this.showDetails = true;
this.$u.api.boxbarcodeDetails({boxBarcode:this.boxData.boxBarcode}).then(res=>{ this.$u.api
console.log(9999,res.data) .boxbarcodeDetails({ boxBarcode: this.boxData.boxBarcode })
this.yieldOrderList = res.data.yieldOrderList .then((res) => {
console.log(9999, res.data);
}) this.yieldOrderList = res.data.yieldOrderList;
});
}, },
handleBoxConfirm() { handleBoxConfirm() {
const code = this.boxCode.trim(); const code = this.boxCode.trim();
@ -217,17 +215,20 @@ export default {
}, },
handleSubmit() { handleSubmit() {
uni.showLoading({
title: "提交中...",
});
let query_ = { let query_ = {
boxBarcode: this.boxData.boxBarcode, // boxBarcode: this.boxBarcode||'', //
startStationCode: this.startData.stationCode, // startStationCode: this.startData.stationCode, //
endWcId: this.endCenterIndex, // endWcId: this.endCenterIndex, //
}; };
this.$u.api.boxBindingTesk(query_).then((res) => { this.$u.api.boxBindingTesk(query_).then((res) => {
console.log(89898989898, res.data);
uni.showToast({ uni.showToast({
title: `成功配送至 ${this.endCenter}!`, title: `成功配送至 ${this.endCenter}!`,
icon: "success", icon: "success",
}); });
uni.hideLoading()
this.boxCode = ""; this.boxCode = "";
this.boxData = null; this.boxData = null;
@ -236,8 +237,9 @@ export default {
this.endCenter = ""; this.endCenter = "";
this.boxInputFocus = true; this.boxInputFocus = true;
this.startInputFocus = false; this.startInputFocus = false;
}); }).catch(err=>{
uni.hideLoading()
})
}, },
}, },
}; };

@ -16,7 +16,6 @@
@confirm="handleBoxConfirm" @confirm="handleBoxConfirm"
placeholder="物料箱条码" placeholder="物料箱条码"
class="uni-input-border" class="uni-input-border"
confirm-type="done"
:focus="boxInputFocus" :focus="boxInputFocus"
/> />
</view> </view>
@ -51,7 +50,6 @@
placeholder="流程卡号" placeholder="流程卡号"
class="uni-input-border" class="uni-input-border"
:class="{ 'input-disabled': !activeBox }" :class="{ 'input-disabled': !activeBox }"
confirm-type="done"
:focus="cardInputFocus" :focus="cardInputFocus"
/> />
</uni-forms-item> </uni-forms-item>
@ -79,7 +77,10 @@
class="order-card" class="order-card"
:class="{ 'order-latest': index === 0 }" :class="{ 'order-latest': index === 0 }"
> >
<view v-if="index === 0" class="latest-badge">最新</view> <!-- <view v-if="index === 0" class="latest-badge">最新</view> -->
<view class="delete-btn" @tap="handleDeleteOrder(order, index)">
<text class="delete-icon"></text>
</view>
<view class="order-header"> <view class="order-header">
<text class="order-no">{{ order.woOrder }}订单号</text> <text class="order-no">{{ order.woOrder }}订单号</text>
<text class="order-no">{{ order.cardNo }}</text> <text class="order-no">{{ order.cardNo }}</text>
@ -133,15 +134,41 @@ export default {
}, },
}, },
methods: { 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() { handleBoxConfirm() {
const code = this.boxCode.trim(); const code = this.boxCode.trim();
if (!code) return; if (!code) return;
uni.showLoading({
title: "查询中...",
});
this.boxInfo = {
yieldOrderList: [],
};
this.$u.api this.$u.api
.boxbarcodeDetails({ boxBarcode: this.boxCode }) .boxbarcodeDetails({ boxBarcode: this.boxCode })
.then((res) => { .then((res) => {
this.boxInfo = res.data; this.boxInfo = res.data;
}); if (res.data.yieldOrderList == null) {
this.boxInfo.yieldOrderList = [];
}
uni.hideLoading();
this.activeBox = code; this.activeBox = code;
// , // ,
uni.showToast({ uni.showToast({
@ -149,46 +176,69 @@ export default {
icon: "success", icon: "success",
}); });
this.boxCode = ""; this.boxCode = "";
this.$nextTick(() => {
this.boxInputFocus = false; this.boxInputFocus = false;
this.cardInputFocus = true; this.cardInputFocus = true;
});
});
}, },
handleCardConfirm() { handleCardConfirm() {
const code = this.cardCode.trim(); // const code = this.cardCode.trim();
if (!code) return; // if (!code) return;
if (this.cardCode) {
if (!this.activeBox) { if (!this.activeBox) {
uni.showToast({ uni.showToast({
title: "请先扫描物料箱条码", title: "请先扫描物料箱条码",
icon: "none", icon: "none",
}); });
this.$nextTick(() => {
this.boxInputFocus = true; this.boxInputFocus = true;
});
return; return;
} }
if (this.boxInfo.yieldOrderList.some((o) => o.cardNo === this.cardCode)) { if (
this.boxInfo.yieldOrderList.some((o) => o.cardNo === this.cardCode)
) {
uni.showToast({ uni.showToast({
title: `订单 ${this.cardCode} 已在该箱中!`, title: `订单 ${this.cardCode} 已在该箱中!`,
icon: "none", icon: "none",
}); });
this.cardCode = ""; this.cardCode = "";
return; this.cardInputFocus = false;
} this.$nextTick(() => {
this.$u.api.queryCardNo({ cardNo: this.cardCode }).then((res) => { this.cardInputFocus = true;
this.boxInfo.yieldOrderList.push(res.data);
if (!res.data.cardNo) {
uni.showToast({
title: `流程卡 ${code} 不存在或未称重`,
icon: "none",
}); });
this.cardCode = "";
return; return;
} }
uni.showLoading({
title: "查询中...",
});
this.$u.api
.queryCardNo({ cardNo: this.cardCode })
.then((res) => {
uni.hideLoading();
this.boxInfo.yieldOrderList.push(res.data);
uni.showToast({ uni.showToast({
title: `流程卡 ${code} 装箱成功`, title: `流程卡 ${code} 装箱成功`,
icon: "success", icon: "success",
}); });
this.cardCode = ""; 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() { handleResetBox() {
@ -197,21 +247,30 @@ export default {
this.orders = []; this.orders = [];
this.boxInputFocus = true; this.boxInputFocus = true;
this.cardInputFocus = false; this.cardInputFocus = false;
this.boxInfo.yieldOrderList = [];
}, },
// //
handleSubmit() { handleSubmit() {
uni.showLoading({
title: "提交中...",
});
this.$u.api this.$u.api
.boxBinding({ .boxBinding({
boxBarcode: this.activeBox, // boxBarcode: this.activeBox, //
orderIdList: this.boxInfo.yieldOrderList.map((o) => o.cardNo), orderIdList: this.boxInfo.yieldOrderList.map((o) => o.cardNo),
}) })
.then((res) => { .then((res) => {
uni.hideLoading();
uni.showToast({ uni.showToast({
title: `装箱成功`, title: `装箱成功`,
icon: "success", icon: "success",
}); });
this.cardCode = ""; this.cardCode = "";
this.boxInfo.yieldOrderList = []; this.boxInfo.yieldOrderList = [];
})
.catch((err) => {
uni.hideLoading();
}); });
}, },
}, },
@ -322,7 +381,7 @@ export default {
} }
.order-latest { .order-latest {
border-color: #fb923c; /* border-color: #fb923c; */
box-shadow: 0 0 0 2rpx rgba(251, 146, 60, 0.2); box-shadow: 0 0 0 2rpx rgba(251, 146, 60, 0.2);
} }
@ -435,4 +494,31 @@ export default {
.submit-btn.disabled { .submit-btn.disabled {
opacity: 0.5; 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);
}
</style> </style>

Loading…
Cancel
Save