|
|
@ -153,7 +153,7 @@ |
|
|
|
<view class="service-row-content"> |
|
|
|
<text class="service-name" style="color: #A94F20;">额外服务费</text> |
|
|
|
<view class="service-price" style="color:#A94F20"> |
|
|
|
¥{{ feedCount > 2 ? price_config.multiService.three.price : price_config.multiService.two.price }} |
|
|
|
¥{{ (feedCount > 2 ? (isHoliday(currentMonthDay.fullDate) ? holidayPrice : normalPrice) * price_config.multiService.three.price : (isHoliday(currentMonthDay.fullDate) ? holidayPrice : normalPrice) * price_config.multiService.two.price).toFixed(2) }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -861,17 +861,20 @@ export default { |
|
|
|
this.petTypeCounts = petTypeCounts |
|
|
|
|
|
|
|
// 2.3 当日多次服务总价 |
|
|
|
// 计算每日多次服务次数费用 |
|
|
|
// 计算每日多次服务次数费用 - 基础价格乘以倍数 |
|
|
|
let multServicesTotalCost = 0 |
|
|
|
let oneDayTwoTimesDates = [] |
|
|
|
let oneDayThreeTimesDates = [] |
|
|
|
for (const date in dailyPets) { |
|
|
|
const maxFeedCount = Math.max(...dailyPets[date].map(pet => pet.feedCount)); |
|
|
|
const isHolidayDate = this.isHoliday(date); |
|
|
|
const dayPrice = isHolidayDate ? parseFloat(this.holidayPrice) : parseFloat(this.normalPrice); |
|
|
|
|
|
|
|
if (maxFeedCount === 2) { |
|
|
|
multServicesTotalCost += this.price_config.multiService.two.price; // 1天2次 |
|
|
|
multServicesTotalCost += dayPrice * this.price_config.multiService.two.price; // 基础价格 × 2次倍数 |
|
|
|
oneDayTwoTimesDates.push(date) |
|
|
|
} else if (maxFeedCount === 3) { |
|
|
|
multServicesTotalCost += this.price_config.multiService.three.price; // 1天3次 |
|
|
|
multServicesTotalCost += dayPrice * this.price_config.multiService.three.price; // 基础价格 × 3次倍数 |
|
|
|
oneDayThreeTimesDates.push(date) |
|
|
|
} |
|
|
|
} |
|
|
@ -903,7 +906,6 @@ export default { |
|
|
|
+ Number(this.baseServiceTotalCost) |
|
|
|
+ Number(this.additionalTotalCost) |
|
|
|
+ Number(this.multServicesTotalCost) |
|
|
|
+ Number(this.companionLevelPrice()) |
|
|
|
+ Number(this.customServicesTotalCost) |
|
|
|
+ Number(moreOrderPrice); // 更新总价 |
|
|
|
|
|
|
@ -963,18 +965,7 @@ export default { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
let companionLevel = this.$globalData.newOrderData.companionLevel |
|
|
|
if (companionLevel) { |
|
|
|
priceDetails.push({ |
|
|
|
name: '伴宠师等级', |
|
|
|
item: [{ |
|
|
|
itemName: companionLevel.paramValue, |
|
|
|
price: this.companionLevelPrice(), |
|
|
|
quantity: 1, |
|
|
|
unit: '位' |
|
|
|
},] |
|
|
|
}) |
|
|
|
} |
|
|
|
// 伴宠师等级价格已合并到基础服务价格中,不再单独显示 |
|
|
|
// 分别统计节假日和非节假日的天数 |
|
|
|
const uniqueDates = new Set(this.newOrderData.pets.map(item => item.serviceDate)); |
|
|
|
let holidayCount = 0; |
|
|
@ -1012,21 +1003,40 @@ export default { |
|
|
|
}); |
|
|
|
} |
|
|
|
if (this.oneDayTwoTimesDates.length > 0 || this.oneDayThreeTimesDates.length > 0) { |
|
|
|
const multiServiceItems = [] |
|
|
|
|
|
|
|
// 计算1天2次的价格明细 |
|
|
|
this.oneDayTwoTimesDates.forEach(date => { |
|
|
|
const isHolidayDate = this.isHoliday(date) |
|
|
|
const dayPrice = isHolidayDate ? parseFloat(this.holidayPrice) : parseFloat(this.normalPrice) |
|
|
|
multiServiceItems.push({ |
|
|
|
itemName: `1天2次 (${isHolidayDate ? '节假日' : '非节假日'})`, |
|
|
|
price: dayPrice * this.price_config.multiService.two.price, |
|
|
|
quantity: 1, |
|
|
|
unit: '天', |
|
|
|
date: date |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
// 计算1天3次的价格明细 |
|
|
|
this.oneDayThreeTimesDates.forEach(date => { |
|
|
|
const isHolidayDate = this.isHoliday(date) |
|
|
|
const dayPrice = isHolidayDate ? parseFloat(this.holidayPrice) : parseFloat(this.normalPrice) |
|
|
|
multiServiceItems.push({ |
|
|
|
itemName: `1天3次 (${isHolidayDate ? '节假日' : '非节假日'})`, |
|
|
|
price: dayPrice * this.price_config.multiService.three.price, |
|
|
|
quantity: 1, |
|
|
|
unit: '天', |
|
|
|
date: date |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
// 按日期排序 |
|
|
|
multiServiceItems.sort((a, b) => new Date(a.date) - new Date(b.date)) |
|
|
|
|
|
|
|
priceDetails.push({ |
|
|
|
name: '上门次数', |
|
|
|
item: [{ |
|
|
|
itemName: '1天2次', |
|
|
|
price: this.price_config.multiService.two.price, |
|
|
|
quantity: this.oneDayTwoTimesDates.length, |
|
|
|
unit: '天' |
|
|
|
}, |
|
|
|
{ |
|
|
|
itemName: '1天3次', |
|
|
|
price: this.price_config.multiService.three.price, |
|
|
|
quantity: this.oneDayThreeTimesDates.length, |
|
|
|
unit: '天' |
|
|
|
}, |
|
|
|
] |
|
|
|
item: multiServiceItems |
|
|
|
}) |
|
|
|
} |
|
|
|
// 过滤宠物类型数量>0的数组 |
|
|
@ -1144,11 +1154,16 @@ export default { |
|
|
|
initPriceConfig() { |
|
|
|
let priceConfig = this.$store.state.price_config |
|
|
|
console.log('价格配置:', priceConfig) |
|
|
|
|
|
|
|
// 获取伴宠师等级价格和城市倍率 |
|
|
|
let companionPrice = this.$globalData.newOrderData.companionLevelPrice || 0 |
|
|
|
let cityPriceRate = this.$globalData.newOrderData.cityPriceRate || 1 |
|
|
|
|
|
|
|
if(priceConfig.basePrice && priceConfig.basePrice.holiday){ |
|
|
|
this.holidayPrice = (priceConfig.basePrice.holiday * this.$store.state.memberRate).toFixed(2) |
|
|
|
this.holidayPrice = ((priceConfig.basePrice.holiday * this.$store.state.memberRate * cityPriceRate) + companionPrice).toFixed(2) |
|
|
|
} |
|
|
|
if(priceConfig.basePrice && priceConfig.basePrice.normal){ |
|
|
|
this.normalPrice = (priceConfig.basePrice.normal * this.$store.state.memberRate).toFixed(2) |
|
|
|
this.normalPrice = ((priceConfig.basePrice.normal * this.$store.state.memberRate * cityPriceRate) + companionPrice).toFixed(2) |
|
|
|
} |
|
|
|
if(priceConfig.holidays && priceConfig.holidays.length > 0){ |
|
|
|
this.holidayDate = priceConfig.holidays |
|
|
@ -1284,13 +1299,13 @@ export default { |
|
|
|
bodyType: '大型', |
|
|
|
}) * largeDogCount) |
|
|
|
} |
|
|
|
// 当日多次服务次数 |
|
|
|
// 当日多次服务次数 - 基础价格乘以倍数 |
|
|
|
let multServicesTotalCost = 0 |
|
|
|
const maxFeedCount = Math.max(...currentDayPets.map(pet => pet.feedCount)); |
|
|
|
if (maxFeedCount === 2) { |
|
|
|
multServicesTotalCost += this.price_config.multiService.two.price; // 1天2次 |
|
|
|
multServicesTotalCost += baseServiceCost * this.price_config.multiService.two.price; // 基础价格 × 2次倍数 |
|
|
|
} else if (maxFeedCount === 3) { |
|
|
|
multServicesTotalCost += this.price_config.multiService.three.price; // 1天3次 |
|
|
|
multServicesTotalCost += baseServiceCost * this.price_config.multiService.three.price; // 基础价格 × 3次倍数 |
|
|
|
} |
|
|
|
// 所有宠物定制服务费用 |
|
|
|
const customServiceCost = currentDayPets.reduce((acc, pet) => acc + this.calculatePetCustomServiceCost(pet), 0) |
|
|
|