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.

619 lines
18 KiB

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