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/supplier/goods.go

99 lines
2.4 KiB

package supplier
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 {
}
type GoodsSearch struct {
Name string // 商品名称
CategoryId uint64 // 类目id
BrandName string // 品牌名
Handle uint // 处理状态 1=待处理 2=入库 3=废弃
}
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"`
BrandId uint `json:"brandId"`
BrandName string `json:"brandName"`
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 (g *goods) Lists(ctx context.Context, args ArgsGoodsList) (reply ReplyGoodsLists, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsGoodsInfo struct {
SkuId uint
}
type ReplyGoodsInfo struct {
Id uint
Name string
GoodsNum string
BrandId uint
BrandName string
CategoryId uint
}
// Info @Title 商品详情
func (g *goods) Info(ctx context.Context, skuId uint) (reply uint, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", skuId, &reply)
return
}