Commit 382858d0 authored by dragondean@qq.com's avatar dragondean@qq.com

修复可拆货值可能为负数的问题

parent 04f34775
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
<span class="mr-10">{{ $t('入仓重量') }}:{{ mainOrderItem.weight || 0 }}kg</span> <span class="mr-10">{{ $t('入仓重量') }}:{{ mainOrderItem.weight || 0 }}kg</span>
<span class="mr-10">{{ $t('收费重量') }}:{{ mainOrderItem.chargeWeight || 0 }}kg</span> <span class="mr-10">{{ $t('收费重量') }}:{{ mainOrderItem.chargeWeight || 0 }}kg</span>
<span class="mr-10">{{ $t('数量(个)') }}:{{ mainOrderItem.quantity || 0 }}</span> <span class="mr-10">{{ $t('数量(个)') }}:{{ mainOrderItem.quantity || 0 }}</span>
<span class="mr-10">{{ $t('剩余货值') }}:{{ mainOrderItem.worth || 0 }}{{ $t('元') }}</span> <span class="mr-10">{{ $t('剩余可拆货值') }}:{{ leftWorth}}{{ $t('元') }}</span>
</div> </div>
<div class="page-title">{{$t('可拆入仓记录')}}</div> <div class="page-title">{{$t('可拆入仓记录')}}</div>
<el-table <el-table
...@@ -404,7 +404,7 @@ import { ...@@ -404,7 +404,7 @@ import {
getSplitList, getSplitList,
// quantitycheck, // quantitycheck,
createSplitItem, createSplitItem,
deleteSplitItem, deleteSplitItem, splitItemWorthCheck,
} from "@/api/ecw/orderHandle"; } from "@/api/ecw/orderHandle";
import {quantityRequired} from "@/api/ecw/warehouse"; import {quantityRequired} from "@/api/ecw/warehouse";
import { getTradeCityList } from "@/api/ecw/region"; import { getTradeCityList } from "@/api/ecw/region";
...@@ -476,7 +476,9 @@ export default { ...@@ -476,7 +476,9 @@ export default {
// 当前选择的入仓记录ID // 当前选择的入仓记录ID
selectedWarehouseInId: null, selectedWarehouseInId: null,
// 当前正在放入的入仓记录 // 当前正在放入的入仓记录
currentPutIn: null currentPutIn: null,
// 订单剩余数据
orderLeftData: null
}; };
}, },
created() { created() {
...@@ -666,7 +668,16 @@ export default { ...@@ -666,7 +668,16 @@ export default {
num -= item.num num -= item.num
})*/ })*/
return num return num
} },
// 订单剩余可拆货值
leftWorth(){
if(!this.orderData?.costVO?.totalWorth)return 0;
let worth = this.orderData.costVO.totalWorth
this.splitData.orderSplitItemBackVOList.forEach(item =>{
worth -= item.worth
})
return worth
},
}, },
methods: { methods: {
/*检查并提交字段(体积,重量)修改*/ /*检查并提交字段(体积,重量)修改*/
...@@ -981,8 +992,14 @@ export default { ...@@ -981,8 +992,14 @@ export default {
// 货值按照主单的总货值*订单的箱数比例 // 货值按照主单的总货值*订单的箱数比例
let worth = (this.orderData.costVO.totalWorth * this.putin.num / this.orderData.sumNum).toFixed(2) let worth = (this.orderData.costVO.totalWorth * this.putin.num / this.orderData.sumNum).toFixed(2)
this.$set(this.shopForm, 'worth', worth) this.$set(this.shopForm, 'worth', worth)
},
// 查询订单剩余数据
getOrderLeftData(){
splitItemWorthCheck(this.orderData.orderId).then(res => {
this.orderLeftData = res.data
})
} }
}, }
}; };
</script> </script>
......
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
<span class="mr-10">{{ $t('入仓重量') }}:{{ leftData.weight || 0 }}kg</span> <span class="mr-10">{{ $t('入仓重量') }}:{{ leftData.weight || 0 }}kg</span>
<span class="mr-10">{{ $t('收费重量') }}:{{ leftData.chargeWeight || 0 }}kg</span> <span class="mr-10">{{ $t('收费重量') }}:{{ leftData.chargeWeight || 0 }}kg</span>
<span class="mr-10">{{ $t('数量(个)') }}:{{ leftData.quantity || 0 }}</span> <span class="mr-10">{{ $t('数量(个)') }}:{{ leftData.quantity || 0 }}</span>
<span class="mr-10">{{ $t('剩余货值') }}:{{ leftData.worth || 0 }}{{ $t('元') }}</span> <span class="mr-10" v-if="orderLeftData">{{ $t('剩余订单货值') }}:{{ orderLeftData.splitResidueWorth || 0 }}{{ $t('元') }}</span>
</div> </div>
</el-card> </el-card>
...@@ -566,7 +566,9 @@ export default { ...@@ -566,7 +566,9 @@ export default {
// 当前选择的入仓记录ID // 当前选择的入仓记录ID
// selectedWarehouseInId: null, // selectedWarehouseInId: null,
// 当前正在放入的入仓记录 // 当前正在放入的入仓记录
currentPutIn: null currentPutIn: null,
// 订单剩余数据,sumNum,splitNum,splitResidueNum,totalWorth,splitWorth,splitResidueWorth
orderLeftData: null
}; };
}, },
async created() { async created() {
...@@ -613,6 +615,9 @@ export default { ...@@ -613,6 +615,9 @@ export default {
shopOpen(show){ shopOpen(show){
if(!show){ if(!show){
this.shopForm = {} this.shopForm = {}
}else{
// 打开弹层查询剩余数据
this.getOrderLeftData()
} }
}, },
// 切换品名需要重置已放入的记录 // 切换品名需要重置已放入的记录
...@@ -1149,16 +1154,12 @@ export default { ...@@ -1149,16 +1154,12 @@ export default {
this.$set(this.shopForm, 'chargeWeight', chargeWeight) this.$set(this.shopForm, 'chargeWeight', chargeWeight)
// 货值按照订单的总货值比例计算,所以需要判断是否是最后一次放入 // 货值按照订单的总货值比例计算,所以需要判断是否是最后一次放入
splitItemWorthCheck(this.queryParams.orderId).then(res => { let worth = (this.orderLeftData.totalWorth * this.putin.num / this.orderLeftData.sumNum).toFixed(2)
let worth = (res.data.totalWorth * this.putin.num / res.data.sumNum).toFixed(2) // 如果是最后放入
console.log({worth}, res.data.totalWorth , this.putin.num , res.data.sumNum, this.putin.num / res.data.sumNum) if(this.orderLeftData.splitResidueNum == this.putin.num){
// 如果是最后放入 worth = this.orderLeftData.splitResidueWorth
if(res.data.splitResidueNum == this.putin.num){ }
worth = res.data.splitResidueWorth this.$set(this.shopForm, 'worth', worth)
}
this.$set(this.shopForm, 'worth', worth)
console.log('set worth', worth)
})
}, },
// 重置 // 重置
reset(){ reset(){
...@@ -1170,6 +1171,12 @@ export default { ...@@ -1170,6 +1171,12 @@ export default {
async cancel(){ async cancel(){
await this.reset() await this.reset()
this.$store.dispatch('tagsView/delCurrentView') this.$store.dispatch('tagsView/delCurrentView')
},
// 查询订单剩余数据
getOrderLeftData(){
splitItemWorthCheck(this.queryParams.orderId).then(res => {
this.orderLeftData = res.data
})
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment