| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <view class="content">
- <view style="width: 100%;" v-if="currentIndex === 1">
- <homePage :workTypeData="workTypeData" :ticketsData="ticketsData"></homePage>
- </view>
- <view style="width: 100%;" v-if="currentIndex === 2">
- <stat></stat>
- </view>
- <view style="width: 100%;" v-if="currentIndex === 3">
- <mine :workTypeData="workTypeData" :userInfo="userInfo"></mine>
- </view>
- <view style="width: 100%;height: 160rpx;"></view>
- <x-tabbar :currentIndex="currentIndex" @switchTab="switchTab"></x-tabbar>
- </view>
- </template>
- <script setup lang="ts">
- import { GetOrderList, GetRepairStatus } from "@/api/order";
- import { GetInfo } from "@/api/login";
- import homePage from '@/pages/index/index.vue'
- import stat from '@/pages/stat/index.vue'
- import mine from '@/pages/mine/index.vue'
- import { onLaunch, onShow, onHide, onReady } from "@dcloudio/uni-app";
- import { ref, nextTick } from 'vue'
- const currentIndex = ref(1)
- const switchTab = (val : any) => {
- currentIndex.value = val.key
- if (currentIndex.value == 1) {
- } else if (currentIndex.value == 2) {
- } else if (currentIndex.value == 3) {
- getInfoList()
- }
- }
- const ticketsData : any = ref([])
- // 用户信息
- const userInfo : any = ref({})
- // 工单状态列表
- const workTypeData : any = ref([])
- onLaunch(() => {
- // uni.hideTabBar();
- })
- const listFlag = ref(true)
- onReady(() => {
- // #ifdef APP-PLUS
- plus.navigator.setStatusBarStyle("light");
- // #endif
- })
- onShow(() => {
- // #ifdef APP-PLUS
- plus.navigator.setStatusBarStyle("light");
- // #endif
- nextTick(() => {
- if (listFlag && currentIndex.value == 1) {
- listFlag.value = false
- getList(1)
- } else if (currentIndex.value == 3) {
- getInfoList()
- }
- getRepairStatus()
- })
- })
- // 获取列表工单
- const getList = (status : any) => {
- GetOrderList({
- isMe: true,
- pageNum: 1,
- pageSize: 999,
- orderStatus: status,
- state: '1749115737095',
- }).then((res : any) => {
- if (res.code == 200) {
- ticketsData.value = res.rows
- listFlag.value = true
- }
- })
- }
- // 获取工单状态
- const getRepairStatus = () => {
- GetRepairStatus({}).then((res : any) => {
- if (res.code == 200) {
- let arrData = res.data
- workTypeData.value = [{
- icon: 'pending',
- color: '#E6A23C',
- title: arrData[0].dictLabel,
- }, {
- icon: 'underway',
- color: '#409EFF',
- title: arrData[1].dictLabel,
- }, {
- icon: 'done',
- color: '#67C23A',
- title: arrData[2].dictLabel,
- }, {
- icon: 'stale',
- color: '#909399',
- title: arrData[3].dictLabel,
- }]
- }
- })
- }
- // 获取用户信息列表
- const getInfoList = () => {
- GetInfo({}).then((res : any) => {
- if (res.code == 200) {
- userInfo.value = res.user
- }
- })
- }
- </script>
- <style>
- .content {
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .pagebox {
- width: 100%;
- }
- </style>
|