feat(store): 门店套餐 v3.4.10 全端实现
新增 StorePackage 与变更审核流,覆盖总部直存、合伙/门店提审、C 端展示与套餐异议工单;同步 PRD/开发文档与 REQ 索引。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -730,6 +730,40 @@ export class TradeService {
|
||||
return serializeBigInt({ ...ticket, orderNo: order.orderNo, orderStatus: order.status });
|
||||
}
|
||||
|
||||
async createPackageDispute(
|
||||
userId: bigint,
|
||||
body: { storeId: string; remark?: string; redeemRecordId?: string },
|
||||
) {
|
||||
const storeId = BigInt(body.storeId);
|
||||
const store = await this.prisma.store.findFirst({
|
||||
where: { id: storeId, status: 'OPEN' },
|
||||
});
|
||||
if (!store) throw new NotFoundException('门店不存在');
|
||||
|
||||
const pending = await this.prisma.commonTicket.findFirst({
|
||||
where: {
|
||||
ticketType: 'PACKAGE_DISPUTE',
|
||||
refType: 'STORE',
|
||||
refId: storeId,
|
||||
status: { in: ['PENDING', 'OPEN'] },
|
||||
},
|
||||
});
|
||||
if (pending) throw new BadRequestException('该门店套餐异议已在处理中');
|
||||
|
||||
const extraJson: Record<string, unknown> = { userId: userId.toString() };
|
||||
if (body.redeemRecordId) {
|
||||
extraJson.redeemRecordId = body.redeemRecordId;
|
||||
}
|
||||
|
||||
return this.ticketService.create({
|
||||
ticketType: 'PACKAGE_DISPUTE',
|
||||
refType: 'STORE',
|
||||
refId: storeId.toString(),
|
||||
remark: body.remark ?? '用户对门店套餐有异议',
|
||||
extraJson,
|
||||
});
|
||||
}
|
||||
|
||||
private generateInvoiceNo() {
|
||||
return `INV${Date.now()}${Math.floor(Math.random() * 900 + 100)}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user