update
This commit is contained in:
parent
7c5de0fe8a
commit
3b9ddd0f8f
@ -47,6 +47,39 @@ async def getbz_order(ns={}):
|
|||||||
AND bo.customerid = ${customerid}$
|
AND bo.customerid = ${customerid}$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# # 统计全部 累计支付金额和累计优惠金额 不包含各种筛选条件
|
||||||
|
# # 累计支付金额=BUY+RENEW-BUY_REVERSE实际支付金额 累计优惠金额=BUY+RENEW-BUY_REVERSE优惠金额
|
||||||
|
# total_amount_sql = """
|
||||||
|
# SELECT
|
||||||
|
# COALESCE(SUM(
|
||||||
|
# CASE
|
||||||
|
# WHEN bo.business_op IN ('BUY', 'RENEW') THEN og.amount
|
||||||
|
# WHEN bo.business_op = 'BUY_REVERSE' THEN -og.amount
|
||||||
|
# ELSE 0
|
||||||
|
# END
|
||||||
|
# ), 0) AS total_paid_amount,
|
||||||
|
# COALESCE(SUM(
|
||||||
|
# CASE
|
||||||
|
# WHEN bo.business_op IN ('BUY', 'RENEW') THEN (og.list_price * og.quantity - og.amount)
|
||||||
|
# WHEN bo.business_op = 'BUY_REVERSE' THEN -(og.list_price * og.quantity - og.amount)
|
||||||
|
# ELSE 0
|
||||||
|
# END
|
||||||
|
# ), 0) AS total_discount_amount
|
||||||
|
# FROM order_goods og
|
||||||
|
# JOIN bz_order bo ON og.orderid = bo.id
|
||||||
|
# WHERE og.del_flg = '0'
|
||||||
|
# AND bo.del_flg = '0'
|
||||||
|
# AND bo.customerid = ${customerid}$
|
||||||
|
# """
|
||||||
|
# total_amount_result = await sor.sqlExe(total_amount_sql, {'customerid': customerid})
|
||||||
|
# total_paid_amount = float(total_amount_result[0]['total_paid_amount']) if total_amount_result else 0.0
|
||||||
|
# total_discount_amount = float(total_amount_result[0]['total_discount_amount']) if total_amount_result else 0.0
|
||||||
|
# # 将累计支付金额和累计优惠金额添加到返回结果中
|
||||||
|
# ns['total_paid_amount'] = total_paid_amount
|
||||||
|
# ns['total_discount_amount'] = total_discount_amount
|
||||||
|
# ns['total_count'] = total_count[0]['total_count'] if total_count else 0
|
||||||
|
|
||||||
|
|
||||||
# 根据订单号搜索
|
# 根据订单号搜索
|
||||||
if ns.get('id'):
|
if ns.get('id'):
|
||||||
sql += " AND bo.id LIKE ${order_id}$"
|
sql += " AND bo.id LIKE ${order_id}$"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user