This commit is contained in:
zmj 2024-05-13 18:06:08 +08:00
parent df0537dfff
commit 3d32b3c8c9
6 changed files with 634 additions and 0 deletions

36
src/api/bank.ts Normal file
View File

@ -0,0 +1,36 @@
import request from '@/utils/request'
// 银行列表列表
export function apiBankLists(params: any) {
return request.get({ url: '/bank/bank/lists', params })
}
// 添加银行列表
export function apiBankAdd(params: any) {
return request.post({ url: '/bank/bank/add', params })
}
// 编辑银行列表
export function apiBankEdit(params: any) {
return request.post({ url: '/bank/bank/edit', params })
}
// 删除银行列表
export function apiBankDelete(params: any) {
return request.post({ url: '/bank/bank/delete', params })
}
// 银行列表详情
export function apiBankDetail(params: any) {
return request.get({ url: '/bank/bank/detail', params })
}
// 添加银行列表
export function apimMrchantbankLists(params: any) {
return request.get({ url: '/merchat/merchantbank/lists', params })
}
// 添加银行列表
export function apimMrchantbankCheck(params: any) {
return request.post({ url: '/merchat/merchantbank/check', params })
}

View File

@ -0,0 +1,87 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="银行名称" prop="name">
<el-input v-model="formData.name" clearable placeholder="请输入银行名称" :readonly="true"/>
</el-form-item>
<el-form-item label="银行图片" prop="image">
<el-input v-model="formData.image" clearable placeholder="请输入银行图片" :readonly="true"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="bankDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiBankAdd, apiBankEdit, apiBankDetail } from '@/api/bank'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const formData = reactive({
id: '',
name: '',
image: '',
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiBankDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

112
src/views/bank/edit.vue Normal file
View File

@ -0,0 +1,112 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
<el-form-item label="银行名称" prop="name">
<el-input v-model="formData.name" clearable placeholder="请输入银行名称" :readonly="false" />
</el-form-item>
<el-form-item label="银行图片" prop="image">
<!-- <el-input v-model="formData.image" clearable placeholder="请输入银行图片" :readonly="false" /> -->
<material-picker v-model="formData.image" />
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="bankEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiBankAdd, apiBankEdit, apiBankDetail } from '@/api/bank'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑银行列表' : '新增银行列表'
})
//
const formData = reactive({
id: '',
name: '',
image: '',
})
//
const formRules = reactive<any>({
name: [{
required: true,
message: '请输入银行名称',
trigger: ['blur']
}],
image: [{
required: true,
message: '请输入银行图片',
trigger: ['blur']
}]
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiBankDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiBankEdit(data)
: await apiBankAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

112
src/views/bank/index.vue Normal file
View File

@ -0,0 +1,112 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="银行名称" prop="name">
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入银行名称" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['bank.bank/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button v-perms="['bank.bank/delete']" :disabled="!selectData.length" @click="handleDelete(selectData)">
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="银行名称" prop="name" show-overflow-tooltip />
<el-table-column label="银行图片" prop="image" show-overflow-tooltip>
<template #default="{ row }">
<el-image :src="row.image" style="width: 50px;height: 50px" />
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-perms="['bank.bank/edit']" type="primary" link @click="handleEdit(row)">
编辑
</el-button>
<el-button v-perms="['bank.bank/delete']" type="danger" link @click="handleDelete(row.id)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="bankLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiBankLists, apiBankDelete } from '@/api/bank'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
name: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiBankLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiBankDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -0,0 +1,149 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
<el-form-item label="商户名称">
<el-input v-model="formData.mer_name" clearable :readonly="true" />
</el-form-item>
<el-form-item label="类型">
<el-input v-model="formData.is_own_text" clearable :readonly="true" />
</el-form-item>
<el-form-item label="开户银行">
<el-input v-model="formData.name" clearable :readonly="true" />
</el-form-item>
<el-form-item label="账户名称">
<el-input v-model="formData.name" clearable :readonly="true" />
</el-form-item>
<el-form-item label="银行账号">
<el-input v-model="formData.bank_code" clearable :readonly="true" />
</el-form-item>
<el-form-item label="开户网点">
<el-input v-model="formData.bank_branch" clearable :readonly="true" />
</el-form-item>
<el-form-item label="身份证">
<el-input v-model="formData.id_card" clearable :readonly="true" />
</el-form-item>
<el-form-item label="电话">
<el-input v-model="formData.phone" clearable :readonly="true" />
</el-form-item>
<el-form-item label="审核意见" prop="is_check">
<el-radio-group v-model="formData.is_check" class="ml-4">
<el-radio :label="1" size="large">通过</el-radio>
<el-radio :label="2" size="large">不通过</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="拒绝原因" v-if="formData.is_check == 2" prop="fail_msg">
<el-input type="textarea" v-model="formData.fail_msg" clearable placeholder="请输入拒绝原因"
:readonly="false" />
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="bankEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apimMrchantbankCheck } from '@/api/bank'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑银行列表' : '新增银行列表'
})
//
const formData = reactive({
mer_name: "",
"id": '',
"mer_id": '',
"bank_id": '',
"bank_code": "",
"bank_branch": "",
"name": "",
"id_card": "",
"phone": "",
"financial_img": "",
"is_own": '',
"is_check": '',
"fail_msg": null,
"admin_id": '',
"admin_name": "",
"bank_info": {
"name": "",
"image": ""
},
"is_own_text": "",
"is_check_text": ""
})
//
const formRules = reactive<any>({
is_check: [{
required: true,
message: '请选择审核意见',
trigger: ['blur']
}],
fail_msg: [{
required: true,
message: '请输入拒绝原因',
trigger: ['blur']
}]
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
formData.is_check ? '' : formData.is_check = ''
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { id: formData.id, is_check: formData.is_check, fail_msg: formData.fail_msg }
apimMrchantbankCheck(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
})
</script>

View File

@ -0,0 +1,138 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" label-width="120px">
<el-row>
<el-col :span="6">
<el-form-item label="账户类型" prop="name">
<el-select class="w-280[px]" v-model="queryParams.is_own" clearable placeholder="请选择店铺类型">
<el-option label="个人账户" :value="parseInt(0)" />
<el-option label="对公账户" :value="parseInt(1)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="审核状态" prop="is_check">
<el-select class="w-280[px]" v-model="queryParams.is_check" clearable placeholder="请选择店铺类型">
<el-option label="待审核" :value="parseInt(0)" />
<el-option label="审核通过" :value="parseInt(1)" />
<el-option label="审核未通过" :value="parseInt(2)" />
</el-select>
</el-form-item>
</el-col>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-row>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['bank.bank/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button v-perms="['bank.bank/delete']" :disabled="!selectData.length" @click="handleDelete(selectData)">
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="商户名称" prop="mer_name" show-overflow-tooltip />
<el-table-column label="开户银行" prop="bank_info.name" show-overflow-tooltip />
<el-table-column label="账户名称" prop="name" show-overflow-tooltip />
<el-table-column label="银行账号" prop="bank_code" show-overflow-tooltip />
<el-table-column label="开户网点" prop="bank_branch" show-overflow-tooltip />
<el-table-column label="身份证" prop="id_card" show-overflow-tooltip />
<el-table-column label="电话" prop="phone" show-overflow-tooltip />
<el-table-column label="审核状态" prop="phone" show-overflow-tooltip>
<template #default="{ row }">
{{ row.is_check == 0 ? "待审核" : row.is_check == 1 ? "已通过" : "已拒绝" }}
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-perms="['bank.bank/edit']" type="primary" link @click="handleEdit(row)"
v-if="row.is_check == 0">
审核
</el-button>
<el-button v-else v-perms="['bank.bank/edit']" type="primary" link @click="handleEdit(row)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="bankLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apimMrchantbankLists, apimMrchantbankCheck } from '@/api/bank'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
is_own: '',
is_check: ""
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apimMrchantbankLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiBankDelete({ id })
getLists()
}
getLists()
</script>