{{userInfo.nickname}}
用户设置 退出登录

{{wikiTitle}}

小程序跳转企业微信客服

小程序跳转企业微信客服

下文中路径都是以完整包前端代码:view/uniapp

1、文件view/uniapp/utils/util.js

/**
     * 处理客服不同的跳转;
     * 
     */
    getCustomer(userInfo,url){
        let self = this;
        customerType().then(res=>{
            let data = res.data;
            if (data.customer_type == 1) {
                uni.makePhoneCall({
                    phoneNumber: data.customer_phone
                });
            } else if (data.customer_type == 2) {
                let href = data.customer_url;
                let hrefO = href + '?uid=' + userInfo.uid + '&nickName=' + userInfo.nickname + '&phone=' +
                    userInfo.phone + '&sex=' + userInfo.sex + '&avatar=' + userInfo.avatar +
                    '&openid=' + userInfo.openid;
                let hrefT = href + '&uid=' + userInfo.uid + '&nickName=' + userInfo.nickname + '&phone=' +
                    userInfo.phone + '&sex=' + userInfo.sex + '&avatar=' + userInfo.avatar +
                    '&openid=' + userInfo.openid;
                let urls = encodeURIComponent(href.indexOf('?') === -1 ? hrefO : hrefT);
                // #ifdef MP
                if (data.customer_url.indexOf('work.weixin.qq.com') > 0){
                    uni.openCustomerServiceChat({
                        extInfo: {
                            url: data.customer_url
                        },
                        corpId: data.wechat_work_corpid,
                        success(res) {},
                        fail(err) {
                            self.Tips({
                                title: err.errMsg
                            });
                        }
                    })
                }else{
                    uni.navigateTo({
                        url: `/pages/annex/web_view/index?url=${urls}`
                    });
                }
                // #endif
                // #ifndef MP
                uni.navigateTo({
                    url: `/pages/annex/web_view/index?url=${urls}`
                });
                // #endif
            } else {
                uni.navigateTo({
                    url: url || '/pages/extension/customer_list/chat'
                })
            }
        }).catch(err=>{
            self.Tips({
                title: err
            });
        })
    },

分别在用到的页面进行调用(路径):

2、view/uniapp/pages/user/index.vue

替换:this.kefuInfo(url); 整体为下图所示部分

3、view/uniapp/pages/users/order_details/index.vue

goGoodCall方法:替换成如下截图

4、view/uniapp/components/kefuIcon/index.vue

<template>
    <!-- #ifdef APP-PLUS || H5 -->
    <view class="acea-row row-center-wrapper cartf iconfont icon-kefu3" :style="{ top: top + 'px'}" @touchmove.stop.prevent="setTouchMove" @click="licks"></view>
    <!-- #endif -->
    <!-- #ifdef MP -->
    <view v-if="routineContact == 0">
        <view class="acea-row row-center-wrapper cartf iconfont icon-kefu3" :style="{ top: top + 'px'}" @touchmove.stop.prevent="setTouchMove" @click="licks"></view>
    </view>
    <button class="acea-row row-center-wrapper cartf iconfont icon-kefu3" open-type='contact' :style="{ top: top + 'px'}" @touchmove.stop.prevent="setTouchMove" v-else-if="routineContact==1 && !goodsCon"></button>
    <button class="acea-row row-center-wrapper cartf iconfont icon-kefu3" open-type='contact' :send-message-title="storeInfo.store_name" :send-message-img="storeInfo.image" :send-message-path="`/pages/goods_details/index?id=${storeInfo.id}`" show-message-card :style="{ top: top + 'px'}" @touchmove.stop.prevent="setTouchMove" v-else-if="routineContact==1 && goodsCon"></button>
    <!-- #endif -->
</template>

licks(){
                let userInfo = {}
                if(typeof this.userInfo === 'string'){
                    userInfo = JSON.parse(this.userInfo)
                }else{
                    userInfo = this.userInfo
                }
                let url = `/pages/extension/customer_list/chat?productId=${this.ids}`
                this.$util.getCustomer(userInfo,url)
            }

{{cateWiki.like_num}}人点赞
0人点赞
评论({{cateWiki.comment_num}}) {{commentWhere.order ? '评论从旧到新':'评论从新到旧'}} {{cateWiki.page_view_num}}人看过该文档
评论(0) {{commentWhere.order ? '评论从旧到新':'评论从新到旧'}} 147人看过该文档
评论
{{item.user ? item.user.nickname : ''}} (自评)
{{item.content}}
{{item.create_time}} 删除
{{item.like ? item.like.like_num : 0}} {{replyIndex == index ? '取消回复' : '回复'}}
评论
{{items.user ? items.user.nickname : '暂无昵称'}} (自评)
{{items.content}}
{{items.create_time}} 删除
{{items.like ? items.like.like_num : 0}} {{replyIndexJ == (index+'|'+indexJ) ? '取消回复' : '回复'}}
评论
目录
  • {{item}}