blocCon.vue 4.77 KB
<template>
  <div class="bloc-chart-container">
    <div class="mid_line">
      <img src="../../assets/scrm_bar_table_icon.png">
    </div>
    <div class="chart_wrapper">
      <line-chart :width="width" ref="myline" echartId="myline" @changeDate="changeCurDate"></line-chart>
    </div>
    <div class="table-wrapper">
      <div class="top_line flex_scb">
        <span :style="[{ 'font-size': todayName.length > 20 ? '12px' : '' }]" class="h7_title">{{ todayName }},各门店明细</span>
        <div class="right_wrap flex_scb">
          <el-radio size="mini" v-model="orderByType" :label="1" @change="changeType(1)">
            <span class="h15_title">按分账金额排序</span>
          </el-radio>
          <el-radio size="mini" v-model="orderByType" :label="2" @change="changeType(2)">
            <span class="h15_title">按分润金额排序</span>
          </el-radio>
        </div>
      </div>
      <div class="table_widget">
        <GLTable ref="table" :hasPage="false" max-height="270" :tableData="productValueInfo" :tableParams="tableParams"></GLTable>
      </div>
    </div>
    <div v-if="!show" class="openBtn h18_title" @click="showContainer">
      <span>展开详情</span>
      <img src="../../assets/down_icon.png" />
    </div>
  </div>
</template>

<script>
import line from '../../components/service-echart/line.vue'
import { orderTotalOfJT } from '../../api/modules/rules'
import { converterApi } from '../../api/modules/converter'
import utils from '../../util/util'
export default {
  name: '',
  components: {
    'line-chart': line
  },
  props: {
    show: {
      type: Boolean,
      default: false
    },
    width:{
      type:Number,
      default:400
    }
  },
  data() {
    return {
      radio: 0,
      tableData: [],
      tableParams: {
        tableOption: false,
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        tableColumns: [
          {
            label: '门店名称',
            prop: 'merchantName'
          },
          {
            label: '分润金额 / (实际)分账金额',
            prop: 'money'
          }
        ]
      },
      //集团
      todayName: '',
      orderByType: 1,
      productValueInfo: [],
      productList: []
    }
  },
  mounted() {
    this.todayName = utils.dateFormat(new Date(), 'YYYY年MM月DD日')
    this.today = utils.dateFormat(new Date())
    const { session } = this.$globalState
    if (session.accountLevel != 4) {
      this.orderDataInfoOfJT(this.today, this.today)
    }
  },
  methods: {
    showContainer() {
      this.show = true
      this.$emit('showRanking', true)
    },
    // 切换radio
    changeType(type) {
      this.orderByType = type
      this.orderDataInfoOfJT(this.curStartTime, this.curEndTime)
    },
    // 集团统计
    orderDataInfoOfJT(start, end) {
      let method = orderTotalOfJT()
      let para = {
        routerMethod: method,
        beginDateStr: start,
        endDateStr: end,
        reportType: 2,
        orderByType: this.orderByType //1 分账  2分润
      }
      converterApi(para).then(res => {
        this.productValueInfo = res.map(item => {
          item.money = `¥${item.profitMoney} / ¥${item.divisionMoney}`
          return item
        })
        this.curStartTime = start
        this.curEndTime = end
      })
    },
    // 更换时间折线图
    changeTimeForLine(start, end) {
      this.$refs.myline.couponsChartData(start, end)
      this.todayName = `${utils.dateFormat(start, 'YYYY年MM月DD日')}至${utils.dateFormat(end, 'YYYY年MM月DD日')}`
    },
    // 获取点击的日期
    changeCurDate(e){
      this.todayName = utils.dateFormat(new Date(e), 'YYYY年MM月DD日')
      this.orderDataInfoOfJT(e,e)
    }
  }
}
</script>
<style lang="scss" scoped>
.bloc-chart-container {
  height: 400px;
  position: relative;
  display: flex;
  .mid_line {
    // width: 1px;
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, 0);
    height: 350px;
    display: flex;
    align-items: center;
    // background: #e8e8ea;
    >img{
      width: 18px;
      height: 155px;
    }
  }
  .chart_wrapper {
    width: 50%;
    height: 350px;
    // background: #999;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .table-wrapper {
    width: 50%;
    height: 350px;
    box-sizing: border-box;
    padding: 13px 22px 0 20px;
    .top_line {
      .right_wrap {
        width: 50%;
      }
    }
    .table_widget {
      margin-top: 7px;
    }
  }
}
.openBtn {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 0);
  bottom: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  > img {
    margin-left: 5px;
    width: 10px;
    height: 9px;
  }
}
// .bloc-chart-container /deep/ .el-table__body-wrapper {
//   height: 270px;
//   overflow-y: scroll;
// }
</style>