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.

652 lines
20 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 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" style="padding: 10rpx 0;">
  89. <uni-row :span="12" v-for="(item,index) in companionList" :key="index">
  90. <uni-card :is-shadow="false" padding=0 margin="6rpx 20rpx"
  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. let info = encodeURIComponent(JSON
  247. .stringify(this.allInfo))
  248. uni.navigateTo({
  249. // url: '/pages/companionPetList/companionPetInfo',
  250. url: `/pages/companionPetList/companionPetInfo?id=${id}`
  251. });
  252. }
  253. },
  254. trigger(e) {
  255. uni.showModal({
  256. title: '提示',
  257. content: `激活状态:${e.item.active};选中项:${e.item.text}`,
  258. success(res) {
  259. if (res.confirm) {
  260. console.log('用户点击确定');
  261. } else if (res.cancel) {
  262. console.log('用户点击取消');
  263. }
  264. }
  265. });
  266. },
  267. fabClick() {
  268. uni.showToast({
  269. title: '点击了悬浮按钮',
  270. icon: 'none'
  271. });
  272. },
  273. getCompanionList() {
  274. // let data = {
  275. // longitude: this.locationLongitude,
  276. // latitude: this.locationLatitude,
  277. // petTypes: this.selectedPet,
  278. // staffName: '',
  279. // address: this.locationAddress
  280. // }
  281. let data = {
  282. // address: "上海市浦东新区浦东南路150弄",
  283. latitude: 29.56471,
  284. longitude: 106.55073,
  285. // petTypes: ["1", "2"],
  286. userName: this.value,
  287. }
  288. if(this.filterOptions.gender){
  289. data.sex = this.filterOptions.gender == '男' ? 0 : 1
  290. }
  291. if(this.filterOptions.petTypes.length){
  292. data.petTypes = this.filterOptions.petTypes.join(',')
  293. }
  294. if(this.filterOptions.level){
  295. data.level = this.filterOptions.level
  296. }
  297. console.log('data', data);
  298. // getCompanionList(data).then(response => {
  299. // if (response.code == 200) {
  300. // this.companionList = response.rows
  301. // console.log(response);
  302. // }
  303. // console.log(response);
  304. // })
  305. getTeacherList(data).then(response => {
  306. if (response.code == 200) {
  307. this.companionList = response.rows
  308. this.calculateTeacherListDistance()
  309. }
  310. console.log(response);
  311. })
  312. },
  313. calculateTeacherListDistance(){
  314. this.companionList.forEach(item => {
  315. item.distanceText = this.calculateDistanceAddress(item.appletAddresseList)
  316. })
  317. },
  318. iconClick() {},
  319. changeSelectedPet(type) {
  320. console.log('changeSelectedPet type', type);
  321. if (type == 'cat') {
  322. this.isCatCheck = !this.isCatCheck
  323. if (this.petTypes.includes('1')) {
  324. if (!this.isCatCheck) {
  325. this.petTypes = this.petTypes.filter(item => item !== '1');
  326. }
  327. } else {
  328. this.isCatCheck ? this.petTypes.push('1') : ''
  329. }
  330. } else {
  331. this.isDogCheck = !this.isDogCheck
  332. if (this.petTypes.includes('2')) {
  333. if (!this.isDogCheck) {
  334. this.petTypes = this.petTypes.filter(item => item !== '2');
  335. }
  336. } else {
  337. this.isDogCheck ? this.petTypes.push('2') : ''
  338. }
  339. }
  340. console.log('this.petTypes', this.petTypes);
  341. },
  342. toggleCalendar(type) {
  343. this.type = type
  344. uni.hideTabBar()
  345. this.$refs.popup.open(type)
  346. },
  347. closePopup() {
  348. this.$refs.popup.close()
  349. setTimeout(() => {
  350. uni.showTabBar()
  351. }, 300)
  352. },
  353. changePopup(e) {
  354. console.log('当前模式:' + e.type + ',状态:' + e.show);
  355. if (e.show) {
  356. uni.hideTabBar()
  357. } else {
  358. setTimeout(() => {
  359. uni.showTabBar()
  360. }, 300)
  361. }
  362. },
  363. close() {
  364. console.log('弹窗关闭');
  365. },
  366. confirm(e) {
  367. console.log('confirm 返回:', e)
  368. },
  369. changeCalendar(e) {
  370. console.log('change 返回:', e)
  371. this.selectedDateShowText = ''
  372. // 选中日期
  373. const selectedValue = this.selectedDate.find(item => item.date === e.fulldate)
  374. if (selectedValue) {
  375. // 存在则移除
  376. this.selectedDate = this.selectedDate.filter(item => item.date !== e.fulldate);
  377. } else {
  378. this.selectedDate.push({
  379. date: e.fulldate,
  380. info: 'time'
  381. })
  382. }
  383. if (this.selectedDate.length > 0) {
  384. this.isCheckTime = true
  385. if (this.selectedDate.length == 1) {
  386. this.selectedDateShowText = this.selectedDate[0].date.replace(/-/g, "/") + ' '
  387. } else {
  388. this.selectedDateShowText = this.selectedDate[0].date.replace(/-/g, "/") + '...' + ' '
  389. }
  390. } else {
  391. this.isCheckTime = false
  392. }
  393. },
  394. getCalendarDate() {
  395. let tomorrow = new Date()
  396. tomorrow.setDate(tomorrow.getDate() + 2);
  397. this.startDate = this.formatDate(tomorrow);
  398. // 获取三个月后的日期
  399. let threeMonthsLater = new Date();
  400. threeMonthsLater.setMonth(threeMonthsLater.getMonth() + 3);
  401. this.endDate = this.formatDate(threeMonthsLater);
  402. },
  403. formatDate(date) {
  404. let year = date.getFullYear();
  405. let month = (date.getMonth() + 1).toString().padStart(2, '0');
  406. let day = date.getDate().toString().padStart(2, '0');
  407. return year + '-' + month + '-' + day;
  408. },
  409. getLocationInfo() {
  410. wx.chooseLocation({
  411. type: 'gcj02', // 坐标系,默认为 wgs84 返回 gps 原始坐标,gcj02 返回可用于 wx.openLocation 的坐标
  412. success: (res) => {
  413. // 成功回调
  414. this.isCheckLocation = true
  415. this.locationName = res.address
  416. this.locationLongitude = res.longitude
  417. this.locationLatitude = res.latitude
  418. this.locationAddress = res.address
  419. console.log('选择的位置:', res);
  420. this.position.address = this.locationAddress
  421. this.position.longitude = this.locationLongitude
  422. this.position.latitude = this.locationLatitude
  423. },
  424. fail: (err) => {
  425. // 失败回调
  426. console.error('选择位置失败:', err);
  427. }
  428. });
  429. },
  430. // 打开筛选弹窗
  431. openFilterPopup() {
  432. this.$refs.filterPopup.open()
  433. },
  434. // 处理筛选确认
  435. handleFilterConfirm(filterData) {
  436. console.log('筛选条件:', filterData)
  437. this.filterOptions = filterData
  438. // 根据筛选条件重新获取数据
  439. this.getCompanionList()
  440. },
  441. }
  442. }
  443. </script>
  444. <style lang="scss">
  445. .home-content {
  446. background: linear-gradient(360deg, #F5F5F7 0%, #FFBF60 99%);
  447. .card-container {
  448. margin: 0;
  449. padding: 0;
  450. .uni-card {
  451. border-radius: 16rpx;
  452. }
  453. .top-select {
  454. background-color: #fff;
  455. border: 1px solid #EBEEF5;
  456. // box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.08);
  457. display: flex;
  458. justify-content: space-between;
  459. margin: 0 10px 10px 10px;
  460. border-radius: 16rpx;
  461. padding: 13px;
  462. .top-select-left {
  463. display: flex;
  464. flex-wrap: nowrap;
  465. align-items: center;
  466. // justify-content: space-around;
  467. }
  468. .top-select-right {
  469. display: flex;
  470. flex-wrap: nowrap;
  471. align-items: center;
  472. }
  473. }
  474. .float-button {
  475. z-index: 10;
  476. position: fixed;
  477. bottom: 100rpx;
  478. /* 距离底部的距离 */
  479. right: 32rpx;
  480. /* 距离右侧的距离 */
  481. // width: 50px;
  482. // /* 按钮的宽度 */
  483. // height: 50px;
  484. }
  485. .is-input-border {
  486. border-radius: 84rpx;
  487. height: 96rpx;
  488. width: 224rpx;
  489. }
  490. .card {
  491. // border-radius: 50rpx;
  492. width: 50%;
  493. background-color: #fff;
  494. border: 1px solid #EBEEF5;
  495. box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.08);
  496. margin-right: 20rpx;
  497. // height: 80rpx;
  498. display: flex;
  499. align-items: center;
  500. justify-content: center;
  501. }
  502. .personal-list-item {
  503. padding: 10px 0px 0px 0;
  504. .personal-info {
  505. display: flex;
  506. align-items: center;
  507. justify-content: flex-start;
  508. .people-img {
  509. width: 168rpx;
  510. height: 168rpx;
  511. border: #FEA714 5rpx solid;
  512. border-radius: 20rpx;
  513. }
  514. .personal-info-1 {
  515. margin-left: 10px;
  516. width: 100%;
  517. .personal-info-2 {
  518. display: flex;
  519. flex-wrap: wrap;
  520. .personal-info-title {
  521. display: flex;
  522. flex-wrap: wrap;
  523. width: 60%;
  524. }
  525. .personal-name {
  526. color: #333;
  527. font-size: 28rpx;
  528. // line-height: 32rpx;
  529. margin-right: 10rpx;
  530. font-weight: 900;
  531. font-style: normal;
  532. overflow: hidden;
  533. text-overflow: ellipsis;
  534. white-space: nowrap;
  535. max-width: 200rpx;
  536. }
  537. .personal-star {
  538. color: #FFAA48;
  539. font-size: 24rpx;
  540. font-weight: 400;
  541. line-height: 32rpx;
  542. }
  543. }
  544. .personal-info-3 {
  545. display: flex;
  546. align-items: baseline;
  547. font-size: 28rpx;
  548. line-height: 32rpx;
  549. margin-top: 5px;
  550. color: #FFAA48;
  551. font-weight: 900;
  552. }
  553. .personal-info-4 {
  554. display: flex;
  555. align-items: baseline;
  556. font-size: 24rpx;
  557. margin-top: 10px;
  558. color: #7D8196;
  559. font-weight: 400;
  560. line-height: 32rpx;
  561. }
  562. }
  563. }
  564. }
  565. .personal-item-bottom {
  566. height: 60rpx;
  567. background-color: #FFF4E5;
  568. margin: 20rpx 0 20rpx 0;
  569. display: flex;
  570. align-items: center;
  571. justify-content: center;
  572. border-radius: 8rpx;
  573. .personal-item-bottom-text {
  574. color: #A94F20;
  575. margin: 14rpx;
  576. font-size: 24rpx;
  577. font-weight: 400;
  578. }
  579. }
  580. .popupBottom {
  581. z-index: 99;
  582. height: 950rpx;
  583. overflow: hidden;
  584. position: fixed;
  585. bottom: 0;
  586. left: 0;
  587. right: 0;
  588. padding: 10rpx 20rpx;
  589. border-radius: 20rpx 20rpx 0 0;
  590. background-color: #fff;
  591. .bottom-btn {
  592. width: 100%;
  593. border-radius: 120rpx;
  594. background: #FFB13F;
  595. font-size: 32rpx;
  596. color: #FFFFFF;
  597. }
  598. }
  599. ::v-deep .wx-radio-input.wx-radio-input-checked {
  600. background-color: #00875a !important;
  601. border-color: #00875a !important;
  602. color: #ffffff !important;
  603. }
  604. .color_FFB13F {
  605. color: #FFB13F;
  606. }
  607. }
  608. }
  609. </style>