支持自定义客服

master
gongfuxiang 2024-05-08 23:09:18 +08:00
parent 5720a3ce87
commit 2880d116e9
2 changed files with 32 additions and 31 deletions

View File

@ -2674,12 +2674,9 @@
longitude: res.longitude || null, longitude: res.longitude || null,
status: 1, status: 1,
}); });
clearInterval(self.data.get_user_location_timer);
},
fail: function(res) {
clearInterval(self.data.get_user_location_timer);
} }
}); });
clearInterval(self.data.get_user_location_timer);
} }
}, 500); }, 500);
} }

View File

@ -3,7 +3,7 @@
<block v-if="online_service_status == 1"> <block v-if="online_service_status == 1">
<!-- 是否商品页样式 --> <!-- 是否商品页样式 -->
<view v-if="propIsGoods == true" class="goods-chat-container item fl cp"> <view v-if="propIsGoods == true" class="goods-chat-container item fl cp">
<block v-if="is_chat == 1"> <block v-if="is_chat == 1 || (common_app_customer_service_custom || null) != null">
<view @tap="chat_event"> <view @tap="chat_event">
<image class="icon" :src="common_static_url+'chat-icon.png'" mode="scaleToFill"></image> <image class="icon" :src="common_static_url+'chat-icon.png'" mode="scaleToFill"></image>
<text class="text dis-block text-size-xs cr-grey">{{$t('online-service.online-service.4l6k22')}}</text> <text class="text dis-block text-size-xs cr-grey">{{$t('online-service.online-service.4l6k22')}}</text>
@ -13,17 +13,21 @@
<!-- #ifdef MP-WEIXIN || MP-TOUTIAO || MP-BAIDU || MP-KUAISHOU --> <!-- #ifdef MP-WEIXIN || MP-TOUTIAO || MP-BAIDU || MP-KUAISHOU -->
<button open-type="contact" :show-message-card="propCard" :send-message-title="propTitle" :send-message-path="propPath" :send-message-img="propImg"> <button open-type="contact" :show-message-card="propCard" :send-message-title="propTitle" :send-message-path="propPath" :send-message-img="propImg">
<image class="icon" :src="common_static_url+'chat-icon.png'" mode="scaleToFill"></image> <image class="icon" :src="common_static_url+'chat-icon.png'" mode="scaleToFill"></image>
<text class="text dis-block text-size-xs cr-grey">{{$t('online-service.online-service.4l6k22')}}</text>
</button>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-ALIPAY --> <!-- #ifdef MP-ALIPAY -->
<button open-type="contact" class="alipay-contact"> <button open-type="contact" class="alipay-contact">
<contact-button :tnt-inst-id="mini_alipay_tnt_inst_id" :scene="mini_alipay_scene" :alipay-card-no="mini_alipay_openid || ''" :icon="common_static_url+'chat-icon.png'" size="40rpx*40rpx" /> <contact-button :tnt-inst-id="mini_alipay_tnt_inst_id" :scene="mini_alipay_scene" :alipay-card-no="mini_alipay_openid || ''" :icon="common_static_url+'chat-icon.png'" size="40rpx*40rpx" />
<text class="text dis-block text-size-xs cr-grey">{{$t('online-service.online-service.4l6k22')}}</text>
</button>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef H5 || APP --> <!-- #ifdef H5 || APP -->
<button type="default" @tap="call_event"> <button type="default" @tap="call_event">
<image class="icon" :src="common_static_url+'chat-icon.png'" mode="scaleToFill"></image> <image class="icon" :src="common_static_url+'chat-icon.png'" mode="scaleToFill"></image>
<!-- #endif -->
<text class="text dis-block text-size-xs cr-grey">{{$t('online-service.online-service.4l6k22')}}</text> <text class="text dis-block text-size-xs cr-grey">{{$t('online-service.online-service.4l6k22')}}</text>
</button> </button>
<!-- #endif -->
</block> </block>
</view> </view>
<!-- 默认浮动展示-可拖拽位置 --> <!-- 默认浮动展示-可拖拽位置 -->
@ -33,7 +37,7 @@
<movable-view direction="all" :x="x" :y="y" :animation="false" class="online-service-event-submit spread"> <movable-view direction="all" :x="x" :y="y" :animation="false" class="online-service-event-submit spread">
<view class="ring"></view> <view class="ring"></view>
<view class="ring"></view> <view class="ring"></view>
<block v-if="is_chat == 1"> <block v-if="is_chat == 1 || (common_app_customer_service_custom || null) != null">
<button type="default" :class="common_ent" @tap="chat_event"> <button type="default" :class="common_ent" @tap="chat_event">
<image class="icon dis-block" :src="common_static_url+'online-service-icon.png'"></image> <image class="icon dis-block" :src="common_static_url+'online-service-icon.png'"></image>
</button> </button>
@ -69,9 +73,11 @@
return { return {
theme_view: app.globalData.get_theme_value_view(), theme_view: app.globalData.get_theme_value_view(),
common_static_url: app.globalData.get_static_url('common'), common_static_url: app.globalData.get_static_url('common'),
client_value: app.globalData.application_client_type(),
is_chat: 0, is_chat: 0,
chat_url: null, chat_url: null,
common_app_customer_service_tel: null, common_app_customer_service_tel: null,
common_app_customer_service_custom: null,
online_service_status: 0, online_service_status: 0,
is_online_service_fixed: app.globalData.data.is_online_service_fixed, is_online_service_fixed: app.globalData.data.is_online_service_fixed,
mini_alipay_tnt_inst_id: null, mini_alipay_tnt_inst_id: null,
@ -165,9 +171,6 @@
top: 250, top: 250,
height_dec: this.propIsBar ? 350 : 250, height_dec: this.propIsBar ? 350 : 250,
// #endif // #endif
// 使
is_chat: this.propIsChat || this.is_chat,
chat_url: this.propChatUrl || this.chat_url,
// //
common_ent: this.propIsGrayscale ? 'grayscale' : '' common_ent: this.propIsGrayscale ? 'grayscale' : ''
}); });
@ -175,33 +178,33 @@
methods: { methods: {
// //
init_config(status) { init_config(status) {
// ( 1 -> 2 -> 3 -> 4 )
if ((status || false) == true) { if ((status || false) == true) {
// 使 // 使
var is_chat = app.globalData.get_config('plugins_base.chat.data.is_mobile_chat', 0); var is_chat = app.globalData.get_config('plugins_base.chat.data.is_mobile_chat', 0);
var chat_url = app.globalData.get_config('plugins_base.chat.data.chat_url'); var chat_url = app.globalData.get_config('plugins_base.chat.data.chat_url');
if(is_chat == 1 && chat_url != null) { if(is_chat == 1 && (chat_url != null || (this.propChatUrl || null) != null)) {
this.setData({ this.setData({
is_chat: is_chat, is_chat: is_chat,
chat_url: chat_url, chat_url: this.propChatUrl || chat_url,
common_app_customer_service_tel: app.globalData.get_config('config.common_app_customer_service_tel'),
online_service_status: app.globalData.get_config('config.common_app_is_online_service', 0) online_service_status: app.globalData.get_config('config.common_app_is_online_service', 0)
}); });
} else { } else {
// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-BAIDU || MP-ALIPAY || MP-KUAISHOU || H5 || APP var online_service_url = app.globalData.get_config('config.common_app_customer_service_custom', null);
this.setData({ this.setData({
common_app_customer_service_tel: app.globalData.get_config('config.common_app_customer_service_tel'), common_app_customer_service_tel: app.globalData.get_config('config.common_app_customer_service_tel', null),
common_app_customer_service_custom: (online_service_url == null || (online_service_url[this.client_value] || null) == null) ? null : online_service_url[this.client_value],
online_service_status: app.globalData.get_config('config.common_app_is_online_service', 0) online_service_status: app.globalData.get_config('config.common_app_is_online_service', 0)
}); });
// #endif
//
// #ifdef H5 || APP var arr = ['qq', 'h5', 'ios', 'android'];
if((this.common_app_customer_service_tel || null) == null) { if(arr.indexOf(this.client_value) != -1 && (this.common_app_customer_service_tel || null) == null && (this.common_app_customer_service_custom || null) == null) {
this.setData({ this.setData({
online_service_status: 0 online_service_status: 0
}); });
} }
// #endif
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
// 线openid // 线openid
if(this.online_service_status == 1) if(this.online_service_status == 1)
@ -219,19 +222,20 @@
} }
}, },
// //
call_event() { chat_event() {
if (this.common_app_customer_service_tel == null) { if(this.is_chat == 1) {
app.globalData.showToast(this.$t('setup.setup.utnr7g')); //
app.globalData.chat_entry_handle(this.chat_url);
} else { } else {
app.globalData.call_tel(this.common_app_customer_service_tel); //
app.globalData.url_open(this.common_app_customer_service_custom);
} }
}, },
// //
chat_event() { call_event() {
var url = this.propChatUrl || this.chat_url || null; app.globalData.call_tel(this.common_app_customer_service_tel);
app.globalData.chat_entry_handle(url);
} }
} }
}; };