index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="index-page">
  3. <image src="@/static/home.jpg" class="bg_home"></image>
  4. <view class="menu">
  5. <view class="menu-box" v-for="(item, index) in menuList" :key="index">
  6. <view class="title">{{item.meta.title}}</view>
  7. <view class="menu-item" v-for="(children, i) in item.children" :key="i" @click="toPage(children.path)">
  8. <!-- <image :src="children.meta.icon" class="icon_menu"></image> -->
  9. <u-icon :name="children.meta.icon" :color="children.meta.color" size="70"></u-icon>
  10. <view class="menu-title">{{children.meta.title}}</view>
  11. </image>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. menuList: [
  22. {
  23. meta:{
  24. title:'我的订单动态'
  25. },
  26. children:[
  27. {
  28. meta:{
  29. icon:'file-text',
  30. color:'#FEFA83',
  31. title:'所有订单'
  32. },
  33. path:'/subPackages/orderforGoods/index'
  34. },
  35. {
  36. meta:{
  37. icon:'file-text',
  38. color:'#A2EF4D',
  39. title:'生产中',
  40. },
  41. path:'/subPackages/orderforGoods/index?status=生产中'
  42. },
  43. {
  44. meta:{
  45. icon:'file-text',
  46. color:'#F71313',
  47. title:'逾期'
  48. },
  49. path:'/subPackages/orderforGoods/index?status=已逾期'
  50. },
  51. {
  52. meta:{
  53. icon:'file-text',
  54. color:'#FFBF6B',
  55. title:'已发货'
  56. },
  57. path:'/subPackages/orderforGoods/index?status=已发货'
  58. },
  59. {
  60. meta:{
  61. icon:'file-text',
  62. color:'#B4FDFF',
  63. title:'已签收'
  64. },
  65. path:'/subPackages/orderforGoods/index?status=已签收'
  66. }
  67. ]
  68. }
  69. ],
  70. }
  71. },
  72. onShow() {
  73. this.getInfo()
  74. // this.getUserMenu();
  75. },
  76. methods: {
  77. getInfo() {
  78. this.$api.getInfo().then(res => {
  79. uni.setStorageSync('userInfo', res.enterpriseUser);
  80. }).catch(err => {})
  81. },
  82. getUserMenu() {
  83. this.menuList = []
  84. this.$api.getRouters().then(res => {
  85. for (let i = 0; i < res.data.length; i++) {
  86. if (res.data[i].pcShow == '0') {
  87. let children = res.data[i].children
  88. for (let j = 0; j < children.length; j++) {
  89. this.menuList.push(children[j])
  90. }
  91. }
  92. }
  93. }).catch(err => {})
  94. },
  95. toPage(path) {
  96. // let url = null
  97. // if (path == 0) {
  98. // url = '/subPackages/work/index'
  99. // }else if (path == 1) {
  100. // url = '/subPackages/qualityinspection/index'
  101. // }else if (path == 2) {
  102. // url = '/subPackages/manualdeclaration/index'
  103. // }else if (path == 3) {
  104. // url = '/subPackages/workorder/index'
  105. // }
  106. uni.navigateTo({
  107. url: path
  108. });
  109. },
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .index-page {
  115. .bg_home {
  116. width: 100%;
  117. height: 400rpx;
  118. }
  119. .menu {
  120. margin: 16rpx;
  121. .menu-box {
  122. background-color: $uni-bg-color;
  123. margin: 0 2% 20rpx 2%;
  124. padding: 30rpx 20rpx;
  125. border-radius: 10rpx;
  126. }
  127. .title {
  128. margin: 10rpx;
  129. font-size: 30rpx;
  130. font-weight: bold;
  131. }
  132. .menu-item {
  133. width: 25%;
  134. margin-top: 24rpx;
  135. display: inline-flex;
  136. flex-direction: column;
  137. align-items: center;
  138. text-align: center;
  139. position: relative;
  140. .icon_menu {
  141. width: 90rpx;
  142. height: 90rpx;
  143. }
  144. .menu-title {
  145. margin-top: 10rpx;
  146. color: #666;
  147. }
  148. }
  149. }
  150. }
  151. </style>