+StoreMap.BoxFee

美团外卖支持打包袋费,美团商品统一添加1角打包费
This commit is contained in:
gazebo
2019-12-30 16:50:32 +08:00
parent cee131b197
commit f1d025eb15
5 changed files with 33 additions and 5 deletions

View File

@@ -176,6 +176,13 @@ var (
"promoteInfo": 1,
}
storeMapKeyPropertyMap = map[string]int{
"status": 1,
"freightDeductionPack": 1,
"vendorStoreName": 1,
"boxFee": 1,
}
WatchVendorStoreTimeList = []string{
"8:00:00",
"10:00:00",
@@ -1121,6 +1128,17 @@ func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
return num, err
}
func isStoreMapNeedSync(vendorID int, valid map[string]interface{}) bool {
if vendorID != model.VendorIDJX {
for k := range valid {
if storeMapKeyPropertyMap[k] == 1 {
return true
}
}
}
return false
}
func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, payload map[string]interface{}, userName string) (num int64, err error) {
if vendorID != model.VendorIDJD {
if autoPickup, ok := payload["autoPickup"]; ok && autoPickup == 0 {
@@ -1196,7 +1214,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
panic(r)
}
}()
if valid["status"] != nil || valid["vendorStoreName"] != nil { // 对于store vendor map只有Status改变才需要同步到厂商
if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map只有Status改变才需要同步到厂商
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
model.FieldStoreID: storeID,
model.FieldVendorID: vendorID,
@@ -1229,7 +1247,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
}
}
dao.Commit(db)
if vendorID != model.VendorIDJX && (valid["status"] != nil || valid["freightDeductionPack"] != nil || valid["vendorStoreName"] != nil) {
if isStoreMapNeedSync(vendorID, valid) {
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
}
}

View File

@@ -26,6 +26,7 @@ type StoreDetail struct {
FreightDeductionPackStr string `orm:"size(4096)" json:"-"` //
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
BoxFee int `orm:"default(1)" json:"boxFee"` // 打包费
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
@@ -84,7 +85,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
sql := `
SELECT t1.*,
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.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.box_fee,
t3.value price_percentage_pack_str,
t4.value freight_deduction_pack_str,
district.name district_name,

View File

@@ -398,6 +398,8 @@ type StoreMap struct {
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
BoxFee int `orm:"default(0)" json:"boxFee"` // 打包费
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
DeliveryFee int `json:"deliveryFee"`

View File

@@ -156,6 +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.UpdateStoreOpTime(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
errList.AddErr(p.UpdateStoreBoxFee(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.BoxFee))
return errList.GetErrListAsOne()
}
@@ -290,3 +291,8 @@ func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context, vendorOrg
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error) {
return err
}
func (c *PurchaseHandler) UpdateStoreBoxFee(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, boxFee int) (err error) {
err = api.MtwmAPI.PackagePriceUpdate(vendorStoreID, 1, boxFee)
return err
}

View File

@@ -28,6 +28,7 @@ const (
specialStoreID = "8171010"
// specialStoreID = "2523687"
fixBoxFee = 10
)
var (
@@ -252,8 +253,8 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
}
foodData["min_order_count"] = 1
foodData["unit"] = storeSku.Unit
foodData["box_num"] = 0
foodData["box_price"] = 0.0
foodData["box_num"] = 1
foodData["box_price"] = jxutils.IntPrice2Standard(fixBoxFee)
catCode := tryCatName2Code(storeSku.VendorCatID)
if catCode != "" {
foodData["category_code"] = catCode