<script lang="ts" setup>
/**
 * 提现待审定制视图：金额强调 + 通过/拒绝交给 ActionHost 打开业务审核
 */
import { computed } from 'vue';

import { Button } from 'ant-design-vue';

const props = defineProps<{
  notice: Record<string, any>;
}>();

const emit = defineEmits<{
  audit: [modalType: number];
}>();

const payload = computed(() => props.notice?.action_payload || {});
</script>

<template>
  <div class="withdraw-view">
    <div class="hero">
      <div class="kicker">提现待审</div>
      <div class="amount">
        <span class="currency">¥</span>{{ payload.amount || '—' }}
      </div>
      <p class="subject">{{ notice.detail || '有一笔提现申请等待你处理' }}</p>
    </div>
    <dl class="facts">
      <div class="fact">
        <dt>单号</dt>
        <dd>{{ payload.order_no || '—' }}</dd>
      </div>
      <div class="fact">
        <dt>申请 ID</dt>
        <dd>#{{ payload.biz_id || '—' }}</dd>
      </div>
      <div class="fact">
        <dt>时间</dt>
        <dd>{{ notice.created_at || '—' }}</dd>
      </div>
    </dl>
    <div class="actions">
      <Button danger size="large" @click="emit('audit', 1)">拒绝</Button>
      <Button type="primary" size="large" @click="emit('audit', 0)">
        通过审核
      </Button>
    </div>
  </div>
</template>

<style scoped>
.withdraw-view {
  padding: 4px 0;
}

.hero {
  padding: 20px 18px;
  border-radius: 16px;
  background:
    radial-gradient(
      70% 100% at 100% 0%,
      hsl(var(--primary) / 0.2),
      transparent 55%
    ),
    linear-gradient(
      160deg,
      hsl(var(--muted) / 0.55),
      hsl(var(--card, var(--background)))
    );
  border: 1px solid hsl(var(--border));
}

.kicker {
  font-size: 12px;
  font-weight: 650;
  color: hsl(var(--primary));
}

.amount {
  margin-top: 10px;
  font-size: 40px;
  font-weight: 780;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--foreground));
}

.currency {
  margin-right: 2px;
  font-size: 22px;
  font-weight: 650;
}

.subject {
  margin: 8px 0 0;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.facts {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}

.fact {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: hsl(var(--card, var(--background)));
  border: 1px solid hsl(var(--border));
}

.fact dt {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

.fact dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
</style>
