Commit 7f8d30fb authored by dragondean@qq.com's avatar dragondean@qq.com

优化拆单,修改货值计算规则

parent 9ed50cdd
...@@ -145,3 +145,12 @@ export function deleteAllSplit(orderId) { ...@@ -145,3 +145,12 @@ export function deleteAllSplit(orderId) {
params: {orderId} params: {orderId}
}) })
} }
// 获取拆单订单的总货值与箱数拆分记录
export function splitItemWorthCheck(orderId) {
return request({
url: '/order/split-item/worth/check',
method: 'get',
params: {orderId}
})
}
...@@ -141,30 +141,34 @@ ...@@ -141,30 +141,34 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('入仓体积')" align="center" > <el-table-column :label="$t('入仓体积')" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.volume" @change="updateField(scope.row, 'volume')" size="mini" disabled> {{scope.row.volume}}
<!--<el-input v-model="scope.row.volume" @change="updateField(scope.row, 'volume')" size="mini" disabled>
<span slot="append"></span> <span slot="append"></span>
</el-input> </el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('收费体积')" align="center" > <el-table-column :label="$t('收费体积')" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.chargeVolume" @change="updateField(scope.row, 'chargeVolume')" size="mini" disabled> {{scope.row.chargeVolume}}
<!--<el-input v-model="scope.row.chargeVolume" @change="updateField(scope.row, 'chargeVolume')" size="mini" disabled>
<span slot="append"></span> <span slot="append"></span>
</el-input> </el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('入仓重量')" align="center"> <el-table-column :label="$t('入仓重量')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.weight" @change="updateField(scope.row, 'weight')" size="mini" disabled> {{scope.row.weight}}kg
<!--<el-input v-model="scope.row.weight" @change="updateField(scope.row, 'weight')" size="mini" disabled>
<span slot="append">kg</span> <span slot="append">kg</span>
</el-input> </el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('收费重量')" align="center"> <el-table-column :label="$t('收费重量')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.chargeWeight" @change="updateField(scope.row, 'chargeWeight')" size="mini" disabled> {{scope.row.chargeWeight}}kg
<!--<el-input v-model="scope.row.chargeWeight" @change="updateField(scope.row, 'chargeWeight')" size="mini" disabled>
<span slot="append">kg</span> <span slot="append">kg</span>
</el-input> </el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('货值')" align="center"> <el-table-column :label="$t('货值')" align="center">
...@@ -291,7 +295,7 @@ ...@@ -291,7 +295,7 @@
<el-table-column :label="$t('操作')"> <el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}"> <template v-slot="{ row, column, $index}">
<el-tag v-if="getWarehouseInSplitData(row.id,'num') >= row.cartonsNum" disabled size="mini" type="primary" >{{$t('已拆完')}}</el-tag> <el-tag v-if="getWarehouseInSplitData(row.id,'num') >= row.cartonsNum" disabled size="mini" type="primary" >{{$t('已拆完')}}</el-tag>
<el-button v-else size="mini" type="primary" @click="putInRecord(row)" :disabled="leftSplitNum <= 0">放入</el-button> <el-button v-else size="mini" type="primary" @click="putInRecord(row)" :disabled="leftSplitNum <= 0">{{$t('放入')}}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -299,7 +303,7 @@ ...@@ -299,7 +303,7 @@
<div class="page-title" style="margin: 0"> <div class="page-title" style="margin: 0">
{{$t('已放入入仓记录')}} {{$t('已放入入仓记录')}}
</div> </div>
<el-button type="danger" size="mini" @click="clearAll">清空放入数据</el-button> <el-button type="danger" size="mini" @click="clearAll">{{$t('清空放入数据')}}</el-button>
</div> </div>
<el-table <el-table
...@@ -348,12 +352,12 @@ ...@@ -348,12 +352,12 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('操作')"> <el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}"> <template v-slot="{ row, column, $index}">
<el-button size="mini" type="primary" @click="deleteRow($index)">删除</el-button> <el-button size="mini" type="primary" @click="deleteRow($index)">{{$t('删除')}}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="page-title">放入数据</div> <div class="page-title">{{$t('放入数据')}}</div>
<div class="pl-20 mb-10"> <div class="pl-20 mb-10">
<span class="mr-10">{{$t('箱数')}}:{{ putin.num || 0 }},</span> <span class="mr-10">{{$t('箱数')}}:{{ putin.num || 0 }},</span>
<span class="mr-10">{{ $t('数量(个)') }}:{{ putin.quantity || 0 }},</span> <span class="mr-10">{{ $t('数量(个)') }}:{{ putin.quantity || 0 }},</span>
...@@ -973,7 +977,10 @@ export default { ...@@ -973,7 +977,10 @@ export default {
const chargeWeight = orderItem.itemType === 3 ? (orderItem.chargeWeight*rate).toFixed(2) : this.putin.weight const chargeWeight = orderItem.itemType === 3 ? (orderItem.chargeWeight*rate).toFixed(2) : this.putin.weight
this.$set(this.shopForm, 'chargeVolume', chargeVolume) this.$set(this.shopForm, 'chargeVolume', chargeVolume)
this.$set(this.shopForm, 'chargeWeight', chargeWeight) this.$set(this.shopForm, 'chargeWeight', chargeWeight)
this.$set(this.shopForm, 'worth', (orderItem.worth*rate).toFixed(2))
// 货值按照主单的总货值*订单的箱数比例
let worth = (this.orderData.costVO.totalWorth * this.putin.num / this.orderData.sumNum).toFixed(2)
this.$set(this.shopForm, 'worth', worth)
} }
}, },
}; };
......
...@@ -172,9 +172,10 @@ ...@@ -172,9 +172,10 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('收费体积')" align="center" > <el-table-column :label="$t('收费体积')" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.chargeVolume" @change="updateField(scope.row, 'chargeVolume')" size="mini" disabled> {{scope.row.chargeVolume}}
<!--<el-input v-model="scope.row.chargeVolume" @change="updateField(scope.row, 'chargeVolume')" size="mini" disabled>
<span slot="append"></span> <span slot="append"></span>
</el-input> </el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('入仓重量')" align="center"> <el-table-column :label="$t('入仓重量')" align="center">
...@@ -184,16 +185,18 @@ ...@@ -184,16 +185,18 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('收费重量')" align="center"> <el-table-column :label="$t('收费重量')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.chargeWeight" @change="updateField(scope.row, 'chargeWeight')" size="mini" disabled> {{scope.row.chargeWeight}}kg
<!--<el-input v-model="scope.row.chargeWeight" @change="updateField(scope.row, 'chargeWeight')" size="mini" disabled>
<span slot="append">kg</span> <span slot="append">kg</span>
</el-input> </el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('货值')" align="center"> <el-table-column :label="$t('货值')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.worth" @change="updateField(scope.row, 'worth')" size="mini" disabled> {{scope.row.worth}}{{ $t('') }}
<!--<el-input v-model="scope.row.worth" @change="updateField(scope.row, 'worth')" size="mini" disabled>
<span slot="append">{{ $t('') }}</span> <span slot="append">{{ $t('') }}</span>
</el-input> </el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('箱数')" align="center" prop="num"> <el-table-column :label="$t('箱数')" align="center" prop="num">
...@@ -256,12 +259,12 @@ ...@@ -256,12 +259,12 @@
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="120px" inline> <el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="120px" inline>
<el-form-item :label="$t('中文品名')"> <el-form-item :label="$t('中文品名')">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')"> <el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')">
<el-option v-for="item in orderData.orderItemVOList" :label="item.prodTitleZh" :value="item.orderItemId" :key="item.prodTitleZh" ></el-option> <el-option v-for="item in orderData.orderItemVOList" :label="item.prodTitleZh" :value="item.orderItemId" :key="item.orderItemId" ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('英文品名')"> <el-form-item :label="$t('英文品名')">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')"> <el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')">
<el-option v-for="item in orderData.orderItemVOList" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.prodTitleEn" ></el-option> <el-option v-for="item in orderData.orderItemVOList" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.orderItemId" ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-card> <el-card>
...@@ -413,8 +416,8 @@ ...@@ -413,8 +416,8 @@
<el-input-number v-model="shopForm.chargeWeight" controls-position="right"></el-input-number>kg <el-input-number v-model="shopForm.chargeWeight" controls-position="right"></el-input-number>kg
</el-form-item> </el-form-item>
<el-form-item :label="$t('放入货值')"> <el-form-item :label="$t('放入货值')" v-if="orderData.costVO">
<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="orderData.costVO.totalWorth">
<template slot="append">{{ $t('') }}</template> <template slot="append">{{ $t('') }}</template>
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
...@@ -488,7 +491,7 @@ import { ...@@ -488,7 +491,7 @@ import {
createSplitItem, createSplitItem,
deleteSplitItem, deleteSplitItem,
deleteSplit, deleteSplit,
deleteAllSplit deleteAllSplit, splitItemWorthCheck
} from "@/api/ecw/orderHandle" } from "@/api/ecw/orderHandle"
import {getWarehouseList, quantityRequired} from '@/api/ecw/warehouse' import {getWarehouseList, quantityRequired} from '@/api/ecw/warehouse'
import {getChannelList} from '@/api/ecw/channel' import {getChannelList} from '@/api/ecw/channel'
...@@ -624,6 +627,9 @@ export default { ...@@ -624,6 +627,9 @@ export default {
this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3}) this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3})
}) })
} }
},
'shopForm.worth'(val, oldVal){
console.log('worth change from', oldVal, 'to', val)
} }
}, },
computed:{ computed:{
...@@ -920,7 +926,7 @@ export default { ...@@ -920,7 +926,7 @@ export default {
} }
this.open = true this.open = true
}, },
// 查询数量是否必填 /*// 查询数量是否必填
numcheck(){ numcheck(){
quantityRequired(this.orderData.lineId).then(res=>{ quantityRequired(this.orderData.lineId).then(res=>{
this.quantityshow = res.data this.quantityshow = res.data
...@@ -928,16 +934,16 @@ export default { ...@@ -928,16 +934,16 @@ export default {
}, },
// 输入方数箱数后,按照平均值计算数量和体积重量数据 // 输入方数箱数后,按照平均值计算数量和体积重量数据
numChange(){ numChange(){
/*var sum = parseInt(this.quantitySum/this.shopForm.num) /!*var sum = parseInt(this.quantitySum/this.shopForm.num)
this.$set(this.shopForm,'quantity',sum)*/ this.$set(this.shopForm,'quantity',sum)*!/
let rate = this.shopForm.num/this.mainOrderItem.num let rate = this.shopForm.num/this.mainOrderItem.num
this.$set(this.shopForm, 'quantity', Math.ceil(this.mainOrderItem.quantity * rate)) this.$set(this.shopForm, 'quantity', Math.ceil(this.mainOrderItem.quantity * rate))
this.$set(this.shopForm, 'volume', (this.mainOrderItem.volume * rate).toFixed(2)) this.$set(this.shopForm, 'volume', (this.mainOrderItem.volume * rate).toFixed(2))
this.$set(this.shopForm, 'chargeVolume', (this.mainOrderItem.chargeVolume * rate).toFixed(2)) this.$set(this.shopForm, 'chargeVolume', (this.mainOrderItem.chargeVolume * rate).toFixed(2))
this.$set(this.shopForm, 'weight', (this.mainOrderItem.weight * rate).toFixed(2)) this.$set(this.shopForm, 'weight', (this.mainOrderItem.weight * rate).toFixed(2))
this.$set(this.shopForm, 'chargeWeight', (this.mainOrderItem.chargeWeight * rate).toFixed(2)) this.$set(this.shopForm, 'chargeWeight', (this.mainOrderItem.chargeWeight * rate).toFixed(2))
this.$set(this.shopForm, 'worth', (this.mainOrderItem.worth * rate).toFixed(2)) // this.$set(this.shopForm, 'worth', (this.mainOrderItem.worth * rate).toFixed(2))
}, },*/
/*changeProdTitleEn(){ /*changeProdTitleEn(){
var list = [] var list = []
list = this.splitData[0].orderSplitItemBackVOList.filter(item=>item.prodTitleEn == this.shopForm.prodTitleEn) list = this.splitData[0].orderSplitItemBackVOList.filter(item=>item.prodTitleEn == this.shopForm.prodTitleEn)
...@@ -1142,12 +1148,17 @@ export default { ...@@ -1142,12 +1148,17 @@ export default {
this.$set(this.shopForm, 'chargeVolume', chargeVolume) this.$set(this.shopForm, 'chargeVolume', chargeVolume)
this.$set(this.shopForm, 'chargeWeight', chargeWeight) this.$set(this.shopForm, 'chargeWeight', chargeWeight)
// 如果品名全拆,则货值直接给剩余数据,否则按照比例计算 // 货值按照订单的总货值比例计算,所以需要判断是否是最后一次放入
let worth = (orderItem.worth*rate).toFixed(2) splitItemWorthCheck(this.queryParams.orderId).then(res => {
if(this.leftData.num.toNumber() === this.putin.num){ let worth = (res.data.totalWorth * this.putin.num / res.data.sumNum).toFixed(2)
worth = this.leftData.worth console.log({worth}, res.data.totalWorth , this.putin.num , res.data.sumNum, this.putin.num / res.data.sumNum)
} // 如果是最后放入
this.$set(this.shopForm, 'worth', worth) if(res.data.splitResidueNum == this.putin.num){
worth = res.data.splitResidueWorth
}
this.$set(this.shopForm, 'worth', worth)
console.log('set worth', worth)
})
}, },
// 重置 // 重置
reset(){ reset(){
......
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