<template>
|
<div class="mod-role">
|
<avue-crud
|
ref="crud"
|
:page.sync="page"
|
:data="dataList"
|
:option="tableOption"
|
@on-load="getDataList"
|
@refresh-change="refreshChange"
|
>
|
<template slot="menuLeft">
|
<el-button type="primary" icon="el-icon-plus" size="small" @click="openDialog()">新增套餐</el-button>
|
</template>
|
<template slot-scope="scope" slot="menu">
|
<el-button type="primary" icon="el-icon-edit" size="small" @click="openDialog(scope.row)">编辑</el-button>
|
<el-button type="danger" icon="el-icon-delete" size="small" @click="deleteRow(scope.row)">删除</el-button>
|
</template>
|
</avue-crud>
|
|
<el-dialog :title="form.uuid ? '编辑贷款套餐' : '新增贷款套餐'" :visible.sync="visible" width="600px" append-to-body>
|
<el-form :model="form" label-width="130px">
|
<el-form-item label="借款天数">
|
<el-input-number v-model="form.term" :min="1" :max="365" />
|
</el-form-item>
|
<el-form-item label="最高额度(USDT)">
|
<el-input-number v-model="form.maxQuota" :min="0" :step="1000" />
|
</el-form-item>
|
<el-form-item label="日利率">
|
<el-input v-model="form.dailyRate" placeholder="如 0.001 表示 0.1%" />
|
</el-form-item>
|
<el-form-item label="放款机构名称">
|
<el-input v-model="form.lendingName" />
|
</el-form-item>
|
<el-form-item label="还款周期(天)">
|
<el-input-number v-model="form.repayCycle" :min="1" />
|
</el-form-item>
|
<el-form-item label="排序">
|
<el-input-number v-model="form.sortNum" :min="0" />
|
</el-form-item>
|
<el-form-item label="状态">
|
<el-select v-model="form.state">
|
<el-option label="启用" :value="1" />
|
<el-option label="停用" :value="0" />
|
</el-select>
|
</el-form-item>
|
</el-form>
|
<span slot="footer">
|
<el-button @click="visible = false">取消</el-button>
|
<el-button type="primary" @click="submitForm">确定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { tableOption } from "@/crud/finance/loan-config";
|
|
export default {
|
data() {
|
return {
|
dataList: [],
|
tableOption,
|
page: { total: 0, currentPage: 1, pageSize: 10 },
|
visible: false,
|
form: {
|
uuid: "",
|
term: 30,
|
maxQuota: 10000,
|
dailyRate: 0.001,
|
lendingInstitution: "1",
|
lendingName: "Platform Finance",
|
repayment: 1,
|
repayCycle: 30,
|
sortNum: 0,
|
state: 1,
|
},
|
};
|
},
|
methods: {
|
getDataList(page, done) {
|
this.$http({
|
url: this.$http.adornUrl("/normal/loanConfigAdmin!list.action"),
|
method: "get",
|
}).then(({ data }) => {
|
if (data.code === 0) {
|
this.dataList = data.data || [];
|
this.page.total = this.dataList.length;
|
}
|
if (done) done();
|
});
|
},
|
openDialog(row) {
|
if (row) {
|
this.form = { ...row };
|
} else {
|
this.form = {
|
uuid: "",
|
term: 30,
|
maxQuota: 10000,
|
dailyRate: 0.001,
|
lendingInstitution: "1",
|
lendingName: "Platform Finance",
|
repayment: 1,
|
repayCycle: 30,
|
sortNum: 0,
|
state: 1,
|
};
|
}
|
this.visible = true;
|
},
|
submitForm() {
|
this.$http({
|
url: this.$http.adornUrl("/normal/loanConfigAdmin!save.action"),
|
method: "get",
|
params: this.$http.adornParams(this.form),
|
}).then(({ data }) => {
|
if (data.code === 0) {
|
this.$message.success("保存成功");
|
this.visible = false;
|
this.getDataList();
|
} else {
|
this.$message.error(data.msg || "保存失败");
|
}
|
});
|
},
|
deleteRow(row) {
|
this.$confirm("确定删除该套餐?", "提示", { type: "warning" }).then(() => {
|
this.$http({
|
url: this.$http.adornUrl("/normal/loanConfigAdmin!delete.action"),
|
method: "get",
|
params: this.$http.adornParams({ uuid: row.uuid }),
|
}).then(({ data }) => {
|
if (data.code === 0) {
|
this.$message.success("删除成功");
|
this.getDataList();
|
}
|
});
|
});
|
},
|
refreshChange() {
|
this.getDataList();
|
},
|
},
|
};
|
</script>
|