package supply import ( "context" "git.oa00.com/supply-chain/service/client" "git.oa00.com/supply-chain/service/lib/bean" "github.com/shopspring/decimal" ) const ( //售后状态 1=售后申请中 2=客户发货 3=收货处理中 4=售后完成 5=售后关闭 ) type afterService struct { } type ArgsRetailHistory struct { Search RetailHistorySearch Page bean.Page } type RetailHistorySearch struct { AfterServiceSn string `label:"售后单号"` OrderSn string `label:"订单号"` Status uint `label:"售后状态"` SourceId uint `label:"所属供应商"` CustomerId uint `label:"所属客户"` CreateStartDate string `label:"创建开始日期"` CreateEndDate string `label:"创建结束日期"` } type RetailHistoryItem struct { Id uint `json:"id"` AfterServiceSn uint64 `json:"afterServiceSn"` OrderSn uint64 `json:"orderSn"` Name string `json:"name"` Quantity uint `json:"quantity"` Status uint `json:"status"` Reason string `json:"reason"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` Source string `json:"source"` CustomerId uint `json:"customerId"` } type ReplyRetailHistory struct { Lists []RetailHistoryItem `json:"lists"` Total int64 `json:"total"` } // RetailAfsHistory @Title 零售订单售后记录 func (a *afterService) RetailAfsHistory(ctx context.Context, args ArgsRetailHistory) (reply ReplyRetailHistory, err error) { xClient, err := client.GetClient(a) if err != nil { return ReplyRetailHistory{}, err } err = xClient.Call(ctx, "RetailAfsHistory", args, &reply) return } type ArgsAfsLists struct { Search AfsListSearch `json:"search"` Page bean.Page `json:"page"` } type AfsListSearch struct { Status uint `json:"status"` AfsSn string `json:"afsSn"` OrderSubSn string `json:"orderSubSn"` CreatedStartDate string `json:"createdStartAt"` CreatedEndDate string `json:"createdEndAt"` } type ReplyAfsLists struct { Lists []AfsItem `json:"lists"` Total int64 `json:"total"` } type AfsItem struct { Id uint `json:"id"` AfsSn string `json:"afsSn"` OrderSubSn string `json:"orderSubSn"` SourceId uint `json:"sourceId"` SourceSkuId string `json:"sourceSkuId"` SkuName string `json:"skuName"` Quantity uint `json:"quantity"` Status uint `json:"status"` Result string `json:"result"` Price decimal.Decimal `json:"price"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } // Lists @Title 售后列表 func (a *afterService) Lists(ctx context.Context, args ArgsAfsLists) (reply ReplyAfsLists, err error) { xClient, err := client.GetClient(a) if err != nil { return ReplyAfsLists{}, err } err = xClient.Call(ctx, "Lists", args, &reply) return } type ArgsAfterServiceDeliver struct { SourceAfsSn string `json:"sourceAfsSn"` SourceSkuId string `json:"sourceSkuId"` SourceOrderSn string `json:"sourceOrderSn"` ApproveNotes string `json:"approveNotes"` } // Deliver @Title 需要发货 func (a *afterService) Deliver(ctx context.Context, args ArgsAfterServiceDeliver) (err error) { xClient, err := client.GetClient(a) if err != nil { return err } reply := 0 err = xClient.Call(ctx, "Deliver", args, &reply) return } type ArgsAfterServiceReceipt struct { SourceAfsSn string `json:"sourceAfsSn"` SourceSkuId string `json:"sourceSkuId"` SourceOrderSN string `json:"sourceOrderSN"` } // Receipt @Title 收货处理 func (a *afterService) Receipt(ctx context.Context, args ArgsAfterServiceReceipt) (err error) { xClient, err := client.GetClient(a) if err != nil { return err } reply := 0 err = xClient.Call(ctx, "Receipt", args, &reply) return } type ArgsAfterServiceClose struct { Source source `json:"source"` SourceAfsSn string `json:"sourceAfsSn"` SourceSkuId string `json:"sourceSkuId"` SourceOrderSn string `json:"sourceOrderSn"` Result string `json:"result"` ApproveNotes string `json:"approveNotes"` } // Close @Title 关闭售后单 func (a *afterService) Close(ctx context.Context, args ArgsAfterServiceClose) (err error) { xClient, err := client.GetClient(a) if err != nil { return err } reply := 0 err = xClient.Call(ctx, "Close", args, &reply) return } type ArgsAfterServiceRefund struct { Source source `json:"source"` SourceAfsSn string `json:"sourceAfsSn"` SourceSkuId string `json:"sourceSkuId"` SourceOrderSn string `json:"sourceOrderSn"` Result string `json:"result"` RefundFee decimal.Decimal `json:"refundFee"` RefundOrderFee decimal.Decimal `json:"refundOrderFee"` RefundFreightFee decimal.Decimal `json:"refundFreightFee"` ApproveNotes string `json:"approveNotes"` } // Refund @Title 退款 func (a *afterService) Refund(ctx context.Context, args ArgsAfterServiceRefund) (err error) { xClient, err := client.GetClient(a) if err != nil { return err } reply := 0 err = xClient.Call(ctx, "Refund", args, &reply) return } type ArgsAfterServiceNewOrder struct { Source source `json:"source"` SourceAfsSn string `json:"sourceAfsSn"` SourceSkuId string `json:"sourceSkuId"` SourceOrderSn string `json:"sourceOrderSn"` Result string `json:"result"` NewSourceOrderSn string `json:"newSourceOrderSn"` ApproveNotes string Skus []NewOrderSku `json:"skus"` } type NewOrderSku struct { SourceSkuId string `json:"sourceSkuId"` Quantity uint `json:"quantity"` Name string `json:"name"` } // NewOrder @Title 新订单 func (a *afterService) NewOrder(ctx context.Context, args ArgsAfterServiceNewOrder) (err error) { xClient, err := client.GetClient(a) if err != nil { return err } reply := 0 err = xClient.Call(ctx, "NewOrder", args, &reply) return } type ReplyAfterServiceDetail struct { Id uint `json:"id"` AfsSn string `json:"afsSn"` // 售后单号 Status uint `json:"status"` // 状态 ApproveNotes string `json:"approveNotes"` // 备注 Result string `json:"result"` // 处理结果 CreatedAt int64 `json:"createdAt"` // 创建时间 UpdatedAt int64 `json:"updatedAt"` // 更新时间 SkuName string `json:"skuName"` // 商品名称 ImgUrl string `json:"imgUrl"` // 商品图片 SkuId uint `json:"skuId"` // skuId SupplySkuId uint `json:"supplySkuId"` // 供应商skuId Price decimal.Decimal `json:"price"` // 采购单价 SupplyPrice decimal.Decimal `json:"supplyPrice"` // 供货价 Quantity uint `json:"quantity"` // 数量 HopeTypeName string `json:"hopeTypeName"` // 期望售后类型 TypeReasonName string `json:"typeReasonName"` // 售后原因 Imgs []string `json:"imgs"` // 售后图片 PackageSend uint `json:"packageSend"` // 发货状态 AfsPackageSend AfsPackageSend `json:"afsPackageSend"` // 售后信息 OrderSubSn uint64 `json:"orderSubSn"` // 订单号 SourceOrderSubSn string `json:"sourceOrderSubSn"` // 供应商的订单号 SourceId uint `json:"sourceId"` // 供应商id ChannelId uint `json:"channelId"` // 客户id NewOrderSubSn string `json:"newOrderSubSn"` // 新订单信息 NewSourceOrderSubSn string `json:"newSourceOrderSubSn"` // 新供应商订单信息 ReceiverName string `json:"receiverName"` // 收件人名称 ReceiverPhone string `json:"receiverPhone"` // 收件手机号 ReceiverAddress string `json:"receiverAddress"` // 收件人地址 StockOutAt int64 `json:"stockOutAt"` // 订单发货时间 RefundFee decimal.Decimal `json:"refundFee"` // 沙马退款金额 SourceRefundFee decimal.Decimal `json:"sourceRefundFee"` // 供应商退款金额 } type AfsPackageSend struct { Name string `json:"name"` // 售后收件人 Mobile string `json:"mobile"` /// 售后手机号 ZipCode string `json:"zipCode"` Address string `json:"address"` // 售后地址 LogisticsCompany string `json:"logisticsCompany"` // 快递公司 WaybillCode string `json:"waybillCode"` // 运单号 SendGoodsDate int64 `json:"sendGoodsDate"` // 发货时间 } // Detail @Title 售后详情 func (a *afterService) Detail(ctx context.Context, afsSn string) (reply ReplyAfterServiceDetail, err error) { xClient, err := client.GetClient(a) if err != nil { return } err = xClient.Call(ctx, "Detail", afsSn, &reply) return } type ReplyAfterServiceLogisticsAddress struct { Name string `json:"name"` // 姓名 Mobile string `json:"mobile"` // 手机号 ZipCode string `json:"zipCode"` // 邮编 Address string `json:"address"` // 地址 } // LogisticsAddress @Title 寄回地址 func (a *afterService) LogisticsAddress(ctx context.Context, afsSn string) (reply ReplyAfterServiceLogisticsAddress, err error) { xClient, err := client.GetClient(a) if err != nil { return } err = xClient.Call(ctx, "LogisticsAddress", afsSn, &reply) return } type ReplyAfsInfoById struct { Id uint `json:"id"` AfsSn string `json:"afsSn"` SourceAfsSn string `json:"sourceAfsSn"` SkuId uint `json:"skuId"` SourceSkuId string `json:"sourceSkuId"` SourceId uint `json:"sourceId"` OrderSubSn string `json:"orderSn"` SourceOrderSn string `json:"SourceOrderSn"` OrderFee decimal.Decimal `json:"orderFee"` SourceOrderFee decimal.Decimal `json:"sourceOrderFee"` FreightFee decimal.Decimal `json:"freightFee"` ApproveNotes string `json:"approveNotes"` } // FindByAfsId @Title 获取售后信息 func (a *afterService) FindByAfsId(ctx context.Context, afsId uint) (reply ReplyAfsInfoById, err error) { xClient, err := client.GetClient(a) if err != nil { return } err = xClient.Call(ctx, "FindByAfsId", afsId, &reply) return } type ReplySourceSkuIdsAfsInfos struct { SourceId uint // 供应商Id SourceName string // 供应商名称 ChannelId uint // 客户Id SkuId uint // 沙马skuId SourceSkuId string // 供应商skuId HopeTypeName string // 期望售后类型 TypeReasonName string // 售后原因 CustomerPrice decimal.Decimal // 销售价格 } // FindBySourceSkuIdsAfsInfos @Title 根据sourceSkuId查询售后信息 func (a *afterService) FindBySourceSkuIdsAfsInfos(ctx context.Context, sourceSkuIds []uint) (reply []ReplySourceSkuIdsAfsInfos, err error) { xClient, err := client.GetClient(a) if err != nil { return } err = xClient.Call(ctx, "FindBySourceSkuIdsAfsInfos", sourceSkuIds, &reply) return }