Commit 5fc17fdf by zhangquan

格式化价格修改

1 parent dc016849
......@@ -68,6 +68,9 @@
<div class="global-title">规格和成本设置</div>
<div class="main-wrap">
<glsx-combi-form ref="editFormRefCar" labelWidth="154px" :isInline="false" :formObj.sync="gradeFormObj" :formData="settingformData" :formRules="gradeRule">
<div slot="costSlot">
<el-input class="cost-input" placeholder="请输入每月投保成本" @input="changePrice($event, gradeFormObj, 'monthlyInsuranceCost')" :disabled="disabled" v-model="gradeFormObj.monthlyInsuranceCost"></el-input>
</div>
<div slot="specConfigSlot">
<ServicesTable :disabled="disabled" class="services-table" v-for="item in gradeList" :key="item.serviceGrade" :tableData="item"></ServicesTable>
<div v-if="!disabled" class="add-btn" @click="handleAddGrade">
......@@ -257,7 +260,7 @@ export default {
label: '每月投保成本/元:',
placeholder: '请输入每月投保成本',
name: 'monthlyInsuranceCost',
type: 'input'
addHtml: 'costSlot'
},
{
label: '规格配置:',
......@@ -297,6 +300,10 @@ export default {
},
methods: {
changePrice(value, item , key){
item[key] = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : ''
},
editConditionFn(row, key){
this.curEditCondition = {
id: row.id,
......@@ -589,6 +596,9 @@ export default {
}
.setting-wrap{
background-color: #fff;
.cost-input{
width: 432px;
}
}
.footer-btn{
text-align: center;
......
......@@ -18,22 +18,17 @@
<td>标准</td>
<td>-</td>
<template v-for="(item, index) in tableData.salePeriodData">
<td :key="index"><el-input :placeholder="placeholder" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disabled" v-model="item.standardShelfCost"></el-input></td>
<td :key="index"> <el-input :placeholder="placeholder" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disabled" v-model="item.standardSalesCost"></el-input></td>
<td :key="index"><el-input :placeholder="placeholder" @input="changePrice($event, item, 'standardShelfCost')" :disabled="disabled" v-model="item.standardShelfCost"></el-input></td>
<td :key="index"> <el-input :placeholder="placeholder" @input="changePrice($event, item, 'standardSalesCost')" :disabled="disabled" v-model="item.standardSalesCost"></el-input></td>
</template>
</tr>
<tr v-for="(item, index) in tableData.gradeConfigList" :key="index">
<td class="price">
<el-input :placeholder="placeholder" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disabled" v-model="item.minPrice"></el-input>
<el-input :placeholder="placeholder" @input="changePrice($event, item, 'minPrice')" @blur="formatPrice($event, item, 'minPrice', 200)" :disabled="disabled" v-model="item.minPrice"></el-input>
<span class="sign">-</span>
<el-input :placeholder="placeholder" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" @blur="formatPrice($event, item, 'maxPrice', 200)" :disabled="disabled" v-model="item.maxPrice"></el-input>
<el-input :placeholder="placeholder" @input="changePrice($event, item, 'maxPrice')" @blur="formatPrice($event, item, 'maxPrice', 200)" :disabled="disabled" v-model="item.maxPrice"></el-input>
</td>
<td><el-input :placeholder="placeholder" onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{3}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disabled" @blur="formatPrice($event, item, 'priceCoefficient', 100)" v-model="item.priceCoefficient"></el-input></td>
<td><el-input :placeholder="placeholder" @input="changePrice($event, item, 'priceCoefficient')" :disabled="disabled" @blur="formatPrice($event, item, 'priceCoefficient', 100)" v-model="item.priceCoefficient"></el-input></td>
<template v-for="(ele, eIdx) in tableData.salePeriodData">
<td :key="eIdx">{{calcPrice(ele.standardShelfCost, item.priceCoefficient)}}</td>
<td :key="eIdx">{{calcPrice(ele.standardSalesCost, item.priceCoefficient)}}</td>
......@@ -116,6 +111,10 @@
}
},
methods: {
changePrice(value, item , key){
item[key] = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : ''
},
formatPrice(e, item, key, maxNum){
let num = e.target.value
if(num>maxNum){
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!