|
@ -149,36 +149,42 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="split-line"></view> |
|
|
<view class="split-line"></view> |
|
|
<view class="companion-content"> |
|
|
|
|
|
|
|
|
<view class="companion-content" |
|
|
|
|
|
v-for="(item,index) in companionList" :key="index" |
|
|
|
|
|
v-if="index < 1"> |
|
|
<view class="companion-item"> |
|
|
<view class="companion-item"> |
|
|
<view class="companion-info"> |
|
|
<view class="companion-info"> |
|
|
<image class="companion-img" slot='cover' |
|
|
<image class="companion-img" slot='cover' |
|
|
:src="defaultCompanion.staffImages && defaultCompanion.staffImages.length > 0 ? defaultCompanion.staffImages[0].url : defaultStaffIamge"> |
|
|
|
|
|
|
|
|
:src="item.userImage"> |
|
|
</image> |
|
|
</image> |
|
|
<view class="companion-info-1"> |
|
|
<view class="companion-info-1"> |
|
|
<view class="companion-info-2"> |
|
|
<view class="companion-info-2"> |
|
|
<view class="companion-info-title"> |
|
|
<view class="companion-info-title"> |
|
|
<view class="companion-name"> |
|
|
<view class="companion-name"> |
|
|
{{defaultCompanion.name}} |
|
|
|
|
|
|
|
|
{{ item.userName || '匿名' }} |
|
|
</view> |
|
|
</view> |
|
|
<view class="companion-sex"> |
|
|
<view class="companion-sex"> |
|
|
<image :src="defaultCompanion.gender == '1' ? 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_m.png' : 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_f.png'" alt="sex" |
|
|
|
|
|
style="width: 40rpx;height: 40rpx;" /> |
|
|
|
|
|
|
|
|
<img :src="item.appletUsersTeacher.sex == 0?'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_m.png': |
|
|
|
|
|
'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/sex_f.png'" alt="sex" |
|
|
|
|
|
style="width: 20px;height: 20px;" /> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="companion-info-star"> |
|
|
<view class="companion-info-star"> |
|
|
<text style="color: #FFB13F;">客户点赞数{{defaultCompanion.star}}</text> |
|
|
|
|
|
<uni-icons type="hand-up-filled" size="18" color="#FFB13F"></uni-icons> |
|
|
|
|
|
|
|
|
<text style="color: #FFB13F;">点赞数{{ item.appletUsersTeacher.thumbsUp || 0 }}</text> |
|
|
|
|
|
<uni-icons type="hand-up-filled" size="20" color="#FFB13F"></uni-icons> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="companion-info-3" style="width: 100%;"> |
|
|
<view class="companion-info-3" style="width: 100%;"> |
|
|
<view class="ellipsis"> |
|
|
|
|
|
距离{{defaultCompanion.distance}}km |
|
|
|
|
|
|
|
|
<view class="ellipsis" v-if="item.distanceText"> |
|
|
|
|
|
距离{{ item.distanceText }}km |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="ellipsis" v-else> |
|
|
|
|
|
{{ '<' }}1km |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="companion-info-4" style="width: 100%;"> |
|
|
<view class="companion-info-4" style="width: 100%;"> |
|
|
<view class="ellipsis" style="max-width: 450rpx;"> |
|
|
|
|
|
简介:{{defaultCompanion.shortDescription}} |
|
|
|
|
|
|
|
|
<view class="ellipsis" style="max-width: 225px;"> |
|
|
|
|
|
简介:{{ item.appletUsersTeacher.userBrief || '暂无' }} |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -186,10 +192,16 @@ |
|
|
</view> |
|
|
</view> |
|
|
<view> |
|
|
<view> |
|
|
<view class="companion-item-bottom"> |
|
|
<view class="companion-item-bottom"> |
|
|
<text class="companion-item-bottom-text">养宠{{defaultCompanion.year}}年 | 评价{{defaultCompanion.record}}条 | 服务小结{{defaultCompanion.serviceNum}}份</text> |
|
|
|
|
|
|
|
|
<text class="companion-item-bottom-text">养宠{{ item.experience || 0 }}年 | 评价{{ item.commentNum || 0 }}条 | 服务小结{{ item.serviceSummaryNum || 0 }}份</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="no-data" v-if="companionList.length == 0"> |
|
|
|
|
|
<view class="no-data-text"> |
|
|
|
|
|
您周边没有伴宠师呢 |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
</uni-card> |
|
|
</uni-card> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
@ -240,7 +252,7 @@ |
|
|
style="width: 100%;" mode="widthFix" alt="service" /> |
|
|
style="width: 100%;" mode="widthFix" alt="service" /> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="card-container"> |
|
|
|
|
|
|
|
|
<!-- <view class="card-container"> |
|
|
<uni-card :is-shadow="false" padding="0px" margin="10px"> |
|
|
<uni-card :is-shadow="false" padding="0px" margin="10px"> |
|
|
<view class="title-img4"></view> |
|
|
<view class="title-img4"></view> |
|
|
<uni-row class="demo-uni-row"> |
|
|
<uni-row class="demo-uni-row"> |
|
@ -258,7 +270,7 @@ |
|
|
|
|
|
|
|
|
</uni-row> |
|
|
</uni-row> |
|
|
</uni-card> |
|
|
</uni-card> |
|
|
</view> |
|
|
|
|
|
|
|
|
</view> --> |
|
|
|
|
|
|
|
|
<view> |
|
|
<view> |
|
|
<image style="height: 132rpx; width: 710rpx; margin: 0 20rpx 20rpx 20rpx;" |
|
|
<image style="height: 132rpx; width: 710rpx; margin: 0 20rpx 20rpx 20rpx;" |
|
@ -343,7 +355,10 @@ |
|
|
getOpenIdKey, |
|
|
getOpenIdKey, |
|
|
setOpenIdKey |
|
|
setOpenIdKey |
|
|
} from '@/utils/auth' |
|
|
} from '@/utils/auth' |
|
|
import { getTeacherListIndex } from '@/api/home' |
|
|
|
|
|
|
|
|
// import { getTeacherListIndex } from '@/api/home' |
|
|
|
|
|
import { |
|
|
|
|
|
getTeacherList, |
|
|
|
|
|
} from "@/api/order/order" |
|
|
import Kefu from './common/kefu.vue' |
|
|
import Kefu from './common/kefu.vue' |
|
|
import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'; |
|
|
import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'; |
|
|
import NewUserCoupon from './components/NewUserCoupon.vue'; |
|
|
import NewUserCoupon from './components/NewUserCoupon.vue'; |
|
@ -409,6 +424,7 @@ |
|
|
numTime: "2024.12.12", |
|
|
numTime: "2024.12.12", |
|
|
}, |
|
|
}, |
|
|
currentCoupon: null, |
|
|
currentCoupon: null, |
|
|
|
|
|
companionList: [], |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
components: { |
|
|
components: { |
|
@ -604,72 +620,43 @@ |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
getCompanionList() { |
|
|
|
|
|
|
|
|
getLocation(){ |
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
|
uni.getLocation({ |
|
|
|
|
|
type: 'gcj02', |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
resolve(res) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
async getCompanionList() { |
|
|
// 构建参数,使用当前位置坐标 |
|
|
// 构建参数,使用当前位置坐标 |
|
|
let data = { |
|
|
let data = { |
|
|
address: this.locationAddress || "上海市浦东新区浦东南路150弄", |
|
|
|
|
|
latitude: this.locationLatitude || 31.22514, |
|
|
|
|
|
longitude: this.locationLongitude || 121.49857, |
|
|
|
|
|
petTypes: ["1", "2"], |
|
|
|
|
|
staffName: "" |
|
|
|
|
|
|
|
|
latitude: this.position.latitude, |
|
|
|
|
|
longitude: this.position.longitude, |
|
|
} |
|
|
} |
|
|
console.log('获取周边伴宠师参数:', data); |
|
|
|
|
|
|
|
|
|
|
|
// 保存当前位置到Vuex,让position mixin能使用 |
|
|
|
|
|
this.$store.commit('setPosition', { |
|
|
|
|
|
address: this.locationAddress, |
|
|
|
|
|
longitude: this.locationLongitude, |
|
|
|
|
|
latitude: this.locationLatitude |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
getTeacherListIndex(data).then(response => { |
|
|
|
|
|
if (response.code == 200 && response.rows && response.rows.length > 0) { |
|
|
|
|
|
const nearbyTeacher = response.rows[0]; |
|
|
|
|
|
console.log('伴宠师原始数据:', nearbyTeacher); |
|
|
|
|
|
|
|
|
|
|
|
// 如果伴宠师有地址信息,使用mixin的calculateDistanceAddress计算距离 |
|
|
|
|
|
let distance = 0; |
|
|
|
|
|
if (nearbyTeacher.addressList && nearbyTeacher.addressList.length > 0) { |
|
|
|
|
|
distance = this.calculateDistanceAddress(nearbyTeacher.addressList); |
|
|
|
|
|
} else if (nearbyTeacher.latitude && nearbyTeacher.longitude) { |
|
|
|
|
|
// 如果没有地址列表但有经纬度信息,则构造地址对象 |
|
|
|
|
|
const addressList = [{ |
|
|
|
|
|
latitude: nearbyTeacher.latitude, |
|
|
|
|
|
longitude: nearbyTeacher.longitude |
|
|
|
|
|
}]; |
|
|
|
|
|
distance = this.calculateDistanceAddress(addressList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 处理用户图片 |
|
|
|
|
|
let userImageUrl = ""; |
|
|
|
|
|
if (typeof nearbyTeacher.userImage === 'string') { |
|
|
|
|
|
userImageUrl = nearbyTeacher.userImage; |
|
|
|
|
|
} else if (nearbyTeacher.userImage && Array.isArray(nearbyTeacher.userImage) && nearbyTeacher.userImage.length > 0) { |
|
|
|
|
|
userImageUrl = nearbyTeacher.userImage[0].url || ""; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 构建伴宠师信息对象 |
|
|
|
|
|
this.defaultCompanion = { |
|
|
|
|
|
name: nearbyTeacher.userName || '宠小二', |
|
|
|
|
|
gender: nearbyTeacher.gender || '1', // 性别,1-男,2-女 |
|
|
|
|
|
star: nearbyTeacher.likeNum || 0, |
|
|
|
|
|
distance: distance.toFixed(1), |
|
|
|
|
|
shortDescription: nearbyTeacher.shortDescription || '专业伴宠师,用心照顾每一位小宠物', |
|
|
|
|
|
staffImages: [{ |
|
|
|
|
|
url: userImageUrl || "https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/catdog.png" |
|
|
|
|
|
}], |
|
|
|
|
|
year: nearbyTeacher.serviceAge || 1, // 服务年限 |
|
|
|
|
|
record: nearbyTeacher.commentNum || 0, // 评价数 |
|
|
|
|
|
serviceNum: nearbyTeacher.serviceSummaryNum || 0 // 服务小结数 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log('周边伴宠师信息:', this.defaultCompanion); |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log('没有找到周边伴宠师或返回数据有误'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!data.latitude){ |
|
|
|
|
|
let res = await this.getLocation() |
|
|
|
|
|
data.latitude = res.latitude |
|
|
|
|
|
data.longitude = res.longitude |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getTeacherList(data).then(response => { |
|
|
|
|
|
if (response.code == 200) { |
|
|
|
|
|
this.companionList = response.rows |
|
|
|
|
|
this.calculateTeacherListDistance() |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
|
|
|
console.error('获取周边伴宠师失败:', err); |
|
|
|
|
|
|
|
|
console.log(response); |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
calculateTeacherListDistance(){ |
|
|
|
|
|
this.companionList.forEach(item => { |
|
|
|
|
|
item.distanceText = this.calculateDistanceAddress(item.appletAddresseList) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.companionList.sort((a,b) => a.distanceText - b.distanceText) |
|
|
}, |
|
|
}, |
|
|
getOrder(value) { |
|
|
getOrder(value) { |
|
|
if (value) { |
|
|
if (value) { |
|
@ -975,6 +962,18 @@ |
|
|
background-color: #F5F5F7 !important; |
|
|
background-color: #F5F5F7 !important; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.no-data{ |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
height: 100%; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
.no-data-text{ |
|
|
|
|
|
font-size: 24rpx; |
|
|
|
|
|
color: #999; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.home-content { |
|
|
.home-content { |
|
|
position: relative; |
|
|
position: relative; |
|
|
|
|
|
|
|
|