You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

600 lines
18 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="home-content">
  3. <view class="card-container">
  4. <view class="float-button">
  5. <image @click="changeOrderType" style="width: 112rpx; height: 112rpx;" slot='cover'
  6. src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/SystemOrderCircle.png">
  7. </view>
  8. <view>
  9. <view class="top-select">
  10. <view style="width: 50%;">
  11. <view class="top-select-left" @click="getLocationInfo">
  12. <uni-icons type="location-filled" size="20" color="#FFB13F"></uni-icons>
  13. <text v-if="isCheckLocation"
  14. style="color: #FFB13F ;font-size: 28rpx;font-weight: 400; line-height: 28rpx; width: 280rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">{{locationName}}</text>
  15. <text v-else style="color: #AAAAAA;font-size: 28rpx;font-weight: 400;">选择地址</text>
  16. </view>
  17. </view>
  18. <view style="width: 50%;">
  19. <view class="top-select-right" @click="toggleCalendar('bottom')">
  20. <image style="width: 32rpx; height: 32rpx; margin-right: 10rpx;" slot='cover'
  21. src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/Calendar.png">
  22. <text v-if="isCheckTime" style="color: #FFB13F;font-size: 28rpx;font-weight: 400;">
  23. {{selectedDateShowText}}{{selectedDate.length}}</text>
  24. <text v-else style="color: #AAAAAA;font-size: 28rpx;font-weight: 400;">选择时间</text>
  25. </view>
  26. <view>
  27. <uni-popup ref="popup" background-color="#fff" @change="changePopup">
  28. <view class="popupBottom">
  29. <uni-calendar ref="calendar" class="uni-calendar--hook" :selected="selectedDate"
  30. :startDate="startDate" :endDate="endDate" :showMonth="false"
  31. @change="changeCalendar" @confirm="changeCalendar" @close="close" />
  32. <view style="display: flex; justify-content: center; align-items: center;">
  33. <!-- <button class="bottom-btn" @click="closePopup">确定</button> -->
  34. <image @click="closePopup" style="width: 670rpx; height: 80rpx;" slot='cover' src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/yesButton.png" />
  35. </view>
  36. </view>
  37. </uni-popup>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view style="display: flex; margin: 10rpx 20rpx 0 20rpx;">
  43. <!-- <view>
  44. <image v-show="isCatCheck" @click="changeSelectedPet('cat')"
  45. style="width: 224rpx; height: 96rpx; margin-right: 20rpx;" slot='cover'
  46. src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/CatCheck.png" />
  47. <image v-show="!isCatCheck" @click="changeSelectedPet('cat')"
  48. style="width: 224rpx; height: 96rpx; margin-right: 20rpx;" slot='cover'
  49. src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/CatUncheck.png" />
  50. </view>
  51. <view>
  52. <image v-show="isDogCheck" @click="changeSelectedPet('dog')"
  53. style="width: 224rpx; height: 96rpx; margin-right: 20rpx;" slot='cover'
  54. src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/DogCheck.png" />
  55. <image v-show="!isDogCheck" @click="changeSelectedPet('dog')"
  56. style="width: 224rpx; height: 96rpx; margin-right: 20rpx;" slot='cover'
  57. src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/DogUncheck.png" />
  58. </view> -->
  59. <view style="padding: 10rpx 20rpx;border-radius: 50rpx;background-color: #fff;
  60. display: flex;align-items: center;justify-content: center;width: 450rpx;margin-right: 30rpx;
  61. color: #AAAAAA;" @click="openFilterPopup">
  62. <text>伴宠师条件筛选</text>
  63. <uni-icons type="forward" size="30rpx" color="#aaa"
  64. style="margin-top: 7rpx;margin-left: 10rpx;"></uni-icons>
  65. </view>
  66. <!-- 筛选弹窗组件 -->
  67. <filter-popup ref="filterPopup" @confirm="handleFilterConfirm"></filter-popup>
  68. <uni-easyinput style="border-radius: 84rpx; width: 224rpx; height: 96rpx;" borderColor="#FFB13F"
  69. prefixIcon="search" v-model="value" placeholder="输入名称" @iconClick="iconClick"></uni-easyinput>
  70. <!-- <view style="width: 50%;" class="card">
  71. <uni-data-checkbox multiple selectedColor="#FFB13F" v-model="selectedPet" :localdata="catOrdog"
  72. @change="changeSelectedPet"></uni-data-checkbox>
  73. </view>
  74. <view style="width: 50%;">
  75. <uni-easyinput style="border-radius: 30rpx;" borderColor="#FFB13F" prefixIcon="search"
  76. v-model="value" placeholder="搜索" @iconClick="iconClick"></uni-easyinput>
  77. </view> -->
  78. <!-- <checkbox-group>
  79. <label>
  80. <checkbox value="cb" checked="true" color="#FFB13F" style="transform:scale(0.7)" />选中
  81. </label>
  82. <label>
  83. <checkbox class="color_FFB13F" value="cb" color="#FFB13F" style="transform:scale(0.7)" />未选中
  84. </label>
  85. </checkbox-group> -->
  86. </view>
  87. <view>
  88. <view v-if="companionList.length > 0">
  89. <uni-row :span="12" v-for="(item,index) in companionList" :key="index">
  90. <uni-card :is-shadow="false" padding=0 margin="10px">
  91. <view class="personal-list-item">
  92. <view class="personal-info">
  93. <view @click="getInfo(item.id)">
  94. <image class="people-img" slot='cover'
  95. :src="item&&item.staffImages&&item.staffImages.length>0?item.staffImages[0].url:defaultStaffIamge">
  96. </image>
  97. </view>
  98. <view class="personal-info-1">
  99. <view class="personal-info-2">
  100. <view class="personal-info-title" @click="getInfo(item.id)">
  101. <view class="personal-name">
  102. {{item.name}}
  103. </view>
  104. <view class="personal-sex">
  105. <img :src="item.gender=='男生'?'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_m.png':
  106. 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_f.png'" alt="sex"
  107. style="width: 20px;height: 20px;" />
  108. </view>
  109. </view>
  110. <view class="personal-star" @click="checkIsLike">
  111. <text style="color: #FFB13F;">客户点赞数{{likeNum}}</text>
  112. <uni-icons v-if="isLike" type="hand-up-filled" size="20"
  113. color="#FFB13F"></uni-icons>
  114. <uni-icons v-else type="hand-up" size="20" color="#FFB13F"></uni-icons>
  115. </view>
  116. </view>
  117. <view class="personal-info-3" style="width: 100%;">
  118. <view class="ellipsis">
  119. 距离{{item.id}}km
  120. </view>
  121. </view>
  122. <view class="personal-info-4" style="width: 100%;">
  123. <view class="ellipsis" style="max-width: 225px;">
  124. 简介{{item.shortDescription}}
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. <view>
  131. <view class="personal-item-bottom">
  132. <text class="personal-item-bottom-text">养宠4年 | 评价11条 | 服务小结13份</text>
  133. </view>
  134. </view>
  135. </uni-card>
  136. </uni-row>
  137. </view>
  138. <view v-else
  139. style="display: flex; justify-content: center; align-items: center; height: 100px; font-size: 16px; font-weight: bold;">
  140. 暂无数据
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </template>
  146. <script>
  147. import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue';
  148. import uniFab from '@/uni_modules/uni-fab/components/uni-fab/uni-fab.vue'
  149. import FilterPopup from '@/components/FilterPopup/FilterPopup.vue'
  150. import {
  151. getCompanionList,
  152. getCompanionInfo
  153. } from "@/api/system/companion"
  154. export default {
  155. data() {
  156. return {
  157. allInfo: {
  158. isCheckLocation: false,
  159. locationName: '',
  160. locationLatitude: '',
  161. locationLongitude: '',
  162. locationAddress: '',
  163. selectedDate: [],
  164. isCheckTime: false,
  165. },
  166. // 筛选条件
  167. filterOptions: {
  168. gender: '',
  169. petTypes: [],
  170. level: ''
  171. },
  172. selectedDate: [],
  173. startDate: '',
  174. endDate: '',
  175. isCheckLocation: false,
  176. locationName: '',
  177. locationLatitude: '',
  178. locationLongitude: '',
  179. locationAddress: '',
  180. isCheckTime: false,
  181. selectedDateShowText: '',
  182. isCatCheck: true,
  183. isDogCheck: true,
  184. petTypes: ['1', '2'],
  185. value: '',
  186. companionList: [],
  187. isLike: false,
  188. likeNum: 560,
  189. defaultStaffIamge: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/banner/gold_people.png',
  190. }
  191. },
  192. components: {
  193. uniPopup,
  194. FilterPopup
  195. },
  196. onLoad: function(option) {
  197. let info = JSON.parse(decodeURIComponent(option.info));
  198. this.allInfo = info
  199. console.log('this.allInfo', this.allInfo);
  200. this.setInfo()
  201. this.getCompanionList()
  202. },
  203. mounted() {
  204. this.getCalendarDate();
  205. },
  206. methods: {
  207. setInfo() {
  208. this.isCheckLocation = this.allInfo.isCheckLocation
  209. this.locationName = this.allInfo.locationName
  210. this.locationLatitude = this.allInfo.locationLatitude
  211. this.locationLongitude = this.allInfo.locationLongitude
  212. this.locationAddress = this.allInfo.locationAddress
  213. this.selectedDate = this.allInfo.selectedDate
  214. this.isCheckTime = this.allInfo.isCheckTime
  215. if (this.allInfo.selectedDate.length == 1) {
  216. this.selectedDateShowText = this.allInfo.selectedDate[0].date.replace(/-/g, "/") + ' '
  217. } else if (this.allInfo.selectedDate.length > 1) {
  218. this.selectedDateShowText = this.allInfo.selectedDate[0].date.replace(/-/g, "/") + '...' + ' '
  219. }
  220. },
  221. checkIsLike() {
  222. this.isLike = !this.isLike
  223. this.$forceUpdate()
  224. },
  225. changeOrderType() {
  226. uni.navigateTo({
  227. url: '/pages/newOrder/serviceNew2'
  228. });
  229. },
  230. getInfo(id) {
  231. if (id) {
  232. uni.navigateTo({
  233. // url: '/pages/companionPetList/companionPetInfo',
  234. url: `/pages/companionPetList/companionPetInfo?id=${id}`
  235. });
  236. }
  237. },
  238. trigger(e) {
  239. uni.showModal({
  240. title: '提示',
  241. content: `激活状态:${e.item.active};选中项:${e.item.text}`,
  242. success(res) {
  243. if (res.confirm) {
  244. console.log('用户点击确定');
  245. } else if (res.cancel) {
  246. console.log('用户点击取消');
  247. }
  248. }
  249. });
  250. },
  251. fabClick() {
  252. uni.showToast({
  253. title: '点击了悬浮按钮',
  254. icon: 'none'
  255. });
  256. },
  257. getCompanionList() {
  258. // let data = {
  259. // longitude: this.locationLongitude,
  260. // latitude: this.locationLatitude,
  261. // petTypes: this.selectedPet,
  262. // staffName: '',
  263. // address: this.locationAddress
  264. // }
  265. let data = {
  266. address: "上海市浦东新区浦东南路150弄",
  267. latitude: 29.56471,
  268. longitude: 106.55073,
  269. petTypes: ["1", "2"],
  270. staffName: "君"
  271. }
  272. console.log('data', data);
  273. getCompanionList(data).then(response => {
  274. if (response.code == 200) {
  275. this.companionList = response.rows
  276. console.log(response);
  277. }
  278. console.log(response);
  279. })
  280. },
  281. iconClick() {},
  282. changeSelectedPet(type) {
  283. console.log('changeSelectedPet type', type);
  284. if (type == 'cat') {
  285. this.isCatCheck = !this.isCatCheck
  286. if (this.petTypes.includes('1')) {
  287. if (!this.isCatCheck) {
  288. this.petTypes = this.petTypes.filter(item => item !== '1');
  289. }
  290. } else {
  291. this.isCatCheck ? this.petTypes.push('1') : ''
  292. }
  293. } else {
  294. this.isDogCheck = !this.isDogCheck
  295. if (this.petTypes.includes('2')) {
  296. if (!this.isDogCheck) {
  297. this.petTypes = this.petTypes.filter(item => item !== '2');
  298. }
  299. } else {
  300. this.isDogCheck ? this.petTypes.push('2') : ''
  301. }
  302. }
  303. console.log('this.petTypes', this.petTypes);
  304. },
  305. toggleCalendar(type) {
  306. this.type = type
  307. uni.hideTabBar()
  308. this.$refs.popup.open(type)
  309. },
  310. closePopup() {
  311. this.$refs.popup.close()
  312. setTimeout(() => {
  313. uni.showTabBar()
  314. }, 300)
  315. },
  316. changePopup(e) {
  317. console.log('当前模式:' + e.type + ',状态:' + e.show);
  318. if (e.show) {
  319. uni.hideTabBar()
  320. } else {
  321. setTimeout(() => {
  322. uni.showTabBar()
  323. }, 300)
  324. }
  325. },
  326. close() {
  327. console.log('弹窗关闭');
  328. },
  329. confirm(e) {
  330. console.log('confirm 返回:', e)
  331. },
  332. changeCalendar(e) {
  333. console.log('change 返回:', e)
  334. this.selectedDateShowText = ''
  335. // 选中日期
  336. const selectedValue = this.selectedDate.find(item => item.date === e.fulldate)
  337. if (selectedValue) {
  338. // 存在则移除
  339. this.selectedDate = this.selectedDate.filter(item => item.date !== e.fulldate);
  340. } else {
  341. this.selectedDate.push({
  342. date: e.fulldate,
  343. info: 'time'
  344. })
  345. }
  346. if (this.selectedDate.length > 0) {
  347. this.isCheckTime = true
  348. if (this.selectedDate.length == 1) {
  349. this.selectedDateShowText = this.selectedDate[0].date.replace(/-/g, "/") + ' '
  350. } else {
  351. this.selectedDateShowText = this.selectedDate[0].date.replace(/-/g, "/") + '...' + ' '
  352. }
  353. } else {
  354. this.isCheckTime = false
  355. }
  356. },
  357. getCalendarDate() {
  358. let tomorrow = new Date()
  359. tomorrow.setDate(tomorrow.getDate() + 2);
  360. this.startDate = this.formatDate(tomorrow);
  361. // 获取三个月后的日期
  362. let threeMonthsLater = new Date();
  363. threeMonthsLater.setMonth(threeMonthsLater.getMonth() + 3);
  364. this.endDate = this.formatDate(threeMonthsLater);
  365. },
  366. formatDate(date) {
  367. let year = date.getFullYear();
  368. let month = (date.getMonth() + 1).toString().padStart(2, '0');
  369. let day = date.getDate().toString().padStart(2, '0');
  370. return year + '-' + month + '-' + day;
  371. },
  372. getLocationInfo() {
  373. wx.chooseLocation({
  374. type: 'gcj02', // 坐标系,默认为 wgs84 返回 gps 原始坐标,gcj02 返回可用于 wx.openLocation 的坐标
  375. success: (res) => {
  376. // 成功回调
  377. this.isCheckLocation = true
  378. this.locationName = res.address
  379. this.locationLongitude = res.longitude
  380. this.locationLatitude = res.latitude
  381. this.locationAddress = res.address
  382. console.log('选择的位置:', res);
  383. },
  384. fail: (err) => {
  385. // 失败回调
  386. console.error('选择位置失败:', err);
  387. }
  388. });
  389. },
  390. // 打开筛选弹窗
  391. openFilterPopup() {
  392. this.$refs.filterPopup.open()
  393. },
  394. // 处理筛选确认
  395. handleFilterConfirm(filterData) {
  396. console.log('筛选条件:', filterData)
  397. this.filterOptions = filterData
  398. // 根据筛选条件重新获取数据
  399. this.getCompanionList()
  400. },
  401. }
  402. }
  403. </script>
  404. <style lang="scss">
  405. .home-content {
  406. background: linear-gradient(360deg, #F5F5F7 0%, #FFBF60 99%);
  407. .card-container {
  408. margin: 0;
  409. padding: 0;
  410. .uni-card {
  411. border-radius: 16rpx;
  412. }
  413. .top-select {
  414. background-color: #fff;
  415. border: 1px solid #EBEEF5;
  416. // box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.08);
  417. display: flex;
  418. justify-content: space-between;
  419. margin: 0 10px 10px 10px;
  420. border-radius: 16rpx;
  421. padding: 13px;
  422. .top-select-left {
  423. display: flex;
  424. flex-wrap: nowrap;
  425. align-items: center;
  426. // justify-content: space-around;
  427. }
  428. .top-select-right {
  429. display: flex;
  430. flex-wrap: nowrap;
  431. align-items: center;
  432. }
  433. }
  434. .float-button {
  435. z-index: 10;
  436. position: fixed;
  437. bottom: 100rpx;
  438. /* 距离底部的距离 */
  439. right: 32rpx;
  440. /* 距离右侧的距离 */
  441. // width: 50px;
  442. // /* 按钮的宽度 */
  443. // height: 50px;
  444. }
  445. .is-input-border {
  446. border-radius: 84rpx;
  447. height: 96rpx;
  448. width: 224rpx;
  449. }
  450. .card {
  451. // border-radius: 50rpx;
  452. width: 50%;
  453. background-color: #fff;
  454. border: 1px solid #EBEEF5;
  455. box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.08);
  456. margin-right: 20rpx;
  457. // height: 80rpx;
  458. display: flex;
  459. align-items: center;
  460. justify-content: center;
  461. }
  462. .personal-list-item {
  463. padding: 10px 0px 0px 0;
  464. .personal-info {
  465. display: flex;
  466. align-items: center;
  467. justify-content: flex-start;
  468. .people-img {
  469. width: 168rpx;
  470. height: 168rpx;
  471. border: #FEA714 5rpx solid;
  472. border-radius: 20rpx;
  473. }
  474. .personal-info-1 {
  475. margin-left: 10px;
  476. width: 100%;
  477. .personal-info-2 {
  478. display: flex;
  479. flex-wrap: wrap;
  480. .personal-info-title {
  481. display: flex;
  482. flex-wrap: wrap;
  483. width: 60%;
  484. }
  485. .personal-name {
  486. color: #333;
  487. font-size: 32rpx;
  488. // line-height: 32rpx;
  489. margin-right: 10rpx;
  490. font-weight: 900;
  491. font-style: normal;
  492. }
  493. .personal-star {
  494. color: #FFAA48;
  495. font-size: 24rpx;
  496. font-weight: 400;
  497. line-height: 32rpx;
  498. }
  499. }
  500. .personal-info-3 {
  501. display: flex;
  502. align-items: baseline;
  503. font-size: 28rpx;
  504. line-height: 32rpx;
  505. margin-top: 5px;
  506. color: #FFAA48;
  507. font-weight: 900;
  508. }
  509. .personal-info-4 {
  510. display: flex;
  511. align-items: baseline;
  512. font-size: 24rpx;
  513. margin-top: 10px;
  514. color: #7D8196;
  515. font-weight: 400;
  516. line-height: 32rpx;
  517. }
  518. }
  519. }
  520. }
  521. .personal-item-bottom {
  522. height: 60rpx;
  523. background-color: #FFF4E5;
  524. margin: 20rpx 0 20rpx 0;
  525. display: flex;
  526. align-items: center;
  527. justify-content: center;
  528. border-radius: 8rpx;
  529. .personal-item-bottom-text {
  530. color: #A94F20;
  531. margin: 14rpx;
  532. font-size: 24rpx;
  533. font-weight: 400;
  534. }
  535. }
  536. .popupBottom {
  537. z-index: 99;
  538. height: 950rpx;
  539. overflow: hidden;
  540. position: fixed;
  541. bottom: 0;
  542. left: 0;
  543. right: 0;
  544. padding: 10rpx 20rpx;
  545. border-radius: 20rpx 20rpx 0 0;
  546. background-color: #fff;
  547. .bottom-btn {
  548. width: 100%;
  549. border-radius: 120rpx;
  550. background: #FFB13F;
  551. font-size: 32rpx;
  552. color: #FFFFFF;
  553. }
  554. }
  555. ::v-deep .wx-radio-input.wx-radio-input-checked {
  556. background-color: #00875a !important;
  557. border-color: #00875a !important;
  558. color: #ffffff !important;
  559. }
  560. .color_FFB13F {
  561. color: #FFB13F;
  562. }
  563. }
  564. }
  565. </style>