This commit is contained in:
邹宗楠
2023-05-15 09:32:02 +08:00
parent 816b200db7
commit 1c9760b540
13 changed files with 74 additions and 24 deletions

View File

@@ -146,13 +146,15 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
}
// 查询订单获取配送费
desireFee, actualFee := GetDesiredFee(order.VendorOrderID)
bill = &model.Waybill{
VendorOrderID: order.VendorOrderID,
OrderVendorID: order.VendorID,
VendorWaybillID: fnOrderId,
VendorWaybillID2: order.VendorOrderID,
WaybillVendorID: model.VendorIDFengNiao,
DesiredFee: GetDesiredFee(order.VendorOrderID),
DesiredFee: desireFee,
ActualFee: actualFee,
}
delivery.OnWaybillCreated(bill)
return bill, err
@@ -193,7 +195,7 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
preCreateOrder.GoodsItemList = goodsList
deliveryFeeInfo = &partner.WaybillFeeInfo{}
deliveryFeeInfo.RefDeliveryFee, deliveryFeeInfo.RefAddFee, err = api.FnAPI.PreCreateByShopFn(preCreateOrder)
deliveryFeeInfo.RefDeliveryFee, deliveryFeeInfo.RefAddFee, err = api.FnAPI.PreCreateByShopFn(preCreateOrder) //
deliveryFeeInfo.DeliveryFee = deliveryFeeInfo.RefDeliveryFee
return deliveryFeeInfo, err
}
@@ -229,14 +231,14 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify) (resp *fnpsapi.CallbackRespon
orderStatus := utils.Str2Int64(order.VendorStatus)
switch orderStatus {
case fnpsapi.OrderStatusAcceptCreate, fnpsapi.OrderStatusAccept: // 0 创建订单
order.DesiredFee = GetDesiredFee(order.VendorOrderID)
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
order.Status = model.WaybillStatusNew //5 带调度
case fnpsapi.OrderStatusAssigned: //20分配骑手
order.DesiredFee = GetDesiredFee(order.VendorOrderID)
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
order.Status = model.WaybillStatusCourierAssigned //12
order.Remark = order.CourierName + "" + order.CourierMobile
case fnpsapi.OrderStatusArrived: // 80 到店
order.DesiredFee = GetDesiredFee(order.VendorOrderID)
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
order.Status = model.WaybillStatusCourierArrived
case fnpsapi.OrderStatusDelivering: // 2 配送中
order.Status = model.WaybillStatusDelivering
@@ -320,11 +322,11 @@ func (c *DeliveryHandler) OnWaybillExcept(msg *fnpsapi.AbnormalReportNotify) (re
}
// 查询订单配送费
func GetDesiredFee(vendorOrderID string) (desiredFee int64) {
func GetDesiredFee(vendorOrderID string) (desiredFee, acuteFee int64) {
if result, err := api.FnAPI.QueryOrder(vendorOrderID); err == nil {
return result.OrderActualAmountCent
return result.OrderActualAmountCent, result.OrderTotalAmountCent
}
return desiredFee
return desiredFee, acuteFee
}
// 获取骑手信息

View File

@@ -92,6 +92,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
return mtpsapi.Err2CallbackResponse(err, fmt.Sprintf("%s", "获取订单状态错误"))
}
order.DesiredFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["delivery_fee"]) * 100)
order.ActualFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["pay_amount"]) * 100)
order.Status = model.WaybillStatusNew
case mtpsapi.OrderStatusAccepted: // 已接单
data, err := api.MtpsAPI.QueryOrderStatus(msg.DeliveryID, msg.MtPeisongID)
@@ -99,6 +100,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
return mtpsapi.Err2CallbackResponse(err, fmt.Sprintf("%s", "获取订单状态错误"))
}
order.DesiredFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["delivery_fee"]) * 100)
order.ActualFee = utils.Float64TwoInt64(utils.MustInterface2Float64(data["pay_amount"]) * 100)
order.Status = model.WaybillStatusCourierAssigned
order.Remark = order.CourierName + "" + order.CourierMobile
case mtpsapi.OrderStatusPickedUp: // 已取货

View File

@@ -354,6 +354,7 @@ func UpdateFakeWayBillToTiktok() {
LogisticsStatus: fakeWayBill[i].Status,
}
// 设置骑手和下一状态时间
makeRiderInfo(fakeWayBill[i], riderInfo)
if riderInfo.LogisticsContext != model.RiderGetOrderDeliverFailed && riderInfo.LogisticsContext != model.RiderGetOrderDeliverOther && riderInfo.LogisticsContext != model.RiderWaitRider {

View File

@@ -317,22 +317,28 @@ func OnWaybillMsg(req *uuptapi.WaybillCallbackParam) (resp *uuptapi.CallbackResp
case uuptapi.StateConfirmSuccess:
param.Status = model.WaybillStatusNew //5 待调度
param.DesiredFee = reallyPrice
param.ActualFee = reallyPrice
case uuptapi.StateRMGrabsOrder:
param.Status = model.WaybillStatusCourierAssigned
param.Remark = req.DriverName + "," + req.DriverMobile
param.DesiredFee = reallyPrice
param.ActualFee = reallyPrice
case uuptapi.StateArrivedStore:
param.Status = model.WaybillStatusCourierArrived
param.DesiredFee = reallyPrice
param.ActualFee = reallyPrice
case uuptapi.StatePickUp:
param.Status = model.WaybillStatusUuPickUp
param.DesiredFee = reallyPrice
param.ActualFee = reallyPrice
case uuptapi.StateArrivedDestination:
param.Status = model.WaybillStatusUuArrivedDestination
param.DesiredFee = reallyPrice
param.ActualFee = reallyPrice
case uuptapi.StateReceiverGetGoods:
param.Status = model.WaybillStatusDelivered
param.DesiredFee = reallyPrice
param.ActualFee = reallyPrice
case uuptapi.StateOrderCancel:
param.Status = model.WaybillStatusCanceled
default:

View File

@@ -18,10 +18,10 @@ const (
type WaybillFeeInfo struct {
ErrCode int `json:"errCode"`
ErrStr string `json:"errStr"`
RefDeliveryFee int64 `json:"refDeliveryFee"` // 无用,待删除
RefAddFee int64 `json:"refAddFee"` // 无用,待删除
DeliveryFee int64 `json:"deliveryFee"`
TimeoutSecond int `json:"timeoutSecond"` // 系统会自动发运单的倒计时
RefDeliveryFee int64 `json:"refDeliveryFee"` // 优惠后
RefAddFee int64 `json:"refAddFee"` // 原始配送费
DeliveryFee int64 `json:"deliveryFee"` // 优惠后
TimeoutSecond int `json:"timeoutSecond"` // 系统会自动发运单的倒计时
Waybill *model.Waybill `json:"waybill"`
}

View File

@@ -17,6 +17,8 @@ const (
StoreAcctTypeExpendCreateWaybillTip = 21 //手动加小费扣除
StoreAcctTypeExpendCreateWaybill2ndMore = 22 //第二次发运单,并且比上次需要更多钱扣的差价
StoreAcctTypeExpendCreateWaybillDeductFee = 23 //运单取消的违约金
StoreAcctTypeExpendTextMessageNotify = 24 //短信通知扣费
StoreAcctTypeExpendVoiceMessageNotify = 26 //电话通知扣费
StoreAcctTypeRealFeeExpend = 25 //真实运费 > 临时运费, 真实运费的值 - 临时运费的值
)