diff --git a/http/api.js b/http/api.js index dcc81a1..643710c 100644 --- a/http/api.js +++ b/http/api.js @@ -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 // 额外参数 diff --git a/pages/logistics/packaging.vue b/pages/logistics/packaging.vue index d729d92..31a8fe1 100644 --- a/pages/logistics/packaging.vue +++ b/pages/logistics/packaging.vue @@ -16,7 +16,9 @@ @confirm="handleBoxConfirm" placeholder="物料箱条码" class="uni-input-border" + confirm-type="done" :focus="boxInputFocus" + :key="'box-' + boxInputFocus" /> @@ -50,7 +52,9 @@ placeholder="流程卡号" class="uni-input-border" :class="{ 'input-disabled': !activeBox }" + confirm-type="done" :focus="cardInputFocus" + :key="'card-' + cardInputFocus" /> @@ -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(); }); }, },