feat(promo): HQ 推广码订单只计已完成并补扫码订单快链

列表与详情的订单数/转化率按 COMPLETED 实时统计;扫码、订单、事件 ID 可跳到对应页。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-28 12:55:19 +08:00
parent 737efb89a3
commit fccfd7abbe
15 changed files with 421 additions and 124 deletions
@@ -37,6 +37,7 @@ type OrderFilterInput = Pick<
| 'createdTo'
| 'excludeTest'
| 'deliveryType'
| 'promoCodeId'
>;
@Injectable()
@@ -94,7 +95,7 @@ export class AdminOrdersService {
skip: (page - 1) * pageSize,
take: pageSize,
include: {
user: { select: { id: true, userNo: true, phone: true, nickname: true } },
user: { select: { id: true, userNo: true, phone: true, nickname: true, hqRemark: true } },
delivery: {
select: {
provider: true,
@@ -190,6 +191,10 @@ export class AdminOrdersService {
if (query.createdTo) where.createdAt.lte = this.endOfDay(query.createdTo);
}
if (query.excludeTest) where.isTest = false;
const promoCodeId = query.promoCodeId?.trim();
if (promoCodeId && /^\d+$/.test(promoCodeId)) {
where.promoCodeId = BigInt(promoCodeId);
}
return where;
}
@@ -252,6 +257,7 @@ export class AdminOrdersService {
userNo: true,
phone: true,
nickname: true,
hqRemark: true,
deviceKey: true,
phoneVerifiedAt: true,
},