<template>
  <div class="page-header-index-wide">
    <div class="query-box">
      <a-range-picker @change="onChangeData" />
      <a-button type="primary" @click="searchQuery" style="margin-left: 20px;">查询</a-button>
    </div>
    <div class="data-box">
      <div class="statistics">
        <p style="color:#666;margin-bottom:5px;">绑定商铺数量</p>
        <p style="margin-bottom:0;color:#333;font-size:24px;line-height:1;">100</p>
      </div>
      <div class="statistics">
        <p style="color:#666;margin-bottom:5px;">平台总小区数量</p>
        <p style="margin-bottom:0;color:#333;font-size:24px;line-height:1;">100</p>
      </div>

      <div class="statistics">
        <p style="color:#666;margin-bottom:5px;">平台总业主数量</p>
        <p style="margin-bottom:0;color:#333;font-size:24px;line-height:1;">100</p>
      </div>

      <div class="statistics">
        <p style="color:#666;margin-bottom:5px;">合作伙伴分利</p>
        <p style="margin-bottom:0;color:#333;font-size:24px;line-height:1;">¥100.00</p>
      </div>

      <div class="statistics">
        <p style="color:#666;margin-bottom:5px;">新增订单数量</p>
        <p style="margin-bottom:0;color:#333;font-size:24px;line-height:1;">100</p>
      </div>
      <div class="statistics">
        <p style="color:#666;margin-bottom:5px;">总营收</p>
        <p style="margin-bottom:0;color:#333;font-size:24px;line-height:1;">¥100.00</p>
      </div>
      <div class="statistics">
        <p style="color:#666;margin-bottom:5px;">本月营收</p>
        <p style="margin-bottom:0;color:#333;font-size:24px;line-height:1;">¥100.00</p>
      </div>
      <div class="statistics" style="margin-right: 0;">
        <p style="color:#666;margin-bottom:5px;">今日营收</p>
        <p style="margin-bottom:0;color:#333;font-size:24px;line-height:1;">¥100.00</p>
      </div>
    </div>
    <a-row :gutter="24">
      <a-col :sm="24" :md="12" :xl="12" :style="{ marginBottom: '20px' }">
        <div class="t-box">
          <h3 class="box-title">最新成交订单</h3>
          <div class="order">
            <div class="order-title"><span
                style="width: 30%;">订单编号</span><span>提交时间</span><span>用户账号</span><span>订单金额</span></div>
            <vue-seamless-scroll :data="listData" class="seamless-warp" :class-option="defineScroll">
              <div v-for="(item, index) in listData" :key="index" class="item">
                <span
                  style="width: 30%;">{{ item.num }}</span><span>{{ item.date }}</span><span>{{ item.account }}</span><span>{{ item.amount }}</span>
              </div>
            </vue-seamless-scroll>
          </div>
        </div>
      </a-col>
      <a-col :sm="24" :md="12" :xl="12" :style="{ marginBottom: '20px' }">
        <div class="t-box">
          <h3 class="box-title">月成交金额</h3>
          <line-chart-multid :dataSource="dayData" :fields="dayFields" style="padding: 0;" />
        </div>
      </a-col>
    </a-row>
    <a-row :gutter="24">
      <a-col :sm="24" :md="12" :xl="12" :style="{ marginBottom: '20px' }">
        <div class="t-box">
          <h3 class="box-title">月成交订单数量</h3>
          <div>
            <line-chart-multid :dataSource="dayData" :fields="dayFields" style="padding: 0;" />
          </div>
        </div>
      </a-col>
      <a-col :sm="24" :md="12" :xl="12" :style="{ marginBottom: '20px' }">
        <div class="t-box">
          <h3 class="box-title">入驻商铺新增数量</h3>
          <bar :dataSource="barData" style="padding: 0;" />
        </div>
      </a-col>
    </a-row>
    <a-row :gutter="24">
      <a-col :sm="24" :md="12" :xl="12" :style="{ marginBottom: '20px' }">
        <div class="t-box">
          <h3 class="box-title">巡报订单数量</h3>
          <div>
            <line-chart-multid :dataSource="dayData1" :fields="dayFields1" style="padding: 0;" />
          </div>
        </div>
      </a-col>
      <a-col :sm="24" :md="12" :xl="12" :style="{ marginBottom: '20px' }">
        <div class="t-box">
          <h3 class="box-title">巡报订单金额</h3>
          <line-chart-multid :dataSource="dayData1" :fields="dayFields1" style="padding: 0;" />
        </div>
      </a-col>
    </a-row>
  </div>
</template>

<script>
import Bar from '@/components/chart/Bar'
import LineChartMultid from '@/components/chart/LineChartMultid'
import vueSeamlessScroll from 'vue-seamless-scroll'
import { getDataStatisticsApi, getLoginfo, getVisitInfo, auditPropertyApi } from '@/api/api'
export default {
  name: 'statistical',
  components: {
    Bar,
    LineChartMultid,
    vueSeamlessScroll,
  },
  data() {
    return {
      loading: true,
      payData: [],
      barData: [],
      dayFields: ['月成交订单数量'],
      dayData: [
        { type: '1月', 月成交订单数量: 71 },
        { type: '2月', 月成交订单数量: 61.9 },
        { type: '3月', 月成交订单数量: 19.5 },
        { type: '4月', 月成交订单数量: 141.5 },
        { type: '5月', 月成交订单数量: 118.4 },
        { type: '6月', 月成交订单数量: 211.5 },
        { type: '7月', 月成交订单数量: 251.2 },
        { type: '8月', 月成交订单数量: 216.5 },
        { type: '9月', 月成交订单数量: 213.3 },
        { type: '10月', 月成交订单数量: 181.3 },
        { type: '11月', 月成交订单数量: 131.9 },
        { type: '12月', 月成交订单数量: 91.6 },
      ],
      listData: [
        {
          num: '201707196398345',
          date: '2023-07-19',
          account: '18000000000',
          amount: '¥200.00',
        },
        {
          num: '201707196398345',
          date: '2023-07-19',
          account: '18000000000',
          amount: '¥200.00',
        },
        {
          num: '201707196398345',
          date: '2023-07-19',
          account: '18000000000',
          amount: '¥200.00',
        },
        {
          num: '201707196398345',
          date: '2023-07-19',
          account: '18000000000',
          amount: '¥200.00',
        },
        {
          num: '201707196398345',
          date: '2023-07-19',
          account: '18000000000',
          amount: '¥200.00',
        },
        {
          num: '201707196398345',
          date: '2023-07-19',
          account: '18000000000',
          amount: '¥200.00',
        },
        {
          num: '201707196398345',
          date: '2023-07-19',
          account: '18000000000',
          amount: '¥200.00',
        },
        {
          num: '201707196398345',
          date: '2023-07-19',
          account: '18000000000',
          amount: '¥200.00',
        },
      ],
      dayFields1: ['巡报订单数量'],
      dayFields2: ['巡报订单金额'],
      dayData1: [
        { type: '7月1日', 巡报订单数量: 171 },
        { type: '7月10日', 巡报订单数量: 161.9 },
        { type: '7月20日', 巡报订单数量: 119.5 },
        { type: '7月30日', 巡报订单数量: 141.5 },
        { type: '8月10日', 巡报订单数量: 118.4 },
        { type: '8月20日', 巡报订单数量: 211.5 },
        { type: '8月30日', 巡报订单数量: 251.2 },
        { type: '9月10日', 巡报订单数量: 216.5 },
        { type: '9月20日', 巡报订单数量: 213.3 },
        { type: '9月30日', 巡报订单数量: 81.3 },
      ],
    }
  },
  created() {
    setTimeout(() => {
      this.loading = !this.loading
    }, 1000)
    for (let i = 0; i < 12; i += 1) {
      this.barData.push({
        x: `${i + 1}月`,
        y: i + 10,
      })
    }
  },
  computed: {
    defineScroll() {
      return {
        step: 0.5, // 数值越大速度滚动越快
        limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
        hoverStop: true, // 是否开启鼠标悬停stop
        direction: 1, // 0向下 1向上 2向左 3向右
        openWatch: true, // 开启数据实时监控刷新dom
        singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
        singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
        waitTime: 1000, // 单步运动停止的时间(默认值1000ms)
      }
    },
  },
  methods: {
    onChangeData(date, dateString) {
      if (dateString.length > 0) {
        this.queryParam.createTime_begin = dateString[0]
        this.queryParam.createTime_end = dateString[1]
      } else {
        this.queryParam.createTime_begin = ''
        this.queryParam.createTime_end = ''
      }
    },
    searchQuery() {},
  },
}
</script>

<style lang="less" scoped>
.page-header-index-wide {
  padding: 16px;

  .query-box {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
  }
  .data-box {
    display: flex;
    margin-bottom: 20px;
    justify-content: space-between;
  }
  .statistics {
    background: #fff;
    width: 11.5%;
    box-sizing: border-box;
    border: 1px solid #e0dfdf;
    padding: 25px 10px;
    max-height: 100px;
    text-align: center;
  }
}
.t-box {
  background: #fff;
  padding: 15px;
  border: 1px solid #e0dfdf;
  height: 340px;
}
.box-title {
  font-weight: bold;
  margin-bottom: 15px;
  display: inline-block;
  padding-left: 10px;
  border-left: 3px solid #1890ff;
  height: 20px;
  line-height: 20px;
}
.order {
  margin: 0 10px;
  .order-title {
    background: #fafafa;
    height: 40px;
    line-height: 40px;
    display: flex;
    border-left: 1px solid #e8e8e8;
    span {
      width: 25%;
      border-right: 1px solid #e8e8e8;
      border-top: 1px solid #e8e8e8;
      text-align: center;
      font-weight: bold;
    }
  }
  .seamless-warp {
    border: 1px solid #e8e8e8;
    border-right: none;
    .item {
      height: 40px;
      line-height: 40px;
      display: flex;
      span {
        width: 25%;
        border-right: 1px solid #e8e8e8;
        border-top: 1px solid #e8e8e8;
        text-align: center;
      }
    }
  }
}
.seamless-warp {
  height: 220px;
  overflow: hidden;
}
</style>