package wholesale import ( "context" "git.oa00.com/supply-chain/service/client" "git.oa00.com/supply-chain/service/lib/bean" "github.com/shopspring/decimal" ) const ( OrderCancelStatusSuccess = 1 // 取消成功 OrderCancelStatusFail = 2 // 取消失败 ) type order struct { } type ArgsOrderSplit struct { Source source // 商品来源 ParentSourceOrderSn string // 上级订单号 OrderSubs []OrderSub // 子订单 } type OrderSub struct { SourceOrderSn string // 供应商订单号 FreightFee decimal.Decimal // 运费 OrderFee decimal.Decimal // 订单金额 Skus []OrderSplitSkuItem // 拆分订单sku } type OrderSplitSkuItem struct { SourceSkuId string Quantity uint SupplyPrice decimal.Decimal } // Split @Title 拆单 func (o *order) Split(ctx context.Context, args ArgsOrderSplit) (err error) { xClient, err := client.GetClient(o) if err != nil { return } reply := 0 err = xClient.Call(ctx, "Split", args, &reply) return } type ArgsOrderFreightFee struct { Source source OrderFreightFees []OrderFreightFee FreightFile string // 附件 } type OrderFreightFee struct { SourceOrderSn string // 供应商订单号 FreightFee decimal.Decimal // 运费 } // FreightFee @Title 运费处理 func (o *order) FreightFee(ctx context.Context, args ArgsOrderFreightFee) (err error) { xClient, err := client.GetClient(o) if err != nil { return } reply := 0 return xClient.Call(ctx, "FreightFee", args, &reply) } type ArgsOrderCancel struct { Source source // 商品来源 SourceOrderSn string // 供应商订单号 Status uint // 订单取消 CancelFile string // 取消订单附件 } // Cancel @Title 订单取消 func (o *order) Cancel(ctx context.Context, args ArgsOrderCancel) (err error) { xClient, err := client.GetClient(o) if err != nil { return } reply := 0 err = xClient.Call(ctx, "Cancel", args, &reply) return } type ArgsOrderStockOut struct { Source source // 商品来源 SourceOrderSn string // 供应商订单号 Packages []Package // 包裹运单 } type Package struct { Type uint // 物流类型 LogisticsCode string // 物流编码 LogisticsName string // 物流名称 LogisticsPhone string // 物流联系方式 WaybillCode string // 运单号 } // StockOut @Title 出库发货 func (o *order) StockOut(ctx context.Context, args ArgsOrderStockOut) (err error) { xClient, err := client.GetClient(o) if err != nil { return } reply := 0 err = xClient.Call(ctx, "StockOut", args, &reply) return } type ArgsOrderFinish struct { Source source // 商品来源 SourceOrderSn string // 供应商订单号 } // Finish @Title 订单完成 func (o *order) Finish(ctx context.Context, args ArgsOrderFinish) (err error) { xClient, err := client.GetClient(o) if err != nil { return } reply := 0 err = xClient.Call(ctx, "Finish", args, &reply) return } type ArgsOrderLists struct { Search OrderSearch Page bean.Page } type OrderSearch struct { OrderSubSn string Status []uint CancelStatus uint CreatedStartDate string CreatedEndDate string PayStartDate string PayEndDate string } type ReplyOrderLists struct { Lists []OrderItem Total int64 } type OrderItem struct { Id uint ChannelId uint OrderSubSn string SourceOrderSn string Status uint CancelStatus uint OrderFee decimal.Decimal FreightFee decimal.Decimal CreatedAt int64 PayAt int64 CloseAt int64 FinishAt int64 } // Lists @Title 订单列表 func (o *order) Lists(ctx context.Context, args ArgsOrderLists) (reply ReplyOrderLists, err error) { xClient, err := client.GetClient(o) if err != nil { return ReplyOrderLists{}, err } err = xClient.Call(ctx, "Lists", args, &reply) return } type ReplyOrderInfo struct { Id uint Status uint CancelStatus uint OrderSunSu string SourceOrderSn string CreatedAt int64 PayAt int64 CloseAt int64 FinishAt int64 OrderFee decimal.Decimal FreightFee decimal.Decimal Skus []OrderSkuItem HopeStockOutAt int64 ChannelId uint ReceiverName string ReceiverMobile string Address string PackagesType uint Packages []Packages } type OrderSkuItem struct { Img string Name string SkuId uint SourceSkuId string Price decimal.Decimal SupplyPrice decimal.Decimal AdjustType uint AdjustPrice decimal.Decimal Rate decimal.Decimal Quantity uint PackageRate uint } type Packages struct { Id uint WaybillCode string LogisticsName string LogisticsCode string LogisticsPhone string } // Info @Title 订单列表 func (o *order) Info(ctx context.Context, orderSubSn uint64) (reply ReplyOrderInfo, err error) { xClient, err := client.GetClient(o) if err != nil { return ReplyOrderInfo{}, err } err = xClient.Call(ctx, "Info", orderSubSn, &reply) return }