• 开发者平台
  • >
  • 餐饮文档中心

正餐下单收费

(下行接口)第三方合作方调用此接口,创建点餐订单

请求描述

HTTP请求方式:POST
HTTP请求头类型:Content-Type=application/json
URI:   /open/v1/dinner/order/create

请求参数

1.公共参数

详情可查看【公共说明】中的公共参数模块

2.业务参数

参数名 类型 是否必填 参数描述
shopIdenty Long 客如云门店ID
shopName String 客如云门店名称
tpOrderId String 第三方订单号
status Int 订单状态,订单状态为“已确认”则无需pos同意/拒绝,且会触发打印;否则需要pos进行同意/拒绝操作 1:未处理 2:已确认 默认1
productCategorySize Int 商品种数
totalPrice Int 菜品总额 单位:分
discountAmount Int 优惠总额 无优惠传0,有优惠时为正数 单位:分
userFee Int 顾客实付=销售金额-优惠金额 单位:分
remark String 订单备注,不支持emoji
createTime Long 订单创建时间
peopleCount Int 就餐人数
print Int 是否打印 1:打印 0:不打印 默认1
products List<DinnerDishProduct> 商品信息
tables List<TableInfo > 桌台信息
customers List<DinnerOrderMember> 顾客信息
discountDetails List<DiscountDetail> 优惠明细

DinnerDishProduct

参数名 类型 是否必填 参数描述
tpId String 合作方菜品ID(第三方自定义)
id Long 客如云菜品ID
parentUuid String 套餐的子菜或单菜加料的父级uuid(即开发者自定义的订单中菜品唯一标识),如果是套餐子菜或单菜加料才有此值,单菜此字段不传
uuid String 订单中菜品的唯一标识,开发者自定义。如果菜品有加料或子菜,才需要传入此值,单菜无加料此值不传
type Integer 菜品类型 : 菜品种类 0:单菜 1:套餐 2:加料。不填默认唯0,套餐子菜请填0
name String 菜品名称
unit String 菜品单位
properties List<ProductProperty> 商品信息
price int 菜品价格 单位:分
quantity int 份数
totalFee int 菜品总价==(菜品单价 + 变价) * 菜品数量,单位:分
remark string 菜品备注

ProductProperty

参数名 类型 是否必填 参数描述
name string 菜品属性名称
id long 菜品属性ID, 为空就匹配名字,名字也无法匹配则放到备注
type int 属性类型1:做法 2:标签 3:备注 4:规格
reprice int 变价, 单位:分,正数加价,负数减价,type为做法此字段必填

TableInfo

参数名 类型 是否必填 参数描述
tableId long 桌台id,通过查询桌台信息接口获取
tableName string 桌台名称
remark string 备注

DinnerOrderMember

参数名 类型 是否必填 参数描述
id string 会员customerId
phoneNumber string 会员电话
name string 会员姓名
gender int 会员性别

DiscountDetail

参数名 类型 是否必填 参数描述
discountType int 优惠类型 1:客如云优惠券 2:平台优惠 3:商户优惠 4:会员特价
discountFee int 优惠金额
promotionId long 优惠活动或者优惠券id,如果优惠类型是优惠券必传,通过券模版获取
couponId long 优惠券模板id, 如果优惠类型是优惠券必传
customerId long 会员customerId, 如果优惠类型是优惠券必传,而且必须和customers 中至少一个id一致
description string 优惠描述

业务示例(JSON)

场景一:无加料无子菜的情况

{
     "createTime":1567477463000,
     "customers":[
         {
             "gender":0,
             "id":37950727842270123,
             "name":"张三",
             "phoneNumber":13239373760
         }
     ],
     "discountAmount":0,
     "discountDetails":[
         {
             "couponId":80977362259301376,
             "customerId":1573,
             "description":"我是优惠券描述",
             "discountFee":0,
             "discountType":3
         }
     ],
     "peopleCount":1,
     "print":1,
     "productCategorySize":2,
     "products":[
         {
             "id":40740829341443072,
             "name":"水煮牛肉",
             "price":2500,
             "properties":[
                 {
                     "id":40740829341443072,
                     "name":"水煮牛肉",
                     "reprice":0,
                     "type":1
                 }
             ],
             "quantity":1,
             "remark":"菜品备注",
             "totalFee":2500,
             "tpId":"40740829341443072",
             "unit":"份"
         },
          {
             "id":248921597135188992,
             "name":"大波浪薯片2",
             "price":2500,
             "quantity":1,
             "remark":"菜品备注哈哈",
             "totalFee":2500,
             "tpId":"23245",
             "unit":"份"
         }
     ],
     "remark":"备注信息",
     "shopIdenty":810094162,
     "shopName":"体验区测试品牌01体验区测试品牌01store品牌1门店3",
     "status":2,
     "tables":[
         {
             "remark":"我是桌台备注",
             "tableId":114430334904879104,
             "tableName":"桌台009"
         }
     ],
     "totalPrice":5000,
     "tpOrderId":"40712345678123456342315ui67890",
     "userFee":5000
 }

场景二:有加料的情况(如:点两份相同的奶茶,加料不同,那么两份奶茶的uuid需定义成不相同的,加料的商品中parentUuid分别填写需要加的奶茶的uuid)

{
     "createTime":1567477463000,
     "customers":[
         {
             "gender":0,
             "id":37950727842270123,
             "name":"张三",
             "phoneNumber":13239373760
         }
     ],
     "discountAmount":0,
     "discountDetails":[
         {
             "couponId":80977362259301376,
             "customerId":1573,
             "description":"我是优惠券描述",
             "discountFee":0,
             "discountType":3
         }
     ],
     "peopleCount":1,
     "print":1,
     "productCategorySize":2,
     "products":[
          {
             "name": "满满鲜奶茶",
                "id": 218063455586880512,
            "tpId":"24242",
            "uuid":12345,
            "quantity":1,
            "price":200,
            "type":0,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":200,
            "properties":[
                {
                    "name":"五分甜",
                    "type":1,
                    "reprice":0
                }, {
                    "name":"常温 ",
                    "type":1,
                    "reprice":0
                }
            ]
        },
        {
            "name": "满满鲜奶茶",
            "id": 218063455586880512,
            "tpId":"24242",
            "uuid":123456,
            "quantity":1,
            "price":200,
            "type":0,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":200,
            "properties":[
                {
                    "name":"五分甜",
                    "type":1,
                    "reprice":0
                }, {
                    "name":"常温",
                    "type":1,
                    "reprice":0
                }
            ]
        },
        { "name": "加料1",
            "id": "",
            "tpId":"24242",
            "parentUuid":123456,
            "quantity":1,
            "price":0,
            "type":2,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":0},
            { "name": "配料1",
            "id": "",
            "tpId":"24242",
            "parentUuid":12345,
            "quantity":1,
            "price":0,
            "type":2,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":0}
     ],
     "remark":"备注信息",
     "shopIdenty":810094162,
     "shopName":"体验区测试品牌01体验区测试品牌01store品牌1门店3",
     "status":2,
     "tables":[
         {
             "remark":"我是桌台备注",
             "tableId":114430334904879104,
             "tableName":"桌台009"
         }
     ],
     "totalPrice":400,
     "tpOrderId":"40712345678123456342315ui67890",
     "userFee":400
 }

场景三:套餐有子菜的情况

{
     "createTime":1567477463000,
     "customers":[
         {
             "gender":0,
             "id":37950727842270123,
             "name":"张三",
             "phoneNumber":13239373760
         }
     ],
     "discountAmount":0,
     "discountDetails":[
         {
             "couponId":80977362259301376,
             "customerId":1573,
             "description":"我是优惠券描述",
             "discountFee":0,
             "discountType":3
         }
     ],
     "peopleCount":1,
     "print":1,
     "productCategorySize":2,
     "products":[
          {
             "name": "满满鲜奶茶",
                "id": 218063455586880512,
            "tpId":"24242",
            "uuid":12345,
            "quantity":1,
            "price":200,
            "type":1,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":200,
            "properties":[
                {
                    "name":"五分甜",
                    "type":1,
                    "reprice":0
                }, {
                    "name":"常温 ",
                    "type":1,
                    "reprice":0
                }
            ]
        },
        {
            "name": "满满鲜奶茶",
            "id": 218063455586880512,
            "tpId":"24242",
            "uuid":123456,
            "quantity":1,
            "price":200,
            "type":1,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":200,
            "properties":[
                {
                    "name":"五分甜",
                    "type":1,
                    "reprice":0
                }, {
                    "name":"常温",
                    "type":1,
                    "reprice":0
                }
            ]
        },
        { "name": "加料1",
            "id": "",
            "tpId":"24242",
            "parentUuid":123456,
            "quantity":1,
            "price":0,
            "type":0,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":0},
            { "name": "配料1",
            "id": "",
            "tpId":"24242",
            "parentUuid":12345,
            "quantity":1,
            "price":0,
            "type":0,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":0}
     ],
     "remark":"备注信息",
     "shopIdenty":810094162,
     "shopName":"体验区测试品牌01体验区测试品牌01store品牌1门店3",
     "status":2,
     "tables":[
         {
             "remark":"我是桌台备注",
             "tableId":114430334904879104,
             "tableName":"桌台009"
         }
     ],
     "totalPrice":400,
     "tpOrderId":"40712345678123456342315ui67890",
     "userFee":400
 }

响应参数

参数名 类型 是否必填 参数描述
code int 错误码;0:成功;其他详见错误码
message string 错误说明
messageUuid string 消息uuid
result object 返回业务参数 code !=0的情况下不返回业务参数

result

参数名 类型 是否必填 参数描述
orderId string 开放平台订单id
tradeId String 订单ID
serialNumber String 序号

响应示例(JSON)

{
    "result": {
        "orderId": "c57d5f80e847490baa70c9f9db0860c1",
        "tradeId": 268700047959992320,
        "serialNumber": "30"
    },
    "code": 0,
    "message": "成功[OK]",
    "messageUuid": "9cf9adc0ed2746b9865fb3edf31ba423",
    "apiMessage": null
}
目录