feat: add invite user binding
This commit is contained in:
@@ -16,7 +16,10 @@ export class State {
|
||||
public code = '';
|
||||
public status = '';
|
||||
public expiresAt = '';
|
||||
public maxUses = 0;
|
||||
public usageCount = 0;
|
||||
public boundUserId = '';
|
||||
public boundUserLabel = '';
|
||||
public lastUsedAt = '';
|
||||
public createdBy = '';
|
||||
public remark = '';
|
||||
@@ -59,14 +62,6 @@ export const schemas = ref<FormSchema[]>([
|
||||
placeholder: '请选择状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'batchId',
|
||||
component: 'NInput',
|
||||
label: '批次ID',
|
||||
componentProps: {
|
||||
placeholder: '请输入批次ID',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createdBy',
|
||||
component: 'NInput',
|
||||
@@ -102,9 +97,26 @@ export const columns = [
|
||||
{ title: '商户', key: 'tenantName', align: 'left', width: 160 },
|
||||
{ title: '邀请码', key: 'code', align: 'left', width: 120 },
|
||||
{ title: '状态', key: 'status', align: 'left', width: 110 },
|
||||
{ title: '批次ID', key: 'batchId', align: 'left', width: 150 },
|
||||
{ title: '到期时间', key: 'expiresAt', align: 'left', width: 190 },
|
||||
{ title: '累计使用次数', key: 'usageCount', align: 'left', width: 130 },
|
||||
{
|
||||
title: '可用次数',
|
||||
key: 'availableUses',
|
||||
align: 'left',
|
||||
width: 110,
|
||||
render(row: State) {
|
||||
return inviteAvailableUsesLabel(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '绑定用户',
|
||||
key: 'boundUserLabel',
|
||||
align: 'left',
|
||||
width: 180,
|
||||
render(row: State) {
|
||||
return row.boundUserLabel || row.boundUserId || '--';
|
||||
},
|
||||
},
|
||||
{ title: '最后使用时间', key: 'lastUsedAt', align: 'left', width: 190 },
|
||||
{ title: '创建人', key: 'createdBy', align: 'left', width: 110 },
|
||||
{ title: '创建时间', key: 'createdAt', align: 'left', width: 190 },
|
||||
@@ -128,6 +140,13 @@ export function statusLabel(status: string) {
|
||||
return statusOptions.find((item) => item.value === status)?.label || status;
|
||||
}
|
||||
|
||||
export function inviteAvailableUsesLabel(row: State) {
|
||||
if (!row.maxUses || Number(row.maxUses) <= 0) {
|
||||
return '不限制';
|
||||
}
|
||||
return `${Math.max(Number(row.maxUses) - Number(row.usageCount || 0), 0)}`;
|
||||
}
|
||||
|
||||
export function localRfc3339(value: number | null) {
|
||||
if (!value) {
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user