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

最小起计量和阶梯价的特需

parent 5ea7e595
......@@ -97,17 +97,17 @@
-
<el-input v-model="item.endNum" type="number" placeholder="" class="w-100"></el-input>
/
<selector v-model="item.weightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector :disabled="index > 0" v-model="item.weightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认运费')" v-if="form.priceType != 1" :prop="`priceStepList.${index}.transportPrice`" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<inputor default2="0" v-model.number="item.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10"/>
<selector v-model="item.transportPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector v-model="item.transportVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector :disabled="index > 0" v-model="item.transportPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector :disabled="index > 0" v-model="item.transportVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认清关费')" v-if="form.priceType != 1" :prop="`priceStepList.${index}.transportPrice`" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<inputor default2="0" v-model.number="item.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"/>
<selector v-model="item.clearancePriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector v-model="item.clearanceVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector :disabled="index > 0" v-model="item.clearancePriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector :disabled="index > 0" v-model="item.clearanceVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item
......@@ -116,14 +116,21 @@
:prop="`priceStepList.${index}.allPrice`"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
>
<selector v-model="item.allPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector :disabled="index > 0" v-model="item.allPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<inputor default2="0" v-model.number="item.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 ml-10" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"/>
/ <selector v-model="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector :disabled="index > 0" v-model="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</div>
</template>
<template v-else>
<el-form-item
:label="$t('最小起计量')"
:prop="`minWeight`"
>
<inputor default2="0" v-model.number="form.minWeight" type="number" class="w-100" :rules="{validator: priceValidator, trigger: 'blur', message: '数量错误'}"/>
/ <selector v-model="form.minWeightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" disabled />
</el-form-item>
<el-form-item :label="$t('默认全包价')" v-if="form.priceType == 1" prop="allPrice" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<selector test="allPriceUnit" v-model="form.allPriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100 mr-10 aaa" />
<inputor default2="0" v-model.number="form.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr10" />
......@@ -145,6 +152,7 @@
</el-form-item>
</template>
</template>
<!--特需-->
<template v-if="form.priceType==1">
<el-form-item
......@@ -184,7 +192,7 @@
<selector disabled v-model="special.clearanceVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</template>
</template>
<el-form-item :label="$t('价格有效期')">
<el-date-picker v-model="form.validateStartDate" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
......@@ -418,36 +426,48 @@ export default {
if(priceType == 1){
this.$set(this.form, 'allPriceUnit', 1)
}
this.syncAllUnit()
},
'form.transportVolumeUnit'(val){
this.form.specialList.forEach(item => {
'form.transportVolumeUnit'(transportVolumeUnit){
// 最小其计量
this.$set(this.form, 'minWeightUnit', transportVolumeUnit)
/* this.form.specialList.forEach(item => {
item.transportVolumeUnit = val
})
}) */
this.syncSpecialUnit({transportVolumeUnit})
},
'form.clearanceVolumeUnit'(val){
this.form.specialList.forEach(item => {
'form.clearanceVolumeUnit'(clearanceVolumeUnit){
/* this.form.specialList.forEach(item => {
item.clearanceVolumeUnit = val
})
}) */
this.syncSpecialUnit({clearanceVolumeUnit})
},
'form.transportPriceUnit'(val){
this.form.specialList.forEach(item => {
'form.transportPriceUnit'(transportPriceUnit){
/* this.form.specialList.forEach(item => {
item.transportPriceUnit = val
})
}) */
this.syncSpecialUnit({transportPriceUnit})
},
'form.clearancePriceUnit'(val){
this.form.specialList.forEach(item => {
'form.clearancePriceUnit'(clearancePriceUnit){
/* this.form.specialList.forEach(item => {
item.clearancePriceUnit = val
})
}) */
this.syncSpecialUnit({clearancePriceUnit})
},
'form.allPriceUnit'(val){
this.form.specialList.forEach(item => {
'form.allPriceUnit'(allPriceUnit){
/* this.form.specialList.forEach(item => {
item.allPriceUnit = val
})
}) */
this.syncSpecialUnit({allPriceUnit})
},
'form.allVolumeUnit'(val){
this.form.specialList.forEach(item => {
'form.allVolumeUnit'(allVolumeUnit){
// 最小其计量
this.$set(this.form, 'minWeightUnit', allVolumeUnit)
this.syncSpecialUnit({allVolumeUnit})
/* this.form.specialList.forEach(item => {
item.allVolumeUnit = val
})
}) */
},
'form.needBook'(val){
if(val) this.$set(this.form, 'dayLimit', 10000)
......@@ -457,6 +477,50 @@ export default {
if(stepPrice == 1 && (!this.form.priceStepList || !this.form.priceStepList.length)){
this.$set(this.form, 'priceStepList', [{},{}])
}
this.syncAllUnit()
},
// 添加区间价的时候需要对新增的区间价给初始单位
'form.priceStepList'(){
this.syncAllUnit()
/* this.syncSpecialUnit({
weightUnit: priceStepList[0].weightUnit,
transportPriceUnit: priceStepList[0].transportPriceUnit,
transportVolumeUnit: priceStepList[0].transportVolumeUnit,
clearancePriceUnit: priceStepList[0].clearancePriceUnit,
clearanceVolumeUnit: priceStepList[0].clearanceVolumeUnit,
allPriceUnit: priceStepList[0].allPriceUnit,
allVolumeUnit: priceStepList[0].allVolumeUnit,
}) */
},
// 第一阶梯的 重量单位
'form.priceStepList.0.weightUnit'(weightUnit){
this.syncSpecialUnit({weightUnit})
},
// 第一阶梯的 运费货币单位
'form.priceStepList.0.transportPriceUnit'(transportPriceUnit){
this.syncSpecialUnit({transportPriceUnit})
},
// 第一阶梯的 运费体积单位
'form.priceStepList.0.transportVolumeUnit'(transportVolumeUnit){
this.syncSpecialUnit({transportVolumeUnit})
},
// 第一阶梯的 清关费货币单位
'form.priceStepList.0.clearancePriceUnit'(clearancePriceUnit){
this.syncSpecialUnit({clearancePriceUnit})
},
// 第一阶梯的 清关费体积单位
'form.priceStepList.0.clearanceVolumeUnit'(clearanceVolumeUnit){
this.syncSpecialUnit({clearanceVolumeUnit})
},
// 第一阶梯价 全包价 货币单位
'form.priceStepList.0.allPriceUnit'(allPriceUnit){
// 同步特需价格单位
this.syncSpecialUnit({allPriceUnit})
},
// 第一阶梯价 全包价 体积单位
'form.priceStepList.0.allVolumeUnit'(allVolumeUnit){
// 同步特需价格单位
this.syncSpecialUnit({allVolumeUnit})
},
needPay(val){
this.$set(this.form, 'needPay', val ? 1 : 0)
......@@ -615,6 +679,51 @@ export default {
},
methods: {
// 同步全部单位
syncAllUnit(){
let obj = this.form.stepPrice == 1 ? this.form.priceStepList[0] : this.form
let fields = {}
// 全包价
if(this.form.priceType == 1){
fields = {
allPriceUnit: obj['allPriceUnit'],
allVolumeUnit: obj['allVolumeUnit']
}
}else{
fields = {
transportPriceUnit: obj.transportPriceUnit,
transportVolumeUnit: obj.transportVolumeUnit,
clearancePriceUnit: obj.clearancePriceUnit,
clearanceVolumeUnit: obj.clearanceVolumeUnit,
}
}
if(this.form.stepPrice == 1){
fields['weightUnit'] = this.form.priceStepList[0].weightUnit
}
this.syncSpecialUnit(fields)
},
// 同步特需的货币单位和体积单位
syncSpecialUnit(obj){
if(!obj) return
// 同步特需单位
this.form.specialList.forEach(item => {
Object.assign(item, obj)
})
// 如果是阶梯价则需要同步其他阶梯
if(this.form.stepPrice == 1){
this.form.priceStepList.forEach(item => {
Object.assign(item, obj)
})
}
// 不是阶梯价需要 同步最小起计量
if(obj['transportVolumeUnit'] || obj['allVolumeUnit']){
this.$set(this.form, 'minWeightUnit', obj['transportVolumeUnit'] || obj['allVolumeUnit'])
}
},
priceValidator(rule, value, callback){
if(!value || value == '') return callback()
value = parseFloat(value)
......
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