1
This commit is contained in:
@@ -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 := `
|
||||
|
||||
Reference in New Issue
Block a user