services.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view>
  3. <up-waterfall>
  4. <template #left>
  5. <view class="demo-warter" v-for="(item, index) in props.leftList" :key="index" @click="goToDetail(item)">
  6. <view v-if="item.type == 'slideshow'" class="home-swiper" @click.stop>
  7. <view v-if="ValueZoneSwiper.length > 0">
  8. <up-swiper :list="ValueZoneSwiper" :indicator="false" class="Up-swiper" @click="handleSwiperClick"
  9. :height="'516rpx'"></up-swiper>
  10. </view>
  11. </view>
  12. <template v-else>
  13. <up-lazy-load threshold="50" border-radius="10" :image="getVolunteerPicture(item)" :index="index"
  14. mode="aspectFill"></up-lazy-load>
  15. <view class="demo-skillDescribe">
  16. {{ item.businessDescribe }}
  17. </view>
  18. <view class="demo-title-container">
  19. <view class="demo-title">
  20. {{ item.businessTierName }}
  21. </view>
  22. </view>
  23. <view class="demo-PriceDome">
  24. <view class="demo-price">
  25. <image :src="getVolunteerPicture(item)" class="name-image"></image>
  26. <text class="name-text">{{ item.name }}</text>
  27. </view>
  28. <view class="demo-price">
  29. <image src="/static/img/1x.png" class="image-1x"></image>
  30. <text class="name-textNumber">1w</text>
  31. </view>
  32. </view>
  33. <view class="demo-price-distance">
  34. <view class="demo-price-distance-text-1">
  35. <text class="demo-price-distance-text-2">¥</text>
  36. <text class="demo-price-distance-text">{{ item.businessPrice }}</text>
  37. </view>
  38. <button class="demo-price-distance-button" @click="goToDetail(item)">抢购</button>
  39. </view>
  40. </template>
  41. </view>
  42. </template>
  43. <template #right>
  44. <view class=" demo-warter" v-for="(item, index) in props.rightList" :key="index" @click="goToDetail(item)">
  45. <up-lazy-load threshold="50" border-radius="10" :image="getVolunteerPicture(item)" :index="index"
  46. mode="aspectFill"></up-lazy-load>
  47. <view class="demo-skillDescribe">
  48. {{ item.businessDescribe }}
  49. </view>
  50. <view class="demo-title-container">
  51. <view class="demo-title">
  52. {{ item.businessTierName }}
  53. </view>
  54. </view>
  55. <view class="demo-PriceDome">
  56. <view class="demo-price">
  57. <image :src="getVolunteerPicture(item)" class="name-image"></image>
  58. <text class="name-text">{{ item.name }}</text>
  59. </view>
  60. <view class="demo-price">
  61. <image src="/static/img/1x.png" class="image-1x"></image>
  62. <text class="name-textNumber">1w</text>
  63. </view>
  64. </view>
  65. <view class="demo-price-distance">
  66. <view class="demo-price-distance-text-1">
  67. <text class="demo-price-distance-text-2">¥</text>
  68. <text class="demo-price-distance-text">{{ item.businessPrice }}</text>
  69. </view>
  70. <button class="demo-price-distance-button" @click="goToDetail(item)">抢购</button>
  71. </view>
  72. </view>
  73. </template>
  74. </up-waterfall>
  75. </view>
  76. </template>
  77. <script setup>
  78. const props = defineProps({
  79. leftList: {
  80. type: Array,
  81. default: () => []
  82. },
  83. rightList: {
  84. type: Array,
  85. default: () => []
  86. },
  87. ValueZoneSwiper: {
  88. type: Array,
  89. default: () => []
  90. }
  91. });
  92. // 获取志愿者图片
  93. const getVolunteerPicture = (item) => {
  94. // volunteerPicture是用逗号拼接的多张图片,取第一张
  95. const pictures = item.volunteerPicture.split(',');
  96. return pictures[0];
  97. };
  98. // 轮播图点击事件
  99. const handleSwiperClick = (item) => {
  100. console.log('轮播图点击', item);
  101. // 这里可以添加轮播图的点击处理逻辑
  102. }
  103. const goToDetail = async (item) => {
  104. const params = {
  105. volunteerId: item.volunteerId, // 获取 volunteerId
  106. serviceCategory: item.serviceCategory, // 获取 serviceCategory
  107. businessManagementId: item.businessManagementId, //获取 businessManagementId
  108. };
  109. const data = encodeURIComponent(JSON.stringify(params))
  110. console.log(data, '>>>>>data');
  111. uni.navigateTo({
  112. url: `/pages_home/pages/Volunteerside/goodsDetails?params=${data}`
  113. });
  114. }
  115. </script>
  116. <style scoped lang="scss">
  117. /* 轮播图片 */
  118. .home-swiper {
  119. width: 340rpx;
  120. height: 516rpx;
  121. :deep(.Up-swiper) {
  122. width: 100%;
  123. height: 100%;
  124. }
  125. }
  126. .demo-warter {
  127. margin-top: 80rpx;
  128. border-radius: 8px;
  129. margin: 5px;
  130. background-color: #ffffff;
  131. // padding-left: 10rpx;
  132. // padding-right: 10rpx;
  133. margin-bottom: 30rpx;
  134. }
  135. .u-close {
  136. position: absolute;
  137. top: 32rpx;
  138. right: 32rpx;
  139. }
  140. .demo-image {
  141. width: 100%;
  142. border-radius: 4px;
  143. }
  144. .demo-title-container {
  145. display: flex;
  146. flex-direction: column;
  147. // justify-content: center;
  148. // align-items: center;
  149. padding: 4rpx 0rpx;
  150. // z-index: 0;
  151. margin-top: 10rpx;
  152. border-radius: 10rpx;
  153. box-sizing: border-box;
  154. // border: 1rpx solid rgba(237, 93, 49, 0.8);
  155. }
  156. .demo-title {
  157. font-size: 22rpx;
  158. color: #ED5D31;
  159. display: -webkit-box;
  160. -webkit-box-orient: vertical;
  161. -webkit-line-clamp: 3;
  162. overflow: hidden;
  163. text-overflow: ellipsis;
  164. word-break: break-all;
  165. }
  166. .demo-skillDescribe {
  167. width: 345rpx;
  168. height: auto;
  169. font-family: PingFang SC;
  170. font-size: 26rpx;
  171. font-weight: 500;
  172. line-height: 36rpx;
  173. letter-spacing: normal;
  174. color: #141414;
  175. margin-top: 5px;
  176. display: -webkit-box;
  177. -webkit-box-orient: vertical;
  178. -webkit-line-clamp: 1;
  179. overflow: hidden;
  180. text-overflow: ellipsis;
  181. word-break: break-all;
  182. }
  183. .demo-img {
  184. width: 40rpx;
  185. height: 40rpx;
  186. border-radius: 50%;
  187. }
  188. .demo-PriceDome {
  189. display: flex;
  190. justify-content: space-between;
  191. align-items: center;
  192. width: 100%;
  193. margin-top: 15rpx;
  194. }
  195. .demo-price {
  196. display: flex;
  197. align-items: center;
  198. overflow: hidden;
  199. /* 防止内容溢出 */
  200. }
  201. .image-1x {
  202. width: 20rpx;
  203. height: 20rpx;
  204. z-index: 0;
  205. }
  206. .name-textNumber {
  207. font-size: 22rpx;
  208. font-weight: normal;
  209. line-height: 24rpx;
  210. text-align: right;
  211. letter-spacing: -0.04em;
  212. color: #FF6E51;
  213. }
  214. .demo-price-distance {
  215. display: flex;
  216. justify-content: space-between;
  217. align-items: center;
  218. margin-top: 10rpx;
  219. .demo-price-distance-text-1 {
  220. display: flex;
  221. align-items: center;
  222. .demo-price-distance-text-2 {
  223. font-family: Source Han Sans;
  224. font-size: 22rpx;
  225. font-weight: bold;
  226. line-height: 34rpx;
  227. color: #FA2922;
  228. }
  229. }
  230. .demo-price-distance-text {
  231. font-family: Source Han Sans;
  232. font-weight: 700;
  233. font-size: 40rpx;
  234. font-variation-settings: "opsz" auto;
  235. color: #FA2922;
  236. }
  237. .demo-price-distance-button {
  238. width: 124rpx;
  239. height: 51rpx;
  240. display: flex;
  241. justify-content: center;
  242. align-items: center;
  243. border-radius: 36rpx;
  244. background: linear-gradient(90deg, #FE534B 25%, #FD8F7C 91%);
  245. box-shadow: 0rpx 1rpx 2rpx 0rpx rgba(0, 0, 0, 0.18), inset 0rpx 4rpx 10rpx 0rpx rgba(255, 221, 221, 0.3);
  246. color: #FFFFFF;
  247. font-size: 30rpx;
  248. padding: 0;
  249. margin-left: 70rpx;
  250. }
  251. }
  252. .name-text {
  253. width: 117rpx;
  254. height: 34rpx;
  255. font-family: PingFang SC;
  256. font-size: 24rpx;
  257. font-weight: normal;
  258. line-height: 34rpx;
  259. letter-spacing: -0.04em;
  260. color: rgba(0, 0, 0, 0.8);
  261. }
  262. .name-image {
  263. width: 40rpx;
  264. height: 40rpx;
  265. margin-right: 10rpx;
  266. border-radius: 50%;
  267. }
  268. .name-text {
  269. white-space: nowrap;
  270. /* 禁止换行 */
  271. overflow: hidden;
  272. /* 超出部分隐藏 */
  273. text-overflow: ellipsis;
  274. /* 显示省略号 */
  275. max-width: 120rpx;
  276. /* 6个中文字符大约占120rpx */
  277. }
  278. </style>