Commit 4a08ff17 authored by dragondean@qq.com's avatar dragondean@qq.com

优化出货拆单

parent 23bd9d88
...@@ -372,7 +372,7 @@ ...@@ -372,7 +372,7 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('放入货值')"> <el-form-item :label="$t('放入货值')">
<el-input-number v-model="shopForm.worth" controls-position="right" :min="0" :max="mainOrderItem.worth"> <el-input-number v-model="shopForm.worth" controls-position="right" :min="0" :max="leftWorth">
<template slot="append">{{ $t('') }}</template> <template slot="append">{{ $t('') }}</template>
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
...@@ -477,8 +477,8 @@ export default { ...@@ -477,8 +477,8 @@ export default {
selectedWarehouseInId: null, selectedWarehouseInId: null,
// 当前正在放入的入仓记录 // 当前正在放入的入仓记录
currentPutIn: null, currentPutIn: null,
// 订单剩余数据 /*// 订单剩余数据
orderLeftData: null orderLeftData: null*/
}; };
}, },
created() { created() {
...@@ -521,11 +521,17 @@ export default { ...@@ -521,11 +521,17 @@ export default {
'shopForm.orderItemId'(){ 'shopForm.orderItemId'(){
// 默认取以前放入的品名 // 默认取以前放入的品名
this.shopForm.specsRecordVOList = [] this.shopForm.specsRecordVOList = []
let specsRecordVOList = this.splitData.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)?.specsRecordVOList || [] const splitItem = this.splitData.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
let specsRecordVOList = splitItem?.specsRecordVOList || []
specsRecordVOList.forEach(item => { specsRecordVOList.forEach(item => {
const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*') const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3}) this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3})
}) })
// 显示原来默认的收费数据
this.$set(this.shopForm, 'chargeVolume', splitItem.chargeVolume)
this.$set(this.shopForm, 'chargeWeight', splitItem.chargeWeight)
this.$set(this.shopForm, 'worth', splitItem.worth)
} }
}, },
computed: { computed: {
...@@ -672,11 +678,18 @@ export default { ...@@ -672,11 +678,18 @@ export default {
// 订单剩余可拆货值 // 订单剩余可拆货值
leftWorth(){ leftWorth(){
if(!this.orderData?.costVO?.totalWorth)return 0; if(!this.orderData?.costVO?.totalWorth)return 0;
let worth = this.orderData.costVO.totalWorth let worth = new Decimal(this.orderData.costVO.totalWorth)
this.splitData.orderSplitItemBackVOList.forEach(item =>{ this.splitData.orderSplitItemBackVOList.forEach(item =>{
worth -= item.worth worth = worth.minus(item.worth || 0)
}) })
return worth // 包当前选择的品名之前填写的货值包含进去
if(this.shopForm.orderItemId){
let splitItem = this.splitData.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
if(splitItem){
worth = worth.plus(splitItem.worth || 0)
}
}
return worth.toNumber()
}, },
}, },
methods: { methods: {
...@@ -853,6 +866,10 @@ export default { ...@@ -853,6 +866,10 @@ export default {
if(this.isQuantity){ if(this.isQuantity){
params.quantity = this.putin.quantity params.quantity = this.putin.quantity
} }
// 货值不能超过剩余货值
if(params.worth > this.leftWorth){
return this.$message.error(this.$t("货值不能超过剩余货值"));
}
createSplitItem(params).then((res) => { createSplitItem(params).then((res) => {
this.$message.success(this.$t("放入成功")); this.$message.success(this.$t("放入成功"));
this.querySplitGoods(); this.querySplitGoods();
...@@ -994,11 +1011,11 @@ export default { ...@@ -994,11 +1011,11 @@ export default {
this.$set(this.shopForm, 'worth', worth) this.$set(this.shopForm, 'worth', worth)
}, },
// 查询订单剩余数据 // 查询订单剩余数据
getOrderLeftData(){ /*getOrderLeftData(){
splitItemWorthCheck(this.orderData.orderId).then(res => { splitItemWorthCheck(this.orderData.orderId).then(res => {
this.orderLeftData = res.data this.orderLeftData = res.data
}) })
} }*/
} }
}; };
</script> </script>
......
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