uni-app 微信小(xiǎo)程序客服聊天和發送頁面卡片功能(néng)
發布日期 :2023-08-23
很多(duō)新學習微信小(xiǎo)程序的朋友(yǒu)都不知道,微信小(xiǎo)程序其實早就(jiù)有了自(zì)已的客服功能(néng),隻要加幾行代碼就(jiù)可以實現客服與用戶用手機(jī)
無障礙的實時進行溝通(tōng),現在把微信小(xiǎo)程序客服聊天和發送頁面卡片功能(néng)實現步驟公布出來,實例如下(xià):
(一(yī)):首先登錄微信公衆平台 :https://mp.weixin.qq.com/
登錄成功後找到(dào)----->功能(néng)-----> 客服---->添加客服--->輸入微信号---->搜索----->确定添加
網頁端客服地址:https://mpkf.weixin.qq.com/
使用綁定的客服微信賬号,掃一(yī)掃二維碼登錄,成功後就(jiù)可以看(kàn)到(dào)接收、回複客戶發的信息
點擊頭像還(hái)可以設置賬号在線和離線
如果退出網頁端客服,可以在綁定的客服手機(jī)微信賬号中搜索 「客服小(xiǎo)助手」小(xiǎo)程序進行客服消息回複 、查看(kàn)客戶咨詢的信息
(二):在代碼中加入button按鈕,當用戶點擊客服進行發信息咨詢時,綁定客服微信的人員(yuán)就(jiù)能(néng)接收和回複信息
<button open-type='contact' plain="true" session-from='' class="contact">
<text class="iconfont icon-kefu"></text>
<text class="text">客服</text>
</button>
(三):如果要實現客服中發送頁面卡片功能(néng),就(jiù)要在button 中新增幾個(gè)屬性即可
<!-- uni-app 寫法 -->
<button
open-type="contact"
plain="true"
show-message-card="true"
:send-message-title="goods.name"
:send-message-img="goods.cover_pic"
:send-message-path="`/pages/product/product?id=${goods.id}`"
class="kefu">
<view class="kefu_button">
<text class="iconfont icon-kefu"></text>
<text>客服</text>
</view>
</button>
<!-- 微信小(xiǎo)程序寫法 -->
<!-- <button
open-type="contact"
send-message-title="{{goods.name}}"
send-message-img="{{goods.cover_pic}}"
send-message-path="/pages/goods/goods?id={{goods.id}}"
show-message-card
plain
class="kefu">
<view class="kefu_button">
<text class="iconfont icon-kefu"></text>
<text>客服</text>
</view>
</button> -->
button 按鈕 open-type 有很多(duō)的開(kāi)放(fàng)能(néng)力 ,分享、客服、登錄獲取個(gè)人信息等等、、、
查看(kàn)文檔地址:https://uniapp.dcloud.io/component/button
————————————————