|
@@ -225,6 +225,12 @@ export default {
|
|
pointsTime = state.pointsTime + (isAmount ? state.unitAmount : state.unitHour);
|
|
pointsTime = state.pointsTime + (isAmount ? state.unitAmount : state.unitHour);
|
|
const available = state.available - state.pointsPerUnit;
|
|
const available = state.available - state.pointsPerUnit;
|
|
const usingTotalDiscount = state.usingTotalDiscount + (isAmount ? state.unitAmount : state.unitHour * hourPrice ); // 重新计算已经使用的优惠逻辑
|
|
const usingTotalDiscount = state.usingTotalDiscount + (isAmount ? state.unitAmount : state.unitHour * hourPrice ); // 重新计算已经使用的优惠逻辑
|
|
|
|
+ if(isAmount && Math.min(points.remainDiscountFeePerDay, points.maxDiscountFee) - state.pointsTime < state.unitAmount) {
|
|
|
|
+ commit('setAvailable', available);
|
|
|
|
+ commit('setPointsTime', Math.min(points.remainDiscountFeePerDay, points.maxDiscountFee));
|
|
|
|
+ commit('setUsingTotalDiscount',state.usingTotalDiscount + (Math.min(points.remainDiscountFeePerDay, points.maxDiscountFee) - state.pointsTime));
|
|
|
|
+ return
|
|
|
|
+ }
|
|
if ( available > -1 ) {
|
|
if ( available > -1 ) {
|
|
// 如果是深圳车场
|
|
// 如果是深圳车场
|
|
commit('setAvailable',available);
|
|
commit('setAvailable',available);
|
|
@@ -234,10 +240,13 @@ export default {
|
|
}
|
|
}
|
|
if ( type === 'minus' && state.pointsTime > 0 ) {
|
|
if ( type === 'minus' && state.pointsTime > 0 ) {
|
|
const pointsTime = state.pointsTime - (isAmount ? state.unitAmount : state.unitHour);
|
|
const pointsTime = state.pointsTime - (isAmount ? state.unitAmount : state.unitHour);
|
|
- if(pointsTime < 0) {
|
|
|
|
|
|
+ const usingTotalDiscount = state.usingTotalDiscount - (isAmount ? state.unitAmount : state.unitHour * hourPrice); // 重新计算已经使用的优惠逻辑
|
|
|
|
+ if(isAmount && pointsTime < 0) {
|
|
|
|
+ commit('setAvailable', state.available + state.pointsPerUnit);
|
|
|
|
+ commit('setPointsTime',0);
|
|
|
|
+ commit('setUsingTotalDiscount',state.usingTotalDiscount - state.pointsTime);
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- const usingTotalDiscount = state.usingTotalDiscount - (isAmount ? state.unitAmount : state.unitHour * hourPrice); // 重新计算已经使用的优惠逻辑
|
|
|
|
// 如果是深圳车场
|
|
// 如果是深圳车场
|
|
commit('setAvailable',state.available + state.pointsPerUnit);
|
|
commit('setAvailable',state.available + state.pointsPerUnit);
|
|
commit('setPointsTime',pointsTime);
|
|
commit('setPointsTime',pointsTime);
|