1
This commit is contained in:
@@ -583,46 +583,31 @@ func (c *PurchaseHandler) CanSwitch2SelfDeliver(order *model.GoodsOrder) (isCan
|
||||
// Swtich2SelfDeliver 抖音转自送的时候就是通知抖音发货了
|
||||
func (c *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName string) (err error) {
|
||||
api := getAPI(order.VendorOrgCode, 0, "")
|
||||
if time.Now().Sub(order.CreatedAt) <= tiktokShop.AutoCallDelayTime15*60 { //自动运力呼叫期间不可取消
|
||||
return errors.New("抖音配送自动呼叫运力期间不可转门店自配送/三方配送,请下单成功15分钟后重试")
|
||||
remoteWaybill, err2 := c.GetDYPSRiderInfo(order.VendorOrderID)
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
if remoteWaybill, err2 := c.GetDYPSRiderInfo(order.VendorOrderID); err2 == nil {
|
||||
//remoteWaybill := &superm_getShipmentInfo_response.ShipmentInfo{ //测试数据
|
||||
// AfterSaleID: 0,
|
||||
// OccurredTime: "2022-12-28 15:55:51",
|
||||
// RiderLatitude: "30.693528",
|
||||
// RiderLongitude: "104.045337",
|
||||
// RiderName: "赵乐均",
|
||||
// RiderPhone: "15108474706",
|
||||
// ShipmentError: 0,
|
||||
// ShipmentStatus: 2,
|
||||
// ShopID: 57939570,
|
||||
// ShopOrderID: 5016940182798690015,
|
||||
// TrackNo: "DYA36452999870015",
|
||||
//}
|
||||
if remoteWaybill.ShipmentStatus >= tiktokShop.ShipmentStatusArrived { //骑手取货后不可取消
|
||||
return errors.New("抖音配送骑手已取货,不可转门店自配送/三方配送")
|
||||
} else {
|
||||
if localWaybill, err1 := dao.GetWaybills(dao.GetDB(), order.VendorOrderID); err1 == nil && len(localWaybill) > 0 {
|
||||
if err = c.CancelWaybill(localWaybill[0], partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel); err != nil {
|
||||
return fmt.Errorf("%s,不可转门店自配送/三方配送", err)
|
||||
} else {
|
||||
//转门店自送通知抖音发货
|
||||
err = api.OrderDelivering(&order_logisticsAdd_request.OrderLogisticsAddParam{
|
||||
OrderId: order.VendorOrderID,
|
||||
Company: "",
|
||||
CompanyCode: "chengdouruoxi",
|
||||
LogisticsCode: order.VendorOrderID,
|
||||
IsRefundReject: false,
|
||||
IsRejectRefund: false,
|
||||
SerialNumberList: nil,
|
||||
AddressId: 0,
|
||||
StoreId: utils.Str2Int64(order.VendorStoreID),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if remoteWaybill.ShipmentStatus >= tiktokShop.ShipmentStatusArrived { //骑手取货后不可取消
|
||||
return errors.New("抖音配送骑手已取货,不可转门店自配送/三方配送")
|
||||
}
|
||||
|
||||
if err := getAPI(order.VendorOrgCode, 0, "").ShopOrderDispatcher(utils.Str2Int64(order.VendorStoreID), order.VendorOrderID, tiktokShop.DispatcherFeeTypeCancel); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
//转门店自送通知抖音发货
|
||||
err = api.OrderDelivering(&order_logisticsAdd_request.OrderLogisticsAddParam{
|
||||
OrderId: order.VendorOrderID,
|
||||
Company: "",
|
||||
CompanyCode: "chengdouruoxi",
|
||||
LogisticsCode: order.VendorOrderID,
|
||||
IsRefundReject: false,
|
||||
IsRejectRefund: false,
|
||||
SerialNumberList: nil,
|
||||
AddressId: 0,
|
||||
StoreId: utils.Str2Int64(order.VendorStoreID),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -998,15 +983,24 @@ func (c *PurchaseHandler) GetCancelDeliveryReason(order *model.GoodsOrder) (stri
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// CancelLogisticsByWmOrderId 取消美团外卖理由转使用三方配送
|
||||
// CancelLogisticsByWmOrderId 取消平台配送,使用现有的三方配送
|
||||
func (c *PurchaseHandler) CancelLogisticsByWmOrderId(order *model.GoodsOrder, reasonCode, detailContent, appPoiCode, orderId string) error {
|
||||
//return getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").CancelLogisticsByWmOrderId(reasonCode, detailContent, appPoiCode, orderId)
|
||||
return nil
|
||||
return getAPI(order.VendorOrgCode, 0, "").ShopOrderDispatcher(utils.Str2Int64(order.VendorStoreID), order.VendorOrderID, tiktokShop.DispatcherFeeTypeCancel)
|
||||
}
|
||||
|
||||
// OrderLogisticsStatus 获取订单配送状态
|
||||
func (c *PurchaseHandler) OrderLogisticsStatus(orderId int64) (int64, error) {
|
||||
return 0, nil
|
||||
orderInfo, err := dao.GetSimpleOrder(dao.GetDB(), utils.Int64ToStr(orderId))
|
||||
if err != nil {
|
||||
return 0, errors.New("获取本地门店账号信息失败,请重试")
|
||||
}
|
||||
|
||||
waybill, err := getAPI(orderInfo.VendorOrgCode, 0, "").GetShipmentInfo(utils.Str2Int64(orderInfo.VendorOrderID), 0, tiktokShop.ShipmentTypeInvoice)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return waybill.ShipmentStatus, nil
|
||||
}
|
||||
|
||||
// GetOrderTotalShopMoney 获取门店结算信息
|
||||
|
||||
Reference in New Issue
Block a user