chore:合并成一个客服按钮
This commit is contained in:
@@ -14,6 +14,7 @@ export class CustomerService {
|
|||||||
*/
|
*/
|
||||||
getPlatformConfig() {
|
getPlatformConfig() {
|
||||||
const servicerConfig = this.vm.$store.state.servicerConfig;
|
const servicerConfig = this.vm.$store.state.servicerConfig;
|
||||||
|
console.log(`客服配置:`, servicerConfig)
|
||||||
if (!servicerConfig) return null;
|
if (!servicerConfig) return null;
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 悬浮按钮 -->
|
<!-- 悬浮按钮 -->
|
||||||
<view v-if="pageCount == 1 || need" class="fixed-box" :style="{ height: fixBtnShow ? '330rpx' : '120rpx' }">
|
<view v-if="pageCount == 1 || need" class="fixed-box" :style="{ height: fixBtnShow ? '330rpx' : '120rpx' }">
|
||||||
<button class="btn-item" v-if="fixBtnShow && useOfficialService" hoverClass="none" open-type="contact"
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
|
<button class="btn-item" v-if="fixBtnShow" hoverClass="none" open-type="contact"
|
||||||
sessionFrom="weapp" showMessageCard="true"
|
sessionFrom="weapp" showMessageCard="true"
|
||||||
:style="{ backgroundImage: 'url(' + (kefuimg ? kefuimg : '') + ')', backgroundSize: '100% 100%' }">
|
:style="{ backgroundImage: 'url(' + (kefuimg ? kefuimg : '') + ')', backgroundSize: '100% 100%' }">
|
||||||
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
||||||
</button>
|
</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
<!-- 自定义客服按钮 -->
|
<!-- 自定义客服按钮 -->
|
||||||
<button class="btn-item" v-if="fixBtnShow && !useOfficialService" hoverClass="none" @click="contactServicer"
|
<button class="btn-item" v-if="fixBtnShow" hoverClass="none" @click="contactServicer"
|
||||||
:style="{ backgroundImage: 'url(' + (kefuimg ? kefuimg : '') + ')', backgroundSize: '100% 100%' }">
|
:style="{ backgroundImage: 'url(' + (kefuimg ? kefuimg : '') + ')', backgroundSize: '100% 100%' }">
|
||||||
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
||||||
</button>
|
</button>
|
||||||
|
<!-- #endif -->
|
||||||
<!-- AI智能助手 -->
|
<!-- AI智能助手 -->
|
||||||
<view class="btn-item" v-if="fixBtnShow && enableAIChat" @click="openAIChat"
|
<view class="btn-item" v-if="fixBtnShow && enableAIKefuButton" @click="openAIChat"
|
||||||
:style="{ backgroundImage: 'url(' + (aiAgentimg ? aiAgentimg : '') + ')', backgroundSize: '100% 100%' }">
|
:style="{ backgroundImage: 'url(' + (aiAgentimg ? aiAgentimg : '') + ')', backgroundSize: '100% 100%' }">
|
||||||
<!-- 核心修改:添加🤖表情,保留原有判断逻辑 -->
|
<!-- 核心修改:添加🤖表情,保留原有判断逻辑 -->
|
||||||
<text class="ai-icon" v-if="!aiAgentimg">🤖</text>
|
<text class="ai-icon" v-if="!aiAgentimg">🤖</text>
|
||||||
@@ -30,7 +35,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { createCustomerService } from '@/common/js/ai-service.js';
|
import { createCustomerService } from '@/common/js/customer-service.js';
|
||||||
import { mapGetters, mapMutations } from 'vuex';
|
import { mapGetters, mapMutations } from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -60,6 +65,8 @@ export default {
|
|||||||
this.customerService = createCustomerService(this);
|
this.customerService = createCustomerService(this);
|
||||||
this.buttonConfig = this.customerService.getButtonConfig();
|
this.buttonConfig = this.customerService.getButtonConfig();
|
||||||
|
|
||||||
|
console.log(`buttonConfig: `, this.buttonConfig);
|
||||||
|
|
||||||
const that = this;
|
const that = this;
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: 'shopInfo',
|
key: 'shopInfo',
|
||||||
@@ -80,6 +87,9 @@ export default {
|
|||||||
'globalAIKefuConfig',
|
'globalAIKefuConfig',
|
||||||
'aiUnreadCount'
|
'aiUnreadCount'
|
||||||
]),
|
]),
|
||||||
|
enableAIKefuButton() {
|
||||||
|
return this.buttonConfig?.type === 'aikefu' && this.enableAIChat;
|
||||||
|
},
|
||||||
aiAgentimg() {
|
aiAgentimg() {
|
||||||
return this.globalAIKefuConfig?.icon || this.$util.getDefaultImage().aiAgent || '';
|
return this.globalAIKefuConfig?.icon || this.$util.getDefaultImage().aiAgent || '';
|
||||||
},
|
},
|
||||||
@@ -141,6 +151,7 @@ export default {
|
|||||||
this.$util.redirectTo('/pages_tool/ai-chat/index');
|
this.$util.redirectTo('/pages_tool/ai-chat/index');
|
||||||
},
|
},
|
||||||
contactServicer() {
|
contactServicer() {
|
||||||
|
|
||||||
this.customerService.handleCustomerClick();
|
this.customerService.handleCustomerClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,8 +146,31 @@
|
|||||||
nsNavbar,
|
nsNavbar,
|
||||||
toTop
|
toTop
|
||||||
},
|
},
|
||||||
mixins: [diyJs, scroll, indexJs]
|
mixins: [diyJs, scroll, indexJs],
|
||||||
|
methods: {
|
||||||
|
// 新增:电话按钮点击事件-弹出对话框
|
||||||
|
openCallDialog() {
|
||||||
|
uni.showModal({
|
||||||
|
title: "拨打?【仅为模拟】", // 弹窗标题
|
||||||
|
content: "", // 弹窗内容(可留空)
|
||||||
|
confirmText: "确定", // 确定按钮文字
|
||||||
|
cancelText: "取消", // 取消按钮文字
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 点击“确定”后的操作(比如实际拨号)
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber: "13800138000" // 替换为实际要拨打的号码
|
||||||
|
});
|
||||||
|
} else if (res.cancel) {
|
||||||
|
// 点击“取消”后的操作(可留空)
|
||||||
|
console.log('用户取消拨打');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user