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

阶梯价格设置提示运费不能为空

parent 73372e74
......@@ -97,17 +97,17 @@
-
<el-input v-model="item.endNum" type="number" placeholder="" class="w-100"></el-input>
/
<selector :disabled="index > 0" v-model="item.weightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector :disabled="index > 0" @input="syncAllUnit" 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 :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" />
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.transportPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector :disabled="index > 0" @input="syncAllUnit" 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 :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" />
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.clearancePriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector :disabled="index > 0" @input="syncAllUnit" 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,9 +116,9 @@
:prop="`priceStepList.${index}.allPrice`"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
>
<selector :disabled="index > 0" v-model="item.allPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector :disabled="index > 0" @input="syncAllUnit" 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 :disabled="index > 0" v-model="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</div>
</template>
......@@ -336,7 +336,7 @@ export default {
checkList: [],
selectedRoutes: [], // 勾选的路线渠道
form: {
priceStepList: [{},{}], // 阶梯价格
priceStepList: [], // 阶梯价格
specialList: []
},
needPay: false, // 是否需要预付
......@@ -431,43 +431,24 @@ export default {
'form.transportVolumeUnit'(transportVolumeUnit){
// 最小其计量
this.$set(this.form, 'minWeightUnit', transportVolumeUnit)
/* this.form.specialList.forEach(item => {
item.transportVolumeUnit = val
}) */
this.syncSpecialUnit({transportVolumeUnit})
},
'form.clearanceVolumeUnit'(clearanceVolumeUnit){
/* this.form.specialList.forEach(item => {
item.clearanceVolumeUnit = val
}) */
this.syncSpecialUnit({clearanceVolumeUnit})
},
'form.transportPriceUnit'(transportPriceUnit){
/* this.form.specialList.forEach(item => {
item.transportPriceUnit = val
}) */
this.syncSpecialUnit({transportPriceUnit})
},
'form.clearancePriceUnit'(clearancePriceUnit){
/* this.form.specialList.forEach(item => {
item.clearancePriceUnit = val
}) */
this.syncSpecialUnit({clearancePriceUnit})
},
'form.allPriceUnit'(allPriceUnit){
/* this.form.specialList.forEach(item => {
item.allPriceUnit = val
}) */
this.syncSpecialUnit({allPriceUnit})
},
'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)
......@@ -479,49 +460,6 @@ export default {
}
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)
},
......@@ -698,14 +636,16 @@ export default {
}
}
// 全包价还需要同步阶梯的重量单位
if(this.form.stepPrice == 1){
fields['weightUnit'] = this.form.priceStepList[0].weightUnit
fields['weightUnit'] = obj.weightUnit
}
this.syncSpecialUnit(fields)
},
// 同步特需的货币单位和体积单位
syncSpecialUnit(obj){
console.log('syncSpecialUnit', obj)
if(!obj) return
// 同步特需单位
this.form.specialList.forEach(item => {
......@@ -714,8 +654,8 @@ export default {
// 如果是阶梯价则需要同步其他阶梯
if(this.form.stepPrice == 1){
this.form.priceStepList.forEach(item => {
Object.assign(item, obj)
this.form.priceStepList.forEach((item, index) => {
this.$set(this.form.priceStepList, index, Object.assign(item, obj))
})
}
......@@ -817,9 +757,27 @@ export default {
data.productId = this.product.id;
data.lineChannelList = this.lineList.length ? this.lineList : this.selectedRoutes
if(this.form.stepPrice != 1){
// 非阶梯价格判断是否运费(全包价是否为空)
if((this.form.priceType == 0 && !this.form.transportPrice) || (this.form.priceType == 1 && !this.form.allPrice)){
return this.$message.error(this.$t('运费/全包价不能为0'))
}
}else{
// 全包价 的阶段 设置和运费(全包价)不能为空
let stepPriceEmpty = false
this.form.priceStepList.forEach(item => {
if(!item.startNum || !item.endNum || !item.weightUnit){
stepPriceEmpty = true
}
if((this.form.priceType == 0 && !item.transportPrice) || (this.form.priceType == 1 && !item.allPrice)){
stepPriceEmpty = true
}
})
if(stepPriceEmpty){
return this.$message.error(this.$t('阶梯价格设置不能留空'))
}
}
this.loading = true
createProductPrice(data).then(response => {
this.$modal.msgSuccess(this.$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