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/afterService.go

151 lines
4.3 KiB

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 ArgsAfterServiceDeliver struct {
SourceAfsSn string `json:"sourceAfsSn"`
SourceSkuId string `json:"sourceSkuId"`
SourceOrderSN string `json:"sourceOrderSN"`
}
// 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 ArgsAfterServiceReject struct {
SourceAfsSn string `json:"sourceAfsSn"`
SourceSkuId string `json:"sourceSkuId"`
SourceOrderSN string `json:"sourceOrderSN"`
}
// Reject @Title 驳回
func (a *afterService) Reject(ctx context.Context, args ArgsAfterServiceReject) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return err
}
reply := 0
err = xClient.Call(ctx, "Reject", args, &reply)
return
}
type ReplyAfterServiceInfo struct {
Id uint `json:"id"`
OrderStatus uint `json:"orderStatus"`
PayTime int64 `json:"payTime"`
FinishAt int64 `json:"finishAt"`
OrderSubSn string `json:"orderSubSn"`
Source string `json:"source"`
Customer string `json:"customer"`
OrderFee decimal.Decimal `json:"orderFee"`
FreightFee decimal.Decimal `json:"freightFee"`
Sku AfterServiceSku `json:"sku"`
Packages []RetailOrderPackage `json:"packages"`
}
type RetailOrderPackage struct {
LogisticsName string `json:"logisticsName"`
WaybillCode string `json:"waybillCode"`
}
type AfterServiceSku struct {
Name string `json:"name"`
SkuId uint `json:"skuId"`
SupplySkuId uint `json:"supplySkuId"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
Rate decimal.Decimal `json:"rate"`
AdjustType uint `json:"adjustType"`
Price decimal.Decimal `json:"price"`
Quantity uint `json:"quantity"`
}
// Info @Title 零售售后详情
func (a *afterService) Info(ctx context.Context, afsSn string) (reply ReplyAfterServiceInfo, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return ReplyAfterServiceInfo{}, err
}
err = xClient.Call(ctx, "Info", afsSn, &reply)
return
}