物流问题修改

master
zhangdi 3 weeks ago
parent 29211f6a37
commit c27ca81ae6
  1. 11
      http/api.js
  2. 79
      pages/logistics/packaging.vue

@ -14,6 +14,7 @@ const http = new Request(options);
http.interceptors.request.use((config) => { // 可使用async await 做异步操作 http.interceptors.request.use((config) => { // 可使用async await 做异步操作
// 假设有token值需要在头部需要携带 // 假设有token值需要在头部需要携带
let accessToken = uni.getStorageSync('accessToken'); let accessToken = uni.getStorageSync('accessToken');
if (accessToken) { if (accessToken) {
@ -28,11 +29,11 @@ http.interceptors.request.use((config) => { // 可使用async await 做异步操
config.url = server_config.loginUrl + config.url; config.url = server_config.loginUrl + config.url;
} }
// #ifndef H5 // #ifndef H5
let url = config.url // let url = config.url
if (process.env.NODE_ENV == 'development' && !url.startsWith("http")) { // if (process.env.NODE_ENV == 'development' && !url.startsWith("http")) {
url = url.substring(url.indexOf('/api') + 4) // url = url.substring(url.indexOf('/api') + 4)
config.url = url // config.url = url
} // }
// #endif // #endif
// 额外参数 // 额外参数

@ -16,7 +16,9 @@
@confirm="handleBoxConfirm" @confirm="handleBoxConfirm"
placeholder="物料箱条码" placeholder="物料箱条码"
class="uni-input-border" class="uni-input-border"
confirm-type="done"
:focus="boxInputFocus" :focus="boxInputFocus"
:key="'box-' + boxInputFocus"
/> />
</view> </view>
</view> </view>
@ -50,7 +52,9 @@
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"
:key="'card-' + cardInputFocus"
/> />
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
@ -134,7 +138,6 @@ export default {
}, },
}, },
methods: { methods: {
//
handleDeleteOrder(order, index) { handleDeleteOrder(order, index) {
uni.showModal({ uni.showModal({
title: "确认删除", title: "确认删除",
@ -154,37 +157,27 @@ export default {
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) { if (this.boxInfo.yieldOrderList == null) {
this.boxInfo.yieldOrderList = []; 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() { handleCardConfirm() {
// const code = this.cardCode.trim(); const code = this.cardCode;
// if (!code) return; // if (!code) return;
if (this.cardCode) { if (this.cardCode) {
if (!this.activeBox) { if (!this.activeBox) {
@ -192,10 +185,10 @@ export default {
title: "请先扫描物料箱条码", title: "请先扫描物料箱条码",
icon: "none", icon: "none",
}); });
this.boxInputFocus = false;
this.$nextTick(() => { this.$nextTick(() => {
this.boxInputFocus = true; this.boxInputFocus = true;
}); });
return; return;
} }
if ( if (
@ -214,16 +207,32 @@ export default {
} }
uni.showLoading({ uni.showLoading({
title: "查询中...", title: "查询中...",
mask: true,
}); });
this.$u.api this.$u.api
.queryCardNo({ cardNo: this.cardCode }) .queryCardNo({ cardNo: this.cardCode })
.then((res) => { .then((res) => {
uni.hideLoading();
this.boxInfo.yieldOrderList.push(res.data); this.boxInfo.yieldOrderList.push(res.data);
uni.showToast({ uni.hideLoading();
title: `流程卡 ${code} 装箱成功`, //
icon: "success", const currentWeight = this.boxInfo.yieldOrderList.reduce(
}); (sum, o) => {
return sum + (Number(o.actualWeighing) || 0);
},
0
);
if (currentWeight > 50000) {
uni.showToast({
title: `请注意箱子已超重!!!!!`,
icon: "warring",
});
} else {
uni.showToast({
title: `流程卡 ${code} 装箱成功`,
icon: "success",
});
}
this.cardCode = ""; this.cardCode = "";
this.cardInputFocus = false; this.cardInputFocus = false;
this.$nextTick(() => { this.$nextTick(() => {
@ -231,7 +240,10 @@ export default {
}); });
}) })
.catch((err) => { .catch((err) => {
uni.hideLoading(); uni.showToast({
title: err,
icon: "error",
});
this.cardCode = ""; this.cardCode = "";
this.cardInputFocus = false; this.cardInputFocus = false;
this.$nextTick(() => { this.$nextTick(() => {
@ -247,30 +259,21 @@ 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();
}); });
}, },
}, },

Loading…
Cancel
Save