Browse Source

完善用户账户用前端页面操作控制,添加账户冻结和解冻功能

main
TonyStark 2 months ago
parent
commit
c0adf0e8e7
  1. 7
      src/api/business/userAccount.js
  2. 166
      src/views/business/userAccount/index.vue
  3. 39
      src/views/business/userRegister/index.vue
  4. 7
      src/views/business/userRegister/indexBus.vue

7
src/api/business/userAccount.js

@ -36,9 +36,10 @@ export function updateUserAccount(data) {
}
// 删除用户账户
export function delUserAccount(id) {
export function lockAccount(data) {
return request({
url: '/business/userAccount/' + id,
method: 'delete'
url: '/business/userAccount/lockAccount',
method: 'delete',
data: data
})
}

166
src/views/business/userAccount/index.vue

@ -1,15 +1,29 @@
<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.userAccount.accountName')" prop="accountName">
<el-input v-model="queryParams.accountName" :placeholder="$t('business.userAccount.accountNamePlaceholder')"
<el-form-item :label="$t('business.userAccount.accountCode')" prop="accountCode">
<el-input v-model="queryParams.accountCode" :placeholder="$t('business.userAccount.inputAccountCode')"
clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item :label="$t('common.tableMsg.createTime')">
<el-date-picker v-model="daterangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
type="daterange" range-separator="-" :start-placeholder="$t('common.tableMsg.startDate')"
:end-placeholder="$t('common.tableMsg.endDate')"
:default-time="['00:00:00', '23:59:59']"></el-date-picker>
<el-form-item label="账户类型" prop="accountType">
<el-select v-model="queryParams.accountType" size="medium" placeholder="请选择账户类型">
<el-option
v-for="item in options_accountType"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="账户状态" prop="status">
<el-select v-model="queryParams.status" size="medium" placeholder="请选择账户状态">
<el-option
v-for="item in options_accountStatus"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{
@ -21,21 +35,11 @@
</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:userAccount: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:userAccount: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:userAccount: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:userAccount:export']">{{ $t('common.button.export') }}
@ -46,27 +50,51 @@
<el-table v-loading="loading" :data="userAccountList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column :label="$t('business.userAccount.accountId')" align="center" prop="accountId"/>
<el-table-column label="用户名称" align="center">
<template #default="scope">
<span v-if="scope.row.userType == 0">{{ scope.row.userInfoName }}</span>
<span v-if="scope.row.userType == 1">{{ scope.row.merchantName }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('business.userAccount.accountCode')" align="center" prop="accountCode"/>
<el-table-column :label="$t('business.userAccount.accountName')" align="center" prop="accountName"/>
<el-table-column :label="$t('business.userAccount.accountAmount')" align="center" prop="accountAmount"/>
<el-table-column
:label="$t('business.userAccount.accountAmount')"
prop="accountAmount"
:formatter="formatCurrency">
</el-table-column>
<el-table-column label="账户类型" align="center" prop="accountType">
<template slot-scope="scope">
<el-tag v-if="scope.row.accountType == 0">普通账户</el-tag>
<el-tag type="warning" v-if="scope.row.accountType == 1">商企账户</el-tag>
</template>
</el-table-column>
<el-table-column label="账户级别" align="center" prop="isPrimary">
<template slot-scope="scope">
<el-tag type="warning" v-if="scope.row.isPrimary == 0">主账户</el-tag>
<el-tag v-if="scope.row.isPrimary == 1">子账户</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('business.userAccount.status')" align="center" prop="status">
<template slot-scope="scope">
<el-tag v-if="scope.row.status == '0'">{{ $t('business.userAccount.statusNormal') }}</el-tag>
<el-tag type="danger" v-if="scope.row.status == '1'">{{ $t('business.userAccount.statusFrozen') }}</el-tag>
<el-tag type="success" v-if="scope.row.status == 0">{{ $t('business.userAccount.statusNormal') }}</el-tag>
<el-tag type="danger" v-if="scope.row.status == 1">{{ $t('business.userAccount.statusFrozen') }}</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('common.button.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 size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)" v-if="(scope.row.id == null)"
v-hasPermi="['business:userAccount:edit']">创建
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-if="(scope.row.id != null)"
v-hasPermi="['business:userAccount:edit']">{{ $t('common.button.edit') }}
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['business:userAccount:remove']">{{ $t('common.button.delete') }}
<el-button size="mini" type="text" icon="el-icon-lock" @click="accountLock(scope.row)" v-if="(scope.row.id != null && scope.row.status == 0)"
v-hasPermi="['business:userAccount:remove']">冻结
</el-button>
<el-button size="mini" type="text" icon="el-icon-lock" @click="accountUnlock(scope.row)" v-if="(scope.row.id != null && scope.row.status == 1)"
v-hasPermi="['business:userAccount:remove']">解冻
</el-button>
</template>
</el-table-column>
@ -78,17 +106,18 @@
<!-- 添加或修改用户账户对话框 -->
<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.userAccount.detailAccountId')" prop="accountId">
<el-input v-model="form.accountId" :placeholder="$t('business.userAccount.inputAccountId')"/>
</el-form-item>
<el-form-item :label="$t('business.userAccount.detailAccountCode')" prop="accountCode">
<el-input v-model="form.accountCode" :placeholder="$t('business.userAccount.inputAccountCode')"/>
</el-form-item>
<el-form-item :label="$t('business.userAccount.detailAccountName')" prop="accountName">
<el-input v-model="form.accountName" :placeholder="$t('business.userAccount.inputAccountName')"/>
</el-form-item>
<el-form-item :label="$t('business.userAccount.detailAccountAmount')" prop="accountAmount">
<el-input v-model="form.accountAmount" :placeholder="$t('business.userAccount.inputAccountAmount')"/>
<el-form-item label="账户级别" prop="isPrimary">
<el-select v-model="form.isPrimary" placeholder="请选择账户级别">
<el-option
v-for="item in options_accountLevel"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -103,9 +132,6 @@
<!-- 用户账户详情显示框 -->
<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.userAccount.detailAccountIdLabel')">
{{ form.accountId }}
</el-form-item>
<el-form-item :label="$t('business.userAccount.detailAccountCodeLabel')">
{{ form.accountCode }}
</el-form-item>
@ -127,9 +153,9 @@
import {
listUserAccount,
getUserAccount,
delUserAccount,
addUserAccount,
updateUserAccount
updateUserAccount,
lockAccount
} from "@/api/business/userAccount";
export default {
@ -171,6 +197,7 @@ export default {
accountCode: undefined,
accountName: undefined,
accountAmount: undefined,
accountType: undefined,
status: undefined,
createTime: undefined,
updateTime: undefined
@ -178,7 +205,28 @@ export default {
//
form: {},
//
rules: {}
rules: {},
options_accountLevel: [{
value: "0",
label: '主账户'
}, {
value: "1",
label: '子账户'
}],
options_accountType: [{
value: 0,
label: '普通账户'
}, {
value: 1,
label: '企业账户'
}],
options_accountStatus: [{
value: 0,
label: '正常'
}, {
value: 1,
label: '冻结'
}],
};
},
created() {
@ -246,8 +294,9 @@ export default {
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
handleAdd(row) {
this.reset();
this.form = row;
this.open = true;
this.title = this.$t('business.userAccount.addTitle');
},
@ -295,16 +344,31 @@ export default {
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm(this.$t('common.button.deleteConfirm')).then(() => {
/** 冻结按钮操作 */
accountLock(row) {
this.$modal.confirm('是否要对账户”' + row.accountName + '“进行冻结?').then(() => {
this.loading = true;
return delUserAccount(ids);
row.status = 1;
return lockAccount(row);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess(this.$t('common.button.deleteSuccess'));
this.$modal.msgSuccess('账户“'+ row.accountName + '”已冻结!');
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/**解冻按钮操作**/
accountUnlock(row) {
this.$modal.confirm('是否解除账户”' + row.accountName + '“的冻结状态?').then(() => {
this.loading = true;
row.status = 0;
return lockAccount(row);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess('已解除对账户“'+ row.accountName + '”的冻结状态!');
}).catch(() => {
}).finally(() => {
this.loading = false;
@ -315,6 +379,14 @@ export default {
this.download('business/userAccount/export', {
...this.queryParams
}, `userAccount_${new Date().getTime()}.xlsx`)
},
/**格式化金额*/
formatCurrency(row, column) {
return new Intl.NumberFormat('zh-CN', {
style: 'currency',
currency: 'CNY',
minimumFractionDigits: 2
}).format(row[column.property]);
}
}
};

39
src/views/business/userRegister/index.vue

@ -111,12 +111,7 @@
</template>
</el-table-column>
<el-table-column :label="$t('userManager.userRegister.phone')" align="center" prop="phone"/>
<el-table-column :label="$t('userManager.userRegister.address')" align="center">
<template #default="scope">
<span v-if="scope.row.userType == '0'">{{ scope.row.addressInfo }}</span>
<span v-if="scope.row.userType == '1'">{{ scope.row.address }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('userManager.userRegister.address')" align="center" prop="addressInfo"/>
<el-table-column :label="$t('common.button.operation')" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-if="(scope.row.addressInfo == '')"
@ -273,38 +268,6 @@
</div>
</el-dialog>
<!-- 添加或修改用户信息-商户扩展对话框 -->
<el-dialog :title="title" :visible.sync="openInfoBus" width="700px" append-to-body>
<el-form ref="formInfoBus" :model="formInfoBus" :rules="rules" label-width="auto">
<el-form-item label="营业执照" prop="license">
<el-input v-model="formInfoBus.license" placeholder="请输入营业执照"/>
</el-form-item>
<el-form-item label="其它证照信息" prop="licenseOther">
<el-input v-model="formInfoBus.licenseOther" placeholder="请输入其它证照信息"/>
</el-form-item>
<el-form-item label="法人姓名" prop="legalPerson">
<el-input v-model="formInfoBus.legalPerson" placeholder="请输入法人姓名"/>
</el-form-item>
<el-form-item label="营业状态" prop="operateStatus">
<el-select v-model="formInfoBus.operateStatus" placeholder="请选择营业状态">
<el-option
v-for="item in options_operateStatus"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="经营地址" prop="operateAddr">
<el-input v-model="formInfoBus.operateAddr" placeholder="请输入经营地址"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitFormInfoBus"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 用户注册详情-个人 -->
<el-dialog :title="title" :visible.sync="detailOpen" width="700px" append-to-body>
<el-form ref="formDetail" :model="formDetail" label-width="auto">

7
src/views/business/userRegister/indexBus.vue

@ -105,12 +105,7 @@
</template>
</el-table-column>
<el-table-column label="联系电话" align="center" prop="phone" />
<el-table-column label="地址" align="center">
<template #default="scope">
<span v-if="scope.row.userType == '0'">{{ scope.row.addressInfo }}</span>
<span v-if="scope.row.userType == '1'">{{ scope.row.address }}</span>
</template>
</el-table-column>
<el-table-column label="地址" align="center" prop="address" />
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-if="(scope.row.addressInfo == '' && scope.row.userType == '0') || (scope.row.address == '' && scope.row.userType == '1')"

Loading…
Cancel
Save