fetch(modify):修改分为元
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m22s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m22s
This commit is contained in:
@@ -140,8 +140,16 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="价格(分)" prop="price">
|
||||
<ElInputNumber v-model="form.price" :min="0" :controls="false" style="width: 100%" />
|
||||
<ElFormItem label="价格(元)" prop="price">
|
||||
<ElInputNumber
|
||||
v-model="form.price"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
placeholder="请输入价格"
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="套餐描述" prop="description">
|
||||
<ElInput
|
||||
@@ -652,7 +660,7 @@
|
||||
form.real_data_mb = row.real_data_mb
|
||||
form.virtual_data_mb = row.virtual_data_mb
|
||||
form.duration_months = row.duration_months
|
||||
form.price = row.price
|
||||
form.price = row.price / 100 // 分转换为元显示
|
||||
form.description = row.description || ''
|
||||
} else {
|
||||
form.id = 0
|
||||
@@ -727,6 +735,9 @@
|
||||
if (valid) {
|
||||
submitLoading.value = true
|
||||
try {
|
||||
// 将元转换为分提交给后端
|
||||
const priceInCents = Math.round(form.price * 100)
|
||||
|
||||
const data = {
|
||||
package_code: form.package_code,
|
||||
package_name: form.package_name,
|
||||
@@ -736,7 +747,7 @@
|
||||
real_data_mb: form.real_data_mb,
|
||||
virtual_data_mb: form.virtual_data_mb,
|
||||
duration_months: form.duration_months,
|
||||
price: form.price,
|
||||
price: priceInCents,
|
||||
description: form.description || undefined
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user