- 添加earningPrice在GetStoresOrderSaleInfo中
This commit is contained in:
@@ -40,7 +40,7 @@ type StoresOrderSaleInfo struct {
|
||||
SalePrice int64 `json:"salePrice"`
|
||||
ActualPayPrice int64 `json:"actualPayPrice"`
|
||||
|
||||
PayPrice int64 `json:"payPrice"`
|
||||
EarningPrice int64 `json:"earningPrice"` // 预估结算给门店老板的钱
|
||||
}
|
||||
|
||||
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
||||
@@ -718,9 +718,11 @@ func (c *OrderManager) GetStoresOrderSaleInfo(ctx *jxcontext.Context, storeIDLis
|
||||
if toTime.Sub(fromTime) > time.Hour*24*60 {
|
||||
return nil, fmt.Errorf("查询时间范围不能超过60天")
|
||||
}
|
||||
// 用int64类型去取float型的数据库返回值,会取不到
|
||||
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
|
||||
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
|
||||
FROM goods_order t1
|
||||
WHERE t1.order_created_at >= ? AND t1.order_created_at <= ?
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user