serviceStore.vue
3.66 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
<!-- 服务4S店 -->
<template>
<d2-container class="commodity">
<el-form
:inline="true"
v-model="searchForm"
label-width="85px"
slot="header"
>
<el-form-item label="商品名称">
<el-input
v-model="searchForm.merchantName"
clearable
></el-input>
</el-form-item>
<el-form-item>
<el-button
:id="tableParams.btnId"
type="primary"
icon="el-icon-search"
>查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<d2-table-header>
<auth-button category="Button"></auth-button>
</d2-table-header>
<d2-table
ref="serviceStoreTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
</d2-container>
</template>
<script>
import { getList, deleteMerchant } from '@api/serviceStore'
import { mapActions } from 'vuex'
import { BaseData, djUserType, ghUserType } from '@/common/constants.js'
export default {
name: 'serviceStore',
data() {
return {
searchForm: {
merchantName: ''
},
getListApi: getList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [{
label: '登录账户',
prop: 'accountName'
}, {
label: '商户号',
prop: 'merchantId'
}, {
label: '商户名称',
prop: 'merchantName'
}, {
label: '商户简称',
prop: 'shortName'
}, {
label: '商户类型',
prop: 'userType',
formatter: (cellValue) => {
var typeAttr = {
1: djUserType,
2: ghUserType
}
return typeAttr[cellValue.channelType][cellValue.userType]
}
}, {
label: '联系人',
prop: 'contactName'
}, {
label: '手机号',
prop: 'phone'
}, {
label: '商户地址',
prop: 'address',
width: '200'
}, {
label: '更新时间',
prop: 'updatedDate'
}, {
label: '渠道',
prop: 'channelType',
formatter: (cellValue) => {
return this.baseData.channelType.find(item => item.value === cellValue.channelType).name
}
}]
},
baseData: {
channelType: []
}
}
},
components: {
},
created() {
this.getBaseData()
},
mounted() { },
methods: {
...mapActions('d2admin/base', ['get']),
beforeSearchFn() {
return new Promise(resolve => {
console.log('搜索前操作--')
resolve()
})
},
async getBaseData() {
this.baseData.channelType = await this.get(BaseData.CHANNELTYPE)
console.log(this.baseData.channelType)
},
handleReset() { },
handleAdd() {
// console.log(form)
},
handleDelete(row) {
console.log(row)
this.$confirm('是否要进行删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteMerchant({ id: row.id }).then(res => {
this.notice.okTips()
this.$refs.serviceStoreTable.refreshTable()
})
}).catch(err => {
console.log(err)
})
}
}
}
</script>
<style scoped>
</style>