Commit b3efc42b authored by 我在何方's avatar 我在何方
parents 5b5226a1 b6a0591c
......@@ -34,6 +34,11 @@ export default {
lang: {
type: String,
default: 'Zh'
},
// 是否显示待确认商品,不传默认不显示
determined: {
type: Boolean,
default: false
}
},
data(){
......@@ -85,7 +90,7 @@ export default {
remoteMethod(keyword){
let params = {
pageSize: keyword ? 100000 : 10,
filter: false
filter: !this.determined
}
if(this.productType){
params.typeId = this.productType
......
......@@ -196,51 +196,64 @@
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="400px" append-to-body>
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="100px">
<el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="500px" append-to-body>
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="150px">
<el-row>
<el-form-item :label="$t('中文品名')+':'" prop="zhId">
<el-select v-model="shopForm.zhId" :placeholder="$t('请选择中文品名')" @change="changeProdTitleZh">
<el-option v-for="item in orderItems" :label="item.prodTitleZh" :value="item.id" :key="item.id" :disabled="itemDisabled(item)"></el-option>
<el-form-item :label="$t('中文品名')+':'" prop="orderItemId">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')" @change="onProdChange">
<el-option v-for="item in orderItems" :label="item.prodTitleZh" :value="item.orderItemId" :key="item.id" :disabled="itemDisabled(item)"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item :label="$t('英文品名')+':'" prop="enId">
<el-select v-model="shopForm.enId" :placeholder="$t('请选择英文品名')" @change="changeProdTitleEn">
<el-option v-for="item in orderItems" :label="item.prodTitleEn" :value="item.id" :key="item.id" :disabled="itemDisabled(item)"></el-option>
<el-form-item :label="$t('英文品名')+':'" prop="orderItemId">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')" @change="onProdChange">
<el-option v-for="item in orderItems" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.id" :disabled="itemDisabled(item)"></el-option>
</el-select>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('剩余箱数')+':'">
{{shopForm.num||0}}
{{shopForm.leftNum||0}}
</el-form-item>
</el-col>
<el-col :span="12" v-show="isQuantity">
<!--剩余数量计算不出来,显示没意义-->
<!--<el-col :span="12" v-show="isQuantity">
<el-form-item :label="$t('剩余数量(个)')+':'">
{{shopForm.quantity||0}}
{{shopForm.leftQuantity||0}}
</el-form-item>
</el-col>
</el-col>-->
</el-row>
<el-form-item :label="$t('放入箱数')+':'">
{{shopForm.putNum||0}}
{{shopForm.num||0}}
</el-form-item>
<el-form-item v-if="mainOrderItem.orderItemId" label-width="0">
{{ $t('剩余入仓方数') }}:{{ mainOrderItem.volume || 0 }}m³,
{{$t('剩余收费方数')}}:{{ mainOrderItem.chargeVolume || 0 }}m³
</el-form-item>
<el-form-item :label="$t('入仓体积')">
<el-input-number v-model="shopForm.volume" controls-position="right" :min="0" :max="orderItem.warehouseInInfoVO.volume"></el-input-number>
<el-input-number v-model="shopForm.volume" controls-position="right" :min="0" :max="mainOrderItem.volume"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费体积')">
<el-input-number v-model="shopForm.chargeVolume" controls-position="right" :min="0" :max="orderItem.chargeVolume"></el-input-number>
<el-input-number v-model="shopForm.chargeVolume" controls-position="right" :min="0" :max="mainOrderItem.chargeVolume"></el-input-number>
</el-form-item>
<el-form-item v-if="mainOrderItem.orderItemId" label-width="0">
{{ $t('剩余入仓重量') }}:{{ mainOrderItem.weight || 0 }}kg,
{{$t('剩余收费重量')}}:{{ mainOrderItem.chargeWeight || 0 }}kg
</el-form-item>
<el-form-item :label="$t('入仓重量')">
<el-input-number v-model="shopForm.weight" controls-position="right" :min="0" :max="orderItem.warehouseInInfoVO.weight"></el-input-number>
<el-input-number v-model="shopForm.weight" controls-position="right" :min="0" :max="mainOrderItem.weight"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费重量')">
<el-input-number v-model="shopForm.chargeWeight" controls-position="right" :min="0" :max="orderItem.chargeWeight"></el-input-number>
<el-input-number v-model="shopForm.chargeWeight" controls-position="right" :min="0" :max="mainOrderItem.chargeWeight"></el-input-number>
</el-form-item>
<!--按照原型这里需要显示剩余数量,但是事实无法计算剩余数量,因为已装数量是未知的-->
<el-form-item :label="$t('放入数量(个)')+':'" prop="quantity">
<el-input-number v-model="shopForm.quantity" controls-position="right" :min="0" :max="mainOrderItem.quantity || undefined"></el-input-number>
</el-form-item>
<!-- <el-form-item :label="$t('放入数量(个)')+':'" prop="putQuantity" v-show="isQuantity">
<el-input-number v-model="shopForm.putQuantity" controls-position="right" :min="0"></el-input-number>
</el-form-item> -->
<el-form-item :label="$t('备注信息')+':'">
<el-input v-model="shopForm.remarks"></el-input>
</el-form-item>
......@@ -312,6 +325,9 @@ export default {
lang: 0,
},
isQuantity: false,
// 主单数据
mainOrder: {orderSplitItemBackVOList: {}}
};
},
created() {
......@@ -359,9 +375,10 @@ export default {
return false;
},
// 订单项数据,默认要返回一个如下的空json结构体,避免报错
orderItem(){
if(!this.orderData) return {warehouseInInfoVO:{}}
return this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId) || {warehouseInInfoVO:{}}
// 装柜拆单只能拆一个出来,所以直接用原单数据作为放入品名的最大值限制即可,跟订单操作中的拆单有所区别
mainOrderItem(){
if(!this.shopForm.orderItemId || !this.mainOrder.orderSplitItemBackVOList.length) return {}
return this.mainOrder.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId) || {}
}
},
methods: {
......@@ -378,23 +395,23 @@ export default {
this.getList()
})
},
/* 拆箱总数 */
totalSplitNum() {
/* 拆箱总数,默认计算箱数,传递quantity可计算个数 */
totalSplit(field = 'num') {
let _total = 0;
const { orderSplitItemBackVOList = [] } = this.splitData;
orderSplitItemBackVOList.forEach((v) => {
_total = Decimal.add(_total, Number(v.num)).toNumber();
_total = Decimal.add(_total, Number(v[field])).toNumber();
});
return _total;
},
totalSplitQty() {
/*totalSplitQty() {
let _total = 0;
const { orderSplitItemBackVOList = [] } = this.splitData;
orderSplitItemBackVOList.forEach((v) => {
_total = Decimal.add(_total, Number(v.quantity)).toNumber();
});
return _total;
},
},*/
/* 打开拆单 */
getSplit() {
this.orderItems = this.currRow.goodsList ?? [];
......@@ -406,6 +423,8 @@ export default {
const data = res.data;
// 取拆单项
this.splitData = data.filter((item) => !item.isMaster)?.[0] ?? {};
// 取主单,用语判断放入品名的数据上限
this.mainOrder = data.find(item => item.isMaster)
});
},
itemDisabled(data) {
......@@ -510,7 +529,36 @@ export default {
this.shopOpen = true;
this.isQuantity = false;
},
async changeProdTitleZh() {
// 更改放入品名后触发,计算重量体积等默认值
onProdChange(){
// 根据键值(中文名或者英文名)来获取对应商品的信息,注:这里应该可以采用orderItemId来获取更优,而不是商品名称,同名可能导致异常
let orderItem = this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
console.log({orderItem})
// 剩余可装箱数,订单入仓箱数 - 订单已装箱数 - 已拆箱数
let leftNum = Decimal(this.currRow.num).minus(this.currRow.installNum).minus(this.totalSplit('num'))
// 剩余箱数
this.$set(this.shopForm, 'leftNum', leftNum)
// 如果主单商品项的入仓箱数小于可装箱数,则取商品项数据
leftNum = Math.min(leftNum, this.mainOrderItem.num)
// 放入箱数
this.$set(this.shopForm, 'num', leftNum)
// 装箱比例
const rate = leftNum / this.mainOrderItem.num
// 放入个数,剩余个数是算不出来的,因为不知道已装数量,所以放入数量只能按照总数的比例计算
this.$set(this.shopForm, 'quantity', Math.ceil(this.mainOrderItem.quantity|| 0 * rate))
// 数量,体积,重量等按照比例给默认值
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, 'weight', (this.mainOrderItem.weight * rate).toFixed(2))
this.$set(this.shopForm, 'chargeWeight', (this.mainOrderItem.chargeWeight * rate).toFixed(2))
},
/*async changeProdTitleZh() {
const item = this.setShopForm("zhId");
this.shopForm.enId = item.id;
this.shopForm = { ...this.shopForm };
......@@ -563,7 +611,7 @@ export default {
this.shopForm.num
).toFixed(0);
return data;
},
},*/
async getSelectData(item) {
await quantitycheck({
seaFreightVolume: item.seaFreightVolume,
......@@ -587,6 +635,8 @@ export default {
shopAdd() {
this.$refs["shopForm"].validate((valid) => {
if (valid) {
// 放入箱数自动计算出来的,所以不需要在做判断了
/*
// 输入箱数大于实装箱数
const total = this.totalSplitNum();
const canSplitNum = Decimal.sub(
......@@ -597,19 +647,19 @@ export default {
if (this.shopForm.num > remain) {
this.$message.error(this.$t("放入箱数不能大于总箱数"));
return;
}
}*/
if (this.shopForm.num === 0) {
this.$message.error(this.$t("放入箱数不能为0"));
return;
}
if (this.shopForm.putQuantity === 0 && this.isQuantity) {
if (this.shopForm.quantity === 0 && this.isQuantity) {
this.$message.error(this.$t("放入数量(个)不能为0"));
return;
}
let params = {
num: this.shopForm.putNum,
quantity: this.shopForm.putQuantity,
num: this.shopForm.num,
quantity: this.shopForm.quantity,
orderItemId: this.shopForm.orderItemId,
orderSplitId: this.splitData.id,
remarks: this.shopForm.remarks,
......
......@@ -241,27 +241,36 @@
<el-option v-for="item in splitData[0].orderSplitItemBackVOList" :label="item.prodTitleEn" :value="item.id" :key="item.prodTitleEn" ></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('剩余箱数')">
{{shopForm.sum||0}}
<el-form-item :label2="$t('剩余箱数')" v-if="mainOrderItem.orderItemId">
剩余箱数{{ shopForm.sum || 0 }},可放入箱数:{{ mainOrderItem.num - 1 }}
</el-form-item>
<el-form-item :label="$t('放入箱数')">
<el-input-number v-model="shopForm.num" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
<el-input-number v-model="shopForm.num" @change="numChange" controls-position="right" :min="1" :max="mainOrderItem.num-1"></el-input-number>
</el-form-item>
<el-form-item v-if="quantityshow" :label="$t('放入数量')+'('+$t('个')+')'">
<el-input-number v-model="shopForm.quantity" controls-position="right" :min="1" :max="quantitySum"></el-input-number>
<el-input-number v-model="shopForm.quantity" controls-position="right" :min="1" :max="mainOrderItem.quantity-1" :placeholder="$t('最多可放入{quantity}', {
quantity: mainOrderItem.quantity-1
})"></el-input-number>
</el-form-item>
<el-form-item :label="$t('入仓体积')">
<el-input-number v-model="shopForm.volume" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
<el-form-item v-if="mainOrderItem.orderItemId">
<div>{{ $t('剩余入仓方数') }}:{{ mainOrderItem.volume || 0 }}m³,{{$t('可放入仓方数')}}:{{ (mainOrderItem.volume - 0.01).toFixed(2) }}m³</div>
<div>{{$t('剩余收费方数')}}:{{ mainOrderItem.chargeVolume || 0 }}m³,{{$t('可放入收费方数')}}:{{ (mainOrderItem.chargeVolume - 0.01).toFixed(2) }}m³</div>
</el-form-item>
<el-form-item :label="$t('入仓方数')">
<el-input-number v-model="shopForm.volume" controls-position="right" :min="0" :max="(mainOrderItem.volume - 0.01).toFixed(2)"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费方数')">
<el-input-number v-model="shopForm.chargeVolume" controls-position="right" :min="0" :max="(mainOrderItem.chargeVolume - 0.01).toFixed(2)"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费体积')">
<el-input-number v-model="shopForm.chargeVolume" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
<el-form-item v-if="mainOrderItem.orderItemId">
<div>{{$t('剩余入仓重量')}}:{{ mainOrderItem.weight || 0 }}kg,{{$t('可放入重量')}}:{{ (mainOrderItem.weight - 0.01).toFixed(2) }}kg</div>
<div>{{$t('剩余收费重量')}}:{{ mainOrderItem.chargeWeight || 0 }}kg,{{$t('可放入收费重量')}}:{{ (mainOrderItem.chargeWeight - 0.01).toFixed(2) }}kg</div>
</el-form-item>
<el-form-item :label="$t('入仓重量')">
<el-input-number v-model="shopForm.weight" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
<el-input-number v-model="shopForm.weight" controls-position="right" :min="0" :max="(mainOrderItem.weight - 0.01).toFixed(2)"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费重量')">
<el-input-number v-model="shopForm.chargeWeight" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
<el-input-number v-model="shopForm.chargeWeight" controls-position="right" :min="0" :max="(mainOrderItem.chargeWeight - 0.01).toFixed(2)"></el-input-number>
</el-form-item>
<el-form-item :label="$t('备注信息')+':'">
......@@ -389,6 +398,16 @@ export default {
},
getDictDatas(){
return getDictDatas
},
// 放入品名试选择的商品项
orderItem(){
if(!this.orderData || !this.shopForm.orderItemId) return {}
return this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId) || {}
},
// 主单数据,也就是拆分剩余的数据,可用来限制拆单放入的最大值
mainOrderItem(){
if(!this.orderItem.orderItemId || !this.splitData.length || !this.splitData[0].orderSplitItemBackVOList) return {}
return this.splitData[0].orderSplitItemBackVOList.find(item => item.orderItemId == this.orderItem.orderItemId) || {}
}
},
methods: {
......@@ -573,9 +592,16 @@ export default {
this.quantityshow = res.data
})
},
// 输入方数箱数后,按照平均值计算数量和体积重量数据
numChange(){
var sum = parseInt(this.quantitySum/this.shopForm.num)
this.$set(this.shopForm,'quantity',sum)
/*var sum = parseInt(this.quantitySum/this.shopForm.num)
this.$set(this.shopForm,'quantity',sum)*/
let rate = this.shopForm.num/this.mainOrderItem.num
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, 'chargeVolume', (this.mainOrderItem.chargeVolume * 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))
},
changeProdTitleEn(){
var list = []
......
......@@ -13,14 +13,14 @@
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span>{{ $t('中文品名') }}</template>
<span style="min-width: 200px;margin-right: 15px;display: inline-block">
<product-selector v-if="!order.parentOrderId && !isAdd" v-model="form.prodId" @change="onProductChange"/>
<product-selector v-if="!order.parentOrderId && !isAdd" v-model="form.prodId" @change="onProductChange" determined/>
<span v-else>{{ warehousing.prodTitleZh }}</span>
</span>
<el-button v-if="!order.parentOrderId && !isAdd" type="text" @click="isShowProduct = true">添加新商品</el-button>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span>{{ $t('英文品名') }}</template>
<product-selector v-if="!order.parentOrderId && !isAdd" lang="En" v-model="form.prodId" @change="onProductChange"/>
<product-selector v-if="!order.parentOrderId && !isAdd" lang="En" v-model="form.prodId" @change="onProductChange" determined/>
<span v-else>{{ warehousing.prodTitleEn }}</span>
</el-descriptions-item>
<el-descriptions-item :label="$t('品牌')">
......
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