修复婚礼红包弹窗:①名字字段兼容 user.username/groom_name 双格式 ②领取路由修正为 /wedding/ceremony/{id}/claim

This commit is contained in:
2026-03-01 19:08:59 +08:00
parent e81887034c
commit e9a41995be
@@ -1238,7 +1238,10 @@
open(detail) {
this.marriageId = detail.marriage_id;
this.ceremonyId = detail.ceremony_id;
this.title = `${detail.groom_name} × ${detail.bride_name} 婚礼红包`;
// 兼容两种字段命名:groom_name/bride_name 或 user.username/partner.username
const groomName = detail.groom_name ?? detail.user?.username ?? '??';
const brideName = detail.bride_name ?? detail.partner?.username ?? '??';
this.title = `${groomName} × ${brideName} 婚礼红包`;
this.subTitle = detail.tier_name ? `【${detail.tier_name}】普天同庆` : '婚礼庆典红包';
this.claimed = false;
this.claimedAmount = 0;
@@ -1253,7 +1256,8 @@
if (this.claiming || this.claimed) return;
this.claiming = true;
try {
const res = await fetch(`/wedding/${this.marriageId}/claim`, {
// 正确路由:/wedding/ceremony/{ceremonyId}/claim
const res = await fetch(`/wedding/ceremony/${this.ceremonyId}/claim`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',