This commit is contained in:
aaron 2025-03-14 00:11:27 +08:00
parent 46d750d15f
commit 0a4f5b97fd
2 changed files with 3 additions and 1 deletions

View File

@ -96,6 +96,7 @@ def calculate_price(price_request: OrderPriceCalculateRequest,user: UserDB,db: S
base_price = settings.ORDER_BASE_PRICE
extra_package_price = settings.ORDER_EXTRA_PACKAGE_PRICE
extra_package_threshold = settings.ORDER_EXTRA_PACKAGE_THRESHOLD
base_more_station_price = 0
# 获取小区定价
if price_request.community_id > 0:
@ -106,6 +107,7 @@ def calculate_price(price_request: OrderPriceCalculateRequest,user: UserDB,db: S
base_price = float(community.base_price)
extra_package_price = float(community.extra_package_price)
extra_package_threshold = int(community.extra_package_threshold)
base_more_station_price = float(community.more_station_price)
# 是否有多驿站
more_station_price = float(community.more_station_price) * (len(price_request.packages) - 1) if len(price_request.packages) > 1 else 0
@ -152,7 +154,7 @@ def calculate_price(price_request: OrderPriceCalculateRequest,user: UserDB,db: S
result.price_info.final_amount = round(remaining_amount, 2)
# 计算价格详情
result.price_detail_text = f"基础配送费 {round(base_price, 1)} 元(限 {extra_package_threshold} 件),超件 {round(extra_package_price, 1)} 元 / 件,多驿站每件加收 {round(more_station_price, 1)}"
result.price_detail_text = f"基础配送费{round(base_price, 1)}元(限{extra_package_threshold}件), 超件{round(extra_package_price, 1)}元/件, 超过1个驿站加收{round(base_more_station_price, 1)}元/站"
return result

Binary file not shown.