Browse Source

在线客服

zhaoxiaohai 3 years ago
parent
commit
ad5c604581

+ 17 - 4
pages/tabbar-pages/customer-service-staff/index.js

@@ -4,16 +4,25 @@ Page({
      * 页面的初始数据
      */
     data: {
-
+        show: true,
+        phoneNumber: "17757394388"
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-
+    onLoad: function (options) {},
+    onClose() {
+        this.setData({
+            show: !this.data.show
+        })
+    },
+    /* 呼叫电话 */
+    CallOut() {
+        wx.makePhoneCall({
+            phoneNumber: this.data.phoneNumber
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
@@ -26,6 +35,9 @@ Page({
      */
     onShow: function () {
         this.getTabBar().init();
+        this.setData({
+            show: true
+        })
     },
 
     /**
@@ -35,6 +47,7 @@ Page({
 
     },
 
+
     /**
      * 生命周期函数--监听页面卸载
      */

+ 8 - 0
pages/tabbar-pages/customer-service-staff/index.wxml

@@ -1,2 +1,10 @@
 <!-- 自定义头部 -->
 <My_navBar></My_navBar>
+
+<view style="position: absolute; top: 48%; width: 100vw; padding: 0 150rpx; box-sizing: border-box;">
+    <van-button plain type="primary" size="large" color='#4BBECF' bindtap="onClose">联系客服</van-button>
+</view>
+
+<van-dialog use-slot title="在线客服" show="{{ show }}" confirmButtonText='呼叫' show-cancel-button bind:close="onClose" bind:confirm="CallOut" confirm-button-color="#4BBECF">
+    <view style="text-align: center; height: 150rpx; line-height: 150rpx;">请联系:{{phoneNumber}}</view>
+</van-dialog>