index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <!--
  2. * @Author: jmy
  3. * @Date: 2026-01-06 12:02:41
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2026-01-06 15:02:20
  6. * @Description: 首页
  7. -->
  8. <template>
  9. <view class="w-all h-all flex flex-column bg-F5F7FA">
  10. <image src="/static/images/yuexuan_home_top_bg.png" class="absolute top-0 left-0 zi-1 w-all h-266"></image>
  11. <uni-nav-bar fixed :statusBar="true" left-icon="back" backgroundColor="" :border="false" rightWidth="0"
  12. leftWidth="0">
  13. <template v-slot:default>
  14. <view class="scs-headr-default flex items-center h-44">
  15. <view class="flex-1">
  16. <view class="fw-500 fs-18 text-000000">芳华悦选</view>
  17. <view class="fw-400 fs-12 text-999999">让家人放心吃健康安全的食品</view>
  18. </view>
  19. <view class="img-car flex items-center justify-center w-32 h-32 bg-white rounded-32">
  20. <image class="w-20 h-20" src="/static/images/shopping_car_icon.png"></image>
  21. </view>
  22. </view>
  23. </template>
  24. </uni-nav-bar>
  25. <!-- 搜索栏 -->
  26. <HomeSearch @onSearch="onSearch" />
  27. <view class="zi-10 flex-1 overflow-auto">
  28. <ScsScrollView ref="fresher" refresherBackground="transparent" :refresherEnabled="false"
  29. @onfresher="onfresher" @loadMore="loadMore" @handleScroll="(flag) => isShowToTop = flag">
  30. <template v-slot:list>
  31. <!-- tab栏 -->
  32. <view class="scs-nav-bar px-12 mt-11 rounded-8">
  33. <view class="flex items-center relative ">
  34. <ScsScrollNavbar :tabsData="tabsData" :tabCurrentIndex="tabCurrentIndex" nameKey="name"
  35. key="tabCurrentIndex" @tabChange="tabChange" />
  36. <image class="w-32 h-32 absolute bottom-2.5 right-40"
  37. src="/static/images/white_gradient_bg.png">
  38. </image>
  39. <view class="flex items-center justify-center">
  40. <image class="w-16 h-16 ml-5 mr-12" src="/static/images/product_section_icon.png">
  41. </image>
  42. <image class="w-16 h-16 mr-7" src="/static/images/home_filter_icon.png"></image>
  43. </view>
  44. </view>
  45. <HomeMenu :autoplay="false" :swiperList="menusData" />
  46. </view>
  47. <!-- 商品栏 -->
  48. <HomeProduct />
  49. <!-- tab栏 -->
  50. <view class="tab-goods w-all mt-10 rounded-t-8 px-28">
  51. <ScsScrollIconbar :tabsData="tabsProduct" :tabCurrentIndex="tabsProductIndex" nameKey="name"
  52. key="tabsProductIndex" @tabChange="tabProductChange" />
  53. </view>
  54. <view class="px-12 mt-14">
  55. <view class="bg-white pb-10 rounded-8 overflow-hidden">
  56. <image class="w-all h-195"
  57. src="https://img1.baidu.com/it/u=2172818577,3783888802&fm=253&app=138&f=JPEG?w=800&h=1422">
  58. </image>
  59. <view
  60. class="goods-count px-12 flex items-center justify-between text-white w-all h-32 rounded-6 mt--15 zi-2 relative">
  61. <view class="fw-500 fs-18">热卖爆品</view>
  62. <view class="fw-400 fs-13">已售1000件</view>
  63. </view>
  64. <view class="fw-500 fs-13 text-333333 mt-11 px-12">
  65. [广州康和药业 GKH PHARMACEUTICAL LTD]盐酸多西环素片 0.1g*12片 1盒装
  66. </view>
  67. <view class="fw-400 fs-12 text-D46C0D mt-7 px-12">
  68. 处方药须凭处方在药师指导下购买和使用
  69. </view>
  70. <view class="flex items-center justify-between mt-7 px-12">
  71. <view class="flex items-center gap-4 text-FF4B33 fs-11">
  72. <view class="px-4 ph-2 border border-FFA599 rounded-2 ">9.5折</view>
  73. <view class="px-4 ph-2 border border-FFA599 rounded-2 ">限购1份</view>
  74. </view>
  75. <view class="flex items-center gap-2">
  76. <view class="fs-12 text-FA341E fw-400">领卷</view>
  77. <image class="w-12 h-12" src="/static/images/home/sdyhzq_bg@2x.png"></image>
  78. </view>
  79. </view>
  80. <view class="flex items-center justify-between mt-8 px-12">
  81. <view class="flex items-end gap-8">
  82. <view class="text-FA341E ">
  83. <text class="fs-12 fw-600">¥</text>
  84. <text class="fs-24 fw-600">105</text>
  85. <text class="fs-15 fw-600">.36</text>
  86. </view>
  87. <view class="text-999999 fs-13 fw-400 text-line-through pb-3">
  88. ¥128.00
  89. </view>
  90. </view>
  91. <view class="flex items-center w-110 h-34 rounded-34 overflow-hidden">
  92. <view class="w-44 h-all flex items-center justify-center bg-38D97D">
  93. <image class="w-20 h-20" src="/static/images/home/shopping_car_icon24@2x.png">
  94. </image>
  95. </view>
  96. <view
  97. class="flex-1 h-all flex items-center justify-center bg-02B176 fw-500 text-white fs-14">
  98. 去购买</view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <u-gap height="15"></u-gap>
  104. </template>
  105. </ScsScrollView>
  106. <ScsScrollTop :isShowToTop="isShowToTop" @goTop="$refs.fresher.goTop" />
  107. </view>
  108. <!-- 频道 可拖拽 -->
  109. <!-- <channel></channel> -->
  110. <channel ref="channelManager" :initial-my-channels="myChannels" :initial-all-channels="allChannels"
  111. :active-channel-id="activeChannelId" @channels-change="onChannelsChange" @order-change="onOrderChange"
  112. @channel-tap="onChannelTap" />
  113. </view>
  114. </template>
  115. <script>
  116. import HomeMenu from './components/home-menu.vue'
  117. import HomeProduct from './components/home-product.vue'
  118. import HomeSearch from './components/home-search.vue'
  119. import {
  120. getMenu,
  121. getCanvas,
  122. getIndexData,
  123. getTuiDoctor,
  124. getTuiArticle,
  125. getTuiDoctorOrder,
  126. getCartCount
  127. } from '@/api/index'
  128. export default {
  129. components: {
  130. HomeMenu,
  131. HomeProduct,
  132. HomeSearch,
  133. },
  134. data() {
  135. return {
  136. statusBarHeight: 0,
  137. tabsData: [
  138. { name: '精选' },
  139. { name: '健康新品' },
  140. { name: '营养保健' },
  141. { name: '健康滋补' },
  142. ],
  143. tabCurrentIndex: 0,
  144. menusData: [],
  145. tabsProduct: [
  146. { name: '今日主推' },
  147. { name: '健康新品' },
  148. { name: '营养保健' },
  149. ],
  150. tabsProductIndex: 0,
  151. goodList: [1, 2],
  152. isShowToTop: false,
  153. }
  154. },
  155. onLoad() {
  156. },
  157. onShow() {
  158. this.getMenuData();
  159. },
  160. methods: {
  161. // 搜索
  162. onSearch(keyword) {
  163. },
  164. // 分类tab切换
  165. tabChange(index) {
  166. this.tabCurrentIndex = index;
  167. },
  168. // 商品tab切换
  169. tabProductChange(index) {
  170. this.tabsProductIndex = index;
  171. },
  172. // 获取分类数据
  173. async getMenuData() {
  174. const { code, data, msg } = await getMenu();
  175. if (code == 200) {
  176. this.menusData = this.$scsUtils.splitArrayIntoSubarrays(data, 5) || []
  177. } else {
  178. uni.showToast({
  179. title: msg,
  180. icon: 'none'
  181. })
  182. }
  183. },
  184. // 下拉刷新
  185. onfresher() {
  186. const self = this;
  187. self.$refs.fresher.isTrigger = true;
  188. setTimeout(() => {
  189. self.$refs.fresher.refresherText = "刷新成功";
  190. self.$refs.fresher.isTrigger = false;
  191. }, 500);
  192. },
  193. // 上拉加载更多
  194. loadMore() {
  195. },
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. ::v-deep .scs-scroll-navbar {
  201. width: calc(100vw - 140rpx) !important;
  202. }
  203. .scs-nav-bar {
  204. background: linear-gradient(180deg, #FFFFFF 0%, #FFFFFF 49.52%, #F5F7FA 100%);
  205. }
  206. .tab-goods {
  207. background: linear-gradient(180deg, #FFFFFF 0%, #FFFFFF 49.52%, #F5F7FA 100%);
  208. }
  209. .goods-count {
  210. background: linear-gradient(to right, #FA341E, #F4A007)
  211. }
  212. </style>