Commit 0ecd4aa1 by cwq0219

编辑商品-到店价<零售价格

1 parent 099e3ead
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
</el-form> </el-form>
</div> </div>
<div class="relateProDialog flex"> <div class="relateProDialog flex">
<span style="width: 180px;">分配给导流方 (4S门店)</span> <span class="sub-title">分配给导流方 (4S门店)</span>
<el-form <el-form
:model="proInfo" :model="proInfo"
:rules="rules" :rules="rules"
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
</el-form> </el-form>
</div> </div>
<div class="relateProDialog flex"> <div class="relateProDialog flex">
<span style="width: 180px;">分配给合伙人 (合作商)</span> <span class="sub-title">分配给合伙人 (合作商)</span>
<el-form <el-form
:model="proInfo" :model="proInfo"
:rules="rules" :rules="rules"
...@@ -282,15 +282,15 @@ export default { ...@@ -282,15 +282,15 @@ export default {
}, },
rules: { rules: {
goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'change' }], goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'change' }],
upgradePrice: [{ required: true, message: '请输入建议升级价', trigger: 'blur' }], upgradePrice: [
shopPrice: [ { required: true, message: '请输入建议升级价', trigger: 'blur' },
{ required: true, message: '请输入到店价', trigger: 'blur' }, { required: true,
{ trigger: 'blur', trigger: 'change',
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
(+value > +this.proInfo.upgradePrice) ? callback(new Error('到店价需小于建议升级价格')) : callback() (+value < +this.proInfo.shopPrice) ? callback(new Error('建议升级价需要大于或等于到店价格')) : callback()
} }
} }],
], shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }],
profitType: [{ required: true, message: '请输入分润规则', trigger: 'change' }], profitType: [{ required: true, message: '请输入分润规则', trigger: 'change' }],
profitValue: [{ required: true, message: '请输入分润比例', trigger: 'blur' }], profitValue: [{ required: true, message: '请输入分润比例', trigger: 'blur' }],
partnerProfitPer: [{ required: true, message: '请输入分润比例', trigger: 'blur' }] partnerProfitPer: [{ required: true, message: '请输入分润比例', trigger: 'blur' }]
...@@ -358,6 +358,8 @@ export default { ...@@ -358,6 +358,8 @@ export default {
handleShopPrice(newVal) { handleShopPrice(newVal) {
this.proInfo.shopPrice = limitPrice(newVal, this.oldVal.shopPrice, 6, 2) this.proInfo.shopPrice = limitPrice(newVal, this.oldVal.shopPrice, 6, 2)
this.oldVal.shopPrice = this.proInfo.shopPrice this.oldVal.shopPrice = this.proInfo.shopPrice
var validateObj = (this.proInfo.shopPrice <= this.proInfo.upgradePrice) ? 'clearValidate' : 'validateField'
this.$refs.proRuleForm1[validateObj]('upgradePrice')
}, },
handleMaxUpgradeDiscount(newVal) { handleMaxUpgradeDiscount(newVal) {
this.proInfo.maxUpgradeDiscount = limitPrice(newVal, this.oldVal.maxUpgradeDiscount, 1, 1, 1) this.proInfo.maxUpgradeDiscount = limitPrice(newVal, this.oldVal.maxUpgradeDiscount, 1, 1, 1)
...@@ -391,6 +393,11 @@ export default { ...@@ -391,6 +393,11 @@ export default {
.relateProDialog.flex { .relateProDialog.flex {
display: flex; display: flex;
} }
.relateProDialog .sub-title {
display: inline-block;
height: 52px;
line-height: 36px;
}
.relateProDialog .w-50 { .relateProDialog .w-50 {
display: inline-block; display: inline-block;
width: 50%; width: 50%;
......
...@@ -50,11 +50,13 @@ export default { ...@@ -50,11 +50,13 @@ export default {
rules: { rules: {
yqMerchantId: [{ required: true, message: '请选择园区店', trigger: 'change' }], yqMerchantId: [{ required: true, message: '请选择园区店', trigger: 'change' }],
goodsCode: [{ required: true, message: '请选择产品名称', trigger: 'change' }], goodsCode: [{ required: true, message: '请选择产品名称', trigger: 'change' }],
shopPrice: [ shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }],
{ required: true, message: '请输入到店价', trigger: 'blur' }, retailPrice: [
{ trigger: 'blur', { required: true, message: '请输入零售价格', trigger: 'blur' },
{ required: true,
trigger: 'change',
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
(+value > +this.markOldVal.retailPrice) ? callback(new Error('到店价需小于建议升级价')) : callback() (+value < +this.markOldVal.shopPrice) ? callback(new Error('配置零售价格需要大于或等于到店价格')) : callback()
} }
} }
], ],
...@@ -99,6 +101,8 @@ export default { ...@@ -99,6 +101,8 @@ export default {
handleInput: (newVal) => { handleInput: (newVal) => {
this.$refs.d2Form.formData.shopPrice = limitPrice(newVal, this.markOldVal.shopPrice, 6, 2) this.$refs.d2Form.formData.shopPrice = limitPrice(newVal, this.markOldVal.shopPrice, 6, 2)
this.markOldVal.shopPrice = this.$refs.d2Form.formData.shopPrice this.markOldVal.shopPrice = this.$refs.d2Form.formData.shopPrice
var validateObj = (this.markOldVal.shopPrice <= this.markOldVal.retailPrice) ? 'clearValidate' : 'validateField'
this.$refs.d2Form.$refs[this.comFormRef + 'd2FormRuleForm'][validateObj]('retailPrice')
} }
}, { }, {
name: 'retailPrice', name: 'retailPrice',
...@@ -164,6 +168,7 @@ export default { ...@@ -164,6 +168,7 @@ export default {
}), }),
linkMerchantIds: res.merchantRefList ? res.merchantRefList.map(item => Object.assign(item, item.merchantInfo)) : [] linkMerchantIds: res.merchantRefList ? res.merchantRefList.map(item => Object.assign(item, item.merchantInfo)) : []
} }
this.markOldVal.shopPrice = res.shopPrice
this.markOldVal.retailPrice = res.retailPrice this.markOldVal.retailPrice = res.retailPrice
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!