- fix calculateOrderDeliveryFee bug for weight.

This commit is contained in:
gazebo
2018-09-05 22:48:15 +08:00
parent 1ed1838802
commit c52e8deade
4 changed files with 7 additions and 7 deletions

View File

@@ -170,7 +170,7 @@ func (c *OrderManager) legacyWriteJxOrder(order *model.GoodsOrder, db orm.Ormer,
OrderTotalMoney: int(order.SalePrice),
OrderDiscountMoney: int(order.SalePrice - order.ActualPayPrice),
OrderBuyerPayableMoney: int(order.ActualPayPrice),
// DeliveryPackageWeight: float64(order.Weight) / 1000,
// DeliveryPackageWeight: float64(jxutils.IntWeight2Float(order.Weight)),
}
if order.VendorID == model.VendorIDELM {
jxorder.OrderStatus = JX_ORDER_STATUS_WAIT_FOR_DELIVERY

View File

@@ -112,7 +112,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy func(del
// "origin_mark": model.VendorNames[order.VendorID],
"origin_mark_no": fmt.Sprintf("%d", order.OrderSeq),
"cargo_type": 13,
"cargo_weight": float64(order.Weight) / 1000.0,
"cargo_weight": jxutils.IntWeight2Float(order.Weight),
"cargo_num": order.GoodsCount,
}

View File

@@ -144,11 +144,11 @@ func (c *DeliveryHandler) calculateOrderDeliveryFee(order *model.GoodsOrder, bil
if order.Weight < 5*1000 {
} else if order.Weight < 10*1000 {
addFee += jxutils.StandardPrice2Int(0.5 * float64(order.Weight/1000-5))
addFee += jxutils.StandardPrice2Int(0.5 * float64(jxutils.IntWeight2Float(order.Weight)-5))
} else if order.Weight < 20*1000 {
addFee += jxutils.StandardPrice2Int(2.5 + 1*float64(order.Weight/1000-10))
addFee += jxutils.StandardPrice2Int(2.5 + 1*float64(jxutils.IntWeight2Float(order.Weight)-10))
} else {
addFee += jxutils.StandardPrice2Int(2.5 + 10 + 2*float64(order.Weight/1000-20))
addFee += jxutils.StandardPrice2Int(2.5 + 10 + 2*float64(jxutils.IntWeight2Float(order.Weight)-20))
}
hour, min, sec := billTime.Clock()
@@ -191,7 +191,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy func(del
ReceiverLng: jxutils.StandardCoordinate2Int(lngFloat),
ReceiverLat: jxutils.StandardCoordinate2Int(latFloat),
GoodsValue: jxutils.IntPrice2Standard(order.ActualPayPrice), // todo 超价处理
GoodsWeight: float64(order.Weight) / 1000,
GoodsWeight: float64(jxutils.IntWeight2Float(order.Weight)),
// ExpectedDeliveryTime: order.ExpectedDeliveredTime.Unix(),
OrderType: mtpsapi.OrderTypeASAP,
}

View File

@@ -114,7 +114,7 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err
SkuID: int(utils.Str2Int64WithDefault(utils.Interface2String(product["skuIdIsv"]), 0)),
VendorSkuID: utils.Int64ToStr(utils.MustInterface2Int64(product["skuId"])),
SkuName: product["skuName"].(string),
Weight: int(utils.MustInterface2Float64(product["skuWeight"]) * 1000),
Weight: jxutils.FloatWeight2Int(float32(utils.MustInterface2Float64(product["skuWeight"]))),
SalePrice: utils.MustInterface2Int64(product["skuJdPrice"]),
PromotionType: int(utils.MustInterface2Int64(product["promotionType"])),
}