index.vue 2.31 KB
<template>
  <view class="h-page">
    <CustomNavBar :title="t('PreMenu.regionalStatistics')" />
    <view :style="`position: fixed;z-index: 99;top: ${navHeight+44}px;`">
      <PageOptions @change="handleChange"></PageOptions>
    </view>
    <view style="height: 164rpx;"></view>
    <AreaStatisticsComp ref="areaStatisticRef" />
  </view>
</template>

<script setup>
  import {
    ref,
    onMounted,
    computed,
    nextTick
  } from 'vue'

  import {
    getUserIndicatorIndexApi,
    getAreaAnalysisStatisApi
  } from '@/api'
  import PageOptions from '@/components/PageOptions.vue'
  import CustomNavBar from '@/components/CustomNav.nvue'
  import AreaStatisticsComp from './components/AreaStatisticsComp.vue'
  import {
    t
  } from '@/plugins/index.js'

  // 组件ref
  const areaStatisticRef = ref(null)

  const params = ref({})
  const flag = ref(false) // 是否初始化完成

  const handleChange = (e, type) => {
    params.value = e
    // if (flag.value && e.storeId) {
    //   params.value.currentKey = e.indicatorKey || currentKey.value
    nextTick(() => {
      areaStatisticRef.value?.initData(params.value)
    })
    // }
    // if (type === 'indicatorKey') {
    //   currentKey.value = e.indicatorKey
    // }
  }

  /**********  指标相关  *********/
  // const indicatorsOptions = {
  //   label: 'indexName',
  //   value: 'indexKey'
  // }
  // onMounted(() => {
  //   initIndicatorList()
  //   flag.value = true
  // })
  // const currentKey = ref('')
  // const indicatorsList = ref([])
  // const initIndicatorList = async () => {
  //   try {
  //     const {
  //       data
  //     } = await getUserIndicatorIndexApi({
  //       id: params.value.storeId
  //     })
  //     indicatorsList.value = data?.filter(item => item.status === 1) || []
  //     currentKey.value = data.length > 0 ? data[0].indexKey : ''
  //     params.value.currentKey = currentKey.value
  //     areaStatisticRef.value?.initData(params.value)
  //   } catch (e) {
  //     console.log(e);
  //   }
  // }
</script>

<style lang="scss">
  @import '@/styles/table.scss';

  .h-page {
    min-height: 100vh;
    background-color: #f2f3f6;

    .h-c-container {
      padding: 0 20rpx 20rpx;
    }
  }

  .table-body-item-value-text.increase {
    color: #00B274;
  }

  .table-body-item-value-text.decrease {
    color: #FF3000;
  }
</style>