|
@ -6,7 +6,7 @@ |
|
|
<uni-icons type="info" size="16" color="#A94F20"></uni-icons> |
|
|
<uni-icons type="info" size="16" color="#A94F20"></uni-icons> |
|
|
</view> |
|
|
</view> |
|
|
<view class="warning-text"> |
|
|
<view class="warning-text"> |
|
|
<text>指定之前服务过的伴宠师,需要额外收10元哦!(可多选,最终由系统根据伴宠师的接单时间安排,为您安排您喜欢的伴宠师!</text> |
|
|
|
|
|
|
|
|
<text>指定之前服务过的伴宠师,需要额外收10元哦!(单选,最终由系统根据伴宠师的接单时间安排,为您安排您喜欢的伴宠师!</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
@ -14,17 +14,22 @@ |
|
|
<scroll-view scroll-y class="companion-scroll"> |
|
|
<scroll-view scroll-y class="companion-scroll"> |
|
|
<view class="companion-list"> |
|
|
<view class="companion-list"> |
|
|
<view v-for="(item, index) in companionList" :key="index" class="companion-wrapper" |
|
|
<view v-for="(item, index) in companionList" :key="index" class="companion-wrapper" |
|
|
:class="{ 'selected': selectedCompanionIds.includes(item.userId) }"> |
|
|
|
|
|
|
|
|
:class="{ 'selected': selectedCompanionId === item.userId }"> |
|
|
<!-- 左侧选中标记 --> |
|
|
<!-- 左侧选中标记 --> |
|
|
<view class="select-icon" @click="selectCompanion(item)"> |
|
|
<view class="select-icon" @click="selectCompanion(item)"> |
|
|
<view class="checkbox-circle" :class="{ 'checked': selectedCompanionIds.includes(item.userId) }"> |
|
|
|
|
|
<view class="checkbox-inner" v-if="selectedCompanionIds.includes(item.userId)"></view> |
|
|
|
|
|
|
|
|
<view class="checkbox-circle" :class="{ 'checked': selectedCompanionId === item.userId }"> |
|
|
|
|
|
<view class="checkbox-inner" v-if="selectedCompanionId === item.userId"></view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<!-- 使用CompanionItem组件 --> |
|
|
<!-- 使用CompanionItem组件 --> |
|
|
<view class="companion-item-wrapper"> |
|
|
<view class="companion-item-wrapper"> |
|
|
<companion-item :item="item" @click="handleItemClick" @like="handleItemLike"> |
|
|
|
|
|
|
|
|
<companion-item |
|
|
|
|
|
:item="item" |
|
|
|
|
|
@click="handleItemClick" |
|
|
|
|
|
:showDetailBtn="true" |
|
|
|
|
|
:showNumerBtn="false" |
|
|
|
|
|
@like="handleItemLike"> |
|
|
</companion-item> |
|
|
</companion-item> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -43,7 +48,7 @@ |
|
|
<text>取消</text> |
|
|
<text>取消</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="confirm-btn" @click="confirm"> |
|
|
<view class="confirm-btn" @click="confirm"> |
|
|
<text>确定{{ selectedCompanionIds.length > 0 ? `(${selectedCompanionIds.length})` : '' }}</text> |
|
|
|
|
|
|
|
|
<text>确定{{ selectedCompanionId ? '(1)' : '' }}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -66,7 +71,7 @@ export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
companionList: [], |
|
|
companionList: [], |
|
|
selectedCompanionIds: [], |
|
|
|
|
|
|
|
|
selectedCompanionId: null, // 改为单选 |
|
|
defaultTeacherId: null, // 默认选中的技师ID(用于再来一单) |
|
|
defaultTeacherId: null, // 默认选中的技师ID(用于再来一单) |
|
|
originalOrderData: null, // 原始订单数据 |
|
|
originalOrderData: null, // 原始订单数据 |
|
|
orderId: null, // 订单ID |
|
|
orderId: null, // 订单ID |
|
@ -74,10 +79,10 @@ export default { |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
...mapState(['teacherLevelList']), |
|
|
...mapState(['teacherLevelList']), |
|
|
// 获取当前选中的伴宠师列表 |
|
|
|
|
|
selectedCompanions() { |
|
|
|
|
|
if (this.selectedCompanionIds.length === 0) return []; |
|
|
|
|
|
return this.companionList.filter(item => this.selectedCompanionIds.includes(item.userId)); |
|
|
|
|
|
|
|
|
// 获取当前选中的伴宠师 |
|
|
|
|
|
selectedCompanion() { |
|
|
|
|
|
if (!this.selectedCompanionId) return null; |
|
|
|
|
|
return this.companionList.find(item => item.userId === this.selectedCompanionId); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad(options) { |
|
|
onLoad(options) { |
|
@ -110,8 +115,8 @@ export default { |
|
|
// 如果有默认技师ID,自动选中该技师 |
|
|
// 如果有默认技师ID,自动选中该技师 |
|
|
if (this.defaultTeacherId) { |
|
|
if (this.defaultTeacherId) { |
|
|
const defaultCompanion = this.companionList.find(item => item.userId == this.defaultTeacherId); |
|
|
const defaultCompanion = this.companionList.find(item => item.userId == this.defaultTeacherId); |
|
|
if (defaultCompanion && !this.selectedCompanionIds.includes(this.defaultTeacherId)) { |
|
|
|
|
|
this.selectedCompanionIds.push(this.defaultTeacherId); |
|
|
|
|
|
|
|
|
if (defaultCompanion) { |
|
|
|
|
|
this.selectedCompanionId = this.defaultTeacherId; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -143,24 +148,24 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 选择伴宠师(多选) |
|
|
|
|
|
|
|
|
// 选择伴宠师(单选) |
|
|
selectCompanion(companion) { |
|
|
selectCompanion(companion) { |
|
|
const userId = companion.userId; |
|
|
const userId = companion.userId; |
|
|
const index = this.selectedCompanionIds.indexOf(userId); |
|
|
|
|
|
|
|
|
|
|
|
if (index > -1) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.selectedCompanionId === userId) { |
|
|
// 如果已选中,则取消选中 |
|
|
// 如果已选中,则取消选中 |
|
|
this.selectedCompanionIds.splice(index, 1); |
|
|
|
|
|
|
|
|
this.selectedCompanionId = null; |
|
|
} else { |
|
|
} else { |
|
|
// 如果未选中,则添加到选中列表 |
|
|
|
|
|
this.selectedCompanionIds.push(userId); |
|
|
|
|
|
|
|
|
// 如果未选中,则选中该伴宠师 |
|
|
|
|
|
this.selectedCompanionId = userId; |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 处理伴宠师列表项点击事件 |
|
|
// 处理伴宠师列表项点击事件 |
|
|
handleItemClick(item) { |
|
|
handleItemClick(item) { |
|
|
// 点击伴宠师项时选中该伴宠师 |
|
|
|
|
|
this.selectCompanion(item); |
|
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
url: '/pages_order/companionPetList/companionPetInfo?id=' + item.userId |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 处理伴宠师列表项点赞事件 |
|
|
// 处理伴宠师列表项点赞事件 |
|
@ -176,9 +181,9 @@ export default { |
|
|
|
|
|
|
|
|
// 确认选择 |
|
|
// 确认选择 |
|
|
confirm() { |
|
|
confirm() { |
|
|
if (this.selectedCompanionIds.length === 0) { |
|
|
|
|
|
|
|
|
if (!this.selectedCompanionId) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '请至少选择一个伴宠师', |
|
|
|
|
|
|
|
|
title: '请选择一个伴宠师', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}); |
|
|
}); |
|
|
return; |
|
|
return; |
|
@ -249,22 +254,22 @@ export default { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 组装宠物数据 |
|
|
// 组装宠物数据 |
|
|
if (order.petVOList && order.petVOList.length > 0) { |
|
|
|
|
|
this.$globalData.newOrderData.currentPets = order.petVOList.map(pet => { |
|
|
|
|
|
// 获取该宠物的服务日期 |
|
|
|
|
|
const petServices = order.orderServiceList.filter(service => service.petId === pet.id); |
|
|
|
|
|
const selectedDate = petServices.map(service => ({ |
|
|
|
|
|
date: service.serviceDate, |
|
|
|
|
|
info: "预定" |
|
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
|
...pet, |
|
|
|
|
|
checked: ['checked'], // 默认选中 |
|
|
|
|
|
selectedDate, |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if (order.petVOList && order.petVOList.length > 0) { |
|
|
|
|
|
// this.$globalData.newOrderData.currentPets = order.petVOList.map(pet => { |
|
|
|
|
|
// // 获取该宠物的服务日期 |
|
|
|
|
|
// const petServices = order.orderServiceList.filter(service => service.petId === pet.id); |
|
|
|
|
|
// const selectedDate = petServices.map(service => ({ |
|
|
|
|
|
// date: service.serviceDate, |
|
|
|
|
|
// info: "预定" |
|
|
|
|
|
// })); |
|
|
|
|
|
|
|
|
|
|
|
// return { |
|
|
|
|
|
// ...pet, |
|
|
|
|
|
// checked: ['checked'], // 默认选中 |
|
|
|
|
|
// selectedDate, |
|
|
|
|
|
// }; |
|
|
|
|
|
// }); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: `/pages/newOrder/serviceNew` |
|
|
url: `/pages/newOrder/serviceNew` |
|
|