From 8a946da3cc150efec5168b75b2b1339635818d76 Mon Sep 17 00:00:00 2001 From: kanade Date: Wed, 20 Jul 2022 18:15:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=BA=93=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supply/sku.go | 83 ++++++++++++++++++++++++++++++++++++++++++++++ supply/skuAudit.go | 54 ++++++++++++++++++++++++++++++ supply/supply.go | 2 ++ 3 files changed, 139 insertions(+) create mode 100644 supply/sku.go create mode 100644 supply/skuAudit.go diff --git a/supply/sku.go b/supply/sku.go new file mode 100644 index 0000000..4ada021 --- /dev/null +++ b/supply/sku.go @@ -0,0 +1,83 @@ +package supply + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "github.com/shopspring/decimal" +) + +type sku struct { +} + +const ( + SkuSourceJd = 1 // 京东开普勒渠道 + + SkuAdjustTypeRate = 1 // 加价比例 + SkuAdjustTypeAmount = 2 // 加价金额 + + SkuPlatformStatusUp = 1 // 平台上架 + SkuPlatformStatusDown = 2 // 平台下架 + + SkuSourceStatusUp = 1 // 供应商上架 + SkuSourceStatusDown = 2 // 供应商下架 + + SkuHandleNone = 1 // 未处理 + SkuHandleFinal = 2 // 已处理 + + SkuAuditStatusNone = 0 // 无 + SkuAuditStatusWait = 1 // 待审核 + SkuAuditStatusAdopt = 2 // 审核通过 + SkuAuditStatusReject = 3 // 审核驳回 +) + +type ArgsSkuAdd struct { + SourceSkuId string // 源skuId + Name string // 商品名称 + BrandId uint // 品牌id + ThirdCategoryId uint // 三级分类id + SupplyPrice decimal.Decimal // 采购价 + GuidePrice decimal.Decimal // 指导价-建议售价 + Size string // 尺码 + Color string // 颜色 + Tax string // 税率 + Unit string // 销售单位 + UpcCode string // 商品条码 + Source uint // 商品来源 + Content string // 商品详情 + Imgs []SkuImg // 商品图片 第一张主图 + Specifications []SkuSpecification // 商品参数信息 +} + +type SkuImg struct { + Id uint `json:"id"` + Path string `json:"path"` +} + +type SkuSpecification struct { + Name string `json:"name"` + Attributes []SkuAttribute `json:"attributes"` +} + +type SkuAttribute struct { + Name string `json:"name"` + Value []string `json:"value"` +} + +// Add @Title 添加商品 +func (s *sku) Add(ctx context.Context, args ArgsSkuAdd) error { + reply := 0 + return client.GetClient(s).Call(ctx, "Add", args, &reply) +} + +type ArgsSkuAdjust struct { + ApplyUserId uint // 修改人 + SkuIds []uint // 商品id + AdjustType uint // 加价类型 + AdjustPrice decimal.Decimal // 加价金额 +} + +// Adjust @Title 加价 +func (s *sku) Adjust(ctx context.Context, args ArgsSkuAdjust) error { + reply := 0 + return client.GetClient(s).Call(ctx, "Adjust", args, &reply) +} diff --git a/supply/skuAudit.go b/supply/skuAudit.go new file mode 100644 index 0000000..e76b674 --- /dev/null +++ b/supply/skuAudit.go @@ -0,0 +1,54 @@ +package supply + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" +) + +type skuAudit struct { +} + +type ArgsSkuAuditLists struct { + Search SkuAuditSearch + Page bean.Page +} + +type SkuAuditSearch struct { +} +type SkuAuditItem struct { + Id uint `json:"id"` +} +type ReplySkuAuditLists struct { + Lists []SkuAuditItem `json:"lists"` + Total int64 `json:"total"` +} + +// Lists @Title 审核列表 +func (s *skuAudit) Lists(ctx context.Context, args ArgsBrandList) (result ReplySkuAuditLists, err error) { + err = client.GetClient(s).Call(ctx, "Lists", args, &result) + return +} + +type ArgsSkuAuditAdopt struct { + AuditUserId uint // 审核人 + AuditIds []uint // 审核单id +} + +// Adopt @Title 通过 +func (s *skuAudit) Adopt(ctx context.Context, args ArgsSkuAuditAdopt) error { + reply := 0 + return client.GetClient(s).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 + return client.GetClient(s).Call(ctx, "Reject", args, &reply) +} diff --git a/supply/supply.go b/supply/supply.go index 7a3749d..b5924e0 100644 --- a/supply/supply.go +++ b/supply/supply.go @@ -3,4 +3,6 @@ package supply type Supply struct { Brand brand Category category + Sku sku + SkuAudit skuAudit }