This commit is contained in:
邹宗楠
2023-06-28 11:24:09 +08:00
parent 1952a934f8
commit 10036ef262
7 changed files with 430 additions and 396 deletions

View File

@@ -121,19 +121,32 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
}
// 重量超标减少配送费
weight := 4.9500
if utils.Int2Float64(order.Weight)/1000 >= weight {
reallyWeight := utils.Int2Float64(order.Weight) / 1000
if reallyWeight >= weight || reallyWeight <= model.NO {
parameter.GoodsWeight = weight
} else {
parameter.GoodsWeight = reallyWeight
}
var goodsList []*fnpsapi.GoodsItemsList
for _, v := range order.Skus {
if len(order.Skus) == model.NO {
goodsList = append(goodsList, &fnpsapi.GoodsItemsList{
ItemName: v.SkuName,
ItemQuantity: v.Count,
ItemAmountCent: v.SalePrice,
ItemActualAmountCent: v.SalePrice,
ItemId: utils.Int2Str(v.SkuID),
ItemName: "平台商品(本地暂无储存信息)",
ItemQuantity: model.YES,
ItemAmountCent: model.YES,
ItemActualAmountCent: model.YES,
ItemId: utils.Int2Str(9527),
})
} else {
for _, v := range order.Skus {
goodsList = append(goodsList, &fnpsapi.GoodsItemsList{
ItemName: v.SkuName,
ItemQuantity: v.Count,
ItemAmountCent: v.SalePrice,
ItemActualAmountCent: v.SalePrice,
ItemId: utils.Int2Str(v.SkuID),
})
}
}
parameter.GoodsItemList = goodsList
@@ -181,20 +194,34 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
}
// 重量超标减少配送费
weight := 4.9500
if utils.Int2Float64(order.Weight)/1000 >= weight {
reallyWeight := utils.Int2Float64(order.Weight) / 1000
if reallyWeight >= weight || reallyWeight <= model.NO {
preCreateOrder.GoodsWeight = weight
} else {
preCreateOrder.GoodsWeight = reallyWeight
}
var goodsList []*fnpsapi.GoodsItemsList
for _, v := range order.Skus {
if len(order.Skus) == model.NO {
goodsList = append(goodsList, &fnpsapi.GoodsItemsList{
ItemName: v.SkuName,
ItemQuantity: v.Count,
ItemAmountCent: v.SalePrice,
ItemActualAmountCent: v.SalePrice,
ItemId: utils.Int2Str(v.SkuID),
ItemName: "平台商品(本地暂无储存信息)",
ItemQuantity: model.YES,
ItemAmountCent: model.YES,
ItemActualAmountCent: model.YES,
ItemId: utils.Int2Str(9527),
})
} else {
for _, v := range order.Skus {
goodsList = append(goodsList, &fnpsapi.GoodsItemsList{
ItemName: v.SkuName,
ItemQuantity: v.Count,
ItemAmountCent: v.SalePrice,
ItemActualAmountCent: v.SalePrice,
ItemId: utils.Int2Str(v.SkuID),
})
}
}
preCreateOrder.GoodsItemList = goodsList
deliveryFeeInfo = &partner.WaybillFeeInfo{}