feat(kefu): 个人中心导航栏与全局客服入口支持直达微信小程序原生客服会话

这个提交包含在:
chen
2026-09-19 12:01:30 +08:00
父节点 aca0d3c671
当前提交 ed9199c8f9
共有 8 个文件被更改,包括 282 次插入 和 2 次删除

查看文件

@@ -1,7 +1,16 @@
<template>
<s-layout class="chat-wrap" title="客服" navbar="inner">
<!-- #ifdef MP-WEIXIN -->
<view class="mp-service-bar ss-flex ss-row-between ss-col-center">
<view class="ss-flex ss-col-center">
<text class="cicon-wechat ss-m-r-12 mp-wechat-icon"></text>
<view class="mp-service-text">微信小程序官方客服</view>
</view>
<button class="ss-reset-button mp-service-btn" open-type="contact">点击接入</button>
</view>
<!-- #endif -->
<div class="status">
{{ socketState.isConnect ? customerServiceInfo.title : '网络已断开,请检查网络后刷新重试' }}
{{ socketState.isConnect ? customerServiceInfo.title : '网络已断开,可使用上方微信客服直接沟通' }}
</div>
<div class="page-bg" :style="{ height: sys_navBar + 'px' }"></div>
<view class="chat-box" :style="{ height: pageHeight + 'px' }">
@@ -597,7 +606,36 @@
// .ui-navbar-box {
// background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
// }
// }
.mp-service-bar {
position: relative;
box-sizing: border-box;
z-index: 4;
margin: 16rpx 20rpx;
padding: 16rpx 24rpx;
background: #ffffff;
border-radius: 16rpx;
box-shadow: 0 4rpx 14rpx rgba(0, 0, 0, 0.08);
.mp-wechat-icon {
font-size: 40rpx;
color: #07c160;
}
.mp-service-text {
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
.mp-service-btn {
padding: 10rpx 24rpx;
background: #07c160;
color: #ffffff;
font-size: 24rpx;
font-weight: 500;
border-radius: 28rpx;
}
}
.status {
position: relative;

查看文件

@@ -24,6 +24,25 @@
<view class="item-title">收藏</view>
</block>
</view>
<!-- #ifdef MP-WEIXIN -->
<button
v-if="serviceIcon"
class="ss-reset-button detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
open-type="contact"
:send-message-title="modelValue.title"
:send-message-path="'/pages/goods/index?id=' + modelValue.id"
:send-message-img="sheep.$url.cdn(modelValue.image)"
show-message-card
>
<image
class="item-icon"
:src="sheep.$url.static('/assets/addons/shopro/uniapp/goods/message.png')"
mode="aspectFit"
></image>
<view class="item-title">客服</view>
</button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<view
v-if="serviceIcon"
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
@@ -36,6 +55,7 @@
></image>
<view class="item-title">客服</view>
</view>
<!-- #endif -->
<view
v-if="shareIcon"
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
@@ -154,6 +174,15 @@
.detail-tabbar-item {
width: 100rpx;
background: transparent;
border: none;
padding: 0;
margin: 0;
line-height: normal;
&::after {
border: none;
}
.item-icon {
width: 40rpx;

查看文件

@@ -57,7 +57,12 @@
<su-fixed bottom placeholder>
<view class="foot-wrap">
<view class="foot_box ss-flex ss-col-center ss-row-between ss-p-x-30">
<!-- #ifdef MP-WEIXIN -->
<button class="ss-reset-button contcat-btn" open-type="contact">联系客服</button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<button class="ss-reset-button contcat-btn" @tap="sheep.$router.go('/pages/chat/index')">联系客服</button>
<!-- #endif -->
<button class="ss-reset-button ui-BG-Main-Gradient sub-btn" @tap="submit">提交</button>
</view>
</view>

查看文件

@@ -115,9 +115,14 @@
@tap="onDelete(state.info.id)"
>删除</button
> -->
<!-- #ifdef MP-WEIXIN -->
<button class="ss-reset-button contcat-btn btn" open-type="contact">联系客服</button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<button class="ss-reset-button contcat-btn btn" @tap="sheep.$router.go('/pages/chat/index')"
>联系客服</button
>
<!-- #endif -->
</view>
</su-fixed>
</s-layout>

查看文件

@@ -51,9 +51,16 @@
</uni-forms>
<su-fixed bottom placeholder>
<view class="ss-flex ss-row-between ss-p-x-30 ss-p-y-10">
<!-- #ifdef MP-WEIXIN -->
<button class="kefu-btn ss-reset-button" open-type="contact">
联系客服
</button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<button class="kefu-btn ss-reset-button" @tap="sheep.$router.go('/pages/chat/index')">
联系客服
</button>
<!-- #endif -->
<button class="submit-btn ss-reset-button ui-BG-Main ui-Shadow-Main" @tap="onSubmit">
提交
</button>

查看文件

@@ -7,6 +7,33 @@
>
{{ data.text }}
</view>
<!-- #ifdef MP-WEIXIN -->
<button
v-if="data.type === 'image' && isCustomerService"
:style="[{ width: width }]"
class="ss-reset-button menu-icon-wrap ss-flex ss-row-center ss-col-center"
open-type="contact"
>
<image
class="nav-image"
:src="data.src && data.src.startsWith('/static/') ? data.src : sheep.$url.cdn(data.src)"
mode="aspectFit"
></image>
</button>
<view
v-else-if="data.type === 'image'"
:style="[{ width: width }]"
class="menu-icon-wrap ss-flex ss-row-center ss-col-center"
@tap="sheep.$router.go(data.url)"
>
<image
class="nav-image"
:src="data.src && data.src.startsWith('/static/') ? data.src : sheep.$url.cdn(data.src)"
mode="aspectFit"
></image>
</view>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<view
v-if="data.type === 'image'"
:style="[{ width: width }]"
@@ -19,6 +46,7 @@
mode="aspectFit"
></image>
</view>
<!-- #endif -->
<view class="ss-flex-1" v-if="data.type == 'search'" :style="[{ width: width }]">
<s-search-block
:placeholder="data.placeholder || '搜索关键字'"
@@ -49,6 +77,20 @@
});
const height = computed(() => sheep.$platform.capsule.height);
// 判断是否为客服入口
const isCustomerService = computed(() => {
const url = props.data?.url || '';
const src = props.data?.src || '';
return (
url === '/pages/chat/index' ||
url.startsWith('/pages/chat') ||
url.includes('chat') ||
url.includes('kefu') ||
url.includes('customer_service') ||
src.includes('c47b048175b325b1e78f837a3b696794')
);
});
</script>
<style lang="scss" scoped>
@@ -61,6 +103,16 @@
.menu-icon-wrap {
width: 100%;
height: 100%;
background: transparent;
border: none;
padding: 0;
margin: 0;
line-height: normal;
&::after {
border: none;
}
.nav-image {
height: 30px;
max-width: 100%;

查看文件

@@ -6,12 +6,31 @@
<view class="container-list ss-flex ss-flex-wrap">
<view class="list-item ss-m-b-24" v-for="item in list" :key="item.title">
<view class="ss-flex-col ss-col-center">
<!-- #ifdef MP-WEIXIN -->
<button
v-if="item.url === '/pages/chat/index'"
class="ss-reset-button list-image ss-flex ss-row-center ss-col-center"
open-type="contact"
@tap="closeMenuTools"
>
<image v-if="show" :src="sheep.$url.static(item.icon)" class="list-icon"></image>
</button>
<button
v-else
class="ss-reset-button list-image ss-flex ss-row-center ss-col-center"
@tap="onClick(item)"
>
<image v-if="show" :src="sheep.$url.static(item.icon)" class="list-icon"></image>
</button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<button
class="ss-reset-button list-image ss-flex ss-row-center ss-col-center"
@tap="onClick(item)"
>
<image v-if="show" :src="sheep.$url.static(item.icon)" class="list-icon"></image>
</button>
<!-- #endif -->
<view class="list-title ss-m-t-20">{{ item.title }}</view>
</view>
</view>