This commit is contained in:
richboo111
2024-01-23 16:46:50 +08:00
parent c6b5305353
commit 28922e913f
16 changed files with 258 additions and 180 deletions

View File

@@ -319,7 +319,7 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
return deliveryFeeInfo, err
}
// CreateWaybill (美团配送)
// CreateWaybill美团配送
func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee int64) (bill *model.Waybill, err error) {
db := dao.GetDB()
// 检查配送平台是否被禁用
@@ -331,6 +331,17 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
return nil, fmt.Errorf("此平台配送已被系统关闭,暂不发配送 [%v]", vendorOrgCode[0].Comment)
}
globals.SugarLogger.Debugf("===================maxDeliveryFee := %d", maxDeliveryFee)
if maxDeliveryFee == model.NO {
fee, err := c.GetWaybillFee(order)
if err != nil {
return nil, err
}
if fee.DeliveryFee >= model.DefMaxDeliveryFee {
return nil, fmt.Errorf("美团配送超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee))
}
}
// 忽略坐标转换错误,即使是转换出错,也只能当成转换成功来处理,底层会有错误日志输出
lngFloat, latFloat, _ := jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType)
billParams := &mtpsapi.CreateOrderByShopParam{