|
@ -155,9 +155,9 @@ |
|
|
|
|
|
|
|
|
<view class="service-new-address"> |
|
|
<view class="service-new-address"> |
|
|
<view v-if="needPreFamiliarize.length>0" class="total-cost"> |
|
|
<view v-if="needPreFamiliarize.length>0" class="total-cost"> |
|
|
<view>提前熟悉 </view> |
|
|
|
|
|
<view>¥{{ (price_config.preFamiliarize && price_config.preFamiliarize.price) || 40 }}</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
<view>提前熟悉 </view> |
|
|
|
|
|
<view>¥{{ (price_config && price_config.preFamiliarize && price_config.preFamiliarize.price) || 40 }}</view> |
|
|
|
|
|
</view> |
|
|
<!-- 伴宠师价格已合并到基础服务价格中,不再单独显示 --> |
|
|
<!-- 伴宠师价格已合并到基础服务价格中,不再单独显示 --> |
|
|
<view class="total-cost"> |
|
|
<view class="total-cost"> |
|
|
<view>费用总计 </view> |
|
|
<view>费用总计 </view> |
|
@ -216,7 +216,7 @@ |
|
|
<view class="service-new-details-desc"> |
|
|
<view class="service-new-details-desc"> |
|
|
<view style="display: flex;"> |
|
|
<view style="display: flex;"> |
|
|
<text style="width: 20rpx;">*</text> |
|
|
<text style="width: 20rpx;">*</text> |
|
|
<text style="flex: 1;">价格{{ price_config.preFamiliarize.price }}元/次</text> |
|
|
|
|
|
|
|
|
<text style="flex: 1;">价格{{ (price_config && price_config.preFamiliarize && price_config.preFamiliarize.price) || 40 }}元/次</text> |
|
|
</view> |
|
|
</view> |
|
|
<view style="display: flex; margin: 20rpx 0;"> |
|
|
<view style="display: flex; margin: 20rpx 0;"> |
|
|
<text style="width: 20rpx;">*</text> |
|
|
<text style="width: 20rpx;">*</text> |
|
@ -391,14 +391,20 @@ |
|
|
this.getCouponList() |
|
|
this.getCouponList() |
|
|
// this.totalPrice = this.$globalData.newOrderData.totalPrice |
|
|
// this.totalPrice = this.$globalData.newOrderData.totalPrice |
|
|
|
|
|
|
|
|
this.companionLevelTitle = this.$globalData.newOrderData.companionLevel.paramValue |
|
|
|
|
|
|
|
|
this.companionLevelTitle = (this.$globalData.newOrderData.companionLevel && this.$globalData.newOrderData.companionLevel.paramValue) || '' |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
companionLevelPrice(){ |
|
|
companionLevelPrice(){ |
|
|
let companionLevel = this.$globalData.newOrderData.companionLevel |
|
|
let companionLevel = this.$globalData.newOrderData.companionLevel |
|
|
let price = Number(companionLevel.paramValueText) * this.isAddPrice() |
|
|
|
|
|
|
|
|
|
|
|
return price * this.$store.state.memberRate |
|
|
|
|
|
|
|
|
if (!companionLevel || !companionLevel.paramValueText) { |
|
|
|
|
|
return 0 |
|
|
|
|
|
} |
|
|
|
|
|
let paramValueText = isNaN(companionLevel.paramValueText) ? 0 : Number(companionLevel.paramValueText) |
|
|
|
|
|
let addPrice = this.isAddPrice() |
|
|
|
|
|
let memberRate = isNaN(this.$store.state.memberRate) ? 1 : Number(this.$store.state.memberRate) |
|
|
|
|
|
let price = paramValueText * addPrice |
|
|
|
|
|
|
|
|
|
|
|
return price * memberRate |
|
|
}, |
|
|
}, |
|
|
//判断当前选中的地址是否加价 |
|
|
//判断当前选中的地址是否加价 |
|
|
isAddPrice(){ |
|
|
isAddPrice(){ |
|
@ -475,7 +481,9 @@ |
|
|
const pets = dailyPets[date]; |
|
|
const pets = dailyPets[date]; |
|
|
const priceDetails = [] |
|
|
const priceDetails = [] |
|
|
// 基础服务 - 根据是否为节假日设置价格 |
|
|
// 基础服务 - 根据是否为节假日设置价格 |
|
|
const baseServiceCost = Number(this.isHoliday(date) ? this.holidayPrice : this.normalPrice) |
|
|
|
|
|
|
|
|
const holidayPrice = isNaN(this.holidayPrice) ? 75 : Number(this.holidayPrice) |
|
|
|
|
|
const normalPrice = isNaN(this.normalPrice) ? 75 : Number(this.normalPrice) |
|
|
|
|
|
const baseServiceCost = Number(this.isHoliday(date) ? holidayPrice : normalPrice) |
|
|
|
|
|
|
|
|
const largeDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('大型')).length; |
|
|
const largeDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('大型')).length; |
|
|
let mediumDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('中型')).length; |
|
|
let mediumDogCount = pets.filter(pet => pet.petType === 'dog' && pet.bodyType.includes('中型')).length; |
|
@ -607,7 +615,13 @@ |
|
|
console.log(baseServiceCost + additionalCost + multServicesTotalCost + customServiceCost); |
|
|
console.log(baseServiceCost + additionalCost + multServicesTotalCost + customServiceCost); |
|
|
console.log(baseServiceCost , additionalCost , multServicesTotalCost , customServiceCost); |
|
|
console.log(baseServiceCost , additionalCost , multServicesTotalCost , customServiceCost); |
|
|
|
|
|
|
|
|
const totalCost = parseFloat((baseServiceCost + additionalCost + multServicesTotalCost + Number(customServiceCost))).toFixed(2) |
|
|
|
|
|
|
|
|
// 确保所有数值都是有效的数字,避免NaN |
|
|
|
|
|
const safeBaseServiceCost = isNaN(baseServiceCost) ? 0 : Number(baseServiceCost) |
|
|
|
|
|
const safeAdditionalCost = isNaN(additionalCost) ? 0 : Number(additionalCost) |
|
|
|
|
|
const safeMultServicesTotalCost = isNaN(multServicesTotalCost) ? 0 : Number(multServicesTotalCost) |
|
|
|
|
|
const safeCustomServiceCost = isNaN(customServiceCost) ? 0 : Number(customServiceCost) |
|
|
|
|
|
|
|
|
|
|
|
const totalCost = parseFloat(safeBaseServiceCost + safeAdditionalCost + safeMultServicesTotalCost + safeCustomServiceCost).toFixed(2) |
|
|
// 所有宠物定制服务总项数,每个类型的服务只算一次 |
|
|
// 所有宠物定制服务总项数,每个类型的服务只算一次 |
|
|
const acc = [] |
|
|
const acc = [] |
|
|
pets.map(pet => { |
|
|
pets.map(pet => { |
|
@ -649,7 +663,15 @@ |
|
|
// 计算宠物定制服务费用 |
|
|
// 计算宠物定制服务费用 |
|
|
calculatePetCustomServiceCost(pet) { |
|
|
calculatePetCustomServiceCost(pet) { |
|
|
console.log('pet.customServices',pet.customServices) |
|
|
console.log('pet.customServices',pet.customServices) |
|
|
const customServiceCost = pet.customServices.reduce((acc, item) => acc + Number(item.price) * item.quantity, 0) |
|
|
|
|
|
|
|
|
// 确保customServices存在且为数组 |
|
|
|
|
|
if (!pet.customServices || !Array.isArray(pet.customServices)) { |
|
|
|
|
|
return '0.00' |
|
|
|
|
|
} |
|
|
|
|
|
const customServiceCost = pet.customServices.reduce((acc, item) => { |
|
|
|
|
|
const price = isNaN(item.price) ? 0 : Number(item.price) |
|
|
|
|
|
const quantity = isNaN(item.quantity) ? 0 : Number(item.quantity) |
|
|
|
|
|
return acc + price * quantity |
|
|
|
|
|
}, 0) |
|
|
console.log('customServiceCost',customServiceCost) |
|
|
console.log('customServiceCost',customServiceCost) |
|
|
return parseFloat(customServiceCost).toFixed(2) |
|
|
return parseFloat(customServiceCost).toFixed(2) |
|
|
}, |
|
|
}, |
|
@ -687,22 +709,29 @@ |
|
|
// 将价格配置赋值给组件 |
|
|
// 将价格配置赋值给组件 |
|
|
this.price_config = priceConfig || {} |
|
|
this.price_config = priceConfig || {} |
|
|
|
|
|
|
|
|
// 获取伴宠师等级价格和城市倍率 |
|
|
|
|
|
let companionPrice = this.$globalData.newOrderData.companionLevelPrice || 0 |
|
|
|
|
|
let cityPriceRate = this.$globalData.newOrderData.cityPriceRate || 1 |
|
|
|
|
|
|
|
|
// 获取伴宠师等级价格和城市倍率,确保都是有效数字 |
|
|
|
|
|
let companionPrice = isNaN(this.$globalData.newOrderData.companionLevelPrice) ? 0 : Number(this.$globalData.newOrderData.companionLevelPrice) |
|
|
|
|
|
let cityPriceRate = isNaN(this.$globalData.newOrderData.cityPriceRate) ? 1 : Number(this.$globalData.newOrderData.cityPriceRate) |
|
|
|
|
|
let memberRate = isNaN(this.$store.state.memberRate) ? 1 : Number(this.$store.state.memberRate) |
|
|
|
|
|
|
|
|
if(priceConfig.basePrice && priceConfig.basePrice.holiday){ |
|
|
if(priceConfig.basePrice && priceConfig.basePrice.holiday){ |
|
|
this.holidayPrice = Number((priceConfig.basePrice.holiday * this.$store.state.memberRate * cityPriceRate) + companionPrice).toFixed(2) |
|
|
|
|
|
|
|
|
const holidayBasePrice = isNaN(priceConfig.basePrice.holiday) ? 75 : Number(priceConfig.basePrice.holiday) |
|
|
|
|
|
this.holidayPrice = Number((holidayBasePrice * memberRate * cityPriceRate) + companionPrice).toFixed(2) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.holidayPrice = 75 |
|
|
} |
|
|
} |
|
|
if(priceConfig.basePrice && priceConfig.basePrice.normal){ |
|
|
if(priceConfig.basePrice && priceConfig.basePrice.normal){ |
|
|
this.normalPrice = Number((priceConfig.basePrice.normal * this.$store.state.memberRate * cityPriceRate) + companionPrice).toFixed(2) |
|
|
|
|
|
|
|
|
const normalBasePrice = isNaN(priceConfig.basePrice.normal) ? 75 : Number(priceConfig.basePrice.normal) |
|
|
|
|
|
this.normalPrice = Number((normalBasePrice * memberRate * cityPriceRate) + companionPrice).toFixed(2) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.normalPrice = 75 |
|
|
} |
|
|
} |
|
|
if(priceConfig.holidays && priceConfig.holidays.length > 0){ |
|
|
|
|
|
|
|
|
if(priceConfig.holidays && Array.isArray(priceConfig.holidays) && priceConfig.holidays.length > 0){ |
|
|
this.holidayDate = priceConfig.holidays |
|
|
this.holidayDate = priceConfig.holidays |
|
|
}else{ |
|
|
}else{ |
|
|
this.holidayDate = [] |
|
|
this.holidayDate = [] |
|
|
} |
|
|
} |
|
|
this.discountMemberText = (this.$store.state.memberRate * 10) |
|
|
|
|
|
|
|
|
this.discountMemberText = (memberRate * 10) |
|
|
}, |
|
|
}, |
|
|
// 判断是否为节假日 |
|
|
// 判断是否为节假日 |
|
|
isHoliday(date) { |
|
|
isHoliday(date) { |
|
|