OPENAPI V3
登录控制台
首次登录赠送 10000 Token,可直接调试接口
充值、回调配置、调用日志、接口调试均在控制台完成

销售单据接口文档

本页专门展示销售单据接口,便于单独交付与维护;通用规则仍复用总览页内容。Long 型标识字段、分页游标等通用约定,请先参考总览页《对接说明》。

销售单据接口

银豹销售单据会覆盖线下收银、线上订单转收银、退货和反结账等多种场景。先理解下面 4 个核心规则,再对接。

01 线下收银

门店直接完成收银后,会生成一笔标准销售单据,这是最基础、也是最常见的对接场景。

03 退货单据

发生退货时,系统会新增一笔退货单据,可以通过 refund=1 快速识别这类数据。

退货:比如买了5瓶水,每瓶2元,支付10元(原单据),觉得买多了,退了3瓶,退回6元(退货单据)。

04 反结账(作废)

反结账不会生成新的单据,而是直接把原单据的 reversed 更新为 1,表示该单据已被反结账处理。

反结账:比如买了5瓶水,每瓶2元,支付10元,顾客突然5瓶都不想要了,店员执行反结账,反结账后会把10元原路退给客户。

查询销售单据

POST
/openapi/v3/ticket/increment-page

用于按主键游标分页查询销售单据,可按需返回明细行、支付记录、明细属性。

请求参数

参数 类型 必填 说明
account string 业务门店账号,表示本次查询对应哪家门店。
uidlong按销售单据 UID 精确查询。
customerUidlong按会员 UID 查询某个会员的销售单据。
snstring按销售单据流水号精确查询。
webOrderNostring按网单号精确查询。
reversedint按是否反结账(作废)查询,0 非反结账单据,1 反结账单据。
refundint按是否退货单据查询,0 非退货单据,1 退货单据。
datetimeBeginstring销售时间开始,格式 yyyy-MM-dd HH:mm:ss,包含该时间。
datetimeEndstring销售时间结束,格式 yyyy-MM-dd HH:mm:ss,不包含该时间,必须大于 datetimeBegin
lastId long 翻页游标。首次传 0 或不传;后续传上一次响应中的 nextLastId
order string 排序方向,仅支持 ascdesc,默认 asc
limit int 分页大小,默认 100,最大 100,超过按 100 处理。
needCustomerInfobooleantrue 时返回会员基础信息。
needTicketPaymentsbooleantrue 时返回支付记录。
needTicketItemsbooleantrue 时返回销售单商品明细。
needTicketItemAttributesbooleantrue 时返回明细属性。
needProductMainImagebooleantrue 时返回销售单商品封面;仅商品有设置封面时返回。
needTicketRelationsbooleantrue 时返回退货/原单关系。

业务说明

  • uidcustomerUidsnwebOrderNo 中任一字段时,按精准定位查询计费,基础消耗 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"
  }
}

返回字段说明

statuserrorCode 及分页公共字段请参考“公共响应格式”,此处仅补充 result.list[] 及扩展对象。

字段 类型 说明
idstring销售单主键 ID,可作为下一页游标来源。
uidstring销售单业务 UID。
cashierUidstring收银员 UID。
customerUidstring会员 UID;散客单据时可能为空。
customerInfoobject会员基础信息,需传 needCustomerInfo=true
snstring销售单号。
datetimestring销售时间。
totalAmountdecimal销售总金额。
totalProfitdecimal销售总利润。
discountdecimal整单折扣。
payMethodstring主支付方式描述。
reversedint是否反结账10 否。
refundint是否退货单据10 否。
originalTicketUidstring退货单据对应的原销售单据 UID;需传 needTicketRelations=true
refundTicketUidsarray<string>销售单据对应的退货单据 UID 列表;需传 needTicketRelations=true
roundingdecimal抹零金额。
webOrderNostring网单号。
sysUpdateTimestring系统更新时间。
ticketItemsarray<object>销售明细列表,需传 needTicketItems=true;若只开启 needTicketItemAttributesneedProductMainImage 也会一并返回。
ticketPaymentsarray<object>支付记录列表,需传 needTicketPayments=true

明细对象字段

对象 字段 类型 说明
ticketItems[]idstring销售明细主键 ID。
ticketItems[]namestring商品名称。
ticketItems[]buyPricedecimal进价。
ticketItems[]sellPricedecimal零售价。
ticketItems[]customerPricedecimal会员价。
ticketItems[]quantitydecimal数量。
ticketItems[]discountdecimal明细折扣。
ticketItems[]customerDiscountdecimal会员折扣。
ticketItems[]isCustomerDiscountint是否应用会员折扣。
ticketItems[]datetimestring明细销售时间。
ticketItems[]sellAmountdecimal挂牌金额。
ticketItems[]totalAmountdecimal实收金额。
ticketItems[]totalProfitdecimal明细利润。
ticketItems[]ticketUidstring所属销售单 UID。
ticketItems[]productUidstring商品 UID。
ticketItems[]productMainImagestring商品主图地址,需传 needProductMainImage=true;仅商品存在 isCover=1 的图片时返回。
ticketItems[]guiderUidstring导购 UID。
ticketItems[]promotionRuleUidstring促销规则 UID。
ticketItems[]productAttribute1string商品属性 1。
ticketItems[]productAttribute2string商品属性 2。
ticketItems[]ticketItemAttributesarray<object>明细属性列表,需传 needTicketItemAttributes=true
ticketItemAttributes[]productAttributeUidstring商品属性 UID。
ticketItemAttributes[]attributeGroupstring属性分组。
ticketItemAttributes[]attributeNamestring属性名称。
ticketItemAttributes[]attributeValuestring属性值。
ticketItemAttributes[]quantitydecimal属性对应数量。
customerInfouidstring会员 UID。
customerInfonumberstring会员卡号。
customerInfonamestring会员名称。
customerInfotelstring会员手机号。
customerInfomoneystring会员储值余额。
customerInfopointstring会员积分。
ticketPayments[]payMethodint支付方式编码。
ticketPayments[]payMethodNamestring支付方式名称。
ticketPayments[]amountdecimal支付金额。