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

291 lines
8.9 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 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"`
SkuName string `json:"skuName"`
Quantity uint `json:"quantity"`
Status uint `json:"status"`
Result string `json:"result"`
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"`
SupplySkuId uint `json:"supplySkuId"`
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"`
LogisticsCompany string `json:"logisticsCompany"`
WaybillCode string `json:"waybillCode"`
SendAt int64 `json:"sendAt"`
PackageSend uint `json:"packageSend"`
AfsPackageSend AfsPackageSend `json:"afsPackageSend"`
}
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
}