- 修改订单中实时计算的earningPrice算法

This commit is contained in:
gazebo
2019-06-19 22:11:54 +08:00
parent 8f382e4dec
commit 9360f11da9

View File

@@ -283,7 +283,7 @@ func (c *OrderManager) getOrders(ctx *jxcontext.Context, isIncludeSku bool, from
}
sql := `
SELECT SQL_CALC_FOUND_ROWS t1.*,
CAST(IF(t1.shop_price <= t1.vendor_price, IF(t1.shop_price = 0, t1.sale_price, t1.shop_price), IF(t1.vendor_price = 0, t1.sale_price, t1.vendor_price))*IF(t5.pay_percentage IS NULL OR t5.pay_percentage <= 0, 70, t5.pay_percentage)/100 AS SIGNED) earning_price,
CAST(IF(t1.shop_price <> 0 && t1.shop_price < t1.sale_price, t1.shop_price, t1.sale_price) * IF(t5.pay_percentage > 0, t5.pay_percentage, 70) / 100 AS SIGNED) earning_price,
t2.status waybill_status, t2.courier_name, t2.courier_mobile,
t2.actual_fee, t2.desired_fee, t2.waybill_created_at, t2.waybill_finished_at`
if isIncludeSku {
@@ -783,7 +783,7 @@ func (c *OrderManager) GetStoresOrderSaleInfo(ctx *jxcontext.Context, storeIDLis
sql := `
SELECT IF(t1.jx_store_id > 0, t1.jx_store_id, t1.store_id) store_id, t1.vendor_id, IF(t1.status < ?, 0, t1.status) status,
COUNT(*) count, SUM(t1.shop_price) shop_price, SUM(t1.vendor_price) vendor_price, SUM(t1.sale_price) sale_price, SUM(t1.actual_pay_price) actual_pay_price,
CAST(SUM(IF(t1.shop_price <= t1.vendor_price, IF(t1.shop_price = 0, t1.sale_price, t1.shop_price), IF(t1.vendor_price = 0, t1.sale_price, t1.vendor_price))*IF(t5.pay_percentage IS NULL OR t5.pay_percentage <= 0, 70, t5.pay_percentage)/100) AS SIGNED) earning_price
CAST(SUM(IF(t1.shop_price <> 0 && t1.shop_price < t1.sale_price, t1.shop_price, t1.sale_price) * IF(t5.pay_percentage > 0, t5.pay_percentage, 70) / 100) AS SIGNED) earning_price
FROM goods_order t1
LEFT JOIN store t5 ON t5.id = IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id)
WHERE t1.order_created_at >= ? AND t1.order_created_at <= ?