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

160 lines
5.8 KiB

package supply
import (
"context"
"database/sql"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
"github.com/shopspring/decimal"
"time"
)
type skuAudit struct {
}
type ArgsSkuAuditLists struct {
Search SkuAuditSearch
Page bean.Page
}
type SkuAuditSearch struct {
SourceId uint // 供应商id
AdjustType uint // 加价类型
Status uint // 状态 1=未审核 2=通过 3=驳回
}
type SkuAndAuditItem struct {
AuditId uint `json:"auditId"`
SkuId uint `json:"skuId"`
Name string `json:"name"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
GuidePrice decimal.Decimal `json:"guidePrice"`
AdjustType uint `json:"adjustType"`
AdjustPrice decimal.Decimal `json:"adjustPrice"`
CustomerPrice decimal.Decimal `json:"customerPrice"`
Category string `json:"category"`
BrandName string `json:"brandName"`
SourceName string `json:"sourceName"`
AuditUserId uint `json:"auditUserId"`
AuditAt sql.NullTime `json:"auditAt"`
ImgUrl string `json:"imgUrl"`
Reason string `json:"reason"`
FirstCategoryName string `json:"firstCategoryName"`
SecondCategoryName string `json:"secondCategoryName"`
ThirdCategoryName string `json:"thirdCategoryName"`
CreatedAt time.Time `json:"createdAt"`
}
type ReplySkuAuditLists struct {
Lists []SkuAndAuditItem `json:"lists"`
Total int64 `json:"total"`
}
// Lists @Title 审核列表
func (s *skuAudit) Lists(ctx context.Context, args ArgsSkuAuditLists) (reply ReplySkuAuditLists, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsSkuAuditAdopt struct {
AuditUserId uint // 审核人
AuditIds []uint // 审核单id
}
// Adopt @Title 通过
func (s *skuAudit) Adopt(ctx context.Context, args ArgsSkuAuditAdopt) error {
reply := 0
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Adopt", args, &reply)
}
type ArgsSkuAuditReject struct {
AuditUserId uint // 审核人
AuditIds []uint // 审核单id
Reason string // 驳回原因
}
// Reject @Title 驳回
func (s *skuAudit) Reject(ctx context.Context, args ArgsSkuAuditReject) error {
reply := 0
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Reject", args, &reply)
}
// Stock @Title 库存查询
func (s *skuAudit) Stock() {
}
type ArgsApplyHistory struct {
Search ApplyHistorySearch
Page bean.Page
}
type ApplyHistorySearch struct {
Id uint // 瑞库客id
Name string // 商品名称
SourceId uint // 所属供应商 1=京东
SourceSonId uint // 沙马供应商的供应商
SourceSkuId uint // 供应商skuId
BrandId uint // 品牌Id
ThirdCategoryId uint // 三级分类Id
AdjustType uint // 加价规则
MaxSupplyPrice decimal.Decimal // 最大采购价格
MinSupplyPrice decimal.Decimal // 最小采购价格
CustomerProfitRate uint // 折扣 0=全部 1=5折以下 2=6 3=7 4=8 5=9折以下
Handle uint // 处理状态
AuditStatus uint // 审核状态
SourceStatus uint // 供应商下架状态
PlatformStatus uint // 平台下架状态
}
type ApplyHistoryItem struct {
Id uint `json:"id"`
Name string `json:"name"` // 名称
BrandName string `json:"brandName"` // 品牌名称
FirstCategoryId uint `json:"firstCategoryId"` // 一级分类id
SecondCategoryId uint `json:"secondCategoryId"` // 二级分类id
ThirdCategoryId uint `json:"thirdCategoryId"` // 三级分类id
SupplyPrice decimal.Decimal `json:"supplyPrice"` // 采购价
GuidePrice decimal.Decimal `json:"guidePrice"` // 指导价
ImgUrl string `json:"imgUrl"` // 商品主图
PlatformStatus uint `json:"platformStatus"` // 平台状态 1=上架 2=下架
SourceName string `json:"sourceName"` // 供应商名称
SourceSkuId string `json:"sourceSkuId"` // 源skuId
SourceStatus uint `json:"sourceStatus"` // 供应商状态 1=上架 2=下架
CustomerPrice decimal.Decimal `json:"customerPrice"` // 供货最高价
CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` // 供货利润率 供货利润/供货最高价%
CustomerDiscount decimal.Decimal `json:"customerDiscount"` // 折扣
AdjustType uint `json:"adjustType"` // 加价类型
AdjustPrice decimal.Decimal `json:"adjustPrice"` // 加价金额
AfterAdjustType uint `json:"afterAdjustType"` // 改价后加价类型
AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` // 改价后加价金额
AfterPrice decimal.Decimal `json:"afterPrice"` // 改价记录
Reason string // 改价驳回原因
}
type ReplyApplyHistoryLists struct {
Lists []ApplyHistoryItem `json:"lists"`
Total int64 `json:"total"`
}
// ApplyHistory @Title 改价申请记录
func (s *skuAudit) ApplyHistory(ctx context.Context, args ArgsApplyHistory) (reply []ReplyApplyHistoryLists, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "ApplyHistory", args, &reply)
return
}