- EarningPrice通过Store.PayPercentage来算,缺省是70%
This commit is contained in:
@@ -226,6 +226,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,
|
||||
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 {
|
||||
@@ -234,7 +235,8 @@ func (c *OrderManager) getOrders(ctx *jxcontext.Context, isIncludeSku bool, from
|
||||
}
|
||||
sql += `
|
||||
FROM goods_order t1
|
||||
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id`
|
||||
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id
|
||||
LEFT JOIN store t5 ON t5.id = IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id)`
|
||||
if isIncludeSku {
|
||||
sql += `
|
||||
JOIN order_sku t3 ON t3.vendor_order_id = t1.vendor_order_id AND t3.vendor_id = t1.vendor_id`
|
||||
@@ -724,8 +726,9 @@ 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)))*0.7 AS SIGNED) earning_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
|
||||
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 <= ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
|
||||
@@ -12,6 +12,8 @@ const (
|
||||
|
||||
type GoodsOrderExt struct {
|
||||
GoodsOrder
|
||||
EarningPrice int64 `json:"earningPrice"` // 预估结算给门店老板的钱
|
||||
|
||||
WaybillStatus int `json:"waybillStatus"`
|
||||
CourierName string `orm:"size(32)" json:"courierName"`
|
||||
CourierMobile string `orm:"size(32)" json:"courierMobile"`
|
||||
|
||||
Reference in New Issue
Block a user