4 changed files with 765 additions and 125 deletions
@ -0,0 +1,44 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 查询钱包限制配置列表
|
|||
export function listWalletLimitConfig(query) { |
|||
return request({ |
|||
url: '/business/walletLimitConfig/list', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
|||
|
|||
// 查询钱包限制配置详细
|
|||
export function getWalletLimitConfig(id) { |
|||
return request({ |
|||
url: '/business/walletLimitConfig/' + id, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 新增钱包限制配置
|
|||
export function addWalletLimitConfig(data) { |
|||
return request({ |
|||
url: '/business/walletLimitConfig', |
|||
method: 'post', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 修改钱包限制配置
|
|||
export function updateWalletLimitConfig(data) { |
|||
return request({ |
|||
url: '/business/walletLimitConfig', |
|||
method: 'put', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 删除钱包限制配置
|
|||
export function delWalletLimitConfig(id) { |
|||
return request({ |
|||
url: '/business/walletLimitConfig/' + id, |
|||
method: 'delete' |
|||
}) |
|||
} |
@ -0,0 +1,512 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!-- 搜索列 --> |
|||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
|||
<el-form-item :label="$t('business.deal.limit.wallet.userType')" prop="userType" label-width="100px"> |
|||
<el-select v-model="queryParams.userType" :placeholder="$t('business.deal.limit.wallet.selectUserType')" |
|||
clearable filterable> |
|||
<el-option |
|||
v-for="item in userTypeOptions" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item :label="$t('business.deal.limit.wallet.isActive')" prop="isActive" label-width="150px"> |
|||
<el-select v-model="queryParams.isActive" :placeholder="$t('business.deal.limit.wallet.selectIsActive')" |
|||
clearable filterable> |
|||
<el-option |
|||
v-for="item in isActiveOptions" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"> |
|||
{{ $t('common.button.search') }} |
|||
</el-button> |
|||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('common.button.reset') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-row :gutter="10" class="mb8"> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="primary" |
|||
plain |
|||
icon="el-icon-plus" |
|||
size="mini" |
|||
@click="handleAdd" |
|||
v-hasPermi="['business:walletLimitConfig:add']" |
|||
>{{ $t('common.button.add') }} |
|||
</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="success" |
|||
plain |
|||
icon="el-icon-edit" |
|||
size="mini" |
|||
:disabled="single" |
|||
@click="handleUpdate" |
|||
v-hasPermi="['business:walletLimitConfig:edit']" |
|||
>{{ $t('common.button.edit') }} |
|||
</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="danger" |
|||
plain |
|||
icon="el-icon-delete" |
|||
size="mini" |
|||
:disabled="multiple" |
|||
@click="handleDelete" |
|||
v-hasPermi="['business:walletLimitConfig:remove']" |
|||
>{{ $t('common.button.delete') }} |
|||
</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="warning" |
|||
plain |
|||
icon="el-icon-download" |
|||
size="mini" |
|||
@click="handleExport" |
|||
v-hasPermi="['business:walletLimitConfig:export']" |
|||
>{{ $t('common.button.export') }} |
|||
</el-button> |
|||
</el-col> |
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
|||
</el-row> |
|||
|
|||
<!-- 表格列 --> |
|||
<el-table v-loading="loading" :data="walletLimitConfigList" @selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" width="55" align="center"/> |
|||
<el-table-column :label="$t('business.deal.limit.wallet.ruleId')" align="center" prop="id" v-if="true"/> |
|||
<el-table-column :label="$t('business.deal.limit.wallet.userType')" align="center" prop="userType"> |
|||
<template slot-scope="scope"> |
|||
<!-- <dict-tag :options="userTypeOptions || []" :value="scope.row.userType"/>--> |
|||
{{ scope.row.userType === 0 ? '个人' : (scope.row.userType === 1 ? '商户' : '代理')}} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column :label="$t('business.deal.limit.wallet.maxBalance')" align="center" prop="maxBalance"> |
|||
<template slot-scope="scope"> |
|||
{{ formatBalance(scope.row.maxBalance) }} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column :label="$t('business.deal.limit.wallet.isActive')" align="center" prop="isActive"> |
|||
<template slot-scope="scope"> |
|||
<!-- <dict-tag :options="isActiveOptions || []" :value="scope.row.isActive"/>--> |
|||
{{ scope.row.isActive === 1 ? '是' : '否'}} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column :label="$t('common.tableMsg.operation')" align="center" width="200" |
|||
class-name="small-padding fixed-width"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-view" |
|||
@click="handleDetail(scope.row)" |
|||
>{{ $t('common.button.detail') }} |
|||
</el-button> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-edit" |
|||
@click="handleUpdate(scope.row)" |
|||
v-hasPermi="['business:walletLimitConfig:edit']" |
|||
>{{ $t('common.button.edit') }} |
|||
</el-button> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-delete" |
|||
@click="handleDelete(scope.row)" |
|||
v-hasPermi="['business:walletLimitConfig:remove']" |
|||
>{{ $t('common.button.delete') }} |
|||
</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<pagination |
|||
v-show="total>0" |
|||
:total="total" |
|||
:page.sync="queryParams.pageNum" |
|||
:limit.sync="queryParams.pageSize" |
|||
@pagination="getList" |
|||
/> |
|||
|
|||
<!-- 添加或修改钱包限制配置对话框 --> |
|||
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> |
|||
<el-form ref="form" :model="form" :rules="rules" label-width="auto"> |
|||
<el-form-item :label="$t('business.deal.limit.wallet.userType')" prop="userType"> |
|||
<el-select v-model="form.userType" :placeholder="$t('business.deal.limit.wallet.selectUserType')"> |
|||
<el-option |
|||
v-for="item in userTypeOptions" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="$t('business.deal.limit.wallet.maxBalance')" prop="maxBalance"> |
|||
<el-input-number |
|||
v-model="form.maxBalanceValue" |
|||
:min="0" |
|||
:precision="2" |
|||
:step="1" |
|||
controls-position="right" |
|||
style="width: 200px" |
|||
:placeholder="$t('business.deal.limit.wallet.inputMaxBalance')" |
|||
/> |
|||
<el-select |
|||
v-model="form.maxBalanceUnit" |
|||
style="width: 100px; margin-left: 10px" |
|||
:placeholder="$t('business.deal.limit.wallet.selectUnit')" |
|||
@change="handleUnitChange" |
|||
> |
|||
<el-option :label="$t('business.deal.limit.wallet.hundred')" value="100"/> |
|||
<el-option :label="$t('business.deal.limit.wallet.thousand')" value="1000"/> |
|||
<el-option :label="$t('business.deal.limit.wallet.tenThousand')" value="10000"/> |
|||
<el-option :label="$t('business.deal.limit.wallet.hundredThousand')" value="100000"/> |
|||
<el-option :label="$t('business.deal.limit.wallet.million')" value="1000000"/> |
|||
<el-option :label="$t('business.deal.limit.wallet.tenMillion')" value="10000000"/> |
|||
<el-option :label="$t('business.deal.limit.wallet.hundredMillion')" value="100000000"/> |
|||
<el-option :label="$t('business.deal.limit.wallet.billion')" value="1000000000"/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item :label="$t('business.deal.limit.wallet.isActive')" prop="isActive"> |
|||
<el-select v-model="form.isActive" :placeholder="$t('business.deal.limit.wallet.selectIsActive')" |
|||
clearable filterable> |
|||
<el-option |
|||
v-for="item in isActiveOptions" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> |
|||
{{ $t('common.button.confirm') }} |
|||
</el-button> |
|||
<el-button @click="cancel">{{ $t('common.button.cancel') }}</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
<!-- 钱包限制配置详情 --> |
|||
<el-dialog :title="title" :visible.sync="detailOpen" width="700px" append-to-body> |
|||
<el-form ref="form" :model="form" label-width="auto"> |
|||
<el-form-item :label="$t('business.deal.limit.wallet.userType') + ':'"> |
|||
<dict-tag :options="userTypeOptions || []" :value="form.userType"/> |
|||
</el-form-item> |
|||
<el-form-item :label="$t('business.deal.limit.wallet.maxBalance') + ':'"> |
|||
{{ formatBalance(form.maxBalance) }} |
|||
</el-form-item> |
|||
<el-form-item :label="$t('business.deal.limit.wallet.isActive') + ':'"> |
|||
<dict-tag :options="isActiveOptions || []" :value="form.isActive"/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="cancel">{{ $t('common.button.close') }}</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
listWalletLimitConfig, |
|||
getWalletLimitConfig, |
|||
delWalletLimitConfig, |
|||
addWalletLimitConfig, |
|||
updateWalletLimitConfig |
|||
} from "@/api/business/walletLimitConfig"; |
|||
import DictTag from '@/components/DictTag'; |
|||
|
|||
export default { |
|||
name: "WalletLimitConfig", |
|||
components: { |
|||
DictTag |
|||
}, |
|||
data() { |
|||
return { |
|||
// 按钮loading |
|||
buttonLoading: false, |
|||
// 遮罩层 |
|||
loading: true, |
|||
// 选中数组 |
|||
ids: [], |
|||
// 非单个禁用 |
|||
single: true, |
|||
// 非多个禁用 |
|||
multiple: true, |
|||
// 显示搜索条件 |
|||
showSearch: true, |
|||
// 总条数 |
|||
total: 0, |
|||
// 钱包限制配置表格数据 |
|||
walletLimitConfigList: [], |
|||
// 弹出层标题 |
|||
title: "", |
|||
// 是否显示弹出层 |
|||
open: false, |
|||
// 是否显示详情弹出层 |
|||
detailOpen: false, |
|||
// 查询参数 |
|||
queryParams: { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
userType: undefined, |
|||
maxBalance: undefined, |
|||
isActive: undefined, |
|||
}, |
|||
userTypeOptions: [ |
|||
{ |
|||
label: this.$t('business.deal.limit.wallet.personal'), |
|||
value: 0, |
|||
raw: {listClass: "info"} |
|||
}, |
|||
{ |
|||
label: this.$t('business.deal.limit.wallet.merchant'), |
|||
value: 1, |
|||
raw: {listClass: "success"} |
|||
}, |
|||
{ |
|||
label: this.$t('business.deal.limit.wallet.agent'), |
|||
value: 2, |
|||
raw: {listClass: "warning"} |
|||
} |
|||
], |
|||
isActiveOptions: [ |
|||
{ |
|||
label: this.$t('business.deal.limit.wallet.yes'), |
|||
value: 1, |
|||
raw: {listClass: "success"} |
|||
}, |
|||
{ |
|||
label: this.$t('business.deal.limit.wallet.no'), |
|||
value: 0, |
|||
raw: {listClass: "danger"} |
|||
} |
|||
], |
|||
// 表单参数 |
|||
form: {}, |
|||
// 表单校验 |
|||
rules: { |
|||
id: [ |
|||
{required: true, message: this.$t('business.deal.limit.wallet.required'), trigger: "blur"} |
|||
], |
|||
userType: [ |
|||
{required: true, message: this.$t('business.deal.limit.wallet.userTypeRequired'), trigger: "change"} |
|||
], |
|||
maxBalanceValue: [ |
|||
{required: true, message: this.$t('business.deal.limit.wallet.maxBalanceRequired'), trigger: "blur"}, |
|||
{type: 'number', message: this.$t('business.deal.limit.wallet.maxBalanceNumber'), trigger: "blur"} |
|||
], |
|||
maxBalanceUnit: [ |
|||
{required: true, message: this.$t('business.deal.limit.wallet.unitRequired'), trigger: "change"} |
|||
], |
|||
isActive: [ |
|||
{required: true, message: this.$t('business.deal.limit.wallet.isActiveRequired'), trigger: "blur"} |
|||
], |
|||
createBy: [ |
|||
{required: true, message: this.$t('business.deal.limit.wallet.createByRequired'), trigger: "blur"} |
|||
], |
|||
updateBy: [ |
|||
{required: true, message: this.$t('business.deal.limit.wallet.updateByRequired'), trigger: "blur"} |
|||
], |
|||
} |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
}, |
|||
methods: { |
|||
formatBalance(balance) { |
|||
if (balance === undefined || balance === null) return '-'; |
|||
const units = [ |
|||
{value: 1000000000, label: this.$t('business.deal.limit.wallet.billion')}, |
|||
{value: 100000000, label: this.$t('business.deal.limit.wallet.hundredMillion')}, |
|||
{value: 10000000, label: this.$t('business.deal.limit.wallet.tenMillion')}, |
|||
{value: 1000000, label: this.$t('business.deal.limit.wallet.million')}, |
|||
{value: 100000, label: this.$t('business.deal.limit.wallet.hundredThousand')}, |
|||
{value: 10000, label: this.$t('business.deal.limit.wallet.tenThousand')}, |
|||
{value: 1000, label: this.$t('business.deal.limit.wallet.thousand')}, |
|||
{value: 100, label: this.$t('business.deal.limit.wallet.hundred')} |
|||
]; |
|||
|
|||
for (const unit of units) { |
|||
if (balance >= unit.value) { |
|||
return `${(balance / unit.value).toFixed(2)} ${unit.label}`; |
|||
} |
|||
} |
|||
return `${balance.toFixed(2)}`; |
|||
}, |
|||
/** 提交按钮 */ |
|||
handleUnitChange() { |
|||
if (this.form.maxBalanceValue !== undefined) { |
|||
this.form.maxBalance = this.form.maxBalanceValue * Number(this.form.maxBalanceUnit); |
|||
} |
|||
}, |
|||
submitForm() { |
|||
this.$refs["form"].validate(valid => { |
|||
if (valid) { |
|||
if (this.form.maxBalanceValue !== undefined) { |
|||
this.form.maxBalance = this.form.maxBalanceValue * Number(this.form.maxBalanceUnit); |
|||
} |
|||
this.buttonLoading = true; |
|||
if (this.form.id != null) { |
|||
updateWalletLimitConfig(this.form).then(response => { |
|||
this.$modal.msgSuccess(this.$t('business.deal.limit.wallet.updateSuccess')); |
|||
this.open = false; |
|||
this.getList(); |
|||
}).finally(() => { |
|||
this.buttonLoading = false; |
|||
}); |
|||
} else { |
|||
addWalletLimitConfig(this.form).then(response => { |
|||
this.$modal.msgSuccess(this.$t('business.deal.limit.wallet.addSuccess')); |
|||
this.open = false; |
|||
this.getList(); |
|||
}).finally(() => { |
|||
this.buttonLoading = false; |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
/** 查询钱包限制配置列表 */ |
|||
getList() { |
|||
this.loading = true; |
|||
listWalletLimitConfig(this.queryParams).then(response => { |
|||
this.walletLimitConfigList = response.rows; |
|||
this.total = response.total; |
|||
this.loading = false; |
|||
}); |
|||
}, |
|||
// 取消按钮 |
|||
cancel() { |
|||
this.open = false; |
|||
this.detailOpen = false; |
|||
this.reset(); |
|||
}, |
|||
// 表单重置 |
|||
reset() { |
|||
this.form = { |
|||
id: undefined, |
|||
userType: undefined, |
|||
maxBalance: undefined, |
|||
maxBalanceValue: undefined, |
|||
maxBalanceUnit: '10000', |
|||
isActive: undefined, |
|||
createBy: undefined, |
|||
updateBy: undefined, |
|||
createTime: undefined, |
|||
updateTime: undefined |
|||
}; |
|||
this.resetForm("form"); |
|||
}, |
|||
/** 搜索按钮操作 */ |
|||
handleQuery() { |
|||
this.queryParams.pageNum = 1; |
|||
this.getList(); |
|||
}, |
|||
/** 重置按钮操作 */ |
|||
resetQuery() { |
|||
this.resetForm("queryForm"); |
|||
this.handleQuery(); |
|||
}, |
|||
// 多选框选中数据 |
|||
handleSelectionChange(selection) { |
|||
this.ids = selection.map(item => item.id) |
|||
this.single = selection.length !== 1 |
|||
this.multiple = !selection.length |
|||
}, |
|||
/** 新增按钮操作 */ |
|||
handleAdd() { |
|||
this.reset(); |
|||
this.open = true; |
|||
this.title = this.$t('business.deal.limit.wallet.addTitle'); |
|||
}, |
|||
/** 详情按钮操作 */ |
|||
handleDetail(row) { |
|||
this.reset(); |
|||
this.form = row; |
|||
this.detailOpen = true; |
|||
this.title = this.$t('business.deal.limit.wallet.detailTitle'); |
|||
}, |
|||
/** 修改按钮操作 */ |
|||
handleUpdate(row) { |
|||
this.loading = true; |
|||
this.reset(); |
|||
const id = row.id || this.ids |
|||
getWalletLimitConfig(id).then(response => { |
|||
this.loading = false; |
|||
this.form = response.data; |
|||
// 设置金额和单位 |
|||
const units = [ |
|||
{value: 1000000000, label: this.$t('business.deal.limit.wallet.billion')}, |
|||
{value: 100000000, label: this.$t('business.deal.limit.wallet.hundredMillion')}, |
|||
{value: 10000000, label: this.$t('business.deal.limit.wallet.tenMillion')}, |
|||
{value: 1000000, label: this.$t('business.deal.limit.wallet.million')}, |
|||
{value: 100000, label: this.$t('business.deal.limit.wallet.hundredThousand')}, |
|||
{value: 10000, label: this.$t('business.deal.limit.wallet.tenThousand')}, |
|||
{value: 1000, label: this.$t('business.deal.limit.wallet.thousand')}, |
|||
{value: 100, label: this.$t('business.deal.limit.wallet.hundred')} |
|||
]; |
|||
|
|||
for (const unit of units) { |
|||
if (this.form.maxBalance >= unit.value) { |
|||
this.form.maxBalanceUnit = unit.value.toString(); |
|||
this.form.maxBalanceValue = this.form.maxBalance / unit.value; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
// 设置下拉选项的显示值 |
|||
const userType = this.userTypeOptions.find(item => item.value === this.form.userType); |
|||
if (userType) { |
|||
this.form.userTypeLabel = userType.label; |
|||
} |
|||
|
|||
const isActive = this.isActiveOptions.find(item => item.value === this.form.isActive); |
|||
if (isActive) { |
|||
this.form.isActiveLabel = isActive.label; |
|||
} |
|||
|
|||
this.open = true; |
|||
this.title = this.$t('business.deal.limit.wallet.editTitle'); |
|||
}); |
|||
}, |
|||
/** 删除按钮操作 */ |
|||
handleDelete(row) { |
|||
const ids = row.id || this.ids; |
|||
this.$modal.confirm(this.$t('business.deal.limit.wallet.deleteConfirm', {ids})).then(() => { |
|||
this.loading = true; |
|||
return delWalletLimitConfig(ids); |
|||
}).then(() => { |
|||
this.loading = false; |
|||
this.getList(); |
|||
this.$modal.msgSuccess(this.$t('business.deal.limit.wallet.deleteSuccess')); |
|||
}).catch(() => { |
|||
}).finally(() => { |
|||
this.loading = false; |
|||
}); |
|||
}, |
|||
/** 导出按钮操作 */ |
|||
handleExport() { |
|||
this.download('business/walletLimitConfig/export', { |
|||
...this.queryParams |
|||
}, `walletLimitConfig_${new Date().getTime()}.xlsx`) |
|||
} |
|||
} |
|||
}; |
|||
</script> |
Loading…
Reference in new issue