diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index b9c07e533..9144ff648 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -1200,6 +1200,15 @@ func (c *OrderManager) GetStoresOrderSaleInfoNew(ctx *jxcontext.Context, storeID } saleInfoList = append(saleInfoList, v) } + + feeList, _ := dao.GetStoreServerFee(db, storeIDList, fromTime, toTime, statusList, true) + for _, v := range saleInfoList { + for _, f := range feeList { + if v.StoreID == f.JxStoreID && v.VendorID == f.VendorID { + v.ServerFee = f.ServerFee + } + } + } return saleInfoList, err } diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 60984b4ec..b147e83a7 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -20,26 +20,22 @@ var ( ) type StoresOrderSaleInfo struct { - StoreID int `orm:"column(store_id)" json:"storeID"` - VendorID int `orm:"column(vendor_id)" json:"vendorID"` - Status int `json:"status"` - - Count int `json:"count"` - ShopPrice int64 `json:"shopPrice"` - VendorPrice int64 `json:"vendorPrice"` - SalePrice int64 `json:"salePrice"` - ActualPayPrice int64 `json:"actualPayPrice"` - - EarningPrice int64 `json:"earningPrice"` // 预估结算给门店老板的钱 - NewEarningPrice int64 `json:"newEarningPrice"` // 预估结算给门店老板的钱(新规则) - + StoreID int `orm:"column(store_id)" json:"storeID"` + VendorID int `orm:"column(vendor_id)" json:"vendorID"` + Status int `json:"status"` + Count int `json:"count"` + ShopPrice int64 `json:"shopPrice"` + VendorPrice int64 `json:"vendorPrice"` + SalePrice int64 `json:"salePrice"` + ActualPayPrice int64 `json:"actualPayPrice"` + EarningPrice int64 `json:"earningPrice"` // 预估结算给门店老板的钱 + NewEarningPrice int64 `json:"newEarningPrice"` // 预估结算给门店老板的钱(新规则) DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 商户承担的远距离配送费(当前只有京东到家有值) WaybillTipMoney int64 `json:"waybillTipMoney"` // 京西加的平台配送小费 - - RealEarningPrice int64 `json:"realEarningPrice"` - - PlatformSettlement int64 `json:"platformSettlement"` // 真实订单的平台结算(无扣点) - ActualFee int64 `json:"actualFee"` // 真三方运单配送费 + RealEarningPrice int64 `json:"realEarningPrice"` + PlatformSettlement int64 `json:"platformSettlement"` // 真实订单的平台结算(无扣点) + ActualFee int64 `json:"actualFee"` // 真三方运单配送费 + ServerFee int64 `json:"serverFee"` // 附加服务费 } type OrderSkuWithActualPayPrice struct { @@ -419,6 +415,42 @@ type TotalShopMoney struct { VendorID int `orm:"column(vendor_id)" json:"vendorID"` } +// GetStoreServerFee 统计门店服务费 +func GetStoreServerFee(db *DaoDB, storeIDs []int, finishedAtBegin, finishedAtEnd time.Time, statusList []int, isFinish bool) ([]*ServerFeeInfo, error) { + sql := ` SELECT sum(t2.package_price) server_fee,t2.vendor_id,t2.jx_store_id FROM goods_order t2 WHERE 1=1 ` + if isFinish { + sql += " AND t2.order_finished_at >= ? AND t2.order_finished_at <= ?" + } else { + sql += " AND t2.order_created_at >= ? AND t2.order_created_at <= ?" + } + sqlParams := []interface{}{ + finishedAtBegin, + finishedAtEnd, + } + if len(storeIDs) > 0 { + sql += " AND IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id) IN (" + GenQuestionMarks(len(storeIDs)) + ")" + sqlParams = append(sqlParams, storeIDs) + } + if len(statusList) > 0 { + sql += " AND t2.status IN (" + GenQuestionMarks(len(statusList)) + ")" + sqlParams = append(sqlParams, statusList) + } + sql += ` GROUP BY t2.vendor_id,t2.jx_store_id` + + feeList := make([]*ServerFeeInfo, 0, 0) + if err := GetRows(db, &feeList, sql, sqlParams...); err != nil { + return nil, err + } + + return feeList, nil +} + +type ServerFeeInfo struct { + ServerFee int64 `json:"server_fee"` + VendorID int `json:"vendor_id"` + JxStoreID int `json:"jx_store_id"` +} + // GetPlatformSettlement 统计平台的结算信息 func GetPlatformSettlement(db *DaoDB, storeIDs []int, finishedAtBegin, finishedAtEnd time.Time) ([]*TotalShopMoney, error) { sql := ` diff --git a/business/partner/printer/feie/feie.go b/business/partner/printer/feie/feie.go index 904db641f..4a0055882 100644 --- a/business/partner/printer/feie/feie.go +++ b/business/partner/printer/feie/feie.go @@ -62,6 +62,10 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin if order.BusinessType == model.BusinessTypeDingshida { orderFmt += ` 预订单
+` + } else { + orderFmt += ` +立即送达
` } orderFmt += ` @@ -124,11 +128,9 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin orderFmt += `
共%d种%d件商品
实付:%s -
--------------------------------
商品质量问题请联系:
%s:%s

-
更多信息请关注官方微信: %s

--------------------------------
@@ -173,6 +175,10 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st if order.BusinessType == model.BusinessTypeDingshida { orderFmt += ` 预订单
+` + } else { + orderFmt += ` +立即送达
` } @@ -231,7 +237,6 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st --------------------------------
商品质量问题请联系:
%s:%s

-
更多信息请关注官方微信: %s

--------------------------------
diff --git a/business/partner/printer/trendit/trendit.go b/business/partner/printer/trendit/trendit.go index a3f6d02d4..d6c4ea5b2 100644 --- a/business/partner/printer/trendit/trendit.go +++ b/business/partner/printer/trendit/trendit.go @@ -196,6 +196,11 @@ func (c *PrinterHandler) getOrderContentV2(order *model.GoodsOrder, storeTel str } } } + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } orderFmt += ` -------------------------------- 下单时间: %s @@ -261,6 +266,11 @@ func (c *PrinterHandler) getOrderContentBigV2(order *model.GoodsOrder, storeTel } } } + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } orderFmt += ` -------------------------------- 下单时间: %s @@ -328,6 +338,11 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin } } } + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } orderFmt += ` -------------------------------- 下单时间: %s @@ -397,6 +412,11 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st } } } + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } orderFmt += ` -------------------------------- 下单时间: %s diff --git a/business/partner/printer/xiaowm/xiaowm.go b/business/partner/printer/xiaowm/xiaowm.go index 22fafe0de..cfea5a3b5 100644 --- a/business/partner/printer/xiaowm/xiaowm.go +++ b/business/partner/printer/xiaowm/xiaowm.go @@ -46,8 +46,13 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin orderFmt := ` %s** 手机买菜上京西* - 极速到家送惊喜* -------------------------------* + 极速到家送惊喜*` + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += ` 预订单*` + } else { + orderFmt += ` 立即送达*` + } + orderFmt += `------------------------------* 下单时间: %s* 预计送达: %s* 订单编号: %s* @@ -137,8 +142,13 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st orderFmt := ` %s** 手机买菜上京西* - 极速到家送惊喜* -------------------------------* + 极速到家送惊喜*` + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += ` 预订单*` + } else { + orderFmt += ` 立即送达*` + } + orderFmt += `------------------------------* 下单时间: %s** 预计送达: %s** 订单编号: %s* @@ -215,8 +225,13 @@ func (c *PrinterHandler) getOrderContent2(order *model.GoodsOrder, storeTel stri orderFmt := ` |7 %s |5 手机买菜上京西 -|5 极速到家送惊喜 -|5-------------------------------- +|5 极速到家送惊喜` + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `|5 预订单` + } else { + orderFmt += `|5 立即送达` + } + orderFmt += `|5-------------------------------- |5下单时间: %s |5预计送达: %s |5订单编号: %s diff --git a/business/partner/printer/xpyun/xpyun.go b/business/partner/printer/xpyun/xpyun.go index f2a3f8cee..a86bbeaf3 100644 --- a/business/partner/printer/xpyun/xpyun.go +++ b/business/partner/printer/xpyun/xpyun.go @@ -193,6 +193,11 @@ func (c *PrinterHandler) getOrderContentV2(order *model.GoodsOrder, storeTel str } } } + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } orderFmt += ` ` + xpyunapi.StrRepeat("-", 32) + ` 下单时间: %s @@ -256,6 +261,11 @@ func (c *PrinterHandler) getOrderContentBigV2(order *model.GoodsOrder, storeTel } } } + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } orderFmt += ` ` + xpyunapi.StrRepeat("-", 32) + ` 下单时间: %s @@ -321,6 +331,11 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin } } } + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } orderFmt += ` ` + xpyunapi.StrRepeat("-", 32) + ` 下单时间: %s @@ -401,6 +416,11 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st } } } + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } orderFmt += ` ` + xpyunapi.StrRepeat("-", 32) + ` 下单时间: %s diff --git a/business/partner/printer/yilianyun/yilianyun.go b/business/partner/printer/yilianyun/yilianyun.go index 9124248c5..10fce0339 100644 --- a/business/partner/printer/yilianyun/yilianyun.go +++ b/business/partner/printer/yilianyun/yilianyun.go @@ -62,6 +62,10 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin orderFmt += ` 预订单\n ` + } else { + orderFmt += ` + 立即送达\n + ` } orderFmt += ` \n @@ -162,8 +166,17 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st 下单时间: %s\n\n 预计送达: %s\n\n 订单编号: %s\n -\n -%s +\n` + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += ` + 预订单\n + ` + } else { + orderFmt += ` + 立即送达\n + ` + } + orderFmt += `%s ` + getCode + `\n 客户: %s\n 电话: %s\n diff --git a/business/partner/printer/zhongwu/zhongwu.go b/business/partner/printer/zhongwu/zhongwu.go index 02b144e58..b4d1d1ca4 100644 --- a/business/partner/printer/zhongwu/zhongwu.go +++ b/business/partner/printer/zhongwu/zhongwu.go @@ -54,8 +54,13 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin } orderFmt += ` 手机买菜上京西 -极速到家送惊喜 -******************************** +极速到家送惊喜` + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } + orderFmt += `******************************** 下单时间: %s 预计送达: %s 订单编号: %s @@ -133,8 +138,13 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st } orderFmt += ` 手机买菜上京西 -极速到家送惊喜 -******************************** +极速到家送惊喜` + if order.BusinessType == model.BusinessTypeDingshida { + orderFmt += `预订单` + } else { + orderFmt += `立即送达` + } + orderFmt += `******************************** 下单时间: %s 预计送达: %s 订单编号: %s