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.

633 lines
19 KiB

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