customer.vue 3.32 KB
<template>
  <div class="tagContainer">
    <template v-if="customerInfoList && customerInfoList.length > 0">
      <div class="customerList">
        <scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
          <div class="customer" v-for="(item) in customerInfoList" :key="item.id" @click="gotoInfo(item)">
            <div class="customer-portrait">
              <img :src="item.avatar" alt="" v-if="item.avatar" />
              <img src="../../assets/images/user.png" alt="" v-else />
            </div>
            <div class="customer-info">
              <div class="customer-info-name">
                <label class="name text-hide">
                  {{ item.customerName }}
                </label>

                <label class="origin">{{ item.type == 1 ? '@微信' : item.type == 2 ? '@企微' : '' }}</label>
              </div>
            </div>
            <div class="buttomLine"></div>
          </div>
        </scroll-view>
      </div>
    </template>
    <empty v-else description="暂无数据" />
  </div>
</template>
<script>
import { wxConfig } from '@/api'
import { mapState } from 'vuex'
export default {
  data() {
    return {

    }
  },
  name: 'customer',
  computed: {
    ...mapState({
      customerInfoList: state => state.solicit.customerInfoList
    })
  },
  mounted() {
    // this.initWx()
  },
  methods: {
    //初始化微信接口
    initWx() {
      wxConfig.init(['openEnterpriseChat']).then(() => { })
    },
    //打开会话
    gotoInfo(item) {
      let seach = {
        userIds: [this.workUserId], //参与会话的企业成员列表,格式为userid1;userid2;...,用分号隔开。
        externalUserIds: [item.userid], // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
        groupName: '', // 会话名称。单聊时该参数传入空字符串""即可。
        chatId: ''
      }
      wxConfig.openEnterpriseChat(seach).then(res => {
        //   console.log(res)
      })
    },
    onReachBottom() {
      this.$refs.scrollView.loading = false
      this.$refs.scrollView.finished = true
    }
  }
}
</script>
<style lang="scss" scoped>
.tagContainer {
  .customerList {

    //   background: #fff;
    .customer {
      padding: 0 8px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      position: relative;

      .customer-portrait {
        width: 44px;
        height: 44px;
        padding: 12px 16px;

        img {
          width: 100%;
        }
      }

      .customer-info {
        padding: 16px 0;
        width: calc(100% - 130px);

        .customer-info-name {
          font-size: 16px;
          line-height: 22px;
          color: #333333;
          display: flex;

          .name {
            max-width: 70%;
          }

          .origin {
            font-size: 14px;
            color: #2cca74;
            margin-left: 6px;
          }
        }
      }
    }
  }

  .buttomLine {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 375px !important;
    height: 1px;
    opacity: 0.3;
    background-color: #c3c3c3 !important;
  }
}

.tagContainer /deep/ .van-checkbox__icon--checked .van-icon {
  color: #fff;
  background-color: #3975c6 !important;
  border-color: #3975c6 !important;
}

.tagContainer /deep/.van-checkbox__icon .van-icon {
  width: 16px;
  height: 16px;
}
</style>