- 使用GetPricePercentage

This commit is contained in:
gazebo
2019-07-15 18:26:25 +08:00
parent ff4b6098d7
commit 1650a2d7e8
8 changed files with 46 additions and 46 deletions

View File

@@ -184,6 +184,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
func(rootTask *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
v := batchItemList[0]
skuItem := v.(*dao.StoreSkuSyncInfo)
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, int(skuItem.Price), int(storeDetail.PricePercentage))
updateFields := []string{model.FieldWscSyncStatus}
storeSkuBind := &model.StoreSkuBind{}
storeSkuBind.ID = skuItem.BindID
@@ -202,14 +203,14 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
outerGoodsCode := utils.Int2Str(skuItem.NameID)
title := jxutils.ComposeSkuName(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 30)
isPutAway := jxutils.MergeSkuStatus(skuItem.Status, skuItem.StoreSkuStatus) == model.SkuStatusNormal
categoryId := skuItem.VendorVendorCatID
if categoryId == 0 {
categoryId = DefVendorCategoryId
categoryID := skuItem.VendorVendorCatID
if categoryID == 0 {
categoryID = DefVendorCategoryId
}
classifyIdList := []int64{utils.Str2Int64WithDefault(skuItem.VendorCatID, 0)}
classifyIDList := []int64{utils.Str2Int64WithDefault(skuItem.VendorCatID, 0)}
if skuItem.SkuVendorCatID != "" {
if int64Value := utils.Str2Int64WithDefault(skuItem.SkuVendorCatID, 0); int64Value > 0 {
classifyIdList = append(classifyIdList, int64Value)
classifyIDList = append(classifyIDList, int64Value)
}
}
b2cGoods := &weimobapi.PendingSaveB2CGoodsVo{
@@ -217,7 +218,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
DeliveryTypeIdList: []int64{DefDeliveryTypeId},
B2cGoodsType: weimobapi.GoodsTypeNormal,
}
salePrice := int64(jxutils.CaculateSkuVendorPrice(int(skuItem.Price), int(storeDetail.PricePercentage), skuItem.CatPricePercentage))
salePrice := int64(jxutils.CaculateSkuVendorPrice(int(skuItem.Price), pricePercentage, skuItem.CatPricePercentage))
skuList := []map[string]interface{}{
map[string]interface{}{
weimobapi.KeyOuterSkuCode: utils.Int2Str(skuItem.ID),
@@ -237,7 +238,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
skuMap map[string]int64
)
if globals.EnableWscStoreWrite {
goodsID, skuMap, err = api.WeimobAPI.AddGoods(outerGoodsCode, title, false, []string{skuItem.Img}, skuItem.Comment, isPutAway, 0, categoryId, classifyIdList, b2cGoods, skuList, nil)
goodsID, skuMap, err = api.WeimobAPI.AddGoods(outerGoodsCode, title, false, []string{skuItem.Img}, skuItem.Comment, isPutAway, 0, categoryID, classifyIDList, b2cGoods, skuList, nil)
} else {
goodsID = jxutils.GenFakeID()
skuMap = map[string]int64{
@@ -261,7 +262,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
// skuList[0][weimobapi.KeyEditStockNum] = model.MaxStoreSkuStockQty - int(utils.MustInterface2Int64(remoteSkuList[0].(map[string]interface{})[weimobapi.KeyAvailableStockNum]))
}
if globals.EnableWscStoreWrite {
_, _, err = api.WeimobAPI.UpdateGoods(goodsID, title, false, []string{skuItem.Img}, skuItem.Comment, isPutAway, 0, categoryId, classifyIdList, b2cGoods, skuList, nil)
_, _, err = api.WeimobAPI.UpdateGoods(goodsID, title, false, []string{skuItem.Img}, skuItem.Comment, isPutAway, 0, categoryID, classifyIDList, b2cGoods, skuList, nil)
}
}
}