follow.vue 4.97 KB
<template>
  <div class="follow-container" v-if="flag">
    <div class="follow-statistics flex m-b-16">
      <template v-for="(s, i) in statisticList">
        <div class="follow-statistics-single" :key="i">
          <div class="font-24 color-3 fw7 line-36">{{ s.value(solicitationFollowData) }}</div>
          <div class="font-12 color-2f m-t-4">{{ s.text }}</div>
        </div>
      </template>
    </div>
    <tab-customer :list="['企微营销', '电话招揽']" @change="changeFollow" :index="follewIndex">
      <scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
        <template v-if="solicitationFollowData.weComMarketingList && solicitationFollowData.weComMarketingList.length > 0">
          <div class="follow-content">
            <div class="follow-content-item m-b-12" v-for="(item, index) in solicitationFollowData.weComMarketingList" :key="index">
              <div class="follow-content-item-top">
                <div class="font-16 color-3 fw5 text-hide">{{ item.groupName }}</div>
                <div class="m-t-8 flex-between fw7">
                  <div class="font-24 line-36 color-3">
                    {{ item.groupWeComCustomerCount }}
                    <span class="font-12 color-2f m-l-8 fw4">个企微客户</span>
                  </div>
                  <div class="font-12 color-2f fw4">招揽月份:{{ item.solicitationMonth }}月</div>
                </div>
              </div>
              <template v-if="follewIndex == 0">
                <div class="flex">
                  <div class="color39 font-14 p52 nowrap" @click="goTo('solicit.marketing', item)">一键营销</div>
                  <div class="colord8">|</div>
                  <div class="color39 font-14 p52 nowrap" @click="goTo('solicit.statistic', item)">触达统计</div>
                </div>
              </template>
              <template v-else>
                <div class="follow-btn">
                  <div class="color39 font-14" @click="goTo('solicit.lookCustomer', item)">查看客户</div>
                </div>
              </template>
            </div>
          </div>
        </template>
        <template v-else>
          <empty description="暂无数据" />
        </template>
      </scroll-view>
    </tab-customer>
  </div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex'
import { solicitApi } from '@/api'
import { Toast } from 'vant'
import { Notify } from 'vant'
export default {
  data() {
    return {
      flag: false,
      solicitationFollowData: {
        solicitationTotal: 20,
        solicitationWeComCustomerCount: 30,
        solicitationNotWeComCustomerCount: 20,
        weComMarketingList: []
      },
      statisticList: []
    }
  },
  computed: {
    ...mapState({
      follewIndex: state => state.solicit.follewIndex,
      activityId: state => state.solicit.activityId,
      staffId: state => state.solicit.staffId
    })
  },
  created() {
    this.statisticList = this.$constants.STATICLIST
    this.getFollowDataList()
    this.solicitationFollow()
  },
  methods: {
    ...mapMutations({
      SET_FOLLOW_INDEX: 'solicit/SET_FOLLOW_INDEX'
    }),
    ...mapActions({
      getFollowDataList: 'solicit/getFollowDataList'
    }),
    solicitationFollow() {
      let params = {
        activityId: this.activityId,
        staffId: this.staffId
      }
      this.showLoading()
      solicitApi.solicitationFollow(params).then(({ code, data, message }) => {
        this.hideLoading()
        if (code == '0') {
          this.solicitationFollowData = data
        } else {
          Notify(message)
        }
        this.flag = true
      })
    },

    goTo(name, item) {
      let { groupId, groupName } = item
      let query = { groupId }
      if (name !== 'solicit.marketing') {
        query.groupName = groupName
      }
      this.$router.push({
        name,
        query
      })
    },
    changeFollow(index) {
      this.SET_FOLLOW_INDEX({ follewIndex: index })
    },
    onReachBottom() {
      this.$refs.scrollView.loading = false
      this.$refs.scrollView.finished = true
    }
  }
}
</script>
<style lang="scss" scoped>
.follow-container {
  .follow-statistics {
    background: #fff;
    height: 82px;
    box-shadow: 0px 3px 10px 0px rgba(223, 228, 234, 0.81);
    border-radius: 4px;
    &-single {
      padding: 12px 0;
      width: 33.3%;

      div {
        text-align: center;
      }
    }
  }

  .content {
    height: calc(100vh - 232px);

    .follow-content {
      padding: 16px 12px;
      box-sizing: border-box;

      &-item {
        background: #f7f7f7;
        border-radius: 8px;
        height: 140px;

        &-top {
          padding: 16px 16px 0 16px;
          border-bottom: 1px solid rgba(216, 216, 216, 0.3);
          height: 96px;
          box-sizing: border-box;
        }

        .follow-btn {
          padding: 10px 52px;
          box-sizing: border-box;
          text-align: center;
        }
      }
    }
  }

  .custom-image {
    background: #fff;
    height: 100%;
  }
}
</style>