1
This commit is contained in:
@@ -715,8 +715,9 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
priceList := storeSku2Mtwm(storeSkuList, updateTypePrice)
|
||||
api := getAPI(vendorOrgCode, storeID, vendorStoreID)
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
failedFoodList, err2 := getAPI(vendorOrgCode, storeID, vendorStoreID).RetailSkuPrice(ctx.GetTrackInfo(), vendorStoreID, priceList)
|
||||
failedFoodList, err2 := api.RetailSkuPrice(ctx.GetTrackInfo(), vendorStoreID, priceList)
|
||||
if err = err2; err == nil {
|
||||
if len(failedFoodList) > 0 {
|
||||
failedList = SelectStoreSkuListByFoodList(storeSkuList, failedFoodList, storeID, model.VendorChineseNames[model.VendorIDMTWM], "更新商品价格")
|
||||
@@ -731,6 +732,34 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg
|
||||
if len(failedList) > 0 {
|
||||
err = nil
|
||||
}
|
||||
|
||||
// 改价的同时去修改报价门店的进货价
|
||||
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDMTWM, "")
|
||||
spuList := make([]*mtwmapi.SpuData, 0, 0)
|
||||
for _, storeSku := range storeSkuList {
|
||||
if storeDetail.QuotationPrice != 0 && storeDetail.PayPercentage >= 50 {
|
||||
spuList = append(spuList, &mtwmapi.SpuData{
|
||||
AppSpuCode: utils.Int2Str(storeSku.SkuID),
|
||||
SkuID: utils.Int2Str(storeSku.SkuID),
|
||||
PurchasePrice: utils.Float64ToStr(float64(storeDetail.QuotationPrice) / float64(100)),
|
||||
})
|
||||
}
|
||||
}
|
||||
// 报价门店同步进货价
|
||||
if len(spuList) > 0 {
|
||||
count := len(spuList) / 50
|
||||
if len(spuList)%50 != 0 {
|
||||
count++
|
||||
}
|
||||
for i := 1; i <= count; i++ {
|
||||
if i == count {
|
||||
api.BatchSetRestockingPrice(utils.GetUUID(), vendorStoreID, spuList[(i-1)*50:])
|
||||
} else {
|
||||
api.BatchSetRestockingPrice(utils.GetUUID(), vendorStoreID, spuList[(i-1)*50:i*50])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user