<template>
  <view class="work-container">

         <!-- 宫格组件 -->
         <uni-section title="常用功能" v-show="auth.hasPermi('invest:accountsBalance:list')"  type="line"></uni-section>
    <view class="grid-body">
      <uni-grid :column="4" :showBorder="false" >
        <uni-grid-item v-for="(item, index) in commonGridList" :key="index" v-show="auth.hasPermi(item.permission)" @click="navigateTo(item.path)">
        <view class="grid-item-box">
            <uni-icons :type="item.icon" size="30"></uni-icons>
            <text class="text">{{ item.text }}</text>
          </view>
      </uni-grid-item>
      </uni-grid>
    </view>

    <!-- 宫格组件 -->
    <uni-section title="账单统计分析" v-show="auth.hasPermi('invest:accountAnalysis:list')"  type="line"></uni-section>
    <view class="grid-body">
      <uni-grid :column="4" :showBorder="false" >
        <uni-grid-item v-for="(item, index) in billGridList" :key="index" v-show="auth.hasPermi(item.permission)" @click="navigateTo(item.path)">
        <view class="grid-item-box">
            <uni-icons :type="item.icon" size="30"></uni-icons>
            <text class="text">{{ item.text }}</text>
          </view>
      </uni-grid-item>
      </uni-grid>
    </view>
             <!-- 宫格组件 -->
             <uni-section title="记账统计分析" v-show="auth.hasPermi('invest:accountsBalance:list')"  type="line"></uni-section>
    <view class="grid-body">
      <uni-grid :column="4" :showBorder="false" >
        <uni-grid-item v-for="(item, index) in accountGridList" :key="index" v-show="auth.hasPermi(item.permission)" @click="navigateTo(item.path)">
        <view class="grid-item-box">
            <uni-icons :type="item.icon" size="30"></uni-icons>
            <text class="text">{{ item.text }}</text>
          </view>
      </uni-grid-item>
      </uni-grid>
    </view>
  </view>
</template>

<script setup>
	import { ref } from "vue";
  import auth from "@/plugins/auth"; // 建议使用auth进行鉴权操作
  const commonGridList=ref([
        { path: '/pages/statistic/accounts/accountsBalance/index', text: '记账账户统计', icon: 'staff-filled' , permission: 'invest:accountsBalance:list' },
        { path: '/pages/statistic/accounts/posAnalysis/index', text: 'POS机刷卡统计', icon: 'shop-filled' , permission: 'invest:posAnalysis:list' },
        { path: '/pages/statistic/accounts/creditCardDealAnalysis/index', text: '信用卡收支统计', icon: 'wallet' , permission: 'invest:accountDealRecord:list' },
        { path: '/pages/statistic/bill/creditBillAnalysis/index', text: '信用卡账单统计', icon: 'map', permission: 'invest:creditAnalysis:list'  },
        { path: '/pages/statistic/accounts/accountDealAnalysis/index', text: '账户收支统计', icon: 'person', permission: 'invest:accountDealAnalysis:list'  },
        { path: '/pages/statistic/accounts/investDealAnalysis/index', text: '投资收益统计', icon: 'arrow-down', permission: 'invest:investDealAnalysis:list'  },
        { path: '/pages/statistic/bill/onlineLendAnalysis/index', text: '网贷待还统计', icon: 'cloud-upload', permission: 'invest:onlineLendAnalysis:list'  },
        { path: '/pages/statistic/bill/creditInstallmentAnalysis/index', text: '信用卡分期待还', icon: 'map-filled', permission: 'invest:creditInstallment:list'  },
        { path: '/pages/statistic/bill/creditRecordAnalysis/index', text: '征信查询统计', icon: 'search', permission: 'invest:creditRecordAnalysis:list'  }
      ])
  const billGridList=ref([
        // { path: '/pages/page1/page1', text: '账户总览', icon: 'person-filled', permission: 'invest:accountAnalysis:list'  },
        { path: '/pages/statistic/bill/investAnalysis/index', text: '收益统计分析', icon: 'arrow-down', permission: 'invest:investAnalysis:list'  },
        { path: '/pages/statistic/bill/futuresAnalysis/index', text: '期货统计分析', icon: 'settings', permission: 'invest:futuresAnalysis:list'  },
        { path: '/pages/statistic/bill/stocksAnalysis/index', text: '股票统计分析', icon: 'left', permission: 'invest:stocksAnalysis:list'  },
        { path: '/pages/statistic/bill/onlineLendAnalysis/index', text: '网贷待还统计', icon: 'cloud-upload', permission: 'invest:onlineLendAnalysis:list'  },
        { path: '/pages/statistic/bill/onlineLendSettledAnalysis/index', text: '网贷已还统计', icon: 'download', permission: 'invest:onlineLendSettledAnalysis:list'  },
        { path: '/pages/statistic/bill/creditBillAnalysis/index', text: '信用卡账单统计', icon: 'map', permission: 'invest:creditAnalysis:list'  },
        { path: '/pages/statistic/bill/creditInstallmentAnalysis/index', text: '信用卡分期待还', icon: 'map-filled', permission: 'invest:creditInstallment:list'  },
        { path: '/pages/statistic/bill/creditInstallmentSettledAnalysis/index', text: '信用卡分期已还', icon: 'map-pin-ellipse', permission: 'invest:creditInstallmentSettledAnalysis:list'  },
        { path: '/pages/statistic/bill/creditRecordAnalysis/index', text: '征信查询统计', icon: 'search', permission: 'invest:creditRecordAnalysis:list'  }
      ])
      const accountGridList=ref([
        { path: '/pages/statistic/accounts/accountsBalance/index', text: '记账账户统计', icon: 'staff-filled' , permission: 'invest:accountsBalance:list' },
        { path: '/pages/statistic/accounts/posAnalysis/index', text: 'POS机刷卡统计', icon: 'shop-filled' , permission: 'invest:posAnalysis:list' },
        { path: '/pages/statistic/accounts/debitDealAnalysis/index', text: '储蓄卡收支统计', icon: 'wallet-filled', permission: 'invest:accountDealRecord:list'  },
        { path: '/pages/statistic/accounts/creditCardDealAnalysis/index', text: '信用卡收支统计', icon: 'wallet' , permission: 'invest:accountDealRecord:list' },
        { path: '/pages/statistic/accounts/investDealAnalysis/index', text: '投资收益统计', icon: 'arrow-down', permission: 'invest:investDealAnalysis:list'  },
        { path: '/pages/statistic/accounts/accountDealAnalysis/index', text: '账户收支统计', icon: 'person', permission: 'invest:accountDealAnalysis:list'  }
      ])

	function navigateTo(path) {
    uni.navigateTo({
        url: path
      });
	}

</script>

<style lang="scss">
  /* #ifndef APP-NVUE */
  page {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background-color: #fff;
    min-height: 100%;
    height: auto;
  }

  view {
    font-size: 20px;
    line-height: inherit;
  }

  /* #endif */

  .text {
    text-align: center;
    font-size: 22rpx;
    margin-top: 10rpx;
  }

  .grid-item-box {
    flex: 1;
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
  }

  .uni-margin-wrap {
    width: 690rpx;
    width: 100%;
    ;
  }

  .swiper {
    height: 300rpx;
  }

  .swiper-box {
    height: 150px;
  }

  .swiper-item {
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    height: 300rpx;
    line-height: 300rpx;
  }

  @media screen and (min-width: 500px) {
    .uni-swiper-dot-box {
      width: 400px;
      /* #ifndef APP-NVUE */
      margin: 0 auto;
      /* #endif */
      margin-top: 8px;
    }

    .image {
      width: 100%;
    }
  }
</style>
