index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="index-page">
  3. <view class="index-empty" v-if="!isLogin">
  4. <uv-empty icon="https://file-node.oss-cn-shanghai.aliyuncs.com/youji/fa57e25b38c442ebb0ba023cace796bb"
  5. :isImg="true" textSize="28" width="360" text="暂未登录">
  6. <view class="index-button-box">
  7. <uv-button type="primary" text="点击登录" size="small" @tap="$navigateTo('/pages/login/login')">
  8. </uv-button>
  9. </view>
  10. </uv-empty>
  11. </view>
  12. <view class="index-container" v-else>
  13. <view class="index-group">
  14. <view class="group-item" v-for="(item,index) in list" :key="item.id">
  15. <view class="item-title">{{item.name}}</view>
  16. <view class="item-content">
  17. <view class="content-item" v-for="(serve,i) in item.children" :key="serve.id"
  18. @tap="$navigateTo('/subPages/indexPage/orderList/orderList?productLevelId=' + serve.id+'&productLevelName='+serve.name)">
  19. <view class="content-icon">
  20. <uv-icon name="photo" color="#fff" size="60"></uv-icon>
  21. </view>
  22. <view class="content-label">{{serve.name}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. getServeProductList
  33. } from '@/request/api/workark.js'
  34. export default {
  35. data() {
  36. return {
  37. isLogin: false,
  38. list: []
  39. }
  40. },
  41. onShow() {
  42. this.isLogin = !!uni.getStorageSync('token');
  43. if (this.isLogin) this.init();
  44. },
  45. methods: {
  46. async init() {
  47. let productData = await getServeProductList(-1);
  48. if (productData.state) this.list = productData.data;
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .index-page {
  55. padding: 30rpx 0;
  56. .index-button-box {
  57. margin-top: 40rpx;
  58. }
  59. .index-empty {
  60. padding-top: 80rpx;
  61. }
  62. .group-item {
  63. background: #fff;
  64. margin-bottom: 30rpx;
  65. &:last-child {
  66. margin-bottom: 0px;
  67. }
  68. }
  69. .item-title {
  70. line-height: 88rpx;
  71. padding: 0 30rpx;
  72. font-size: 30rpx;
  73. font-weight: 500;
  74. border-bottom: 2rpx solid $uv-border-color;
  75. }
  76. .item-content {
  77. display: flex;
  78. align-items: center;
  79. flex-wrap: wrap;
  80. padding-top: 30rpx;
  81. }
  82. .content-item {
  83. width: 25%;
  84. display: flex;
  85. justify-content: center;
  86. flex-direction: column;
  87. align-items: center;
  88. padding-bottom: 30rpx;
  89. }
  90. .content-icon {
  91. width: 100rpx;
  92. height: 100rpx;
  93. border-radius: 50%;
  94. background: #fc0107;
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. }
  99. .content-label {
  100. color: $uv-content-color;
  101. margin-top: 10rpx;
  102. font-weight: 400;
  103. font-size: 26rpx;
  104. }
  105. }
  106. </style>