{
  "openapi": "3.0.3",
  "info": {
    "title": "国信订餐 store 接口增量",
    "version": "2026-06-12",
    "description": "仅包含 store 设备核销和 PC 订单管理订餐筛选/导出接口。"
  },
  "servers": [
    {
      "url": "/",
      "description": "按部署环境域名补齐"
    }
  ],
  "components": {
    "parameters": {
      "H5AccessToken": {
        "name": "Access-Token",
        "in": "header",
        "required": true,
        "description": "ai_api H5 登录 token",
        "schema": {
          "type": "string"
        }
      },
      "H5Platform": {
        "name": "platform",
        "in": "header",
        "required": true,
        "description": "H5 固定传 H5",
        "schema": {
          "type": "string",
          "default": "H5"
        }
      },
      "DeviceAccount": {
        "name": "account",
        "in": "header",
        "required": true,
        "description": "store api_auth 设备接口账号",
        "schema": {
          "type": "string"
        }
      },
      "DevicePwd": {
        "name": "pwd",
        "in": "header",
        "required": true,
        "description": "store api_auth 设备接口密码",
        "schema": {
          "type": "string"
        }
      },
      "DeviceKey": {
        "name": "key",
        "in": "header",
        "required": true,
        "description": "store api_auth 设备接口 key",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "AiApiResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 200
          },
          "message": {
            "type": "string",
            "example": "success"
          },
          "data": {
            "type": "object"
          }
        }
      },
      "StoreApiResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "example": 0
          },
          "message": {
            "type": "string",
            "example": "查询成功"
          },
          "data": {
            "type": "object"
          }
        }
      },
      "BookingConfigResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AiApiResponse"
          }
        ]
      },
      "BookingSubmitRequest": {
        "type": "object",
        "required": [
          "booking_type",
          "dates",
          "meal_times"
        ],
        "properties": {
          "restaurant_id": {
            "type": "integer",
            "description": "档口ID",
            "example": 12
          },
          "booking_type": {
            "type": "string",
            "description": "self=本人订餐，family=亲友餐，official=招待餐",
            "enum": [
              "self",
              "family",
              "official"
            ],
            "example": "self"
          },
          "dates": {
            "type": "array",
            "description": "订餐日期，按档口 book_rules 可订日期校验",
            "items": {
              "type": "string",
              "format": "date"
            },
            "example": [
              "2026-06-13"
            ]
          },
          "meal_times": {
            "type": "array",
            "description": "餐次：1=早餐，2=午餐，3=晚餐，4=夜宵",
            "items": {
              "type": "integer",
              "enum": [
                1,
                2,
                3,
                4
              ]
            },
            "example": [
              2
            ]
          },
          "participant": {
            "type": "object",
            "description": "亲友餐/招待餐扩展信息",
            "properties": {
              "name": {
                "type": "string",
                "description": "亲友姓名或接待对象"
              },
              "phone": {
                "type": "string",
                "description": "联系电话"
              },
              "relation": {
                "type": "string",
                "description": "亲友关系"
              },
              "peopleCount": {
                "type": "integer",
                "description": "人数；本人订餐固定 1，亲友餐按人数生成多条订单，招待餐一条订单记录总人数",
                "example": 1
              },
              "remark": {
                "type": "string",
                "description": "备注"
              }
            }
          }
        }
      },
      "BookingRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 10001
          },
          "orderNo": {
            "type": "string",
            "example": "202606130001"
          },
          "type": {
            "type": "string",
            "example": "本人订餐"
          },
          "status": {
            "type": "string",
            "example": "待核销"
          },
          "date": {
            "type": "string",
            "example": "2026-06-13"
          },
          "meal": {
            "type": "string",
            "example": "午餐"
          },
          "canteen": {
            "type": "string",
            "example": "一层档口"
          },
          "amount": {
            "type": "string",
            "example": "15.00"
          },
          "verificationCode": {
            "type": "string",
            "description": "亲友餐/招待餐二维码 token；本人订餐为空",
            "example": "cb4f6a6c0b8a4e1b8d9a2c5f1a0b2c3d"
          },
          "canCancel": {
            "type": "boolean",
            "example": true
          },
          "cancelDeadline": {
            "type": "string",
            "example": "2026-06-13 10:30:00"
          }
        }
      },
      "BookingSubmitResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AiApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "batch_no": {
                    "type": "string",
                    "example": "BK202606131200000001"
                  },
                  "records": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/BookingRecord"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "BookingListResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AiApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "list": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/BookingRecord"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "BookingDetailResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AiApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "detail": {
                    "$ref": "#/components/schemas/BookingRecord"
                  }
                }
              }
            }
          }
        ]
      },
      "BookingCancelResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AiApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "integer",
                    "example": 10001
                  },
                  "status": {
                    "type": "string",
                    "example": "已取消"
                  }
                }
              }
            }
          }
        ]
      },
      "BookingVerifyRequest": {
        "type": "object",
        "required": [
          "equipment_code"
        ],
        "properties": {
          "staff_uuid": {
            "type": "string",
            "description": "本人订餐人脸核销用；与 qr_token/verification_code 二选一",
            "example": "staff-uuid"
          },
          "qr_token": {
            "type": "string",
            "description": "亲友餐/招待餐二维码 token；与 staff_uuid 二选一",
            "example": "cb4f6a6c0b8a4e1b8d9a2c5f1a0b2c3d"
          },
          "verification_code": {
            "type": "string",
            "description": "qr_token 别名，兼容 H5 展示字段",
            "example": "cb4f6a6c0b8a4e1b8d9a2c5f1a0b2c3d"
          },
          "equipment_code": {
            "type": "string",
            "description": "核销设备编号",
            "example": "EQ001"
          },
          "meal_date": {
            "type": "string",
            "format": "date",
            "description": "就餐日期；不传默认当天",
            "example": "2026-06-13"
          },
          "meal_times": {
            "type": "integer",
            "description": "餐次：1=早餐，2=午餐，3=晚餐，4=夜宵；不传则不按餐次过滤",
            "example": 2
          },
          "msgid": {
            "type": "string",
            "description": "设备请求流水号",
            "example": "EQ001-20260613120000001"
          }
        }
      },
      "PcMealOrderListRequest": {
        "type": "object",
        "properties": {
          "start_date": {
            "type": "string",
            "format": "date",
            "example": "2026-06-01"
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "example": "2026-06-30"
          },
          "source": {
            "type": "integer",
            "description": "订单类型：1=堂食，4=线上订餐/外卖，5=外部订餐，6=闸机，7=点餐机",
            "example": 4
          },
          "is_booking": {
            "type": "integer",
            "description": "是否订餐：0=非订餐，1=订餐；本次新增",
            "enum": [
              0,
              1
            ],
            "example": 1
          },
          "booking_type": {
            "type": "integer",
            "description": "订餐类型：1=本人订餐，2=亲友餐，3=招待餐；本次新增",
            "enum": [
              1,
              2,
              3
            ],
            "example": 1
          },
          "order_unified_status": {
            "type": "integer",
            "description": "订单统一状态：10=待付款，20=已取消，30=已付款，40=已退款，50=退款中，60=部分退款",
            "example": 30
          },
          "pay_type": {
            "type": "integer",
            "description": "支付方式：10=线上，20=刷卡，30=消费码，40=刷脸",
            "example": 10
          },
          "meal_times": {
            "type": "string",
            "description": "餐次，多个逗号分隔",
            "example": "2,3"
          },
          "department_uuids": {
            "type": "string",
            "description": "部门UUID，多个逗号分隔",
            "example": "dept-uuid"
          },
          "restaurantIds": {
            "type": "string",
            "description": "档口ID，多个逗号分隔",
            "example": "12,13"
          },
          "equipment_codes": {
            "type": "string",
            "description": "设备编号，多个逗号分隔",
            "example": "EQ001,EQ002"
          },
          "marketing_strategy_id": {
            "type": "integer",
            "description": "消费策略ID",
            "example": 100
          },
          "mobile": {
            "type": "string",
            "description": "手机号搜索",
            "example": "13800000000"
          },
          "nickname": {
            "type": "string",
            "description": "姓名搜索",
            "example": "张三"
          },
          "card_id": {
            "type": "string",
            "description": "卡号搜索"
          },
          "order_no": {
            "type": "string",
            "description": "订单号搜索"
          },
          "page": {
            "type": "integer",
            "example": 1
          }
        }
      },
      "PcMealOrderListResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/StoreApiResponse"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "example": 10001
                        },
                        "order_no": {
                          "type": "string",
                          "example": "202606130001"
                        },
                        "is_booking": {
                          "type": "integer",
                          "example": 1
                        },
                        "is_booking_text": {
                          "type": "string",
                          "example": "订餐"
                        },
                        "booking_type": {
                          "type": "integer",
                          "example": 1
                        },
                        "booking_type_text": {
                          "type": "string",
                          "example": "本人订餐"
                        },
                        "booking_verify_status": {
                          "type": "integer",
                          "example": 10
                        },
                        "booking_verify_status_text": {
                          "type": "string",
                          "example": "待核销"
                        },
                        "expense_owner_name": {
                          "type": "string",
                          "example": "测试部门账户"
                        }
                      }
                    }
                  },
                  "total": {
                    "type": "integer",
                    "example": 1
                  },
                  "total_price": {
                    "type": "string",
                    "example": "15.00"
                  },
                  "pay_amount": {
                    "type": "string",
                    "example": "15.00"
                  }
                }
              }
            }
          }
        ]
      }
    }
  },
  "paths": {
    "/api/consume/bookingVerify": {
      "post": {
        "tags": [
          "国信订餐/设备核销"
        ],
        "x-apifox-folder": "国信订餐/设备核销",
        "summary": "设备订餐核销",
        "description": "store 设备接口。本人订餐使用 staff_uuid 人脸核销；亲友餐/招待餐使用 qr_token 或 verification_code 二维码核销。核销成功后订单变为已完成，booking_verify_status=20。",
        "operationId": "consumeBookingVerify",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeviceAccount"
          },
          {
            "$ref": "#/components/parameters/DevicePwd"
          },
          {
            "$ref": "#/components/parameters/DeviceKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/BookingVerifyRequest"
              },
              "examples": {
                "face": {
                  "summary": "本人订餐人脸核销",
                  "value": {
                    "staff_uuid": "staff-uuid",
                    "equipment_code": "EQ001",
                    "meal_date": "2026-06-13",
                    "meal_times": 2,
                    "msgid": "EQ001-20260613120000001"
                  }
                },
                "qr": {
                  "summary": "亲友/招待二维码核销",
                  "value": {
                    "qr_token": "cb4f6a6c0b8a4e1b8d9a2c5f1a0b2c3d",
                    "equipment_code": "EQ001",
                    "meal_date": "2026-06-13",
                    "meal_times": 2,
                    "msgid": "EQ001-20260613120000002"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "核销结果",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoreApiResponse"
                },
                "example": {
                  "code": 0,
                  "message": "核销成功",
                  "data": {
                    "order_id": 10001,
                    "order_no": "202606130001",
                    "booking_type": 1,
                    "meal_date": "2026-06-13",
                    "meal_times": 2,
                    "pay_price": "15.00",
                    "verify_status": 20
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/mealOrder/list": {
      "post": {
        "tags": [
          "国信订餐/PC订单管理"
        ],
        "x-apifox-folder": "国信订餐/PC订单管理",
        "summary": "PC消费订单列表（新增订餐筛选/字段）",
        "description": "既有 store PC 接口，本次新增 is_booking、booking_type 筛选，并在返回列表中增加订餐展示字段。",
        "operationId": "pcMealOrderList",
        "requestBody": {
          "required": false,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PcMealOrderListRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PcMealOrderListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/p/mealOrder/export": {
      "post": {
        "tags": [
          "国信订餐/PC订单管理"
        ],
        "x-apifox-folder": "国信订餐/PC订单管理",
        "summary": "PC消费订单导出（新增订餐筛选/字段）",
        "description": "既有 store PC 导出接口，本次新增 is_booking、booking_type 筛选；导出文件增加是否订餐、订餐类型、核销状态、费用归属列。",
        "operationId": "pcMealOrderExport",
        "requestBody": {
          "required": false,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PcMealOrderListRequest"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "integer",
                        "description": "导出类型；消费订单为 1",
                        "example": 1
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "导出任务提交结果",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoreApiResponse"
                },
                "example": {
                  "code": 0,
                  "message": "提交成功，请在导出日志查看进度",
                  "data": []
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "国信订餐/设备核销"
    },
    {
      "name": "国信订餐/PC订单管理"
    }
  ]
}