Skip to content

邮轮

概述

途牛邮轮服务提供邮轮产品搜索、团期查询和在线预订功能,支持集成到 AI 助手、智能客服等应用中。

核心特性:

  • 🚀 无状态设计,无需维护会话
  • 🔐 基于 API Key 认证
  • 💾 智能缓存,提升响应速度
  • 📦 完整的预订流程(搜索→详情→团期选择→下单)
  • 🗓️ 团期价格日历,支持多出发日期选择
  • 🌊 兼容"游轮"说法,用户可使用"邮轮"或"游轮"进行查询
  • 📖 支持用户单独查看所选产品的邮轮船只与配套信息,以及按天行程详情;两项能力均可在列表或产品详情之后按需调用,不阻塞主预订流程

一、Tools 列表

1.1 searchCruiseList(邮轮列表搜索)

功能:根据出游日期范围搜索邮轮产品,支持按航线、品牌、天数等条件筛选,支持分页查询。

请求说明

参数表:

参数类型必需说明
departsDateBeginstring出游日期范围起始,格式 YYYY-MM-DD,不能早于当前日期
departsDateEndstring出游日期范围结束,格式 YYYY-MM-DD,不能早于 departsDateBegin
cruiseLineNamestring邮轮航线名称,如"长江三峡"
cruiseBrandstring邮轮品牌名称,如"皇家加勒比"
tourDaynumber行程天数
pageNumnumber页码(从 1 开始,默认 1)

重要说明

  • departsDateBegindepartsDateEnd 是查询条件的日期范围,表示"在此期间有出发班次的产品"
  • 返回结果中的 departsDateBegindepartsDateEnd 仅用于后续调用 getCruiseProductDetail,属于内部透传字段,不要向用户展示或解读
  • 用户说"游轮"时等同于"邮轮",系统会自动兼容

响应说明

参数类型说明
successboolean是否成功
errorCodenumber错误码
msgstring错误信息
dataobject查询结果数据

data 对象结构

参数类型说明
countnumber符合条件的产品总数
rowsarray当前页产品列表

data.rows 数组元素(关键字段)

参数类型说明
productIdstring产品 ID(⭐ 调用详情接口必需)
productNamestring产品名称
departsDateBeginstring详情接口透传字段(⭐ 调用详情接口必需,内部字段,不向用户展示)
departsDateEndstring详情接口透传字段(⭐ 调用详情接口必需,内部字段,不向用户展示)
departCityCodearray出发城市代码数组(⭐ 调用详情接口必需,必须原样传递)
departCityNamearray出发城市名称数组
classBrandIdnumber品牌 ID(⭐ 调用详情接口时作为 classBrandParentId 传入,整型)
proModenumber采购方式(⭐ 调用详情接口必需,整型)
pricenumber起价(人民币元)
cruiseLineNamestring邮轮航线名称
cruiseBrandstring邮轮品牌名称
ticketTypeNamestring船票类型
departurePortNamestring出发港口名称
tourDaynumber行程天数
satisfactionnumber满意度(百分比)
peopleNumnumber出游人数
picUrlstring产品缩略图
isDirectSalestring是否船司直营
customConditionNamearray产品标签

⚠️ 重要提示

  • departsDateBegindepartsDateEnddepartCityCodeclassBrandIdproMode 这 5 个字段是调用 getCruiseProductDetail 时的必需参数
  • departCityCode 是数组格式(如 [1602][1602, 1603]),必须原样传递,不得修改、不得提取单个元素
  • 不要在面向用户的列表展示中输出或解释 departsDateBegindepartsDateEnd
  • 展示完本页产品列表或用户已关注某产品时,可提醒用户:如需进一步了解该邮轮船只本身信息,可调用 getCruiseBaseInfo;如需查看按天展开的完整行程说明,可调用 getJourneyDetail(均需 productId,见下文 1.3、1.4 节)

入参示例

查询未来 3 天的邮轮产品:

json
{
  "departsDateBegin": "2026-03-17",
  "departsDateEnd": "2026-03-20"
}

按航线和品牌筛选:

json
{
  "departsDateBegin": "2026-03-17",
  "departsDateEnd": "2026-03-30",
  "cruiseLineName": "长江三峡",
  "cruiseBrand": "世纪邮轮"
}

分页查询(第 2 页):

json
{
  "departsDateBegin": "2026-03-17",
  "departsDateEnd": "2026-03-20",
  "pageNum": 2
}

响应示例

json
{
  "success": true,
  "errorCode": 0,
  "msg": "查询成功",
  "data": {
    "count": 22,
    "rows": [
      {
        "productId": "321648365",
        "productName": "[春节]<海洋光谱号上海-济州-上海4晚5天>上海登船2026,免签韩国",
        "departsDateBegin": "2026-02-10",
        "departsDateEnd": "2026-02-14",
        "departCityCode": [1602],
        "departCityName": ["上海"],
        "classBrandId": 12,
        "proMode": 1,
        "price": 3299,
        "cruiseLineName": "日韩航线",
        "cruiseBrand": "皇家加勒比",
        "ticketTypeName": "单船票",
        "departurePortName": "上海吴淞口国际邮轮港",
        "tourDay": 5,
        "satisfaction": 97,
        "peopleNum": 1286,
        "picUrl": "https://img1.tuniucdn.com/image/cruise/321648365.jpg",
        "isDirectSale": "航司直营",
        "customConditionName": ["亲子游", "美食"]
      }
    ]
  }
}

1.2 getCruiseProductDetail(产品详情和可用团期查询)

功能:查询指定邮轮产品的详细信息及可用团期(团期价格日历),返回下单所需的关键字段。

请求说明

前置条件:必须先调用 searchCruiseList 获取产品信息。

参数来源:所有参数必须从 searchCruiseList 返回的 data.rows[] 中获取,不可自行构造。

参数类型必需说明来源字段
productIdstring产品 IDdata.rows[].productId
departsDateBeginstring产品日期范围起始,格式 YYYY-MM-DDdata.rows[].departsDateBegin
departsDateEndstring产品日期范围结束,格式 YYYY-MM-DDdata.rows[].departsDateEnd
departCityCodearray出发城市代码数组,⚠️ 必须原样传递data.rows[].departCityCode
classBrandParentIdnumber品牌父级 ID(整型)data.rows[].classBrandId
proModenumber采购方式(整型)data.rows[].proMode

⚠️ 重要提示

  • departCityCode 必须传递数组格式(如 [1602]),不得提取单个元素,函数内部会自动取第一个元素使用
  • 所有参数必须与列表查询返回的数据完全一致
  • departsDateBegindepartsDateEnd 必须按列表结果原样传递并保持成对一致,不可替换为用户口述日期

响应说明

参数类型说明
successboolean是否成功
errorCodenumber错误码
msgstring错误信息
dataobject产品详情数据
traceIdstring链路追踪 ID

data 对象关键字段

参数类型说明
productIdstring产品 ID(⭐ 下单必需)
productNamestring产品名称
departureCityNamestring出发城市名称(⭐ 下单必需)
durationnumber行程天数(⭐ 下单必需)
productNightnumber晚数(⭐ 下单时作为 night 参数)
journeySummaryarray每日行程概览(含 day/title/moduleList
bookNoticestring预订须知全文(取消条款、签证须知、报名须知等)
productPriceCalendarobject团期价格日历(⭐ 用户选择出发日期)

productPriceCalendar 对象结构

参数类型说明
countnumber可选团期总数
rowsarray团期列表

productPriceCalendar.rows 数组元素

参数类型说明
departDatestring出发日期(⭐ 用户选择后用于调用 getCruiseCabinAndRoom,非下单字段)
tuniuPricenumber成人起价(人民币元)
tuniuChildPricenumber儿童起价(人民币元,为 0 时不支持儿童价)
bookCityCodenumber预订城市代码
departCityCodenumber出发城市代码
backCityCodenumber返回城市代码

journeySummary 数组元素

参数类型说明
daynumber第几天
titlestring当天标题(如港口/城市)
moduleListarray当天行程模块列表,需按 moduleType 解析展示

moduleList 解析规则(对客展示)

  • activity:优先展示 description(通常为 HTML,需转纯文本);可合并抵离港时间、活动说明
  • hotel:展示 hotelList[].title 等住宿信息
  • food:解析 food.hasList(早餐/午餐/晚餐/夜宵/下午茶,可能仅返回其中部分餐型),按统一规则生成对客文案,也可在此规则上优化对客展示文案:has=成人是否含餐,hasChild=儿童是否含餐(为空按 0);1/1=成人、儿童已含,0/0=成人、儿童自理,1/0=成人已含,儿童自理,0/1=成人自理,儿童已含
  • scenic:展示 scenicList[].contenttype(如是否含门票)及图片链接(如有)
  • reminder:展示 remind.typeremind.content(HTML 转纯文本)
  • shopping / flight:按返回结构展示购物/航班关键信息;缺失字段可说明“未提供详细信息”
  • 未知 moduleType:保留原字段兜底展示,不丢失行程内容

⚠️ 团期选择说明

  • productPriceCalendar.rows 包含所有可选的出发日期及对应价格
  • 需先向用户说明 count(可选团期总数);若 rows 为空或 count=0,应明确当前无可售团期,无法继续查询舱位/下单
  • 用户必须从中选择一个具体的 departDate(如 "2026-05-01")用于下单
  • 只要 tuniuPricetuniuChildPrice 有值且大于 0,对外说明必须使用“起价”口径(如“成人起价”“儿童起价”),避免被误解为最终成交价
  • tuniuPrice>0 && tuniuChildPrice=0 时,仅展示成人起价,不展示儿童价
  • tuniuPrice=0 && tuniuChildPrice=0 时,视为无效团期,不应展示或推荐
  • tuniuPrice=0 && tuniuChildPrice>0 时,可将儿童起价作为参考展示,并提示以实际下单结果为准
  • 用户确认后应直接带该日期调用 getCruiseCabinAndRoom
  • 下单前必须明确用户已选择了具体的团期
  • 实际提交 saveCruiseOrder 时,departureDategetCruiseCabinAndRoom.data.base.beginDate(通常与所选 departDate 同一天)
  • 仅可使用 productPriceCalendar.rows 中存在的 departDate

入参示例

从列表查询结果中获取参数:

json
{
  "productId": "321648365",
  "departsDateBegin": "2026-02-10",
  "departsDateEnd": "2026-02-14",
  "departCityCode": [1602],
  "classBrandParentId": 12,
  "proMode": 1
}

响应示例

json
{
  "success": true,
  "errorCode": 0,
  "msg": "查询成功",
  "data": {
    "productId": "321648365",
    "productName": "[春节]<海洋光谱号上海-济州-上海4晚5天>上海登船2026,免签韩国",
    "departureCityName": "上海",
    "duration": 5,
    "productNight": 4,
    "journeySummary": [
      {
        "day": 1,
        "title": "上海",
        "moduleList": [
          {
            "moduleType": "activity",
            "description": "<p>于指定时间抵达码头办理登船手续,开启邮轮之旅。</p>"
          },
          {
            "moduleType": "hotel",
            "hotelList": [
              {
                "title": "邮轮上"
              }
            ]
          }
        ]
      },
      {
        "day": 2,
        "title": "海上巡游",
        "moduleList": [
          {
            "moduleType": "activity",
            "description": "<p>全天海上巡游,享用船上餐饮及娱乐设施。</p>"
          }
        ]
      }
    ],
    "bookNotice": "【取消条款】启航前45天(含)以上取消行程,按全款20%收取损失;启航前44天(含)到21天(含)取消行程,按全款50%收取损失;启航前20天内取消行程,按全款100%收取损失。",
    "productPriceCalendar": {
      "count": 8,
      "rows": [
        {
          "departDate": "2026-05-01",
          "tuniuPrice": 3299,
          "tuniuChildPrice": 2999,
          "bookCityCode": 1602,
          "departCityCode": 1602,
          "backCityCode": 1602
        },
        {
          "departDate": "2026-05-08",
          "tuniuPrice": 3499,
          "tuniuChildPrice": 3199,
          "bookCityCode": 1602,
          "departCityCode": 1602,
          "backCityCode": 1602
        },
        {
          "departDate": "2026-05-15",
          "tuniuPrice": 3699,
          "tuniuChildPrice": 0,
          "bookCityCode": 1602,
          "departCityCode": 1602,
          "backCityCode": 1602
        }
      ]
    }
  },
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

重要提示

  • 用户需要从 productPriceCalendar.rows 中选择一个 departDate 用于下单;
  • 建议在后续 getCruiseCabinAndRoomsaveCruiseOrder 全链路透传本接口返回的 traceId 便于排障。
  • 向用户展示产品详情后,可提醒:如需进一步了解邮轮船只参数与船上配套,可调用 getCruiseBaseInfo;如需单独查看按天展开的行程详情,可调用 getJourneyDetail(均需当前 productId,见 1.3、1.4 节)。

1.3 getCruiseBaseInfo(邮轮重要信息 / 可选)

功能:查询当前产品对应邮轮的重要信息,帮助用户了解船只与船上配套。服务端通过 composite 接口 type=1 拉取数据;成功时返回的 data 为上游 cruiseImportantInfo 对象(已去除冗余字段 decks,若存在)。

前置条件:已知 productId(来自 searchCruiseList.data.rows[].productIdgetCruiseProductDetail 关联产品)。

请求说明

参数类型必需说明
productIdstring产品 ID
traceIdstring链路追踪 ID,建议透传上游工具返回值

响应说明

参数类型说明
successboolean是否成功
errorCodenumber错误码
msgstring错误信息
dataobject邮轮重要信息(与上游 cruiseImportantInfo 一致)
traceIdstring链路追踪 ID

data 对象关键字段(含义)

字段说明
basicInfo基本信息(船名、船司、首航年份、特色文案等)
shipStatInfo船舶参数(吨位、载客、甲板数、尺寸航速等)
cabinTypes涵盖的舱等范围与房型说明(当前团期可售承诺)
restaurants餐饮设施
amuses娱乐设施

重要cabinTypes 等为船只/产品层面的涵盖说明;实际可售舱等、房型与价格以 getCruiseCabinAndRoom 为准

入参示例

json
{
  "productId": "321648365",
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

1.4 getJourneyDetail(按天行程详情 / 可选)

功能:查询当前邮轮产品按天展开的行程详情(每日标题与模块化内容)。服务端通过 composite 接口 type=2 拉取数据;成功时返回的 datajourneySummary 数组。

前置条件:已知 productId(来源同 getCruiseBaseInfo)。

请求说明

参数类型必需说明
productIdstring产品 ID
traceIdstring链路追踪 ID,建议透传上游工具返回值

响应说明

参数类型说明
successboolean是否成功
errorCodenumber错误码
msgstring错误信息
dataarray每日行程列表 journeySummary(元素含 day/title/moduleList
traceIdstring链路追踪 ID

data 数组元素(journeySummary)

参数类型说明
daynumber第几天
titlestring当天标题(如港口/城市)
moduleListarray当天行程模块列表,按 moduleType 解析

moduleList 解析规则(与 getCruiseProductDetail 一致)

  • activity:解析 description(HTML 转纯文本)
  • hotel:解析 hotelList(如 title
  • food:解析 food.hasList(早餐/午餐/晚餐/夜宵/下午茶,可能仅返回其中部分餐型),按统一规则生成对客文案,也可在此规则上优化对客展示文案:has=成人是否含餐,hasChild=儿童是否含餐(为空按 0);1/1=成人、儿童已含,0/0=成人、儿童自理,1/0=成人已含,儿童自理,0/1=成人自理,儿童已含
  • scenic:解析 scenicListcontent/type/picture
  • reminder:解析 remindtype/content,HTML 转纯文本)
  • shopping / flight:按对象结构展示关键信息
  • 未知 moduleType:保留原始字段做兜底展示

入参示例

json
{
  "productId": "321648365",
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

1.5 getCruiseCabinAndRoom(舱位房型查询)

功能:查询指定产品+团期下的舱位和房型信息,并返回下单必需的 vendorIdjourneyIdresourceIdsubResourceId 来源字段。

请求说明

参数类型必需说明来源
productIdstring产品 IDgetCruiseProductDetail.data.productId
departDatestring出游日期,格式 YYYY-MM-DD用户从 getCruiseProductDetail.data.productPriceCalendar.rows[].departDate 中选择
vendorIdnumber供应商 ID(用于切换行程)data.vendorList[].vendorId
traceIdstring链路追踪 ID,建议透传getCruiseProductDetail.traceId

响应说明

参数类型说明
successboolean是否成功
errorCodenumber错误码
msgstring错误信息
dataobject舱位房型数据
traceIdstring链路追踪 ID

data 对象关键字段

参数类型说明
vendorListarray可选供应商列表(含 vendorIdvendorNameadultPrice
base.vendorIdnumber⭐ 下单 saveCruiseOrder.vendorId 来源
base.beginDatestring⭐ 下单 saveCruiseOrder.departureDate 来源
cabinList[].journeyIdnumber⭐ 下单 selectRes[].journeyId 来源
cabinList[].cruiseCabinPicPathstring舱等图片 URL(无图时为 null)
cabinList[].roomList[].resPicPathstring房型图片 URL(无图时为 null)
cabinList[].roomList[].priceRes[]array价格资源数组,见下方映射

priceRes 与下单映射

  • roomTypeResType = 0resIdsaveCruiseOrder.selectRes[].resourceId(必填)
  • roomTypeResType = 1resIdsaveCruiseOrder.selectRes[].subResourceId(可选)
  • ⚠️ resourceId/subResourceId 必须取自 priceRes[].resId 的“值”,不能是 priceRes 数组的下标(0/1/2...);若误传疑似下标的小正数(如 1/2/3,通常 <=10),会被 saveCruiseOrder 参数校验拦截并提示重试。

入参示例

json
{
  "productId": "321648365",
  "departDate": "2026-05-01",
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

1.6 getCruiseBookingRequiredInfo(获取预订信息)

功能:返回下单前置说明文案。应在用户通过 getCruiseProductDetail 确认团期、并通过 getCruiseCabinAndRoom 明确房型后调用;用于展示固定说明(房型与 selectRes 规则、乘客/联系人字段、合规与隐私链接),再引导收集 tourists/contactTourist

请求说明

无参数,arguments 传空对象即可。

响应说明

返回纯文本(非 JSON),内容位于 result.content[0].text,包含:

内容模块说明
房型与下单关系说明 selectRes 与房型选择关系,强调 journeyId/resourceId/subResourceId 必须来自舱位房型接口结果,禁止编造
乘客与联系人信息乘客字段、联系人字段、填写规范
身份证/非身份证规则自动解析规则与补充字段要求
合规与隐私链接提交前阅读确认

1.7 saveCruiseOrder(创建订单)

功能:创建邮轮预订订单。

请求说明

前置条件

  • 必须先调用 getCruiseProductDetail 获取产品详情字段
  • 必须先调用 getCruiseCabinAndRoom 并明确用户选定房型
  • 必须先调用 getCruiseBookingRequiredInfo 展示下单说明

参数来源

  • productIddepartureCityNamedurationnight 来自 getCruiseProductDetail.data
  • departureDate 来自 getCruiseCabinAndRoom.data.base.beginDate
  • vendorId 来自 getCruiseCabinAndRoom.data.base.vendorId(或用户在 vendorList 选中的 vendorId
  • selectRes 来自 getCruiseCabinAndRoom.data.cabinList[].journeyId + roomList[].priceRes
参数类型必需说明来源
productIdstring产品 IDdata.productId
departureDatestring出发日期,格式 YYYY-MM-DDgetCruiseCabinAndRoom.data.base.beginDate
departureCityNamestring出发城市名称data.departureCityName
durationnumber行程天数data.duration
nightnumber晚数data.productNight
vendorIdnumber供应商 IDgetCruiseCabinAndRoom.data.base.vendorId
selectResarray选房价资源列表journeyId/resourceId/subResourceId 来源于舱位房型结果
touristsarray乘客信息列表用户提供
contactTouristobject联系人信息用户提供
traceIdstring链路追踪 IDgetCruiseProductDetail 返回的 traceId

tourists 数组元素

参数类型说明
namestring姓名(必填)
idTypestring证件类型(必填):身份证、因私护照、户口簿、出生证明、军人证、台胞证、回乡证、港澳居民居住证、台湾居民居住证、外国人永久居留身份证
idNumberstring证件号码(必填)
mobilestring手机号(必填)
typestring乘客类型(可选):成人/儿童/婴儿,不填则根据生日自动判断
psptEndDatestring证件有效期,格式 yyyy-MM-dd,非身份证必填(可选)
sexnumber性别,1 男 0 女 9 未知,非身份证必填(可选)
birthdaystring生日,格式 yyyy-MM-dd,非身份证必填(可选)

contactTourist 对象

参数类型说明
namestring联系人姓名(可选,不填则使用第一个乘客姓名)
mobilestring联系人手机号(可选,不填则使用第一个乘客电话)
emailstring联系人邮箱(可选)

响应说明

参数类型说明
successboolean是否成功
errorCodenumber错误码
msgstring提示信息
dataobject订单数据
traceIdstring链路追踪 ID

data 对象

参数类型说明
orderIdstring订单号
orderDetailUrlstring订单详情链接(https://m.tuniu.com/u/gt/order/{orderId}?orderType=66

selectRes 数组元素

参数类型说明
journeyIdnumber/string行程编号,来自 cabinList[].journeyId
resourceIdnumber/string必填,来自 priceResroomTypeResType=0resId(不能是 priceRes 数组下标;疑似下标的小正数(如 1/2/3,通常 <=10)会被拦截)
subResourceIdnumber/string可选,来自 priceResroomTypeResType=1resId(不能是 priceRes 数组下标;疑似下标的小正数(如 1/2/3,通常 <=10)会被拦截)

入参示例

json
{
  "productId": "321648365",
  "departureDate": "2026-05-01",
  "departureCityName": "上海",
  "duration": 5,
  "night": 4,
  "vendorId": 73824,
  "selectRes": [
    {
      "journeyId": 91252286,
      "resourceId": 2119981534
    }
  ],
  "tourists": [
    {
      "name": "张三",
      "idType": "身份证",
      "idNumber": "310101199001011234",
      "mobile": "13800138000"
    }
  ],
  "contactTourist": {
    "name": "张三",
    "mobile": "13800138000",
    "email": "zhangsan@example.com"
  },
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

响应示例

json
{
  "success": true,
  "errorCode": 0,
  "msg": "下单成功",
  "data": {
    "orderId": "1260278419",
    "orderDetailUrl": "https://m.tuniu.com/u/gt/order/1260278419?orderType=66"
  },
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

重要提示:下单成功后,用户可使用 orderDetailUrl 查看订单详情,并需要联系客服或前往途牛官网完成支付。

二、完整预订流程

2.1 流程图

主流程:搜索邮轮 → 选择产品 → 查看详情 → 选择团期 → 查询舱位房型 → 获取下单说明 → 创建订单

可选(不阻塞下单):在已有 productId 时,可调用 getCruiseBaseInfo(船只配套)或 getJourneyDetail(按天行程),通常在列表展示后或查看详情后发起。

2.2 命令行示例

调用前请先阅读 途牛 CLI 使用指南

命令格式:

bash
tuniu call <> <工具> -a '<JSON 入参>'

本页示例使用:tuniu call cruise <工具名称> -a '<JSON 入参>'

参数来源productIddepartCityCodeclassBrandParentIdproModetraceIdselectResvendorId 等须按上文各工具说明从接口返回中取值,勿手写编造。

步骤 1:搜索邮轮列表

bash
tuniu call cruise searchCruiseList -a '{"departsDateBegin":"2026-03-17","departsDateEnd":"2026-03-30"}'

步骤 2:查看产品详情(须与列表返回字段原样一致,departCityCode 保持数组)

bash
tuniu call cruise getCruiseProductDetail -a '{
  "productId": "321648365",
  "departsDateBegin": "2026-02-10",
  "departsDateEnd": "2026-02-14",
  "departCityCode": [1602],
  "classBrandParentId": 12,
  "proMode": 1
}'

(可选)步骤 3-1:邮轮船只配套

bash
tuniu call cruise getCruiseBaseInfo -a '{
  "productId": "321648365",
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}'

(可选)步骤 3-2:按天行程

bash
tuniu call cruise getJourneyDetail -a '{
  "productId": "321648365",
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}'

步骤 4:用户选定团期后查询舱位房型

bash
tuniu call cruise getCruiseCabinAndRoom -a '{
  "productId": "321648365",
  "departDate": "2026-05-01",
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}'

步骤 5:获取预订说明

bash
tuniu call cruise getCruiseBookingRequiredInfo -a '{}'

步骤 6:创建订单(departureDate 一般取舱位接口 base.beginDate;selectRes 来自舱位房型结果)

bash
tuniu call cruise saveCruiseOrder -a '{
  "productId": "321648365",
  "departureDate": "2026-05-01",
  "departureCityName": "上海",
  "duration": 5,
  "night": 4,
  "vendorId": 73824,
  "selectRes": [
    {
      "journeyId": 91252286,
      "resourceId": 2119981534
    }
  ],
  "tourists": [
    {
      "name": "张三",
      "idType": "身份证",
      "idNumber": "310101199001011234",
      "mobile": "13800138000"
    }
  ],
  "contactTourist": {
    "name": "张三",
    "mobile": "13800138000",
    "email": "zhangsan@example.com"
  },
  "traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}'

2.3 关键参数说明

departCityCode 数组传递

javascript
// ✅ 正确:原样传递数组
{
  departCityCode: [1602]  // 或 [1602, 1603]
}

// ❌ 错误:提取了单个元素
{
  departCityCode: 1602
}

// ❌ 错误:转换为字符串
{
  departCityCode: "1602"
}

团期选择流程

javascript
// 1. 获取团期列表
const calendar = detailResult.data.productPriceCalendar;
console.log(`共有 ${calendar.count} 个团期可选`);

// 2. 遍历展示(过滤掉无效团期)
const validRows = calendar.rows.filter(row => 
  row.tuniuPrice > 0 && (row.tuniuChildPrice > 0 || row.tuniuPrice > 0)
);

validRows.forEach(row => {
  const childPriceInfo = row.tuniuChildPrice > 0 
    ? `儿童起价 ¥${row.tuniuChildPrice}` 
    : '不支持儿童价';
  console.log(`${row.departDate}: 成人起价 ¥${row.tuniuPrice}, ${childPriceInfo}`);
});

// 3. 等待用户选择
const userChoice = await getUserInput('请选择出发日期:');

// 4. 验证用户选择
const selectedRow = validRows.find(row => row.departDate === userChoice);
if (!selectedRow) {
  throw new Error('选择的日期不在可选范围内');
}

// 5. 用选中的日期查询舱位房型
const departDate = selectedRow.departDate;
const cabinResult = await callTool('getCruiseCabinAndRoom', {
  productId: detailResult.data.productId,
  departDate
});

// 6. 下单时使用 departureDate=base.beginDate
const departureDate = cabinResult.data.base.beginDate;

Powered by VitePress