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.

565 lines
16 KiB

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