Commit 0941c8a3 by wusiyi

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

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