<template>
    <view class="work-container">
        <!-- 轮播图 -->
        <uni-swiper-dot :current="current" :info="data" class="uni-swiper-dot-box" field="content">
            <swiper :current="swiperDotIndex" class="swiper-box" @change="changeSwiper">
                <swiper-item v-for="(item, index) in data" :key="index">
                    <view class="swiper-item" @click="clickBannerItem(item)">
                        <image :draggable="false" :src="item.image" mode="aspectFill"/>
                    </view>
                </swiper-item>
            </swiper>
        </uni-swiper-dot>

        <!-- 宫格组件 -->
        <uni-section title="订单管理" type="line"></uni-section>
        <view class="grid-body">
            <uni-grid :column="4" :showBorder="false" @change="changeGrid">
                <uni-grid-item @click="gotoOrderManager">
                    <view class="grid-item-box">
                        <uni-icons size="30" type="person-filled"></uni-icons>
                        <text class="text">订单管理</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item @click="gotoOrder">
                    <view class="grid-item-box">
                        <uni-icons size="30" type="person-filled"></uni-icons>
                        <text class="text">订单审核</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item @click="gotoFinalcial">
                    <view class="grid-item-box">
                        <uni-icons size="30" type="person-filled"></uni-icons>
                        <text class="text">财务审批</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item @click="gotoBusiness">
                    <view class="grid-item-box">
                        <uni-icons size="30" type="person-filled"></uni-icons>
                        <text class="text">商务审批</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item @click="gotoOrderSearchQuery">
                    <view class="grid-item-box">
                        <uni-icons size="30" type="person-filled"></uni-icons>
                        <text class="text">订单综合查询</text>
                    </view>
                </uni-grid-item>
            </uni-grid>
        </view>

        <uni-section title="系统设置" type="line"></uni-section>
        <view class="grid-body">
            <uni-grid :column="4" :showBorder="false" @change="changeGrid">
                <uni-grid-item>
                    <view class="grid-item-box" @click="jiansheing">
                        <uni-icons size="30" type="staff-filled"></uni-icons>
                        <text class="text">角色管理</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item>
                    <view class="grid-item-box" @click="jiansheing">
                        <uni-icons size="30" type="color"></uni-icons>
                        <text class="text">菜单管理</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item>
                    <view class="grid-item-box" @click="jiansheing">
                        <uni-icons size="30" type="settings-filled"></uni-icons>
                        <text class="text">部门管理</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item>
                    <view class="grid-item-box" @click="jiansheing">
                        <uni-icons size="30" type="heart-filled"></uni-icons>
                        <text class="text">岗位管理</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item>
                    <view class="grid-item-box" @click="jiansheing">
                        <uni-icons size="30" type="bars"></uni-icons>
                        <text class="text">字典管理</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item>
                    <view class="grid-item-box" @click="jiansheing">
                        <uni-icons size="30" type="gear-filled"></uni-icons>
                        <text class="text">参数设置</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item>
                    <view class="grid-item-box">
                        <uni-icons size="30" type="chat-filled"></uni-icons>
                        <text class="text">通知公告</text>
                    </view>
                </uni-grid-item>
                <uni-grid-item>
                    <view class="grid-item-box">
                        <uni-icons size="30" type="wallet-filled"></uni-icons>
                        <text class="text">日志管理</text>
                    </view>
                </uni-grid-item>
            </uni-grid>
        </view>
    </view>
</template>

<script setup>
import {getCurrentInstance, ref} from "vue"

const {proxy} = getCurrentInstance()
const current = ref(0)
const swiperDotIndex = ref(0)
const data = ref([{image: '/static/images/banner/background.jpg'}])

function clickBannerItem(item) {
    console.info(item)
}

function changeSwiper(e) {
    current.value = e.detail.current
}

function changeGrid(e) {
    // proxy.$modal.showToast('模块建设中~')
}

function jiansheing(e) {
    proxy.$modal.showToast('模块建设中~')
}

const gotoBusiness = () => {
    uni.navigateTo({
        url: '/pages/work/BusinessApproval/index'
    })
}
const gotoFinalcial = () => {
    uni.navigateTo({
        url: '/pages/work/FinancialApproval/index'
    })
}
const gotoOrder = () => {
    uni.navigateTo({
        url: '/pages/work/OrderApproval/index'
    })
}
const gotoOrderManager = () => {
    uni.navigateTo({
        url: '/pages/work/OrderManager/index'
    })
}

const gotoOrderSearchQuery = () => {
    uni.navigateTo({
        url: '/pages/work/OrderSearchQuery/index'
    })
}

</script>

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

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

/* #endif */

.text {
    text-align: center;
    font-size: 26rpx;
    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>
