Commit 1e64dc2e by cwq0219

编辑商品-到店价,零售价格比较

1 parent c06290aa
......@@ -76,6 +76,7 @@
:disabled="item.isDisabled"
clearable
@input="item.handleInput"
@blur="item.handleBlur"
>
<i
slot="suffix"
......
......@@ -78,6 +78,7 @@
placeholder="请输入建议到店价格"
class="dis-in-block"
@input="handleShopPrice"
@blur="handleShopPriceBlur"
>
<i
slot="suffix"
......@@ -285,7 +286,7 @@ export default {
upgradePrice: [
{ required: true, message: '请输入建议升级价', trigger: 'blur' },
{ required: true,
trigger: 'change',
trigger: 'blur',
validator: (rule, value, callback) => {
(+value < +this.proInfo.shopPrice) ? callback(new Error('建议升级价需要大于或等于到店价格')) : callback()
}
......@@ -358,8 +359,12 @@ export default {
handleShopPrice(newVal) {
this.proInfo.shopPrice = limitPrice(newVal, this.oldVal.shopPrice, 6, 2)
this.oldVal.shopPrice = this.proInfo.shopPrice
var validateObj = (this.proInfo.shopPrice <= this.proInfo.upgradePrice) ? 'clearValidate' : 'validateField'
this.$refs.proRuleForm1[validateObj]('upgradePrice')
},
handleShopPriceBlur() {
if (this.proInfo.upgradePrice) {
var validateObj = (this.proInfo.shopPrice <= this.proInfo.upgradePrice) ? 'clearValidate' : 'validateField'
this.$refs.proRuleForm1[validateObj]('upgradePrice')
}
},
handleMaxUpgradeDiscount(newVal) {
this.proInfo.maxUpgradeDiscount = limitPrice(newVal, this.oldVal.maxUpgradeDiscount, 1, 1, 1)
......
......@@ -54,7 +54,7 @@ export default {
retailPrice: [
{ required: true, message: '请输入零售价格', trigger: 'blur' },
{ required: true,
trigger: 'change',
trigger: 'blur',
validator: (rule, value, callback) => {
(+value < +this.markOldVal.shopPrice) ? callback(new Error('配置零售价格需要大于或等于到店价格')) : callback()
}
......@@ -98,11 +98,15 @@ export default {
label: '到店价格',
type: 'input',
unit: '元',
handleBlur: () => {
if (this.markOldVal.retailPrice) {
var validateObj = (this.markOldVal.shopPrice <= this.markOldVal.retailPrice) ? 'clearValidate' : 'validateField'
this.$refs.d2Form.$refs[this.comFormRef + 'd2FormRuleForm'][validateObj]('retailPrice')
}
},
handleInput: (newVal) => {
this.$refs.d2Form.formData.shopPrice = limitPrice(newVal, this.markOldVal.shopPrice, 6, 2)
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',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!