chore: stabilize lint and verify builds
This commit is contained in:
2
frontend/superadmin/dist/index.html
vendored
2
frontend/superadmin/dist/index.html
vendored
@@ -7,7 +7,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Sakai Vue</title>
|
||||
<link href="https://fonts.cdnfonts.com/css/lato" rel="stylesheet">
|
||||
<script type="module" crossorigin src="./assets/index-qhcz61Ui.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index-CsH8eBi3.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-CLNNtsXI.css">
|
||||
</head>
|
||||
|
||||
|
||||
@@ -319,5 +319,23 @@ export const UserService = {
|
||||
total: data?.total ?? 0,
|
||||
items: normalizeItems(data?.items)
|
||||
};
|
||||
},
|
||||
async creditUserWallet(userID, { amount, remark } = {}) {
|
||||
if (!userID) throw new Error('userID is required');
|
||||
if (!amount || Number(amount) <= 0) throw new Error('amount is required');
|
||||
return requestJson(`/super/v1/users/${userID}/wallet/credit`, {
|
||||
method: 'POST',
|
||||
body: { amount, remark }
|
||||
});
|
||||
},
|
||||
async activateRechargeCodes({ amount, quantity, remark } = {}) {
|
||||
if (!amount || Number(amount) <= 0) throw new Error('amount is required');
|
||||
const body = { amount };
|
||||
if (quantity) body.quantity = quantity;
|
||||
if (remark) body.remark = remark;
|
||||
return requestJson('/super/v1/finance/recharge-codes/activate', {
|
||||
method: 'POST',
|
||||
body
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -416,6 +416,18 @@ const profileIsVerified = ref(false);
|
||||
const profileRealName = ref('');
|
||||
const profileIDCard = ref('');
|
||||
|
||||
const walletCreditDialogVisible = ref(false);
|
||||
const walletCreditSubmitting = ref(false);
|
||||
const walletCreditAmount = ref(null);
|
||||
const walletCreditRemark = ref('');
|
||||
|
||||
const rechargeCodeDialogVisible = ref(false);
|
||||
const rechargeCodeSubmitting = ref(false);
|
||||
const rechargeCodeAmount = ref(null);
|
||||
const rechargeCodeQuantity = ref(1);
|
||||
const rechargeCodeRemark = ref('');
|
||||
const rechargeCodeItems = ref([]);
|
||||
|
||||
const statusDialogVisible = ref(false);
|
||||
const statusLoading = ref(false);
|
||||
const statusOptionsLoading = ref(false);
|
||||
@@ -533,6 +545,61 @@ async function confirmUpdateProfile() {
|
||||
}
|
||||
}
|
||||
|
||||
function openWalletCreditDialog() {
|
||||
walletCreditAmount.value = null;
|
||||
walletCreditRemark.value = '';
|
||||
walletCreditDialogVisible.value = true;
|
||||
}
|
||||
|
||||
function openRechargeCodeDialog() {
|
||||
rechargeCodeAmount.value = null;
|
||||
rechargeCodeQuantity.value = 1;
|
||||
rechargeCodeRemark.value = '';
|
||||
rechargeCodeItems.value = [];
|
||||
rechargeCodeDialogVisible.value = true;
|
||||
}
|
||||
|
||||
async function confirmWalletCredit() {
|
||||
const id = userID.value;
|
||||
if (!id || !walletCreditAmount.value || Number(walletCreditAmount.value) <= 0) return;
|
||||
|
||||
walletCreditSubmitting.value = true;
|
||||
try {
|
||||
await UserService.creditUserWallet(id, {
|
||||
amount: Number(walletCreditAmount.value),
|
||||
remark: walletCreditRemark.value?.trim() || undefined
|
||||
});
|
||||
toast.add({ severity: 'success', summary: '充值成功', detail: `用户ID: ${id}`, life: 3000 });
|
||||
walletCreditDialogVisible.value = false;
|
||||
await loadUser();
|
||||
await loadWallet();
|
||||
await loadRechargeOrders();
|
||||
} catch (error) {
|
||||
toast.add({ severity: 'error', summary: '充值失败', detail: error?.message || '无法完成充值', life: 4000 });
|
||||
} finally {
|
||||
walletCreditSubmitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmRechargeCodeActivation() {
|
||||
if (!rechargeCodeAmount.value || Number(rechargeCodeAmount.value) <= 0) return;
|
||||
|
||||
rechargeCodeSubmitting.value = true;
|
||||
try {
|
||||
const result = await UserService.activateRechargeCodes({
|
||||
amount: Number(rechargeCodeAmount.value),
|
||||
quantity: rechargeCodeQuantity.value,
|
||||
remark: rechargeCodeRemark.value?.trim() || undefined
|
||||
});
|
||||
rechargeCodeItems.value = Array.isArray(result?.items) ? result.items : [];
|
||||
toast.add({ severity: 'success', summary: '激活成功', detail: `生成 ${rechargeCodeItems.value.length} 个充值码`, life: 3000 });
|
||||
} catch (error) {
|
||||
toast.add({ severity: 'error', summary: '激活失败', detail: error?.message || '无法生成充值码', life: 4000 });
|
||||
} finally {
|
||||
rechargeCodeSubmitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const ownedTenantsLoading = ref(false);
|
||||
const ownedTenants = ref([]);
|
||||
const ownedTenantsTotal = ref(0);
|
||||
@@ -1428,7 +1495,11 @@ onMounted(() => {
|
||||
<div class="font-medium">{{ formatCny(wallet?.balance_frozen) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<Button label="刷新" icon="pi pi-refresh" severity="secondary" @click="loadWallet" :disabled="walletLoading" />
|
||||
<div class="flex items-center gap-2">
|
||||
<Button label="超管充值" icon="pi pi-plus" @click="openWalletCreditDialog" :disabled="walletLoading" />
|
||||
<Button label="生成充值码" icon="pi pi-ticket" severity="secondary" @click="openRechargeCodeDialog" :disabled="walletLoading" />
|
||||
<Button label="刷新" icon="pi pi-refresh" severity="secondary" @click="loadWallet" :disabled="walletLoading" />
|
||||
</div>
|
||||
</div>
|
||||
<DataTable :value="wallet?.transactions || []" dataKey="id" :loading="walletLoading" scrollable scrollHeight="420px" responsiveLayout="scroll">
|
||||
<Column field="id" header="订单ID" style="min-width: 8rem" />
|
||||
@@ -1760,4 +1831,68 @@ onMounted(() => {
|
||||
<Button label="确认" icon="pi pi-check" @click="confirmUpdateRoles" :loading="rolesLoading" />
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<Dialog v-model:visible="walletCreditDialogVisible" :modal="true" :style="{ width: '420px' }">
|
||||
<template #header>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-medium">超管充值</span>
|
||||
<span class="text-muted-color truncate max-w-[240px]">{{ user?.username ?? '-' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div>
|
||||
<label class="block font-medium mb-2">充值金额(元)</label>
|
||||
<InputNumber v-model="walletCreditAmount" :min="0" :maxFractionDigits="2" placeholder="请输入金额" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block font-medium mb-2">备注</label>
|
||||
<InputText v-model="walletCreditRemark" placeholder="可选" class="w-full" />
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<Button label="取消" icon="pi pi-times" text @click="walletCreditDialogVisible = false" :disabled="walletCreditSubmitting" />
|
||||
<Button label="确认" icon="pi pi-check" @click="confirmWalletCredit" :loading="walletCreditSubmitting" :disabled="walletCreditSubmitting || !walletCreditAmount" />
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<Dialog v-model:visible="rechargeCodeDialogVisible" :modal="true" :style="{ width: '520px' }">
|
||||
<template #header>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-medium">生成充值码</span>
|
||||
<span class="text-muted-color truncate max-w-[260px]">{{ user?.username ?? '-' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block font-medium mb-2">单码金额(元)</label>
|
||||
<InputNumber v-model="rechargeCodeAmount" :min="0" :maxFractionDigits="2" placeholder="请输入金额" class="w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="block font-medium mb-2">生成数量</label>
|
||||
<InputNumber v-model="rechargeCodeQuantity" :min="1" :max="500" placeholder="默认 1" class="w-full" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block font-medium mb-2">备注</label>
|
||||
<InputText v-model="rechargeCodeRemark" placeholder="可选" class="w-full" />
|
||||
</div>
|
||||
<div v-if="rechargeCodeItems.length" class="rounded border border-surface-200 p-3">
|
||||
<div class="text-sm text-muted-color mb-2">生成结果</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<div v-for="item in rechargeCodeItems" :key="item.code" class="flex flex-col gap-1">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="font-medium">{{ item.code }}</span>
|
||||
<span class="text-sm text-muted-color">{{ formatCny(item.amount * 100) }}</span>
|
||||
</div>
|
||||
<div class="text-xs text-muted-color">{{ item.activated_at ? formatDate(item.activated_at) : '-' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<Button label="关闭" icon="pi pi-times" text @click="rechargeCodeDialogVisible = false" :disabled="rechargeCodeSubmitting" />
|
||||
<Button label="生成" icon="pi pi-check" @click="confirmRechargeCodeActivation" :loading="rechargeCodeSubmitting" :disabled="rechargeCodeSubmitting || !rechargeCodeAmount" />
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user