KfModal.vue 3.27 KB
<template>
  <van-overlay :show="show">
    <div class="wrapper" @click.self="cancel">
      <div :class="['kf-box flex', { short: !detail.customerServiceQrImg }]">
        <div class="sprite-icon icon-kf-box"></div>
        <div class="sprite-icon icon-kf-logo x-center"></div>
        <div class="info">
          <div class="name">{{ detail.customerServiceName }}</div>
          <template v-if="detail.customerServicePhone">
            <div class="phone flex" @click="makePhoneCall(detail.customerServicePhone)">
              <div class="sprite-icon icon-phone"></div>
              {{ detail.customerServicePhone }}
            </div>
          </template>
        </div>
        <template v-if="detail.customerServiceQrImg">
          <div class="qr-box">
            <div class="sprite-icon icon-qr"></div>
            <img :src="detail.customerServiceQrImg" class="qr xy-center" />
          </div>
          <div class="bottom flex">
            <div class="item flex">
              <div class="sprite-icon icon-download"></div>
              <div>
                保存图片
                <br />
                到相册
              </div>
            </div>
            <div class="item flex">
              <div class="sprite-icon icon-scan"></div>
              <div>
                打开微信扫一扫
                <br />
                添加客服企微
              </div>
            </div>
          </div>
        </template>
      </div>
    </div>
  </van-overlay>
</template>
<script type="text/ecmascript-6">
export default {
  name: 'KfModal',
  props: ['value', 'detail'],
  data () {
    return {
      show: false,
      img: null
    }
  },
  mounted () { },
  watch: {
    value (n) {
      this.show = n
    }
  },
  methods: {
    cancel () {
      this.show = false
      this.$parent.showKf = false
    },
    save () {
      this.showToast('请长按二维码保存')
    }
  }
}
</script>
<style scoped lang="scss">
.van-overlay {
  z-index: 3;
}
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex-direction: column;
  .kf-box {
    width: 300px;
    height: 350px;
    position: relative;
    flex-direction: column;
    font-size: 18px;
    font-weight: 500;
    color: #282829;
    .icon-kf-box {
      position: absolute;
    }
    .icon-kf-logo {
      top: -15px;
    }
    .info {
      position: relative;
      z-index: 2;
      text-align: center;
      padding-top: 64px;
      .phone {
        letter-spacing: 2px;
        margin-top: 1px;
      }
    }
    .qr-box {
      position: relative;
      width: 143px;
      height: 142px;
      margin: 10px 0 16px;
      .qr {
        width: calc(100% - 32px);
        height: calc(100% - 32px);
      }
    }
    .bottom {
      position: absolute;
      left: 0;
      bottom: 0;
      z-index: 2;
      width: 100%;
      height: 70px;
      background: #f7f8fa;
      border-radius: 0px 0px 10px 10px;
      box-sizing: border-box;
      padding: 0 20px;
      justify-content: space-between;
      .item {
        padding-left: 7px;
        font-size: 12px;
        color: #b1b1b3;
        .sprite-icon {
          margin-right: 6px;
        }
      }
    }
  }
  .short {
    height: 140px;
    .icon-kf-box {
      height: 100%;
      border-radius: 12px;
    }
  }
}
</style>