feat:后台开卡绑定用户
This commit is contained in:
1 parent
7269ee4baa
commit
9726e9b616
10 files changed
+372
-317
No files matched your search
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<el-dialog title="绑定用户" width="30%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="用户" prop="userId">
|
||||
<select-user v-model="form.userId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletActiveDialog">
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletActiveApi from "/@/api/wallet/wallet-active"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: "",
|
||||
userId: "",
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
userId: [{ required: true, message: "请选择用户", trigger: "change" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 获取walletActive信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletActiveData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
try {
|
||||
loading.value = true
|
||||
// fastCreateCard(form)
|
||||
useMessage().success("绑定成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletActiveData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
walletActiveApi
|
||||
.getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
@@ -1,107 +1,112 @@
|
||||
<template>
|
||||
<el-dialog title="开卡" width="30%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-dialog title="开卡" width="30%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商户" prop="merchantId">
|
||||
<select-mch v-model="form.merchantId" placeholder="请选择商户" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商户" prop="merchantId">
|
||||
<select-mch v-model="form.merchantId" placeholder="请选择商户" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="生成数量" prop="count">
|
||||
<el-input-number style="width: 100%" v-model="form.count" :max="200" placeholder="请输入生成数量" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="生成数量" prop="count">
|
||||
<el-input-number
|
||||
style="width: 100%"
|
||||
v-model="form.count"
|
||||
:max="200"
|
||||
placeholder="请输入生成数量"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletActiveDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj, fastCreateCard } from '/@/api/wallet/wallet-active'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj, fastCreateCard } from "/@/api/wallet/wallet-active"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
merchantId: '',
|
||||
count: '',
|
||||
});
|
||||
id: "",
|
||||
merchantId: "",
|
||||
count: "",
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
merchantId: [{ required: true, message: '请选择商户', trigger: 'change' }],
|
||||
count: [{ required: true, message: '生成数量不能为空', trigger: 'blur' }],
|
||||
merchantId: [{ required: true, message: "请选择商户", trigger: "change" }],
|
||||
count: [{ required: true, message: "生成数量不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 获取walletActive信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletActiveData(id)
|
||||
}
|
||||
};
|
||||
// 获取walletActive信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletActiveData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
fastCreateCard(form)
|
||||
useMessage().success("开卡成功");
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
fastCreateCard(form)
|
||||
useMessage().success("开卡成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletActiveData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
@@ -29,13 +29,7 @@
|
||||
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_walletActive_add'"
|
||||
>
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'wallet_walletActive_add'">
|
||||
开 卡
|
||||
</el-button>
|
||||
<el-button
|
||||
@@ -80,14 +74,10 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.isActiveHardware == 1"
|
||||
icon="Postcard"
|
||||
text
|
||||
type="primary"
|
||||
@click="doRefreshAvatar(row)"
|
||||
<el-button v-if="row.isActiveHardware == 1" icon="Postcard" text type="primary" @click="doRefreshAvatar(row)"
|
||||
>重新激活</el-button
|
||||
>
|
||||
<el-button icon="Postcard" text type="primary" @click="bindUserFormDialogRef.openDialog(row.id)">绑定用户</el-button>
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="edit-pen"
|
||||
@@ -97,22 +87,15 @@
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletActive_del'"
|
||||
@click="handleDelete([row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletActive_del'" @click="handleDelete([row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<bind-user-form-dialog ref="bindUserFormDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -125,10 +108,12 @@ import { ElLoading } from "element-plus"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
const BindUserFormDialog = defineAsyncComponent(() => import("./bind-user-form.vue"))
|
||||
// 定义查询字典
|
||||
const { wallet_type, yes_no_type } = useDict("wallet_type", "yes_no_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const bindUserFormDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
@@ -142,8 +127,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
|
||||
@@ -25,11 +25,7 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item class="w100" label="审核时间" prop="processTimeList">
|
||||
<el-date-picker
|
||||
v-model="state.queryForm.processTimeList"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="datetimerange"
|
||||
/>
|
||||
<el-date-picker v-model="state.queryForm.processTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -111,12 +107,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column v-auths="['wallet_walletRechargeImport_recover']" label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-auth="'wallet_walletRechargeImport_recover'"
|
||||
icon="RefreshRight"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleRecover(row.id)"
|
||||
<el-button v-auth="'wallet_walletRechargeImport_recover'" icon="RefreshRight" text type="primary" @click="handleRecover(row.id)"
|
||||
>恢复</el-button
|
||||
>
|
||||
</template>
|
||||
@@ -133,12 +124,7 @@ import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import * as walletRechargeImportApi from "/@/api/wallet/wallet-recharge-import"
|
||||
|
||||
const { wallet_biz_recharge, wallet_type, check_status } = useDict(
|
||||
"wallet_biz_recharge",
|
||||
"wallet_type",
|
||||
"check_status",
|
||||
"check_status",
|
||||
)
|
||||
const { wallet_biz_recharge, wallet_type, check_status } = useDict("wallet_biz_recharge", "wallet_type", "check_status", "check_status")
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
@@ -155,8 +141,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 恢复操作
|
||||
const handleRecover = async (id: string) => {
|
||||
@@ -188,11 +173,7 @@ const getSummaries = (param: any) => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile(
|
||||
"/wallet/walletRechargeApply/export",
|
||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||
"walletRechargeApply.xlsx",
|
||||
)
|
||||
downBlobFile("/wallet/walletRechargeApply/export", Object.assign(state.queryForm, { ids: selectObjs }), "walletRechargeApply.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -89,13 +89,7 @@
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletRecharge_del'"
|
||||
@click="handleDelete([row.id])"
|
||||
<el-button v-if="false" icon="delete" text type="primary" v-auth="'wallet_walletRecharge_del'" @click="handleDelete([row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
@@ -137,8 +131,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
|
||||
Reference in new issue
Block a user