计算earningprice

This commit is contained in:
苏尹岚
2020-05-19 17:54:13 +08:00
parent 48d6ed401c
commit f92076a264
2 changed files with 14 additions and 4 deletions

View File

@@ -392,7 +392,11 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
if v.VendorPrice == v.SalePrice { if v.VendorPrice == v.SalePrice {
var earningPrice = 0 var earningPrice = 0
if v.ShopPrice < v.SalePrice { if v.ShopPrice < v.SalePrice {
if v.ShopPrice == 0 {
earningPrice = int(utils.Float64TwoInt64(math.Round(utils.Int2Float64(int(v.SalePrice)) * utils.Int2Float64(storePayPercentage) / 100)))
} else {
earningPrice = int(utils.Float64TwoInt64(math.Round(utils.Int2Float64(int(v.ShopPrice)) * utils.Int2Float64(storePayPercentage) / 100))) earningPrice = int(utils.Float64TwoInt64(math.Round(utils.Int2Float64(int(v.ShopPrice)) * utils.Int2Float64(storePayPercentage) / 100)))
}
} else { } else {
earningPrice = int(utils.Float64TwoInt64(math.Round(utils.Int2Float64(int(v.SalePrice)) * utils.Int2Float64(storePayPercentage) / 100))) earningPrice = int(utils.Float64TwoInt64(math.Round(utils.Int2Float64(int(v.SalePrice)) * utils.Int2Float64(storePayPercentage) / 100)))
} }

View File

@@ -1120,15 +1120,21 @@ func AddSku(ctx *jxcontext.Context, nameID int, sku *model.Sku, userName string)
err = ErrEntityNotExist err = ErrEntityNotExist
} }
} }
// storeSkus, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, nameID) storeSkus, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, nameID)
// if len(storeSkus) > 0 { // if len(storeSkus) > 0 {
// storeSkus2, err2 := dao.GetStoreSkusByNameIDs(db, nil, nameID) // storeSkus2, err2 := dao.GetStoreSkusByNameIDs(db, nil, nameID)
// err = err2 // err = err2
// skuBindInfos := []*StoreSkuBindInfo{} // storeIDs := make(map[int]int)
// for _, v := range storeSkus2 { // for _, v := range storeSkus2 {
// storeMaps, err := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, []int{v.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "")
// storeIDs[v.StoreID] = v.StoreID
// }
// skuBindInfos := []*StoreSkuBindInfo{}
// for _, v := range storeIDs {
// skus2 := []*StoreSkuBindSkuInfo{} // skus2 := []*StoreSkuBindSkuInfo{}
// skuBindInfo := &StoreSkuBindInfo{ // skuBindInfo := &StoreSkuBindInfo{
// StoreID: v.StoreID, // StoreID: v,
// } // }
// sku2 := &StoreSkuBindSkuInfo{ // sku2 := &StoreSkuBindSkuInfo{
// SkuID: sku.ID, // SkuID: sku.ID,