|
|
|
|
@ -16,7 +16,6 @@ |
|
|
|
|
@confirm="handleBoxConfirm" |
|
|
|
|
placeholder="物料箱条码" |
|
|
|
|
class="uni-input-border" |
|
|
|
|
confirm-type="done" |
|
|
|
|
:focus="boxInputFocus" |
|
|
|
|
/> |
|
|
|
|
</view> |
|
|
|
|
@ -51,7 +50,6 @@ |
|
|
|
|
placeholder="流程卡号" |
|
|
|
|
class="uni-input-border" |
|
|
|
|
:class="{ 'input-disabled': !activeBox }" |
|
|
|
|
confirm-type="done" |
|
|
|
|
:focus="cardInputFocus" |
|
|
|
|
/> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
@ -79,7 +77,10 @@ |
|
|
|
|
class="order-card" |
|
|
|
|
: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"> |
|
|
|
|
<text class="order-no">{{ order.woOrder }}订单号</text> |
|
|
|
|
<text class="order-no">{{ order.cardNo }}</text> |
|
|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
|