index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view class="index">
  3. <view class="index-header">
  4. <view class="index-header-box">
  5. <view class="index-header-box-1">
  6. <view class="left">
  7. <text>欢迎你!{{ vuex_user.operName }}</text>
  8. </view>
  9. <view class="right">
  10. <u-icon size="21" name="../../static/icons/logout-icon.svg" @click="logout"></u-icon>
  11. </view>
  12. </view>
  13. <view class="index-header-box-2">
  14. <text>普定智慧停车<br />运营中心</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="index-main">
  19. <view class="index-main-menu">
  20. <!-- 数据概览 -->
  21. <view class="index-main-menu-1">
  22. <view class="menu-item" v-for="(item, index) in analysisMenuList" :key="index" @click="jumpPage(item.url)">
  23. <view class="menu-item-icon">
  24. <u-icon size="48" :name="item.icon"></u-icon>
  25. </view>
  26. <view class="menu-item-name">
  27. <text>{{ item.name }}</text>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 订单管理 -->
  32. <view class="index-main-menu-2">
  33. <view class="index-main-menu-title">
  34. <text>订单管理</text>
  35. </view>
  36. <view class="menu">
  37. <view class="menu-item" v-for="(item, index) in orderMenuList" :key="index" @click="jumpPage(item.url)">
  38. <view class="menu-item-icon" :style="{ width: item.width || '30px' }">
  39. <u--image :src="item.icon" :width="item.width || '30px'"
  40. :height="item.height || '31px'"></u--image>
  41. </view>
  42. <view class="menu-item-name">
  43. <text>{{ item.name }}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 巡检管理 -->
  49. <view class="index-main-menu-2">
  50. <view class="index-main-menu-title">
  51. <text>巡检管理</text>
  52. </view>
  53. <view class="menu">
  54. <view class="menu-item" v-for="(item, index) in patrolMenuList" :key="index" @click="jumpPage(item.url)">
  55. <view class="menu-item-icon" :style="{ width: item.width || '30px', height: '33px' }">
  56. <u--image :src="item.icon" :width="item.width || '30px'"
  57. :height="item.height || '30px'"></u--image>
  58. </view>
  59. <view class="menu-item-name">
  60. <text>{{ item.name }}</text>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <u-toast ref="uToast"></u-toast>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. todayData: {},
  75. analysisMenuList: [{
  76. icon: require('@/static/icons/today-overview-icon.svg'),
  77. name: '今日概况',
  78. url: 'pages/dataOverview/todayOverview/todayOverview'
  79. },
  80. {
  81. icon: require('@/static/icons/operational-analysis-icon.svg'),
  82. name: '运营分析',
  83. url: 'pages/dataOverview/operationalAnalysis/operationalAnalysis'
  84. },
  85. {
  86. icon: require('@/static/icons/statistical-report-icon.svg'),
  87. name: '统计报表',
  88. url: 'pages/dataOverview/statisticalReport/statisticalReport'
  89. }
  90. ],
  91. // 订单管理
  92. orderMenuList: [{
  93. icon: require('@/static/icons/parking-record-icon.svg'),
  94. name: '停车记录',
  95. url: 'pages/orderManagement/parkingRecord/parkingRecord',
  96. width: '28px'
  97. },
  98. {
  99. icon: require('@/static/icons/arrearage-record-icon.svg'),
  100. name: '欠费记录',
  101. url: 'pages/orderManagement/arrearageRecord/arrearageRecord'
  102. },
  103. {
  104. icon: require('@/static/icons/collection-record-icon.svg'),
  105. name: '收款记录',
  106. url: 'pages/orderManagement/collectionRecord/collectionRecord'
  107. },
  108. {
  109. icon: require('@/static/icons/fee-evasion-record-icon.svg'),
  110. name: '逃费记录',
  111. url: 'pages/orderManagement/feeEvasionRecord/feeEvasionRecord',
  112. width: '39px',
  113. height: '31px'
  114. },
  115. {
  116. icon: require('@/static/icons/void-record-icon.svg'),
  117. name: '作废记录',
  118. url: 'pages/orderManagement/voidRecord/voidRecord',
  119. height: '31px'
  120. },
  121. {
  122. icon: require('@/static/icons/recovery-record-icon.svg'),
  123. name: '追缴记录',
  124. url: 'pages/orderManagement/recoveryRecord/recoveryRecord',
  125. height: '31px'
  126. }
  127. ],
  128. // 巡检管理
  129. patrolMenuList: [{
  130. icon: require('@/static/icons/patrol-manage-icon.svg'),
  131. name: '巡检记录',
  132. url: 'pages/patrolManagement/patrolRecord/patrolRecord',
  133. width: '29px',
  134. height: '31px'
  135. },
  136. {
  137. icon: require('@/static/icons/device-error-records-icon.svg'),
  138. name: '设备异常记录',
  139. url: 'pages/patrolManagement/deviceAbnormalRecords/deviceAbnormalRecords',
  140. width: '35px',
  141. height: '31px'
  142. }
  143. ]
  144. }
  145. },
  146. onLoad() {
  147. // 为了验证token是否过期
  148. this.getTodayData();
  149. },
  150. methods: {
  151. /**
  152. * 登出操作
  153. */
  154. logout() {
  155. uni.showModal({
  156. title: '提示',
  157. content: '你确认退出登录?',
  158. success: (res) => {
  159. if (res.confirm) {
  160. uni.$u.api.logoutApi().then(res => {
  161. if (res.code === 200) {
  162. uni.$u.vuex('vuex_token', '');
  163. this.$u.vuex('vuex_user', {});
  164. this.$u.vuex('vuex_isLogin', false);
  165. this.jumpPage('pages/login/login')
  166. } else {
  167. this.$refs.uToast.show({
  168. loading: true,
  169. message: res.msg || '退出登录失败!',
  170. type: 'error'
  171. })
  172. }
  173. })
  174. }
  175. }
  176. })
  177. },
  178. /**
  179. * 获取今日概况
  180. */
  181. getTodayData() {
  182. uni.$u.api.todayOverviewApi.getTodayDataApi().then(res => {
  183. if (res.code === 200) {
  184. this.todayData = res.data
  185. } else {
  186. this.$refs.uToast.show({
  187. loading: true,
  188. message: res.msg || '获取今日概况失败!',
  189. type: 'error'
  190. })
  191. }
  192. })
  193. },
  194. /**
  195. * 跳转页面
  196. * @param { String } url
  197. * @param { Object } params
  198. */
  199. jumpPage(url, params) {
  200. uni.$u.route({
  201. url,
  202. params
  203. })
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang="scss">
  209. page {
  210. background-color: #EFEFEF;
  211. }
  212. </style>
  213. <style lang="scss" scoped>
  214. @import './index.scss';
  215. </style>