|
@@ -0,0 +1,907 @@
|
|
|
|
+```
|
|
|
|
+import { mapState } from 'vuex';
|
|
|
|
+
|
|
|
|
+import uni from '@/utils/uniHooks';
|
|
|
|
+
|
|
|
|
+import {Toast} from 'vant';
|
|
|
|
+
|
|
|
|
+import {getPlatform, getAppIdByGroupIdAndMallId, isInWeixinH5} from '@/utils';
|
|
|
|
+
|
|
|
|
+import { debounce } from 'lodash'
|
|
|
|
+
|
|
|
|
+import dayjs from 'dayjs';
|
|
|
|
+
|
|
|
|
+import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
|
|
+
|
|
|
|
+import noCardPng from '@/pages/static/images/no-card.png'
|
|
|
|
+
|
|
|
|
+// 使用插件
|
|
|
|
+
|
|
|
|
+dayjs.extend(isSameOrAfter);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+
|
|
|
|
+data() {
|
|
|
|
+
|
|
|
|
+return {
|
|
|
|
+
|
|
|
|
+checkedCouponList: [],
|
|
|
|
+
|
|
|
|
+couponList: [],
|
|
|
|
+
|
|
|
|
+launchPath: '', // H5跳转CRM微信小程序
|
|
|
|
+
|
|
|
|
+envVersion: window.env === 'qa' ? 'trial' : 'release', // 所需跳转的小程序版本,合法值为:正式版release、开发版develop、体验版trial(支持的微信版本:iOS 8.0.18及以上、Android 8.0.19及以上)
|
|
|
|
+
|
|
|
|
+platform: getPlatform(),
|
|
|
|
+
|
|
|
|
+maxCouponFee: 0, // 计算优惠券已选的总金额
|
|
|
|
+
|
|
|
|
+remainPrice: 0, // 剩余可用优惠额度
|
|
|
|
+
|
|
|
|
+newAvailableDiscountFee: 0, // 可使用的电子券的优惠金额上限
|
|
|
|
+
|
|
|
|
+extraData: {},
|
|
|
|
+
|
|
|
|
+// 虚拟dom
|
|
|
|
+
|
|
|
|
+offset: 0,
|
|
|
|
+
|
|
|
|
+height: 0,
|
|
|
|
+
|
|
|
|
+rowHeight: 105,
|
|
|
|
+
|
|
|
|
+rowData: [...new Array(30)].map((i, index) => index),
|
|
|
|
+
|
|
|
|
+handleScrollDebounce: null,
|
|
|
|
+
|
|
|
|
+noCardPng
|
|
|
|
+
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+computed: {
|
|
|
|
+
|
|
|
|
+...mapState({
|
|
|
|
+
|
|
|
|
+custTypeId: (state) => state.custTypeId,
|
|
|
|
+
|
|
|
|
+actualPayFee: (state) => state.order.actualPayFee,
|
|
|
|
+
|
|
|
|
+orderDetail: (state) => state.order.orderDetail,
|
|
|
|
+
|
|
|
|
+coupons: (state) => state.order.coupons,
|
|
|
|
+
|
|
|
|
+maxOneDayDiscountFee: (state) => state.order.maxOneDayDiscountFee, // 深圳单日单次使用上限
|
|
|
|
+
|
|
|
|
+usingTotalDiscount: (state) => state.order.usingTotalDiscount, // 当前已使用优惠
|
|
|
|
+
|
|
|
|
+availableDiscountFee: (state) => state.order.availableDiscountFee, // 当前已使用优惠
|
|
|
|
+
|
|
|
|
+unLimitWeekendPoints: (state) => state.order.unLimitWeekendPoints, // 新的积分上限, 默认为false(不开启), unLimitWeekendPoints: true # 开启无上限功能; unLimitWeekendPoints: false # 关闭无上限功能;
|
|
|
|
+
|
|
|
|
+lbsId: (state) => state.lbsId, // 楼栋ID
|
|
|
|
+
|
|
|
|
+groupId: (state) => state.groupId, // 楼盘ID
|
|
|
|
+
|
|
|
|
+remainCoupons: (state) => state.order.remainCoupons, // 仅限杭州当前剩余可选电子券上限
|
|
|
|
+
|
|
|
|
+na buildingId: (state) => state.order.buildingId, // 当前车场id
|
|
|
|
+
|
|
|
|
+maxOneDayCoupons: (state) => state.order.maxOneDayCoupons,// 仅限杭州当日电子券可选上限
|
|
|
|
+
|
|
|
|
+paperDiscountFee: (state) => state.order.paperDiscountFee,// 纸质券的优惠金额
|
|
|
|
+
|
|
|
|
+}),
|
|
|
|
+
|
|
|
|
+totalFee() {
|
|
|
|
+
|
|
|
|
+return this?.orderDetail?.parkingRecord?.totalFee
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+mounted() {
|
|
|
|
+
|
|
|
|
+this.height = window.document.documentElement.offsetHeight;
|
|
|
|
+
|
|
|
|
+if(!this.handleScrollDebounce) {
|
|
|
|
+
|
|
|
|
+this.handleScrollDebounce = debounce(this.handleScroll, 100)
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+window.addEventListener('scroll', this.handleScrollDebounce, false);
|
|
|
|
+
|
|
|
|
+this.pageInit();
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+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);
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+setTimeout(() => {
|
|
|
|
+
|
|
|
|
+this.newGroupedCouponData()
|
|
|
|
+
|
|
|
|
+this.setAllDisabled()
|
|
|
|
+
|
|
|
|
+}, 100)
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+pageInit() {
|
|
|
|
+
|
|
|
|
+const {parkInfo, parkingRecord} = this.orderDetail
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+
|
|
|
|
+* 电子优惠券初始化逻辑(后端处理)
|
|
|
|
+
|
|
|
|
+*
|
|
|
|
+
|
|
|
|
+* 1、每次change之后,需要重新计算每个电子优惠券的逻辑
|
|
|
|
+
|
|
|
|
+* 2、superposition 叠加使用规则 (1不可叠加,2仅同类型可叠加,3可叠加);
|
|
|
|
+
|
|
|
|
+* */
|
|
|
|
+
|
|
|
|
+this.couponList = [...this.coupons];
|
|
|
|
+
|
|
|
|
+// 如果存在第三方车场优惠
|
|
|
|
+
|
|
|
|
+const {parkDiscount = 0} = parkingRecord
|
|
|
|
+
|
|
|
|
+this.remainPrice = this.usingTotalDiscount - this.paperDiscountFee - parkDiscount;
|
|
|
|
+
|
|
|
|
+if (this.isHaveDeiscountByBuildingId(this.buildingId, [ 'skc', 'tkc']) && this.orderDetail?.discountInfo?.points?.[0]?.discountFee) {
|
|
|
|
+
|
|
|
|
+this.remainPrice = this.remainPrice - this.orderDetail.discountInfo.points[0].discountFee
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 前海积分不参与当前电子券优惠上限 (福州、深圳建设广场)
|
|
|
|
+
|
|
|
|
+if (this.isHaveDeiscountByBuildingId(this.buildingId, [ 'qhkc', 'fzkc', 'szkp1' ]) && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
|
|
|
|
+
|
|
|
|
+this.remainPrice = this.remainPrice - this.orderDetail?.discountInfo?.points[0]?.discountFee
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+this.newAvailableDiscountFee = this.availableDiscountFee
|
|
|
|
+
|
|
|
|
+// console.log(878787, this.newAvailableDiscountFee);
|
|
|
|
+
|
|
|
|
+if (this.couponList.length) {
|
|
|
|
+
|
|
|
|
+this.couponList = this.couponList.map((elm, index) => {
|
|
|
|
+
|
|
|
|
+elm.disabled = true;
|
|
|
|
+
|
|
|
|
+const selected = elm.hasOwnProperty('selected') ? elm.selected : elm.defaultSelected;
|
|
|
|
+
|
|
|
|
+if (selected) {
|
|
|
|
+
|
|
|
|
+this.maxCouponFee = this.maxCouponFee + elm.discountFee;
|
|
|
|
+
|
|
|
|
+this.checkedCouponList.push(`coupon${index}`);
|
|
|
|
+
|
|
|
|
+elm.disabled = false;
|
|
|
|
+
|
|
|
|
+} else {
|
|
|
|
+
|
|
|
|
+// elm.disabled = !elm.defaultSelected
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return elm;
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+if (!this.checkedCouponList.length) {
|
|
|
|
+
|
|
|
|
+this.couponList = this.couponList.map((elm) => {
|
|
|
|
+
|
|
|
|
+elm.disabled = false;
|
|
|
|
+
|
|
|
|
+return elm;
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+this.$nextTick(() => {
|
|
|
|
+
|
|
|
|
+// 验证剩余优惠券是否可勾选(无需验证:后端已计算可勾选的优惠券) 4, 0, 1, 3, 10,
|
|
|
|
+
|
|
|
|
+this.newGroupedCouponData()
|
|
|
|
+
|
|
|
|
+this.setAllDisabled()
|
|
|
|
+
|
|
|
|
+if (this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'bkc', 'skc', 'qhkc', 'tkc', 'fzkc', 'szkp1' ])) {
|
|
|
|
+
|
|
|
|
+this.isDisabledByRule(this.couponList[0], 0, 'showMsg');
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+item2Number(i) {
|
|
|
|
+
|
|
|
|
+return Number.parseInt(i.replace(/coupon/g, ''));
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+checkboxItemChange(name, index) {
|
|
|
|
+
|
|
|
|
+const coupon = this.couponList[index];
|
|
|
|
+
|
|
|
|
+if (coupon.disabled) {
|
|
|
|
+
|
|
|
|
+if (this.getAmountToBePaid() <= 0) {
|
|
|
|
+
|
|
|
|
+Toast('当前无需追加优惠')
|
|
|
|
+
|
|
|
|
+return;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+setTimeout(() => {
|
|
|
|
+
|
|
|
|
+// 根据电子券规则判断是否可选
|
|
|
|
+
|
|
|
|
+this.isDisabledByRule(coupon, index);
|
|
|
|
+
|
|
|
|
+}, 100)
|
|
|
|
+
|
|
|
|
+return;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 取消勾选时
|
|
|
|
+
|
|
|
|
+if (this.checkedCouponList.indexOf(name) > -1) {
|
|
|
|
+
|
|
|
|
+this.checkedCouponList = this.checkedCouponList.filter((i) => i !== name);
|
|
|
|
+
|
|
|
|
+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;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 如果有选中项
|
|
|
|
+
|
|
|
|
+// 还需支付金额 = 总金额 - 优惠金额
|
|
|
|
+
|
|
|
|
+if (this.getAmountToBePaid() <= 0) {
|
|
|
|
+
|
|
|
|
+Toast('当前无需追加优惠')
|
|
|
|
+
|
|
|
|
+return;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const item = this.couponList[index];
|
|
|
|
+
|
|
|
|
+this.remainPrice = this.remainPrice + this.couponList[index].discountFee
|
|
|
|
+
|
|
|
|
+this.newAvailableDiscountFee = this.newAvailableDiscountFee - this.couponList[index].discountFee
|
|
|
|
+
|
|
|
|
+if (!item.disabled) {
|
|
|
|
+
|
|
|
|
+this.checkedCouponList.push(`coupon${index}`);
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+this.$nextTick(() => {
|
|
|
|
+
|
|
|
|
+this.newGroupedCouponData()
|
|
|
|
+
|
|
|
|
+this.setAllDisabled()
|
|
|
|
+
|
|
|
|
+this.isDisabledByRule(coupon, index, 'showMsg');
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// 获取还需支付金额
|
|
|
|
+
|
|
|
|
+getAmountToBePaid() {
|
|
|
|
+
|
|
|
|
+const { totalFee, paperDiscountFee, remainPrice, orderDetail } = this;
|
|
|
|
+
|
|
|
|
+let amountToBePaid = totalFee - paperDiscountFee - remainPrice;
|
|
|
|
+
|
|
|
|
+const discountFee = orderDetail.discountInfo?.points?.[0]?.discountFee || 0;
|
|
|
|
+
|
|
|
|
+// 需要处理的site
|
|
|
|
+
|
|
|
|
+if (this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'bkc', 'skc', 'qhkc', 'tkc', 'fzkc', 'szkp1' ]) && discountFee) {
|
|
|
|
+
|
|
|
|
+amountToBePaid -= discountFee;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return amountToBePaid;
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// 针对达到优惠的上限制
|
|
|
|
+
|
|
|
|
+setAllDisabled() {
|
|
|
|
+
|
|
|
|
+const {parkInfo,parkingRule} = this.orderDetail
|
|
|
|
+
|
|
|
|
+const {maxOneTimeDiscountTime,oneTimeLimitation,oneDayLimitation,hourPrice,remainConsumeTime} = parkingRule
|
|
|
|
+
|
|
|
|
+// 设置深圳、福州的达到优惠金额的上限,置灰剩下未选择的金额
|
|
|
|
+
|
|
|
|
+if ( this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'bkc', 'skc', 'qhkc', 'tkc', 'fzkc', 'szkp1' ]) && this.remainPrice >= this.newAvailableDiscountFee) {
|
|
|
|
+
|
|
|
|
+this.couponList = this.couponList.map((elm,iemi) => {
|
|
|
|
+
|
|
|
|
+if ( !elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
|
|
|
|
+
|
|
|
|
+elm.disabled = true
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return elm
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+return true
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 单日上限限制
|
|
|
|
+
|
|
|
|
+if ( oneDayLimitation && this.isHaveDeiscountByBuildingId(this.buildingId,[], [ 'jakc', 'kcp', 'bkc', 'skc', 'qhkc', 'tkc', 'fzkc', 'szkp1' ])) {
|
|
|
|
+
|
|
|
|
+const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
|
|
|
|
+
|
|
|
|
+const remainConsumeTimeFee = remainConsumeTime * hourPrice
|
|
|
|
+
|
|
|
|
+// 计算单日剩余 remainConsumeTime
|
|
|
|
+
|
|
|
|
+// 当前使用优惠 state.usingTotalDiscount
|
|
|
|
+
|
|
|
|
+// 判断符合上限
|
|
|
|
+
|
|
|
|
+if (this.remainPrice >= maxOneTimeDiscountFee) {
|
|
|
|
+
|
|
|
|
+this.couponList = this.couponList.map((elm, iemi) => {
|
|
|
|
+
|
|
|
|
+if (!elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
|
|
|
|
+
|
|
|
|
+elm.disabled = true
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return elm
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 单次上限限制
|
|
|
|
+
|
|
|
|
+if ( oneTimeLimitation && this.isHaveDeiscountByBuildingId(this.buildingId, [], [ 'qhkc', 'tkc', 'fzkc', 'szkp1' ])) {
|
|
|
|
+
|
|
|
|
+const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
|
|
|
|
+
|
|
|
|
+// const remainConsumeTimeFee = remainConsumeTime * hourPrice
|
|
|
|
+
|
|
|
|
+// 计算单日剩余 remainConsumeTime
|
|
|
|
+
|
|
|
|
+// 当前使用优惠 state.usingTotalDiscount
|
|
|
|
+
|
|
|
|
+// 判断符合上限
|
|
|
|
+
|
|
|
|
+if (this.remainPrice >= maxOneTimeDiscountFee) {
|
|
|
|
+
|
|
|
|
+this.couponList = this.couponList.map((elm, iemi) => {
|
|
|
|
+
|
|
|
|
+if (!elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
|
|
|
|
+
|
|
|
|
+elm.disabled = true
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return elm
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 杭州、福州、深圳前海 电子券选择上限判断 +天津 20240911
|
|
|
|
+
|
|
|
|
+if ( this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'hkc', 'bkc', 'skc', 'qhkc', 'tkc', 'kec', 'fzkc', 'ke3', 'szkp1', 'szkp1' ]) && this.checkedCouponList.length >= this.remainCoupons ) {
|
|
|
|
+
|
|
|
|
+this.couponList = this.couponList.map(( elm,iemi ) => {
|
|
|
|
+
|
|
|
|
+if ( !elm.disabled && this.checkedCouponList.indexOf(`coupon${ iemi }`) < 0 ) {
|
|
|
|
+
|
|
|
|
+elm.disabled = true
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return elm
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return false
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// 对不同类型的优惠券进行汇总统计
|
|
|
|
+
|
|
|
|
+newGroupedCouponData() {
|
|
|
|
+
|
|
|
|
+let couponList = [...this.couponList]; // 获取目前用户的电子券
|
|
|
|
+
|
|
|
|
+if (!this.checkedCouponList.length) {
|
|
|
|
+
|
|
|
|
+this.couponList = couponList.map(elm => {
|
|
|
|
+
|
|
|
|
+elm.disabled = elm?.status !== 'available' || !dayjs().isBefore(elm.expirationDate);
|
|
|
|
+
|
|
|
|
+return elm;
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+return
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 如果杭州、福州的使用券打到上限则不自动计算其余券是否可选 +天津 20240911
|
|
|
|
+
|
|
|
|
+if (this.checkedCouponList.length >= this.remainCoupons && this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'hkc', 'bkc', 'skc', 'qhkc', 'tkc', 'kec', 'fzkc', 'ke3', 'szkp1', 'szkp1' ])) {
|
|
|
|
+
|
|
|
|
+return
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const index = this.item2Number(this.checkedCouponList[0])
|
|
|
|
+
|
|
|
|
+const item = this.couponList[index];
|
|
|
|
+
|
|
|
|
+const {superposition, limitCountPerOrder = 0, name} = item;
|
|
|
|
+
|
|
|
|
+switch (superposition) {
|
|
|
|
+
|
|
|
|
+case '1': // 不可叠加
|
|
|
|
+
|
|
|
|
+this.rowData.forEach((elmIndex) => {
|
|
|
|
+
|
|
|
|
+const elm = {
|
|
|
|
+
|
|
|
|
+...this.couponList[elmIndex]
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+if(elm.name) {
|
|
|
|
+
|
|
|
|
+this.$set(this.couponList, elmIndex , {
|
|
|
|
+
|
|
|
|
+...elm,
|
|
|
|
+
|
|
|
|
+disabled: elmIndex !== index
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+break;
|
|
|
|
+
|
|
|
|
+case '2': // 同类型可叠加
|
|
|
|
+
|
|
|
|
+// 找到
|
|
|
|
+
|
|
|
|
+this.rowData.map((elmIndex) => {
|
|
|
|
+
|
|
|
|
+const elm = {
|
|
|
|
+
|
|
|
|
+...this.couponList[elmIndex]
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 只有 status === 'available' 的才会赋值为 false
|
|
|
|
+
|
|
|
|
+elm.disabled = elm?.status !== 'available' || !dayjs().isBefore(elm.expirationDate); // 默认可选
|
|
|
|
+
|
|
|
|
+// 找到所以 superposition === 2 的同类型的券
|
|
|
|
+
|
|
|
|
+if (elm?.status === 'unavailable' || dayjs().isSameOrAfter(elm.expirationDate)) {
|
|
|
|
+
|
|
|
|
+// 这里是做一个阻断,就是避免程序往下执行,没有别的意思
|
|
|
|
+
|
|
|
|
+elm.disabled = true
|
|
|
|
+
|
|
|
|
+} else if (elm.superposition === superposition) { // 这里是找到一样类型的券
|
|
|
|
+
|
|
|
|
+const selectCouponIds = couponList.filter((iem, iemi) => iem.couponId === elm.couponId && this.checkedCouponList.indexOf(`coupon${iemi}`) > -1); // 筛选出相同批次(couponId一样)的电子券,并且是已经选中的
|
|
|
|
+
|
|
|
|
+if (elm.limitCountPerOrder > 1) { // 是否存在上限
|
|
|
|
+
|
|
|
|
+if (selectCouponIds.length >= elm.limitCountPerOrder) { // 如果这个批次的券已经选了一部分,并且超过了可选上限的话。
|
|
|
|
+
|
|
|
|
+elm.disabled = selectCouponIds.findIndex(iem => iem.code === elm.code) < 0 // 置灰剩余没有选中的电子券
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+} else if (elm.limitCountPerOrder === 0) { // 如果是 0 的话,则不做任何限制
|
|
|
|
+
|
|
|
|
+elm.disabled = false
|
|
|
|
+
|
|
|
|
+} else {
|
|
|
|
+
|
|
|
|
+elm.disabled = selectCouponIds.findIndex(iem => iem.code === elm.code) < 0 && selectCouponIds.length > 0 // 同类型可选的券,如果可选上限是1,就设为不可选择
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+} else {
|
|
|
|
+
|
|
|
|
+elm.disabled = true; // 非同批次的优惠券设置为不可选择
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+if(elm.name) {
|
|
|
|
+
|
|
|
|
+this.couponList[elmIndex] = {...elm}
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+break;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// 根据电子券规则判断是否可选
|
|
|
|
+
|
|
|
|
+isDisabledByRule(item, index, showMsg) {
|
|
|
|
+
|
|
|
|
+// 最高优先级,提示未生效的电子券
|
|
|
|
+
|
|
|
|
+if (item.status === 'unavailable' || dayjs().isSameOrAfter(item.expirationDate)) {
|
|
|
|
+
|
|
|
|
+return Toast({
|
|
|
|
+
|
|
|
|
+message: `当前电子券暂未生效,不可用`,
|
|
|
|
+
|
|
|
|
+className: "white-space",
|
|
|
|
+
|
|
|
|
+icon: 'none',
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 电子券上限判断(杭州、福州)+天津 20240911
|
|
|
|
+
|
|
|
|
+if ( this.checkedCouponList.length >= this.remainCoupons && this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'hkc', 'bkc', 'skc', 'qhkc', 'tkc', 'kec', 'fzkc', 'ke3', 'szkp1', 'szkp1' ]) ) {
|
|
|
|
+
|
|
|
|
+if ( showMsg ) return true
|
|
|
|
+
|
|
|
|
+return Toast({
|
|
|
|
+
|
|
|
|
+message: `电子券每天最多可使用${this.maxOneDayCoupons}张`,
|
|
|
|
+
|
|
|
|
+className: "white-space",
|
|
|
|
+
|
|
|
|
+icon: 'none',
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 浦东每次缴费超限控制、沈阳每日超限控制
|
|
|
|
+
|
|
|
|
+if (this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'bkc', 'skc', 'qhkc', 'tkc', 'fzkc', 'szkp1' ]) && this.crossMessage(showMsg)) {
|
|
|
|
+
|
|
|
|
+this.couponList = this.couponList.map((e, i) => {
|
|
|
|
+
|
|
|
|
+if (this.checkedCouponList.findIndex((c) => c === `coupon${i}`) === -1) {
|
|
|
|
+
|
|
|
|
+e.disabled = true;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return e
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+return;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 选中状态赋值
|
|
|
|
+
|
|
|
|
+this.newGroupedCouponData();
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// 是否选中
|
|
|
|
+
|
|
|
|
+isCheck(val) {
|
|
|
|
+
|
|
|
|
+return this.checkedCouponList.findIndex((e) => e == val) !== -1;
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// 超限提示
|
|
|
|
+
|
|
|
|
+crossMessage(showMsg = '') {
|
|
|
|
+
|
|
|
|
+const {
|
|
|
|
+
|
|
|
|
+maxOneTimeDiscountTime,
|
|
|
|
+
|
|
|
|
+remainConsumeTime,
|
|
|
|
+
|
|
|
|
+hourPrice,
|
|
|
|
+
|
|
|
|
+oneTimeLimitation,
|
|
|
|
+
|
|
|
|
+oneDayLimitation,
|
|
|
|
+
|
|
|
|
+maxOneDayDiscountFee
|
|
|
|
+
|
|
|
|
+} = this.orderDetail.parkingRule;
|
|
|
|
+
|
|
|
|
+const {
|
|
|
|
+
|
|
|
|
+actualPayFee, // 应付金额
|
|
|
|
+
|
|
|
|
+} = this.orderDetail.parkingRecord;
|
|
|
|
+
|
|
|
|
+// 剩余可使用的优惠金额,支持动态计算; 优惠时长,不可能全部使用,不能超过车费减去优惠的金额;不能超过单次的应付金额
|
|
|
|
+
|
|
|
|
+let remainPrice = remainConsumeTime * hourPrice;
|
|
|
|
+
|
|
|
|
+if (this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'bkc', 'skc', 'qhkc', 'tkc', 'fzkc', 'szkp1' ])) {
|
|
|
|
+
|
|
|
|
+if (remainPrice - this.paperDiscountFee > actualPayFee) {
|
|
|
|
+
|
|
|
|
+remainPrice = actualPayFee;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 深圳超限处理 +天津 20240911
|
|
|
|
+
|
|
|
|
+if (this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'bkc', 'skc', 'qhkc', 'tkc', 'fzkc', 'szkp1' ]) && this.remainPrice >= this.availableDiscountFee) {
|
|
|
|
+
|
|
|
|
+if ( showMsg ) return true
|
|
|
|
+
|
|
|
|
+return Toast({
|
|
|
|
+
|
|
|
|
+message: `优惠券已达当日使用上限,不可再用`,
|
|
|
|
+
|
|
|
|
+className: "white-space",
|
|
|
|
+
|
|
|
|
+icon: 'none',
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 单日上限 +天津20240911
|
|
|
|
+
|
|
|
|
+if (oneDayLimitation && this.remainPrice >= this.availableDiscountFee) {
|
|
|
|
+
|
|
|
|
+if (showMsg) return true
|
|
|
|
+
|
|
|
|
+return Toast({
|
|
|
|
+
|
|
|
|
+message: this.isHaveDeiscountByBuildingId(this.buildingId, [ 'jakc', 'kcp', 'bkc', 'skc', 'qhkc', 'tkc', 'fzkc', 'szkp1' ]) ? '当日优惠已达上限,不可再用' : `每日最高可抵扣${maxOneDayDiscountFee}元`,
|
|
|
|
+
|
|
|
|
+className: "white-space",
|
|
|
|
+
|
|
|
|
+icon: 'none',
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
|
|
|
|
+
|
|
|
|
+// 单次上限限制 +天津 20240911
|
|
|
|
+
|
|
|
|
+if ( oneTimeLimitation && this.isHaveDeiscountByBuildingId(this.buildingId, [], [ 'qhkc', 'tkc', 'fzkc', 'szkp1' ]) && this.remainPrice >= maxOneTimeDiscountFee) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+if ( showMsg ) return true
|
|
|
|
+
|
|
|
|
+return Toast({
|
|
|
|
+
|
|
|
|
+message: `超出抵扣上限,每次最高可抵扣${maxOneTimeDiscountTime}小时`,
|
|
|
|
+
|
|
|
|
+className: "white-space",
|
|
|
|
+
|
|
|
|
+icon: 'none',
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return false
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// 确认
|
|
|
|
+
|
|
|
|
+confirm() {
|
|
|
|
+
|
|
|
|
+// 重新计算兑换券优惠
|
|
|
|
+
|
|
|
|
+const couponList = this.couponList.map((elm, index) => {
|
|
|
|
+
|
|
|
|
+elm.selected = false;
|
|
|
|
+
|
|
|
|
+if (this.checkedCouponList.indexOf(`coupon${index}`) > -1) {
|
|
|
|
+
|
|
|
|
+elm.selected = true;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+return elm;
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+this.$store.dispatch('order/saveCouponMath', {
|
|
|
|
+
|
|
|
|
+couponList: couponList,
|
|
|
|
+
|
|
|
|
+callback: () => {
|
|
|
|
+
|
|
|
|
+this.$router.back();
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// 跳转小程序
|
|
|
|
+
|
|
|
|
+navigateToMiniProgram() {
|
|
|
|
+
|
|
|
|
+// TODO 跳转小程序
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+// H5 跳转到小程序
|
|
|
|
+
|
|
|
|
+launchFn({appId, extInfo}) {
|
|
|
|
+
|
|
|
|
+this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
|
|
|
|
+
|
|
|
|
+name: 'parkingFeeDetail',
|
|
|
|
+
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+this.$router.go(-2);
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+launchErrorFn({errMsg, appId, extInfo}) {
|
|
|
|
+
|
|
|
|
+// console.log('H5 跳转到 嘉里中心小程序: fail', JSON.stringify({ errMsg, appId, extInfo }));
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+onLaunchReady() {
|
|
|
|
+
|
|
|
|
+// console.log('H5 跳转到 嘉里中心小程序 的标签 渲染了');
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+destroyed() {
|
|
|
|
+
|
|
|
|
+window.removeEventListener('scroll', this.handleScrollDebounce, 100);
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+};
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+https://qa-crm.kerryplus.com/bkc-jump-page-1.html
|
|
|
|
+https://crm.kerryplus.com/bkc-jump-page.html
|
|
|
|
+
|
|
|
|
+请帮忙将下面2个链接是指向 tron/temporary-parking-frontend 这个容器里面:
|
|
|
|
+
|
|
|
|
+https://crm.kerryplus.com/bkc/jump-page.html
|
|
|
|
+对应 tron/temporary-parking-frontend 容器中的 bkc/jump-page.html
|
|
|
|
+
|
|
|
|
+https://qa-crm.kerryplus.com/bkc/jump-page.html
|
|
|
|
+对应 tron/temporary-parking-frontend 容器中的 bkc/jump-page-1.html
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+https://qa-consumer.kerryplus.com/tparking/jump-page.html](https://qa-consumer.kerryplus.com/tparking/jump-page.html "https://qa-consumer.kerryplus.com/tparking/jump-page.html
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+[https://qa-crm.kerryplus.com/bkc/jump-page.html](https://qa-crm.kerryplus.com/bkc/jump-page.html "https://qa-crm.kerryplus.com/bkc/jump-page.html")
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+https://qa-consumer.kerryplus.com/tparking/jump-page.html](https://qa-consumer.kerryplus.com/tparking/jump-page.html "https://qa-consumer.kerryplus.com/tparking/jump-page.html
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91379e685365e0e9&redirect_uri=https://qa-consumer.kerryplus.com/tparking/jump-page.html&response_type=code&scope=snsapi_base&state=STATE&component_appid=wxc684d3448fdeb25a#wechat_redirect
|