Commit acb928cd by 张立顺

feat 功能开发

1 parent e41a2426
......@@ -12,10 +12,16 @@ 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
# 首页 GET coupon/popup:true 时不发请求,使用 CouponController 内联 MOCK;联调用真实接口时请设为 false
VITE_MOCK_COUPON_POPUP=false
VITE_APP_TOKEN= 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJnb25nbGVpIiwiaXNzIjoiZG9jd2lzZXJBcHAiLCJtb2JpbGUiOiIxODgyMjg4NTUxOCIsImV4cCI6MTgzMjUwMDcxOSwiaWF0IjoxNzYwNTAwNzE5LCJqdGkiOiIxIn0.8AR4Q8YG65yzBL2LfFUecMiTuWIbkJF4wIctHZhnUdQ'
......@@ -15,5 +15,7 @@ PUBLISH_PATH = '/'
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_COUPON_IMAGE_BASE_URL=https://img01.glsx.com.cn/weapp/resource/dj-aus/images/coupon
VITE_APP_TOKEN= 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmYWN0b3JJZCI6MSwic3ViIjoiYWRtaW5pc3RyYXRvciIsInJlYWxOYW1lIjoi6LaF57qn566h55CG5ZGYIiwicGFzc3dvcmQiOiIkMmEkMTAkaFR0QkdSOTAxZ1A2SzQ5Ti9RNWFNT2oyQjE3cDVYZjRmeXliZTJ6ckpjdEJjWklMbUEwZEciLCJpc3MiOiJ5eHR3ZWIiLCJhdmF0YXIiOiJ1c2VySW5mby8yMDIzMDcxOC9OMUYxNGJ5NmRPLmpwZyIsImV4cCI6MTc2ODkyNzY3NywiaWF0IjoxNjk2OTI3Njc3LCJqdGkiOiIxIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9TVVBFUiIsIkFETUlOIl19.3SYoNceGBTubVsikOb7aFpm5medHG-AUpVgcBdb2ao8'
import type { AxiosStatic } from "axios";
/** 扩展参数:`paramValue` 以 JSON 可序列化形式提交 */
export type EventTrackingParamType =
| "STRING"
| "NUMBER"
| "BOOLEAN"
| "ARRAY"
| "OBJECT";
export interface EventTrackingBusinessKeyVO {
businessType: string;
businessKey: string;
}
export interface EventTrackingParamVO {
paramKey: string;
paramValue: string | number | boolean | null;
paramType?: EventTrackingParamType;
}
export interface EventTrackingBatchItem {
eventCode: string;
eventTime?: string;
duration?: number;
remark?: string;
businessKeys?: EventTrackingBusinessKeyVO[];
params?: EventTrackingParamVO[];
}
export interface EventTrackingBatchSaveBody {
events: EventTrackingBatchItem[];
}
function defaultBatchSavePath(): string {
const p = import.meta.env.VITE_APP_EVENT_TRACKING_PATH;
return (typeof p === "string" && p.trim().length > 0
? p.trim()
: "eventTracking/batchSave") as string;
}
/**
* POST 业务埋点批量上报(与其它 Controller 一致走全局 axios / Token)
*/
export class EventTrackingController {
static batchSave(
axios: AxiosStatic,
body: EventTrackingBatchSaveBody,
path?: string
): Promise<unknown> {
return axios
.post(path ?? defaultBatchSavePath(), body)
.then((r) => r.data);
}
}
{
"code": "200",
"success": true,
"message": "操作成功",
"data": [
{
"couponId": "CPN202605080004939",
"templateName": "自测阶梯满减",
"couponType": 2,
"deductionType": 1,
"faceAmount": 30,
"actualDeduction": 30,
"validStartTime": "2026-05-09 17:12:07",
"validEndTime": "2026-05-29 17:12:07",
"receiveTime": "2026-05-08 17:12:07",
"available": true,
"recommended": true
},
{
"couponId": "CPN202605080004937",
"templateName": "固定时间20元·抵扣佣金",
"couponType": 1,
"deductionType": 2,
"faceAmount": 20,
"thresholdAmount": 0,
"actualDeduction": 20,
"validStartTime": "2026-05-08 00:00:00",
"validEndTime": "2026-05-17 23:59:59",
"receiveTime": "2026-05-08 17:11:12",
"available": true,
"recommended": false
},
{
"couponId": "CPN202605080004942",
"templateName": "固定时间20元·抵扣车款",
"couponType": 1,
"deductionType": 1,
"faceAmount": 20,
"thresholdAmount": 0,
"actualDeduction": 20,
"validStartTime": "2026-05-08 00:00:00",
"validEndTime": "2026-05-17 23:59:59",
"receiveTime": "2026-05-08 17:43:26",
"available": true,
"recommended": false
},
{
"couponId": "CPN202605120000001",
"templateName": "平台佣金减免券",
"couponType": 1,
"deductionType": 2,
"faceAmount": 50,
"thresholdAmount": 0,
"actualDeduction": 50,
"validStartTime": "2026-05-08 00:00:00",
"validEndTime": "2026-06-30 23:59:59",
"receiveTime": "2026-05-12 14:27:00",
"available": true,
"recommended": false
},
{
"couponId": "CPN202605120000002",
"templateName": "车款满减券",
"couponType": 1,
"deductionType": 1,
"faceAmount": 100,
"thresholdAmount": 0,
"actualDeduction": 80,
"validStartTime": "2026-05-08 00:00:00",
"validEndTime": "2026-06-15 23:59:59",
"receiveTime": "2026-05-12 14:27:08",
"available": true,
"recommended": false
},
{
"couponId": "CPN202605130000001",
"templateName": "未生效测试券",
"couponType": 1,
"deductionType": 2,
"faceAmount": 10,
"thresholdAmount": 0,
"actualDeduction": 0,
"validStartTime": "2026-06-12 11:22:24",
"validEndTime": "2026-06-13 11:22:24",
"receiveTime": "2026-05-13 11:22:24",
"available": false,
"unavailableReason": "优惠券未生效",
"recommended": false
}
]
}
/** 与 dj-aus CDN(img01)路径对齐;可被 `.env` 中 `VITE_APP_COUPON_IMAGE_BASE_URL` 覆盖 */
export const DEFAULT_COUPON_IMAGE_BASE_URL =
"https://img01.glsx.com.cn/weapp/resource/dj-aus/images/coupon";
/**
* 优惠券等相关图片:`VITE_APP_COUPON_IMAGE_BASE_URL`(若未配置则用默认 CDN)+ 文件名。
*/
export function couponImageUrl(fileName: string): string {
const fromEnv = String(import.meta.env.VITE_APP_COUPON_IMAGE_BASE_URL ?? "").trim();
const baseRaw = fromEnv || DEFAULT_COUPON_IMAGE_BASE_URL;
const base = baseRaw.replace(/\/+$/, "");
const name = fileName.replace(/^\/+/, "");
return `${base}/${name}`;
}
import type { AxiosStatic } from "axios";
import {
EventTrackingController,
type EventTrackingBatchItem,
type EventTrackingBatchSaveBody,
type EventTrackingBusinessKeyVO,
type EventTrackingParamVO,
} from "@/api/EventTrackingController";
function voidBatch(axios: AxiosStatic, events: EventTrackingBatchItem[]): void {
if (!events.length) {
return;
}
const body: EventTrackingBatchSaveBody = { events };
void EventTrackingController.batchSave(axios, body).catch((e: unknown) => {
console.error("[eventTracking/batchSave]", e);
});
}
function strParam(
key: string,
value: string | number | boolean | null,
paramType: EventTrackingParamVO["paramType"] = "STRING"
): EventTrackingParamVO {
return { paramKey: key, paramValue: value as string | number | boolean | null, paramType };
}
function workOrderKeys(orderId: number): EventTrackingBusinessKeyVO[] {
return [{ businessType: "WORK_ORDER", businessKey: String(orderId) }];
}
/** 首页权益弹窗主按钮(我知道了 / 一键收下) */
export function trackCouponPopupClick(
axios: AxiosStatic,
popupType: "transfer" | "distribute",
couponIdsJoined: string
): void {
voidBatch(axios, [
{
eventCode: "coupon_popup_click",
params: [
strParam("popup_type", popupType),
strParam("coupon_id", couponIdsJoined),
],
},
]);
}
/** 蒙层关闭 / 关闭按钮关闭弹窗(非主按钮) */
export function trackCouponPopupClose(
axios: AxiosStatic,
popupType: "transfer" | "distribute"
): 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),
],
},
]);
}
/** 优惠卡券页「使用说明」展开 */
export function trackCouponRuleClick(axios: AxiosStatic, couponId: string): void {
voidBatch(axios, [
{
eventCode: "coupon_rule_click",
remark: "/module/order/CouponPage",
params: [strParam("coupon_id", couponId)],
},
]);
}
/** 待签署订单选券底栏切换(相对打开弹窗前的选择发生变化) */
export function trackOrderCouponChangeClick(
axios: AxiosStatic,
orderId: number,
selectedCouponId: string
): void {
voidBatch(axios, [
{
eventCode: "order_coupon_change_click",
businessKeys: workOrderKeys(orderId),
params: [strParam("selected_coupon_id", selectedCouponId)],
},
]);
}
/** 立即使用:核销接口成功回调 */
export function trackOrderPaySubmitClick(
axios: AxiosStatic,
orderId: number,
usedCouponId: string,
actualDiscountAmt: number
): void {
voidBatch(axios, [
{
eventCode: "order_pay_submit_click",
businessKeys: workOrderKeys(orderId),
params: [
strParam("used_coupon_id", usedCouponId),
strParam("actual_discount_amt", actualDiscountAmt, "NUMBER"),
],
},
]);
}
/**
* 开发包订单优惠券 GET coupon/order-coupons:
* - `true`:使用 `mockOrderCouponsEnvelope.json`,不发请求
* - `false`:走真实接口(联调时改此项即可,保存后热更新通常无需重启)
*
* 正式构建恒为关闭(见 `isOrderCouponsDevMockActive`)。
*/
export const DEV_ORDER_COUPONS_HTTP_MOCK = false;
export function isOrderCouponsDevMockActive(): boolean {
return import.meta.env.DEV && DEV_ORDER_COUPONS_HTTP_MOCK;
}
......@@ -27,33 +27,54 @@
</template>
<script lang="ts">
import { Ref, Component, Vue } from "vue-facing-decorator";
import { Prop, Ref, Component, Vue } from "vue-facing-decorator";
import { onShow } from "@dcloudio/uni-app";
import { PreferenceController } from "@/api/PreferenceController";
import { AuthService } from "@/common/AuthService";
@Component({})
export default class ImprovePopup extends Vue {
@Prop({ type: Boolean, default: false })
parentControlled = false;
@Ref popupRef: any;
// 是否显示下次再说
isShowClosePopup: boolean = true;
created(): void {
if (this.parentControlled) {
return;
}
onShow(() => {
//判断是否登录
const authService: AuthService = this.$auth;
const accountInfo = authService.getAuthentication();
if (authService.isLogin()) {
if (accountInfo && accountInfo.accountType === 'COMMON' && accountInfo.certifiedState !== "CERTIFICATING") {
console.log('用户未认证,不能展示收车偏好弹窗弹窗')
} else {
this.getPreferencePopup();
this.fetchPreferencePopupAndMaybeOpen();
}
}
})
}
getPreferencePopup() {
/**
* 由首页在待通知权益弹窗结束后调用(parentControlled 模式)。
*/
tryOpenPreferencePopup(): void {
const authService: AuthService = this.$auth;
const accountInfo = authService.getAuthentication();
if (!authService.isLogin()) {
return;
}
if (accountInfo && accountInfo.accountType === 'COMMON' && accountInfo.certifiedState !== "CERTIFICATING") {
return;
}
this.fetchPreferencePopupAndMaybeOpen();
}
fetchPreferencePopupAndMaybeOpen() {
PreferenceController.getPreferenceDetails(this.axios, { isIndexPage: true }).then((response: any) => {
const data = response.data || {};
if (data.success) {
......
......@@ -52,10 +52,16 @@ export default class RoundBidPopup extends Vue {
isClose = false;
/**
* 轮拍结束 center 弹层已调度或展示中,父页(如车辆详情)应抑制其它 center 活动弹窗。
*/
centerOverlayBlocking = false;
created(): void { }
//初始化数据
initData(data: any) {
this.centerOverlayBlocking = true;
this.nextAucVehData = data || {};
if (this.nextAucVehData.aucvehId) {
this.endState = '2';
......@@ -89,6 +95,7 @@ export default class RoundBidPopup extends Vue {
//跳转到下一辆车
toNextAucVeh() {
this.popupRef.close('center');
this.centerOverlayBlocking = false;
uni.navigateTo({ url: '/module/auction/AuctionVehiclePage?aucvehId=' + this.nextAucVehData.aucvehId });
this.isClose = true;
}
......@@ -96,6 +103,7 @@ export default class RoundBidPopup extends Vue {
closePopup() {
this.isClose = true;
this.popupRef.close('center');
this.centerOverlayBlocking = false;
}
}
......
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_APP_COUPON_IMAGE_BASE_URL?: string;
/** 业务埋点 `POST`,默认相对 `VITE_APP_API_URL` 为 `eventTracking/batchSave` */
readonly VITE_APP_EVENT_TRACKING_PATH?: string;
}
declare module '*.vue' {
import {DefineComponent} from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
......
......@@ -85,7 +85,7 @@ export default class BidPage extends PaginationComponent<Bid> {
}
viewCarDetail(bid: Bid) {
uni.navigateTo({url: '/module/auction/AuctionVehiclePage?aucvehId=' + bid.auctionVehicle.aucvehId});
uni.navigateTo({ url: '/module/auction/AuctionVehiclePage?aucvehId=' + bid.auctionVehicle.aucvehId + '&fromBidRecord=1' });
}
onSearch(): void {
......
......@@ -230,7 +230,9 @@
"path": "CouponPage",
"style": {
"navigationBarTitleText": "优惠卡券",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"disableScroll": true,
"backgroundColor": "#FFFFFF"
}
},
{
......
......@@ -127,7 +127,9 @@
</view>
<view class="tool-item" @click="navigateTo('/module/order/CouponPage')">
<view class="tool-icon tool-icon--badge">
<image src="/static/images/profile/coupon.png" mode="aspectFill" class="tools-image" />
<!-- 使用 view 背景图而非 image:小程序原生 image 层级最高,会盖住同层红点 -->
<view class="tools-image tools-image--coupon"
:style="{ backgroundImage: `url(${couponEntryIconUrl})` }" />
<view v-if="couponEntryShowDot" class="tool-entry-badge-dot"></view>
</view>
<text class="tool-name">优惠卡券</text>
......@@ -213,7 +215,8 @@ import { BACKGROUND_IMAGE_1 } from "@/static/ResourceConstants";
import { FileInfo } from "lib/src/core/bean/FileInfo";
import { BurialPoint } from "@/common/BurialPoint";
import { PreferenceController } from "@/api/PreferenceController";
import { CouponController } from "@/api/CouponController";
import { CouponController, type CouponRedDotResp } from "@/api/CouponController";
import { couponImageUrl } from "@/common/couponImageUrl";
@Component({
......@@ -303,10 +306,11 @@ export default class ProfilePage extends Vue {
this.couponEntryShowDot = false;
return;
}
CouponController.getCouponCount(this.axios)
CouponController.getCouponRedDot(this.axios)
.then(res => {
const c = res.data;
this.couponEntryShowDot = (c?.unusedCount ?? 0) > 0;
const raw = res.data as CouponRedDotResp & { data?: CouponRedDotResp };
const c = raw.data ?? raw;
this.couponEntryShowDot = Boolean(c?.hasRedDot);
})
.catch(() => {
this.couponEntryShowDot = false;
......@@ -314,13 +318,14 @@ export default class ProfilePage extends Vue {
}
navigateTo(url: string): void {
console.log('navigateTo', url);
const authService: AuthService = this.$auth;
console.log('authService.isLogin()', authService.isLogin());
if (authService.isLogin()) {
if (url === '/module/order/AuctionOrderPage') {
BurialPoint.burialPoint(this.$auth.getAuthentication(), 'auction_my_viewallorders_click', '0', '/pages/tabbar/ProfilePage');
}
if (url === '/module/order/CouponPage') {
BurialPoint.burialPoint(this.$auth.getAuthentication(), 'auction_my_coupon_click', '0', '/pages/tabbar/ProfilePage');
}
uni.navigateTo({
url,
fail: (err) => {
......@@ -364,6 +369,10 @@ export default class ProfilePage extends Vue {
}
}
get couponEntryIconUrl(): string {
return couponImageUrl("ticket.png");
}
previewAvatar(): void {
if (this.accountInfo?.avatar && this.accountInfo.avatar?.url) {
uni.previewImage({ urls: [this.accountInfo.avatar.url], current: 0 });
......@@ -541,12 +550,14 @@ export default class ProfilePage extends Vue {
.tool-icon--badge {
position: relative;
overflow: visible;
}
.tool-entry-badge-dot {
position: absolute;
top: 0;
right: 2px;
z-index: 10;
width: 8px;
height: 8px;
background: #ff3b30;
......@@ -559,6 +570,12 @@ export default class ProfilePage extends Vue {
height: 24px;
}
.tools-image--coupon {
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
.tool-name {
font-size: 14px;
font-weight: 400;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!