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

316 lines
10 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
}
2 years ago
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 {
2 years ago
Id uint `json:"id"`
AfsSn string `json:"afsSn"`
OrderSubSn string `json:"orderSubSn"`
SourceId uint `json:"sourceId"`
SourceSkuId string `json:"sourceSkuId"`
SkuName string `json:"skuName"`
Quantity uint `json:"quantity"`
Status uint `json:"status"`
Result string `json:"result"`
Price decimal.Decimal `json:"price"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
2 years ago
}
// Lists @Title 售后列表
2 years ago
func (a *afterService) Lists(ctx context.Context, args ArgsAfsLists) (reply ReplyAfsLists, err error) {
2 years ago
xClient, err := client.GetClient(a)
if err != nil {
2 years ago
return ReplyAfsLists{}, err
2 years ago
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsAfterServiceDeliver struct {
SourceAfsSn string `json:"sourceAfsSn"`
SourceSkuId string `json:"sourceSkuId"`
2 years ago
SourceOrderSn string `json:"sourceOrderSn"`
2 years ago
ApproveNotes string `json:"approveNotes"`
}
// 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"`
2 years ago
ApproveNotes string `json:"approveNotes"`
2 years ago
}
// 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 {
2 years ago
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"`
2 years ago
ApproveNotes string `json:"approveNotes"`
2 years ago
}
// Refund @Title 退款
2 years ago
func (a *afterService) Refund(ctx context.Context, args ArgsAfterServiceRefund) (err error) {
2 years ago
xClient, err := client.GetClient(a)
if err != nil {
return err
}
reply := 0
err = xClient.Call(ctx, "Refund", args, &reply)
return
}
type ArgsAfterServiceNewOrder struct {
2 years ago
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
2 years ago
Skus []NewOrderSku `json:"skus"`
}
type NewOrderSku struct {
SourceSkuId string `json:"sourceSkuId"`
Quantity uint `json:"quantity"`
Name string `json:"name"`
}
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"`
2 years ago
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"` // skuId
SupplySkuId uint `json:"supplySkuId"` // 供应商skuId
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"` // 售后图片
PackageSend uint `json:"packageSend"` // 发货状态
AfsPackageSend AfsPackageSend `json:"afsPackageSend"` // 售后信息
OrderSubSn uint64 `json:"orderSubSn"` // 订单号
SourceOrderSubSn string `json:"sourceOrderSubSn"` // 供应商的订单号
SourceId uint `json:"sourceId"` // 供应商id
ChannelId uint `json:"channelId"` // 客户id
}
type AfsPackageSend struct {
2 years ago
Name string `json:"name"` // 售后收件人
Mobile string `json:"mobile"` /// 售后手机号
ZipCode string `json:"zipCode"`
2 years ago
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
}
2 years ago
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"`
2 years ago
OrderSubSn string `json:"orderSn"`
SourceOrderSn string `json:"SourceOrderSn"`
2 years ago
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
}
2 years ago
type ReplySourceSkuIdsAfsInfos struct {
2 years ago
SourceId uint // 供应商Id
SourceName string // 供应商名称
ChannelId uint // 客户Id
SkuId uint // 沙马skuId
SourceSkuId string // 供应商skuId
HopeTypeName string // 期望售后类型
TypeReasonName string // 售后原因
CustomerPrice decimal.Decimal // 销售价格
2 years ago
}
// FindBySourceSkuIdsAfsInfos @Title 根据sourceSkuId查询售后信息
func (a *afterService) FindBySourceSkuIdsAfsInfos(ctx context.Context, sourceSkuIds []uint) (reply []ReplySourceSkuIdsAfsInfos, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "FindBySourceSkuIdsAfsInfos", sourceSkuIds, &reply)
return
}