|
|
@@ -99,6 +99,13 @@
|
|
|
<template #last_login_type="{ record }">
|
|
|
<span>{{ formatLastLoginType(record.last_login_type) }}</span>
|
|
|
</template>
|
|
|
+ <template #send_count_auto_approve="{ record }">
|
|
|
+ <a-switch
|
|
|
+ :model-value="isSendCountAutoApprove(record)"
|
|
|
+ :loading="whitelistLoadingUuid === record.uuid"
|
|
|
+ @change="(checked) => onSendCountAutoApproveChange(record, checked)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
<template #optional="{ record }">
|
|
|
<a-button @click="changeCount(record)">更改次数</a-button>
|
|
|
</template>
|
|
|
@@ -125,7 +132,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, reactive, onMounted } from 'vue'
|
|
|
-import { adminGetUserList, adminChangeLepaoCount } from '@/api/user'
|
|
|
+import { adminGetUserList, adminChangeLepaoCount, adminSetSendCountAutoApprove } from '@/api/user'
|
|
|
import { Notification, Message } from '@arco-design/web-vue'
|
|
|
|
|
|
const visible = ref(false)
|
|
|
@@ -151,6 +158,37 @@ const pagination = reactive({
|
|
|
|
|
|
const loading = ref(false)
|
|
|
const data = ref([])
|
|
|
+const whitelistLoadingUuid = ref('')
|
|
|
+
|
|
|
+const isSendCountAutoApprove = (record) => Number(record?.send_count_auto_approve) === 1
|
|
|
+
|
|
|
+const onSendCountAutoApproveChange = async (record, checked) => {
|
|
|
+ if (!record?.uuid || whitelistLoadingUuid.value) return
|
|
|
+ const next = checked === true ? 1 : 0
|
|
|
+ whitelistLoadingUuid.value = record.uuid
|
|
|
+ try {
|
|
|
+ const res = await adminSetSendCountAutoApprove({
|
|
|
+ userid: record.uuid,
|
|
|
+ send_count_auto_approve: next
|
|
|
+ })
|
|
|
+ if (!res || res.code !== 0) {
|
|
|
+ Notification.error({
|
|
|
+ title: '保存失败',
|
|
|
+ content: res?.msg ?? '请稍后再试'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ record.send_count_auto_approve = next
|
|
|
+ Message.success(next ? '已加入赠送免审白名单' : '已关闭赠送免审')
|
|
|
+ } catch (error) {
|
|
|
+ Notification.error({
|
|
|
+ title: '保存失败',
|
|
|
+ content: error.message || '请稍后再试'
|
|
|
+ })
|
|
|
+ } finally {
|
|
|
+ whitelistLoadingUuid.value = ''
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
const columns = [
|
|
|
|
|
|
@@ -193,6 +231,10 @@ const columns = [
|
|
|
title: '剩余乐跑次数',
|
|
|
dataIndex: 'lepao_count',
|
|
|
width: 120,
|
|
|
+ }, {
|
|
|
+ title: '赠送免审',
|
|
|
+ slotName: 'send_count_auto_approve',
|
|
|
+ width: 110,
|
|
|
}, {
|
|
|
title: '操作',
|
|
|
slotName: 'optional',
|