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:
@@ -74,7 +74,7 @@ export class PackageManageService extends BaseService {
|
||||
*/
|
||||
static updatePackageStatus(id: number, status: number): Promise<BaseResponse> {
|
||||
const data: UpdatePackageStatusRequest = { status }
|
||||
return this.put<BaseResponse>(`/api/admin/packages/${id}/status`, data)
|
||||
return this.patch<BaseResponse>(`/api/admin/packages/${id}/status`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,6 +75,6 @@ export class PackageSeriesService extends BaseService {
|
||||
*/
|
||||
static updatePackageSeriesStatus(id: number, status: number): Promise<BaseResponse> {
|
||||
const data: UpdatePackageSeriesStatusRequest = { status }
|
||||
return this.put<BaseResponse>(`/api/admin/package-series/${id}/status`, data)
|
||||
return this.patch<BaseResponse>(`/api/admin/package-series/${id}/status`, data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,18 +60,21 @@
|
||||
<ElFormItem label="店铺名称">
|
||||
<ElInput v-model="costPriceForm.shop_name" disabled />
|
||||
</ElFormItem>
|
||||
<ElFormItem label="原成本价(分)">
|
||||
<ElFormItem label="原成本价(元)">
|
||||
<ElInputNumber
|
||||
v-model="costPriceForm.old_cost_price"
|
||||
disabled
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="新成本价(分)" prop="cost_price">
|
||||
<ElFormItem label="新成本价(元)" prop="cost_price">
|
||||
<ElInputNumber
|
||||
v-model="costPriceForm.cost_price"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
placeholder="请输入新成本价"
|
||||
@@ -755,8 +758,8 @@
|
||||
costPriceForm.id = row.id
|
||||
costPriceForm.package_name = row.package_name
|
||||
costPriceForm.shop_name = row.shop_name
|
||||
costPriceForm.old_cost_price = row.cost_price
|
||||
costPriceForm.cost_price = row.cost_price
|
||||
costPriceForm.old_cost_price = row.cost_price / 100 // 分转换为元显示
|
||||
costPriceForm.cost_price = row.cost_price / 100 // 分转换为元显示
|
||||
|
||||
// 重置表单验证状态
|
||||
nextTick(() => {
|
||||
@@ -784,9 +787,12 @@
|
||||
if (valid) {
|
||||
costPriceSubmitLoading.value = true
|
||||
try {
|
||||
// 将元转换为分提交给后端
|
||||
const costPriceInCents = Math.round(costPriceForm.cost_price * 100)
|
||||
|
||||
await ShopPackageAllocationService.updateShopPackageAllocationCostPrice(
|
||||
costPriceForm.id,
|
||||
costPriceForm.cost_price
|
||||
costPriceInCents
|
||||
)
|
||||
ElMessage.success('修改成本价成功')
|
||||
costPriceDialogVisible.value = false
|
||||
|
||||
@@ -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