Commit dc4992f3 authored by dragondean@qq.com's avatar dragondean@qq.com

完善订单拆单的最大值限制和计算平均数

parent 8e99a6d9
......@@ -240,33 +240,42 @@
<el-select v-model="shopForm.pordid" :placeholder="$t('请选择英文品名')" @change="changeProdTitleZh" clearable>
<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>
<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-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-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>
<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>
<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-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-form-item>
</el-form-item>
<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="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="mainOrderItem.quantity-1" :placeholder="$t('最多可放入{quantity}', {
quantity: mainOrderItem.quantity-1
})"></el-input-number>
</el-form-item>
<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 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" 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" controls-position="right" :min="0" :max="(mainOrderItem.chargeWeight - 0.01).toFixed(2)"></el-input-number>
</el-form-item>
<el-form-item :label="$t('备注信息')+':'">
<el-input v-model="shopForm.remark"></el-input>
</el-form-item>
<el-form-item :label="$t('备注信息')+':'">
<el-input v-model="shopForm.remark"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="shopAdd">{{$t('确定')}}</el-button>
......@@ -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 = []
......
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