From 95ad575e0965bbf8add30984b5a0b2d57b411c87 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 21 Feb 2020 10:24:01 +0800 Subject: [PATCH] =?UTF-8?q?StoreMap=E6=B7=BB=E5=8A=A0DeliveryFeeDeductionS?= =?UTF-8?q?ill,=20DeliveryFeeDeductionFee?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/dao_order_test.go | 4 ++-- business/model/dao/store.go | 13 +++++++------ business/model/store.go | 9 +++++---- business/partner/purchase/jx/localjx/order.go | 6 ++++++ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/business/model/dao/dao_order_test.go b/business/model/dao/dao_order_test.go index a30eed64a..539001f27 100644 --- a/business/model/dao/dao_order_test.go +++ b/business/model/dao/dao_order_test.go @@ -26,13 +26,13 @@ func TestGetAfsOrderSkuInfo(t *testing.T) { } func TestGetStoreOrderSkuList(t *testing.T) { - skuList, err := GetStoreOrderSkuList(GetDB(), []int{100118}, time.Now().Add(-30*time.Hour), time.Now(), nil) + skuList, err := GetStoreOrderSkuList(GetDB(), []int{100118}, time.Now().Add(-30*time.Hour), time.Now(), nil, false) if err != nil { t.Fatal(err) } t.Log(utils.Format4Output(skuList, false)) - afsSkuList, err := GetStoreOrderSkuList(GetDB(), []int{100118}, time.Now().Add(-30*time.Hour), time.Now(), nil) + afsSkuList, err := GetStoreOrderSkuList(GetDB(), []int{100118}, time.Now().Add(-30*time.Hour), time.Now(), nil, false) if err != nil { t.Fatal(err) } diff --git a/business/model/dao/store.go b/business/model/dao/store.go index b9db74271..6135869c3 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -16,11 +16,12 @@ type StoreDetail struct { VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空 - VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` - VendorStoreName string `json:"vendorStoreName"` - VendorStatus int `json:"vendor_status"` // 取值同Store.Status - DeliveryFee int `json:"deliveryFee"` - SyncStatus int8 `orm:"default(2)" json:"syncStatus"` + VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` + VendorStoreName string `json:"vendorStoreName"` + VendorStatus int `json:"vendor_status"` // 取值同Store.Status + DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` + DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` + SyncStatus int8 `orm:"default(2)" json:"syncStatus"` PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格 PricePercentagePackStr string `orm:"size(4096)" json:"-"` // @@ -86,7 +87,7 @@ func (s *StoreDetail) GetPricePerentage(price int) (pricePercentage int) { func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (storeDetail *StoreDetail, err error) { sql := ` 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_deduction_sill, t2.delivery_fee_deduction_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, t3.value price_percentage_pack_str, t4.value freight_deduction_pack_str, diff --git a/business/model/store.go b/business/model/store.go index b0c82a868..799714676 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -407,10 +407,11 @@ type StoreMap struct { FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` // - AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货 - DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型 - DeliveryFee int `json:"deliveryFee"` - DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争 + AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货 + DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型 + DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` + DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` + DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争 SyncStatus int8 `orm:"default(2)" json:"syncStatus"` IsSync int8 `orm:"default(1)" json:"isSync"` // 是否同步 diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 3e631bb2a..028426ace 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -466,6 +466,12 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64 } else { outJxOrder.FreightPrice = 0 } + if outJxOrder.OrderPrice >= int64(storeDetail.DeliveryFeeDeductionSill) { + outJxOrder.FreightPrice -= int64(storeDetail.DeliveryFeeDeductionFee) + if outJxOrder.FreightPrice < 0 { + outJxOrder.FreightPrice = 0 + } + } if err == nil { outJxOrder.TotalPrice = outJxOrder.OrderPrice + outJxOrder.FreightPrice outJxOrder.ActualPayPrice = outJxOrder.TotalPrice