Commit f8d9f636 by 张立顺

fix bug

1 parent 269c5020
......@@ -12,11 +12,11 @@ PUBLISH_PATH = '/'
# VITE_APP_API_URL = 'https://aus.glsx.com.cn/app/api/'
# VITE_APP_API_BASE_URL = 'https://aus.glsx.com.cn/app/'
# VITE_APP_API_URL = 'https://aus.test.glsx.com.cn/app/api/'
# VITE_APP_API_BASE_URL = 'https://aus.test.glsx.com.cn/app/'
VITE_APP_API_URL = 'https://aus.test.glsx.com.cn/app/api/'
VITE_APP_API_BASE_URL = 'https://aus.test.glsx.com.cn/app/'
VITE_APP_API_URL = 'http://192.168.1.125:6901/api/'
VITE_APP_API_BASE_URL = 'http://192.168.1.125:6901/'
# VITE_APP_API_URL = 'http://192.168.1.125:6901/api/'
# VITE_APP_API_BASE_URL = 'http://192.168.1.125:6901/'
# 优惠券相关 CDN 图:`{BASE}/{文件名}`,与 dj-aus 小程序资源路径对齐
VITE_APP_COUPON_IMAGE_BASE_URL=https://img01.glsx.com.cn/weapp/resource/dj-aus/images/coupon
......
......@@ -83,9 +83,14 @@ const MOCK_COUPON_POPUP_HTTP_BODY: CouponPopupApiEnvelope = {
message: "操作成功",
};
/**
* 首页 `GET coupon/popup`:为 true 时使用本文件 `MOCK_COUPON_POPUP_HTTP_BODY`,不发请求;
* 为 false(默认)时走真实 `axios.get('coupon/popup')`。
*/
const COUPON_POPUP_HTTP_MOCK_ENABLED = false;
function couponPopupUsesHttpMock(): boolean {
const v = import.meta.env.VITE_MOCK_COUPON_POPUP;
return v === "true" || v === "1";
return COUPON_POPUP_HTTP_MOCK_ENABLED;
}
/** GET coupon/order-coupons/{orderId}:`mockOrderCouponsEnvelope.json`(仅开发构建,见 `orderCouponsDevMock.ts`) */
......
......@@ -29,49 +29,54 @@ function workOrderKeys(orderId: number): EventTrackingBusinessKeyVO[] {
return [{ businessType: "WORK_ORDER", businessKey: String(orderId) }];
}
/** 首页权益弹窗主按钮(我知道了 / 一键收下) */
/** 与 GET coupon/popup 的 `popupType` 一致;上报为 NUMBER */
function couponPopupTypeNumber(popupType: number): number {
if (typeof popupType === "number" && Number.isFinite(popupType)) {
return popupType;
}
const n = Number(popupType);
return Number.isFinite(n) ? n : 0;
}
/**
* 首页弹窗:`popup_type`(NUMBER);`coupon_id`(STRING) 仅一条,多券用英文逗号拼接。
*/
function couponPopupCommonParams(
popupType: number,
couponIds: readonly string[]
): EventTrackingParamVO[] {
const pt = couponPopupTypeNumber(popupType);
const ids = [...couponIds].map((id) => (id ?? "").trim()).filter((id) => id.length > 0);
return [
strParam("popup_type", pt, "NUMBER"),
strParam("coupon_id", ids.length > 0 ? ids.join(",") : "", "STRING"),
];
}
/** 首页权益弹窗主按钮(文档 Coupon_Popup_Click) */
export function trackCouponPopupClick(
axios: AxiosStatic,
popupType: "transfer" | "distribute",
couponIdsJoined: string
popupType: number,
couponIds: readonly string[]
): void {
voidBatch(axios, [
{
eventCode: "coupon_popup_click",
params: [
strParam("popup_type", popupType),
strParam("coupon_id", couponIdsJoined),
],
params: couponPopupCommonParams(popupType, couponIds),
},
]);
}
/** 蒙层关闭 / 关闭按钮关闭弹窗(非主按钮) */
/** 蒙层 / 右上角关闭;文档 Coupon_Popup_Close → `eventCode` 小写下划线;参数与 click 一致 */
export function trackCouponPopupClose(
axios: AxiosStatic,
popupType: "transfer" | "distribute"
popupType: number,
couponIds: readonly string[]
): void {
voidBatch(axios, [
{
eventCode: "coupon_popup_close",
params: [strParam("popup_type", popupType)],
},
]);
}
/** 弹窗曝光(替代原 SCRM Coupon_Popup_Show,口径统一到新接口) */
export function trackCouponPopupShow(
axios: AxiosStatic,
popupType: "transfer" | "distribute",
couponIdsJoined: string
): void {
voidBatch(axios, [
{
eventCode: "coupon_popup_show",
params: [
strParam("popup_type", popupType),
strParam("coupon_id", couponIdsJoined),
],
params: couponPopupCommonParams(popupType, couponIds),
},
]);
}
......
......@@ -12,6 +12,10 @@ export default {
formatNumber(value: number, fractionDigits = 2): string {
return value.toFixed(fractionDigits);
},
/** 优惠券面额/抵扣展示:固定两位小数,与订单合同选券等保持一致 */
formatCouponMoney(value: number): string {
return value.toFixed(2);
},
formatCities(cityCodes: string[]): string[] {
const cityList = areaList.city_list;
const provinceList = areaList.province_list;
......
......@@ -62,7 +62,6 @@ import type { CouponPopupItem, ParsedCouponPopup } from "@/api/CouponController"
import {
trackCouponPopupClick,
trackCouponPopupClose,
trackCouponPopupShow,
} from "@/common/eventTracking";
import { couponImageUrl } from "@/common/couponImageUrl";
......@@ -204,10 +203,11 @@ export default class CouponHomeBenefitPopup extends Vue {
if (!Number.isFinite(x)) {
return "0";
}
if (x % 1 === 0) {
return Math.round(x).toLocaleString("zh-CN");
}
return x.toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
return x.toLocaleString("zh-CN", {
useGrouping: true,
minimumFractionDigits: 0,
maximumFractionDigits: 2,
});
}
formatValidEndDate(raw: string): string {
......@@ -259,31 +259,29 @@ export default class CouponHomeBenefitPopup extends Vue {
return "activity";
}
private analyticsPopupType(): "transfer" | "distribute" {
return this.payload?.popupType === 1 ? "transfer" : "distribute";
/** 埋点 `popup_type`:直接使用接口下发的 `popupType` */
private analyticsPopupTypeField(): number {
const pt = this.payload?.popupType;
if (typeof pt === "number" && Number.isFinite(pt)) {
return pt;
}
const n = Number(pt);
return Number.isFinite(n) ? n : 0;
}
private analyticsCouponIdsJoined(): string {
/** 埋点:弹窗内所有券实例 ID(顺序与 couponList 一致) */
private analyticsCouponIds(): string[] {
return (this.payload?.couponList ?? [])
.map((c) => c.couponId)
.filter(Boolean)
.join(",");
.map((c) => (c.couponId ?? "").trim())
.filter(Boolean);
}
private dismissPopupShell(): void {
this.popupRef?.close?.("center");
}
/** 父级 show=true 且带有 payload 时打开 uni-popup(曝光埋点 + 重试 open) */
/** 父级 show=true 且带有 payload 时打开 uni-popup(重试 open) */
private presentWhenShown(): void {
const p = this.payload;
if (p != null) {
trackCouponPopupShow(
this.axios as AxiosStatic,
this.analyticsPopupType(),
this.analyticsCouponIdsJoined(),
);
}
this.scheduleUniPopupOpen();
}
......@@ -294,7 +292,8 @@ export default class CouponHomeBenefitPopup extends Vue {
}
trackCouponPopupClose(
this.axios as AxiosStatic,
this.analyticsPopupType(),
this.analyticsPopupTypeField(),
this.analyticsCouponIds(),
);
this.$emit("close");
}
......@@ -306,7 +305,8 @@ export default class CouponHomeBenefitPopup extends Vue {
}
trackCouponPopupClose(
this.axios as AxiosStatic,
this.analyticsPopupType(),
this.analyticsPopupTypeField(),
this.analyticsCouponIds(),
);
this.popupRef?.close?.("center");
this.$emit("close");
......@@ -353,14 +353,15 @@ export default class CouponHomeBenefitPopup extends Vue {
});
}
/** 文档 Coupon_Popup_Click → `coupon_popup_click`;用户点主按钮(我知道了 / 一键收下) */
onConfirm(): void {
if (!this.payload) {
return;
}
trackCouponPopupClick(
this.axios as AxiosStatic,
this.analyticsPopupType(),
this.analyticsCouponIdsJoined(),
this.analyticsPopupTypeField(),
this.analyticsCouponIds(),
);
this.popupRef?.close("center");
this.$emit("close");
......@@ -417,7 +418,7 @@ export default class CouponHomeBenefitPopup extends Vue {
.benefit-title {
display: block;
text-align: center;
font-size: 19px;
font-size: 26px;
font-weight: 600;
color: #000;
margin-bottom: 8px;
......@@ -454,7 +455,8 @@ export default class CouponHomeBenefitPopup extends Vue {
}
.coupon-ticket__amt {
min-width: 100px;
width: 76px;
height: 76px;
flex-shrink: 0;
background: #fff0f0;
display: flex;
......@@ -470,6 +472,7 @@ export default class CouponHomeBenefitPopup extends Vue {
}
.coupon-ticket__y {
font-family: "numberNor", sans-serif;
font-size: 20px;
font-weight: 700;
color: #ff5500;
......@@ -477,6 +480,7 @@ export default class CouponHomeBenefitPopup extends Vue {
}
.coupon-ticket__num {
font-family: "numberNor", sans-serif;
font-size: 20px;
font-weight: 700;
color: #ff5500;
......
......@@ -6,23 +6,23 @@ interface ImportMetaEnv {
readonly VITE_APP_EVENT_TRACKING_PATH?: string;
}
declare module '*.vue' {
import {DefineComponent} from 'vue'
declare module "*.vue" {
import { DefineComponent } from "vue";
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
const component: DefineComponent<{}, {}, any>;
export default component;
}
/**
* 自定义类型申明
*/
declare module '@vue/runtime-core' {
declare module "@vue/runtime-core" {
interface ComponentCustomProperties {
$filters: any,
$auth: AuthService,
$apiUrl: string,
$store: Store<any>,
$goBack: () => void,
axios: any,
$filters: any;
$auth: AuthService;
$apiUrl: string;
$store: Store<any>;
$goBack: () => void;
axios: any;
}
}
@import "./styles/number-nor-font.scss";
$grey: #F5F5F5;
$theme-color: #1890FF;
......
......@@ -140,7 +140,7 @@
<view class="param-item">
<text class="param-value"> {{ this.i18n('usageType', this.vehicle.ownership.usageType)
}}</text>
}}</text>
<text class="param-label">使用性质</text>
</view>
<view class="param-item">
......@@ -271,7 +271,7 @@
<text class="balance-title">{{ auctionVehicle.auction.auctionType === 'LIGHT' ? '明拍进行中' :
'暗拍进行中'
}}</text>
}}</text>
</view>
<view class="section-card auction-card">
<text class="section-title">拍卖信息</text>
......@@ -297,7 +297,7 @@
<view v-if="auctionVehicle.auction.auctionType === 'LIGHT'">
<text class="price-color-current">¥{{ $filters.formatNumber(auctionVehicle.highestPrice
/ 10000)
}}</text>
}}</text>
<text class="price-unit">万元</text>
</view>
<text class="price-color-current"
......@@ -1850,10 +1850,11 @@ export default class AuctionVehiclePage extends Vue {
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
font-size: 17px;
font-size: 20px;
font-weight: 600;
color: #323233;
line-height: 24px;
line-height: 28px;
text-align: center;
margin-bottom: 12px;
// padding-right: 28px;
}
......
......@@ -61,11 +61,10 @@
</view>
</view>
</view>
<view v-if="item.status !== 1" 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-line" />
<text class="coupon-card__stamp-text">{{ stampLabel(item.status) }}</text>
<view class="coupon-card__stamp-line" />
<image class="coupon-card__stamp-img" :src="stampImageSrc(item.status)"
mode="aspectFit" />
</view>
</view>
</view>
......@@ -128,6 +127,7 @@ import {
} from "@/api/CouponController";
import type { AxiosStatic } from "axios";
import { trackCouponRuleClick } from "@/common/eventTracking";
import { couponImageUrl } from "@/common/couponImageUrl";
type CouponTabKey = "unused" | "verified" | "expired";
......@@ -139,7 +139,7 @@ interface CouponTabSlice {
loadingMore: boolean;
}
/** 与 CouponAccountRespVO.status 一致:1 待使用 / 2 已核销 / 3 已失效 / 4 已退回 */
/** 与 CouponAccountRespVO.status 一致:1 待使用 / 2 已核销 / 3 已失效 / 4 已退回;列表侧栏印章图仅 2、3 */
type CouponTabStatus = 1 | 2 | 3 | 4;
/** 列表卡片视图模型(由 CouponAccountRespVO 映射) */
......@@ -336,10 +336,10 @@ export default class CouponPage extends Vue {
return "coupon-card--expired";
}
stampLabel(status: CouponTabStatus): string {
if (status === 2) return "已核销";
if (status === 4) return "已退回";
return "已过期";
stampImageSrc(status: CouponTabStatus): string {
if (status === 2) return couponImageUrl("Redeemed.png");
if (status === 3) return couponImageUrl("Expired.png");
return "";
}
deductionTypeLabel(deductionType: number): string {
......@@ -348,8 +348,8 @@ export default class CouponPage extends Vue {
}
formatFaceAmount(amount: number): string {
const f = this.$filters?.formatNumber;
if (typeof f === "function") return f(amount, 0);
const f = this.$filters?.formatCouponMoney;
if (typeof f === "function") return f(amount);
return String(amount);
}
......@@ -514,6 +514,7 @@ export default class CouponPage extends Vue {
}
.coupon-card__currency {
font-family: "numberNor", sans-serif;
font-size: 14px;
font-weight: 600;
margin-right: 2px;
......@@ -532,6 +533,7 @@ export default class CouponPage extends Vue {
}
.coupon-card__amount-num {
font-family: "numberNor", sans-serif;
font-size: 22px;
font-weight: 700;
line-height: 1;
......@@ -710,32 +712,18 @@ export default class CouponPage extends Vue {
.coupon-card__stamp {
width: 56px;
height: 56px;
border-radius: 50%;
border: 2px solid #c8c9cc;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transform: rotate(-14deg);
box-sizing: border-box;
}
.coupon-card__stamp-line {
width: 28px;
height: 1px;
background: #c8c9cc;
.coupon-card__stamp-img {
width: 56px;
height: 56px;
flex-shrink: 0;
}
.coupon-card__stamp-text {
font-size: 10px;
color: #969799;
font-weight: 600;
padding: 4px 0;
line-height: 1.2;
text-align: center;
}
.coupon-card__instruction {
border-top: 1px solid #e7ebf4;
padding: 6px;
......
......@@ -57,7 +57,7 @@
class="coupon-row-value coupon-row-value--muted">处理中…</text>
<template v-else>
<text class="coupon-row-value" :class="couponRowValueClass">{{ couponRowRightText
}}</text>
}}</text>
<text v-if="couponRowShowUseBtn" class="coupon-row-use-btn"
@click.stop="onOpenCouponVerifyDialog">立即使用</text>
</template>
......@@ -113,7 +113,7 @@
<view class="contract-coupon-card__amount-row">
<text class="contract-coupon-card__currency">¥</text>
<text class="contract-coupon-card__face">{{ formatCouponAmount(item.faceAmount)
}}</text>
}}</text>
</view>
<text class="contract-coupon-card__cap">最高抵扣¥{{
formatCouponAmount(item.actualDeduction) }}</text>
......@@ -127,7 +127,7 @@
:class="item.deductionType === 2 ? 'contract-coupon-card__tag--commission' : 'contract-coupon-card__tag--car'">
{{ deductionTypeLabel(item.deductionType) }}</view>
<text class="contract-coupon-card__period">有效期至{{ formatValidEnd(item.validEndTime)
}}</text>
}}</text>
</view>
<view class="contract-coupon-card__radio">
<view class="coupon-radio coupon-radio--lg"
......@@ -150,7 +150,7 @@
<view class="contract-coupon-card__amount-row">
<text class="contract-coupon-card__currency">¥</text>
<text class="contract-coupon-card__face">{{ formatCouponAmount(u.faceAmount)
}}</text>
}}</text>
</view>
<text class="contract-coupon-card__cap">最高抵扣¥{{
formatCouponAmount(u.actualDeduction) }}</text>
......@@ -162,11 +162,11 @@
:class="u.deductionType === 2 ? 'contract-coupon-card__tag--commission' : 'contract-coupon-card__tag--car'">
{{ deductionTypeLabel(u.deductionType) }}</view>
<text class="contract-coupon-card__period">有效期至{{ formatValidEnd(u.validEndTime)
}}</text>
}}</text>
</view>
<view class="contract-coupon-card__stamp">
<text class="contract-coupon-card__stamp-txt">{{ u.unavailableReason || '不可用'
}}</text>
}}</text>
</view>
</view>
</view>
......@@ -181,7 +181,7 @@
z-index="10002">
<view class="coupon-verify-dialog">
<image class="coupon-verify-dialog__illu" :src="couponVerifyDialogIlluSrc" mode="widthFix" />
<!-- <text class="coupon-verify-dialog__title">确认核销优惠券吗</text> -->
<text class="coupon-verify-dialog__title">确认核销优惠券吗</text>
<view class="coupon-verify-dialog__btn coupon-verify-dialog__btn--outline"
:class="{ 'coupon-verify-dialog__btn--disabled': couponVerifyLoading }"
@click="onCouponVerifyDismiss">
......@@ -192,7 +192,7 @@
@click="onCouponVerifyConfirm">
<text class="coupon-verify-dialog__btn-txt coupon-verify-dialog__btn-txt--inv">{{
couponVerifyLoading ? "核销中…" : "确认核销"
}}</text>
}}</text>
</view>
</view>
</uni-popup>
......@@ -530,8 +530,8 @@ export default class ContractPage extends Vue {
}
formatCouponAmount(n: number): string {
const f = (this as unknown as { $filters?: { formatNumber?: (v: number, d?: number) => string } }).$filters
?.formatNumber;
const f = (this as unknown as { $filters?: { formatCouponMoney?: (v: number) => string } }).$filters
?.formatCouponMoney;
if (typeof f === "function") return f(n);
return String(n);
}
......@@ -547,7 +547,7 @@ export default class ContractPage extends Vue {
return "抵扣车款";
}
/** 核销接口业务成功:`order_pay_submit_click`(立即使用链路) */
/** `order_pay_submit_click`:仅「立即使用」确认后核销成功上报(须在调用 coupon/verify 成功回调内);「查看购车合同」核销不上报 */
private emitOrderPaySubmitOnVerifySuccess(
couponId: string,
actualDeductionRaw: unknown
......@@ -802,10 +802,6 @@ export default class ContractPage extends Vue {
});
return;
}
this.emitOrderPaySubmitOnVerifySuccess(
couponId,
parsed.data?.actualDeduction
);
if (
parsed.data?.actualDeduction != null &&
parsed.data.actualDeduction >= 0
......@@ -1201,14 +1197,31 @@ export default class ContractPage extends Vue {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 4px;
margin-bottom: 8px;
border-bottom: 1px solid #f2f3f5;
padding: 14px 16px;
margin-bottom: 12px;
box-sizing: border-box;
background-color: #fff;
border: 1px solid #ebedf0;
border-radius: 10px;
}
.coupon-sheet__no-use-txt {
font-size: 15px;
color: #323233;
line-height: 22px;
}
/* 稿:细灰描边空心圆;与下方券卡大号勾选样式区分 */
.coupon-sheet__no-use .coupon-radio {
width: 20px;
height: 20px;
border: 1px solid #dcdee0;
background-color: #fff;
}
.coupon-sheet__no-use .coupon-radio--on {
border: 1px solid #ff6010;
background-color: #ff6010;
}
.coupon-radio {
......@@ -1293,12 +1306,14 @@ export default class ContractPage extends Vue {
}
.contract-coupon-card__currency {
font-family: "numberNor", sans-serif;
font-size: 22px;
color: #ff6010;
font-weight: 700;
}
.contract-coupon-card__face {
font-family: "numberNor", sans-serif;
font-size: 22px;
font-weight: 700;
color: #ff6010;
......
@font-face {
font-family: "numberNor";
src: url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-500-Medium.ttf");
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!