Skip to main content

商机模块

获取新增商机表单接口

接口地址

https://e-crm.icsoc.net/openapi/v1/opportunity/form/fields

请求方式

GET

示例:

curl -X GET \
https://e-crm.icsoc.net/openapi/v1/opportunity/form/fields \
-H "Authorization: Bearer {access-token}" \

字段说明

  • access-token:认证文档中的access_token

响应结果

{
"code": 200,
"message": "ok",
"data": [
{
"field_name": "opty_name",
"field_label": "商机名称",
"options": [],
"field_type": "input",
"is_required": 1
},
{
"field_name": "cle_id",
"field_label": "客户名称",
"options": {
"association_type": "client.list",
"display_field_name": "cle_name",
"url": "api/client/smartSearch",
"dynamic_value": [],
"display_value": {
"cle_id": "0",
"cle_name": ""
}
},
"field_type": "association",
"is_required": 1
},
{
"field_name": "opty_type",
"field_label": "商机类型",
"options": {
"customFieldsOptionNames": [
{
"text": "新客户商机",
"value": 1
},
{
"text": "老客户商机",
"value": 2
}
],
"customFieldsOptionNamesKeys": [
0,
1
],
"customFieldsOptionDefault": "",
"customFieldsOptionCount": 2
},
"field_type": "select",
"is_required": 1
},
{
"field_name": "opty_source",
"field_label": "商机来源",
"options": {
"customFieldsOptionNames": [
{
"text": "官网注册",
"value": 1
},
{
"text": "在线咨询",
"value": 2
},
{
"text": "电话咨询",
"value": 3
},
{
"text": "销售自有",
"value": 4
},
{
"text": "老客户介绍",
"value": 5
},
{
"text": "其他",
"value": 6
}
],
"customFieldsOptionNamesKeys": [
0,
1,
2,
3,
4,
5
],
"customFieldsOptionDefault": "",
"customFieldsOptionCount": 6
},
"field_type": "select",
"is_required": 1
},
{
"field_name": "opty_stage",
"field_label": "销售阶段\t",
"options": {
"display_field_name": "opty_stage_name",
"customFieldsOptionNames": [
{
"value": 22,
"text": "初步洽谈"
},
{
"value": 23,
"text": "需求确定"
},
{
"value": 24,
"text": "商务谈判"
},
{
"value": 25,
"text": "赢单"
},
{
"value": 26,
"text": "输单"
},
{
"value": 42,
"text": "123123123"
},
{
"value": 43,
"text": "1231231"
}
],
"customFieldsOptionDefault": 0,
"customFieldsOptionCount": 7
},
"field_type": "select",
"is_required": 1
}
]
}

结果说明

返回字段字段类型说明
field_namestring字段唯一标识
field_labelstring字段名称
optionsobject字段特殊选项设置,不同字段类型参见附录
field_typestring字段类型,所有字段类型参见附录
is_requriedint是否必填

商机详情接口

接口地址

https://e-crm.icsoc.net/openapi/v1/opportunity/{opty_id}

请求方式

GET

参数说明

参数类型说明必选约束
opty_idint商机ID

响应结果

{
"code": 200,
"message": "ok",
"data": {
"_id": 6471982131139821569,
"opty_name": "商机",
"cle_id": "6470844909275561985",
"opty_type": 1,
"opty_type_name": "新客户商机",
"opty_source": 1,
"opty_source_name": "官网注册",
"opty_stage": 22,
"lose_order_reason": 0,
"lose_order_remark": "",
"sale_charge_user_id": 90002395,
"create_user_id": 90000172,
"create_time": 1543040783,
"update_user_id": 90000172,
"update_time": 1543040783,
"last_contact_user_id": 0,
"last_contact_time": 0,
"cle_name": "1112321323",
"cle_phone": "3121123123",
"opty_stage_name": "初步洽谈",
"lose_order_reason_name": "",
"sale_charge_user_name": "1214 luquan",
"sale_charge_department_id": 39,
"sale_charge_department_name": "测试分配策略",
"last_contact_user_name": "",
"last_contact_department_id": 0,
"last_contact_department_name": "",
"vcc_id": 90000000,
"create_user_name": "8002 8002坐席",
"create_department_id": 1,
"create_department_name": "公司",
"update_user_name": "8002 8002坐席",
"update_department_id": 1,
"update_department_name": "公司",
"id": "6471982131139821569"
}
}

结果说明

返回字段字段类型说明
opty_namestring商机名称
opty_stageint商机阶段ID
opty_sourceint商机来源ID
opty_typeint商机类型ID

编辑商机表单接口

接口地址

https://e-crm.icsoc.net/openapi/v1/opportunity/{opty_id}/form/fields

请求方式

GET

参数说明

参数类型说明必选约束
opty_idint商机ID

响应结果

{
"code": 200,
"message": "ok",
"data": [
{
"field_name": "opty_name",
"field_label": "商机名称",
"options": [],
"field_type": "input",
"is_required": 1,
"field_value": "商机"
},
{
"field_name": "cle_id",
"field_label": "客户名称",
"options": {
"association_type": "client.list",
"display_field_name": "cle_name",
"url": "api/client/smartSearch",
"dynamic_value": [],
"display_value": {
"cle_id": "6470844909275561985",
"cle_name": "1112321323"
}
},
"field_type": "association",
"is_required": 1,
"field_value": "6470844909275561985"
},
{
"field_name": "opty_type",
"field_label": "商机类型",
"options": {
"customFieldsOptionNames": [
{
"text": "新客户商机",
"value": 1
},
{
"text": "老客户商机",
"value": 2
}
],
"customFieldsOptionNamesKeys": [
0,
1
],
"customFieldsOptionDefault": "",
"customFieldsOptionCount": 2
},
"field_type": "select",
"is_required": 1,
"field_value": 1
},
{
"field_name": "opty_source",
"field_label": "商机来源",
"options": {
"customFieldsOptionNames": [
{
"text": "官网注册",
"value": 1
},
{
"text": "在线咨询",
"value": 2
},
{
"text": "电话咨询",
"value": 3
},
{
"text": "销售自有",
"value": 4
},
{
"text": "老客户介绍",
"value": 5
},
{
"text": "其他",
"value": 6
}
],
"customFieldsOptionNamesKeys": [
0,
1,
2,
3,
4,
5
],
"customFieldsOptionDefault": "",
"customFieldsOptionCount": 6
},
"field_type": "select",
"is_required": 1,
"field_value": 1
},
{
"field_name": "opty_stage",
"field_label": "销售阶段\t",
"options": {
"display_field_name": "opty_stage_name",
"customFieldsOptionNames": [
{
"value": 22,
"text": "初步洽谈"
},
{
"value": 23,
"text": "需求确定"
},
{
"value": 24,
"text": "商务谈判"
},
{
"value": 25,
"text": "赢单"
},
{
"value": 26,
"text": "输单"
},
{
"value": 42,
"text": "123123123"
},
{
"value": 43,
"text": "1231231"
}
],
"customFieldsOptionDefault": 22,
"customFieldsOptionCount": 7
},
"field_type": "select",
"is_required": 1,
"field_value": 22
}
]
}

结果说明

返回字段字段类型说明
field_namestring字段唯一标识
field_labelarray字段名称
optionsstring字段特殊选项设置,不同字段类型参见附录
field_typestring字段类型,所有字段类型参见附录
is_requriedint是否必填
field_valuemixed编辑联系人的当前值

新建商机接口

接口地址

https://e-crm.icsoc.net/openapi/v1/opportunity

请求方式

POST

请求参数

{
"opty_name": "商机1",
"cle_id": "6470844909275561985",
"opty_type": 1,
"opty_stage": 22,
"opty_source": 1
}

参数说明

参数类型说明必选约束
cle_idstring客户ID
opty_namestring商机名称
opty_sourceint商机来源ID
opty_typeint商机类型ID
opty_stageint商机阶段ID
  • 更多字段参考新增商机表单字段接口返回结果

响应结果

{
"code": 200,
"message": "ok",
"data": {
"id": "6471982131139821569",
"_id": 6471982131139821569
}
}

结果说明

返回字段字段类型说明
idstring商机ID(string类型)
_idint商机ID(int类型)

编辑商机接口

接口地址

https://e-crm.icsoc.net/openapi/v1/opportunity/{opty_id}

请求方式

PUT

请求参数

{
"opty_name": "商机1",
"cle_id": "6470844909275561985",
"opty_type": 1,
"opty_stage": 22,
"opty_source": 1
}

参数说明

参数类型说明必选约束
cle_idstring客户ID
opty_namestring商机名称
opty_sourceint商机来源ID
opty_typeint商机类型ID
opty_stageint商机阶段ID
  • 更多字段参考新增商机表单字段接口返回结果

示例:

curl -X PUT \
https://e-crm.icsoc.net/openapi/v1/opportunity/{opty_id} \
-H "accept: application/json" \
-H "Authorization: Bearer {access-token}" \
-H "Content-Type: application/json" \
-d '{
"opty_name": "商机1",
"cle_id": "6470844909275561985",
"opty_type": 1,
"opty_stage": 22,
"opty_source": 1
}'

响应结果

{
"code": 200,
"message": "ok",
"data": {
"id": "6471982131139821569",
"_id": 6471982131139821569
}
}

结果说明

返回字段字段类型说明
idstring商机ID(string类型)
_idint商机ID(int类型)

商机列表接口

接口地址

https://e-crm.icsoc.net/openapi/v1/opportunity/opportunities?page={page}&page_size={page_size}&cle_name={cle_name}&opty_name={opty_name}&opty_stage={opty_stage}&sort={sort}&order={order}&cursor=WzE1NDIzNTA0NzgsImNybV9jbGllbnRzIzY0NjkwODY3ODA0NTYxNTcxODUiXQQD

请求方式

GET

参数说明

参数类型说明必选约束
cursorstring游标,第一次查询时无需传该值,后续查询时,将上一次查询获取数据中的cursor传递过来即可,此字段用于分页查询
page_sizeint查询数据条数,默认为10
sortstring排序字段,若有值,根据字段进行排序返回,默认为create_time
orderstring排序规则,默认为降序desc枚举值:asc,desc
cle_namestring客户名称,若有值,返回符合条件的数据,匹配规则为模糊匹配
opty_namestring商机名称,若有值,返回符合条件的数据,匹配规则为模糊匹配
opty_stageint商机阶段,若有值,返回符合条件的数据,匹配规则为精确匹配

响应结果

{
"code": 200,
"message": "ok",
"data": {
"cursor": "WzE1NDIzNTA0NzgsImNybV9jbGllbnRzIzY0NjkwODY3ODA0NTYxNTcxODUiXQQD",
"total": 4,
"rows": [
{
"_id": 6471982131139821569,
"opty_name": "商机1",
"cle_id": 6470844909275561985,
"opty_type": 1,
"opty_type_name": "新客户商机",
"opty_source": 1,
"opty_source_name": "官网注册",
"opty_stage": 22,
"lose_order_reason": 0,
"lose_order_remark": "",
"sale_charge_user_id": 90002395,
"create_user_id": 90000172,
"create_time": 1543040783,
"update_user_id": 90000172,
"update_time": 1543041375,
"last_contact_user_id": 0,
"last_contact_time": 0,
"cle_name": "1112321323",
"cle_phone": "3121123123",
"opty_stage_name": "初步洽谈",
"lose_order_reason_name": "",
"sale_charge_user_name": "1214 luquan",
"sale_charge_department_id": 39,
"sale_charge_department_name": "测试分配策略",
"last_contact_user_name": "",
"last_contact_department_id": 0,
"last_contact_department_name": "",
"vcc_id": 90000000,
"create_user_name": "8002 8002坐席",
"create_department_id": 1,
"create_department_name": "公司",
"update_user_name": "8002 8002坐席",
"update_department_id": 1,
"update_department_name": 0,
"id": "6471982131139821569"
},
{
"_id": 6471982002546655233,
"opty_name": "商机",
"cle_id": 6470844909275561985,
"opty_type": 1,
"opty_type_name": "新客户商机",
"opty_source": 1,
"opty_source_name": "官网注册",
"opty_stage": 22,
"lose_order_reason": 0,
"lose_order_remark": "",
"sale_charge_user_id": 90002395,
"create_user_id": 90000172,
"create_time": 1543040753,
"update_user_id": 90000172,
"update_time": 1543040753,
"last_contact_user_id": 0,
"last_contact_time": 0,
"cle_name": "1112321323",
"cle_phone": "3121123123",
"opty_stage_name": "初步洽谈",
"lose_order_reason_name": "",
"sale_charge_user_name": "1214 luquan",
"sale_charge_department_id": 39,
"sale_charge_department_name": "测试分配策略",
"last_contact_user_name": "",
"last_contact_department_id": 0,
"last_contact_department_name": "",
"vcc_id": 90000000,
"create_user_name": "8002 8002坐席",
"create_department_id": 1,
"create_department_name": "公司",
"update_user_name": "8002 8002坐席",
"update_department_id": 1,
"update_department_name": "公司",
"id": "6471982002546655233"
}
]
}
}

结果说明

返回字段字段类型说明
cursorstring查询游标,下次查询使用
totalint总条数
rowsarray结果集 (参数说明参见商机字段参考说明

删除商机接口

支持批量删除

接口地址

https://e-crm.icsoc.net/openapi/v1/opportunity

请求方式

DELETE

curl -X DELETE \
https://e-crm.icsoc.net/openapi/v1/opportunity \
-H "accept: application/json" \
-H "Authorization: Bearer {access-token}" \
-H "Content-Type: application/json" \
-d '{
"ids":[6471982131139821569,6471982131139821569]
}'

参数说明

参数类型说明必选约束
idsarray商机ID集合

响应结果

{
"code": 200,
"message": "ok",
"data": []
}

商机字段说明

参数名参数说明
_id商机ID
opty_name商机名称
cle_id客户ID
opty_type商机类型ID
opty_type_name商机名称
opty_source商机来源ID
opty_stage销售阶段ID
opty_source_name商机来源名称
lose_order_reason输单原因ID
lose_order_remark输单备注
sale_charge_user_id销售负责人ID
create_user_id创建人ID
create_time创建时间
update_user_id更新人ID
update_time更新时间
last_contact_user_id最近跟进人ID
last_contact_time最近跟进时间
cle_name客户名称
cle_phone客户电话
lose_order_reason_name输单原因说明
sale_charge_user_name销售负责人名称(坐席工号+空格+坐席名称)
sale_charge_department_id销售负责部门ID
sale_charge_department_name销售负责部门名
last_contact_user_name最近跟进人名称(坐席工号+空格+坐席名称)
last_contact_department_id最近跟进部门ID
last_contact_department_name最近跟进部门名
create_user_name创建人名称(坐席工号+空格+坐席名称)
create_department_id创建人部门ID
create_department_name创建人部门名
update_user_name更新人名称(坐席工号+空格+坐席名称)
update_department_id更新人部门ID
update_department_name更新人部门名
id商机ID冗余(string类型,供前端使用)