index.vue
3.57 KB
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
146
147
148
149
150
151
<template>
<div class="container">
<div class="config-card">
<h2 class="config-title">上传证件配置</h2>
<p class="config-desc">此开关用于配置用户提现时是否要上传身份证正反面</p>
<div class="table-container">
<GLTable :tableData="tableData" :tableParams="tableParams" :hasPage="false" :hasNum="false">
<template slot="switchSlot" slot-scope="scope">
<!-- <el-switch v-model="scope.scope.enabled" active-text="启用" inactive-text="停用"></el-switch> -->
<el-switch v-model="scope.scope.enabled"></el-switch>
<div class="switch-txt">{{ scope.scope.enabled ? '启用' : '停用' }}</div>
</template>
</GLTable>
</div>
<div class="form-actions">
<el-button type="primary" size="small" @click="handleConfirm">保存</el-button>
</div>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
props: {},
data() {
return {
url: url,
tableData: [
{ channelCode: 2, channelName: '续保用户', enabled: false },
{ channelCode: 1, channelName: '阳光激励用户', enabled: false },
{ channelCode: 3, channelName: '管理层', enabled: false }
],
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '渠道名称',
prop: 'channelName'
},
{
label: '上传身份证',
prop: 'enabled',
addHtml: 'switchSlot'
}
]
}
}
},
mounted() {
this.getConfig()
},
methods: {
getConfig() {
this.$apis.ruleConfig.getUpDocConfig({}).then(res => {
res.forEach(item => {
let idx = this.tableData.findIndex(i => i.channelCode == item.channelCode)
this.tableData[idx].id = item.id
// isEnabled 是否打开:0-关闭,1-打开
this.tableData[idx].enabled = !!item.isEnabled
})
})
},
handleConfirm() {
let params = {
uploadDocumentConfigRequestList: []
}
this.tableData.forEach(item => {
params.uploadDocumentConfigRequestList.push({
channelCode: item.channelCode,
id: item.id,
isEnabled: item.enabled ? 1 : 0
})
})
this.$apis.ruleConfig.updateUpDocConfig(params).then(res => {
let { code, message } = res
code == 0 ? this.$message.success('配置成功!') : this.$message.error(message)
})
}
}
}
</script>
<style scoped lang='scss'>
.container {
padding: 20px;
.switch-txt {
display: inline-block;
margin-left: 8px;
}
.config-card {
background: #fff;
border-radius: 4px;
padding: 20px;
position: relative;
.config-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 8px;
}
.config-desc {
color: #909399;
font-size: 14px;
margin-bottom: 20px;
}
.table-container {
width: 580px;
margin-bottom: 20px;
}
.config-table {
width: 100%;
border-collapse: collapse;
th,
td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ebeef5;
}
th {
background-color: #f5f7fa;
color: #606266;
font-weight: 500;
}
tr:last-child td {
border-bottom: none;
}
td:first-child {
color: #606266;
width: 150px;
}
}
.form-actions {
margin-top: 30px;
text-align: left;
}
}
}
</style>