门店直接完成收银后,会生成一笔标准销售单据,这是最基础、也是最常见的对接场景。
销售单据接口
银豹销售单据会覆盖线下收银、线上订单转收银、退货和反结账等多种场景。先理解下面 4 个核心规则,再对接。
美团、饿了么、抖音、小程序等线上订单在门店完成收银后,同样会生成销售单据;其中 webOrderNo 表示线上订单号(网单号)。
发生退货时,系统会新增一笔退货单据,可以通过 refund=1 快速识别这类数据。
退货:比如买了5瓶水,每瓶2元,支付10元(原单据),觉得买多了,退了3瓶,退回6元(退货单据)。
反结账不会生成新的单据,而是直接把原单据的 reversed 更新为 1,表示该单据已被反结账处理。
反结账:比如买了5瓶水,每瓶2元,支付10元,顾客突然5瓶都不想要了,店员执行反结账,反结账后会把10元原路退给客户。
查询销售单据
POST/openapi/v3/ticket/increment-page用于按主键游标分页查询销售单据,可按需返回明细行、支付记录、明细属性。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account |
string | 是 | 业务门店账号,表示本次查询对应哪家门店。 |
uid | long | 否 | 按销售单据 UID 精确查询。 |
customerUid | long | 否 | 按会员 UID 查询某个会员的销售单据。 |
sn | string | 否 | 按销售单据流水号精确查询。 |
webOrderNo | string | 否 | 按网单号精确查询。 |
reversed | int | 否 | 按是否反结账(作废)查询,0 非反结账单据,1 反结账单据。 |
refund | int | 否 | 按是否退货单据查询,0 非退货单据,1 退货单据。 |
datetimeBegin | string | 否 | 销售时间开始,格式 yyyy-MM-dd HH:mm:ss,包含该时间。 |
datetimeEnd | string | 否 | 销售时间结束,格式 yyyy-MM-dd HH:mm:ss,不包含该时间,必须大于 datetimeBegin。 |
lastId |
long | 否 | 翻页游标。首次传 0 或不传;后续传上一次响应中的 nextLastId。 |
order |
string | 否 | 排序方向,仅支持 asc、desc,默认 asc。 |
limit |
int | 否 | 分页大小,默认 100,最大 100,超过按 100 处理。 |
needCustomerInfo | boolean | 否 | 传 true 时返回会员基础信息。 |
needTicketPayments | boolean | 否 | 传 true 时返回支付记录。 |
needTicketItems | boolean | 否 | 传 true 时返回销售单商品明细。 |
needTicketItemAttributes | boolean | 否 | 传 true 时返回明细属性。 |
needProductMainImage | boolean | 否 | 传 true 时返回销售单商品封面;仅商品有设置封面时返回。 |
needTicketRelations | boolean | 否 | 传 true 时返回退货/原单关系。 |
业务说明
- 传
uid、customerUid、sn、webOrderNo中任一字段时,按精准定位查询计费,基础消耗 100 token。 - 未传以上定位字段时,按普通分页/范围查询计费,基础消耗 500 token。
- 每开启一个扩展返回开关need*,额外消耗 20 token。
- 传
needTicketRelations=true时,退货单据(refund=1)返回originalTicketUid,销售单据返回refundTicketUids。
请求示例
{
"account": "store001",
"uid": 202604010001,
"customerUid": 3002001001,
"sn": "XS202604010001",
"webOrderNo": "WEB202604010001",
"reversed": 0,
"refund": 0,
"datetimeBegin": "2026-04-01 00:00:00",
"datetimeEnd": "2026-04-02 00:00:00",
"lastId": 0,
"order": "asc",
"limit": 100,
"needCustomerInfo": true,
"needTicketItems": true,
"needTicketPayments": true,
"needTicketItemAttributes": false,
"needTicketRelations": true,
"needProductMainImage": true
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "301",
"uid": "202604010001",
"cashierUid": "90001",
"customerUid": "3002001001",
"customerInfo": {
"uid": "3002001001",
"number": "VIP0001",
"name": "张三",
"tel": "13800138000",
"money": "98.50",
"point": "2560"
},
"sn": "XS202604010001",
"datetime": "2026-04-01 11:00:00",
"totalAmount": 58.00,
"totalProfit": 16.30,
"discount": 9.50,
"reversed": 0,
"refund": 0,
"rounding": 0.00,
"webOrderNo": "WEB202604010001",
"ticketItems": [
{
"id": "401",
"name": "可乐500ml",
"buyPrice": 2.20,
"sellPrice": 3.50,
"customerPrice": 3.20,
"quantity": 2,
"discount": 10.00,
"customerDiscount": 9.50,
"isCustomerDiscount": 1,
"datetime": "2026-04-01 11:00:00",
"sellAmount": 7.00,
"totalAmount": 6.65,
"totalProfit": 2.25,
"ticketUid": "202604010001",
"productUid": "1002003001",
"productMainImage": "https://img.pospal.cn/product/1002003001.jpg",
"guiderUid": "80001",
"promotionRuleUid": "70001",
"productAttribute1": "常温",
"productAttribute2": "500ml",
"ticketItemAttributes": [
{
"productAttributeUid": "50001",
"attributeGroup": "规格",
"attributeName": "容量",
"attributeValue": "500ml",
"quantity": 2
}
]
}
],
"ticketPayments": [
{
"payMethod": 1,
"payMethodName": "现金支付",
"amount": 30.00,
},
{
"payMethod": 2,
"payMethodName": "储值卡支付",
"amount": 28.00,
}
]
}
],
"hasMore": false,
"nextLastId": "301"
}
}
返回字段说明
status、errorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[] 及扩展对象。
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 销售单主键 ID,可作为下一页游标来源。 |
uid | string | 销售单业务 UID。 |
cashierUid | string | 收银员 UID。 |
customerUid | string | 会员 UID;散客单据时可能为空。 |
customerInfo | object | 会员基础信息,需传 needCustomerInfo=true。 |
sn | string | 销售单号。 |
datetime | string | 销售时间。 |
totalAmount | decimal | 销售总金额。 |
totalProfit | decimal | 销售总利润。 |
discount | decimal | 整单折扣。 |
payMethod | string | 主支付方式描述。 |
reversed | int | 是否反结账1 是 0 否。 |
refund | int | 是否退货单据1 是 0 否。 |
originalTicketUid | string | 退货单据对应的原销售单据 UID;需传 needTicketRelations=true。 |
refundTicketUids | array<string> | 销售单据对应的退货单据 UID 列表;需传 needTicketRelations=true。 |
rounding | decimal | 抹零金额。 |
webOrderNo | string | 网单号。 |
sysUpdateTime | string | 系统更新时间。 |
ticketItems | array<object> | 销售明细列表,需传 needTicketItems=true;若只开启 needTicketItemAttributes 或 needProductMainImage 也会一并返回。 |
ticketPayments | array<object> | 支付记录列表,需传 needTicketPayments=true。 |
明细对象字段
| 对象 | 字段 | 类型 | 说明 |
|---|---|---|---|
ticketItems[] | id | string | 销售明细主键 ID。 |
ticketItems[] | name | string | 商品名称。 |
ticketItems[] | buyPrice | decimal | 进价。 |
ticketItems[] | sellPrice | decimal | 零售价。 |
ticketItems[] | customerPrice | decimal | 会员价。 |
ticketItems[] | quantity | decimal | 数量。 |
ticketItems[] | discount | decimal | 明细折扣。 |
ticketItems[] | customerDiscount | decimal | 会员折扣。 |
ticketItems[] | isCustomerDiscount | int | 是否应用会员折扣。 |
ticketItems[] | datetime | string | 明细销售时间。 |
ticketItems[] | sellAmount | decimal | 挂牌金额。 |
ticketItems[] | totalAmount | decimal | 实收金额。 |
ticketItems[] | totalProfit | decimal | 明细利润。 |
ticketItems[] | ticketUid | string | 所属销售单 UID。 |
ticketItems[] | productUid | string | 商品 UID。 |
ticketItems[] | productMainImage | string | 商品主图地址,需传 needProductMainImage=true;仅商品存在 isCover=1 的图片时返回。 |
ticketItems[] | guiderUid | string | 导购 UID。 |
ticketItems[] | promotionRuleUid | string | 促销规则 UID。 |
ticketItems[] | productAttribute1 | string | 商品属性 1。 |
ticketItems[] | productAttribute2 | string | 商品属性 2。 |
ticketItems[] | ticketItemAttributes | array<object> | 明细属性列表,需传 needTicketItemAttributes=true。 |
ticketItemAttributes[] | productAttributeUid | string | 商品属性 UID。 |
ticketItemAttributes[] | attributeGroup | string | 属性分组。 |
ticketItemAttributes[] | attributeName | string | 属性名称。 |
ticketItemAttributes[] | attributeValue | string | 属性值。 |
ticketItemAttributes[] | quantity | decimal | 属性对应数量。 |
customerInfo | uid | string | 会员 UID。 |
customerInfo | number | string | 会员卡号。 |
customerInfo | name | string | 会员名称。 |
customerInfo | tel | string | 会员手机号。 |
customerInfo | money | string | 会员储值余额。 |
customerInfo | point | string | 会员积分。 |
ticketPayments[] | payMethod | int | 支付方式编码。 |
ticketPayments[] | payMethodName | string | 支付方式名称。 |
ticketPayments[] | amount | decimal | 支付金额。 |