商品接口
本页按“商品资料”“商品分类”“商品标签”“商品单位”“商品品牌”“商品供应商”“商品口味”“商品库存”和“商品报损”等场景拆开展示,方便客户先理解主数据接口,再查看字典同步、库存查询与库存写入接口。
商品资料接口
用于商品查询、新增、修改。通常适合做资料初始化、资料比对、商品档案维护;分类、标签、单位、品牌、供应商、口味等字典能力按资源单独分组展示。
查询商品
POST/openapi/v3/product/increment-page支持按 uid、barcode、分类、名称等条件查询商品,也可按 lastId 游标分页拉取;默认只返回 product 表基础信息,扩展信息需通过布尔参数显式开启。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account |
string | 是 | 业务门店账号,表示本次查询对应哪家门店。 |
lastId |
long | 否 | 翻页游标。首次传 0 或不传;后续传上一次响应中的 nextLastId。 |
order |
string | 否 | 排序方向,仅支持 asc、desc,默认 asc。 |
limit |
int | 否 | 分页大小,默认 100,最大 100,超过按 100 处理。 |
uid | long | 否 | 按单个商品 UID 精确查询。 |
uidSet | array<long> | 否 | 按多个商品 UID 查询,最多 100 个。 |
barcode | string | 否 | 按单个条码精确查询。 |
barcodeSet | array<string> | 否 | 按多个条码查询,最多 100 个。 |
categoryUid | long | 否 | 按分类 UID 查询。 |
categoryName | string | 否 | 按分类名称查询,系统会先换算为分类 UID 再查询。 |
name | string | 否 | 按商品名称精确查询。 |
needCommonAttribute | boolean | 否 | 传 true 时返回商品通用属性,额外消耗 +20 token。 |
needImages | boolean | 否 | 传 true 时返回商品图片列表,额外消耗 +20 token。 |
needExtBarcodes | boolean | 否 | 传 true 时返回扩展条码,额外消耗 +20 token。 |
needTags | boolean | 否 | 传 true 时返回商品标签,额外消耗 +20 token。 |
needTastes | boolean | 否 | 传 true 时返回商品口味信息,额外消耗 +20 token。 |
needSuppliers | boolean | 否 | 传 true 时返回商品供应商列表,额外消耗 +20 token。 |
needMainUnit | boolean | 否 | 传 true 时返回商品主单位,额外消耗 +20 token。 |
needCategory | boolean | 否 | 传 true 时返回分类对象,额外消耗 +20 token。 |
业务说明
- 只查询 未删除
(enable != -1)的商品。 - 扩展返回字段按布尔参数显式开启;不需要的扩展建议不要传
true。
请求示例
{
"account": "store001",
"lastId": 0,
"order": "asc",
"limit": 100,
"needCommonAttribute": true,
"needImages": true,
"needExtBarcodes": false,
"needTags": false,
"needTastes": true,
"needSuppliers": true,
"needMainUnit": true,
"needCategory": true
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "101",
"uid": "1002003001",
"categoryUid": "9001",
"supplierUid": "3001",
"stock": 128.0000,
"userId": 5592187,
"name": "可乐500ml",
"barcode": "6901234567890",
"buyPrice": 2.20,
"sellPrice": 3.50,
"maxStock": 500.00,
"minStock": 20.00,
"pinyin": "kele",
"sellPrice2": 3.20,
"customerPrice": 3.20,
"productionDate": "2026-03-20",
"shelfLife": 365,
"isPoint": 1,
"isCustomerDiscount": 1,
"enable": 1,
"description": "新品测试",
"createdDatetime": "2026-03-20 08:00:00",
"updatedDatetime": "2026-04-01 09:30:00",
"isGift": 0,
"isCaseProduct": 2,
"noStock": 0,
"attribute1": "常温",
"attribute2": "500ml",
"attribute3": "塑料瓶",
"attribute4": "SP-001",
"attribute5": "COLA-500",
"attribute6": "500ml*24",
"attribute7": "是",
"attribute8": "否",
"attribute9": "自定义9",
"attribute10": "自定义10",
"sysUpdateTime": "2026-04-01 09:30:00",
"commonAttribute": {
"canAppointed": 0,
"isTiming": 0,
"atLeastMinutes": 30,
"atLeastAmount": 100.00,
"enableBatch": 1,
"stockDeductionType": 0,
"pluCode": "2800000001234",
"brandUid": "8001",
"brandName": "可口可乐",
"stockPosition": "A-01-02",
"preparationTime": 15,
"preparationTimeUnit": 0,
"volume": 0.500,
"weight": 0.550,
"weightUnit": 1,
"minSellQuantity": 1.000,
"stepSellQuantity": 1.000,
"maxSellQuantity": 10.000,
"enableSN": 0,
"isPacking": 0,
"isBarcodeScale": 0,
"isNewly": 1,
"limitMinSellPrice": 3.00,
"depositValidDays": 7,
"enableTraceabilityCode": 1,
"ifNeedMake": 0,
"referGrossRate": 35.50,
"mnemonicCode": "KL"
},
"images": [
{
"path": "https://cdn.example.com/product/1002003001/main.jpg",
"isCover": 1,
"orderIndex": 1
}
],
"extBarcodes": [
"16901234567890"
],
"tags": [
"饮料",
"常温"
],
"tastes": [
{
"uid": "1622707645696449590",
"attributeName": "椰果",
"attributeValue": "2",
"isDefault": 0,
"suggest": 1,
"packageUid": "1622707645694362262",
"packageName": "加料",
"packageType": 1
},
{
"uid": "1622707645706257418",
"attributeName": "奶盖",
"attributeValue": "5",
"isDefault": 0,
"suggest": 0,
"packageUid": "1622707645694362262",
"packageName": "加料",
"packageType": 1
}
],
"suppliers": [
{
"uid": "3001",
"number": "SUP-001",
"name": "鲜果原料供应商",
"lastBuyPrice": 8.50000000,
"buyPrice": 9.00000000,
"isDefault": 1,
"deliveryDay": 1
},
{
"uid": "3002",
"number": "SUP-002",
"name": "奶制品供应商",
"lastBuyPrice": 11.20000000,
"buyPrice": 11.50000000,
"isDefault": 0,
"deliveryDay": 2
}
],
"mainUnit": {
"uid": "7001",
"name": "瓶"
},
"category": {
"uid": "9001",
"parentUid": "9000",
"name": "饮料",
"enable": 1,
"categoryOrder": 10
}
}
],
"hasMore": true,
"nextLastId": "101"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[] 及扩展对象。
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 商品主键 ID。 |
uid | string | 商品业务 UID。 |
categoryUid | string | 商品所属分类 UID。 |
supplierUid | string | 供应商 UID。 |
stock | decimal | 当前库存数量。 |
userId | int | 门店 ID。 |
name | string | 商品名称。 |
barcode | string | 主条码。 |
buyPrice | decimal | 进价。 |
sellPrice | decimal | 售价。 |
maxStock | decimal | 库存上限。 |
minStock | decimal | 库存下限。 |
pinyin | string | 商品拼音。 |
sellPrice2 | decimal | 批发价。 |
customerPrice | decimal | 会员价。 |
productionDate | string | 生产日期。 |
shelfLife | int | 保质期。 |
isPoint | int | 是否参与积分。 |
isCustomerDiscount | int | 是否开启会员折扣 1-开启 0/null-不开启。 |
enable | int | 状态,文档中仅返回 enable != -1 的商品。1-可用,0-禁用,-1-删除。 |
description | string | 商品描述。 |
createdDatetime | string | 创建时间。 |
updatedDatetime | string | 业务更新时间。 |
isGift | int | 是否赠品。 |
isCaseProduct | int | 是否原材料配方商品。 |
noStock | int | 是否不记库存,0/null-记库存,1-不记库存。 |
attribute1 | string | attribute1。 |
attribute2 | string | attribute2。 |
attribute3 | string | attribute3。 |
attribute4 | string | attribute4 货号(零售行业)。 |
attribute5 | string | SPU/主编码(服装多颜色尺码)多规格商品,该字段一样。 |
attribute6 | string | 规格。 |
attribute7 | string | 是否主商品。 |
attribute8 | string | 是否多颜色尺码。 |
attribute9 | string | attribute9。 |
attribute10 | string | attribute10。 |
sysUpdateTime | string | 系统更新时间。 |
commonAttribute | object | 商品通用属性,需传 needCommonAttribute=true。 |
images | array<object> | 商品图片列表,需传 needImages=true。 |
extBarcodes | array<string> | 扩展条码列表,需传 needExtBarcodes=true。 |
tags | array<string> | 商品标签列表,需传 needTags=true。 |
tastes | array<object> | 商品口味列表,需传 needTastes=true。 |
suppliers | array<object> | 商品供应商列表,需传 needSuppliers=true,按供应商 UID 去重后返回。 |
mainUnit | object | 商品主单位,需传 needMainUnit=true。 |
category | object | 分类对象,需传 needCategory=true。 |
扩展对象字段
| 对象 | 字段 | 类型 | 说明 |
|---|---|---|---|
commonAttribute | canAppointed | int | 是否可预约,0/null-否,1-是。 |
commonAttribute | isTiming | int | 是否计时商品,0/null-否,1-是。 |
commonAttribute | atLeastMinutes | int | 最低消费分钟数。 |
commonAttribute | atLeastAmount | decimal | 最低消费金额。 |
commonAttribute | enableBatch | int | 是否开启批次管理,0/null-关闭,1-开启。 |
commonAttribute | stockDeductionType | int | 库存扣减方式,仅开启批次管理时有效,0-先进先出,1-手动选择批次。 |
commonAttribute | pluCode | string | 称编码。 |
commonAttribute | brandUid | string | 品牌 UID。 |
commonAttribute | brandName | string | 品牌名称。 |
commonAttribute | stockPosition | string | 库位。 |
commonAttribute | preparationTime | int | 准备时长,单位分钟。 |
commonAttribute | preparationTimeUnit | int | 准备时长单位,0-分钟,1-天。 |
commonAttribute | volume | decimal | 体积。 |
commonAttribute | weight | decimal | 重量。 |
commonAttribute | weightUnit | int | 重量单位,NULL/1-kg,2-斤。 |
commonAttribute | minSellQuantity | decimal | 起售量。 |
commonAttribute | stepSellQuantity | decimal | 增量售卖数。 |
commonAttribute | maxSellQuantity | decimal | 最大售卖数。 |
commonAttribute | enableSN | int | 是否开启序列号管理,0/null-关闭,1-开启。 |
commonAttribute | isPacking | int | 是否包装商品,0/null-否,1-是。 |
commonAttribute | isBarcodeScale | int | 是否条码秤商品,0/null-否,1-是。 |
commonAttribute | isNewly | int | 是否新品,0/null-否,1-是。 |
commonAttribute | limitMinSellPrice | decimal | 最低售价限制。 |
commonAttribute | depositValidDays | int | 寄存有效期,单位天。 |
commonAttribute | enableTraceabilityCode | int | 是否开启溯源码,0/null-关闭,1-开启。 |
commonAttribute | ifNeedMake | int | 是否需要制作,0/null-关闭,1-开启。 |
commonAttribute | referGrossRate | decimal | 参考毛利率。 |
commonAttribute | mnemonicCode | string | 商品助记码。 |
images[] | path | string | 图片地址。 |
images[] | isCover | int | 是否封面图,1 表示是。 |
images[] | orderIndex | int | 图片排序值。 |
tastes[] | uid | string | 口味 UID。 |
tastes[] | attributeName | string | 口味名称。 |
tastes[] | attributeValue | string | 口味值。 |
tastes[] | isDefault | int | 是否默认口味,1 表示默认。 |
tastes[] | suggest | int | 是否推荐口味,1 表示推荐。 |
tastes[] | packageUid | string | 口味组 UID。 |
tastes[] | packageName | string | 口味组名称。 |
tastes[] | packageType | int | 口味组类型 1:多选 + 非必选 2:单选 + 非必选 3:多选 + 必选 4:单选 + 必选。 |
suppliers[] | uid | string | 供应商 UID。 |
suppliers[] | number | string | 供应商编号。 |
suppliers[] | name | string | 供应商名称。 |
suppliers[] | lastBuyPrice | decimal | 最后进货价。 |
suppliers[] | buyPrice | decimal | 进货价。 |
suppliers[] | isDefault | int | 是否默认供应商,1 表示默认。 |
suppliers[] | deliveryDay | int | 交货周期,单位天。 |
mainUnit | uid | string | 主单位 UID。 |
mainUnit | name | string | 主单位名称。 |
category | uid | string | 分类 UID。 |
category | parentUid | string | 父级分类 UID。 |
category | name | string | 分类名称。 |
category | enable | int | 分类启用状态。 |
category | categoryOrder | int | 分类排序值。 |
新增商品
POST/openapi/v3/product/create新增商品采用扁平写模型。基础字段尽量与查询商品同名;分类、供应商、主单位、标签、品牌、口味等引用字段,先通过字典接口取到 UID,再在本接口中回传。
请求参数
| 参数 | 类型 | 必填 | 说明 | UID 来源接口 |
|---|---|---|---|---|
account | string | 是 | 业务门店账号。 | - |
categoryUid | long | 否 | 商品分类 UID。 | /openapi/v3/product/category-page |
supplierUid | long | 否 | 默认供应商 UID。 | /openapi/v3/product/supplier-page |
stock | decimal | 否 | 初始库存;不传默认 0。 | - |
name | string | 是 | 商品名称。 | - |
barcode | string | 否 | 商品条码;如传入则服务端基于该条码生成商品 UID。若不传,服务端会自动生成条码并据此生成商品 UID;同门店内最终落库条码必须唯一。 | - |
buyPrice | decimal | 是 | 进价,必须大于等于 0。 | - |
sellPrice | decimal | 是 | 售价,必须大于等于 0。 | - |
maxStock | decimal | 否 | 最大库存。 | - |
minStock | decimal | 否 | 最小库存。 | - |
pinyin | string | 否 | 商品拼音,如果为空按银豹默认规则生成。 | - |
sellPrice2 | decimal | 否 | 批发价。 | - |
customerPrice | decimal | 否 | 会员价;不传时默认等于 sellPrice。 | - |
productionDate | string | 否 | 生产日期;建议格式 yyyy-MM-dd。 | - |
shelfLife | int | 否 | 保质期天数;如传值需大于 0。 | - |
attribute1 | string | 否 | attribute1。 | - |
attribute2 | string | 否 | attribute2。 | - |
attribute3 | string | 否 | attribute3。 | - |
attribute4 | string | 否 | attribute4 货号(零售行业)。 | - |
attribute5 | string | 否 | SPU/主编码(服装多颜色尺码)多规格商品,该字段一样。 | - |
attribute6 | string | 否 | 规格;按现有表结构原值落库。 | - |
attribute7 | string | 否 | 是否主商品。 | - |
attribute8 | string | 否 | 是否多颜色尺码。 | - |
attribute9 | string | 否 | attribute9。 | - |
attribute10 | string | 否 | attribute10。 | - |
isCustomerDiscount | int | 否 | 是否参与会员折扣,取值 0 / 1,默认 0。 | - |
enable | int | 否 | 启用状态,取值 0 / 1,默认 1。 | - |
description | string | 否 | 商品描述。 | - |
noStock | int | 否 | 是否不记库存,0/null-记库存,1-不记库存。 | - |
commonAttribute | object | 否 | 商品通用扩展属性对象;支持传入品牌、批次管理、准备时长、称编码、重量、起售量等字段,详见下方 commonAttribute 子字段说明。 | - |
extBarcodes | array<string> | 否 | 扩展条码列表;每项长度不能超过 32。 | - |
tagUids | array<long> | 否 | 商品标签 UID 列表。 | /openapi/v3/product/tag-page |
tastes | array<object> | 否 | 商品口味列表。 | /openapi/v3/product/attribute-page |
tastes[].uid | long | 是(有 tastes 时) | 口味 UID。 | /openapi/v3/product/attribute-page |
tastes[].suggest | int | 否 | 是否推荐,取值 0 / 1,默认 0。 | - |
mainUnitUid | long | 否 | 商品主单位 UID;当前仅支持写入一个主单位。 | /openapi/v3/product/unit-page |
commonAttribute 子字段说明
以下仅列出新增商品接口当前支持写入的 commonAttribute 子字段;如 commonAttribute.brandName 等查询返回字段,不支持在本接口直接传入。
| 参数 | 类型 | 必填 | 说明 | 默认值/校验 | UID 来源接口 |
|---|---|---|---|---|---|
commonAttribute.canAppointed | int | 否 | 是否可预约。 | 0/null=否,1=是。 | - |
commonAttribute.isTiming | int | 否 | 是否计时商品。 | 0/null=否,1=是。 | - |
commonAttribute.atLeastMinutes | int | 否 | 最低消费分钟数。 | 如传值需大于 0。 | - |
commonAttribute.atLeastAmount | decimal | 否 | 最低消费金额。 | 按数值落库。 | - |
commonAttribute.enableBatch | int | 否 | 是否开启批次管理。 | 0/null=关闭,1=开启。 | - |
commonAttribute.stockDeductionType | int | 否 | 库存扣减方式,仅开启批次管理时有效。 | 0=先进先出,1=手动选择批次。 | - |
commonAttribute.pluCode | string | 否 | 称编码。 | 按原值落库。 | - |
commonAttribute.brandUid | long | 否 | 品牌 UID。 | 服务端会校验是否存在。 | /openapi/v3/product/brand-page |
commonAttribute.stockPosition | string | 否 | 库位。 | 按原值落库。 | - |
commonAttribute.preparationTime | int | 否 | 准备时长。 | 如传值需大于 0。 | - |
commonAttribute.preparationTimeUnit | int | 否 | 准备时长单位。 | 不传默认 0;0=分钟,1=天。 | - |
commonAttribute.volume | decimal | 否 | 体积。 | 按数值落库。 | - |
commonAttribute.weight | decimal | 否 | 重量。 | 按数值落库。 | - |
commonAttribute.weightUnit | int | 否 | 重量单位。 | 1=kg,2=斤。 | - |
commonAttribute.minSellQuantity | decimal | 否 | 起售量。 | 按数值落库。 | - |
commonAttribute.stepSellQuantity | decimal | 否 | 增量售卖数。 | 按数值落库。 | - |
commonAttribute.maxSellQuantity | decimal | 否 | 最大售卖数。 | 按数值落库。 | - |
commonAttribute.enableSN | int | 否 | 是否开启序列号管理。 | 0/null=关闭,1=开启。 | - |
commonAttribute.isPacking | int | 否 | 是否包装商品。 | 0/null=否,1=是。 | - |
commonAttribute.isBarcodeScale | int | 否 | 是否条码秤商品。 | 0/null=否,1=是。 | - |
commonAttribute.isNewly | int | 否 | 是否新品。 | 0/null=否,1=是。 | - |
commonAttribute.limitMinSellPrice | decimal | 否 | 最低售价限制。 | 按数值落库。 | - |
commonAttribute.depositValidDays | int | 否 | 寄存有效期,单位天。 | 如传值需大于 0。 | - |
commonAttribute.enableTraceabilityCode | int | 否 | 是否开启溯源码。 | 0/null=关闭,1=开启。 | - |
commonAttribute.ifNeedMake | int | 否 | 是否需要制作。 | 0/null=关闭,1=开启。 | - |
commonAttribute.referGrossRate | decimal | 否 | 参考毛利率。 | 按数值落库。 | - |
commonAttribute.mnemonicCode | string | 否 | 商品助记码。 | 按原值落库。 | - |
业务说明
- 商品 UID 由服务端按
NumberUtil.generateUid(barcode)生成;若未传barcode,服务端会先自动生成条码,再据此生成商品 UID。 - 仅当不同门店传入相同
barcode时,生成的商品 UID 才保持一致。 - 若同一门店下最终使用的
barcode已存在,接口会返回4006。 attribute1~attribute10会按原值写入现有表结构;如门店已约定具体业务语义,请保持与既有系统一致。commonAttribute仅支持本页列出的可写子字段;如commonAttribute.brandName等查询返回字段,不支持在创建接口传入。- 如传入
categoryUid、supplierUid、mainUnitUid、tagUids、tastes[].uid、commonAttribute.brandUid,服务端会先校验 UID 是否存在;不存在时返回4004。 - 当前暂不支持多单位批量写入,仅支持通过
mainUnitUid写主单位。
请求示例
{
"account": "store001",
"categoryUid": 9001,
"supplierUid": 3001,
"stock": 128,
"name": "可乐500ml",
"barcode": "6901234567890",
"buyPrice": 2.2,
"sellPrice": 3.5,
"maxStock": 500,
"minStock": 20,
"pinyin": "kele",
"sellPrice2": 3.2,
"customerPrice": 3.2,
"productionDate": "2026-03-20",
"shelfLife": 365,
"attribute1": "常温",
"attribute2": "500ml",
"attribute3": "塑料瓶",
"attribute4": "SP-001",
"attribute5": "COLA-500",
"attribute6": "500ml*24",
"attribute7": "是",
"attribute8": "否",
"attribute9": "自定义9",
"attribute10": "自定义10",
"isCustomerDiscount": 1,
"enable": 1,
"description": "新品测试",
"noStock": 0,
"commonAttribute": {
"canAppointed": 0,
"isTiming": 0,
"atLeastMinutes": 30,
"atLeastAmount": 100,
"enableBatch": 1,
"stockDeductionType": 0,
"pluCode": "2800000001234",
"brandUid": 8001,
"stockPosition": "A-01-02",
"preparationTime": 15,
"preparationTimeUnit": 0,
"volume": 0.5,
"weight": 0.55,
"weightUnit": 1,
"minSellQuantity": 1,
"stepSellQuantity": 1,
"maxSellQuantity": 10,
"enableSN": 0,
"isPacking": 0,
"isBarcodeScale": 0,
"isNewly": 1,
"limitMinSellPrice": 3,
"depositValidDays": 7,
"enableTraceabilityCode": 1,
"ifNeedMake": 0,
"referGrossRate": 35.5,
"mnemonicCode": "KL"
},
"extBarcodes": [
"16901234567890"
],
"tagUids": [
11001,
11002
],
"tastes": [
{
"uid": 1622707645696449590,
"suggest": 1
},
{
"uid": 1622707645706257418,
"suggest": 0
}
],
"mainUnitUid": 7001
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"id": "101",
"uid": "506901234567890",
"name": "可乐500ml",
"barcode": "6901234567890",
"sysUpdateTime": "2026-04-25 14:30:00"
}
}
返回字段说明
status、errorCode 及公共响应字段请参考“公共响应格式”,此处仅补充 result。
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 商品主键 ID。 |
uid | long | 商品 UID,由服务端根据 barcode 生成。 |
name | string | 商品名称。 |
barcode | string | 商品条码。 |
sysUpdateTime | string | 系统更新时间。 |
修改商品
POST/openapi/v3/product/update按 uid 或 barcode 二选一定位商品,采用 updateMask + clearFields 协议更新商品资料,并支持在修改资料时一起直接设置库存。
说明:为避免客户误以为只支持少数字段,本节下面直接列出完整可修改字段清单、可清空规则以及 commonAttribute 子字段清单。
协议控制字段
| 参数 | 类型 | 必填 | 说明 | UID 来源接口 |
|---|---|---|---|---|
account | string | 是 | 业务门店账号。 | - |
uid | long | 二选一 | 商品 UID;与 barcode 二选一传入。 | - |
barcode | string | 二选一 | 商品条码;与 uid 二选一传入,仅作定位条件,不支持修改。 | - |
updateMask | array<string> | 否 | 声明本次要修改哪些字段;不在其中的字段不修改。 | - |
clearFields | array<string> | 否 | 声明本次要清空哪些字段;与 updateMask 不能同时都为空。 | - |
完整可修改字段清单
| 字段 | 类型 | 要求 | 说明 | 是否支持清空 | UID 来源接口 |
|---|---|---|---|---|---|
name | string | 按需 | 商品名称;仅当 updateMask 包含 name 时生效。 | 否 | - |
categoryUid | long | 按需 | 商品分类 UID。 | 否 | /openapi/v3/product/category-page |
supplierUid | long | 按需 | 默认供应商 UID。 | 是 | /openapi/v3/product/supplier-page |
stock | decimal | 按需 | 库存值;仅当 updateMask 包含 stock 时生效,语义为直接设置库存。 | 否 | - |
buyPrice | decimal | 按需 | 进价。 | 否 | - |
sellPrice | decimal | 按需 | 售价。 | 否 | - |
maxStock | decimal | 按需 | 最大库存。 | 是 | - |
minStock | decimal | 按需 | 最小库存。 | 是 | - |
pinyin | string | 按需 | 商品拼音。 | 是 | - |
sellPrice2 | decimal | 按需 | 批发价。 | 是 | - |
customerPrice | decimal | 按需 | 会员价。 | 是 | - |
productionDate | string | 按需 | 生产日期,建议格式 yyyy-MM-dd。 | 是 | - |
shelfLife | int | 按需 | 保质期天数。 | 是 | - |
attribute1 | string | 按需 | attribute1。 | 是 | - |
attribute2 | string | 按需 | attribute2。 | 是 | - |
attribute3 | string | 按需 | attribute3。 | 是 | - |
attribute4 | string | 按需 | attribute4。货号(零售行业) | 是 | - |
attribute5 | string | 按需 | SPU/主编码(服装多颜色尺码)多规格商品,该字段一样。 | 是 | - |
attribute6 | string | 按需 | 规格。 | 是 | - |
attribute7 | string | 按需 | 是否主商品。 | 是 | - |
attribute8 | string | 按需 | 是否多颜色尺码。 | 是 | - |
attribute9 | string | 按需 | attribute9。 | 是 | - |
attribute10 | string | 按需 | attribute10。 | 是 | - |
isCustomerDiscount | int | 按需 | 是否参与会员折扣,只支持 0 / 1。 | 否 | - |
enable | int | 按需 | 启用状态,只支持 0 / 1。 | 否 | - |
description | string | 按需 | 商品描述。 | 是 | - |
noStock | int | 按需 | 是否不记库存。 | 是 | - |
extBarcodes | array<string> | 按需 | 扩展条码列表;更新时按整体替换。 | 是 | - |
tagUids | array<long> | 按需 | 商品标签 UID 列表;更新时按整体替换。 | 是 | /openapi/v3/product/tag-page |
tastes | array<object> | 按需 | 商品口味列表;更新时按整体替换。如只想修改其中一个口味的 suggest,也需传最终完整口味列表。 | 是 | /openapi/v3/product/attribute-page |
mainUnitUid | long | 按需 | 商品主单位 UID。 | 是 | /openapi/v3/product/unit-page |
commonAttribute 可修改子字段
| 字段 | 类型 | 说明 | 是否支持清空 | UID 来源接口 |
|---|---|---|---|---|
commonAttribute.canAppointed | int | 是否可预约。 | 否 | - |
commonAttribute.isTiming | int | 是否计时商品。 | 否 | - |
commonAttribute.atLeastMinutes | int | 最低消费分钟数。 | 是 | - |
commonAttribute.atLeastAmount | decimal | 最低消费金额。 | 是 | - |
commonAttribute.enableBatch | int | 是否开启批次管理。 | 否 | - |
commonAttribute.stockDeductionType | int | 库存扣减方式。 | 否 | - |
commonAttribute.pluCode | string | 称编码。 | 是 | - |
commonAttribute.brandUid | long | 品牌 UID。 | 是 | /openapi/v3/product/brand-page |
commonAttribute.stockPosition | string | 库位。 | 是 | - |
commonAttribute.preparationTime | int | 准备时长。 | 是 | - |
commonAttribute.preparationTimeUnit | int | 准备时长单位。 | 否 | - |
commonAttribute.volume | decimal | 体积。 | 是 | - |
commonAttribute.weight | decimal | 重量。 | 是 | - |
commonAttribute.weightUnit | int | 重量单位。 | 否 | - |
commonAttribute.minSellQuantity | decimal | 起售量。 | 是 | - |
commonAttribute.stepSellQuantity | decimal | 增量售卖数。 | 是 | - |
commonAttribute.maxSellQuantity | decimal | 最大售卖数。 | 是 | - |
commonAttribute.enableSN | int | 是否开启序列号管理。 | 否 | - |
commonAttribute.isPacking | int | 是否包装商品。 | 否 | - |
commonAttribute.isBarcodeScale | int | 是否条码秤商品。 | 否 | - |
commonAttribute.isNewly | int | 是否新品。 | 否 | - |
commonAttribute.limitMinSellPrice | decimal | 最低售价限制。 | 是 | - |
commonAttribute.depositValidDays | int | 尤存有效天数。 | 是 | - |
commonAttribute.enableTraceabilityCode | int | 是否开启溯源码。 | 否 | - |
commonAttribute.ifNeedMake | int | 是否需要制作。 | 否 | - |
commonAttribute.referGrossRate | decimal | 参考毛利率。 | 是 | - |
commonAttribute.mnemonicCode | string | 助记码。 | 是 | - |
业务说明
uid与barcode必须且只能传一个;推荐优先传barcode。updateMask负责“改值”,clearFields负责“清空”;同一个字段不能同时出现在两边。clearFields可清空的基础字段主要包括:supplierUid、maxStock、minStock、pinyin、sellPrice2、customerPrice、productionDate、shelfLife、description、noStock、attribute1~10、extBarcodes、tagUids、tastes、mainUnitUid。stock支持随商品资料一起修改,但不支持清空;如需批量设置 / 批量增减库存,仍建议使用库存专用接口。tagUids、tastes、extBarcodes在更新时按“整体替换”处理;放入clearFields时表示全部清空。tastes不支持只传局部变更项。比如原来有 3 种口味想改成 2 种,请直接传最终的 2 种口味列表;如原来有 5 种口味只想修改某个口味的 suggest,也请传最终完整的 5 种口味列表。commonAttribute不支持整对象更新;如需清空整个commonAttribute,请传clearFields: ["commonAttribute"]。- 如请求涉及
categoryUid、supplierUid、mainUnitUid、tagUids、tastes[].uid、commonAttribute.brandUid,服务端会先校验 UID 是否存在。
请求示例
{
"account": "store001",
"barcode": "6901234567890",
"updateMask": [
"name",
"stock",
"sellPrice",
"attribute5",
"tagUids",
"commonAttribute.brandUid"
],
"clearFields": ["description"],
"name": "可乐600ml",
"stock": 128,
"sellPrice": 3.8,
"attribute5": "COLA-600",
"tagUids": [11001, 11002],
"commonAttribute": {
"brandUid": 8001
}
}
口味修改示例
当 updateMask 包含 tastes 时,服务端会把传入的口味列表视为“最终状态”,不支持只传局部变更项。
{
"account": "store001",
"barcode": "6901234567890",
"updateMask": ["tastes"],
"tastes": [
{
"uid": 1622707645696449590,
"suggest": 1
},
{
"uid": 1622707645706257418,
"suggest": 0
}
]
}
- 原来有 3 种口味,想改成 2 种:直接传最终的 2 条
tastes。 - 原来有 5 种口味,只想改某一条的
suggest:也要把最终完整的 5 条tastes一起传上来。
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"id": "101",
"uid": "1002003001",
"name": "可乐600ml",
"barcode": "6901234567890",
"sysUpdateTime": "2026-04-26 15:30:12"
}
}
常见错误
请传 uid 或 barcode 其中一个uid 与 barcode 只能传一个updateMask 与 clearFields 不能同时为空barcode 仅支持作为定位条件,不支持修改stock 不支持清空commonAttribute 不支持整对象更新,请使用 commonAttribute.xxx
商品分类
用于查询、新增、修改商品分类。分类新增和修改成功后会生成同步任务并通知收银端。
查询商品分类
POST/openapi/v3/product/category-page分页拉取商品分类字典,供新增商品接口传入 categoryUid;返回 id、uid、parentUid、name 等字段。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
lastId | long | 否 | 分页游标。首次传 0;后续传上次响应中的 nextLastId。 |
limit | int | 否 | 单次返回条数;默认 100,最大 100。 |
name | string | 否 | 分类名称,按精确匹配过滤。 |
业务说明
- 服务端固定按
id asc顺序分页返回。 - 仅返回未删除分类,即
enable != -1的记录。 - 新增商品时请使用返回的
uid作为categoryUid。
请求示例
{
"account": "store001",
"lastId": 0,
"limit": 100,
"name": "饮料"
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "301",
"uid": "9001",
"parentUid": "9000",
"name": "饮料",
"enable": 1,
"categoryOrder": 10
}
],
"hasMore": false,
"nextLastId": "301"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[]。
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 分类表主键 ID,用于分页游标。 |
uid | long | 分类 UID,新增商品时传入 categoryUid。 |
parentUid | long | 父级分类 UID。 |
name | string | 分类名称。 |
enable | int | 分类启用状态。 |
categoryOrder | int | 分类排序值。 |
新增商品分类
POST/openapi/v3/product/category-create新增商品分类。name 必填,parentUid 不传或传 0 表示顶级分类;新增成功后会同步到收银端。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
name | string | 是 | 分类名称,服务端会自动去除首尾空格,长度不能超过 50。 |
parentUid | long | 否 | 父级分类 UID。不传或传 0 表示顶级分类;非 0 时父级分类必须存在。 |
业务说明
- 同一父级分类下不允许存在相同名称的未删除分类。
- 新增分类默认
enable = 1、categoryOrder = 0、categoryType = 0。 - 接口成功后会异步保存同步任务并通知收银端,行为与新增商品订单同步保持一致。
请求示例
{
"account": "store001",
"parentUid": 0,
"name": "饮料"
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"id": "302",
"uid": "9002",
"parentUid": "0",
"name": "饮料",
"enable": 1,
"categoryOrder": 0
}
}
返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 分类表主键 ID。 |
uid | long | 分类 UID,新增或修改商品时传入 categoryUid。 |
parentUid | long | 父级分类 UID;0 表示顶级分类。 |
name | string | 分类名称。 |
enable | int | 分类启用状态。 |
categoryOrder | int | 分类排序值。 |
修改商品分类
POST/openapi/v3/product/category-update修改商品分类名称或父级分类。uid 必填,name 和 parentUid 按需传入;修改成功后会同步到收银端。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
uid | long | 是 | 要修改的分类 UID。 |
name | string | 否 | 新的分类名称。传入时服务端会自动去除首尾空格,长度不能超过 50。 |
parentUid | long | 否 | 新的父级分类 UID。传 0 表示改为顶级分类;传 -1 或不传表示不修改父级。 |
业务说明
- 目标分类不存在或已删除时返回错误。
- 非
0的父级分类必须存在。 - 同一父级分类下不允许存在相同名称的未删除分类。
- 不允许把分类移动到自己或自己的子分类下。
- 接口成功后会异步保存同步任务并通知收银端,行为与新增商品订单同步保持一致。
请求示例
{
"account": "store001",
"uid": 9002,
"parentUid": -1,
"name": "瓶装饮料"
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"id": "302",
"uid": "9002",
"parentUid": "0",
"name": "瓶装饮料",
"enable": 1,
"categoryOrder": 0
}
}
返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 分类表主键 ID。 |
uid | long | 分类 UID,新增或修改商品时传入 categoryUid。 |
parentUid | long | 父级分类 UID;0 表示顶级分类。 |
name | string | 分类名称。 |
enable | int | 分类启用状态。 |
categoryOrder | int | 分类排序值。 |
商品标签
用于查询商品标签字典,返回新增或修改商品时所需的 tagUids。
查询商品标签
POST/openapi/v3/product/tag-page分页拉取商品标签字典,返回 uid + name,供新增商品接口传入 tagUids。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
lastId | long | 否 | 分页游标。首次传 0;后续传上次响应中的 nextLastId。 |
limit | int | 否 | 单次返回条数;默认 100,最大 100。 |
name | string | 否 | 标签名称,按精确匹配过滤。 |
业务说明
- 服务端固定按
id asc顺序分页返回。 name为精确匹配,适合按标签名称定位对应 UID。- 返回字段覆盖新增商品所需的核心信息:
id、uid、name。
请求示例
{
"account": "store001",
"lastId": 0,
"limit": 100,
"name": "饮料"
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "201",
"uid": "11001",
"name": "饮料"
}
],
"hasMore": false,
"nextLastId": "201"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[]。
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 标签表主键 ID,用于分页游标。 |
uid | long | 标签 UID,新增商品时传入 tagUids。 |
name | string | 标签名称。 |
商品单位
用于查询商品单位字典,返回新增或修改商品时所需的 mainUnitUid。
查询商品单位
POST/openapi/v3/product/unit-page分页拉取商品单位字典,供新增商品接口传入 mainUnitUid。当前新增商品只支持写一个主单位。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
lastId | long | 否 | 分页游标。首次传 0;后续传上次响应中的 nextLastId。 |
limit | int | 否 | 单次返回条数;默认 100,最大 100。 |
name | string | 否 | 单位名称,按精确匹配过滤。 |
业务说明
- 服务端固定按
id asc顺序分页返回。 - 仅返回启用中的单位,即
enable = 1的记录。 - 新增商品时请使用返回的
uid作为mainUnitUid。
请求示例
{
"account": "store001",
"lastId": 0,
"limit": 100,
"name": "瓶"
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "401",
"uid": "7001",
"name": "瓶"
}
],
"hasMore": false,
"nextLastId": "401"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[]。
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 单位表主键 ID,用于分页游标。 |
uid | long | 单位 UID,新增商品时传入 mainUnitUid。 |
name | string | 单位名称。 |
商品品牌
用于查询商品品牌字典,返回新增或修改商品时所需的 commonAttribute.brandUid。
查询商品品牌
POST/openapi/v3/product/brand-page分页拉取商品品牌字典,供新增商品接口传入 commonAttribute.brandUid。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
lastId | long | 否 | 游标 ID;默认从 0 开始。 |
limit | int | 否 | 分页大小;默认 100,最大 100。 |
name | string | 否 | 品牌名称;按名称精确匹配。 |
请求示例
{
"account": "store001",
"lastId": 0,
"limit": 100,
"name": "可口可乐"
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": 1,
"uid": 8001,
"name": "可口可乐"
}
],
"hasMore": false,
"nextLastId": 1
}
}
返回字段说明
status、errorCode 及公共响应字段请参考“公共响应格式”,此处仅补充 result。
| 字段 | 类型 | 说明 |
|---|---|---|
list[].id | long | 品牌记录主键 ID。 |
list[].uid | long | 品牌 UID;新增商品时传入 commonAttribute.brandUid。 |
list[].name | string | 品牌名称。 |
hasMore | boolean | 是否还有下一页。 |
nextLastId | long | 下一次请求应传入的 lastId;没有更多数据时返回当前页最后一条的 id 或 null。 |
商品供应商
用于查询供应商字典,返回新增或修改商品时所需的 supplierUid。
查询供应商
POST/openapi/v3/product/supplier-page分页拉取供应商字典,供新增商品接口传入 supplierUid。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
lastId | long | 否 | 分页游标。首次传 0;后续传上次响应中的 nextLastId。 |
limit | int | 否 | 单次返回条数;默认 100,最大 100。 |
name | string | 否 | 供应商名称,按精确匹配过滤。 |
业务说明
- 服务端固定按
id asc顺序分页返回。 - 仅返回未删除供应商,即
enable != -1的记录。 - 新增商品时请使用返回的
uid作为supplierUid。
请求示例
{
"account": "store001",
"lastId": 0,
"limit": 100,
"name": "鲜果原料供应商"
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "501",
"uid": "3001",
"number": "SUP-001",
"name": "鲜果原料供应商"
}
],
"hasMore": false,
"nextLastId": "501"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[]。
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 供应商表主键 ID,用于分页游标。 |
uid | long | 供应商 UID,新增商品时传入 supplierUid。 |
number | string | 供应商编号。 |
name | string | 供应商名称。 |
商品口味
用于查询商品口味字典,返回新增或修改商品时所需的 tastes[].uid。
查询商品口味
POST/openapi/v3/product/attribute-page分页拉取商品口味字典,主要用于新增商品时传入 tastes[].uid;返回口味名称、口味值及所属口味组信息。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
lastId | long | 否 | 分页游标。首次传 0;后续传上次响应中的 nextLastId。 |
limit | int | 否 | 单次返回条数;默认 100,最大 100。 |
name | string | 否 | 口味名称,按 attributeName 精确匹配过滤。 |
业务说明
- 服务端固定按
id asc顺序分页返回。 - 新增商品时请使用返回的
uid作为tastes[].uid。 - 响应同时返回口味所属口味组信息:
packageUid、packageName、packageType。
请求示例
{
"account": "store001",
"lastId": 0,
"limit": 100,
"name": "椰果"
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "601",
"uid": "1622707645696449590",
"attributeName": "椰果",
"attributeValue": "2",
"isDefault": 0,
"packageUid": "1622707645694362262",
"packageName": "加料",
"packageType": 1
}
],
"hasMore": false,
"nextLastId": "601"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[]。
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 口味表主键 ID,用于分页游标。 |
uid | long | 口味 UID,新增商品时传入 tastes[].uid。 |
attributeName | string | 口味名称。 |
attributeValue | string | 口味值。 |
isDefault | int | 是否默认项。 |
packageUid | long | 所属口味组 UID。 |
packageName | string | 所属口味组名称。 |
packageType | int | 所属口味组类型 1:多选 + 非必选 2:单选 + 非必选 3:多选 + 必选 4:单选 + 必选。 |
商品库存接口
用于库存查询和批量库存写入,适合库存轮询、库存对账、盘点回写、出入库同步等场景。
- 库存写接口单次最多
100条。 - 幂等继续使用请求头
X-Request-Id。 批量设置商品库存写入最终库存值;批量调整商品库存写入库存变动值。
查询商品库存
POST/openapi/v3/product/stock-page按商品主键 id 顺序分页拉取库存,仅返回 barcode、stock,适合客户轮询库存。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号,表示本次查询对应哪家门店。 |
lastId | long | 否 | 翻页游标。首次传 0 或不传;后续传上一次响应中的 nextLastId。 |
业务说明
- 服务端固定按
id asc顺序分页查询。 - 单次最多返回
1000条库存记录。 - 服务端按
1001条查询,多出一条则判定hasMore = true。 - 仅返回库存轮询所需的最小字段,不替代完整商品查询接口。
请求示例
{
"account": "store001",
"lastId": 0
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"barcode": "6901234567890",
"stock": 128.0000
},
{
"barcode": "6901234567891",
"stock": 16.0000
}
],
"hasMore": true,
"nextLastId": "1000"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[]。
| 字段 | 类型 | 说明 |
|---|---|---|
barcode | string | 商品主条码 |
stock | decimal | 当前库存数量 |
批量设置商品库存
POST/openapi/v3/product/stock-batch-set按商品 barcode 批量把库存直接写成目标值,适合把外部系统的最新账面库存一次性回写到门店。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
items | array<object> | 是 | 库存明细,单次最多 100 条。 |
items[].barcode | string | 是 | 商品条码。 |
items[].stock | decimal | 是 | 要设置成的最终库存值。 |
业务说明
- 单次最多处理
100条,超过会直接报参数错误。 - 同一请求内不允许重复传同一个
barcode。 - 幂等继续复用请求头
X-Request-Id;若请求号重复,会在业务执行前被拦截。 - 接口返回逐条处理结果;即使部分明细失败,已成功的明细仍会保留。
请求示例
{
"account": "store001",
"items": [
{
"barcode": "6901234567890",
"stock": 120
},
{
"barcode": "6901234567891",
"stock": 35.5
}
]
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"successCount": 1,
"failCount": 1,
"results": [
{
"barcode": "6901234567890",
"success": true,
"message": "success",
"stock": 120
},
{
"barcode": "NOT-EXIST-001",
"success": false,
"message": "商品不存在,请检查 barcode",
"stock": null
}
]
}
}
返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
successCount | int | 本次成功写入的商品数量。 |
failCount | int | 本次写入失败的商品数量。 |
results[].barcode | string | 商品条码。 |
results[].success | boolean | 当前明细是否成功。 |
results[].message | string | 当前明细处理结果说明。 |
results[].stock | decimal | 处理成功后的最新库存;失败时返回 null。 |
批量调整商品库存
POST/openapi/v3/product/stock-batch-adjust按商品 barcode 批量增减库存,适合做出入库、盘点差异回写等增量场景。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
items | array<object> | 是 | 库存明细,单次最多 100 条。 |
items[].barcode | string | 是 | 商品条码。 |
items[].changeStock | decimal | 是 | 库存变动值;正数表示增加,负数表示扣减。 |
业务说明
- 单次最多处理
100条,超过会直接报参数错误。 - 同一请求内不允许重复传同一个
barcode。 - 幂等继续复用请求头
X-Request-Id;若请求号重复,会在业务执行前被拦截。 - 接口按明细逐条处理,并返回每个商品处理后的最新库存。
请求示例
{
"account": "store001",
"items": [
{
"barcode": "6901234567890",
"changeStock": 10
},
{
"barcode": "6901234567891",
"changeStock": -2.5
}
]
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"successCount": 2,
"failCount": 0,
"results": [
{
"barcode": "6901234567890",
"success": true,
"message": "success",
"stock": 138
},
{
"barcode": "6901234567891",
"success": true,
"message": "success",
"stock": 33
}
]
}
}
返回字段说明
返回结构与“批量设置商品库存”一致。
商品报损接口
用于查询门店已有收银系统产生的商品报损原因和报损记录。报损查询固定返回主单与商品明细,不提供报损写入能力。
- 报损原因按门店查询,不分页。
- 报损记录按报损单主表
id游标分页,固定返回明细。 - 报损状态仅开放
100-已完成、1-待审核、-1-已拒绝。
查询报损原因
POST/openapi/v3/product/discard-reason/list查询当前门店的商品报损原因字典,返回 discardreason 中的原因 UID、名称、启用状态和报损类型。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
uid | long | 否 | 报损原因 UID discardreason.uid,精确查询。 |
enable | int | 否 | 状态,1-启用,-1-已删除;不传返回全部。 |
请求示例
{
"account": "store001",
"uid": 1800000000001,
"enable": 1
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": [
{
"id": 1001,
"uid": 1800000000001,
"detail": "临期报损",
"enable": 1,
"discardType": 1
}
]
}
返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 报损原因表主键。 |
uid | long | 报损原因 UID,对应报损明细中的 reasonUid。 |
detail | string | 报损原因名称。 |
enable | int | 状态,1-启用,-1-已删除。 |
discardType | int | 报损类型:null/0-默认,1-门店报损,2-仓库报损,3-工厂报损,4-后厨报损。 |
查询商品报损
POST/openapi/v3/product/discard-page分页查询当前门店的商品报损记录,固定返回报损主单和报损商品明细。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account | string | 是 | 业务门店账号。 |
lastId | long | 否 | 翻页游标。首次传 0 或不传;后续传上一次响应中的 nextLastId。 |
order | string | 否 | 排序方向,仅支持 asc、desc,默认 asc。 |
limit | int | 否 | 分页大小,默认 100,最大 100。 |
datetimeBegin | string | 否 | 按 createdDateTime 开始时间筛选,格式 yyyy-MM-dd HH:mm:ss。 |
datetimeEnd | string | 否 | 按 createdDateTime 结束时间筛选,左闭右开。 |
updateTimeBegin | string | 否 | 按 updateTime 开始时间筛选,格式 yyyy-MM-dd HH:mm:ss。 |
updateTimeEnd | string | 否 | 按 updateTime 结束时间筛选,左闭右开。 |
status | int | 否 | 报损状态:100-已完成,1-待审核,-1-已拒绝;不传查询全部。 |
请求示例
{
"account": "store001",
"datetimeBegin": "2026-07-01 00:00:00",
"datetimeEnd": "2026-07-08 00:00:00",
"status": 100,
"lastId": 0,
"order": "asc",
"limit": 100
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": 129937,
"userId": 10001,
"cashierUid": 100001,
"createdDateTime": "2026-07-07 10:30:00",
"remarks": "临期报损",
"status": 100,
"updateTime": "2026-07-07 10:35:00",
"items": [
{
"id": 183271,
"productUid": 180000000000100001,
"productUnitUid": 7001,
"quantity": 2,
"buyPrice": 3.5,
"sellPrice": 5.0,
"reasonUid": 1800000000001
}
]
}
],
"hasMore": true,
"nextLastId": "129937"
}
}
返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
list[].id | long | 报损单主键。 |
list[].userId | int | 门店 ID。 |
list[].cashierUid | long | 收银员 / 操作员 UID。 |
list[].createdDateTime | string | 报损单创建时间。 |
list[].remarks | string | 备注。 |
list[].status | int | 报损状态:100-已完成,1-待审核,-1-已拒绝。 |
list[].updateTime | string | 审核更新时间。 |
list[].items[].id | long | 报损明细主键。 |
list[].items[].productUid | long | 报损商品 UID。 |
list[].items[].productUnitUid | long | 报损单位 UID。 |
list[].items[].quantity | decimal | 报损数量。 |
list[].items[].buyPrice | decimal | 报损单位的进货价。 |
list[].items[].sellPrice | decimal | 报损单位的销售价。 |
list[].items[].reasonUid | long | 报损原因 UID。0:未设置。大于0:可通过“查询报损原因”接口映射名称。 |