|
@@ -5,7 +5,7 @@ import { cloneDeep } from 'lodash'
|
|
import uni from '@/utils/uniHooks';
|
|
import uni from '@/utils/uniHooks';
|
|
// const app = getApp()
|
|
// const app = getApp()
|
|
export default {
|
|
export default {
|
|
- components: {uniNumberBox},
|
|
|
|
|
|
+ components: { uniNumberBox },
|
|
created() {
|
|
created() {
|
|
// 超限提示
|
|
// 超限提示
|
|
// this.crossMessage();
|
|
// this.crossMessage();
|
|
@@ -31,22 +31,22 @@ export default {
|
|
enableConsumeSplit: false,
|
|
enableConsumeSplit: false,
|
|
maxReduceDiscount: 0,
|
|
maxReduceDiscount: 0,
|
|
reduceHours: 0,
|
|
reduceHours: 0,
|
|
- remainPrice: 0
|
|
|
|
|
|
+ remainPrice: 0,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState({
|
|
...mapState({
|
|
- orderDetail: state => state.order.orderDetail,
|
|
|
|
- custTypeId: ( state ) => state.custTypeId,
|
|
|
|
- groupId: ( state ) => state.groupId,
|
|
|
|
- enableConsume: state => state.order.enableConsume,
|
|
|
|
- actualPayFee: state => state.order.actualPayFee,
|
|
|
|
- usingTotalDiscount: state => state.order.usingTotalDiscount,
|
|
|
|
- memberLevelDiscount: state => state.order.memberLevelDiscount,
|
|
|
|
- checkedTotal: state => state.order.checkedTotal,
|
|
|
|
- parkMallCode: state => state.order.parkMallCode,
|
|
|
|
- paperDiscountTime: state => state.order.paperDiscountTime,
|
|
|
|
- paperDiscountFee: state => state.order.paperDiscountTime,
|
|
|
|
|
|
+ orderDetail: (state) => state.order.orderDetail,
|
|
|
|
+ custTypeId: (state) => state.custTypeId,
|
|
|
|
+ groupId: (state) => state.groupId,
|
|
|
|
+ enableConsume: (state) => state.order.enableConsume,
|
|
|
|
+ actualPayFee: (state) => state.order.actualPayFee,
|
|
|
|
+ usingTotalDiscount: (state) => state.order.usingTotalDiscount,
|
|
|
|
+ memberLevelDiscount: (state) => state.order.memberLevelDiscount,
|
|
|
|
+ checkedTotal: (state) => state.order.checkedTotal,
|
|
|
|
+ parkMallCode: (state) => state.order.parkMallCode,
|
|
|
|
+ paperDiscountTime: (state) => state.order.paperDiscountTime,
|
|
|
|
+ paperDiscountFee: (state) => state.order.paperDiscountTime,
|
|
}),
|
|
}),
|
|
// maxReduceDiscount() {
|
|
// maxReduceDiscount() {
|
|
// const {maxOneDayCoupons,maxConsumeTime,maxonedaydiscountFee,maxOneTimeDiscountTime,remainConsumeTime,hourPrice,availableDiscountFee,oneTimeLimitation,oneDayLimitation,maxOneDayDiscountFee} = this.orderDetail.parkingRule;
|
|
// const {maxOneDayCoupons,maxConsumeTime,maxonedaydiscountFee,maxOneTimeDiscountTime,remainConsumeTime,hourPrice,availableDiscountFee,oneTimeLimitation,oneDayLimitation,maxOneDayDiscountFee} = this.orderDetail.parkingRule;
|
|
@@ -66,29 +66,27 @@ export default {
|
|
// remainPrice = remainPrice + this.memberGrade.discountFee
|
|
// remainPrice = remainPrice + this.memberGrade.discountFee
|
|
// }
|
|
// }
|
|
// if ( this.checkedList.indexOf('reduces') > -1) {
|
|
// if ( this.checkedList.indexOf('reduces') > -1) {
|
|
- //
|
|
|
|
|
|
+ //
|
|
// }
|
|
// }
|
|
- //
|
|
|
|
- //
|
|
|
|
- //
|
|
|
|
- //
|
|
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
// return remainPrice
|
|
// return remainPrice
|
|
// }
|
|
// }
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
try {
|
|
try {
|
|
- this.isCheck(
|
|
|
|
- () => this.pageInit()
|
|
|
|
- ); // 验证是否可选
|
|
|
|
- } catch ( err ) {
|
|
|
|
- console.log(err)
|
|
|
|
|
|
+ this.isCheck(() => this.pageInit()); // 验证是否可选
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.log(err);
|
|
this.$router.back();
|
|
this.$router.back();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
remainPrice() {
|
|
remainPrice() {
|
|
- const {maxOneDayCoupons,maxonedaydiscountFee,maxOneTimeDiscountTime,remainConsumeTime,hourPrice,availableDiscountFee,oneTimeLimitation,oneDayLimitation,maxOneDayDiscountFee} = this.orderDetail.parkingRule;
|
|
|
|
- const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
|
|
|
|
|
|
+ const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, availableDiscountFee, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
|
|
+ const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
// console.log('hourPrice + this.remainPrice',this.remainPrice)
|
|
// console.log('hourPrice + this.remainPrice',this.remainPrice)
|
|
// 单日上限
|
|
// 单日上限
|
|
// if ( oneDayLimitation && this.remainPrice >= maxOneDayDiscountFee ) {
|
|
// if ( oneDayLimitation && this.remainPrice >= maxOneDayDiscountFee ) {
|
|
@@ -99,19 +97,20 @@ export default {
|
|
//
|
|
//
|
|
// }
|
|
// }
|
|
// 单次上限限制
|
|
// 单次上限限制
|
|
- if ( oneTimeLimitation ) {
|
|
|
|
- if( this.remainPrice <= maxOneTimeDiscountFee ) {
|
|
|
|
- if ( this.isMember ) {
|
|
|
|
- this.isMember = !this.isMember
|
|
|
|
|
|
+ if (oneTimeLimitation) {
|
|
|
|
+ if (this.remainPrice <= maxOneTimeDiscountFee) {
|
|
|
|
+ if (this.isMember) {
|
|
|
|
+ this.isMember = !this.isMember;
|
|
|
|
+ }
|
|
|
|
+ if (this.isReduces) {
|
|
|
|
+ this.isReduces = false;
|
|
|
|
+ console.log(109);
|
|
}
|
|
}
|
|
- if ( this.isReduces ) {
|
|
|
|
- this.isReduces = false
|
|
|
|
- }
|
|
|
|
} else {
|
|
} else {
|
|
- this.isMember = this.checkedList.indexOf('member') < 0
|
|
|
|
- this.isReduces = this.checkedList.indexOf('reduces') < 0
|
|
|
|
|
|
+ this.isMember = this.checkedList.indexOf('member') < 0;
|
|
|
|
+ this.isReduces = this.checkedList.indexOf('reduces') < 0;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
checkedList() {
|
|
checkedList() {
|
|
// const {hourPrice} = this.orderDetail.parkingRule;
|
|
// const {hourPrice} = this.orderDetail.parkingRule;
|
|
@@ -120,79 +119,86 @@ export default {
|
|
// } else {
|
|
// } else {
|
|
// this.remainPrice = this.remainPrice - this.reduceHours * hourPrice
|
|
// this.remainPrice = this.remainPrice - this.reduceHours * hourPrice
|
|
// }
|
|
// }
|
|
- }
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
pageInit() {
|
|
pageInit() {
|
|
- this.remainPrice = this.usingTotalDiscount
|
|
|
|
- if ( this.orderDetail?.parkingRule?.enableConsumeSplit ) {
|
|
|
|
- this.enableConsumeSplit = this.orderDetail.parkingRule.enableConsumeSplit
|
|
|
|
|
|
+ this.remainPrice = this.usingTotalDiscount;
|
|
|
|
+ if (this.orderDetail?.parkingRule?.enableConsumeSplit) {
|
|
|
|
+ this.enableConsumeSplit = this.orderDetail.parkingRule.enableConsumeSplit;
|
|
}
|
|
}
|
|
- this.checkedList = []
|
|
|
|
- const {memberGrade = [],consume = [],memberLevelDiscount} = this.orderDetail.discountInfo;
|
|
|
|
- const {maxConsumeTime} = this.orderDetail.parkingRule
|
|
|
|
- this.memberGrade = {...memberGrade[0]}
|
|
|
|
- this.consume = {...consume[0]}
|
|
|
|
- if ( JSON.stringify(this.memberGrade) !== '{}' && this.memberGrade.hasOwnProperty('selected') ? this.memberGrade.selected : this.memberGrade.defaultSelected ) {
|
|
|
|
- this.checkedList.push('member')
|
|
|
|
- this.isMember = false
|
|
|
|
|
|
+ this.checkedList = [];
|
|
|
|
+ const { memberGrade = [], consume = [], memberLevelDiscount } = this.orderDetail.discountInfo;
|
|
|
|
+ const { maxConsumeTime } = this.orderDetail.parkingRule;
|
|
|
|
+ this.memberGrade = { ...memberGrade[0] };
|
|
|
|
+ this.consume = { ...consume[0] };
|
|
|
|
+ if (JSON.stringify(this.memberGrade) !== '{}' && this.memberGrade && this.memberGrade.hasOwnProperty('selected') ? this.memberGrade.selected : this.memberGrade.defaultSelected) {
|
|
|
|
+ this.checkedList.push('member');
|
|
|
|
+ this.isMember = false;
|
|
|
|
+ } else {
|
|
|
|
+ this.isMember = true;
|
|
}
|
|
}
|
|
- if ( JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected ) {
|
|
|
|
- this.checkedList.push('reduces')
|
|
|
|
- this.isReduces = false
|
|
|
|
|
|
+ // console.log(140, this.consume, this.consume.hasOwnProperty('selected'), JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected, this.consume.defaultSelected)
|
|
|
|
+ // console.log(143, JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected !== undefined : this.consume.defaultSelected !== undefined);
|
|
|
|
+ if (JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected !== undefined : this.consume.defaultSelected !== undefined) {
|
|
|
|
+ this.checkedList.push('reduces');
|
|
|
|
+ this.isReduces = false;
|
|
// 如果存在拆分逻辑的话
|
|
// 如果存在拆分逻辑的话
|
|
// this.consume.
|
|
// this.consume.
|
|
|
|
+ } else {
|
|
|
|
+ console.log(150);
|
|
|
|
+ this.isReduces = true;
|
|
}
|
|
}
|
|
- this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : this.consume.defaultDiscountTime
|
|
|
|
- if ( maxConsumeTime ) {
|
|
|
|
- this.maxReduceDiscount = maxConsumeTime
|
|
|
|
|
|
+ this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : this.consume.defaultDiscountTime;
|
|
|
|
+ if (maxConsumeTime) {
|
|
|
|
+ this.maxReduceDiscount = maxConsumeTime;
|
|
}
|
|
}
|
|
- this.oldCheckedList = [...this.checkedList]
|
|
|
|
|
|
+ this.oldCheckedList = [...this.checkedList];
|
|
},
|
|
},
|
|
setIsMemberDiscountDisabled() {
|
|
setIsMemberDiscountDisabled() {
|
|
- this.todayReduceDiscountMessage = '当日'
|
|
|
|
|
|
+ this.todayReduceDiscountMessage = '当日';
|
|
},
|
|
},
|
|
checkboxChange() {},
|
|
checkboxChange() {},
|
|
- onReduceHoursChange( type ) {
|
|
|
|
- if ( this.checkedList.indexOf('reduces') < 0 ) {
|
|
|
|
|
|
+ onReduceHoursChange(type) {
|
|
|
|
+ if (this.checkedList.indexOf('reduces') < 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const {maxOneDayCoupons,maxonedaydiscountFee,maxOneTimeDiscountTime,remainConsumeTime,hourPrice,availableDiscountFee,oneTimeLimitation,oneDayLimitation,maxOneDayDiscountFee} = this.orderDetail.parkingRule;
|
|
|
|
|
|
+ const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, availableDiscountFee, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
// console.log(133,this.reduceHours)
|
|
// console.log(133,this.reduceHours)
|
|
- if ( type === 'plus') {
|
|
|
|
- this.remainPrice = this.remainPrice + hourPrice
|
|
|
|
- this.reduceHours = this.reduceHours + 1
|
|
|
|
- const [isCrossMessage = false,maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage()
|
|
|
|
- if ( isCrossMessage ) {
|
|
|
|
- this.remainPrice = this.remainPrice - hourPrice
|
|
|
|
- this.reduceHours = this.reduceHours - 1
|
|
|
|
|
|
+ if (type === 'plus' && this.reduceHours < this.maxReduceDiscount) {
|
|
|
|
+ this.remainPrice = this.remainPrice + hourPrice;
|
|
|
|
+ this.reduceHours = this.reduceHours + 1;
|
|
|
|
+ const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
|
|
|
|
+ if (isCrossMessage) {
|
|
|
|
+ this.remainPrice = this.remainPrice - hourPrice;
|
|
|
|
+ this.reduceHours = this.reduceHours - 1;
|
|
}
|
|
}
|
|
- return
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- if ( type === 'minus' ) {
|
|
|
|
- this.reduceHours = this.reduceHours - 1
|
|
|
|
- this.remainPrice = this.remainPrice - hourPrice
|
|
|
|
- return
|
|
|
|
|
|
+ if (type === 'minus') {
|
|
|
|
+ this.reduceHours = this.reduceHours - 1;
|
|
|
|
+ this.remainPrice = this.remainPrice - hourPrice;
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
memberClick() {
|
|
memberClick() {
|
|
- const {maxConsumeTime} = this.orderDetail.parkingRule;
|
|
|
|
- if ( this.checkedList.indexOf('member') > -1 ) {
|
|
|
|
- this.remainPrice = this.memberGrade.discountFee + this.remainPrice
|
|
|
|
- } else if ( !this.isMember ) {
|
|
|
|
- this.remainPrice = this.remainPrice - this.memberGrade.discountFee
|
|
|
|
- this.maxReduceDiscount = maxConsumeTime
|
|
|
|
|
|
+ const { maxConsumeTime } = this.orderDetail.parkingRule;
|
|
|
|
+ if (this.checkedList.indexOf('member') > -1) {
|
|
|
|
+ this.remainPrice = this.memberGrade.discountFee + this.remainPrice;
|
|
|
|
+ } else if (!this.isMember) {
|
|
|
|
+ this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
|
|
+ this.maxReduceDiscount = maxConsumeTime;
|
|
}
|
|
}
|
|
- const [isCrossMessage = false,maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage()
|
|
|
|
- if ( isCrossMessage ) {
|
|
|
|
- this.checkedList = this.checkedList.filter(elm => elm !== 'member')
|
|
|
|
- this.remainPrice = this.remainPrice - this.memberGrade.discountFee
|
|
|
|
- this.isMember = false
|
|
|
|
|
|
+ const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
|
|
|
|
+ if (isCrossMessage) {
|
|
|
|
+ this.checkedList = this.checkedList.filter((elm) => elm !== 'member');
|
|
|
|
+ this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
|
|
+ this.isMember = false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
reducesClick() {
|
|
reducesClick() {
|
|
- const {maxOneTimeDiscountTime,hourPrice,oneTimeLimitation,maxConsumeTime,oneDayLimitation,maxOneDayDiscountFee} = this.orderDetail.parkingRule;
|
|
|
|
- const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
|
|
|
|
|
|
+ const { maxOneTimeDiscountTime, hourPrice, oneTimeLimitation, maxConsumeTime, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
|
|
+ const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
/*if ( oneTimeLimitation && this.remainPrice >= maxOneTimeDiscountFee ) {
|
|
/*if ( oneTimeLimitation && this.remainPrice >= maxOneTimeDiscountFee ) {
|
|
this.checkedList = this.checkedList.filter(elm => elm !== 'reduces')
|
|
this.checkedList = this.checkedList.filter(elm => elm !== 'reduces')
|
|
Toast({
|
|
Toast({
|
|
@@ -201,98 +207,96 @@ export default {
|
|
});
|
|
});
|
|
return false
|
|
return false
|
|
}*/
|
|
}*/
|
|
- const reduceHours = ( maxOneTimeDiscountFee - this.remainPrice ) / hourPrice
|
|
|
|
- if ( this.checkedList.indexOf('reduces') > -1 ) {
|
|
|
|
- this.remainPrice = hourPrice + this.remainPrice
|
|
|
|
- this.maxReduceDiscount = maxConsumeTime
|
|
|
|
|
|
+ const reduceHours = (maxOneTimeDiscountFee - this.remainPrice) / hourPrice;
|
|
|
|
+ if (this.checkedList.indexOf('reduces') > -1) {
|
|
|
|
+ this.remainPrice = hourPrice + this.remainPrice;
|
|
|
|
+ this.maxReduceDiscount = maxConsumeTime;
|
|
} else {
|
|
} else {
|
|
- this.remainPrice = this.remainPrice - hourPrice
|
|
|
|
- this.maxReduceDiscount = maxConsumeTime
|
|
|
|
- this.reduceHours = maxConsumeTime
|
|
|
|
|
|
+ this.remainPrice = this.remainPrice - hourPrice;
|
|
|
|
+ this.maxReduceDiscount = maxConsumeTime;
|
|
|
|
+ this.reduceHours = 0;
|
|
}
|
|
}
|
|
- const [isCrossMessage = false,maxReduceDiscount = 0] = this.crossMessage()
|
|
|
|
- if ( isCrossMessage ) {
|
|
|
|
|
|
+ const [isCrossMessage = false, maxReduceDiscount = 0] = this.crossMessage();
|
|
|
|
+ if (isCrossMessage) {
|
|
// console.log(215, maxReduceDiscount)
|
|
// console.log(215, maxReduceDiscount)
|
|
// console.log(207, this.reduceHours)
|
|
// console.log(207, this.reduceHours)
|
|
// this.maxReduceDiscount = maxReduceDiscount ? 0 : maxReduceDiscount * -1
|
|
// this.maxReduceDiscount = maxReduceDiscount ? 0 : maxReduceDiscount * -1
|
|
// console.log(217, this.maxReduceDiscount)
|
|
// console.log(217, this.maxReduceDiscount)
|
|
- this.remainPrice = this.remainPrice - maxReduceDiscount * hourPrice
|
|
|
|
|
|
+ this.remainPrice = this.remainPrice - maxReduceDiscount * hourPrice;
|
|
//
|
|
//
|
|
// this.reduceHours = this.maxReduceDiscount
|
|
// this.reduceHours = this.maxReduceDiscount
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 超限提示
|
|
// 超限提示
|
|
crossMessage() {
|
|
crossMessage() {
|
|
- const {maxOneTimeDiscountTime,hourPrice,oneTimeLimitation,oneDayLimitation,maxOneDayDiscountFee} = this.orderDetail.parkingRule;
|
|
|
|
- const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
|
|
|
|
|
|
+ const { maxOneTimeDiscountTime, hourPrice, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
|
|
+ const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
// 单日上限
|
|
// 单日上限
|
|
- if ( oneDayLimitation && this.remainPrice >= maxOneDayDiscountFee ) {
|
|
|
|
|
|
+ if (oneDayLimitation && this.remainPrice >= maxOneDayDiscountFee) {
|
|
Toast({
|
|
Toast({
|
|
- message: `每日最高可抵扣${ maxOneDayDiscountFee }元`,
|
|
|
|
|
|
+ message: `每日最高可抵扣${maxOneDayDiscountFee}元`,
|
|
icon: 'none',
|
|
icon: 'none',
|
|
});
|
|
});
|
|
- return [true,( maxOneDayDiscountFee - (this.reduceHours - 1) * hourPrice ) / hourPrice]
|
|
|
|
|
|
+ return [true, (maxOneDayDiscountFee - (this.reduceHours - 1) * hourPrice) / hourPrice];
|
|
}
|
|
}
|
|
// 单次上限限制
|
|
// 单次上限限制
|
|
- console.log(234, this.remainPrice, maxOneTimeDiscountFee,);
|
|
|
|
- if ( oneTimeLimitation && this.remainPrice >= maxOneTimeDiscountFee ) {
|
|
|
|
|
|
+ if (oneTimeLimitation && this.remainPrice > maxOneTimeDiscountFee) {
|
|
Toast({
|
|
Toast({
|
|
- message: `超出抵扣上限,每次最高可抵扣${ maxOneTimeDiscountTime }小时`,
|
|
|
|
|
|
+ message: `超出抵扣上限,每次最高可抵扣${maxOneTimeDiscountTime}小时`,
|
|
icon: 'none',
|
|
icon: 'none',
|
|
});
|
|
});
|
|
// return [true,( maxOneTimeDiscountFee - (this.reduceHours - 1) * hourPrice ) / hourPrice]
|
|
// return [true,( maxOneTimeDiscountFee - (this.reduceHours - 1) * hourPrice ) / hourPrice]
|
|
- return [true, ( this.remainPrice - maxOneTimeDiscountFee) / hourPrice]
|
|
|
|
|
|
+ return [true, (this.remainPrice - maxOneTimeDiscountFee) / hourPrice];
|
|
}
|
|
}
|
|
- return [false,0]
|
|
|
|
|
|
+ return [false, 0];
|
|
},
|
|
},
|
|
// 验证当前的选项是否可选择
|
|
// 验证当前的选项是否可选择
|
|
- isCheck( callback ) {
|
|
|
|
- if ( !this?.orderDetail?.parkingRule ) {
|
|
|
|
- return
|
|
|
|
|
|
+ isCheck(callback) {
|
|
|
|
+ if (!this?.orderDetail?.parkingRule) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
// const {parkInfo,parkingRule,discountInfo} = this.orderDetail
|
|
// const {parkInfo,parkingRule,discountInfo} = this.orderDetail
|
|
- const {maxOneTimeDiscountTime,maxOneDayDiscountFee,oneTimeLimitation,oneDayLimitation,hourPrice,remainConsumeTime} = this.orderDetail.parkingRule
|
|
|
|
|
|
+ const { maxOneTimeDiscountTime, maxOneDayDiscountFee, oneTimeLimitation, oneDayLimitation, hourPrice, remainConsumeTime } = this.orderDetail.parkingRule;
|
|
// 浦东
|
|
// 浦东
|
|
- if ( this.parkMallCode === 1 ) {
|
|
|
|
- const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
|
|
|
|
- const remainConsumeTimeFee = remainConsumeTime * hourPrice
|
|
|
|
|
|
+ if (this.parkMallCode === 1) {
|
|
|
|
+ const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
|
|
+ const remainConsumeTimeFee = remainConsumeTime * hourPrice;
|
|
|
|
|
|
- // TODO: 统计纸质优惠券的总金额, usingTotalDiscount - 纸质优惠券的总金额,才是用户当前订单使用的优惠总数
|
|
|
|
- this.isMember = !( this.usingTotalDiscount - this.paperDiscountFee < ( oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee ) && this.memberLevelDiscount )
|
|
|
|
- this.isReduces = !( this.usingTotalDiscount - this.paperDiscountFee < ( oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee ) && this.enableConsume )
|
|
|
|
|
|
+ // TODO: 统计纸质优惠券的总金额, usingTotalDiscount - 纸质优惠券的总金额,才是用户当前订单使用的优惠总数
|
|
|
|
+ this.isMember = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
|
|
|
|
+ this.isReduces = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
|
|
}
|
|
}
|
|
- if ( callback ) callback()
|
|
|
|
|
|
+ if (callback) callback();
|
|
},
|
|
},
|
|
- reducesChange( value ) {
|
|
|
|
|
|
+ reducesChange(value) {
|
|
// console.log(149,value)
|
|
// console.log(149,value)
|
|
},
|
|
},
|
|
async confirm() {
|
|
async confirm() {
|
|
- let orderDetail = cloneDeep(this.orderDetail)
|
|
|
|
|
|
+ let orderDetail = cloneDeep(this.orderDetail);
|
|
// 如果初次进来操作的跟原来的不一样则重新计算优惠
|
|
// 如果初次进来操作的跟原来的不一样则重新计算优惠
|
|
- if ( this.checkedList.length !== this.checkedTotal || true ) {
|
|
|
|
- ['member','reduces'].forEach(key => {
|
|
|
|
- if ( key === 'member' ) {
|
|
|
|
|
|
+ if (this.checkedList.length !== this.checkedTotal || true) {
|
|
|
|
+ ['member', 'reduces'].forEach((key) => {
|
|
|
|
+ if (key === 'member') {
|
|
this.memberGrade = {
|
|
this.memberGrade = {
|
|
...this.memberGrade,
|
|
...this.memberGrade,
|
|
- selected: this.checkedList.indexOf(key) > -1
|
|
|
|
- }
|
|
|
|
- orderDetail.discountInfo.memberGrade = [this.memberGrade]
|
|
|
|
|
|
+ selected: this.checkedList.indexOf(key) > -1,
|
|
|
|
+ };
|
|
|
|
+ orderDetail.discountInfo.memberGrade = [this.memberGrade];
|
|
}
|
|
}
|
|
- if ( key === 'reduces' ) {
|
|
|
|
|
|
+ if (key === 'reduces') {
|
|
this.consume = {
|
|
this.consume = {
|
|
...this.consume,
|
|
...this.consume,
|
|
discountTime: this.reduceHours,
|
|
discountTime: this.reduceHours,
|
|
discountFee: this.reduceHours * this.orderDetail.parkingRule.hourPrice,
|
|
discountFee: this.reduceHours * this.orderDetail.parkingRule.hourPrice,
|
|
- selected: this.checkedList.indexOf(key) > -1
|
|
|
|
- }
|
|
|
|
- orderDetail.discountInfo.consume = [this.consume]
|
|
|
|
|
|
+ selected: this.checkedList.indexOf(key) > -1,
|
|
|
|
+ };
|
|
|
|
+ orderDetail.discountInfo.consume = [this.consume];
|
|
}
|
|
}
|
|
- })
|
|
|
|
- await this.$store.dispatch('order/saveDiscounts',{orderDetail,callback: () => this.$router.back()})
|
|
|
|
|
|
+ });
|
|
|
|
+ await this.$store.dispatch('order/saveDiscounts', { orderDetail, callback: () => this.$router.back() });
|
|
} else {
|
|
} else {
|
|
this.$router.back();
|
|
this.$router.back();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
-
|
|
|
|
};
|
|
};
|