This commit is contained in:
2026-08-25 16:01:07 +08:00
parent 63b169a033
commit d3ba1c7e48
26 changed files with 1542 additions and 148 deletions
+54 -1
View File
@@ -14,6 +14,10 @@ const grantVisible = ref(false)
const grantForm = reactive({ phoneNum: '', planId: 'day' })
const granting = ref(false)
const remarkVisible = ref(false)
const remarkForm = reactive({ phoneNum: '', remark: '' })
const remarking = ref(false)
const planOptions = [
{ value: 'day', label: '1天' },
{ value: 'week', label: '7天' },
@@ -64,6 +68,29 @@ function submitGrant() {
})
}
function openRemark(row) {
remarkForm.phoneNum = row.phoneNum
remarkForm.remark = row.remark || ''
remarkVisible.value = true
}
function submitRemark() {
remarking.value = true
request
.post('/licenses/remark', {
phoneNum: remarkForm.phoneNum.trim(),
remark: remarkForm.remark.trim(),
})
.then(() => {
ElMessage.success(remarkForm.remark ? '备注已保存' : '备注已清空')
remarkVisible.value = false
load()
})
.finally(() => {
remarking.value = false
})
}
function revoke(row) {
ElMessageBox.confirm(`确认撤销 ${row.phoneNum} 的授权?撤销后该账号额度立即失效,账号保留可继续登录。`, '撤销授权', {
type: 'warning',
@@ -112,9 +139,13 @@ onMounted(load)
<el-table-column prop="updatedAt" label="更新时间" width="180">
<template #default="{ row }">{{ row.updatedAt || '-' }}</template>
</el-table-column>
<el-table-column label="操作" width="130" fixed="right">
<el-table-column prop="remark" label="备注" min-width="160" show-overflow-tooltip>
<template #default="{ row }">{{ row.remark || '-' }}</template>
</el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<template #default="{ row }">
<el-button type="primary" link size="small" @click="openGrant(row)">授权</el-button>
<el-button type="warning" link size="small" @click="openRemark(row)">备注</el-button>
<el-button type="danger" link size="small" :disabled="!row.expiresAt" @click="revoke(row)">撤销</el-button>
</template>
</el-table-column>
@@ -146,6 +177,28 @@ onMounted(load)
<el-button type="primary" :loading="granting" @click="submitGrant">确认授权</el-button>
</template>
</el-dialog>
<el-dialog v-model="remarkVisible" title="账号备注" width="420px">
<el-form label-width="80px">
<el-form-item label="手机号">
<el-input :model-value="remarkForm.phoneNum" disabled />
</el-form-item>
<el-form-item label="备注">
<el-input
v-model="remarkForm.remark"
type="textarea"
:rows="3"
maxlength="200"
show-word-limit
placeholder="运营备注(如发卡渠道/人工记录),留空提交即清空"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="remarkVisible = false">取消</el-button>
<el-button type="primary" :loading="remarking" @click="submitRemark">保存</el-button>
</template>
</el-dialog>
</el-card>
</template>