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

213 lines
6.5 KiB

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 (
//售后状态 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 {
2 years ago
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"`
}
2 years ago
// 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
}
2 years ago
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 需要发货
2 years ago
func (a *afterService) Deliver(ctx context.Context, args ArgsAfterServiceDeliver) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return err
}
2 years ago
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
}
2 years ago
type ArgsAfterServiceClose struct {
Source source `json:"source"`
SourceAfsSn string `json:"sourceAfsSn"`
SourceSkuId string `json:"sourceSkuId"`
2 years ago
SourceOrderSn string `json:"sourceOrderSn"`
Result string `json:"result"`
}
// 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"`
}
// Refund @Title 退款
func (a *afterService) Refund(ctx context.Context, args ArgsAfterServiceClose) (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 decimal.Decimal `json:"newSourceOrderSn"`
}
2 years ago
// 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
2 years ago
err = xClient.Call(ctx, "NewOrder", args, &reply)
return
}
2 years ago
2 years ago
type ReplyAfterServiceDetail struct {
Id uint `json:"id"`
AfsSn string `json:"afsSn"`
Status uint `json:"status"`
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"`
2 years ago
}
// Detail @Title 售后详情
func (a *afterService) Detail(ctx context.Context, afsSn string) (reply ReplyAfterServiceDetail, err error) {
2 years ago
xClient, err := client.GetClient(a)
if err != nil {
2 years ago
return
2 years ago
}
2 years ago
err = xClient.Call(ctx, "Detail", afsSn, &reply)
2 years ago
return
}
2 years ago
type ReplyAfterServiceLogisticsAddress struct {
Name string `json:"name"` // 姓名
Mobile string `json:"mobile"` // 手机号
ZipCode string `json:"zipCode"` // 邮编
Address string `json:"address"` // 地址
}
2 years ago
// LogisticsAddress @Title 寄回地址
2 years ago
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
}