|
@@ -224,7 +224,7 @@ export default {
|
|
let couponList = [...this.couponList]; // 获取目前用户的电子券
|
|
let couponList = [...this.couponList]; // 获取目前用户的电子券
|
|
if (!this.checkedCouponList.length) {
|
|
if (!this.checkedCouponList.length) {
|
|
this.couponList = couponList.map(elm => {
|
|
this.couponList = couponList.map(elm => {
|
|
- elm.disabled = false
|
|
|
|
|
|
+ elm.disabled = elm?.status !== 'available';
|
|
return elm;
|
|
return elm;
|
|
})
|
|
})
|
|
return
|
|
return
|
|
@@ -242,13 +242,17 @@ export default {
|
|
case '2': // 同类型可叠加
|
|
case '2': // 同类型可叠加
|
|
// 找到
|
|
// 找到
|
|
couponList = couponList.map((elm, i) => {
|
|
couponList = couponList.map((elm, i) => {
|
|
- elm.disabled = false; // 默认可选
|
|
|
|
|
|
+ // 只有 status === 'available' 的才会赋值为 false
|
|
|
|
+ elm.disabled = elm?.status !== 'available'; // 默认可选
|
|
// 找到所以 superposition === 2 的同类型的券
|
|
// 找到所以 superposition === 2 的同类型的券
|
|
- if (elm.superposition === superposition) {
|
|
|
|
- const selectCouponIds = couponList.filter((iem, iemi) => iem.couponId === elm.couponId && this.checkedCouponList.indexOf(`coupon${iemi}`) > -1);
|
|
|
|
|
|
+ if ( elm?.status === 'unavailable' ) {
|
|
|
|
+ // 这里是做一个阻断,就是避免程序往下执行,没有别的意思
|
|
|
|
+ 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 (elm.limitCountPerOrder > 1) { // 是否存在上限
|
|
- if (selectCouponIds.length >= elm.limitCountPerOrder) {
|
|
|
|
- elm.disabled = selectCouponIds.findIndex(iem => iem.code === elm.code) < 0
|
|
|
|
|
|
+ if (selectCouponIds.length >= elm.limitCountPerOrder) { // 如果这个批次的券已经选了一部分,并且超过了可选上限的话。
|
|
|
|
+ elm.disabled = selectCouponIds.findIndex(iem => iem.code === elm.code) < 0 // 置灰剩余没有选中的电子券
|
|
}
|
|
}
|
|
} 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,就设为不可选择
|
|
@@ -265,6 +269,14 @@ export default {
|
|
// 根据电子券规则判断是否可选
|
|
// 根据电子券规则判断是否可选
|
|
isDisabledByRule(item) {
|
|
isDisabledByRule(item) {
|
|
const { parkMallCode } = this.orderDetail.parkInfo;
|
|
const { parkMallCode } = this.orderDetail.parkInfo;
|
|
|
|
+ // 最高优先级,提示未生效的电子券
|
|
|
|
+ if (item.status === 'unavailable') {
|
|
|
|
+ return Toast({
|
|
|
|
+ className: 'top300',
|
|
|
|
+ message: `当前电子券暂未生效,不可用`,
|
|
|
|
+ icon: 'none',
|
|
|
|
+ });
|
|
|
|
+ }
|
|
// 杭州电子券使用上限(单位: 张)
|
|
// 杭州电子券使用上限(单位: 张)
|
|
/*if (this.parkMallCode === 2) {
|
|
/*if (this.parkMallCode === 2) {
|
|
// 达到上限
|
|
// 达到上限
|