<template>
  <view class="message" @click="handleServiceChat">
    <view class="info-msg">
      <image src="@/static/mmm.png"></image>
      <!-- <icon class="iconfont icon-xiaoxi2"></icon> -->
      <text>咨询</text>
    </view>

  </view>
</template>

<script>
  import {
    mapState
  } from "vuex";
  export default {
    data() {
      return {
        data: {}
      }
    },
    computed: {
      ...mapState(["configBox"]),
    },
    mounted() {},
    methods: {
      handleServiceChat() {
        let that = this
        console.log("configBox", this.configBox)
        if (!that.configBox.serviceappid) {
          that.$tools.msg("小程序还未配置微信客服")
          return
        }
        wx.openCustomerServiceChat({
          extInfo: { //客服链接
            url: that.configBox.serviceurl
          },
          corpId: that.configBox.serviceappid, //企业ID
          success(res) {}
        })
      }
    }
  }
</script>

<style scoped lang="scss">
  .message {
    position: fixed;
    top: 33%;
    z-index: 99;
    right: 10px;
    background: #3967d6;
    width: 45px;
    height: 45px;
    padding: 2px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;

    .info-msg {
      display: flex;
      justify-content: center;
      align-content: center;
      flex-wrap: wrap;
    }

    icon {
      font-size: 18px;
    }

    image {
      width: 22px;
      height: 22px;
      margin-top: 3px;

    }

    text {
      width: 100%;
      display: inline-block;
      text-align: center;
    }
  }
</style>
