普兆健康管家前端代码仓库
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.

112 lines
2.5 KiB

  1. <template>
  2. <view>
  3. <navbar :title="title" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
  4. <!-- 搜索栏 -->
  5. <view class="search">
  6. <uv-search
  7. v-model="keyword"
  8. placeholder="请输入要查询的内容"
  9. placeholderColor="#C6C6C6"
  10. searchIconColor="#8B8B8B"
  11. :searchIconSize="40"
  12. :inputStyle="{
  13. 'font-family': 'PingFang SC',
  14. 'font-weight': 400,
  15. 'font-size': '28rpx',
  16. 'line-height': 1.4,
  17. 'padding': '12rpx 0',
  18. }"
  19. bgColor="#fff"
  20. :showAction="false"
  21. @search="search"
  22. ></uv-search>
  23. </view>
  24. <view class="content">
  25. <productCustomView :type="queryParams.type" :isMeal="queryParams.isMeal === 'Y'" :list="list" @categoryChange="onCategoryChange"></productCustomView>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import mixinsList from '@/mixins/list.js'
  31. import productCustomView from './productCustomView.vue'
  32. export default {
  33. mixins: [mixinsList],
  34. components: {
  35. productCustomView,
  36. },
  37. data() {
  38. return {
  39. title: '',
  40. keyword: '',
  41. mixinsListApi: 'getProductList',
  42. queryParams: {
  43. pageNo: 1,
  44. pageSize: 10,
  45. type: 0, // 产品类型(0营养剂,1预约,2课程)
  46. },
  47. }
  48. },
  49. onLoad(arg) {
  50. const { title, type, homeRecommend, search, isMeal } = arg
  51. if (title) {
  52. this.title = title
  53. }
  54. this.queryParams.type = type
  55. if (search) {
  56. this.keyword = search
  57. }
  58. if (homeRecommend) {
  59. this.queryParams.homeRecommend = homeRecommend
  60. }
  61. if (isMeal) [
  62. this.queryParams.isMeal = isMeal
  63. ]
  64. this.search()
  65. },
  66. methods: {
  67. search() {
  68. this.queryParams.pageNo = 1
  69. this.queryParams.pageSize = 10
  70. if (this.keyword) {
  71. this.queryParams.keyword = this.keyword
  72. } else {
  73. delete this.queryParams.keyword
  74. }
  75. this.getData()
  76. },
  77. onCategoryChange(e) {
  78. const { classId } = e || {}
  79. if (classId) {
  80. this.queryParams.classId = classId
  81. } else {
  82. delete this.queryParams.classId
  83. }
  84. this.queryParams.pageNo = 1
  85. this.queryParams.pageSize = 10
  86. this.getData()
  87. },
  88. },
  89. }
  90. </script>
  91. <style scoped lang="scss">
  92. @import './styles/tab.scss';
  93. .content {
  94. margin-top: 24rpx;
  95. }
  96. </style>