diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 055240308..89b2338e3 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2193,8 +2193,8 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io. taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) { switch step { case 0: - // xlsx, err := excelize.OpenFile("111.xlsx") xlsx, err := excelize.OpenReader(reader) + // xlsx, err := excelize.OpenFile("111.xlsx") if err != nil { return "", err } @@ -2229,9 +2229,15 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io. skuList, err2 := dao.GetStoreSkusByNameIDs(db, []int{vv}, nameID) err = err2 if len(skuList) > 0 { + unitPrice := 0 + if storeSkuNamePrice.Unit == "KG" { + unitPrice = storeSkuNamePrice.Price / 2 + } else { + unitPrice = storeSkuNamePrice.Price + } storeSkuBindInfo := &StoreSkuBindInfo{ NameID: nameID, - UnitPrice: storeSkuNamePrice.Price, + UnitPrice: unitPrice, } skuBindInfos = append(skuBindInfos, storeSkuBindInfo) outSuccess := DataSuccess{ @@ -2239,8 +2245,8 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io. Name: skuList[0].Name, Unit: storeSkuNamePrice.Unit, OrgPrice: utils.Str2Float64(utils.Int64ToStr(skuList[0].UnitPrice / 100)), - NowPrice: utils.Str2Float64(utils.Int64ToStr(int64(storeSkuNamePrice.Price / 100))), - MixPrice: utils.Str2Float64(utils.Int64ToStr(int64(storeSkuNamePrice.Price) - skuList[0].UnitPrice)), + NowPrice: utils.Str2Float64(utils.Int64ToStr(int64(unitPrice / 100))), + MixPrice: utils.Str2Float64(utils.Int64ToStr(int64(unitPrice) - skuList[0].UnitPrice)), } dataLock.AppendDataSuccess(outSuccess) } else {