|
@@ -1,13 +1,9 @@
|
|
-import { mapState } from 'vuex';
|
|
|
|
|
|
+import {mapState} from 'vuex';
|
|
import uni from '@/utils/uniHooks';
|
|
import uni from '@/utils/uniHooks';
|
|
-// import { initWxJsSdkConfig } from '@/utils/login';
|
|
|
|
-import { Toast } from 'vant';
|
|
|
|
-import { getPlatform, getAppIdByGroupIdAndMallId, isInWeixinH5 } from '@/utils';
|
|
|
|
-import { initWxJsSdkConfig } from '@/utils/login';
|
|
|
|
|
|
+import {Toast} from 'vant';
|
|
|
|
+import {getPlatform, getAppIdByGroupIdAndMallId, isInWeixinH5} from '@/utils';
|
|
import moment from 'moment'
|
|
import moment from 'moment'
|
|
-// import { compare } from '@/utils/location.js';
|
|
|
|
-// import { isArray } from 'lodash';
|
|
|
|
-// import { v4 as uuidv4 } from 'uuid';
|
|
|
|
|
|
+import {debounce, throttle} from 'lodash';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
@@ -20,7 +16,13 @@ export default {
|
|
maxCouponFee: 0, // 计算优惠券已选的总金额
|
|
maxCouponFee: 0, // 计算优惠券已选的总金额
|
|
remainPrice: 0, // 剩余可用优惠额度
|
|
remainPrice: 0, // 剩余可用优惠额度
|
|
newAvailableDiscountFee: 0, // 可使用的电子券的优惠金额上限
|
|
newAvailableDiscountFee: 0, // 可使用的电子券的优惠金额上限
|
|
- extraData: {}
|
|
|
|
|
|
+ extraData: {},
|
|
|
|
+ // 虚拟dom
|
|
|
|
+ offset: 0,
|
|
|
|
+ height: 0,
|
|
|
|
+ rowHeight: 105,
|
|
|
|
+ rowData: [...new Array(30)].map((i, index) => index),
|
|
|
|
+ handleScrollDebounce: null
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -32,47 +34,50 @@ export default {
|
|
maxOneDayDiscountFee: (state) => state.order.maxOneDayDiscountFee, // 深圳单日单次使用上限
|
|
maxOneDayDiscountFee: (state) => state.order.maxOneDayDiscountFee, // 深圳单日单次使用上限
|
|
usingTotalDiscount: (state) => state.order.usingTotalDiscount, // 当前已使用优惠
|
|
usingTotalDiscount: (state) => state.order.usingTotalDiscount, // 当前已使用优惠
|
|
availableDiscountFee: (state) => state.order.availableDiscountFee, // 当前已使用优惠
|
|
availableDiscountFee: (state) => state.order.availableDiscountFee, // 当前已使用优惠
|
|
- paperDiscountFee: (state) => state.order.paperDiscountFee, // 当前已使用优惠
|
|
|
|
unLimitWeekendPoints: (state) => state.order.unLimitWeekendPoints, // 新的积分上限, 默认为false(不开启), unLimitWeekendPoints: true # 开启无上限功能; unLimitWeekendPoints: false # 关闭无上限功能;
|
|
unLimitWeekendPoints: (state) => state.order.unLimitWeekendPoints, // 新的积分上限, 默认为false(不开启), unLimitWeekendPoints: true # 开启无上限功能; unLimitWeekendPoints: false # 关闭无上限功能;
|
|
lbsId: (state) => state.lbsId, // 楼栋ID
|
|
lbsId: (state) => state.lbsId, // 楼栋ID
|
|
groupId: (state) => state.groupId, // 楼盘ID
|
|
groupId: (state) => state.groupId, // 楼盘ID
|
|
- remainCoupons: ( state ) => state.order.remainCoupons, // 仅限杭州当前剩余可选电子券上限
|
|
|
|
- parkMallCode: ( state ) => state.order.parkMallCode, // 当前车场的数据
|
|
|
|
- maxOneDayCoupons: ( state ) => state.order.maxOneDayCoupons,// 仅限杭州当日电子券可选上限
|
|
|
|
- paperDiscountFee: ( state ) => state.order.paperDiscountFee,// 纸质券的优惠金额
|
|
|
|
|
|
+ remainCoupons: (state) => state.order.remainCoupons, // 仅限杭州当前剩余可选电子券上限
|
|
|
|
+ parkMallCode: (state) => state.order.parkMallCode, // 当前车场的数据
|
|
|
|
+ maxOneDayCoupons: (state) => state.order.maxOneDayCoupons,// 仅限杭州当日电子券可选上限
|
|
|
|
+ paperDiscountFee: (state) => state.order.paperDiscountFee,// 纸质券的优惠金额
|
|
}),
|
|
}),
|
|
- totalFee () {
|
|
|
|
|
|
+ totalFee() {
|
|
return this?.orderDetail?.parkingRecord?.totalFee
|
|
return this?.orderDetail?.parkingRecord?.totalFee
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
mounted() {
|
|
mounted() {
|
|
- // console.log('parkingFeeCoupon.js');
|
|
|
|
- // setTimeout(() => {
|
|
|
|
- // uni.setNavigationBarTitle({
|
|
|
|
- // title: '优惠券',
|
|
|
|
- // });
|
|
|
|
- // if (isInWeixinH5()) {
|
|
|
|
- // initWxJsSdkConfig(['checkJsApi', 'chooseImage'], ['wx-open-launch-weapp']);
|
|
|
|
- // this.launchPathInit();
|
|
|
|
- // }
|
|
|
|
- // }, 300);
|
|
|
|
- // setTimeout(() => {
|
|
|
|
- // window?.toWXSendMsg({
|
|
|
|
- // type: 'uni_func',
|
|
|
|
- // funcName: 'setNavigationBarColor',
|
|
|
|
- // options: {
|
|
|
|
- // frontColor: '#000000',
|
|
|
|
- // backgroundColor: '#FBFCFF',
|
|
|
|
- // },
|
|
|
|
- // });
|
|
|
|
- // }, 500)
|
|
|
|
|
|
+ this.height = window.document.documentElement.offsetHeight;
|
|
|
|
+ if(!this.handleScrollDebounce) {
|
|
|
|
+ this.handleScrollDebounce = debounce(this.handleScroll, 100)
|
|
|
|
+ }
|
|
|
|
+ window.addEventListener('scroll', this.handleScrollDebounce, false);
|
|
this.pageInit();
|
|
this.pageInit();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ handleScroll(e) {
|
|
|
|
+ const scrollingElement = e.target.scrollingElement;
|
|
|
|
+ const scrollTop = scrollingElement.scrollTop;
|
|
|
|
+ const scrollHeight = scrollingElement.scrollHeight;
|
|
|
|
+ const clientHeight = scrollingElement.clientHeight;
|
|
|
|
+ // 计算是否已经滚动到底部
|
|
|
|
+ const isAtBottom = scrollTop + clientHeight >= scrollHeight - this.rowHeight * 2;
|
|
|
|
+ if (isAtBottom) {
|
|
|
|
+ // 只有当滚动到底部时才进行计算
|
|
|
|
+ if (!this.rowHeight && this.coupons.length) {
|
|
|
|
+ this.rowHeight = scrollTop / (this.coupons.length === 20 ? 20 : this.coupons.length);
|
|
|
|
+ }
|
|
|
|
+ if (this.rowHeight > 100 && this.coupons.length > this.rowData.length) {
|
|
|
|
+ const newRowDataCount = Math.round(scrollTop / this.rowHeight);
|
|
|
|
+ if (newRowDataCount >= 20) {
|
|
|
|
+ this.rowData = Array.from({length: this.rowData.length + 10}, (_, index) => index);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
pageInit() {
|
|
pageInit() {
|
|
const {parkInfo} = this.orderDetail
|
|
const {parkInfo} = this.orderDetail
|
|
- const { parkMallCode } = parkInfo;
|
|
|
|
|
|
+ const {parkMallCode} = parkInfo;
|
|
/*
|
|
/*
|
|
* 电子优惠券初始化逻辑(后端处理)
|
|
* 电子优惠券初始化逻辑(后端处理)
|
|
*
|
|
*
|
|
@@ -83,7 +88,7 @@ export default {
|
|
this.remainPrice = this.usingTotalDiscount - this.paperDiscountFee;
|
|
this.remainPrice = this.usingTotalDiscount - this.paperDiscountFee;
|
|
if ((this.parkMallCode === 4 || this.parkMallCode === 6) && this.orderDetail?.discountInfo?.points?.[0]?.discountFee) {
|
|
if ((this.parkMallCode === 4 || this.parkMallCode === 6) && this.orderDetail?.discountInfo?.points?.[0]?.discountFee) {
|
|
this.remainPrice = this.remainPrice - this.orderDetail.discountInfo.points[0].discountFee
|
|
this.remainPrice = this.remainPrice - this.orderDetail.discountInfo.points[0].discountFee
|
|
- }
|
|
|
|
|
|
+ }
|
|
// 前海积分不参与当前电子券优惠上限
|
|
// 前海积分不参与当前电子券优惠上限
|
|
if ( [ 5, 8, 10 ].indexOf(parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
|
|
if ( [ 5, 8, 10 ].indexOf(parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
|
|
this.remainPrice = this.remainPrice - this.orderDetail?.discountInfo?.points[0]?.discountFee
|
|
this.remainPrice = this.remainPrice - this.orderDetail?.discountInfo?.points[0]?.discountFee
|
|
@@ -115,7 +120,7 @@ export default {
|
|
this.setAllDisabled()
|
|
this.setAllDisabled()
|
|
if (this.parkMallCode === 4 || this.parkMallCode === 6 || this.parkMallCode === 5 || this.parkMallCode === 8) {
|
|
if (this.parkMallCode === 4 || this.parkMallCode === 6 || this.parkMallCode === 5 || this.parkMallCode === 8) {
|
|
this.isDisabledByRule(this.couponList[0], 0, 'showMsg');
|
|
this.isDisabledByRule(this.couponList[0], 0, 'showMsg');
|
|
- }
|
|
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -123,8 +128,8 @@ export default {
|
|
return Number.parseInt(i.replace(/coupon/g, ''));
|
|
return Number.parseInt(i.replace(/coupon/g, ''));
|
|
},
|
|
},
|
|
checkboxItemChange(name, index) {
|
|
checkboxItemChange(name, index) {
|
|
- const coupon = this.couponList[index];
|
|
|
|
- if ( coupon.disabled ) {
|
|
|
|
|
|
+ const coupon = this.couponList[index];
|
|
|
|
+ if (coupon.disabled) {
|
|
if (this.getAmountToBePaid() <= 0) {
|
|
if (this.getAmountToBePaid() <= 0) {
|
|
Toast('当前无需追加优惠')
|
|
Toast('当前无需追加优惠')
|
|
return;
|
|
return;
|
|
@@ -138,13 +143,11 @@ export default {
|
|
// 取消勾选时
|
|
// 取消勾选时
|
|
if (this.checkedCouponList.indexOf(name) > -1) {
|
|
if (this.checkedCouponList.indexOf(name) > -1) {
|
|
this.checkedCouponList = this.checkedCouponList.filter((i) => i !== name);
|
|
this.checkedCouponList = this.checkedCouponList.filter((i) => i !== name);
|
|
- setTimeout(() => {
|
|
|
|
- this.remainPrice = this.remainPrice - this.couponList[index].discountFee
|
|
|
|
- this.newAvailableDiscountFee = this.newAvailableDiscountFee + this.couponList[index].discountFee
|
|
|
|
- this.newGroupedCouponData()
|
|
|
|
- this.setAllDisabled()
|
|
|
|
- this.isDisabledByRule(coupon, index, 'showMsg');
|
|
|
|
- }, 100)
|
|
|
|
|
|
+ this.remainPrice = this.remainPrice - this.couponList[index].discountFee
|
|
|
|
+ this.newAvailableDiscountFee = this.newAvailableDiscountFee + this.couponList[index].discountFee
|
|
|
|
+ this.newGroupedCouponData()
|
|
|
|
+ this.setAllDisabled()
|
|
|
|
+ this.isDisabledByRule(coupon, index, 'showMsg');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// 如果有选中项
|
|
// 如果有选中项
|
|
@@ -164,7 +167,6 @@ export default {
|
|
this.setAllDisabled()
|
|
this.setAllDisabled()
|
|
this.isDisabledByRule(coupon, index, 'showMsg');
|
|
this.isDisabledByRule(coupon, index, 'showMsg');
|
|
})
|
|
})
|
|
-
|
|
|
|
},
|
|
},
|
|
// 获取还需支付金额
|
|
// 获取还需支付金额
|
|
getAmountToBePaid() {
|
|
getAmountToBePaid() {
|
|
@@ -172,7 +174,7 @@ export default {
|
|
if([ 5, 8, 10 ].indexOf(this.parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
|
|
if([ 5, 8, 10 ].indexOf(this.parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
|
|
amountToBePaid = amountToBePaid - this.orderDetail.discountInfo?.points?.[0]?.discountFee
|
|
amountToBePaid = amountToBePaid - this.orderDetail.discountInfo?.points?.[0]?.discountFee
|
|
}
|
|
}
|
|
- if([ 4, 6 ].indexOf(this.parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
|
|
|
|
|
|
+ if ([4, 6].indexOf(this.parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
|
|
amountToBePaid = amountToBePaid - this.orderDetail.discountInfo?.points?.[0]?.discountFee
|
|
amountToBePaid = amountToBePaid - this.orderDetail.discountInfo?.points?.[0]?.discountFee
|
|
}
|
|
}
|
|
return amountToBePaid
|
|
return amountToBePaid
|
|
@@ -200,9 +202,9 @@ export default {
|
|
// 计算单日剩余 remainConsumeTime
|
|
// 计算单日剩余 remainConsumeTime
|
|
// 当前使用优惠 state.usingTotalDiscount
|
|
// 当前使用优惠 state.usingTotalDiscount
|
|
// 判断符合上限
|
|
// 判断符合上限
|
|
- if ( this.remainPrice >= maxOneTimeDiscountFee) {
|
|
|
|
- this.couponList = this.couponList.map((elm,iemi) => {
|
|
|
|
- if ( !elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
|
|
|
|
|
|
+ if (this.remainPrice >= maxOneTimeDiscountFee) {
|
|
|
|
+ this.couponList = this.couponList.map((elm, iemi) => {
|
|
|
|
+ if (!elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
|
|
elm.disabled = true
|
|
elm.disabled = true
|
|
}
|
|
}
|
|
return elm
|
|
return elm
|
|
@@ -216,9 +218,9 @@ export default {
|
|
// 计算单日剩余 remainConsumeTime
|
|
// 计算单日剩余 remainConsumeTime
|
|
// 当前使用优惠 state.usingTotalDiscount
|
|
// 当前使用优惠 state.usingTotalDiscount
|
|
// 判断符合上限
|
|
// 判断符合上限
|
|
- if ( this.remainPrice >= maxOneTimeDiscountFee ) {
|
|
|
|
- this.couponList = this.couponList.map((elm,iemi) => {
|
|
|
|
- if ( !elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
|
|
|
|
|
|
+ if (this.remainPrice >= maxOneTimeDiscountFee) {
|
|
|
|
+ this.couponList = this.couponList.map((elm, iemi) => {
|
|
|
|
+ if (!elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
|
|
elm.disabled = true
|
|
elm.disabled = true
|
|
}
|
|
}
|
|
return elm
|
|
return elm
|
|
@@ -247,13 +249,12 @@ export default {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
// 如果杭州、福州的使用券打到上限则不自动计算其余券是否可选
|
|
// 如果杭州、福州的使用券打到上限则不自动计算其余券是否可选
|
|
- if ( this.checkedCouponList.length >= this.remainCoupons && (this.parkMallCode === 2 || this.parkMallCode === 8 || this.parkMallCode === 7 || this.parkMallCode === 9 || this.parkMallCode === 5) ) {
|
|
|
|
|
|
+ if (this.checkedCouponList.length >= this.remainCoupons && (this.parkMallCode === 2 || this.parkMallCode === 8 || this.parkMallCode === 7 || this.parkMallCode === 9 || this.parkMallCode === 5)) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- // console.log(292,this.couponList);
|
|
|
|
const index = this.item2Number(this.checkedCouponList[0])
|
|
const index = this.item2Number(this.checkedCouponList[0])
|
|
const item = this.couponList[index];
|
|
const item = this.couponList[index];
|
|
- const { superposition, limitCountPerOrder = 0, name } = item;
|
|
|
|
|
|
+ const {superposition, limitCountPerOrder = 0, name} = item;
|
|
switch (superposition) {
|
|
switch (superposition) {
|
|
case '1': // 不可叠加
|
|
case '1': // 不可叠加
|
|
couponList = couponList.map((elm, i) => {
|
|
couponList = couponList.map((elm, i) => {
|
|
@@ -262,12 +263,12 @@ export default {
|
|
})
|
|
})
|
|
break;
|
|
break;
|
|
case '2': // 同类型可叠加
|
|
case '2': // 同类型可叠加
|
|
- // 找到
|
|
|
|
|
|
+ // 找到
|
|
couponList = couponList.map((elm, i) => {
|
|
couponList = couponList.map((elm, i) => {
|
|
// 只有 status === 'available' 的才会赋值为 false
|
|
// 只有 status === 'available' 的才会赋值为 false
|
|
elm.disabled = elm?.status !== 'available' || !moment().isBefore(elm.expirationDate); // 默认可选
|
|
elm.disabled = elm?.status !== 'available' || !moment().isBefore(elm.expirationDate); // 默认可选
|
|
// 找到所以 superposition === 2 的同类型的券
|
|
// 找到所以 superposition === 2 的同类型的券
|
|
- if ( elm?.status === 'unavailable' || moment().isSameOrAfter(elm.expirationDate)) {
|
|
|
|
|
|
+ if (elm?.status === 'unavailable' || moment().isSameOrAfter(elm.expirationDate)) {
|
|
// 这里是做一个阻断,就是避免程序往下执行,没有别的意思
|
|
// 这里是做一个阻断,就是避免程序往下执行,没有别的意思
|
|
elm.disabled = true
|
|
elm.disabled = true
|
|
} else if (elm.superposition === superposition) { // 这里是找到一样类型的券
|
|
} else if (elm.superposition === superposition) { // 这里是找到一样类型的券
|
|
@@ -276,7 +277,7 @@ export default {
|
|
if (selectCouponIds.length >= elm.limitCountPerOrder) { // 如果这个批次的券已经选了一部分,并且超过了可选上限的话。
|
|
if (selectCouponIds.length >= elm.limitCountPerOrder) { // 如果这个批次的券已经选了一部分,并且超过了可选上限的话。
|
|
elm.disabled = selectCouponIds.findIndex(iem => iem.code === elm.code) < 0 // 置灰剩余没有选中的电子券
|
|
elm.disabled = selectCouponIds.findIndex(iem => iem.code === elm.code) < 0 // 置灰剩余没有选中的电子券
|
|
}
|
|
}
|
|
- } else if (elm.limitCountPerOrder === 0) { // 如果是 0 的话,则不做任何限制
|
|
|
|
|
|
+ } else if (elm.limitCountPerOrder === 0) { // 如果是 0 的话,则不做任何限制
|
|
elm.disabled = false
|
|
elm.disabled = false
|
|
} else {
|
|
} else {
|
|
elm.disabled = selectCouponIds.findIndex(iem => iem.code === elm.code) < 0 && selectCouponIds.length > 0 // 同类型可选的券,如果可选上限是1,就设为不可选择
|
|
elm.disabled = selectCouponIds.findIndex(iem => iem.code === elm.code) < 0 && selectCouponIds.length > 0 // 同类型可选的券,如果可选上限是1,就设为不可选择
|
|
@@ -292,7 +293,7 @@ export default {
|
|
},
|
|
},
|
|
// 根据电子券规则判断是否可选
|
|
// 根据电子券规则判断是否可选
|
|
isDisabledByRule(item, index, showMsg) {
|
|
isDisabledByRule(item, index, showMsg) {
|
|
- const { parkMallCode } = this.orderDetail.parkInfo;
|
|
|
|
|
|
+ const {parkMallCode} = this.orderDetail.parkInfo;
|
|
// 最高优先级,提示未生效的电子券
|
|
// 最高优先级,提示未生效的电子券
|
|
if (item.status === 'unavailable' || moment().isSameOrAfter(item.expirationDate)) {
|
|
if (item.status === 'unavailable' || moment().isSameOrAfter(item.expirationDate)) {
|
|
return Toast({
|
|
return Toast({
|
|
@@ -305,12 +306,12 @@ export default {
|
|
if ( this.checkedCouponList.length >= this.remainCoupons && (this.parkMallCode === 2 || this.parkMallCode === 8 || this.parkMallCode === 7 || this.parkMallCode === 9 || this.parkMallCode === 5 || this.parkMallCode === 8) ) {
|
|
if ( this.checkedCouponList.length >= this.remainCoupons && (this.parkMallCode === 2 || this.parkMallCode === 8 || this.parkMallCode === 7 || this.parkMallCode === 9 || this.parkMallCode === 5 || this.parkMallCode === 8) ) {
|
|
if ( showMsg ) return true
|
|
if ( showMsg ) return true
|
|
return Toast({
|
|
return Toast({
|
|
- message: `电子券每天最多可使用${ this.maxOneDayCoupons }张`,
|
|
|
|
|
|
+ message: `电子券每天最多可使用${this.maxOneDayCoupons}张`,
|
|
className: "white-space",
|
|
className: "white-space",
|
|
icon: 'none',
|
|
icon: 'none',
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 浦东每次缴费超限控制、沈阳每日超限控制
|
|
// 浦东每次缴费超限控制、沈阳每日超限控制
|
|
if ([1,4,5,999, 8, 6,10].indexOf(parkMallCode) > -1 && this.crossMessage(showMsg)) {
|
|
if ([1,4,5,999, 8, 6,10].indexOf(parkMallCode) > -1 && this.crossMessage(showMsg)) {
|
|
this.couponList = this.couponList.map((e, i) => {
|
|
this.couponList = this.couponList.map((e, i) => {
|
|
@@ -321,9 +322,8 @@ export default {
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 选中状态赋值
|
|
// 选中状态赋值
|
|
- // this.groupedCouponData();
|
|
|
|
this.newGroupedCouponData();
|
|
this.newGroupedCouponData();
|
|
},
|
|
},
|
|
// 是否选中
|
|
// 是否选中
|
|
@@ -332,14 +332,16 @@ export default {
|
|
},
|
|
},
|
|
// 超限提示
|
|
// 超限提示
|
|
crossMessage(showMsg = '') {
|
|
crossMessage(showMsg = '') {
|
|
- const { parkMallCode } = this.orderDetail.parkInfo;
|
|
|
|
- const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, availableDiscountFee, oneTimeLimitation,oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
|
|
|
|
+ const {parkMallCode} = this.orderDetail.parkInfo;
|
|
const {
|
|
const {
|
|
- usingTotalDiscount, // 使用总抵扣
|
|
|
|
- coupons,
|
|
|
|
- } = this.orderDetail.discountInfo;
|
|
|
|
|
|
+ maxOneTimeDiscountTime,
|
|
|
|
+ remainConsumeTime,
|
|
|
|
+ hourPrice,
|
|
|
|
+ oneTimeLimitation,
|
|
|
|
+ oneDayLimitation,
|
|
|
|
+ maxOneDayDiscountFee
|
|
|
|
+ } = this.orderDetail.parkingRule;
|
|
const {
|
|
const {
|
|
- // totalFee, // 应缴
|
|
|
|
actualPayFee, // 应付金额
|
|
actualPayFee, // 应付金额
|
|
} = this.orderDetail.parkingRecord;
|
|
} = this.orderDetail.parkingRecord;
|
|
// 剩余可使用的优惠金额,支持动态计算; 优惠时长,不可能全部使用,不能超过车费减去优惠的金额;不能超过单次的应付金额
|
|
// 剩余可使用的优惠金额,支持动态计算; 优惠时长,不可能全部使用,不能超过车费减去优惠的金额;不能超过单次的应付金额
|
|
@@ -358,10 +360,10 @@ export default {
|
|
icon: 'none',
|
|
icon: 'none',
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 单日上限
|
|
// 单日上限
|
|
if (oneDayLimitation && this.remainPrice >= this.availableDiscountFee) {
|
|
if (oneDayLimitation && this.remainPrice >= this.availableDiscountFee) {
|
|
- if ( showMsg ) return true
|
|
|
|
|
|
+ if (showMsg) return true
|
|
return Toast({
|
|
return Toast({
|
|
message: [5, 8, 10].indexOf(parkMallCode) > -1 ? '当日优惠已达上限,不可再用' : `每日最高可抵扣${maxOneDayDiscountFee}元`,
|
|
message: [5, 8, 10].indexOf(parkMallCode) > -1 ? '当日优惠已达上限,不可再用' : `每日最高可抵扣${maxOneDayDiscountFee}元`,
|
|
className: "white-space",
|
|
className: "white-space",
|
|
@@ -383,7 +385,6 @@ export default {
|
|
// 确认
|
|
// 确认
|
|
confirm() {
|
|
confirm() {
|
|
// 重新计算兑换券优惠
|
|
// 重新计算兑换券优惠
|
|
- const checkedCouponList = this.checkedCouponList.map((i) => this.item2Number(i));
|
|
|
|
const couponList = this.couponList.map((elm, index) => {
|
|
const couponList = this.couponList.map((elm, index) => {
|
|
elm.selected = false;
|
|
elm.selected = false;
|
|
if (this.checkedCouponList.indexOf(`coupon${index}`) > -1) {
|
|
if (this.checkedCouponList.indexOf(`coupon${index}`) > -1) {
|
|
@@ -397,36 +398,6 @@ export default {
|
|
this.$router.back();
|
|
this.$router.back();
|
|
},
|
|
},
|
|
});
|
|
});
|
|
-
|
|
|
|
- /*uni.setStorageSync('checkedCouponList', this.checkedCouponList);
|
|
|
|
- uni.setStorageSync('list', this.list);
|
|
|
|
- uni.setStorageSync('couponInfo', {
|
|
|
|
- couponfee: this.totalFee,
|
|
|
|
- couponcode: this.couponCode.join('#'),
|
|
|
|
- });
|
|
|
|
- this.$router.back();*/
|
|
|
|
- },
|
|
|
|
- launchPathInit() {
|
|
|
|
- const groupId = uni.getStorageSync('groupId');
|
|
|
|
- const mallId = uni.getStorageSync('mallId');
|
|
|
|
- const { projectId } = getAppIdByGroupIdAndMallId({
|
|
|
|
- groupId: groupId,
|
|
|
|
- mallId: mallId,
|
|
|
|
- type: 'all',
|
|
|
|
- });
|
|
|
|
- this.launchPath = `?trackSourceType=运营位&trackSourceName=功能球&projectId=${projectId}&groupId=${groupId}&mallId=${mallId}&source=tparkingH5`;
|
|
|
|
-
|
|
|
|
- let isLogin = false
|
|
|
|
- const member = uni.getStorageSync('member');
|
|
|
|
- if (member && JSON.stringify(this.member) !== '{}') {
|
|
|
|
- isLogin = true
|
|
|
|
- }
|
|
|
|
- this.extraData = {
|
|
|
|
- brandId: this.groupId,
|
|
|
|
- lbsId: this.lbsId,
|
|
|
|
- isLogin: isLogin,
|
|
|
|
- navigate_time:new Date().getTime()
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
// 跳转小程序
|
|
// 跳转小程序
|
|
navigateToMiniProgram() {
|
|
navigateToMiniProgram() {
|
|
@@ -447,49 +418,22 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if (isInWeixinH5()) {
|
|
|
|
- // this.$wx.chooseWXPay({
|
|
|
|
- // timestamp: params?.timeStamp,
|
|
|
|
- // nonceStr: params?.nonceStr,
|
|
|
|
- // package: params?.package,
|
|
|
|
- // signType: params?.signType,
|
|
|
|
- // paySign: params?.paySign,
|
|
|
|
- // success: function (res) {
|
|
|
|
- // // alert('success: ' + JSON.stringify(res));
|
|
|
|
- // // res: {"errMsg":"chooseWXPay:cancel"}
|
|
|
|
- // if (res.errMsg === 'chooseWXPay:ok') {
|
|
|
|
- // resolve({ errMsg: 'requestPayment:ok' });
|
|
|
|
- // } else {
|
|
|
|
- // reject(res);
|
|
|
|
- // }
|
|
|
|
- // },
|
|
|
|
- // cancel: function (res) {
|
|
|
|
- // // alert('cancel: ' + JSON.stringify(res));
|
|
|
|
- // // res: {"errMsg":"chooseWXPay:cancel"}
|
|
|
|
- // resolve({ errMsg: 'requestPayment:cancel' });
|
|
|
|
- // },
|
|
|
|
- // fail: function (err) {
|
|
|
|
- // // eslint-disable-next-line no-console
|
|
|
|
- // console.error(err);
|
|
|
|
- // reject(err);
|
|
|
|
- // },
|
|
|
|
- // });
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
// H5 跳转到小程序
|
|
// H5 跳转到小程序
|
|
- launchFn({ appId, extInfo }) {
|
|
|
|
- // console.log(584, JSON.stringify({ appId, extInfo }));
|
|
|
|
|
|
+ launchFn({appId, extInfo}) {
|
|
this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
|
|
this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
|
|
name: 'parkingFeeDetail',
|
|
name: 'parkingFeeDetail',
|
|
});
|
|
});
|
|
this.$router.go(-2);
|
|
this.$router.go(-2);
|
|
- // console.log('H5 跳转到 嘉里中心小程序: success');
|
|
|
|
},
|
|
},
|
|
- launchErrorFn({ errMsg, appId, extInfo }) {
|
|
|
|
|
|
+ launchErrorFn({errMsg, appId, extInfo}) {
|
|
// console.log('H5 跳转到 嘉里中心小程序: fail', JSON.stringify({ errMsg, appId, extInfo }));
|
|
// console.log('H5 跳转到 嘉里中心小程序: fail', JSON.stringify({ errMsg, appId, extInfo }));
|
|
},
|
|
},
|
|
onLaunchReady() {
|
|
onLaunchReady() {
|
|
// console.log('H5 跳转到 嘉里中心小程序 的标签 渲染了');
|
|
// console.log('H5 跳转到 嘉里中心小程序 的标签 渲染了');
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ destroyed() {
|
|
|
|
+ window.removeEventListener('scroll', this.handleScrollDebounce, 100);
|
|
|
|
+ }
|
|
};
|
|
};
|