物流问题修改

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

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

Loading…
Cancel
Save