新版交易所前段管理后台
1
5 days ago b4dd0687c7285f3be32860adccfa523a62bfd4c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<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>