|
|
@@ -100,10 +100,10 @@
|
|
|
<li v-for="(item, index) in chooseItem.prices" v-bind:key="index">
|
|
|
<div class="clearfix">
|
|
|
<div class="pull-left">
|
|
|
- <input type="number" placeholder="数量" class="otherNumber" :class="{firstNumber: index === 0}" v-model.lazy="item.start" :disabled="index === 0" :readonly="index === 0" @blur="startpriceBlur(item, index)" maxlength="9"/>
|
|
|
+ <input type="number" placeholder="数量" class="otherNumber" :class="{firstNumber: index === 0}" @change="startpriceBlur(item, index)" v-model="item.start" :disabled="index === 0" :readonly="index === 0" @blur="startpriceBlur(item, index)" maxlength="9"/>
|
|
|
<label v-if="index !== chooseItem.prices.length - 1">-</label>
|
|
|
<label v-if="index === chooseItem.prices.length - 1">以上</label>
|
|
|
- <input type="number" placeholder="数量" class="otherNumber" v-model.lazy="item.end" v-if="index !== chooseItem.prices.length - 1" @blur="endpriceBlur(item, index)" maxlength="9"/>
|
|
|
+ <input type="number" placeholder="数量" class="otherNumber" v-model="item.end" v-if="index !== chooseItem.prices.length - 1" @blur="endpriceBlur(item, index)" maxlength="9" @change="endpriceBlur(item, index)"/>
|
|
|
</div>
|
|
|
<div class="pull-right">
|
|
|
<template v-if="chooseItem.currencyName == 'RMB'">
|
|
|
@@ -273,7 +273,12 @@
|
|
|
// 开始价格阶段失去焦点
|
|
|
startpriceBlur(item, index) {
|
|
|
if (index > 0) {
|
|
|
- if (item.start <= this.chooseItem.prices[index - 1].start) {
|
|
|
+ if (item.start === '' || toString(item.start).trim() === '') {
|
|
|
+ this.timeoutCount++
|
|
|
+ this.collectResult = '输入值不能为空'
|
|
|
+ item.start = ''
|
|
|
+ return false
|
|
|
+ } else if (Math.abs(item.start) <= Math.abs(this.chooseItem.prices[index - 1].start)) {
|
|
|
this.timeoutCount++
|
|
|
this.collectResult = '输入值会导致梯度重叠,请重新修改'
|
|
|
item.start = ''
|
|
|
@@ -283,29 +288,36 @@
|
|
|
this.chooseItem.prices[index - 1].end = item.start - 1
|
|
|
return false
|
|
|
}
|
|
|
- if (item.start > item.end) {
|
|
|
+ if (item.end && toString(item.end).trim() !== '' && Math.abs(item.start) > Math.abs(item.end)) {
|
|
|
this.timeoutCount++
|
|
|
this.collectResult = `输入值必须小于${item.end}`
|
|
|
item.start = ''
|
|
|
return false
|
|
|
}
|
|
|
this.chooseItem.prices[index - 1].end = item.start - 1
|
|
|
+ console.log(this.chooseItem.prices)
|
|
|
}
|
|
|
},
|
|
|
// 结束价格阶段失去焦点
|
|
|
endpriceBlur(item, index) {
|
|
|
- if (this.chooseItem.prices[index + 1].end !== '' && toString(this.chooseItem.prices[index + 1].end).trim() !== '' && Math.abs(item.end) + 1 >= this.chooseItem.prices[index + 1].end) {
|
|
|
+ if (item.end === '' && toString(item.end).trim() === '') {
|
|
|
+ this.timeoutCount++
|
|
|
+ this.collectResult = `输入值不能为空`
|
|
|
+ item.end = ''
|
|
|
+ return false
|
|
|
+ } else if (this.chooseItem.prices[index + 1].end !== '' && toString(this.chooseItem.prices[index + 1].end).trim() !== '' && Math.abs(item.end) + 1 >= Math.abs(this.chooseItem.prices[index + 1].end)) {
|
|
|
this.timeoutCount++
|
|
|
this.collectResult = `输入值不能大于${this.chooseItem.prices[index + 1].end - 1}`
|
|
|
item.end = ''
|
|
|
return false
|
|
|
- } else if (item.start !== '' && toString(item.start).trim() !== '' && Math.abs(item.end) + 1 <= item.start) {
|
|
|
+ } else if (Math.abs(item.end) + 1 <= Math.abs(item.start)) {
|
|
|
this.timeoutCount++
|
|
|
this.collectResult = `输入值不能小于${item.start}`
|
|
|
item.end = ''
|
|
|
return false
|
|
|
}
|
|
|
this.chooseItem.prices[index + 1].start = Math.abs(item.end) + 1
|
|
|
+ console.log(this.chooseItem.prices)
|
|
|
},
|
|
|
// 交期失去焦点
|
|
|
minDeliveryBlur() {
|
|
|
@@ -317,7 +329,7 @@
|
|
|
},
|
|
|
// 单价失去焦点
|
|
|
rMBPriceBlur(item) {
|
|
|
- if (!/^[0-9]+([.]{1}[1-9]+)?$/.test(item.rMBPrice)) {
|
|
|
+ if (!/^[0-9]+([.]{1}[0-9]+)?$/.test(item.rMBPrice)) {
|
|
|
this.timeoutCount++
|
|
|
this.collectResult = '单价只能输入数字'
|
|
|
return false
|
|
|
@@ -419,7 +431,8 @@
|
|
|
this.collectResult = '分段数量必须是正整数'
|
|
|
isHas = true
|
|
|
break
|
|
|
- } else if (!/^[0-9]+([.]{1}[1-9]{1,6})?$/.test(this.chooseItem.prices[i].rMBPrice)) {
|
|
|
+ } else if (!/^[0-9]+([.]{1}[0-9]{1,6})?$/.test(this.chooseItem.prices[i].rMBPrice)) {
|
|
|
+ console.log(this.chooseItem.prices[i].rMBPrice)
|
|
|
this.timeoutCount++
|
|
|
this.collectResult = '单价只能输入数字'
|
|
|
isHas = true
|