Commit 17f1ec4c by cwq0219

限制

1 parent 1ad15c63
......@@ -150,29 +150,29 @@ export default {
maxlength: '50'
}
]
},
{
title: '新车优惠政策',
editFormData: [
{
label: '优惠政策',
name: 'police',
type: 'input',
inputType: 'textarea',
width: '320px',
maxlength: '300'
}
]
},
{
title: '在线客服',
editFormData: [
{
label: '',
addHtml: 'onlineService'
}
]
}
// {
// title: '新车优惠政策',
// editFormData: [
// {
// label: '优惠政策',
// name: 'police',
// type: 'input',
// inputType: 'textarea',
// width: '320px',
// maxlength: '300'
// }
// ]
// },
// {
// title: '在线客服',
// editFormData: [
// {
// label: '',
// addHtml: 'onlineService'
// }
// ]
// }
]
}
},
......
......@@ -135,16 +135,16 @@
<td :style="{ width: specsWidth }" v-for="(n, idx) in subItem.specsValueList" :key="idx">{{ n }}</td>
<td :style="{ width: specsWidth }">
<div v-if="routeInfo.groupOrStore == 1">
<el-input :disabled="isDisabled" :class="{ 'border-red': (!(subItem.retailPrice + '') || +editForm.supplyPrice > +subItem.retailPrice) && submitted }" placeholder="零售价" v-model="subItem.retailPrice" ng-blur="handleBlur()">
<el-input :disabled="isDisabled" :class="{ 'border-red': (!(subItem.retailPrice + '') || +editForm.supplyPrice > +subItem.retailPrice) && submitted }" placeholder="零售价" v-model="subItem.retailPrice" @input.native="e => handleRetailPriceInput(e, subIndex)">
<el-popover v-show="(!(subItem.retailPrice + '') || +editForm.supplyPrice > +subItem.retailPrice) && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="!(subItem.retailPrice + '') ? '零售价是必填项' : '零售价要大于供货价'">
<i class="el-icon-warning color-red" slot="reference"></i>
</el-popover>
</el-input>
</div>
<el-input :disabled="isDisabled" v-else placeholder="零售价" v-model="subItem.retailPrice" ng-blur="handleBlur()"></el-input>
<el-input :disabled="isDisabled" v-else placeholder="零售价" v-model="subItem.retailPrice" @input.native="e => handleRetailPriceInput(e, subIndex)"></el-input>
</td>
<td :style="{ width: specsWidth }">
<el-input :disabled="isDisabled" placeholder="库存" v-model="subItem.stock" :class="{ 'border-red': !(subItem.stock + '') && submitted }">
<el-input :disabled="isDisabled" placeholder="库存" v-model="subItem.stock" :class="{ 'border-red': !(subItem.stock + '') && submitted }" @input.native="e => handleStockInput(e, subIndex)">
<el-popover v-show="!(subItem.stock + '') && submitted" slot="suffix" placement="top" title="" width="90" trigger="hover" content="库存是必填项">
<i class="el-icon-warning color-red" slot="reference"></i>
</el-popover>
......@@ -217,6 +217,7 @@
</template>
<script>
import { limitPrice } from '@/common/constant'
export default {
name: 'editProduct',
data() {
......@@ -262,6 +263,12 @@ export default {
specificationDetailList: [],
nameToValSpecsList: [],
minRetailPrice: '',
/* eslint-disable */
reg: {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/
},
/* eslint-enable */
// 添加规格弹窗
isSpescVisible: false,
spescRules: {
......@@ -563,6 +570,29 @@ export default {
}
},
watch: {
// 零售价
'editForm.retailPrice'(newValue, oldValue) {
this.editForm.retailPrice = limitPrice(newValue, oldValue, 5, 2)
},
// 划线价
'editForm.originalPrice'(newValue, oldValue) {
this.editForm.originalPrice = limitPrice(newValue, oldValue, 5, 2)
},
// 供货价
'editForm.supplyPrice'(newValue, oldValue) {
this.editForm.supplyPrice = limitPrice(newValue, oldValue, 5, 2)
},
// 库存
'editForm.goodsStock'(newValue, oldValue) {
this.editForm.goodsStock = limitPrice(newValue, oldValue, 10, 0, 0, 10000000000, 'numReg')
},
// 运费
'editForm.expressFee'(newValue, oldValue) {
this.editForm.expressFee = limitPrice(newValue, oldValue, 5, 2, 0, 100000)
}
},
mounted() {
this.userInfo = this.$globalState.session
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
......@@ -631,6 +661,28 @@ export default {
this.externalFormList[1].editFormData[idx].isHide = !!this.specificationDetailList.length
})
},
handleRetailPriceInput(e, idx) {
var newValue = e.target.value
if (!this.reg.priceReg.test(newValue)) {
newValue = ''
}
var oldValue = newValue
if (e.key != 'Backspace' && newValue.length > 1) {
oldValue = newValue.slice(0, newValue.length - 1)
}
this.nameToValSpecsList[idx].retailPrice = limitPrice(newValue, oldValue, 5, 2)
},
handleStockInput(e, idx) {
var newValue = e.target.value
if (!this.reg.priceReg.test(newValue)) {
newValue = ''
}
var oldValue = newValue
if (e.key != 'Backspace' && newValue.length > 1) {
oldValue = newValue.slice(0, newValue.length - 1)
}
this.nameToValSpecsList[idx].stock = limitPrice(newValue, oldValue, 10, 0, 0, 10000000000, 'numReg')
},
// 二次确认
secondSimpleConfirm(title, txt, fn) {
this.$confirm(txt, title, {
......
......@@ -74,11 +74,11 @@ export default {
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '专区来源',
prop: ''
}
// {
// label: '专区来源',
// prop: ''
// }
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!