计费标准修改

This commit is contained in:
851673013@qq.com 2022-06-16 10:29:32 +08:00
parent 94f5ab6acd
commit 71f6ff0790
2 changed files with 52 additions and 17 deletions

View File

@ -85,12 +85,14 @@
</div> </div>
<div class="form"> <div class="form">
<span>计费标准</span> <span>计费标准</span>
<!-- :formatter="limitNumber"
:parser="limitNumber" -->
<a-input-number <a-input-number
v-model:value="price" v-model:value="price"
:min="0" :min="0"
:max="9999" :max="9999"
:formatter="limitNumber" :step="0.01"
:parser="limitNumber" string-mode
placeholder="请填写计费标准,单位为元" placeholder="请填写计费标准,单位为元"
/> />
</div> </div>
@ -217,15 +219,15 @@
const question = ref('') const question = ref('')
const answer = ref('') const answer = ref('')
const plainOptions = ['一次性买断', '按调用次数', '按并发路数', '按年计费'] const plainOptions = ['一次性买断', '按调用次数', '按并发路数', '按年计费']
const limitNumber = (value) => { // const limitNumber = (value) => {
if (typeof value === 'string') { // if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0 // return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
} else if (typeof value === 'number') { // } else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/\./g, '') : 0 // return !isNaN(value) ? String(value).replace(/\./g, '') : 0
} else { // } else {
return 0 // return 0
} // }
} // }
const add = () => { const add = () => {
if (type.value.length > 0 && price.value > 0 && desc.value.length > 0) { if (type.value.length > 0 && price.value > 0 && desc.value.length > 0) {
data.value.freightBasis.push({ data.value.freightBasis.push({

View File

@ -60,13 +60,46 @@
obj.attrValue = JSON.parse(obj.attrValue) obj.attrValue = JSON.parse(obj.attrValue)
// dataFrom.value = obj // dataFrom.value = obj
obj.attrValue.map((item) => { obj.attrValue.map((item) => {
let params = { let params = {}
switch (item.type) {
case '一次性买断':
params = {
title: item.type, title: item.type,
content: item.desc, content: item.desc,
value: item.price, value: item.price,
time: '/年起', time: '/元',
unit: '¥', unit: '¥',
} }
break
case '按调用次数':
params = {
title: item.type,
content: item.desc,
value: item.price,
time: '/次',
unit: '¥',
}
break
case '按并发路数':
params = {
title: item.type,
content: item.desc,
value: item.price,
time: '/路',
unit: '¥',
}
break
case '按年计费':
params = {
title: item.type,
content: item.desc,
value: item.price,
time: '/年',
unit: '¥',
}
break
}
dataFrom.value.push(params) dataFrom.value.push(params)
}) })
} }