page.vue 12.3 KB
Newer Older
乐宝呗666's avatar
乐宝呗666 committed
1 2
<template>
  <d2-container class="business">
3 4 5 6 7 8 9 10 11 12 13 14
    <headerLayout></headerLayout>
    <div class="section">
      <div class="leftBlock">
        <div class="boxHeight-3">
          <div class="title">商机统计</div>
          <div class="businessStatistics d-flex">
            <div class="circle">商机统计</div>
            <div class="circle circleOut"></div>
            <div class="flex-1">
              <div class="box">
                <div class="boxTitle">商机总数<span>(个)</span></div>
                <div class="boxValue">{{totalObj.opportunitiesNumber}}</div>
15
              </div>
16 17 18
              <div class="box">
                <div class="boxTitle">整体预算<span>(百万)</span></div>
                <div class="boxValue">{{totalObj.budget| numFilter}}</div>
19
              </div>
20
            </div>
21 22 23 24 25
            <div class="horizontal"></div>
            <div class="flex-1">
              <div class="box">
                <div class="boxTitle">本月新增<span>(个)</span></div>
                <div class="boxValue">{{(totalObj.newOpportunities|| 0)}}</div>
乐宝呗666's avatar
乐宝呗666 committed
26
              </div>
27 28 29
              <div class="box">
                <div class="boxTitle">预计毛利<span>(百万)</span></div>
                <div class="boxValue">{{totalObj.budgetGrossProfit | numFilter }}</div>
乐宝呗666's avatar
乐宝呗666 committed
30
              </div>
31
            </div>
32
            <div class="horizontal"></div>
33
            <div class="flex-1">
34 35 36 37 38 39 40 41
              <div class="box">
                <div class="boxTitle">售前参与<span>(个)</span></div>
                <div class="boxValue">{{totalObj.saler}}</div>
              </div>
              <div class="box">
                <div class="boxTitle">预计成本<span>(百万)</span></div>
                <div class="boxValue">{{totalObj.budgetCost | numFilter }}</div>
              </div>
42
            </div>
43 44 45
            <div class="horizontal horizontal1 "></div>
            <div class="horizontal horizontal1 horizontal2"></div>
            <div class="vertical"></div>
乐宝呗666's avatar
乐宝呗666 committed
46 47
          </div>
        </div>
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
        <div class="boxHeight-3 mt-2">
          <div class="title">行业分布</div>
          <pieChart @downData="downDistributeData" :message="typeDistribute" idstr="typeDistribute" class="heightCut44"></pieChart>
        </div>
        <div class="boxHeight-3 mt-2">
          <div class="title">商机分布</div>
          <barChart :message="bussionDistribute" idstr="bussionDistribute" class="heightCut44 mt-2"></barChart>
        </div>
      </div>
      <div class="centerBlock">
        <div class="centerBoxHeight-32 d-flex flex-column">
          <div class="select-box mt-2">
              <div class="tab-chart">
                  <span class="tab-button" @click="chartActive=1" :class="{'is-active':chartActive=== 1 }">数量</span>
                  <span class="tab-button" @click="chartActive=2" :class="{'is-active':chartActive=== 2 }">金额</span>
              </div>
乐宝呗666's avatar
乐宝呗666 committed
64
          </div>
65 66 67 68 69 70 71 72 73
          <div class="flex-1 d-flex">
            <div class="flex-1">
              <div class="title">商机阶段分析</div>
              <funnel :message="bussionStep" :idstr="'bussionStep'" class="heightCut44"></funnel>
            </div>
            <div class="flex-1">
              <div class="title">商机类型</div>
              <pieChart :message="bussionType" idstr="bussionType" class="heightCut44"></pieChart>
            </div>
乐宝呗666's avatar
乐宝呗666 committed
74
          </div>
75 76
          <div class="flex-1">
            <doubleYBarChart @downData="downData" :message="bussionAnalysis" idstr="bussionAnalysis" class="heightCut44 mt-1"></doubleYBarChart>
乐宝呗666's avatar
乐宝呗666 committed
77
          </div>
乐宝呗666's avatar
乐宝呗666 committed
78
        </div>
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
        <div class="centerBoxHeight-3 mt-2">
          <div class="title">合同税率分布</div>
          <doubleYBarChart :message="taxRateDistribute" idstr="taxRateDistribute" class="heightCut44 mt-1"></doubleYBarChart>
        </div>
      </div>
      <div class="rightBlock">
        <div class="boxHeight-3">
          <div class="title">商机成功率</div>
          <doubleYBarChart :message="successRatio" idstr="successRatio" class="heightCut44 mt-1"></doubleYBarChart>
        </div>
        <div class="boxHeight-3 mt-2">
          <div class="title">新商机分析</div>
          <doubleYBarChart :message="newBussAnalysis" idstr="newBussAnalysis" class="heightCut44 mt-1"></doubleYBarChart>
        </div>
        <div class="boxHeight-3 mt-2">
          <div class="title">产品类型分析</div>
          <pieChart @downData="downTypeData" :message="typeAnalysis" idstr="typeAnalysis" class="heightCut44"></pieChart>
        </div>
乐宝呗666's avatar
乐宝呗666 committed
97 98 99 100 101 102
      </div>
    </div>
  </d2-container>
</template>

<script>
103
import headerLayout from '@/components/headerLayout/index' // 公共头部
104 105 106 107
import pieChart from '@/components/echarts/pieChart' // 行业分布-饼图
import barChart from '@/components/echarts/barChart' // 商机分布-柱图
import doubleYBarChart from '@/components/echarts/doubleYBarChart' // 新商机分析-柱加折线图
import funnel from '@/components/echarts/funnel' // 梯形图
乐宝呗666's avatar
乐宝呗666 committed
108 109
import * as API_BUSSINESS from '@/api/con.business.js'
export default {
110
  components: { headerLayout, pieChart, barChart, doubleYBarChart, funnel },
乐宝呗666's avatar
乐宝呗666 committed
111 112
  data () {
    return {
113
      chartActive: 1,
114 115
      totalObj: {}, // 商机统计
      industry: '',
116
      // 行业分布
117 118
      typeDistribute: {},
      productType: '',
119
      // 产品类型分析
120
      typeAnalysis: {},
121
      // 商机分布
122
      bussionDistribute: {},
123
      // 新商机分析
124
      newBussAnalysis: {},
125
      // 合同税率分布
126 127 128
      taxRateDistribute: {},
      // 商机预算及硬蛋率
      successRatio: {},
129 130 131
      // 商机分析-中间图
      bussionAnalysis: {
        legend: ['初步接洽', '需求确定', '方案/报价', '谈判审核', '赢单'],
132
        xAxis: ['运营管理中心', '解决方案中心', '智能制造中心', '生态合作中心', '客户运营中心', 'XXXX中心'],
133 134 135 136 137
        yAxis: ['单位:个', '赢单率:%'],
        data: [
          {
            name: '初步接洽',
            type: 'bar',
138 139 140 141 142 143 144 145
            data: [
              { value: 123.2, isLeaf: false, parent: '' },
              { value: 125.6, isLeaf: false, parent: '' },
              { value: 176.7, isLeaf: false, parent: '' },
              { value: 135.6, isLeaf: false, parent: '' },
              { value: 162.2, isLeaf: false, parent: '' },
              { value: 200, isLeaf: false, parent: '' }
            ]
146 147 148
          }, {
            name: '需求确定',
            type: 'bar',
149 150 151 152 153 154 155 156
            data: [
              { value: 83.2, isLeaf: false, parent: '' },
              { value: 75.6, isLeaf: false, parent: '' },
              { value: 86.7, isLeaf: false, parent: '' },
              { value: 85.6, isLeaf: false, parent: '' },
              { value: 62.2, isLeaf: false, parent: '' },
              { value: 90, isLeaf: false, parent: '' }
            ]
157 158 159 160
          }, {
            name: '方案/报价',
            type: 'bar',
            yAxisIndex: 1,
161 162 163 164 165 166 167 168
            data: [
              { value: 74.5, isLeaf: false, parent: '' },
              { value: 66.3, isLeaf: false, parent: '' },
              { value: 70.2, isLeaf: false, parent: '' },
              { value: 80.3, isLeaf: false, parent: '' },
              { value: 53.4, isLeaf: false, parent: '' },
              { value: 87, isLeaf: false, parent: '' }
            ]
169 170 171 172
          }, {
            name: '谈判审核',
            type: 'bar',
            yAxisIndex: 1,
173 174 175 176 177 178 179 180
            data: [
              { value: 64.5, isLeaf: false, parent: '' },
              { value: 56.3, isLeaf: false, parent: '' },
              { value: 60.2, isLeaf: false, parent: '' },
              { value: 70.3, isLeaf: false, parent: '' },
              { value: 43.4, isLeaf: false, parent: '' },
              { value: 77, isLeaf: false, parent: '' }
            ]
181 182 183 184
          }, {
            name: '赢单',
            type: 'bar',
            yAxisIndex: 1,
185 186 187 188 189 190 191 192
            data: [
              { value: 54.5, isLeaf: false, parent: '' },
              { value: 46.3, isLeaf: false, parent: '' },
              { value: 50.2, isLeaf: false, parent: '' },
              { value: 60.3, isLeaf: false, parent: '' },
              { value: 33.4, isLeaf: false, parent: '' },
              { value: 65, isLeaf: false, parent: '' }
            ]
193 194 195 196
          }, {
            name: '赢单率',
            type: 'line',
            yAxisIndex: 1,
197 198 199 200 201 202 203 204
            data: [
              { value: 4.5, isLeaf: false, parent: '' },
              { value: 6.3, isLeaf: false, parent: '' },
              { value: 10.2, isLeaf: false, parent: '' },
              { value: 20.3, isLeaf: false, parent: '' },
              { value: 23.4, isLeaf: false, parent: '' },
              { value: 30.2, isLeaf: false, parent: '' }
            ]
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
          }
        ]
      },
      // 商机类型
      bussionType: {
        legend: ['服务续签', '其他', '特殊事项'],
        data: [
          { value: 335, name: '服务续签' },
          { value: 310, name: '其他' },
          { value: 234, name: '特殊事项' }
        ]
      },
      // 商机阶段分析
      bussionStep: {
        legend: ['初步接洽', '需求确定', '方案/报价', '谈判审核', '赢单', '输单', '终止', '暂停'],
        data: [
          { value: 335, name: '初步接洽' },
          { value: 280, name: '需求确定' },
          { value: 234, name: '方案/报价' },
          { value: 190, name: '谈判审核' },
          { value: 185, name: '赢单' },
          { value: 120, name: '输单' },
          { value: 89, name: '终止' },
          { value: 23, name: '暂停' }
        ]
230
      }
乐宝呗666's avatar
乐宝呗666 committed
231 232 233
    }
  },
  mounted () {
234 235 236 237 238 239 240
    this.getOpportunitiesStatistics()
    this.getDistribution()
    this.getOpportunitiesDistribution()
    this.getTaxRate()
    this.getProductType()
    this.getNewOpportunities()
    this.getBillRate()
乐宝呗666's avatar
乐宝呗666 committed
241 242 243 244 245
  },
  filters: {
    numFilter (value) {
      value = value / 1000000
      // 截取当前数据到小数点后两位(以百万元为单位)
246
      const realVal = parseFloat(value).toFixed(2)
乐宝呗666's avatar
乐宝呗666 committed
247 248 249 250
      return realVal
    }
  },
  methods: {
251 252 253 254 255 256 257 258 259 260 261 262 263 264
    // 商机统计
    async  getOpportunitiesStatistics () {
      const _data = await API_BUSSINESS.getOpportunitiesStatistics()
      this.totalObj = _data.data[0]
    },
    // 行业分布
    async getDistribution () {
      const _data = await API_BUSSINESS.getDistribution({ industry: this.industry || null })
      const _distribute = {
        legend: _data.data.legend,
        data: _data.data.data.map(item => {
          return {
            name: item.industry,
            value: Number(item.value)
乐宝呗666's avatar
乐宝呗666 committed
265 266
          }
        })
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
      }
      this.typeDistribute = _distribute
    },
    // 商机分布
    async getOpportunitiesDistribution () {
      const _data = await API_BUSSINESS.getOpportunitiesDistribution()
      this.bussionDistribute = _data.data
    },
    // 合同税率
    async getTaxRate () {
      const _data = await API_BUSSINESS.getTaxRate()
      this.taxRateDistribute = _data.data
      this.taxRateDistribute.data = this.taxRateDistribute.data.map(item => {
        item.barWidth = '25%'
        return item
      })
    },
    // 产品类型分析
    async getProductType () {
      const _data = await API_BUSSINESS.getProductType({ type: this.productType || null })
      const _typeAnalysis = {
        legend: _data.data.legend,
        data: _data.data.data.map(item => {
          return {
            name: item.productType || item.name,
            value: Number(item.number)
乐宝呗666's avatar
乐宝呗666 committed
293 294
          }
        })
295 296 297 298 299 300 301 302 303 304
      }
      this.typeAnalysis = _typeAnalysis
    },
    // 新商机分析
    async getNewOpportunities () {
      const _data = await API_BUSSINESS.getNewOpportunities()
      this.newBussAnalysis = _data.data
      this.newBussAnalysis.data = this.newBussAnalysis.data.map(item => {
        item.barWidth = '25%'
        return item
乐宝呗666's avatar
乐宝呗666 committed
305
      })
306
    },
307 308 309 310 311
    // 商机成功率
    async getBillRate () {
      const _data = await API_BUSSINESS.getBillRate()
      this.successRatio = _data.data
    },
312 313
    // 行业分布下钻数据
    downDistributeData (item) {
314 315 316
      console.log('传来的值:', item)
      this.industry = item
      this.getDistribution()
317 318 319 320
    },
    // 产品类型分析下钻数据
    downTypeData (item) {
      console.log('pie传来的值:', item)
321 322
      this.productType = item
      this.getProductType()
323 324
    },
    downData (item) {
325

乐宝呗666's avatar
乐宝呗666 committed
326 327 328 329 330 331 332 333
    }
  }
}
</script>

<style lang="scss" scoped>
  @import '~@/assets/style/business.scss';
</style>