---
name: "getServiceDetail"
mode: "kit"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.5" }
---

## getServiceDetail

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.5

### 描述

服务详情信息

### 参数

`Params`

| 参数 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `params` | `QueryServiceDetailDto` | 是 | - | 请求体 |

### 引用对象

##### `type` QueryServiceDetailDto

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `homeId` | `string` | 家庭 id |
| `stockId` | `string` | 库存 id |

##### `interface` DeviceInfo

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `productId` | `string` | 产品 id |
| `planList` | `PlanInfoDto[]` | 设备服务计划列表 |
| `isUseFreeService` | `0 \| 1` | 是否已购买订阅首期免费商品（0-未购买、1-已购买） |
| `isUseCommonUserTrail` | `0 \| 1` | 是否购买过普通试用-账号级别免费商品（0-未购买、1-已购买） |
| `isUseCommonDeviceTrail` | `0 \| 1` | 是否购买过普通试用-设备级别免费商品（0-未购买、1-已购买） |
| `isTried` | `0 \| 1` | 是否已试用商品（0-未试用、1-已试用） |
| `hasServiceOrder` | `boolean` | 是否存在服务单 |
| `icon` | `string` | 设备图标 |
| `name` | `string` | 设备名称 |
| `ownerId` | `string` | 所属家庭 ID |
| `uuid` | `string` | 设备唯一 ID |
| `roomName` | `string` | 房间名称 |
| `deviceId` | `string` | 设备 deviceId |
| `isBind` | `"DeviceBindStatus.BINDING" \\| "DeviceBindStatus.NOT_SUPPORT" \\| "DeviceBindStatus.NOT_BIND"` | 绑定状态（已绑定 / 不支持 / 未绑定） |
| `status` | `boolean` | 设备状态 |
| `aiSmartFreeDev` | `boolean` | 当前设备是否处于 aiSmart 能力白名单中 |

##### `interface` CloudService

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `bindDeviceNum` | `number` | 绑定设备数量 |
| `totalDevices` | `number` | 总数量 |

##### `enum` StockStatus

| 枚举值 | 实际值 | 描述 |
| --- | --- | --- |
| `StockStatus.NO_ENABLE` | `1` | 未启用 |
| `StockStatus.ENABLED` | `2` | 启用中 |

##### `enum` DeviceBindStatus

| 枚举值 | 实际值 | 描述 |
| --- | --- | --- |
| `DeviceBindStatus.BINDING` | `1` | 已绑定 |
| `DeviceBindStatus.NOT_SUPPORT` | `2` | 不支持 |
| `DeviceBindStatus.NOT_BIND` | `3` | 未绑定 |

##### `interface` PlanInfoDto

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `commodityCode` | `string` | 商品编码 |
| `commodityName` | `string` | 商品名称 |
| `env` | `number` | 环境标识 |
| `instanceId` | `string` | 实例 id（通常为设备 id） |
| `isSubscribe` | `0 \| 1` | 是否订阅商品（0 / 1） |
| `orderNo` | `number` | 排序序号 |
| `planStatus` | `1` | 套餐状态（如使用中） |
| `serviceBeginTime` | `number` | 服务开始时间 |
| `serviceEndTime` | `number` | 服务结束时间 |
| `stockId` | `string` | 库存 id |
| `isCanceled` | `0 \| 1` | 是否已退订（0 / 1） |
| `isAdditional` | `0 \| 1` | 是否加购/附加（0 / 1） |


### 示例代码

#### 请求示例

```typescript
import { getServiceDetail } from '@tuya-miniapp/cloud-api';

getServiceDetail({ homeId: '194137', stockId: 'stock-1' })
  .then((d) => console.log(d))
  .catch(console.error);
```

#### 返回示例

```json
{
  "cover": "https://images.example.com/cover.jpg",
  "commodityName": "云存储月包",
  "stockId": "stock-1",
  "commodityCode": "CLOUD_30D",
  "duration": 30,
  "durationDesc": "30 天",
  "stockStatus": 2,
  "isSubscribe": 1,
  "isFuturePayments": 0,
  "additionalUuid": "uuid-root",
  "categoryCode": "ipc",
  "isPublish": 1,
  "cloudService": { "bindDeviceNum": 1, "totalDevices": 2 }
}
```
