package jd 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 // 废弃商品 SkuHandleNone = 1 // 未处理 SkuHandleStart = 2 // 开始处理 SkuJdStatusUp = 1 // 京东上架 SkuJdStatusDown = 2 // 京东下架 ) type sku struct { } type SkuSearch struct { Status uint // 状态 Handle uint // 处理状态 Name string // 商品名称 JdSkuId uint64 // 京东SkuId CategoryId uint64 // 类目id BrandName string // 品牌 MinSupplyPrice decimal.Decimal // 采购价最小 MaxSupplyPrice decimal.Decimal // 采购价最大 } type ArgsSkuList struct { Search SkuSearch Page bean.Page } type SkuItem struct { Id uint `json:"id"` JdSkuId uint64 `json:"jdSkuId"` JdSkuStatus uint `json:"jdSkuStatus"` Name string `json:"name"` ImgUrl string `json:"imgUrl"` FirstCategoryName string `json:"firstCategoryName"` SecondCategoryName string `json:"secondCategoryName"` ThirdCategoryName string `json:"thirdCategoryName"` BrandName string `json:"brandName"` SupplyPrice decimal.Decimal `json:"supplyPrice"` GuidePrice decimal.Decimal `json:"guidePrice"` Profit decimal.Decimal `json:"profit"` Status uint `json:"status"` Handle uint `json:"handle"` } type ReplySkuList struct { Lists []SkuItem `json:"lists"` Total int64 `json:"total"` } // Lists @Title 获取商品列表 func (s *sku) Lists(ctx context.Context, args ArgsSkuList) (reply ReplySkuList, err error) { err = client.GetClient(s).Call(ctx, "Lists", args, &reply) return } type ReplySkuInfo struct { Id uint `json:"id"` Name string `json:"name"` JdSkuId uint64 `json:"jdSkuId"` SupplyPrice decimal.Decimal `json:"supplyPrice"` GuidePrice decimal.Decimal `json:"guidePrice"` Profit decimal.Decimal `json:"profit"` UpcCode string `json:"upcCode"` Color string `json:"color"` Size string `json:"size"` FirstCategoryName string `json:"firstCategoryName"` SecondCategoryName string `json:"secondCategoryName"` ThirdCategoryName string `json:"thirdCategoryName"` SupplyCategoryId uint `json:"supplyCategoryId"` BrandName string `json:"brandName"` SupplyBrandId uint `json:"supplyBrandId"` Content string `json:"content"` Tax string `json:"tax"` Unit string `json:"unit"` Imgs []SkuImg `json:"imgs"` Specifications []SkuSpecification `json:"specifications"` JdSkuStatus uint `json:"jdSkuStatus"` } type SkuImg struct { Id uint `json:"id"` Path string `json:"path"` ReplacePath string `json:"replacePath"` } type SkuSpecification struct { Name string `json:"name"` Attributes []SkuAttribute `json:"attributes"` } type SkuAttribute struct { Name string `json:"name"` Value []string `json:"value"` } // Info @Title 获取商品详情 func (s *sku) Info(ctx context.Context, skuId uint) (reply ReplySkuInfo, err error) { err = client.GetClient(s).Call(ctx, "Info", skuId, &reply) return } type ArgsSkuEdit struct { SkuId uint SupplyBandId uint SupplyCategoryId uint Content string Imgs []SkuImgEdit } type SkuImgEdit struct { Id uint ReplacePath string } // Edit @Title 商品编辑 func (s *sku) Edit(ctx context.Context, args ArgsSkuEdit) error { reply := 0 return client.GetClient(s).Call(ctx, "Edit", args, &reply) } // Discard @Title 废弃 func (s *sku) Discard(ctx context.Context, skuIds []uint) error { reply := 0 return client.GetClient(s).Call(ctx, "Discard", skuIds, &reply) } type AdoptItem struct { Id uint `json:"id"` JdSkuId uint64 `json:"jdSkuId"` Name string `json:"name"` Error string `json:"error"` } // Adopt @Title 入库 func (s *sku) Adopt(ctx context.Context, skuIds []uint) (err error) { reply := 0 return client.GetClient(s).Call(ctx, "Adopt", skuIds, &reply) }