Commit 4a31e134 by 张立顺

fix bug

1 parent 8b36c03f
...@@ -84,7 +84,7 @@ const MOCK_COUPON_POPUP_HTTP_BODY: CouponPopupApiEnvelope = { ...@@ -84,7 +84,7 @@ const MOCK_COUPON_POPUP_HTTP_BODY: CouponPopupApiEnvelope = {
}; };
/** /**
* 首页 `GET coupon/popup`:为 true 时使用本文件 `MOCK_COUPON_POPUP_HTTP_BODY`,不发请求; * 车辆详情等 `GET coupon/popup`:为 true 时使用本文件 `MOCK_COUPON_POPUP_HTTP_BODY`,不发请求;
* 为 false(默认)时走真实 `axios.get('coupon/popup')`。 * 为 false(默认)时走真实 `axios.get('coupon/popup')`。
*/ */
const COUPON_POPUP_HTTP_MOCK_ENABLED = false; const COUPON_POPUP_HTTP_MOCK_ENABLED = false;
...@@ -98,7 +98,7 @@ function orderCouponsUsesHttpMock(): boolean { ...@@ -98,7 +98,7 @@ function orderCouponsUsesHttpMock(): boolean {
return isOrderCouponsDevMockActive(); return isOrderCouponsDevMockActive();
} }
/** 解析后的首页权益弹窗(便于组件使用) */ /** 解析后的待通知优惠券弹窗(便于组件使用) */
export interface ParsedCouponPopup { export interface ParsedCouponPopup {
popupType: number; popupType: number;
couponList: CouponPopupItem[]; couponList: CouponPopupItem[];
...@@ -812,7 +812,7 @@ export class CouponController { ...@@ -812,7 +812,7 @@ export class CouponController {
} }
/** /**
* 获取待展示弹窗(首页)。 * 获取待展示弹窗(车辆详情等场景)。
* 当前服务端在成功返回数据时会将该用户本批次待通知弹窗批量标记为已触达,请勿在「仅探测、暂不展示」的场景调用。 * 当前服务端在成功返回数据时会将该用户本批次待通知弹窗批量标记为已触达,请勿在「仅探测、暂不展示」的场景调用。
*/ */
static getCouponPopup( static getCouponPopup(
...@@ -861,7 +861,7 @@ export class CouponController { ...@@ -861,7 +861,7 @@ export class CouponController {
} }
/** /**
* 当前创建时间最新的可用优惠券活动 * 当前创建时间最新的可用优惠券活动(首页 P2 活动弹窗)
*/ */
static getLatestCouponActivity( static getLatestCouponActivity(
axios: AxiosStatic axios: AxiosStatic
......
<template>
<view class="latest-activity-popup-host">
<uni-popup ref="popupRef" class="latest-activity-popup" type="center" background-color="#fff"
border-radius="16px" :is-mask-click="true" @maskClick="onMaskDismiss">
<view v-if="activity" class="latest-activity-card">
<view class="latest-activity-close" @click.stop="onHeaderCloseTap">
<uni-icons type="closeempty" size="20" color="#999999" />
</view>
<image class="latest-activity-illust" :src="illustSrc" mode="widthFix" />
<view class="latest-activity-title">{{ activity.activityName }}</view>
<scroll-view scroll-y class="latest-activity-scroll" :show-scrollbar="true">
<view class="latest-activity-body">
<rich-text class="latest-activity-body-rich"
:nodes="formatLatestActivityRichText(activity.agreementContent)"></rich-text>
</view>
</scroll-view>
<van-button class="latest-activity-action" round block color="#FF5000"
@click="onParticipate">立即参拍</van-button>
</view>
</uni-popup>
</view>
</template>
<script lang="ts">
import { Component, Prop, Ref, Vue, Watch } from "vue-facing-decorator";
import { couponImageUrl } from "@/common/couponImageUrl";
export interface LatestActivityPopupData {
activityName: string;
agreementContent: string;
}
@Component({
emits: ["close"],
})
export default class LatestCouponActivityPopup extends Vue {
@Prop({ type: Boolean, default: false })
show!: boolean;
@Prop({ type: Object, default: null })
activity!: LatestActivityPopupData | null;
@Ref popupRef: any;
@Watch("show")
onShowPropChanged(): void {
if (!this.show) {
this.dismissPopupShell();
return;
}
if (this.activity != null) {
this.presentWhenShown();
}
}
@Watch("activity")
onActivityPropChanged(): void {
if (this.show && this.activity != null) {
this.presentWhenShown();
}
}
get illustSrc(): string {
return couponImageUrl("Promotion.png");
}
/**
* 与 AgreementPage 一致:弱化编辑器内联样式,便于小程序 rich-text 排版
*/
formatLatestActivityRichText(html: string): string {
if (!html) {
return "";
}
let s = html;
s = s.replace(/class="mce-.*?"/g, "");
s = s.replace(/width:\s*\d+px;/g, "");
s = s.replace(/height:\s*\d+px;/g, "height: auto;");
s = s.replace(/<(\/)?pre[^>]*>/gi, "");
return s;
}
private dismissPopupShell(): void {
this.popupRef?.close?.("center");
}
private presentWhenShown(): void {
this.scheduleUniPopupOpen();
}
onMaskDismiss(): void {
if (!this.activity) {
return;
}
this.$emit("close");
}
onHeaderCloseTap(): void {
if (!this.activity) {
return;
}
this.popupRef?.close?.("center");
this.$emit("close");
}
onParticipate(): void {
if (!this.activity) {
return;
}
this.popupRef?.close?.("center");
uni.switchTab({ url: "/pages/tabbar/AuctionPage" });
this.$emit("close");
}
private scheduleUniPopupOpen(): void {
const popupInstance = (): any =>
this.popupRef ?? (this.$refs as { popupRef?: unknown }).popupRef;
const tryOpenCenter = (): boolean => {
const ref = popupInstance();
if (ref && typeof ref.open === "function") {
ref.open("center");
return true;
}
return false;
};
this.$nextTick(() => {
this.$nextTick(() => {
if (tryOpenCenter()) {
return;
}
setTimeout(() => {
if (tryOpenCenter()) {
return;
}
setTimeout(() => {
if (!tryOpenCenter()) {
console.warn(
"[LatestCouponActivityPopup] uni-popup.open 不可用,popupRef=",
popupInstance(),
);
}
}, 280);
}, 80);
});
});
}
}
</script>
<style scoped lang="scss">
.latest-activity-popup-host {
position: relative;
z-index: 20000;
}
.latest-activity-popup-host :deep(.uni-popup) {
z-index: 20000 !important;
}
.latest-activity-card {
position: relative;
width: 300px;
max-width: 86vw;
padding: 24px 20px 20px;
box-sizing: border-box;
}
.latest-activity-close {
position: absolute;
right: 12px;
top: 12px;
z-index: 2;
padding: 4px;
}
.latest-activity-illust {
display: block;
width: 120px;
margin: 0px auto 0px;
}
.latest-activity-title {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
font-size: 20px;
font-weight: 600;
color: #323233;
line-height: 28px;
text-align: center;
margin-bottom: 12px;
}
.latest-activity-scroll {
max-height: 220px;
margin-bottom: 16px;
}
.latest-activity-body {
background: #f7f8fa;
border-radius: 8px;
padding: 12px;
}
.latest-activity-body-rich {
font-size: 13px;
color: #646566;
line-height: 20px;
white-space: normal !important;
word-wrap: break-word !important;
word-break: break-all !important;
width: 100% !important;
max-width: 100% !important;
}
.latest-activity-action {
margin-top: 4px;
}
</style>
...@@ -379,24 +379,8 @@ ...@@ -379,24 +379,8 @@
</van-dialog> </van-dialog>
</view> </view>
<uni-popup ref="latestActivityPopupRef" class="latest-activity-popup" type="center" background-color="#fff" <coupon-home-benefit-popup :show="showCouponBenefitPopup" :payload="couponBenefitPayload"
border-radius="16px" z-index="10001" :mask-click="true" @maskClick="closeLatestActivityPopup"> @close="onCouponBenefitPopupClose" />
<view v-if="latestActivityForPopup" class="latest-activity-card">
<view class="latest-activity-close" @click.stop="closeLatestActivityPopup">
<uni-icons type="closeempty" size="20" color="#999999" />
</view>
<image class="latest-activity-illust" :src="latestActivityIllustSrc" mode="widthFix" />
<view class="latest-activity-title">{{ latestActivityForPopup.activityName }}</view>
<scroll-view scroll-y class="latest-activity-scroll" :show-scrollbar="true">
<view class="latest-activity-body">
<rich-text class="latest-activity-body-rich"
:nodes="formatLatestActivityRichText(latestActivityForPopup.agreementContent)"></rich-text>
</view>
</scroll-view>
<van-button class="latest-activity-action" round block color="#FF5000"
@click="onLatestActivityParticipate">立即参拍</van-button>
</view>
</uni-popup>
</template> </template>
<script lang="ts"> <script lang="ts">
...@@ -413,14 +397,18 @@ import { FileInfo } from "lib/src/core/bean/FileInfo"; ...@@ -413,14 +397,18 @@ import { FileInfo } from "lib/src/core/bean/FileInfo";
import BidSuccessDialog from "@/module/auction/BidSuccessDialog.vue"; import BidSuccessDialog from "@/module/auction/BidSuccessDialog.vue";
import { AuctionOrderController } from "@/api/AuctionOrderController"; import { AuctionOrderController } from "@/api/AuctionOrderController";
import { FavoriteController } from "@/api/FavoriteController"; import { FavoriteController } from "@/api/FavoriteController";
import { couponImageUrl } from "@/common/couponImageUrl";
import { maskNumberStr } from "@/common/CommonUtils"; import { maskNumberStr } from "@/common/CommonUtils";
import { ConfigController } from "@/api/ConfigController"; import { ConfigController } from "@/api/ConfigController";
import { DarkBidPriceRange } from "lib/src/entity/business/domain/DarkBidPriceRange"; import { DarkBidPriceRange } from "lib/src/entity/business/domain/DarkBidPriceRange";
import { LightBidPriceRange } from "lib/src/entity/business/domain/LightBidPriceRange"; import { LightBidPriceRange } from "lib/src/entity/business/domain/LightBidPriceRange";
import { Recharge } from "lib/src/entity/finance/entity/Recharge"; import { Recharge } from "lib/src/entity/finance/entity/Recharge";
import { DepositController } from "@/api/DepositController"; import { DepositController } from "@/api/DepositController";
import { CouponController, parseLatestCouponActivityResponse } from "@/api/CouponController"; import {
CouponController,
parseCouponPopupResponse,
type ParsedCouponPopup,
} from "@/api/CouponController";
import CouponHomeBenefitPopup from "@/components/CouponHomeBenefitPopup.vue";
import roundBidBottom from "@/module/auction/roundBidBottom.vue"; import roundBidBottom from "@/module/auction/roundBidBottom.vue";
import RoundBidPopup from "@/components/RoundBidPopup.vue"; import RoundBidPopup from "@/components/RoundBidPopup.vue";
...@@ -428,7 +416,7 @@ import customNav from "@/module/auction/customNav.vue"; ...@@ -428,7 +416,7 @@ import customNav from "@/module/auction/customNav.vue";
import InspectionReport from "@/module/auction/InspectionReport.vue"; import InspectionReport from "@/module/auction/InspectionReport.vue";
@Component({ @Component({
components: { BidSuccessDialog, roundBidBottom, RoundBidPopup, customNav, InspectionReport } components: { BidSuccessDialog, roundBidBottom, RoundBidPopup, customNav, InspectionReport, CouponHomeBenefitPopup }
}) })
export default class AuctionVehiclePage extends Vue { export default class AuctionVehiclePage extends Vue {
...@@ -439,13 +427,11 @@ export default class AuctionVehiclePage extends Vue { ...@@ -439,13 +427,11 @@ export default class AuctionVehiclePage extends Vue {
@Ref() @Ref()
bidPopup: any; bidPopup: any;
@Ref() /** 待通知优惠券弹窗(GET coupon/popup) */
latestActivityPopupRef: any; showCouponBenefitPopup = false;
couponBenefitPayload: ParsedCouponPopup | null = null;
/** 最新优惠券活动弹窗(/latest-activity) */ /** 由参拍记录 BidPage 进入时不展示优惠券弹窗 */
latestActivityForPopup: { activityName: string; agreementContent: string } | null = null;
/** 由参拍记录 BidPage 进入时不展示最新活动弹窗 */
fromBidRecordEntry = false; fromBidRecordEntry = false;
currentImageIndex = 0; currentImageIndex = 0;
...@@ -530,9 +516,9 @@ export default class AuctionVehiclePage extends Vue { ...@@ -530,9 +516,9 @@ export default class AuctionVehiclePage extends Vue {
} }
/** /**
* 最新优惠券活动弹窗优先级低于中标引导、轮拍结束切车等阻断型自动弹层。 * 待通知优惠券弹窗优先级低于中标引导、轮拍结束切车等阻断型自动弹层。
*/ */
shouldOpenLatestCouponActivityOverlay(): boolean { shouldOpenCouponBenefitOverlay(): boolean {
if (this.showBidSuccessDialog) { if (this.showBidSuccessDialog) {
return false; return false;
} }
...@@ -543,59 +529,33 @@ export default class AuctionVehiclePage extends Vue { ...@@ -543,59 +529,33 @@ export default class AuctionVehiclePage extends Vue {
return true; return true;
} }
fetchLatestCouponActivity(): void { fetchCouponBenefitPopup(): void {
if (this.fromBidRecordEntry) { if (this.fromBidRecordEntry) {
return; return;
} }
CouponController.getLatestCouponActivity(this.axios) CouponController.getCouponPopup(this.axios)
.then((res) => { .then((res) => {
const activity = parseLatestCouponActivityResponse(res); const parsed = parseCouponPopupResponse(res);
if (!activity) { if (!parsed) {
return; return;
} }
this.latestActivityForPopup = { this.couponBenefitPayload = parsed;
activityName: activity.activityName,
agreementContent: activity.agreementContent,
};
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
if (!this.shouldOpenLatestCouponActivityOverlay()) { if (!this.shouldOpenCouponBenefitOverlay()) {
this.latestActivityForPopup = null; this.couponBenefitPayload = null;
return; return;
} }
this.latestActivityPopupRef?.open?.('center'); this.showCouponBenefitPopup = true;
}, 100); }, 100);
}); });
}) })
.catch(() => { }); .catch(() => { });
} }
closeLatestActivityPopup(): void { onCouponBenefitPopupClose(): void {
this.latestActivityPopupRef?.close?.(); this.showCouponBenefitPopup = false;
} this.couponBenefitPayload = null;
onLatestActivityParticipate(): void {
this.closeLatestActivityPopup();
uni.switchTab({ url: '/pages/tabbar/AuctionPage' });
}
/**
* 与 AgreementPage 一致:弱化编辑器内联样式,便于小程序 rich-text 排版
*/
formatLatestActivityRichText(html: string): string {
if (!html) {
return "";
}
let s = html;
s = s.replace(/class="mce-.*?"/g, "");
s = s.replace(/width:\s*\d+px;/g, "");
s = s.replace(/height:\s*\d+px;/g, "height: auto;");
s = s.replace(/<(\/)?pre[^>]*>/gi, "");
return s;
}
get latestActivityIllustSrc(): string {
return couponImageUrl("Promotion.png");
} }
get maskBidPrice(): string { get maskBidPrice(): string {
...@@ -689,7 +649,7 @@ export default class AuctionVehiclePage extends Vue { ...@@ -689,7 +649,7 @@ export default class AuctionVehiclePage extends Vue {
FavoriteController.getFavoriteCountByAucvehId(this.axios, this.aucvehId).then(res => { FavoriteController.getFavoriteCountByAucvehId(this.axios, this.aucvehId).then(res => {
this.favoriteCount = res.data; this.favoriteCount = res.data;
}); });
this.fetchLatestCouponActivity(); this.fetchCouponBenefitPopup();
}); });
onShow((option) => { onShow((option) => {
this.loadData(); this.loadData();
...@@ -1821,67 +1781,4 @@ export default class AuctionVehiclePage extends Vue { ...@@ -1821,67 +1781,4 @@ export default class AuctionVehiclePage extends Vue {
font-size: 20px; font-size: 20px;
} }
.latest-activity-card {
position: relative;
width: 300px;
max-width: 86vw;
padding: 24px 20px 20px;
box-sizing: border-box;
}
.latest-activity-close {
position: absolute;
right: 12px;
top: 12px;
z-index: 2;
padding: 4px;
}
.latest-activity-illust {
display: block;
width: 120px;
margin: 0px auto 0px;
}
.latest-activity-title {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
font-size: 20px;
font-weight: 600;
color: #323233;
line-height: 28px;
text-align: center;
margin-bottom: 12px;
// padding-right: 28px;
}
.latest-activity-scroll {
max-height: 220px;
margin-bottom: 16px;
}
.latest-activity-body {
background: #f7f8fa;
border-radius: 8px;
padding: 12px;
}
.latest-activity-body-rich {
font-size: 13px;
color: #646566;
line-height: 20px;
white-space: normal !important;
word-wrap: break-word !important;
word-break: break-all !important;
width: 100% !important;
max-width: 100% !important;
}
.latest-activity-action {
margin-top: 4px;
}
</style> </style>
...@@ -56,11 +56,13 @@ ...@@ -56,11 +56,13 @@
<view class="coupon-card__instruction-toggle" <view class="coupon-card__instruction-toggle"
@click.stop="toggleInstruction(item.couponId)"> @click.stop="toggleInstruction(item.couponId)">
<text class="coupon-card__instruction-label">使用说明</text> <text class="coupon-card__instruction-label">使用说明</text>
<view class="coupon-card__instruction-arrow-wrap">
<view class="coupon-card__instruction-arrow" <view class="coupon-card__instruction-arrow"
:class="{ 'coupon-card__instruction-arrow--up': isInstructionExpanded(item.couponId) }" /> :class="{ 'coupon-card__instruction-arrow--up': isInstructionExpanded(item.couponId) }" />
</view> </view>
</view> </view>
</view> </view>
</view>
<view v-if="item.status === 2 || item.status === 3" class="coupon-card__aside"> <view v-if="item.status === 2 || item.status === 3" class="coupon-card__aside">
<view class="coupon-card__stamp"> <view class="coupon-card__stamp">
<image class="coupon-card__stamp-img" :src="stampImageSrc(item.status)" <image class="coupon-card__stamp-img" :src="stampImageSrc(item.status)"
...@@ -71,25 +73,7 @@ ...@@ -71,25 +73,7 @@
<transition v-if="item.status === 1" name="coupon-expand"> <transition v-if="item.status === 1" name="coupon-expand">
<view v-if="isInstructionExpanded(item.couponId)" class="coupon-card__instruction"> <view v-if="isInstructionExpanded(item.couponId)" class="coupon-card__instruction">
<view class="coupon-card__instruction-block"> <text class="coupon-card__instruction-p">{{ item.description }}</text>
<text class="coupon-card__instruction-h">一、优惠券适用范围</text>
<text class="coupon-card__instruction-p">{{ item.instruction.scope }}</text>
</view>
<view class="coupon-card__instruction-block">
<text class="coupon-card__instruction-h">二、使用期限</text>
<text class="coupon-card__instruction-p">{{ item.instruction.validity }}</text>
</view>
<view v-if="item.instruction.rules.length > 0" class="coupon-card__instruction-block">
<text class="coupon-card__instruction-h">三、使用规则</text>
<view v-for="(line, idx) in item.instruction.rules" :key="idx"
class="coupon-card__instruction-rule">
<text class="coupon-card__instruction-p">{{ idx + 1 }}. {{ line }}</text>
</view>
</view>
<view class="coupon-card__instruction-block">
<text class="coupon-card__instruction-h">四、其他说明</text>
<text class="coupon-card__instruction-p">{{ item.instruction.other }}</text>
</view>
</view> </view>
</transition> </transition>
</view> </view>
...@@ -153,26 +137,9 @@ interface CouponCardVM { ...@@ -153,26 +137,9 @@ interface CouponCardVM {
timeDisplay?: string; timeDisplay?: string;
orderInfo?: { vehicleName: string; sourceNo: string }; orderInfo?: { vehicleName: string; sourceNo: string };
approachingExpiry?: boolean; approachingExpiry?: boolean;
instruction: { description: string;
scope: string;
validity: string;
rules: string[];
other: string;
};
} }
const DEFAULT_INSTRUCTION = {
scope: "本券仅适用于本店在售二手车(特殊标注除外),抵扣购车款,不适用检测、过户、保险等附加费用。",
validity: "自领取之日起30天有效,逾期失效,不补发、不延期。",
rules: [
"每张限用1次,不可叠加、拆分,不找零、不兑现;",
"付款时主动出示生效,付款后出示无效;",
"仅限个人购车,企业购车、置换不适用;",
"交易取消,已用优惠券作废。",
],
other: "1. 最终解释权归本店所有;",
};
function formatDateDot(iso?: string | null): string { function formatDateDot(iso?: string | null): string {
if (!iso) return "--"; if (!iso) return "--";
const d = dayjs(iso); const d = dayjs(iso);
...@@ -202,15 +169,6 @@ function computeApproachingExpiry(row: CouponAccountRespVO, status: CouponTabSta ...@@ -202,15 +169,6 @@ function computeApproachingExpiry(row: CouponAccountRespVO, status: CouponTabSta
return daysLeft >= 0 && daysLeft <= 3; return daysLeft >= 0 && daysLeft <= 3;
} }
function buildInstruction(_row: CouponAccountRespVO): CouponCardVM["instruction"] {
return {
scope: DEFAULT_INSTRUCTION.scope,
validity: DEFAULT_INSTRUCTION.validity,
rules: [...DEFAULT_INSTRUCTION.rules],
other: DEFAULT_INSTRUCTION.other,
};
}
function mapApiToCardVM(row: CouponAccountRespVO): CouponCardVM { function mapApiToCardVM(row: CouponAccountRespVO): CouponCardVM {
const status = normalizeStatus(row.status); const status = normalizeStatus(row.status);
const timeDisplay = const timeDisplay =
...@@ -225,7 +183,7 @@ function mapApiToCardVM(row: CouponAccountRespVO): CouponCardVM { ...@@ -225,7 +183,7 @@ function mapApiToCardVM(row: CouponAccountRespVO): CouponCardVM {
timeDisplay, timeDisplay,
orderInfo: row.orderInfo, orderInfo: row.orderInfo,
approachingExpiry: computeApproachingExpiry(row, status), approachingExpiry: computeApproachingExpiry(row, status),
instruction: buildInstruction(row), description: row.description || "",
}; };
} }
...@@ -631,6 +589,7 @@ export default class CouponPage extends Vue { ...@@ -631,6 +589,7 @@ export default class CouponPage extends Vue {
gap: 6px; gap: 6px;
flex-shrink: 0; flex-shrink: 0;
flex-wrap: nowrap; flex-wrap: nowrap;
overflow: visible;
} }
.coupon-card__meta-left { .coupon-card__meta-left {
...@@ -674,6 +633,7 @@ export default class CouponPage extends Vue { ...@@ -674,6 +633,7 @@ export default class CouponPage extends Vue {
gap: 4px; gap: 4px;
flex-shrink: 0; flex-shrink: 0;
white-space: nowrap; white-space: nowrap;
overflow: visible;
} }
.coupon-card__instruction-label { .coupon-card__instruction-label {
...@@ -681,24 +641,31 @@ export default class CouponPage extends Vue { ...@@ -681,24 +641,31 @@ export default class CouponPage extends Vue {
color: #969799; color: #969799;
} }
.coupon-card__instruction-arrow-wrap {
width: 18px;
height: 18px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
overflow: visible;
}
/* 细线 V 形箭头:收起朝下,展开朝上 */ /* 细线 V 形箭头:收起朝下,展开朝上 */
.coupon-card__instruction-arrow { .coupon-card__instruction-arrow {
width: 5px; width: 7px;
height: 5px; height: 7px;
border-style: solid; border-style: solid;
border-color: #969799; border-color: #969799;
border-width: 0 1.5px 1.5px 0; border-width: 0 2px 2px 0;
transform: rotate(45deg); transform: rotate(45deg);
margin-left: 2px;
margin-top: -1px;
flex-shrink: 0; flex-shrink: 0;
box-sizing: border-box; box-sizing: border-box;
transition: transform 0.2s ease, margin-top 0.2s ease; transition: transform 0.2s ease;
} }
.coupon-card__instruction-arrow--up { .coupon-card__instruction-arrow--up {
transform: rotate(-135deg); transform: rotate(-135deg);
margin-top: 2px;
} }
.coupon-card__aside { .coupon-card__aside {
...@@ -755,31 +722,13 @@ export default class CouponPage extends Vue { ...@@ -755,31 +722,13 @@ export default class CouponPage extends Vue {
opacity: 1; opacity: 1;
} }
.coupon-card__instruction-block {
margin-bottom: 6px;
}
.coupon-card__instruction-block:last-child {
margin-bottom: 0;
}
.coupon-card__instruction-h {
display: block;
font-size: 13px;
font-weight: 600;
color: #323233;
margin-bottom: 6px;
}
.coupon-card__instruction-p { .coupon-card__instruction-p {
display: block; display: block;
font-size: 12px; font-size: 12px;
color: #646566; color: #646566;
line-height: 1.55; line-height: 1.55;
} white-space: pre-wrap;
word-break: break-word;
.coupon-card__instruction-rule {
margin-bottom: 6px;
} }
.coupon-empty { .coupon-empty {
......
...@@ -102,10 +102,10 @@ ...@@ -102,10 +102,10 @@
<certification-dialog @close="onCertifyDialogClosed"></certification-dialog> <certification-dialog @close="onCertifyDialogClosed"></certification-dialog>
</van-dialog> </van-dialog>
<coupon-home-benefit-popup :show="showCouponBenefitPopup" :payload="couponBenefitPayload" <latest-coupon-activity-popup :show="showLatestActivityPopup" :activity="latestActivityForPopup"
@close="onCouponBenefitPopupClose" /> @close="onLatestActivityPopupClose" />
<!-- 完善收车偏好弹窗:由首页在认证与待通知权益流程结束后触发 --> <!-- 完善收车偏好弹窗:由首页在认证与最新活动弹窗流程结束后触发 -->
<improve-popup ref="improvePopupRef" :parent-controlled="true" /> <improve-popup ref="improvePopupRef" :parent-controlled="true" />
</view> </view>
</template> </template>
...@@ -127,18 +127,17 @@ import CertificationDialog from "./home/CertificationDialog.vue"; ...@@ -127,18 +127,17 @@ import CertificationDialog from "./home/CertificationDialog.vue";
import { BurialPoint } from "@/common/BurialPoint"; import { BurialPoint } from "@/common/BurialPoint";
import { import {
CouponController, CouponController,
parseCouponPopupResponse, parseLatestCouponActivityResponse,
type ParsedCouponPopup,
} from "@/api/CouponController"; } from "@/api/CouponController";
import { ConfigController } from "@/api/ConfigController"; import { ConfigController } from "@/api/ConfigController";
import { BusinessConfig } from "lib/src/entity/business/domain/BusinessConfig"; import { BusinessConfig } from "lib/src/entity/business/domain/BusinessConfig";
import { FileInfo } from "lib/src/core/bean/FileInfo"; import { FileInfo } from "lib/src/core/bean/FileInfo";
import ImprovePopup from "@/components/ImprovePopup.vue"; import ImprovePopup from "@/components/ImprovePopup.vue";
import CouponHomeBenefitPopup from "@/components/CouponHomeBenefitPopup.vue"; import LatestCouponActivityPopup from "@/components/LatestCouponActivityPopup.vue";
@Component({ @Component({
components: { CertificationDialog, BidSuccessDialog, CustomNavBar, LikeAuctionVehicles, RecommendAuctionVehicles, ImprovePopup, CouponHomeBenefitPopup } components: { CertificationDialog, BidSuccessDialog, CustomNavBar, LikeAuctionVehicles, RecommendAuctionVehicles, ImprovePopup, LatestCouponActivityPopup }
}) })
export default class HomePage extends Vue { export default class HomePage extends Vue {
...@@ -156,9 +155,9 @@ export default class HomePage extends Vue { ...@@ -156,9 +155,9 @@ export default class HomePage extends Vue {
showCertifyDialog = false; showCertifyDialog = false;
/** P2:首页权益弹窗(声明式,与认证 van-dialog 一致) */ /** P2:首页最新活动弹窗(声明式,与认证 van-dialog 一致) */
showCouponBenefitPopup = false; showLatestActivityPopup = false;
couponBenefitPayload: ParsedCouponPopup | null = null; latestActivityForPopup: { activityName: string; agreementContent: string } | null = null;
/** 认证弹窗延迟定时器(避免重复 onShow 叠加多个定时器) */ /** 认证弹窗延迟定时器(避免重复 onShow 叠加多个定时器) */
certifyDelayTimer: ReturnType<typeof setTimeout> | null = null; certifyDelayTimer: ReturnType<typeof setTimeout> | null = null;
...@@ -225,7 +224,7 @@ export default class HomePage extends Vue { ...@@ -225,7 +224,7 @@ export default class HomePage extends Vue {
this.businessConfig = res.data; this.businessConfig = res.data;
}); });
}); });
// 每次都加载 — P1 认证 → P2 待通知权益 → P3 收车偏好 // 每次都加载 — P1 认证 → P2 最新活动 → P3 收车偏好
onShow((option) => { onShow((option) => {
this.runHomeEntrancePopupSequence(); this.runHomeEntrancePopupSequence();
}); });
...@@ -321,7 +320,7 @@ export default class HomePage extends Vue { ...@@ -321,7 +320,7 @@ export default class HomePage extends Vue {
/** /**
* P1:COMMON 且未处于认证中 → 延迟展示认证引导。 * P1:COMMON 且未处于认证中 → 延迟展示认证引导。
* 否则直接进入 P2/P3 链路。(勿在 P1 展示前请求 coupon/popup:服务端 GET 即批量已触达) * 否则直接进入 P2/P3 链路。
*/ */
runHomeEntrancePopupSequence(): void { runHomeEntrancePopupSequence(): void {
const authService: AuthService = this.$auth; const authService: AuthService = this.$auth;
...@@ -353,9 +352,9 @@ export default class HomePage extends Vue { ...@@ -353,9 +352,9 @@ export default class HomePage extends Vue {
void this.continuePopupSequenceAfterP1(); void this.continuePopupSequenceAfterP1();
} }
onCouponBenefitPopupClose(): void { onLatestActivityPopupClose(): void {
this.showCouponBenefitPopup = false; this.showLatestActivityPopup = false;
this.couponBenefitPayload = null; this.latestActivityForPopup = null;
this.triggerImprovePreferencePopup(); this.triggerImprovePreferencePopup();
} }
...@@ -368,21 +367,24 @@ export default class HomePage extends Vue { ...@@ -368,21 +367,24 @@ export default class HomePage extends Vue {
improveRef?.tryOpenPreferencePopup?.(); improveRef?.tryOpenPreferencePopup?.();
} }
/** P2 待通知权益 → P3 收车偏好 */ /** P2 最新活动弹窗 → P3 收车偏好 */
async continuePopupSequenceAfterP1(): Promise<void> { async continuePopupSequenceAfterP1(): Promise<void> {
let parsed = null; let activity = null;
try { try {
const res = await CouponController.getCouponPopup(this.axios); const res = await CouponController.getLatestCouponActivity(this.axios);
parsed = parseCouponPopupResponse(res); activity = parseLatestCouponActivityResponse(res);
} catch (e) { } catch (e) {
console.error('[coupon/popup] request failed', e); console.error('[coupon/latest-activity] request failed', e);
parsed = null; activity = null;
} }
if (parsed) { if (activity) {
this.couponBenefitPayload = parsed; this.latestActivityForPopup = {
activityName: activity.activityName,
agreementContent: activity.agreementContent,
};
await new Promise<void>((resolve) => this.$nextTick(() => resolve())); await new Promise<void>((resolve) => this.$nextTick(() => resolve()));
this.showCouponBenefitPopup = true; this.showLatestActivityPopup = true;
return; return;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!