套餐计划价格统一设置原始价格增加20%,前端套餐计划下拉增加公网IP数量显示

This commit is contained in:
jingrow 2025-07-29 16:26:42 +08:00
parent d38736f137
commit f5132fbccf
2 changed files with 9 additions and 1 deletions

View File

@ -637,6 +637,7 @@ export default {
const bandwidth = plan.bandwidth || '未知';
const price = plan.origin_price || '未知';
const planType = plan.plan_type || '';
const publicIpNum = plan.public_ip_num || 0;
// MB
let memoryDisplay = memory;
@ -671,7 +672,7 @@ export default {
typePrefix = '';
}
return `${typePrefix}${cpu}核/${memoryDisplay}/${disk}GB/${bandwidthDisplay} - ¥${price}/月`;
return `${typePrefix}${cpu}核/${memoryDisplay}/${disk}GB/${bandwidthDisplay}/${publicIpNum}个公网IP - ¥${price}/月`;
},
getSelectedPlanPrice() {
const selectedPlan = this.plans.find(plan => plan.plan_id === this.selectedPlanId);

View File

@ -638,6 +638,13 @@ def get_aliyun_plans(region_id='cn-shanghai'):
plan for plan in result['data']['plans']
if plan.get('plan_type') in allowed_types
]
# 在origin_price上统一增加20%作为利润
for plan in filtered_plans:
if 'origin_price' in plan and plan['origin_price'] is not None:
original_price = float(plan['origin_price'])
plan['origin_price'] = int(original_price / (1 - 0.2)) # 确保20%利润率且价格为整数
result['data']['plans'] = filtered_plans
return result