fix
This commit is contained in:
parent
155a1ba164
commit
1d7d90289c
@ -91,7 +91,7 @@ def calculate_price(price_request: OrderPriceCalculateRequest,user: UserDB,db: S
|
|||||||
# 3. 如果没有优惠券,且用户有积分,则使用积分抵扣
|
# 3. 如果没有优惠券,且用户有积分,则使用积分抵扣
|
||||||
elif user.points > 0:
|
elif user.points > 0:
|
||||||
# 计算最大可抵扣金额(1元=10积分)
|
# 计算最大可抵扣金额(1元=10积分)
|
||||||
max_points_discount = user.points / settings.POINT_RATIO
|
max_points_discount = float(user.points) / settings.POINT_RATIO
|
||||||
points_discount_amount = min(remaining_amount, max_points_discount)
|
points_discount_amount = min(remaining_amount, max_points_discount)
|
||||||
|
|
||||||
result.price_info.points_discount_amount = points_discount_amount
|
result.price_info.points_discount_amount = points_discount_amount
|
||||||
@ -445,7 +445,7 @@ async def cancel_order(
|
|||||||
# 如果使用了积分,返还积分
|
# 如果使用了积分,返还积分
|
||||||
if order.point_discount_amount > 0:
|
if order.point_discount_amount > 0:
|
||||||
# 返还积分
|
# 返还积分
|
||||||
return_points = order.point_discount_amount * settings.POINT_RATIO
|
return_points = float(order.point_discount_amount) * settings.POINT_RATIO
|
||||||
current_user.points += return_points
|
current_user.points += return_points
|
||||||
|
|
||||||
# 记录积分变动
|
# 记录积分变动
|
||||||
@ -598,7 +598,7 @@ async def deliveryman_cancel_order(
|
|||||||
# 如果使用了积分,返还积分
|
# 如果使用了积分,返还积分
|
||||||
if order.point_discount_amount > 0:
|
if order.point_discount_amount > 0:
|
||||||
# 返还积分
|
# 返还积分
|
||||||
return_points = order.point_discount_amount * settings.POINT_RATIO
|
return_points = float(order.point_discount_amount) * settings.POINT_RATIO
|
||||||
|
|
||||||
order_user = db.query(UserDB).filter(
|
order_user = db.query(UserDB).filter(
|
||||||
UserDB.userid == order.userid
|
UserDB.userid == order.userid
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user