index.vue 3.5 KB

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