美团饿百打包费改为统一系统参数
This commit is contained in:
@@ -225,10 +225,21 @@ func calVendorPrice4StoreSku(inSku *dao.StoreSkuSyncInfo, pricePercentagePack mo
|
|||||||
return inSku
|
return inSku
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getSkuBoxFee(vendorID int) (boxFee int64) {
|
||||||
|
if vendorID == model.VendorIDMTWM {
|
||||||
|
boxFee, _ = dao.GetSysConfigAsInt64(dao.GetDB(), model.ConfigSysMtwmSkuBoxFee)
|
||||||
|
}
|
||||||
|
return boxFee
|
||||||
|
}
|
||||||
|
|
||||||
func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyncInfo {
|
func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyncInfo {
|
||||||
for _, skuItem := range inSkuList {
|
if len(inSkuList) > 0 {
|
||||||
skuItem.MergedStatus = jxutils.MergeSkuStatus(skuItem.Status, skuItem.StoreSkuStatus)
|
boxFee := getSkuBoxFee(inSkuList[0].VendorID)
|
||||||
skuItem.SkuName = jxutils.ComposeSkuNameSync(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0, skuItem.ExPrefix, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd)
|
for _, skuItem := range inSkuList {
|
||||||
|
skuItem.BoxFee = boxFee
|
||||||
|
skuItem.MergedStatus = jxutils.MergeSkuStatus(skuItem.Status, skuItem.StoreSkuStatus)
|
||||||
|
skuItem.SkuName = jxutils.ComposeSkuNameSync(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0, skuItem.ExPrefix, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return inSkuList
|
return inSkuList
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,3 +49,13 @@ func ValidateRoles(db *DaoDB, roles ...string) (err error) {
|
|||||||
}
|
}
|
||||||
return errList.GetErrListAsOne()
|
return errList.GetErrListAsOne()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetSysConfigAsInt64(db *DaoDB, key string) (value int64, err error) {
|
||||||
|
configList, err := QueryConfigs(db, key, model.ConfigTypeSys, "")
|
||||||
|
if err == nil && len(configList) > 0 {
|
||||||
|
value = utils.Str2Int64WithDefault(configList[0].Value, 0)
|
||||||
|
} else if IsNoRowsError(err) {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
return value, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ type StoreDetail struct {
|
|||||||
|
|
||||||
FreightDeductionPackStr string `orm:"size(4096)" json:"-"` //
|
FreightDeductionPackStr string `orm:"size(4096)" json:"-"` //
|
||||||
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
|
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
|
||||||
BoxFee int `orm:"default(1)" json:"boxFee"` // 打包费
|
|
||||||
|
|
||||||
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
||||||
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
||||||
@@ -85,7 +84,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
|
|||||||
sql := `
|
sql := `
|
||||||
SELECT t1.*,
|
SELECT t1.*,
|
||||||
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee, t2.sync_status, t2.vendor_org_code,
|
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee, t2.sync_status, t2.vendor_org_code,
|
||||||
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.box_fee,
|
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name,
|
||||||
t3.value price_percentage_pack_str,
|
t3.value price_percentage_pack_str,
|
||||||
t4.value freight_deduction_pack_str,
|
t4.value freight_deduction_pack_str,
|
||||||
district.name district_name,
|
district.name district_name,
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ type StoreSkuSyncInfo struct {
|
|||||||
StoreID int `orm:"column(store_id)"`
|
StoreID int `orm:"column(store_id)"`
|
||||||
SkuID int `orm:"column(sku_id)"` // 这个与Sku.ID的区别是SkuID是必然存在的
|
SkuID int `orm:"column(sku_id)"` // 这个与Sku.ID的区别是SkuID是必然存在的
|
||||||
|
|
||||||
|
BoxFee int64
|
||||||
|
|
||||||
Price int64
|
Price int64
|
||||||
UnitPrice int64
|
UnitPrice int64
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ const (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
ConfigSysFakeOrderMobiles = "FakeOrderMobiles" // 假订单手机
|
ConfigSysFakeOrderMobiles = "FakeOrderMobiles" // 假订单手机
|
||||||
|
ConfigSysEbaiBoxFee = "EbaiBoxFee" // 饿百打包费
|
||||||
|
ConfigSysMtwmBoxFee = "MtwmBoxFee" // 美团外卖打包费
|
||||||
|
ConfigSysMtwmSkuBoxFee = "MtwmSkuBoxFee" // 美团外卖单商品打包费
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -398,8 +398,6 @@ type StoreMap struct {
|
|||||||
|
|
||||||
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
|
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
|
||||||
|
|
||||||
BoxFee int `orm:"default(0)" json:"boxFee"` // 打包费
|
|
||||||
|
|
||||||
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
||||||
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
||||||
DeliveryFee int `json:"deliveryFee"`
|
DeliveryFee int `json:"deliveryFee"`
|
||||||
|
|||||||
@@ -400,6 +400,9 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
|||||||
params["name"] = jxutils.ComposeStoreName(store.Name, model.VendorIDEBAI)
|
params["name"] = jxutils.ComposeStoreName(store.Name, model.VendorIDEBAI)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// boxFee, _ := dao.GetSysConfigAsInt64(dao.GetDB(), model.ConfigSysEbaiBoxFee)
|
||||||
|
// params["package_box_price"] = boxFee
|
||||||
|
|
||||||
params["address"] = store.Address
|
params["address"] = store.Address
|
||||||
// todo 饿百 开店审核通过后不允许修改商户信息
|
// todo 饿百 开店审核通过后不允许修改商户信息
|
||||||
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
|
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, mergedStoreStatus))
|
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, mergedStoreStatus))
|
||||||
}
|
}
|
||||||
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
||||||
errList.AddErr(p.UpdateStoreBoxFee(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.BoxFee))
|
errList.AddErr(p.UpdateStoreBoxFee(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID))
|
||||||
return errList.GetErrListAsOne()
|
return errList.GetErrListAsOne()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +292,10 @@ func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgC
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreBoxFee(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, boxFee int) (err error) {
|
func (c *PurchaseHandler) UpdateStoreBoxFee(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (err error) {
|
||||||
err = api.MtwmAPI.PackagePriceUpdate(vendorStoreID, 1, boxFee)
|
// boxFee, err := dao.GetSysConfigAsInt64(dao.GetDB(), model.ConfigSysMtwmBoxFee)
|
||||||
|
// if err == nil {
|
||||||
|
// err = api.MtwmAPI.PackagePriceUpdate(vendorStoreID, 1, int(boxFee))
|
||||||
|
// }
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ const (
|
|||||||
|
|
||||||
specialStoreID = "8171010"
|
specialStoreID = "8171010"
|
||||||
// specialStoreID = "2523687"
|
// specialStoreID = "2523687"
|
||||||
fixBoxFee = 10
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -254,7 +253,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
foodData["min_order_count"] = 1
|
foodData["min_order_count"] = 1
|
||||||
foodData["unit"] = storeSku.Unit
|
foodData["unit"] = storeSku.Unit
|
||||||
foodData["box_num"] = 1
|
foodData["box_num"] = 1
|
||||||
foodData["box_price"] = jxutils.IntPrice2Standard(fixBoxFee)
|
foodData["box_price"] = jxutils.IntPrice2Standard(storeSku.BoxFee)
|
||||||
catCode := tryCatName2Code(storeSku.VendorCatID)
|
catCode := tryCatName2Code(storeSku.VendorCatID)
|
||||||
if catCode != "" {
|
if catCode != "" {
|
||||||
foodData["category_code"] = catCode
|
foodData["category_code"] = catCode
|
||||||
|
|||||||
Reference in New Issue
Block a user