bloc.vue 5.18 KB
<template>
  <div class="bloc-info-module">
    <div class="wrapper">
      <div class="wrap_left">
        <div v-for="(item, index) in leftData" :key="index" class="out_box_wrap">
          <div class="fixed_widget">
            <div class="label_text">版本:{{ item.name }}</div>
            <div class="label_text dr_top">
              开通门店数:
              <span class="num_text">{{ item.num }}家</span>
            </div>
            <div class="label_text dr_top">门店详情</div>
          </div>
          <div :class="item.open ? 'table_wrapper_open' : 'table_wrapper_close'">
            <glsx-table v-if="item.open" :hasPage="false" :tableParams="tableParams" :tableData="item.list" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"></glsx-table>
          </div>
          <div class="fixed_footer" @click="changeLeftOpenStatus(item, index)">
            <i :class="item.open ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
            <span class="dr_left">{{ item.open ? '隐藏门店详情' : '展开门店详情' }}</span>
          </div>
        </div>
      </div>
      <div class="wrap_right">
        <div v-for="(item, index) in rightData" :key="index" class="out_box_wrap">
          <div class="fixed_widget">
            <div class="label_text">版本:{{ item.name }}</div>
            <div class="label_text dr_top">
              开通门店数:
              <span class="num_text">{{ item.num }}家</span>
            </div>
            <div class="label_text dr_top">门店详情</div>
          </div>
          <div :class="item.open ? 'table_wrapper_open' : 'table_wrapper_close'">
            <glsx-table v-if="item.open" 
            :hasPage="false" 
            :tableParams="tableParams" 
            :tableData="item.list"
            :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }" 
            ></glsx-table>
          </div>
          <div class="fixed_footer" @click="changeRightOpenStatus(item, index)">
            <i :class="item.open ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
            <span class="dr_left">{{ item.open ? '隐藏门店详情' : '展开门店详情' }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: '',
  data() {
    return {
      curOpenIndex: 0,
      dataList: [],
      leftData: [],
      rightData: [],
      tableParams: {
        listName:'list',
        tableColumns: [
          {
            label: '门店名称',
            prop: 'name'
          },
          {
            label: '有效期',
            prop: 'stateDate'
          }
        ]
      }
    }
  },
  methods: {
    changeLeftOpenStatus(item, index) {
      this.leftData[index].open = !item.open
    },
    changeRightOpenStatus(item, index) {
      this.rightData[index].open = !item.open
    },
    handlerData() {
      let arr = this.dataList
      let left = []
      let right = []
      arr.forEach((item, index) => {
        if (index % 2 == 0) {
          left.push(item)
        } else {
          right.push(item)
        }
      })
      this.leftData = left
      this.rightData = right
      console.log(left);
      console.log(right);
    },
    monidata() {
      let arr = []
      for (let i = 0; i < 3; i++) {
        let obj = {
          id: i + 1,
          open:false,
          name:'嘀嘀虎',
          num:i+10,
          list: [
            {
              name: '1之花',
              stateDate: '2021-09-29',
              sort: 1
            },
            {
              name: '2之花',
              stateDate: '2021-09-29',
              sort: 2
            },
            {
              name: '3之花',
              stateDate: '2021-09-29',
              sort: 3
            }
          ]
        }
        arr.push(obj)
      }
      this.dataList = arr
      this.handlerData()
    }
  },
  mounted() {
    this.monidata()
  }
}
</script>
<style lang="scss" scoped>
.bloc-info-module {
  box-sizing: border-box;
  padding: 20px 0 0 40px;
}
.wrapper {
  display: flex;
  flex-wrap: wrap;
  .wrap_left,
  .wrap_right {
    width: 44.8%;
    min-height: 176px;
  }
  .wrap_left {
    margin-right: 40px;
  }
}
.out_box_wrap {
  width: 100%;
  min-height: 176px;
  box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
  border-radius: 10px;
  border: 1px solid #e5e4ff;
  margin: 0 40px 40px 0;
  .fixed_widget {
    width: 100%;
    height: 140px;
    box-sizing: border-box;
    padding: 20px 0 0 20px;
    .label_text {
      color: #333333;
      font-size: 14px;
      font-weight: 400;
    }
    .num_text {
      font-size: 14px;
      font-weight: 400;
      color: #5850ff;
    }
    .dr_top {
      margin-top: 20px;
    }
  }
  .table_wrapper_close {
    height: 0%;
    transition: height 0.3s ease-in-out;
  }
  .table_wrapper_open {
    height: 494px;
    transition: height 0.3s ease-in-out;
  }
  .fixed_footer {
    width: 100%;
    height: 36px;
    background: #f4f6fc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 400;
    color: #b9b8c7;
    border-radius: 0px 0px 10px 10px;
    cursor: pointer;
    .dr_left {
      margin-left: 12px;
    }
  }
}
</style>