- GetStoresSkus中返回realEarningPrice
This commit is contained in:
@@ -45,6 +45,8 @@ type StoreSkuNameExt struct {
|
|||||||
|
|
||||||
PendingOpType int8 `json:"pendingOpType"` // 取值同 StoreOpRequest.Type
|
PendingOpType int8 `json:"pendingOpType"` // 取值同 StoreOpRequest.Type
|
||||||
PendingUnitPrice int `json:"pendingUnitPrice"` // 这个是待审核的价格申请
|
PendingUnitPrice int `json:"pendingUnitPrice"` // 这个是待审核的价格申请
|
||||||
|
|
||||||
|
PayPercentage int `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStoreSkus用
|
// GetStoreSkus用
|
||||||
@@ -256,7 +258,8 @@ func GetStoresSkus(ctx *jxcontext.Context, storeIDs []int, isFocus bool, keyword
|
|||||||
t1.img,
|
t1.img,
|
||||||
t1.elm_img_hash_code,
|
t1.elm_img_hash_code,
|
||||||
t3.id,
|
t3.id,
|
||||||
t3.name`
|
t3.name,
|
||||||
|
t3.pay_percentage`
|
||||||
if isBySku {
|
if isBySku {
|
||||||
sql += `,
|
sql += `,
|
||||||
t2.id`
|
t2.id`
|
||||||
@@ -280,6 +283,7 @@ func GetStoresSkus(ctx *jxcontext.Context, storeIDs []int, isFocus bool, keyword
|
|||||||
t1.elm_img_hash_code,
|
t1.elm_img_hash_code,
|
||||||
t3.id store_id,
|
t3.id store_id,
|
||||||
t3.name store_name,
|
t3.name store_name,
|
||||||
|
t3.pay_percentage,
|
||||||
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"id":', t2.id, ',"comment":"', t2.comment, '","status":', t2.status, ',"createdAt":"',
|
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"id":', t2.id, ',"comment":"', t2.comment, '","status":', t2.status, ',"createdAt":"',
|
||||||
CONCAT(REPLACE(IF(t4.created_at IS NULL, '1970-01-01 00:00:00', t4.created_at)," ","T"),"+08:00"), '","updatedAt":"', CONCAT(REPLACE(IF(t4.updated_at IS NULL, '1970-01-01 00:00:00', t4.updated_at)," ","T"),"+08:00"),
|
CONCAT(REPLACE(IF(t4.created_at IS NULL, '1970-01-01 00:00:00', t4.created_at)," ","T"),"+08:00"), '","updatedAt":"', CONCAT(REPLACE(IF(t4.updated_at IS NULL, '1970-01-01 00:00:00', t4.updated_at)," ","T"),"+08:00"),
|
||||||
'","lastOperator":"', IF(t4.last_operator IS NULL, '', t4.last_operator), '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","weight":', t2.weight,
|
'","lastOperator":"', IF(t4.last_operator IS NULL, '', t4.last_operator), '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","weight":', t2.weight,
|
||||||
@@ -344,11 +348,20 @@ func GetStoresSkus(ctx *jxcontext.Context, storeIDs []int, isFocus bool, keyword
|
|||||||
} else {
|
} else {
|
||||||
v["actPrice"] = 0
|
v["actPrice"] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
earningPrice := 0
|
||||||
if jxSkuPriceMap[index] != nil {
|
if jxSkuPriceMap[index] != nil {
|
||||||
v["earningPrice"] = jxSkuPriceMap[index].EarningPrice
|
earningPrice = jxSkuPriceMap[index].EarningPrice
|
||||||
} else {
|
|
||||||
v["earningPrice"] = 0
|
|
||||||
}
|
}
|
||||||
|
v["earningPrice"] = earningPrice
|
||||||
|
|
||||||
|
realEarningPrice := earningPrice
|
||||||
|
if realEarningPrice == 0 {
|
||||||
|
shopPrice := utils.Interface2Int64WithDefault(v["price"], 0)
|
||||||
|
realEarningPrice = int(jxutils.CaculateSkuEarningPrice(shopPrice, shopPrice, skuName.PayPercentage))
|
||||||
|
}
|
||||||
|
v["realEarningPrice"] = realEarningPrice
|
||||||
|
|
||||||
delete(v, "unitPrice")
|
delete(v, "unitPrice")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user