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

81 lines
1.7 KiB

  1. <template>
  2. <view>
  3. <view class="flex header">
  4. <view class="title">推荐检测</view>
  5. <button class="btn flex"><text style="margin-right: 4rpx;">查看全部</text><uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon></button>
  6. </view>
  7. <view class="content">
  8. <view v-for="item in list" :key="item.id" style="min-width: 0;">
  9. <productCard :data="item"></productCard>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import productCard from '@/pages_order/product/productCard.vue'
  16. export default {
  17. components: {
  18. productCard,
  19. },
  20. data() {
  21. return {
  22. list: [],
  23. }
  24. },
  25. created() {
  26. this.getData()
  27. },
  28. methods: {
  29. async getData() {
  30. try {
  31. const queryParams = {
  32. pageNo: 1,
  33. // todo: check
  34. pageSize: 6,
  35. type: 1, // 产品类型(0营养剂,1预约,2课程)
  36. homeRecommend: 'Y',
  37. }
  38. let records = (await this.$fetch('getProductList', queryParams))?.records || []
  39. this.list = records.map(item => {
  40. delete item.sold
  41. return item
  42. })
  43. } catch (err) {
  44. }
  45. },
  46. },
  47. }
  48. </script>
  49. <style scoped lang="scss">
  50. .header {
  51. justify-content: space-between;
  52. .title {
  53. font-family: PingFang SC;
  54. font-weight: 600;
  55. font-size: 36rpx;
  56. line-height: 1.2;
  57. color: #252545;
  58. }
  59. .btn {
  60. font-family: PingFang SC;
  61. font-weight: 400;
  62. font-size: 24rpx;
  63. line-height: 1.4;
  64. color: #A8A8A8;
  65. }
  66. }
  67. .content {
  68. margin-top: 24rpx;
  69. display: grid;
  70. grid-template-columns: repeat(2, 1fr);
  71. grid-column-gap: 32rpx;
  72. }
  73. </style>