fix bug
This commit is contained in:
parent
f06c6c7c69
commit
73418553c7
@ -410,10 +410,12 @@ async def get_order_detail(
|
||||
|
||||
# 计算配送员分账金额
|
||||
deliveryman_share = 0
|
||||
if current_user.delivery_commission_rate is not None:
|
||||
deliveryman_share = round(order.original_amount_with_additional_fee * (current_user.delivery_commission_rate / 100.0), 2)
|
||||
if current_user.delivery_commission_fixed is not None:
|
||||
if current_user.delivery_commission_fixed > 0:
|
||||
deliveryman_share = current_user.delivery_commission_fixed
|
||||
elif current_user.delivery_commission_rate > 0:
|
||||
deliveryman_share = round(order.original_amount_with_additional_fee * (current_user.delivery_commission_rate / 100.0), 2)
|
||||
else:
|
||||
deliveryman_share = 0
|
||||
|
||||
# 如果有配送员 id,则获取配送员信息
|
||||
if order.deliveryman_user_id:
|
||||
@ -1166,12 +1168,15 @@ async def deliveryman_complete_order(
|
||||
order.completed_time = datetime.now()
|
||||
|
||||
# 计算配送员分账金额
|
||||
if current_user.delivery_commission_rate is not None:
|
||||
if current_user.delivery_commission_rate > 0:
|
||||
deliveryman_share = order.original_amount_with_additional_fee * current_user.delivery_commission_rate / 100
|
||||
else:
|
||||
elif current_user.delivery_commission_fixed > 0:
|
||||
deliveryman_share = current_user.delivery_commission_fixed
|
||||
else:
|
||||
deliveryman_share = 0
|
||||
|
||||
# 使用账户管理器处理分账
|
||||
if deliveryman_share > 0:
|
||||
account_manager = AccountManager(db)
|
||||
account_manager.change_balance(
|
||||
user_id=order.deliveryman_user_id,
|
||||
@ -1179,6 +1184,7 @@ async def deliveryman_complete_order(
|
||||
description=f"配送订单收益",
|
||||
transaction_id=orderid
|
||||
)
|
||||
|
||||
db.commit()
|
||||
|
||||
# 如果当前订单是首单,如果有邀请人,给邀请人发放优惠券
|
||||
|
||||
Loading…
Reference in New Issue
Block a user