diff --git a/supplier/goods/goods.go b/supplier/goods/goods.go index 6e36c8b..5c96844 100644 --- a/supplier/goods/goods.go +++ b/supplier/goods/goods.go @@ -1,5 +1,77 @@ package goods +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" + "github.com/shopspring/decimal" +) + +const ( + SkuStatusNone = 1 // 待处理 + SkuStatusAdopt = 2 // 同步入库 + SkuStatusReject = 3 // 废弃商品 +) + type Goods struct { - Sku sku +} +type GoodsSearch struct { + Name string // 商品名称 + CategoryId uint64 // 类目id + BrandName string // 品牌名 + SupplierType uint // 供应商类型 +} +type ArgsGoodsList struct { + Search GoodsSearch + Page bean.Page +} + +type GoodsItem struct { + Id uint `json:"id"` + Name string `json:"name"` + Img string `json:"img"` + GoodsNum string `json:"goodsNum"` + CategoryId uint `json:"categoryId"` + Category string `json:"category"` + BrandId uint `json:"brandId"` + Brand string `json:"brand"` + GoodsSpecs []GoodsSpecificationItem `json:"goodsSpecs"` + SkuItems []GoodsItemLists `json:"skuItems"` + StockCount uint `json:"stockCount"` + MinPrice decimal.Decimal `json:"minPrice"` + CreatedAt int64 `json:"createdAt"` +} + +type GoodsItemLists struct { + Id uint `json:"id"` + Specifications []SkuSpecificationItem `json:"specifications"` + Stock uint `json:"stock"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + GoodsId uint `json:"goodsId"` + Img string `json:"img"` +} + +type GoodsSpecificationItem struct { + Name string `json:"name"` + Values []string `json:"values"` +} + +type SkuSpecificationItem struct { + Name string `json:"name"` + Value string `json:"value"` +} + +type ReplyGoodsLists struct { + List []GoodsItem `json:"list"` + Total int64 `json:"total"` +} + +// Lists @Title 获取商品列表 +func (s *Goods) Lists(ctx context.Context, args ArgsGoodsList) (reply ReplyGoodsLists, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) + return } diff --git a/supplier/goods/sku.go b/supplier/goods/sku.go deleted file mode 100644 index abc08a7..0000000 --- a/supplier/goods/sku.go +++ /dev/null @@ -1,77 +0,0 @@ -package goods - -import ( - "context" - "git.oa00.com/supply-chain/service/client" - "git.oa00.com/supply-chain/service/lib/bean" - "github.com/shopspring/decimal" -) - -const ( - SkuStatusNone = 1 // 待处理 - SkuStatusAdopt = 2 // 同步入库 - SkuStatusReject = 3 // 废弃商品 -) - -type sku struct { -} -type GoodsSearch struct { - Name string // 商品名称 - CategoryId uint64 // 类目id - BrandName string // 品牌名 - SupplierType uint // 供应商类型 -} -type ArgsGoodsList struct { - Search GoodsSearch - Page bean.Page -} - -type GoodsItem struct { - Id uint `json:"id"` - Name string `json:"name"` - Img string `json:"img"` - GoodsNum string `json:"goodsNum"` - CategoryId uint `json:"categoryId"` - Category string `json:"category"` - BrandId uint `json:"brandId"` - Brand string `json:"brand"` - GoodsSpecs []GoodsSpecificationItem `json:"goodsSpecs"` - SkuItems []GoodsItemLists `json:"skuItems"` - StockCount uint `json:"stockCount"` - MinPrice decimal.Decimal `json:"minPrice"` - CreatedAt int64 `json:"createdAt"` -} - -type GoodsItemLists struct { - Id uint `json:"id"` - Specifications []SkuSpecificationItem `json:"specifications"` - Stock uint `json:"stock"` - SupplyPrice decimal.Decimal `json:"supplyPrice"` - GoodsId uint `json:"goodsId"` - Img string `json:"img"` -} - -type GoodsSpecificationItem struct { - Name string `json:"name"` - Values []string `json:"values"` -} - -type SkuSpecificationItem struct { - Name string `json:"name"` - Value string `json:"value"` -} - -type ReplyGoodsLists struct { - List []GoodsItem `json:"list"` - Total int64 `json:"total"` -} - -// Lists @Title 获取商品列表 -func (s *sku) Lists(ctx context.Context, args ArgsGoodsList) (reply ReplyGoodsLists, err error) { - xClient, err := client.GetClient(s) - if err != nil { - return - } - err = xClient.Call(ctx, "Lists", args, &reply) - return -}