(即将废弃)tt.openEcIm
收藏我的收藏
注意
基础库 2.74.0.0 开始支持本接口,使用时可用 tt.canIUse 判断是否可用。
提供从小程序跳转到小店客服页面的能力。仅支持抖音 App 和 抖音极速版 App。
语法
tt.openEcIm(options);
参数说明
options 为 Object 类型,属性如下:
属性名 | 类型 | 默认值 | 必填 | 说明 | 最低支持版本 |
orderId | string | -- | 否 | 需要客服服务的订单 id | 抖音 1.96.0,抖音极速版 2.19.0 |
promotionId | string | -- | 否(订单 ID 和商品 ID,至少需要上传一个) | 需要客服服务的商品 id | 抖音 1.96.0,抖音极速版 2.19.0 |
shopId | string | -- | 是 | 当前小程序绑定的抖音小店 id | 抖音 1.96.0,抖音极速版 2.19.0 |
success | function | -- | 否 | 接口调用成功的回调函数 | 抖音 1.96.0,抖音极速版 2.19.0 |
fail | function | -- | 否 | 接口调用失败的回调函数 | 抖音 1.96.0,抖音极速版 2.19.0 |
complete | function | -- | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | 抖音 1.96.0,抖音极速版 2.19.0 |
回调成功
参数为 Object 类型,属性如下:
参数 | 参数类型 | 说明 | 最低支持版本 |
errMsg | string | 回调信息 | 抖音 1.96.0,抖音极速版 2.19.0 |
回调失败
参数为 Object 类型,属性如下:
参数 | 参数类型 | 说明 | 最低支持版本 |
errNo | number | 错误码 | 抖音 1.96.0,抖音极速版 2.19.0 |
errMsg | string | 错误信息 | 抖音 1.96.0,抖音极速版 2.19.0 |
错误码说明
errNo | errMsg | 说明 | 最低支持版本 |
10301 | feature is not supported in App | 当前 App 不支持这个功能 | 抖音 1.96.0,抖音极速版 2.19.0 |
20001 | param should be string, but got xxx | 参数类型校验错误 | 抖音 1.96.0,抖音极速版 2.19.0 |
20001 | param orderId or promotionId is required | 缺少必传参数 | 抖音 1.96.0,抖音极速版 2.19.0 |
21500 | The session id is unavailable, please check login status | 获取宿主 sessionid 失败,用 户未登录 | 抖音 1.96.0,抖音极速版 2.19.0 |
21501 | server error | 网络错误 | 抖音 1.96.0,抖音极速版 2.19.0 |
21502 | server data error | 服务端网关错误 | 抖音 1.96.0,抖音极速版 2.19.0 |
21503 | has no bind relation | 当前小程序与传入的商铺无绑定关 系 | 抖音 1.96.0,抖音极速版 2.19.0 |
21100 | host open schema fail: %s, schema == %s | 宿主 openSchema 错误 | 抖音 1.96.0,抖音极速版 2.19.0 |
代码示例
<button type="default" size="default" bindtap="openEcIm"> 跳转小店客服 </button>
Page({ openEcIm(e) { tt.openEcIm({ promotionId: "3423546", orderId: "13543545456", // 订单ID 和 商品ID 至少需要一个 shopId: "1234354", success(res) { console.log("调用成功", res); }, fail(res) { console.log("调用失败", res); }, }); }, });
Bug & Tip
- •Tip:使用该接口时需要用户身份信息,请确保在调用接口前,用户已经登录宿主 App;
- •Tip:目前该接口只支持抖音和抖音极速版,所以请在抖音 App 或抖音极速版 App中调用。