普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.3 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar bgColor="#FFFFFF" >
  4. <view>
  5. <uv-tabs
  6. :current="current"
  7. :list="tabs"
  8. :activeStyle="{
  9. 'font-family': 'PingFang SC',
  10. 'font-weight': 600,
  11. 'font-size': '40rpx',
  12. 'line-height': 1.2,
  13. 'color': '#252545',
  14. }"
  15. :inactiveStyle="{
  16. 'font-family': 'PingFang SC',
  17. 'font-weight': 400,
  18. 'font-size': '32rpx',
  19. 'line-height': 1.5,
  20. 'color': '#A8A8A8',
  21. }"
  22. lineWidth="22rpx"
  23. lineHeight="4rpx"
  24. lineColor="#252545"
  25. @change="onTabChange"
  26. ></uv-tabs>
  27. </view>
  28. </navbar>
  29. <!-- 营养素 -->
  30. <tab-nutrient v-if="current == 0">
  31. <template #custom>
  32. <product-custom-view :type="0" :list="list" @categoryChange="onCategoryChange"></product-custom-view>
  33. </template>
  34. </tab-nutrient>
  35. <!-- 检测 -->
  36. <tab-detect v-else-if="current == 1">
  37. <template #custom>
  38. <product-custom-view :type="1" :list="list" @categoryChange="onCategoryChange"></product-custom-view>
  39. </template>
  40. </tab-detect>
  41. <!-- 课程 -->
  42. <tab-course v-else-if="current == 2">
  43. <!-- <template #custom>
  44. <product-custom-view :type="2" :list="list" @categoryChange="onCategoryChange"></product-custom-view>
  45. </template> -->
  46. </tab-course>
  47. <tabber select="product" />
  48. </view>
  49. </template>
  50. <script>
  51. import mixinsList from '@/mixins/list.js'
  52. import tabber from '@/components/base/tabbar.vue'
  53. import tabNutrient from '@/pages_order/product/tabNutrient/index.vue'
  54. import tabDetect from '@/pages_order/product/tabDetect/index.vue'
  55. import tabCourse from '@/pages_order/product/tabCourse/index.vue'
  56. import productCustomView from '@/pages_order/product/productCustomView.vue'
  57. export default {
  58. mixins: [mixinsList],
  59. components: {
  60. tabNutrient,
  61. tabDetect,
  62. tabCourse,
  63. productCustomView,
  64. tabber,
  65. },
  66. data() {
  67. return {
  68. tabs: [
  69. { name: '营养素' },
  70. { name: '检测' },
  71. { name: '课程' },
  72. ],
  73. current: 0,
  74. mixinsListApi: 'getProductList',
  75. queryParams: {
  76. pageNo: 1,
  77. pageSize: 10,
  78. type: 0, // 产品类型(0营养剂,1预约,2课程)
  79. },
  80. }
  81. },
  82. onLoad() {
  83. if(uni.getStorageSync('token')){
  84. this.$store.commit('getUserInfo')
  85. }
  86. },
  87. methods: {
  88. onTabChange(e) {
  89. console.log('current', e.index)
  90. this.current = e.index
  91. this.queryParams.pageNo = 1
  92. this.queryParams.pageSize = 10
  93. this.queryParams.type = this.current
  94. this.getData()
  95. },
  96. onCategoryChange(e) {
  97. const { classId } = e || {}
  98. if (classId) {
  99. this.queryParams.classId = classId
  100. } else {
  101. delete this.queryParams.classId
  102. }
  103. this.queryParams.pageNo = 1
  104. this.queryParams.pageSize = 10
  105. this.getData()
  106. },
  107. },
  108. }
  109. </script>
  110. <style scoped lang="scss">
  111. .page__view {
  112. width: 100vw;
  113. min-height: 100vh;
  114. background-image: linear-gradient(#EAE5FF, #F3F2F7, #F3F2F7);
  115. position: relative;
  116. /deep/ .uv-tabs__wrapper__nav__line {
  117. border-radius: 2rpx;
  118. }
  119. }
  120. </style>