与牧同行-小程序用户端
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.

154 lines
5.2 KiB

1 month ago
  1. <!-- 药品推荐主页面 -->
  2. <view class="page-container">
  3. <!-- 顶部搜索和筛选栏 -->
  4. <view class="top-bar">
  5. <!-- 搜索框 -->
  6. <view class="search-container">
  7. <view class="search-box">
  8. <view class="search-icon">🔍</view>
  9. <input
  10. class="search-input"
  11. placeholder="搜索药品名称、专家或症状"
  12. bindinput="onSearchInput"
  13. value="{{searchKeyword}}"
  14. />
  15. <view class="search-clear" wx:if="{{searchKeyword}}" bindtap="clearSearch">
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 快捷分类筛选 -->
  20. <view class="category-filters">
  21. <scroll-view class="filters-scroll" scroll-x="true">
  22. <view class="filter-tag {{currentCategory === 'all' ? 'active' : ''}}"
  23. data-category="all" bindtap="onCategoryChange">
  24. 全部推荐
  25. </view>
  26. <view class="filter-tag {{currentCategory === 'prescription' ? 'active' : ''}}"
  27. data-category="prescription" bindtap="onCategoryChange">
  28. 处方药
  29. </view>
  30. <view class="filter-tag {{currentCategory === 'otc' ? 'active' : ''}}"
  31. data-category="otc" bindtap="onCategoryChange">
  32. 非处方药
  33. </view>
  34. <view class="filter-tag {{currentCategory === 'chinese' ? 'active' : ''}}"
  35. data-category="chinese" bindtap="onCategoryChange">
  36. 中成药
  37. </view>
  38. <view class="filter-tag {{currentCategory === 'health' ? 'active' : ''}}"
  39. data-category="health" bindtap="onCategoryChange">
  40. 保健品
  41. </view>
  42. </scroll-view>
  43. </view>
  44. </view>
  45. <!-- 药品列表 - 网格布局 -->
  46. <view class="medicine-grid">
  47. <!-- 空状态 -->
  48. <view class="empty-state" wx:if="{{filteredList.length === 0 && !loading}}">
  49. <image class="empty-image" src="/images/empty-medicine.png" mode="aspectFit" />
  50. <view class="empty-text" wx:if="{{searchKeyword}}">
  51. 未找到"{{searchKeyword}}"相关的药品
  52. </view>
  53. <view class="empty-text" wx:else>
  54. 暂无药品推荐
  55. </view>
  56. <button class="empty-btn" bindtap="refreshList">刷新推荐</button>
  57. </view>
  58. <!-- 药品卡片 -->
  59. <block wx:for="{{filteredList}}" wx:key="id">
  60. <view class="medicine-card" bindtap="showMedicineDetail" data-id="{{item.id}}">
  61. <!-- 药品图片 -->
  62. <view class="card-image">
  63. <image
  64. src="{{item.image || '/images/default-medicine.png'}}"
  65. mode="aspectFill"
  66. class="medicine-img"
  67. />
  68. <!-- 药品标签 -->
  69. <view class="card-tag {{item.category}}">
  70. {{item.categoryText}}
  71. </view>
  72. <!-- 热销标签 -->
  73. <view class="hot-tag" wx:if="{{item.isHot}}">
  74. 热销
  75. </view>
  76. </view>
  77. <!-- 药品基本信息 -->
  78. <view class="card-content">
  79. <!-- 药品名称 -->
  80. <view class="medicine-name">{{item.name}}</view>
  81. <!-- 适用症状(简短) -->
  82. <view class="medicine-indication" wx:if="{{item.indication}}">
  83. {{getShortText(item.indication, 12)}}
  84. </view>
  85. <!-- 生产厂家 -->
  86. <view class="manufacturer" wx:if="{{item.manufacturer}}">
  87. {{getShortText(item.manufacturer, 14)}}
  88. </view>
  89. <!-- 价格和推荐信息 -->
  90. <view class="card-footer">
  91. <!-- 价格 -->
  92. <view class="price-section">
  93. <view class="current-price">
  94. <text class="price-symbol">¥</text>
  95. <text class="price-value">{{item.price}}</text>
  96. </view>
  97. <view class="original-price" wx:if="{{item.originalPrice}}">
  98. ¥{{item.originalPrice}}
  99. </view>
  100. </view>
  101. <!-- 推荐专家 -->
  102. <view class="expert-brief">
  103. <image
  104. src="{{item.expert.avatar || '/images/default-avatar.png'}}"
  105. class="expert-avatar"
  106. mode="aspectFill"
  107. />
  108. <text class="expert-name">{{item.expert.name}}</text>
  109. </view>
  110. </view>
  111. <!-- 店铺信息 -->
  112. <view class="store-brief">
  113. <view class="store-icon">🏪</view>
  114. <text class="store-name">{{item.store.name}}</text>
  115. <view class="distance" wx:if="{{item.store.distance}}">
  116. {{item.store.distance}}km
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </block>
  122. </view>
  123. <!-- 加载更多 -->
  124. <view class="load-more" wx:if="{{hasMore && !loading}}">
  125. <view class="load-text">上拉加载更多</view>
  126. </view>
  127. <!-- 加载中 -->
  128. <view class="loading-container" wx:if="{{loading}}">
  129. <view class="loading-spinner"></view>
  130. <text>加载中...</text>
  131. </view>
  132. <!-- 没有更多 -->
  133. <view class="no-more" wx:if="{{!hasMore && filteredList.length > 0}}">
  134. <text>没有更多药品了</text>
  135. </view>
  136. <!-- 返回顶部按钮 -->
  137. <view class="back-to-top {{showBackToTop ? 'show' : ''}}" bindtap="scrollToTop">
  138. </view>
  139. </view>