StoreMap添加DeliveryFeeDeductionSill, DeliveryFeeDeductionFee
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"` // 是否同步
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user