创建服务器订单时业务参数增加plan_type字段

This commit is contained in:
jingrow 2025-08-09 23:23:58 +08:00
parent 6a3ead8b46
commit 4d95116696
2 changed files with 9 additions and 0 deletions

View File

@ -608,6 +608,7 @@ export default {
image_id: this.selectedImageId,
period: this.period,
region_id: this.selectedRegionId,
plan_type: this.getSelectedPlanType(),
payment_method: this.selectedPaymentMethod
});
@ -714,6 +715,10 @@ export default {
const selectedPlan = this.filteredPlans.find(plan => plan.plan_id === this.selectedPlanId);
return selectedPlan ? (selectedPlan.origin_price || 0) : 0;
},
getSelectedPlanType() {
const selectedPlan = this.filteredPlans.find(plan => plan.plan_id === this.selectedPlanId);
return selectedPlan ? (selectedPlan.plan_type || '') : '';
},
getTotalAmount() {
const monthlyPrice = this.getSelectedPlanPrice();
return (monthlyPrice * this.period).toFixed(2);

View File

@ -980,6 +980,7 @@ def create_server_order(**kwargs):
image_id = kwargs.get('image_id')
period = kwargs.get('period', 1)
region_id = kwargs.get('region_id', 'cn-shanghai')
plan_type = kwargs.get('plan_type', '')
if not plan_id or not image_id:
jingrow.throw("缺少必要参数")
@ -1009,6 +1010,7 @@ def create_server_order(**kwargs):
"image_id": image_id,
"period": period,
"region_id": region_id,
"plan_type": plan_type,
"monthly_price": monthly_price,
"total_amount": total_amount,
"plan_info": {
@ -1360,6 +1362,7 @@ def create_aliyun_server(order_name):
image_id = biz_params.get("image_id")
period = biz_params.get("period", 1)
region_id = biz_params.get("region_id", "cn-shanghai")
plan_type = biz_params.get("plan_type", "")
monthly_price = biz_params.get("monthly_price", 0)
plan_info = biz_params.get("plan_info", {})
@ -1390,6 +1393,7 @@ def create_aliyun_server(order_name):
"end_date": jingrow.utils.add_months(jingrow.utils.nowdate(), period),
"title": f"{region_id} - {plan_info.get('core', '')}核/{plan_info.get('memory', '')}GB",
"planid": plan_id,
"plan_type": plan_type,
"period": period,
"plan_price": monthly_price,
"cpu": plan_info.get('core'),