Files
baseapi/platformapi/ebaiapi/order_model.go
邹宗楠 ef3d065f75 1
2024-03-27 13:55:11 +08:00

319 lines
15 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package ebaiapi
import "time"
const (
MerchantOrderReverseApplyCancel = "1" // 商户发起全退
MerchantOrderReverseApplyPartCancel = "2" // 商户发起部分退款
)
const (
OrderCommodityType = "4" // 商品子单类型 1:称重品、2:标品、3:按件称重、4:虚拟商品子单
OrderVirtualType = "0" // 商品类型为虚拟商品是有效0:普通实物商品 1:包装费子单 2:处方服务费子单、3:附加0.01费子单、4:配送费子单
)
const (
OrderDeliveryStatusCreate = 1 // 生成运单
OrderDeliveryStatusWaitRider = 2 // 配送待分配
OrderDeliveryStatusReceived = 3 // 骑士接单
OrderDeliveryStatusToStore = 8 // 骑手到店
OrderDeliveryStatusSend = 20 // 骑手送出
OrderDeliveryStatusSendOver = 30 // 配送完成
OrderDeliveryStatusCancel = 6 // 配送取消
OrderDeliveryStatusAbnormal = 7 // 配送异常
OrderDeliveryStatusRefusal = 110 // 配送拒单
)
type ExpressInfo struct {
OrderID string `json:"order_id"`
ExpressID string `json:"express_id"`
ExpressCompany string `json:"express_company"`
}
type PrivateMobileInfo struct {
ShortNumber string `json:"short_number"`
ExpireDate *time.Time `json:"expire_date"`
}
type RefundSku struct {
SkuID string `json:"sku_id,omitempty"`
Upc string `json:"upc,omitempty"`
CustomeSkuID string `json:"custom_sku_id,omitempty"`
Number string `json:"number"`
}
type ProductSubsidyInfo struct {
AgentRate int `json:"agent_rate"`
BaiduRate int `json:"baidu_rate"`
Discount int `json:"discount"`
DiscountDetail []*struct {
ActivityID string `json:"activity_id"`
BaiduRate int `json:"baidu_rate"`
ShopRate int `json:"shop_rate"`
Type string `json:"type"`
} `json:"discount_detail"`
LogisticsRate int `json:"logistics_rate"`
ShopRate int `json:"shop_rate"`
UserRate int `json:"user_rate"`
}
type OrderProductInfo struct {
BaiduProductID string `json:"baidu_product_id"`
SkuID string `json:"sku_id"` // 部分退款信息中是这个而不是BaiduProductID
SubBizOrderID string `json:"sub_biz_order_id"`
CustomSkuID string `json:"custom_sku_id"`
PackageAmount int `json:"package_amount"`
PackageFee int `json:"package_fee"`
PackagePrice int `json:"package_price"`
PrescriptionID string `json:"prescription_id"`
ProductAmount int `json:"product_amount"`
Number int `json:"number"` // 部分退款信息中是这个而不是ProductAmount
ProductAttr []interface{} `json:"product_attr"`
ProductCustomIndex string `json:"product_custom_index"`
ProductFeatures []interface{} `json:"product_features"`
ProductFee int `json:"product_fee"`
ProductName string `json:"product_name"`
ProductPrice int `json:"product_price"`
ProductSubsidy *ProductSubsidyInfo `json:"product_subsidy"`
ProductType int `json:"product_type"`
SupplyType int `json:"supply_type"`
TotalFee int `json:"total_fee"`
TotalWeight int `json:"total_weight"`
Upc string `json:"upc"`
WeightType int `json:"weight_type"`
}
type OrderDiscountInfo struct {
ActivityID string `json:"activity_id"`
AgentRate int `json:"agent_rate"`
BaiduRate int `json:"baidu_rate"`
Desc string `json:"desc"`
Fee int `json:"fee"`
LogisticsRate int `json:"logistics_rate"`
Products []*struct {
ActivityID string `json:"activity_id"`
ActivityProductNum int `json:"activity_product_num"`
BaiduProductID int64 `json:"baidu_product_id"`
NowPrice int `json:"now_price"`
OrigPrice int `json:"orig_price"`
SavePrice int `json:"save_price"`
} `json:"products,omitempty"`
RuleID string `json:"rule_id"`
ShopRate int `json:"shop_rate"`
Type string `json:"type"`
}
type OrderDetailInfo struct {
Discount []*OrderDiscountInfo `json:"discount"`
Order *struct {
AtshopTime int `json:"atshop_time"`
CancelTime string `json:"cancel_time"`
ColdBoxFee string `json:"cold_box_fee"`
Commission int `json:"commission"`
ConfirmTime string `json:"confirm_time"`
CreateTime string `json:"create_time"`
DeliveryParty int `json:"delivery_party"` // 此字段会在配送变化后变化
DeliveryPhone string `json:"delivery_phone"`
DeliveryTime int `json:"delivery_time"`
DiscountFee int `json:"discount_fee"`
DownFlag int `json:"down_flag"`
ElemeOrderID string `json:"eleme_order_id"`
ExpectTimeMode int `json:"expect_time_mode"`
Ext struct {
TaoxiFlag int `json:"taoxi_flag"`
} `json:"ext"`
FinishedTime string `json:"finished_time"`
InvoiceTitle string `json:"invoice_title"`
IsColdBoxOrder int `json:"is_cold_box_order"`
IsPrivate int `json:"is_private"`
LatestSendTime int `json:"latest_send_time"`
MealNum string `json:"meal_num"`
NeedInvoice int `json:"need_invoice"`
OrderFlag int `json:"order_flag"`
OrderFrom string `json:"order_from"`
OrderID string `json:"order_id"`
OrderIndex string `json:"order_index"`
PackageFee int `json:"package_fee"`
PayStatus int `json:"pay_status"`
PayType int `json:"pay_type"`
PickupTime int `json:"pickup_time"`
Remark string `json:"remark"`
// ResponsibleParty string `json:"responsible_party"`
SendFee int `json:"send_fee"`
SendImmediately int `json:"send_immediately"`
SendTime int `json:"send_time"`
ShopFee int `json:"shop_fee"`
Status int `json:"status"`
TaxerID string `json:"taxer_id"`
TotalFee int `json:"total_fee"`
UserFee int `json:"user_fee"`
} `json:"order"`
Products [][]*OrderProductInfo `json:"products"`
Shop *struct {
BaiduShopID string `json:"baidu_shop_id"`
ID string `json:"id"`
Name string `json:"name"`
} `json:"shop"`
Source string `json:"source"`
User *struct {
Address string `json:"address"`
// City string `json:"city"`
Coord *struct {
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
} `json:"coord"`
CoordAmap *struct {
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
} `json:"coord_amap"`
// District string `json:"district"`
Gender string `json:"gender"`
Name string `json:"name"`
Phone string `json:"phone"`
PrivacyPhone string `json:"privacy_phone"`
// Province string `json:"province"`
UserID string `json:"user_id"`
} `json:"user"`
}
type RefundOrderDetailInfo struct {
CustomSkuID string `json:"custom_sku_id"`
Name string `json:"name"`
Number int `json:"number"`
ProductFeatures []interface{} `json:"product_features"`
ProductFee int `json:"product_fee"`
ProductPrice int `json:"product_price"`
ProductSubsidy *ProductSubsidyInfo `json:"product_subsidy"`
SkuID string `json:"sku_id"`
TotalWeight int `json:"total_weight"`
Upc string `json:"upc"`
}
type RefundDetailInfo struct {
ApplyTime string `json:"apply_time"`
CustomSkuID string `json:"custom_sku_id"`
Desc string `json:"desc"`
Name string `json:"name"`
Number int `json:"number"`
RefundID string `json:"refund_id"`
ShopEleRefund int `json:"shop_ele_refund"`
SkuID string `json:"sku_id"`
Status int `json:"status"`
TotalRefund int `json:"total_refund"`
Type int `json:"type"`
Upc string `json:"upc"`
}
type PartRefundInfo struct {
Commission int `json:"commission"`
Fee int `json:"fee"`
OrderDetail []*RefundOrderDetailInfo `json:"order_detail"`
OrderID string `json:"order_id"`
PackageFee int `json:"package_fee"`
RefundDetail []*RefundDetailInfo `json:"refund_detail"`
RefundPrice int `json:"refund_price"`
SendFee int `json:"send_fee"`
ShopFee int `json:"shop_fee"`
TotalPrice int `json:"total_price"`
Type int `json:"type"`
UserFee int `json:"user_fee"`
}
type ListOrderItemInfo struct {
BaiduShopID int64 `json:"baidu_shop_id"`
CreateTime int64 `json:"create_time"`
OrderFrom int `json:"order_from"`
OrderID string `json:"order_id"`
OrderStatus int `json:"order_status"`
PayStatus int `json:"pay_status"`
PayType int `json:"pay_type"`
ShopID string `json:"shop_id"`
Status int `json:"status"`
UserPhone string `json:"user_phone"`
}
type ListOrderInfo struct {
Total int `json:"total"`
Page int `json:"Page"`
Pages int `json:"pages"`
List []*ListOrderItemInfo `json:"list"`
}
type PushRiderInfo struct {
DistributorId int `json:"distributor_id"` // 固定值201
Knight Knight `json:"knight"`
OrderId string `json:"order_id"` // 订单id
State int `json:"state"` // 配送状态传固定值21 开始配送(已废弃,已接入商家不影响)
SelfStatus int `json:"selfStatus"` // 配送状态 1:生成运单 2:配送待分配3:骑士接单必传8:骑士到店必传20:骑手送出必传30:配送完成必传6:配送取消必传7:配送异常必传101:配送拒单
SelfStatusDesc string `json:"selfStatusDesc"` // 配送状态文案描述
SelfSubStatus int `json:"selfSubStatus"` // 配送取消(6)子原因:
SelfSubStatusDesc string `json:"selfSubStatusDesc"` // 配送异常子状态文案描述
DistributorInfoDTO DistributorInfoDTO `json:"distributorInfoDTO"` // 配送服务商信息
}
type Knight struct {
Id int64 `json:"id"` // 骑手id商家自定义
Name string `json:"name"` // 骑手姓名
Phone string `json:"phone"` // 骑手手机号码
}
type DistributorInfoDTO struct {
DistributorTypeId string `json:"distributorTypeId"` // 配送商类型id:
DistributorName string `json:"distributorName"` // 配送商名称
DistributorPhone string `json:"distributorPhone"` // 配送商电话
}
// RefundOrderExamine 商家审核是售后单
type RefundOrderExamine struct {
ReverseOrderId string `json:"reverse_order_id" required:"true"` // 逆向单ID
OrderId string `json:"order_id" required:"true"` // 订单id
IdempotentId string `json:"idempotent_id" required:"true"` // 请求唯一标示
ActionType string `json:"action_type" required:"true"` // 逆向单审批操作类型枚举值【1-同意全单/部分退款申请 、 2-拒绝全单/部分退款申请、 3-同意退货申请 、 4-拒绝退货申请】
ReasonCode string `json:"reason_code" required:"false"` // 当拒绝场景必填即action_type = 2 or action_type =4 时 必填,枚举值: 7019-双方协商一致不再取消订单、 7020-商品已经备货完成、 7021-商品已送出、 7802-商品发出时完好、 7803-用户未举证/举证无效、 7804-商品影响二次销售、 7805-商品不符合7天无理由退款、 7302-未收到退货(仅退货单支持传入该code)、 7001-其他原因
ReasonRemarks string `json:"reason_remarks" required:"false"` // 原因备注说明信息
RefundProductList []*RefundProductList `json:"refund_product_list" required:"false"` // 订单id
}
type RefundProductList struct {
SubBizOrderId string `json:"sub_biz_order_id" required:"false"` // 商品子单ID
PlatformSkuId string `json:"platform_sku_id" required:"false"` // 平台商品ID
Number string `json:"number"`
RefundAmount string `json:"refund_amount"`
}
// OrderReverseApplyParam 商家发起取消订单或者部分退款
type OrderReverseApplyParam struct {
OrderId string `json:"order_id"` // 订单号
IdempotentId string `json:"idempotent_id"` // 幂等id (商家自定义同一操作重试需保证幂等Id一致)
RefundType string `json:"refund_type"` // 申请退款类型, 枚举值1 全退 2 部分退(按商品部分退),如 部分退2 则 refund_product_list 参数不能为空
ReasonCode string `json:"reason_code"` // 发起退款原因 code枚举值7015-商品已售完、 7017-无骑手接单/无运力、 7053-骑手无法配送、 7054-无法联系到用户(未接听、关机、号码错误)、 7018-商户暂时不营业、 7070-拣货人力不足、 7908-补差退款、 7001-其他原因、 7052-药师审核处方笺不通过仅支持医药处方订单、7080-包装费退款(仅支持订单级包装费可选)
ReasonRemarks string `json:"reason_remarks"` // 详细原因信息reason_code为7001时必填
NeedIvrUser int64 `json:"need_ivr_user"` // 非必填reason_code为7015 缺货售中部分取消退款场景是否需要平台外呼通知用户仅refund_type=2时 传入有效;枚举值: 1:通知 0 or null :不通知
RefundProductList []*RefundProductListParam `json:"refund_product_list"` // 申请退款商品列表信息(非必填),部分退( refund_type = 2refund_product_list 必填
}
// RefundProductListParam 申请退款商品列表信息
type RefundProductListParam struct {
SubBizOrderId string `json:"sub_biz_order_id"` // 子单ID对应订单中商品唯一ID
PlatformSkuId string `json:"platform_sku_id"` // 平台商品ID
Number string `json:"number"` // 申请退款件数整型范围1-商品最大可退通过order.reverse.consult接口查询称重品金支持按金额退款需指定refund_amount进行退款传入数量无效
RefundAmount string `json:"refund_amount"` // 申请退款金额(单位 分,整型)
FundCalculateType string `json:"fund_calculate_type"` // 非必填部分退类型0按件数退1按照金额退, 默认为按件数退0; 按件退 number字段必传 按金额退 refund_amount字段必传
}
// OrderSelfDeliveryLocationSync 自配送订单骑手位置回传
type OrderSelfDeliveryLocationSync struct {
OrderId string `json:"order_id"` // 订单号
Location *RiderLocation `json:"location"`
}
// RiderLocation 骑手坐标
type RiderLocation struct {
UTC string `json:"utc"` // 当前时间格式10位时间戳
Altitude string `json:"altitude"` // 海拔高度,如无,可传入固定值
Latitude string `json:"latitude"` // 纬度,建议使用高德坐标 39.90038
Longitude string `json:"longitude"` // 经度,建议使用高德坐标 116.389149
}