discover.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <view class="discover-page base-container">
  3. <view class="discover-top">
  4. <view class="home-search">
  5. <view class="search-wrap">
  6. <up-search placeholder="搜索品种" v-model="typeSearch"></up-search>
  7. </view>
  8. </view>
  9. <view class="type-wrap">
  10. <up-scroll-list indicatorColor="#FF770033" indicatorActiveColor="#FF7700" :indicatorWidth="30"
  11. :indicatorBarWidth="13">
  12. <view class="item-type" :class="{'active': activeType === 0}">
  13. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon.png`" alt="" />
  14. <view class="type-text">
  15. 全部
  16. </view>
  17. </view>
  18. <view class="item-type">
  19. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-2.png`" alt="" />
  20. <view class="type-text">
  21. 龙眼
  22. </view>
  23. </view>
  24. <view class="item-type">
  25. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-3.png`" alt="" />
  26. <view class="type-text">
  27. 葡萄
  28. </view>
  29. </view>
  30. <view class="item-type">
  31. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon.png`" alt="" />
  32. <view class="type-text">
  33. 水蜜桃
  34. </view>
  35. </view>
  36. <view class="item-type">
  37. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-2.png`" alt="" />
  38. <view class="type-text">
  39. 龙眼
  40. </view>
  41. </view>
  42. <view class="item-type">
  43. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-3.png`" alt="" />
  44. <view class="type-text">
  45. 葡萄
  46. </view>
  47. </view>
  48. <view class="item-type">
  49. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-3.png`" alt="" />
  50. <view class="type-text">
  51. 葡萄
  52. </view>
  53. </view>
  54. <view class="item-type">
  55. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon.png`" alt="" />
  56. <view class="type-text">
  57. 水蜜桃
  58. </view>
  59. </view>
  60. <view class="item-type">
  61. <image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-2.png`" alt="" />
  62. <view class="type-text">
  63. 龙眼
  64. </view>
  65. </view>
  66. </up-scroll-list>
  67. </view>
  68. </view>
  69. <!-- 列表 -->
  70. <view class="discover-content">
  71. <view class="discover-filter">
  72. <view class="filter-item" :class="{'active': filterIndex === 0}" @click="selectFilter(0)">
  73. 综合
  74. </view>
  75. <view class="filter-item" :class="{'active': filterIndex === 1}" @click="selectFilter(1)">
  76. 价格
  77. </view>
  78. <view class="filter-item" :class="{'active': filterIndex === 2}" @click="selectFilter(2)">
  79. 销量
  80. </view>
  81. </view>
  82. <view class="discover-list">
  83. <view class="list-line">
  84. <view class="list-item" v-for="(item, index) in discoverData" :key="index">
  85. <image class="item-img" :src="`${config.BASIC_IMG}home/fruit.png`" mode=""></image>
  86. <view class="item-desc">
  87. <view class="item-text">
  88. {{item.name}}
  89. </view>
  90. <view class="item-subtext">
  91. <text class="subtext-text">坏单包退</text>
  92. <text class="subtext-text">包邮</text>
  93. </view>
  94. <view class="info-price">
  95. <view class="price-text">
  96. <text class="price-unit">¥</text>{{item.price}}
  97. </view>
  98. <view class="info-sold">
  99. 已售{{item.sold}}
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </template>
  109. <script setup>
  110. import {
  111. ref
  112. } from "vue";
  113. import config from "@/api/config.js"
  114. const typeSearch = ref(null)
  115. const filterIndex = ref(0)
  116. const activeType = ref(0)
  117. const discoverData = ref([
  118. {
  119. name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
  120. text: "",
  121. price: '107',
  122. sold: "1250"
  123. },
  124. {
  125. name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
  126. text: "",
  127. price: '107',
  128. sold: "1250"
  129. },
  130. {
  131. name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
  132. text: "",
  133. price: '107',
  134. sold: "1250"
  135. },
  136. {
  137. name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
  138. text: "",
  139. price: '107',
  140. sold: "1250"
  141. }
  142. ])
  143. function selectFilter(i) {
  144. filterIndex.value = i
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .discover-page {
  149. padding: 0;
  150. background: #F2F3F5;
  151. .discover-top {
  152. padding: 20rpx 24rpx;
  153. background: linear-gradient(#FFFFFF, #F2F3F5);
  154. .home-search {
  155. display: flex;
  156. align-items: center;
  157. width: 100%;
  158. border: 2rpx solid #FFD95E;
  159. border-radius: 40rpx;
  160. margin-bottom: 40rpx;
  161. .search-wrap {
  162. flex: 1;
  163. // padding-left: 22rpx;
  164. ::v-deep {
  165. .u-search {
  166. .u-search__content {
  167. background-color: transparent !important;
  168. .u-search__content__input {
  169. background-color: transparent !important;
  170. }
  171. }
  172. .u-search__action {
  173. text-align: center;
  174. line-height: 52rpx;
  175. border-radius: 40rpx;
  176. font-size: 28rpx;
  177. background-color: #FFD95E;
  178. margin: 6rpx 8rpx;
  179. width: 112rpx;
  180. height: 52rpx;
  181. }
  182. }
  183. }
  184. }
  185. .search-btn {
  186. text-align: center;
  187. line-height: 52rpx;
  188. border-radius: 40rpx;
  189. font-size: 28rpx;
  190. background-color: #FFD95E;
  191. margin: 6rpx 8rpx;
  192. width: 112rpx;
  193. height: 52rpx;
  194. }
  195. }
  196. .type-wrap {
  197. padding: 0 20rpx 20rpx;
  198. background-color: #fff;
  199. border-radius: 16rpx;
  200. height: 200rpx;
  201. box-sizing: border-box;
  202. .item-type {
  203. text-align: center;
  204. font-size: 24rpx;
  205. .type-img {
  206. width: 92rpx;
  207. height: 92rpx;
  208. }
  209. .type-text {
  210. line-height: 36rpx;
  211. }
  212. &.active {
  213. .type-text {
  214. background-color: #FFD95E;
  215. border-radius: 20rpx;
  216. }
  217. }
  218. }
  219. .item-type+.item-type {
  220. padding-left: 22rpx;
  221. }
  222. }
  223. }
  224. .discover-content {
  225. padding: 0rpx 24rpx 24rpx;
  226. .discover-filter {
  227. color: #A6A6A6;
  228. font-size: 28rpx;
  229. display: flex;
  230. align-items: center;
  231. .filter-item {
  232. padding: 12rpx 20rpx;
  233. &.active {
  234. color: #000000;
  235. }
  236. }
  237. }
  238. .discover-list {
  239. padding-top: 20rpx;
  240. .list-line {
  241. padding-bottom: 20rpx;
  242. display: flex;
  243. flex-wrap: wrap;
  244. .list-item {
  245. background-color: #FFFFFF;
  246. border-radius: 10rpx;
  247. width: calc(50% - 16rpx);
  248. margin-bottom: 20rpx;
  249. .item-img {
  250. width: 100%;
  251. height: 340rpx;
  252. object-fit: cover;
  253. border-radius: 10rpx 10rpx 0 0;
  254. }
  255. .item-desc {
  256. padding: 0 10rpx 10rpx;
  257. .item-text {
  258. width: calc(100% - 22rpx);
  259. overflow: hidden;
  260. text-overflow: ellipsis;
  261. color: #000000;
  262. font-size: 28rpx;
  263. line-height: 42rpx;
  264. font-weight: 600;
  265. white-space: nowrap;
  266. }
  267. .item-subtext {
  268. color: #AFAFAF;
  269. font-size: 24rpx;
  270. line-height: 36rpx;
  271. .subtext-text + .subtext-text {
  272. padding-left: 10rpx;
  273. }
  274. }
  275. .info-price {
  276. display: flex;
  277. align-items: baseline;
  278. justify-content: space-between;
  279. .price-text {
  280. color: #FF7700;
  281. font-size: 36rpx;
  282. .price-unit {
  283. font-size: 23rpx;
  284. }
  285. }
  286. .info-sold {
  287. font-size: 20rpx;
  288. color: #C4C4C4;
  289. }
  290. }
  291. }
  292. }
  293. .list-item:nth-child(2n) {
  294. margin-left: 20rpx;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. </style>