discover.vue 7.5 KB

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