You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
service/supply/order.go

268 lines
8.1 KiB

2 years ago
package supply
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
2 years ago
"github.com/shopspring/decimal"
)
2 years ago
const (
OrderCancelStatusSuccess = 1 // 取消成功
OrderCancelStatusFail = 2 // 取消失败
OrderCancelStatusReject = 3 // 申请拒收
)
2 years ago
type order struct {
}
type ArgsOrderSplit struct {
2 years ago
Source source // 商品来源
ParentSourceOrderSn string // 上级订单号
OrderSubs []OrderSub // 子订单
}
type OrderSub struct {
2 years ago
SourceOrderSn string // 供应商订单号
FreightFee decimal.Decimal // 运费
OrderFee decimal.Decimal // 订单金额
Skus []OrderSplitSkuItem // 拆分订单sku
2 years ago
}
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
2 years ago
err = xClient.Call(ctx, "Split", args, &reply)
2 years ago
return
}
2 years ago
2 years ago
type ArgsOrderCancel struct {
Source source // 商品来源
SourceOrderSn string // 供应商订单号
2 years ago
Status uint // 订单取消
2 years ago
}
2 years ago
// Cancel @Title 订单取消
2 years ago
func (o *order) Cancel(ctx context.Context, args ArgsOrderCancel) (err error) {
2 years ago
xClient, err := client.GetClient(o)
if err != nil {
return
}
reply := 0
2 years ago
err = xClient.Call(ctx, "Cancel", args, &reply)
2 years ago
return
}
2 years ago
type ArgsOrderStockOut struct {
Source source // 商品来源
SourceOrderSn string // 供应商订单号
Packages []Package // 包裹运单
}
type Package struct {
LogisticsCode string // 物流编码
LogisticsName string // 物流名称
WaybillCode string // 运单号
}
// StockOut @Title 出库发货
2 years ago
func (o *order) StockOut(ctx context.Context, args ArgsOrderStockOut) (err error) {
2 years ago
xClient, err := client.GetClient(o)
if err != nil {
return
}
reply := 0
2 years ago
err = xClient.Call(ctx, "StockOut", args, &reply)
2 years ago
return
}
2 years ago
2 years ago
//
//type ArgsChangeWaybill struct {
// Id uint
// Source source // 商品来源
// SourceOrderSn string
// WaybillCode string
// LogisticsName string
// LogisticsCode string
//}
//
//// ChangeWaybill @Title 修改运单信息
//func (o *order) ChangeWaybill(ctx context.Context, args ArgsChangeWaybill) (err error) {
// xClient, err := client.GetClient(o)
// if err != nil {
// return
// }
// reply := 0
// err = xClient.Call(ctx, "ChangeWaybill", args, &reply)
// return
//}
9 months ago
type ArgsOrderDelivered struct {
Source source // 商品来源
SourceOrderSn string // 供应商订单号
}
// Delivered @Title 订单签收/妥投
func (o *order) Delivered(ctx context.Context, args ArgsOrderDelivered) (err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Delivered", args, &reply)
return
}
2 years ago
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 ArgsRetailOrderLists struct {
Search RetailOrderSearch
Page bean.Page
}
type RetailOrderSearch struct {
OrderSubSn uint64 `label:"订单号"`
2 years ago
SourceSubSn uint64 `label:"供应商订单号"`
SupplierId uint `label:"供应商"`
CustomerId uint `label:"客户"`
WaybillCode string `label:"运单号"`
Status uint `label:"订单状态"`
PayStartDate string `label:"支付开始日期"`
PayEndDate string `label:"支付结束日期"`
FinishStartDate string `label:"完成开始日期"`
FinishEndDate string `label:"完成结束日期"`
}
type RetailOrderItem struct {
1 year ago
Id uint `json:"id"`
OrderSubSn string `json:"orderSubSn"` // 订单号
SourceOrderSn string `json:"sourceOrderSn"` // 供应商订单号
SourceName string `json:"sourceName"` // 供应商名称
CustomerName string `json:"customerName"` // 客户名称
OrderStatus uint `json:"orderStatus"` // 订单状态
OrderFee decimal.Decimal `json:"orderFee"` // 订单金额
FreightFee decimal.Decimal `json:"freightFee"` // 运费
SupplyOrderFee decimal.Decimal `json:"supplyOrderFee"` // 供应商订单金额
PayTime int64 `json:"payTime"` // 支付时间
FinishAt int64 `json:"finishAt"` // 完成时间
CloseAt int64 `json:"closeAt"` // 关闭时间
StockOutAt int64 `json:"stockOutAt"` // 发货时间
}
type ReplyRetailOrderLists struct {
Lists []RetailOrderItem `json:"lists"`
Total int64 `json:"total"`
}
// Lists @Title 订单列表
func (o *order) Lists(ctx context.Context, args ArgsRetailOrderLists) (reply ReplyRetailOrderLists, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
2 years ago
type OrderInfo struct {
OrderId uint `json:"orderId"`
CustomerId uint `json:"customerId"`
OrderSn uint64 `json:"orderSn"`
2 years ago
SourceOrderSn uint64 `json:"sourceOrderSn"`
2 years ago
SourceId uint `json:"sourceId"`
2 years ago
SourceName string `json:"sourceName"`
2 years ago
ReceiverName string `json:"receiverName"`
ReceiverMobile string `json:"receiverMobile"`
Address string `json:"address"`
FreightFee decimal.Decimal `json:"freightFee"`
OrderFee decimal.Decimal `json:"orderFee"`
PayTime int64 `json:"payTime"`
FinishAt int64 `json:"finishAt"`
Status uint `json:"status"`
Skus []OrderSku `json:"skus"`
Packages []OrderPackage `json:"packages"`
2 years ago
StockOutAt int64 `json:"stockOutAt"`
2 years ago
}
type OrderSku struct {
Id uint `json:"id"`
SkuId uint `json:"skuId"`
Name string `json:"name"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
Rate decimal.Decimal `json:"rate"`
2 years ago
Price decimal.Decimal `json:"price"`
AdjustPrice decimal.Decimal `json:"adjustPrice"`
Amount decimal.Decimal `json:"amount"`
2 years ago
ImgUrl string `json:"imgUrl"`
Quantity uint `json:"quantity"`
}
type OrderPackage struct {
LogisticsName string `json:"logisticsName"`
WaybillCode string `json:"waybillCode"`
}
// Info @Title 订单详情
func (o *order) Info(ctx context.Context, orderSn string) (reply OrderInfo, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", orderSn, &reply)
return
}
2 years ago
type InfoByOrderId struct {
Id uint
ChannelOrderSn string // 渠道订单编号
OrderSn uint64 // 订单编号
ChannelId uint // 渠道id
Type uint // 下单方式 1=api接口下单 2=客户商城下单
Status uint // 状态
OrderFee decimal.Decimal // 订单总金额-不含运费
SupplyOrderFee decimal.Decimal // 供应商订单总金额-不含运费
PayTime int64 // 确认时间
Rate decimal.Decimal // 商品费率
FreightFee decimal.Decimal // 运费
ReceiverName string // 收件人
ReceiverMobile string // 手机号
ReceiverEmail string // 邮箱
ReceiverZipCode string // 邮编
Address string // 配送地址
UserIp string // 用户ip
ExpireAt int64 // 订单提单超时时效时间
LadingBillAt int64 // 提单时间
CloseAt int64 // 订单关闭时间
}
// InfoByOrderId @Title 根据订单id查询详情
func (o *order) InfoByOrderId(ctx context.Context, orderId uint) (reply InfoByOrderId, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(ctx, "InfoByOrderId", orderId, &reply)
return
}