Commit 45367f73 authored by 邓春圆's avatar 邓春圆

Merge remote-tracking branch 'origin/release' into release

parents 4345553b f250698a
......@@ -147,10 +147,10 @@ export function deleteAllSplit(orderId) {
}
// 获取拆单订单的总货值与箱数拆分记录
export function splitItemWorthCheck(orderId) {
export function splitItemWorthCheck(orderId, orderSplitItemId) {
return request({
url: '/order/split-item/worth/check',
method: 'get',
params: {orderId}
params: {orderId, orderSplitItemId}
})
}
......@@ -13,8 +13,8 @@
<el-button type="primary" @click="reLoad">{{$t('搜索')}}</el-button>
<div v-if="showAll">
<el-checkbox :label="$t('全选(最多500)')" @change="toggleAll" :disabled="isAllProduct"></el-checkbox>
<el-checkbox :label="$t('全选库内商品(共{cnt}个)', {cnt: total})" v-model="isAllProduct"></el-checkbox>
<el-checkbox :label="$t('全选') + `(${total > 500 ? $t('最多500') : $t('{total}个', {total})})`" @change="toggleAll" :disabled="isAllProduct"></el-checkbox>
<el-checkbox :label="$t('全选库内商品(共{cnt}个)', {cnt: allTotal})" v-model="isAllProduct"></el-checkbox>
</div>
</div>
<div class="list">
......@@ -61,7 +61,8 @@ export default {
list: [],
page: 1,
pages: 1,
total: 0, // 商品总数
total: 0, // 当前筛选条件的商品总数
allTotal: 0, // 全库商品总数
queryParams: {
pageNo: 1,
pageSize: 500,
......@@ -115,6 +116,11 @@ export default {
if(this.defaultIds.length){
this.loadDefaultProds()
}
// 获取全库商品总数
getProductPage({pageNo: 1, pageSize: 1}).then(res => {
this.allTotal = res.data.total
})
},
methods: {
/* setAllProduct(status){
......
......@@ -372,7 +372,7 @@
</el-form-item>
<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>
</el-input-number>
</el-form-item>
......@@ -477,8 +477,8 @@ export default {
selectedWarehouseInId: null,
// 当前正在放入的入仓记录
currentPutIn: null,
// 订单剩余数据
orderLeftData: null
/*// 订单剩余数据
orderLeftData: null*/
};
},
created() {
......@@ -521,11 +521,17 @@ export default {
'shopForm.orderItemId'(){
// 默认取以前放入的品名
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 => {
const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
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: {
......@@ -672,11 +678,18 @@ export default {
// 订单剩余可拆货值
leftWorth(){
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 =>{
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: {
......@@ -853,6 +866,10 @@ export default {
if(this.isQuantity){
params.quantity = this.putin.quantity
}
// 货值不能超过剩余货值
if(params.worth > this.leftWorth){
return this.$message.error(this.$t("货值不能超过剩余货值"));
}
createSplitItem(params).then((res) => {
this.$message.success(this.$t("放入成功"));
this.querySplitGoods();
......@@ -994,11 +1011,11 @@ export default {
this.$set(this.shopForm, 'worth', worth)
},
// 查询订单剩余数据
getOrderLeftData(){
/*getOrderLeftData(){
splitItemWorthCheck(this.orderData.orderId).then(res => {
this.orderLeftData = res.data
})
}
}*/
}
};
</script>
......
......@@ -625,13 +625,28 @@ export default {
// 默认取以前放入的品名
let split = this.splitData.find(item => item.id == this.splitData[this.splitIndex].id)
this.shopForm.specsRecordVOList = []
let splitItemId = undefined
let splitItem = undefined
if(split) {
let specsRecordVOList = split.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)?.specsRecordVOList || []
splitItem = split.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
if(splitItem){
let specsRecordVOList = splitItem.specsRecordVOList || []
specsRecordVOList.forEach(item => {
const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3})
})
splitItemId = splitItem.id
}
}
// 填充原来的收费数据和货值
this.$set(this.shopForm, 'chargeVolume', splitItem?.chargeVolume || 0)
this.$set(this.shopForm, 'chargeWeight', splitItem?.chargeWeight || 0)
this.$set(this.shopForm, 'worth', splitItem?.worth || 0)
// 获取剩余货值,排除当前品名已放入数据
this.getOrderLeftData(splitItemId)
},
'shopForm.worth'(val, oldVal){
console.log('worth change from', oldVal, 'to', val)
......@@ -1014,6 +1029,11 @@ export default {
specsRecordVOList:this.shopForm.specsRecordVOList
}
// 货值不能超过可拆货值
if(params.worth > this.orderLeftData.splitResidueWorth){
return this.$message.error(this.$t('货值不能超过可拆货值'))
}
// 体积重量不能为0
const fields = {
'volume': this.$t('体积'),
......@@ -1155,8 +1175,8 @@ export default {
// 货值按照订单的总货值比例计算,所以需要判断是否是最后一次放入
let worth = (this.orderLeftData.totalWorth * this.putin.num / this.orderLeftData.sumNum).toFixed(2)
// 如果是最后放入
if(this.orderLeftData.splitResidueNum == this.putin.num){
// 如果是最后放入,或者超过了剩余货值,则直接取剩余货值
if(this.orderLeftData.splitResidueNum == this.putin.num || worth > this.orderLeftData.splitResidueWorth){
worth = this.orderLeftData.splitResidueWorth
}
this.$set(this.shopForm, 'worth', worth)
......@@ -1173,8 +1193,8 @@ export default {
this.$store.dispatch('tagsView/delCurrentView')
},
// 查询订单剩余数据
getOrderLeftData(){
splitItemWorthCheck(this.queryParams.orderId).then(res => {
getOrderLeftData(orderSplitItemId){
splitItemWorthCheck(this.queryParams.orderId, orderSplitItemId).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