discover.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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="item.img" 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. img: "/static/home/fruit.png",
  121. text: "",
  122. price: '107',
  123. sold: "1250"
  124. },
  125. {
  126. name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
  127. img: "/static/home/fruit.png",
  128. text: "",
  129. price: '107',
  130. sold: "1250"
  131. },
  132. {
  133. name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
  134. img: "/static/home/fruit.png",
  135. text: "",
  136. price: '107',
  137. sold: "1250"
  138. },
  139. {
  140. name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
  141. img: "/static/home/fruit.png",
  142. text: "",
  143. price: '107',
  144. sold: "1250"
  145. }
  146. ])
  147. function selectFilter(i) {
  148. filterIndex.value = i
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .discover-page {
  153. padding: 0;
  154. background: #F2F3F5;
  155. .discover-top {
  156. padding: 20rpx 24rpx;
  157. background: linear-gradient(#FFFFFF, #F2F3F5);
  158. .home-search {
  159. display: flex;
  160. align-items: center;
  161. width: 100%;
  162. border: 2rpx solid #FFD95E;
  163. border-radius: 40rpx;
  164. margin-bottom: 40rpx;
  165. .search-wrap {
  166. flex: 1;
  167. // padding-left: 22rpx;
  168. ::v-deep {
  169. .u-search {
  170. .u-search__content {
  171. background-color: transparent !important;
  172. .u-search__content__input {
  173. background-color: transparent !important;
  174. }
  175. }
  176. .u-search__action {
  177. text-align: center;
  178. line-height: 52rpx;
  179. border-radius: 40rpx;
  180. font-size: 28rpx;
  181. background-color: #FFD95E;
  182. margin: 6rpx 8rpx;
  183. width: 112rpx;
  184. height: 52rpx;
  185. }
  186. }
  187. }
  188. }
  189. .search-btn {
  190. text-align: center;
  191. line-height: 52rpx;
  192. border-radius: 40rpx;
  193. font-size: 28rpx;
  194. background-color: #FFD95E;
  195. margin: 6rpx 8rpx;
  196. width: 112rpx;
  197. height: 52rpx;
  198. }
  199. }
  200. .type-wrap {
  201. padding: 0 20rpx 20rpx;
  202. background-color: #fff;
  203. border-radius: 16rpx;
  204. height: 200rpx;
  205. box-sizing: border-box;
  206. .item-type {
  207. text-align: center;
  208. font-size: 24rpx;
  209. .type-img {
  210. width: 92rpx;
  211. height: 92rpx;
  212. }
  213. .type-text {
  214. line-height: 36rpx;
  215. }
  216. &.active {
  217. .type-text {
  218. background-color: #FFD95E;
  219. border-radius: 20rpx;
  220. }
  221. }
  222. }
  223. .item-type+.item-type {
  224. padding-left: 22rpx;
  225. }
  226. }
  227. }
  228. .discover-content {
  229. padding: 0rpx 24rpx 24rpx;
  230. .discover-filter {
  231. color: #A6A6A6;
  232. font-size: 28rpx;
  233. display: flex;
  234. align-items: center;
  235. .filter-item {
  236. padding: 12rpx 20rpx;
  237. &.active {
  238. color: #000000;
  239. }
  240. }
  241. }
  242. .discover-list {
  243. padding-top: 20rpx;
  244. .list-line {
  245. padding-bottom: 20rpx;
  246. display: flex;
  247. flex-wrap: wrap;
  248. .list-item {
  249. background-color: #FFFFFF;
  250. border-radius: 10rpx;
  251. width: calc(50% - 16rpx);
  252. margin-bottom: 20rpx;
  253. .item-img {
  254. width: 100%;
  255. height: 340rpx;
  256. object-fit: cover;
  257. border-radius: 10rpx 10rpx 0 0;
  258. }
  259. .item-desc {
  260. padding: 0 10rpx 10rpx;
  261. .item-text {
  262. width: calc(100% - 22rpx);
  263. overflow: hidden;
  264. text-overflow: ellipsis;
  265. color: #000000;
  266. font-size: 28rpx;
  267. line-height: 42rpx;
  268. font-weight: 600;
  269. white-space: nowrap;
  270. }
  271. .item-subtext {
  272. color: #AFAFAF;
  273. font-size: 24rpx;
  274. line-height: 36rpx;
  275. .subtext-text + .subtext-text {
  276. padding-left: 10rpx;
  277. }
  278. }
  279. .info-price {
  280. display: flex;
  281. align-items: baseline;
  282. justify-content: space-between;
  283. .price-text {
  284. color: #FF7700;
  285. font-size: 36rpx;
  286. .price-unit {
  287. font-size: 23rpx;
  288. }
  289. }
  290. .info-sold {
  291. font-size: 20rpx;
  292. color: #C4C4C4;
  293. }
  294. }
  295. }
  296. }
  297. .list-item:nth-child(2n) {
  298. margin-left: 20rpx;
  299. }
  300. }
  301. }
  302. }
  303. }
  304. </style>