details.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. {{serviceName }}
  3. 111
  4. <view style="padding-top: 20rpx; width: 100vw; height: 100vh; overflow: hidden">
  5. <view style="width: 100%; height: 100%; overflow:scroll">
  6. <view class="Wrapper">
  7. <image src="/static/img/Location.png" class="Wrapper-img" />
  8. <span class="Wrapper-content">重庆</span>
  9. <vie class="input-container">
  10. <up-input v-model="value" @click.native="goToDetail" placeholder="请输入内容" prefixIcon="search"
  11. :customStyle="inputStyle"></up-input>
  12. </vie>
  13. </view>
  14. <view class="tabs-container">
  15. <view class="tabs-wrapper">
  16. <!-- 可滑动的 tabs 区域 -->
  17. <scroll-view scroll-x class="tabs-scroll">
  18. <up-tabs :list="list1" @click="handlTabs" class="tabs-content"></up-tabs>
  19. </scroll-view>
  20. <!-- 固定不动的图标 -->
  21. <image ref="iconRef" src="/static/img/分类or广场or其他.png" class="fixed-icon" @click="toggleDropdown" />
  22. </view>
  23. <view v-if="showDropdown" class="custom-dropdown">
  24. <up-tabs :list="list2" @click="click" class="tabs-content" />
  25. <up-tabs :list="list3" @click="click" class="tabs-content" />
  26. </view>
  27. </view>
  28. <!-- 瀑布流 -->
  29. <view>
  30. <up-waterfall v-model="flowList">
  31. <template #left :listData="listData">
  32. <view class="demo-warter" v-for="(item, index) in listData" :key="index"
  33. @click="goToDetail(item)">
  34. <up-lazy-load threshold="-450" border-radius="10" :image="item.image"
  35. :index="index"></up-lazy-load>
  36. <view class="demo-title">
  37. {{item.skillDescribe}}
  38. </view>
  39. <view class="demo-PriceDome">
  40. <view class="demo-price">
  41. <image src="../../static/用户.png" class="name-image"></image>
  42. {{item.name}}
  43. </view>
  44. <view class="dome-Like">
  45. <text style="font-size: 25rpx; color: red;">¥</text>
  46. <text style="font-size: 35rpx; color: red;">1.4w</text>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <template #right :rightList="rightList">
  52. <view class="demo-warter" v-for="(item, index) in rightList" :key="index"
  53. @click="goToDetail(item)">
  54. <up-lazy-load threshold="-450" border-radius="10" :image="item.image"
  55. :index="index"></up-lazy-load>
  56. <view class="demo-title">
  57. {{item.skillDescribe}}
  58. </view>
  59. <view class="demo-PriceDome">
  60. <view class="demo-price">
  61. <image src="../../static/用户.png" class="name-image"></image>
  62. {{item.name}}
  63. </view>
  64. <view class="dome-Like">
  65. <text style="font-size: 25rpx; color: red;">¥</text>
  66. <text style="font-size: 35rpx; color: red;">1.4w</text>
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. </up-waterfall>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script setup>
  77. import {
  78. ref,
  79. onMounted,
  80. reactive
  81. } from 'vue';
  82. import volunteerSide from "@/pages/Volunteerside/Side_index.vue"
  83. import {
  84. typeOptionSelect,
  85. volunteerInfoList,
  86. getDetailsvolunteerId,
  87. dictListlrRstudy,
  88. dictListlrData
  89. } from "@/api/volunteerDetailsApi/details.js"
  90. import {
  91. useRoute
  92. } from 'vue-router';
  93. const value1 = ref(1)
  94. const value2 = ref(2)
  95. const list1 = ref([])
  96. const list2 = ref([])
  97. const list3 = ref([])
  98. const flowList = ref([]); //list数据
  99. const listData = ref([])
  100. const rightList = ref([])
  101. const defaultTab = ref({
  102. dictValue: 1
  103. });
  104. // 获取当前路由对象
  105. const route = useRoute();
  106. // 存储服务名称
  107. const serviceName = ref('');
  108. const showDropdown = ref(false)
  109. function toggleDropdown() {
  110. console.log("点击了")
  111. showDropdown.value = !showDropdown.value
  112. }
  113. const getListData = async (dictSort = null) => {
  114. try {
  115. const params = {
  116. pageNum: 1,
  117. pageSize: 10,
  118. dictType: 'lrr_service_category',
  119. dictSort
  120. }
  121. const res = await typeOptionSelect(params)
  122. console.log((res, '获取健值成功'))
  123. if (res.code == 200 && res.rows) {
  124. list1.value = res.rows.map(item => ({
  125. ...item,
  126. name: item.dictLabel,
  127. }))
  128. }
  129. } catch (e) {
  130. console.log('获取失败')
  131. }
  132. }
  133. const getListData2 = async () => {
  134. try {
  135. const params = {
  136. dictType: 'lrr_service_subject',
  137. }
  138. const res = await dictListlrRstudy(params)
  139. if (res.code == 200 && res.rows) {
  140. list2.value = res.rows.map(item => ({
  141. ...item,
  142. name: item.dictLabel,
  143. }))
  144. }
  145. } catch (e) {
  146. console.log('获取失败')
  147. }
  148. }
  149. const getListData3 = async () => {
  150. try {
  151. const params = {
  152. dictType: 'lrr_study',
  153. }
  154. const res = await dictListlrData(params)
  155. if (res.code == 200 && res.rows) {
  156. list3.value = res.rows.map(item => ({
  157. ...item,
  158. name: item.dictLabel,
  159. }))
  160. }
  161. } catch (e) {
  162. console.log('获取失败')
  163. }
  164. }
  165. // tabs选择服务类型
  166. const handlTabs = async (tab) => {
  167. const params = {
  168. serviceCategory: tab.dictValue
  169. }
  170. const res = await volunteerInfoList(params)
  171. // 处理左右数据展示
  172. let leftArr = []
  173. let rightArr = []
  174. console.log(res.data, '>>>res.data');
  175. (res.data || []).forEach((item, index) => {
  176. index % 2 != 0 ? leftArr.push(item) : rightArr.push(item)
  177. })
  178. listData.value = leftArr
  179. rightList.value = rightArr
  180. }
  181. const goToDetail = async (item) => {
  182. const volunteerId = item.volunteerId;
  183. uni.navigateTo({
  184. url: `/pages/goodsDetails/goodsDetails?volunteerId=${volunteerId}`
  185. });
  186. }
  187. const inputStyle = { //input輸入框樣式設置
  188. borderRadius: '140rpx',
  189. border: '1rpx solid #ccc',
  190. height: '70rpx',
  191. paddingLeft: '30rpx',
  192. width: '600rpx',
  193. }
  194. onMounted(() => {
  195. if (route && route.query && route.query.name) {
  196. serviceName.value = decodeURIComponent(route.query.name); // 解码参数
  197. console.log(serviceName.value, '111112333');
  198. }
  199. getListData()
  200. getListData2()
  201. getListData3()
  202. handlTabs(defaultTab.value)
  203. })
  204. </script>
  205. <style scoped>
  206. .Wrapper {
  207. display: flex;
  208. align-items: center;
  209. gap: 10rpx;
  210. }
  211. .Wrapper-img {
  212. width: 50rpx;
  213. height: 50rpx;
  214. margin-left: 10rpx;
  215. }
  216. .Wrapper-content {
  217. color: rgba(16, 16, 16, 1);
  218. font-size: 25rpx;
  219. font-family: PingFangSC-regular;
  220. line-height: 20rpx;
  221. }
  222. /* 外层容器 */
  223. .tabs-container {
  224. width: 100%;
  225. background: #fff;
  226. padding: 10px 0;
  227. }
  228. /* Flex 布局容器 */
  229. .tabs-wrapper {
  230. display: flex;
  231. align-items: center;
  232. position: relative;
  233. }
  234. /* 可横向滚动的 scroll-view */
  235. .tabs-scroll {
  236. flex: 1;
  237. /* 占据剩余空间 */
  238. overflow-x: auto;
  239. /* 允许横向滚动 */
  240. white-space: nowrap;
  241. /* 禁止换行 */
  242. -webkit-overflow-scrolling: touch;
  243. /* iOS 平滑滚动 */
  244. }
  245. /* 隐藏滚动条(可选) */
  246. .tabs-scroll::-webkit-scrollbar {
  247. display: none;
  248. }
  249. /* 固定图标(始终显示在右侧) */
  250. .fixed-icon {
  251. width: 30px;
  252. height: 30px;
  253. margin-left: 10px;
  254. /* 与 tabs 的间距 */
  255. flex-shrink: 0;
  256. /* 禁止压缩 */
  257. }
  258. .demo-warter {
  259. border-radius: 8px;
  260. margin: 5px;
  261. background-color: #ffffff;
  262. padding: 5px;
  263. }
  264. .u-close {
  265. position: absolute;
  266. top: 32rpx;
  267. right: 32rpx;
  268. }
  269. .demo-image {
  270. width: 100%;
  271. border-radius: 4px;
  272. }
  273. .demo-title {
  274. font-size: 30rpx;
  275. margin-top: 5px;
  276. color: $up-main-color;
  277. margin-left: 15rpx;
  278. display: -webkit-box;
  279. -webkit-box-orient: vertical;
  280. -webkit-line-clamp: 2;
  281. /* 限制显示两行 */
  282. overflow: hidden;
  283. text-overflow: ellipsis;
  284. /* 超出部分显示省略号 */
  285. word-break: break-all;
  286. }
  287. .demo-img {
  288. width: 40rpx;
  289. height: 40rpx;
  290. border-radius: 50%;
  291. }
  292. .demo-PriceDome {
  293. display: flex;
  294. font-size: 30rpx;
  295. color: $up-type-error;
  296. /* margin-top: 5px; */
  297. margin-top: 20rpx;
  298. }
  299. .demo-price {
  300. display: flex;
  301. }
  302. .name-image {
  303. width: 40rpx;
  304. height: 40rpx;
  305. }
  306. .dome-Like {
  307. margin-left: 140rpx;
  308. display: flex;
  309. justify-content: center;
  310. align-items: center;
  311. }
  312. </style>