物料订单配送费计算
This commit is contained in:
@@ -421,16 +421,6 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
|||||||
outJxOrder = &outJxOrder2
|
outJxOrder = &outJxOrder2
|
||||||
outJxOrder.StoreName = storeDetail.Name
|
outJxOrder.StoreName = storeDetail.Name
|
||||||
|
|
||||||
//表示此订单为物料配送订单
|
|
||||||
if fromStoreID != 0 {
|
|
||||||
storeDetail2, err2 := dao.GetStoreDetail(db, fromStoreID, model.VendorIDJX)
|
|
||||||
if err = err2; err != nil {
|
|
||||||
return nil, nil, fmt.Errorf("fromStoreID有误,[%v]", fromStoreID)
|
|
||||||
}
|
|
||||||
deliveryAddress.ConsigneeName = storeDetail2.Name
|
|
||||||
outJxOrder.FromStoreID = fromStoreID
|
|
||||||
}
|
|
||||||
|
|
||||||
skus := formalizeSkus(jxOrder.Skus)
|
skus := formalizeSkus(jxOrder.Skus)
|
||||||
// 允许空商品列表(一般用于测试配送地址,门店信息是否合适)
|
// 允许空商品列表(一般用于测试配送地址,门店信息是否合适)
|
||||||
if len(skus) > 0 {
|
if len(skus) > 0 {
|
||||||
@@ -501,23 +491,40 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.Sort(JxSkuInfoList(outJxOrder.Skus))
|
if fromStoreID == 0 {
|
||||||
outJxOrder.FreightPrice, _, err = delivery.CalculateDeliveryFee(dao.GetDB(), jxOrder.StoreID, "",
|
sort.Sort(JxSkuInfoList(outJxOrder.Skus))
|
||||||
jxutils.StandardCoordinate2Int(deliveryAddress.Lng), jxutils.StandardCoordinate2Int(deliveryAddress.Lat),
|
outJxOrder.FreightPrice, _, err = delivery.CalculateDeliveryFee(dao.GetDB(), jxOrder.StoreID, "",
|
||||||
model.CoordinateTypeMars, outJxOrder.Weight, checkTime)
|
jxutils.StandardCoordinate2Int(deliveryAddress.Lng), jxutils.StandardCoordinate2Int(deliveryAddress.Lat),
|
||||||
|
model.CoordinateTypeMars, outJxOrder.Weight, checkTime)
|
||||||
|
}
|
||||||
// if jxOrder.StoreID == specialStoreID {
|
// if jxOrder.StoreID == specialStoreID {
|
||||||
// outJxOrder.FreightPrice = 0
|
// outJxOrder.FreightPrice = 0
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
outJxOrder.FreightPrice = 0
|
outJxOrder.FreightPrice = 0
|
||||||
}
|
}
|
||||||
if outJxOrder.FreightPrice > specialFreightPrice {
|
//表示此订单为物料配送订单
|
||||||
outJxOrder.FreightPrice = specialFreightPrice
|
if fromStoreID != 0 {
|
||||||
}
|
storeDetail2, err2 := dao.GetStoreDetail(db, fromStoreID, model.VendorIDJX)
|
||||||
if outJxOrder.OrderPrice >= int64(storeDetail.DeliveryFeeDeductionSill) {
|
if err = err2; err != nil {
|
||||||
outJxOrder.FreightPrice -= int64(storeDetail.DeliveryFeeDeductionFee)
|
return nil, nil, fmt.Errorf("fromStoreID有误,[%v]", fromStoreID)
|
||||||
if outJxOrder.FreightPrice < 0 {
|
}
|
||||||
outJxOrder.FreightPrice = 0
|
deliveryAddress.ConsigneeName = storeDetail2.Name
|
||||||
|
outJxOrder.FromStoreID = fromStoreID
|
||||||
|
if outJxOrder.Weight <= 2000 {
|
||||||
|
outJxOrder.FreightPrice = 500
|
||||||
|
} else {
|
||||||
|
outJxOrder.FreightPrice = utils.Float64TwoInt64(500 + math.Ceil((utils.Int2Float64(outJxOrder.Weight)-2000)/1000)*200)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if outJxOrder.FreightPrice > specialFreightPrice {
|
||||||
|
outJxOrder.FreightPrice = specialFreightPrice
|
||||||
|
}
|
||||||
|
if outJxOrder.OrderPrice >= int64(storeDetail.DeliveryFeeDeductionSill) {
|
||||||
|
outJxOrder.FreightPrice -= int64(storeDetail.DeliveryFeeDeductionFee)
|
||||||
|
if outJxOrder.FreightPrice < 0 {
|
||||||
|
outJxOrder.FreightPrice = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user