This commit is contained in:
邹宗楠
2025-08-07 16:55:20 +08:00
parent b15f7ac442
commit 99ad4b5f97
8 changed files with 157 additions and 33 deletions

View File

@@ -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
}

View File

@@ -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 := `

View File

@@ -62,6 +62,10 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `
<B>预订单</B><BR>
`
} else {
orderFmt += `
<B>立即送达</B><BR>
`
}
orderFmt += `
@@ -124,11 +128,9 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
orderFmt += `<BR>
<BOLD>共%d种%d件商品</BOLD><BR>
<BOLD>实付:%s</BOLD>
<BR>
--------------------------------<BR>
<C><BOLD>商品质量问题请联系:</BOLD><BR></C>
<C><BOLD>%s:%s</BOLD><BR></C><BR>
<BR>
更多信息请关注官方微信: %s<BR>
<BR>
--------------------------------<BR>
@@ -173,6 +175,10 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `
<B>预订单</B><BR>
`
} else {
orderFmt += `
<B>立即送达</B><BR>
`
}
@@ -231,7 +237,6 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
--------------------------------<BR>
<C><BOLD>商品质量问题请联系:</BOLD><BR></C>
<BOLD>%s:%s</BOLD><BR><BR>
<BR>
更多信息请关注官方微信: %s<BR>
<BR>
--------------------------------<BR>

View File

@@ -196,6 +196,11 @@ func (c *PrinterHandler) getOrderContentV2(order *model.GoodsOrder, storeTel str
}
}
}
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C><font# bolder=0 height=2 width=2>预订单</font#>`
} else {
orderFmt += `<C><font# bolder=0 height=2 width=2>立即送达</font#>`
}
orderFmt += `
<font# bolder=0 height=1 width=1>--------------------------------</font#>
<LEFT>下单时间: %s</LEFT>
@@ -261,6 +266,11 @@ func (c *PrinterHandler) getOrderContentBigV2(order *model.GoodsOrder, storeTel
}
}
}
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C><font# bolder=0 height=2 width=2>预订单</font#>`
} else {
orderFmt += `<C><font# bolder=0 height=2 width=2>立即送达</font#>`
}
orderFmt += `
<font# bolder=0 height=2 width=1>--------------------------------</font#>
<LEFT>下单时间: %s</LEFT>
@@ -328,6 +338,11 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
}
}
}
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C><font# bolder=0 height=2 width=2>预订单</font#>`
} else {
orderFmt += `<C><font# bolder=0 height=2 width=2>立即送达</font#>`
}
orderFmt += `
<font# bolder=0 height=1 width=1>--------------------------------</font#>
<LEFT>下单时间: %s</LEFT>
@@ -397,6 +412,11 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
}
}
}
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C><font# bolder=0 height=2 width=2>预订单</font#>`
} else {
orderFmt += `<C><font# bolder=0 height=2 width=2>立即送达</font#>`
}
orderFmt += `
<font# bolder=0 height=1 width=1>--------------------------------</font#>
<LEFT><font# bolder=0 height=2 width=1>下单时间: %s</font#></LEFT>

View File

@@ -46,8 +46,13 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
orderFmt := `
<big> %s**
手机买菜上京西*
极速到家送惊喜*
------------------------------*
极速到家送惊喜*`
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<big> 预订单*`
} else {
orderFmt += `<big> 立即送达*`
}
orderFmt += `------------------------------*
下单时间: %s*
预计送达: %s*
订单编号: %s*
@@ -137,8 +142,13 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
orderFmt := `
<big> %s**
手机买菜上京西*
极速到家送惊喜*
------------------------------*
极速到家送惊喜*`
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<big> 预订单*`
} else {
orderFmt += `<big> 立即送达*`
}
orderFmt += `------------------------------*
<big>下单时间: %s**
<big>预计送达: %s**
<big>订单编号: %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

View File

@@ -193,6 +193,11 @@ func (c *PrinterHandler) getOrderContentV2(order *model.GoodsOrder, storeTel str
}
}
}
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C><B>预订单</B><C>`
} else {
orderFmt += `<C><B>立即送达</B><C>`
}
orderFmt += `
` + xpyunapi.StrRepeat("-", 32) + `
<L>下单时间: %s
@@ -256,6 +261,11 @@ func (c *PrinterHandler) getOrderContentBigV2(order *model.GoodsOrder, storeTel
}
}
}
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C><B>预订单</B><C>`
} else {
orderFmt += `<C><B>立即送达</B><C>`
}
orderFmt += `
` + xpyunapi.StrRepeat("-", 32) + `
<HB><L>下单时间: %s
@@ -321,6 +331,11 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
}
}
}
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C><B>预订单</B><C>`
} else {
orderFmt += `<C><B>立即送达</B><C>`
}
orderFmt += `
` + xpyunapi.StrRepeat("-", 32) + `
<L>下单时间: %s
@@ -401,6 +416,11 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
}
}
}
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C><B>预订单</B><C>`
} else {
orderFmt += `<C><B>立即送达</B><C>`
}
orderFmt += `
` + xpyunapi.StrRepeat("-", 32) + `
<HB><L>下单时间: %s

View File

@@ -62,6 +62,10 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
orderFmt += `
<FS>预订单</FS>\n
`
} else {
orderFmt += `
<FS>立即送达</FS>\n
`
}
orderFmt += `
\n
@@ -162,8 +166,17 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
<FS>下单时间: %s\n\n</FS>
<FS>预计送达: %s\n\n</FS>
<FS>订单编号: %s\n</FS>
\n
<QR>%s</QR>
\n`
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `
<FS>预订单</FS>\n
`
} else {
orderFmt += `
<FS>立即送达</FS>\n
`
}
orderFmt += `<QR>%s</QR>
` + getCode + `\n
<FS>客户: %s\n</FS>
<FS>电话: %s\n</FS>

View File

@@ -54,8 +54,13 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
}
orderFmt += `
<C>手机买菜上京西</C>
<C>极速到家送惊喜</C><RN>
********************************
<C>极速到家送惊喜</C><RN>`
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C>预订单</C><RN>`
} else {
orderFmt += `<C>立即送达</C><RN>`
}
orderFmt += `********************************
下单时间: %s<RN>
预计送达: %s<RN>
订单编号: %s<RN>
@@ -133,8 +138,13 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
}
orderFmt += `
<C>手机买菜上京西</C>
<C>极速到家送惊喜</C><RN>
********************************
<C>极速到家送惊喜</C><RN>`
if order.BusinessType == model.BusinessTypeDingshida {
orderFmt += `<C>预订单</C><RN>`
} else {
orderFmt += `<C>立即送达</C><RN>`
}
orderFmt += `********************************
<S2>下单时间: %s<RN><RN></S2>
<S2>预计送达: %s<RN><RN></S2>
<S2>订单编号: %s<RN></S2>