**版本：202701**

# 查询商品定制配置

**GET** `/openapi/2027-01/customization/products/:product_id/design`

返回某商品的定制配置，包含定制项、分组与展示规则。

## 请求

**Path参数**

- `product_id` string (required)

  SaaS 商品 ID

## 响应

**200**

OK

**application/json**

**数据结构 | 示例**

**数据结构**

- `code` string

  错误码
- `message` string

  错误信息
- `data` object

  - `design` object

    商品定制配置

    - `product_id` string

      SaaS 商品 ID
    - `type` string

      配置类型：normal / linked（只读）
    - `applied_template_id` string

      来源模板 ID，未套用模板时为空
    - `components` object[]

      定制项

      *   Array [

      - `key` string

        定制项标识，格式 {type}-{8位}，同一配置内唯一
      - `type` string

        定制项类型：text / dropdown / checkbox / button / image / upload / datetime / size-pricing / preview-*
      - `settings` object

        定制项设置。通用字段：label（必填，同商品内唯一）、order_label、required、support_condition、value、options[]； options[]：key（选项标识，ERP 匹配用）、label、value、imageUrl、price、link、children、parentKey；其余字段按 type 而定
      - `price_settings` object

        该定制项的加价规则

        - `calc_type` string

          计算方式：component / option / bysize / formula
        - `price` object

          价格表。calc_type=component 时 key 为定制项 key，option 时为选项 key，bysize 时为尺寸 key

          - `property name*` double
        - `settings` object

          附加设置，calc_type=formula 时含 formula
      *   ]
    - `groups` object[]

      定制项分组

      *   Array [

      - `key` string

        分组标识
      - `group_name` string

        分组展示名
      - `contains` string[]

        该分组包含的定制项 key
      - `type` string

        分组类型：material（每个定制项默认的包裹组，key 与定制项相同）/ group（自定义分组，key 形如 group-xxxxxxxx）
      *   ]
    - `conditions` object[]

      链式展示规则

      *   Array [

      - `rules` object

        {items: [{type: custom/product, left, right: []}], logic: and/or}。custom：left 为定制项 key， right 为选项 key；product：left 为规格名，right 为规格值
      - `targets` string[]

        要显示的定制项或分组 key
      *   ]
    - `with_preview` int32

      预览模式：0-仅选项，1-带预览
    - `preview_settings` object

      预览设置，with_preview=1 时有值

      - `physical_size` object

        {width, height, unit, dpi}
      - `background_images` object

        {[saas_variant_id]: {image: {src, width, height}}}
      - `print_design_bounding` object

        {[saas_variant_id]: {top, left, width, height, angle, scaleX, scaleY}}
      - `layers` GoogleProtobufValue

        图层定义
      - `artwork_image` object

        效果图

        - `src` string

          图片地址
        - `width` int32

          图片宽度（像素）
        - `height` int32

          图片高度（像素）

```json
{
  "code": "string",
  "message": "string",
  "data": {
    "design": {
      "product_id": "string",
      "type": "string",
      "applied_template_id": "string",
      "components": [
        {
          "key": "string",
          "type": "string",
          "settings": {},
          "price_settings": {
            "calc_type": "string",
            "price": {},
            "settings": {}
          }
        }
      ],
      "groups": [
        {
          "key": "string",
          "group_name": "string",
          "contains": [
            "string"
          ],
          "type": "string"
        }
      ],
      "conditions": [
        {
          "rules": {},
          "targets": [
            "string"
          ]
        }
      ],
      "with_preview": 0,
      "preview_settings": {
        "physical_size": {},
        "background_images": {},
        "print_design_bounding": {},
        "artwork_image": {
          "src": "string",
          "width": 0,
          "height": 0
        }
      }
    }
  }
}
```
