计费标准修改

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

View File

@ -60,13 +60,46 @@
obj.attrValue = JSON.parse(obj.attrValue)
// dataFrom.value = obj
obj.attrValue.map((item) => {
let params = {
let params = {}
switch (item.type) {
case '一次性买断':
params = {
title: item.type,
content: item.desc,
value: item.price,
time: '/年起',
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
case '按年计费':
params = {
title: item.type,
content: item.desc,
value: item.price,
time: '/年',
unit: '¥',
}
break
}
dataFrom.value.push(params)
})
}