index.vue
6.61 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<template>
<div>
<el-button type="primary" :size="'small'" @click="handleOpen">添加白名单
</el-button>
<div class="ctnr">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchFormWhite" :searchSelectObj="searchSelectObj"
:formData="searchFormData" @handleOk="selConfig" @handleRest="selConfig('reset')"></GLCombiForm>
<div class="operate-wrap">
<div class="table-title1">白名单列表
<p class="table-des">门店助手小程序的积分提现功能对白名单下的门店可见,其门店员工可进行积分提现。</p>
</div>
<div class="operate-btn">
</div>
</div>
<GLTable @setTableFinishFun="setTableFinishFun" ref="table" :pageConf="pageConf" :searchForm="searchFormWhite"
:tableParams="tableParams" :getListApi="getListApi">
<div slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<whiteStore v-if="relateStoreVisible" ref="relateStore" :relateStoreVisible="relateStoreVisible"
:storeApi="storeApi" :storeSearchForm="searchForm" :storeSelected="tableData"
@handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose">
<div slot class="header">
<el-form :model="searchForm" ref="relate" :inline="true" label-width="90px" class="configDialog">
<el-form-item>
<el-input placeholder="请输入内容" clear v-model="searchForm.selectInput" class="input-with-select"
size="small">
<el-select v-model="searchForm.select" slot="prepend" placeholder="请选择">
<el-option label="商户名称" value="1"></el-option>
<el-option label="商户号" value="2"></el-option>
</el-select>
</el-input>
</el-form-item>
<el-form-item style="margin-top: -1px;margin-left:-16px;">
<el-button size="small" type="primary" @click="handleSearchStore">查询</el-button>
</el-form-item>
</el-form>
</div>
</whiteStore>
</div>
</div>
</template>
<script>
import whiteStore from "views/whiteList/components/whiteStore";
export default {
name: "index",
components: {
whiteStore
},
data() {
return {
searchForm: {
select:'1'
},
searchFormWhite: {
selectMerchantName:'',
selectMerchantId:''
},
storeApi: this.$apis.whiteList.subscribeMerchant,
tableData: [],
selectedList: [],
relateStoreVisible: false,
searchSelectObj: {
idOrName: {
attr: 'selectMerchantName',
value: ''
}
},
searchFormData: [
{
type: 'selectInput',
selectName: 'idOrName',
isClear: true,
inputWidth: '325px',
selectWidth: '110px',
selectOption: [
{
label: '商户名称',
name: 'selectMerchantName'
},
{
label: '商户号',
name: 'selectMerchantId'
}
],
handleSelectChange: value => {
this.searchSelectObj.idOrName.value = ''
}
},
],
getListApi: this.$apis.whiteList.whiteListPage,
pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'},
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '商户名称',
minWidth: 300,
prop: 'merchantName'
},
{
label: '商户号',
prop: 'merchantId',
width: 250,
},
{
label: '配置时间',
prop: 'configTime',
width: 180
}
]
},
buttonList: [
{
type: 'el-button',
name: '删除',
attrs: {
type: 'text',
fn: '删除'
},
listeners: {
click: row => this.handleDel(row.scope)
}
}
],
}
},
methods: {
handleDel(scope) {
const params = {
ids: [scope.id]
}
this.$confirm(`是否确认删除${scope.merchantName} ?`, '提示', {
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis.whiteList.whiteListDelete(params).then(res => {
if (res) {
this.$message.success('操作成功')
this.selConfig()
}
})
}
}
})
},
selConfig(e) {
if (e == 'reset') {
this.searchFormWhite = {
selectMerchantName:'',
selectMerchantId:''
}
this.searchSelectObj = {
idOrName: {
attr: 'selectMerchantName',
value: ''
}
}
}
this.searchFormWhite[this.searchSelectObj.idOrName.attr] = this.searchSelectObj.idOrName.value
this.$refs.table.refreshTable()
},
handleOpen() {
this.tableData = []
this.relateStoreVisible = !this.relateStoreVisible
},
handleRelateStoreConfirm(selectedData) {
this.merchantList = []
selectedData.forEach(item => {
this.merchantList.push({
merchantId: item.merchantId,
merchantName: item.merchantName,
})
})
this.tableData = selectedData
const params = {
merchantList: [...this.merchantList]
}
this.$apis.whiteList.whiteListSave(params).then(res => {
if (res) {
this.$message.success('操作成功')
this.selConfig()
}
})
this.handleRelateStoreClose()
},
//搜索门店table
handleSearchStore() {
this.$refs.relateStore.handleCurrentChange(1)
},
handleRelateStoreClose() {
this.relateStoreVisible = false
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.table.data.length ? (this.$refs.table.tableHeightValues = '') : this.$refs.table.setTableHeightFun()
},
}
}
</script>
<style scoped lang="scss">
.ctnr {
margin-top: 16px;
background-color: #fff;
padding: 20px;
}
.operate-wrap{
.table-title1{
display: flex;
height: 32px;
font-weight: 600;
font-size: 16px;
color: #333;
line-height: 32px;
.table-des{
line-height: 34px;
margin-left: 8px;
font-weight: 400;
color: #666666;
font-size: 14px;
}
}
}
</style>