Commit 0941c8a3 by wusiyi

feat: 添加收款账户管理页面

parent 95ba9bde
......@@ -6,3 +6,70 @@ export function getUserRechargeRecordListApi(params) {
export function getSubjectListApi(params) {
return axios.get('/pay/businessPayRecord/subjectList', params)
}
// 获取账户类型
export function getAccountTypeListApi() {
return axios.get('/baseProceedsAccount/accountTypeList')
}
// 获取收款方式
export function getReceiverTypeListApi() {
return axios.get('/baseProceedsAccount/receiverTypeList')
}
// 获取币种
export function getCurrencyTypeListApi() {
return axios.get('/manage/rest/baseCurrencyInfo/uniList')
}
// 获取安全设置
export function getSecuritySettingApi() {
return axios.get('/sysSecuritySettings/getOne')
}
// 获取收款账户列表
export function getBaseProceedsAccountListApi(params) {
return axios.post('/baseProceedsAccount/list_page', params)
}
// 获取收款账户详情
export function getBaseProceedsAccountDetailApi(id) {
return axios.get(`/baseProceedsAccount/get?id=${id}`)
}
// 获取收款账户操作日志
export function getBaseProceedsAccountLogApi(id) {
return axios.get(`/baseProceedsAccountLog/getList?relaId=${id}`)
}
// 更新收款账户启用状态
export function updateBaseProceedsAccountEnableApi(params) {
return axios.post('/baseProceedsAccount/updateEnable', params)
}
// 新增收款账户
export function addBaseProceedsAccountApi(params) {
return axios.post('/baseProceedsAccount/add', params)
}
// 更新收款账户
export function updateBaseProceedsAccountApi(params) {
return axios.post('/baseProceedsAccount/update', params)
}
// 删除收款账户
export function deleteBaseProceedsAccountApi(params) {
return axios.post('/baseProceedsAccount/delete', params)
}
// 发送手机验证码
export function sendPhoneCodeApi(params) {
return axios.post('/sysSecuritySettings/sendPhoneCode', params)
}
// 发送邮箱验证码
export function sendEmailCodeApi(email, operateType) {
return axios.get(
`/sysSecuritySettings/sendEmailCode?email=${email}&operateType=${operateType}`
)
}
......@@ -183,7 +183,10 @@
type="warning"
size="small"
v-if="currentMethod !== 'phone' && securityData.phone"
@click="currentMethod = 'phone'"
@click="
currentMethod = 'phone'
resetForm()
"
style="width: 100%">
手机验证
</el-button>
......@@ -192,7 +195,10 @@
type="success"
size="small"
v-if="currentMethod !== 'mailbox' && securityData.mailbox"
@click="currentMethod = 'mailbox'"
@click="
currentMethod = 'mailbox'
resetForm()
"
style="width: 100%">
邮箱验证
</el-button>
......@@ -205,7 +211,10 @@
dialogType !== 'addPassword' &&
securityData.superPassword
"
@click="currentMethod = 'superPassword'"
@click="
currentMethod = 'superPassword'
resetForm()
"
style="width: 100%">
超级密码验证
</el-button>
......@@ -504,8 +513,8 @@ export default {
resetForm() {
this.$refs.dialogForm?.resetFields()
this.dialogForm = {
phone: '',
mailbox: '',
phone: this.securityData.phone || '',
mailbox: this.securityData.mailbox || '',
code: '',
superPassword: '',
newSuperPassword1: '',
......
......@@ -238,16 +238,18 @@
v-for="(item, index) in logFormData"
:key="index"
style="margin-bottom: 10px">
({{ index + 1 }})、{{ item.operateName + ':' + item.msg }}
({{ index + 1 }})、{{ item.description }}
</li>
</ul>
</el-dialog>
<!-- 安全验证弹窗 -->
<el-dialog
ref="securityDialog"
:title="operateType + '-安全验证'"
:visible.sync="securityVisible"
width="400px"
:close-on-click-modal="false"
@close="resetSecurityForm"
class="confirm-dialog">
<el-form
:model="securityFormData"
......@@ -309,8 +311,8 @@
:label="'超级密码'"
prop="superPassword">
<el-input
v-model="securityFormData.superPassword"
:placeholder="'请输入超级密码'"
v-model="securityFormData.superPassword"
clearable
show-password
size="small" />
......@@ -323,7 +325,10 @@
type="warning"
size="small"
v-if="currentMethod !== 'phone' && securitySetting.phone"
@click="currentMethod = 'phone'"
@click="
currentMethod = 'phone'
resetSecurityForm()
"
style="width: 100%">
手机验证
</el-button>
......@@ -332,7 +337,10 @@
type="success"
size="small"
v-if="currentMethod !== 'mailbox' && securitySetting.mailbox"
@click="currentMethod = 'mailbox'"
@click="
currentMethod = 'mailbox'
resetSecurityForm()
"
style="width: 100%">
邮箱验证
</el-button>
......@@ -343,7 +351,10 @@
v-if="
currentMethod !== 'superPassword' && securitySetting.superPassword
"
@click="currentMethod = 'superPassword'"
@click="
currentMethod = 'superPassword'
resetSecurityForm()
"
style="width: 100%">
超级密码验证
</el-button>
......@@ -358,9 +369,23 @@
</div>
</template>
<script lang="jsx">
import axios from '../../common/api/axios'
import CustomForm from '@/common/components/base/CustomForm.vue'
import tableVue from '@/common/components/base/tableView.vue'
import {
getAccountTypeListApi,
getReceiverTypeListApi,
getCurrencyTypeListApi,
getSecuritySettingApi,
getBaseProceedsAccountListApi,
getBaseProceedsAccountDetailApi,
getBaseProceedsAccountLogApi,
updateBaseProceedsAccountEnableApi,
addBaseProceedsAccountApi,
updateBaseProceedsAccountApi,
deleteBaseProceedsAccountApi,
sendPhoneCodeApi,
sendEmailCodeApi
} from '@/common/api/user/user.js'
export default {
name: 'baseProceedsAccount',
......@@ -386,30 +411,6 @@ export default {
select: '',
sourceData: [],
queryFormData: {},
queryformConfig: [
{
prop: 'timeRange',
type: 'datePicker',
dateType: 'datetimerange',
name: ' 提交时间',
attrs: {
'start-placeholder': '开始时间',
'end-placeholder': '结束时间',
'value-format': 'yyyy-MM-dd HH:mm:ss',
'default-time': ['00:00:00', '23:59:59']
}
},
{
prop: 'runStatus',
type: 'select',
name: '状态',
options: [
{ label: '进行中', value: 0 },
{ label: '完成', value: 1 },
{ label: '失败', value: 2 }
]
}
],
accountTypeList: [],
receiverTypeList: [],
currencyTypeList: [],
......@@ -444,6 +445,11 @@ export default {
validator: (rule, value, callback) => {
if (value <= 0) {
callback(new Error('日限额必须大于0'))
} else if (
this.addFormData.monthlySumLimited &&
value >= this.addFormData.monthlySumLimited
) {
callback(new Error('日限额必须小于月限额'))
} else {
callback()
}
......@@ -458,6 +464,11 @@ export default {
validator: (rule, value, callback) => {
if (value <= 0) {
callback(new Error('月限额必须大于0'))
} else if (
this.addFormData.daySumLimited &&
value <= this.addFormData.daySumLimited
) {
callback(new Error('月限额必须大于日限额'))
} else {
callback()
}
......@@ -488,7 +499,12 @@ export default {
type: '',
currentRow: null,
securityVisible: false,
securityFormData: {},
securityFormData: {
phone: '',
mailbox: '',
code: '',
superPassword: ''
},
securitySetting: {},
securityFormRules: {
securityCode: [
......@@ -521,6 +537,8 @@ export default {
this.currentRow.name
}账户`
: ''
case 'delete':
return `删除${this.currentRow.name}账户`
default:
return ''
}
......@@ -634,12 +652,57 @@ export default {
<i
title="删除"
class="el-icon-delete"
onClick={() => this.getLog(item.id)}
onClick={() => this.handleDelete(item)}
style="cursor: pointer; color: #F56C6C"></i>
</div>
)
}
]
},
queryformConfig() {
return [
{
prop: 'name',
type: 'input',
name: '账户名称'
},
{
prop: 'accountType',
type: 'select',
name: '账户类型',
options: this.accountTypeList.map((item) => ({
label: item.remark,
value: item.code
}))
},
{
prop: 'receiverType',
type: 'select',
name: '收款方式',
options: this.receiverTypeList.map((item) => ({
label: item.remark,
value: item.code
}))
},
{
prop: 'currencyType',
type: 'select',
name: '币种',
options: this.currencyTypeList.map((item) => ({
label: item.currencyName,
value: item.currencyCode
}))
},
{
prop: 'isEnable',
type: 'select',
name: '状态',
options: [
{ label: '启用', value: 1 },
{ label: '禁用', value: 0 }
]
}
]
}
},
methods: {
......@@ -663,81 +726,52 @@ export default {
}
this.getList()
},
// 提取公共的 API 请求处理方法
async fetchData(url, method = 'get', data = null) {
try {
const res = await axios({ method, url, data })
if (res.code === 200) {
return res.data
} else {
this.$message.error(res.message)
return null
}
} catch (error) {
this.$message.error(`${method === 'get' ? '获取' : '操作'}失败`)
return null
}
},
// 获取账户类型列表
async getAccountTypeList() {
const data = await this.fetchData('baseProceedsAccount/accountTypeList')
if (data) this.accountTypeList = data
const res = await getAccountTypeListApi()
this.accountTypeList = res.data
},
// 收款方式
async getReceiverTypeList() {
const data = await this.fetchData('baseProceedsAccount/receiverTypeList')
if (data) this.receiverTypeList = data
const res = await getReceiverTypeListApi()
this.receiverTypeList = res.data
},
// 币种列表
async getCurrencyTypeList() {
const data = await this.fetchData('manage/rest/baseCurrencyInfo/uniList')
if (data) this.currencyTypeList = data
const res = await getCurrencyTypeListApi()
this.currencyTypeList = res.data
},
// 获取安全设置信息
async getSecuritySetting() {
const data = await this.fetchData('sysSecuritySettings/getOne')
if (data) {
this.securitySetting = data
this.securityFormData.phone = data.phone || ''
this.securityFormData.mailbox = data.mailbox || ''
}
const res = await getSecuritySettingApi()
this.securitySetting = res.data
this.securityFormData.phone = res.data.phone || ''
this.securityFormData.mailbox = res.data.mailbox || ''
},
// 查询
async getList() {
this.loading = true
const { pageSize, currentPage } = this.paginationOptions
const data = await this.fetchData(
'baseProceedsAccount/list_page',
'post',
{
pageSize,
currentPage,
...this.queryFormData
}
)
if (data) {
this.sourceData = data.records
this.paginationOptions.total = data.total
}
const res = await getBaseProceedsAccountListApi({
pageSize,
currentPage,
...this.queryFormData
})
this.sourceData = res.data.records
this.paginationOptions.total = res.data.total
this.loading = false
},
// 获取详情
async getDetails(id) {
const data = await this.fetchData(`baseProceedsAccount/get?id=${id}`)
if (data) {
this.detailFormData = data
this.detailVisible = true
}
const res = await getBaseProceedsAccountDetailApi(id)
this.detailFormData = res.data
this.detailVisible = true
},
// 获取日志
async getLog(id) {
const data = await this.fetchData(
`baseProceedsAccountLog/getList?relaId=${id}`
)
if (data) {
this.logFormData = data
this.logVisible = true
}
const res = await getBaseProceedsAccountLogApi(id)
this.logFormData = res.data
this.logVisible = true
},
// 提交
submit() {
......@@ -749,6 +783,9 @@ export default {
case 'changeStatus':
this.submitStatusChange()
break
case 'delete':
this.deleteSubmit()
break
}
},
// 验证安全验证方式
......@@ -788,21 +825,22 @@ export default {
},
// 提交启用状态变化
async submitStatusChange() {
const data = await this.fetchData(
'baseProceedsAccount/updateEnable',
'post',
{
try {
const res = await updateBaseProceedsAccountEnableApi({
id: this.currentRow.id,
isEnable: this.currentRow.isEnable ? 0 : 1,
checkType: this.currentMethod,
...this.securityFormData,
operateType: this.operateType
})
if (res.code === 200) {
this.$message.success(res.message)
this.securityVisible = false
this.getList()
}
)
if (data) {
this.$message.success(data.message || '操作成功')
this.securityVisible = false
this.getList()
} catch (error) {
console.log(error)
}
},
// 新增 打开弹窗
......@@ -826,11 +864,11 @@ export default {
},
// 新增 提交
async addSubmit() {
const url =
const apiMethod =
this.type === 'add'
? 'baseProceedsAccount/add'
: 'baseProceedsAccount/update'
const data = await this.fetchData(url, 'post', {
? addBaseProceedsAccountApi
: updateBaseProceedsAccountApi
const data = await apiMethod({
...this.addFormData,
checkType: this.currentMethod,
...this.securityFormData,
......@@ -845,6 +883,33 @@ export default {
}
},
// 删除 打开弹窗
async handleDelete(row) {
this.type = 'delete'
this.currentMethod = 'superPassword'
this.currentRow = row
if (this.setVerificationMethod()) {
this.securityVisible = true
}
},
// 删除 提交
async deleteSubmit() {
try {
const res = await deleteBaseProceedsAccountApi({
id: this.currentRow.id,
checkType: this.currentMethod,
...this.securityFormData
})
if (res.code === 200) {
this.$message.success(res.message)
this.securityVisible = false
this.getList()
}
} catch (error) {
console.log(error)
}
},
// 新增 重置表单
resetForm() {
Object.assign(this.addFormData, {
......@@ -862,9 +927,20 @@ export default {
isEnable: false
})
this.$nextTick(() => {
if (this.$refs.addForm) {
this.$refs.addForm.clearValidate()
}
this.$refs.addForm.clearValidate()
})
},
// 安全验证表单重置
resetSecurityForm() {
Object.assign(this.securityFormData, {
code: '',
superPassword: '',
phone: this.securitySetting.phone || '',
mailbox: this.securitySetting.mailbox || ''
})
this.$nextTick(() => {
this.$refs.securityForm.clearValidate()
})
},
// 发送验证码
......@@ -888,20 +964,20 @@ export default {
}
}
countdownFn()
const url =
this.currentMethod === 'phone'
? '/sysSecuritySettings/sendPhoneCode'
: `/sysSecuritySettings/sendEmailCode?email=${this.securityFormData.mailbox}&operateType=${this.operateType}`
const data = await this.fetchData(
url,
this.currentMethod === 'phone' ? 'post' : 'get',
this.currentMethod === 'phone'
? {
phone: this.securityFormData.phone,
operateType: this.operateType
}
: null
)
let data
if (this.currentMethod === 'phone') {
data = await sendPhoneCodeApi({
phone: this.securityFormData.phone,
operateType: this.operateType
})
} else {
data = await sendEmailCodeApi(
this.securityFormData.mailbox,
this.operateType
)
}
if (data) {
this.$message.success('验证码发送成功')
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment