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
<template>
<div class="cashierManagement">
<a-button type="primary" style="margin-bottom: 20px" @click="choosePeople">添加管理员</a-button>
<div class="searchUserMessage" v-if="searchSource.UserMessage.emplId">
<div class="positionDiv"></div>
<div class="clearUserMessage"><a href="javascript:;" @click="clearUserMessage">清除</a></div>
<img v-if="searchSource.UserMessage.avatar" :src="searchSource.UserMessage.avatar" :alt="searchSource.UserMessage.name"/>
<img v-else :src="this.avatarCanvasFn(searchSource.UserMessage.name)" :alt="searchSource.UserMessage.name">
<span>{{ searchSource.UserMessage.name }}</span>
</div>
<a-table :columns="columns" :dataSource="cashierManagementList" size="default" rowKey="id" :pagination="pagination" @change="handleTableChange">
<span slot="name">成员</span>
<span slot="createDate">时间</span>
<span slot="action" slot-scope="text, record, index">
<a v-if="record.status === '0'" href="javascript:;" @click="showModel(record, text, index)">删除</a>
<a v-else href="javascript:;" style="color:#cccccc">已删除</a>
</span>
</a-table>
</div>
</template>
<script>
import { config } from './../../../api/config.js'
import { $http } from './../../../api/axios.js'
export default {
name: 'cashierManagement',
data () {
return {
searchSource: {
UserMessage: {
avatar: '',
emplId: '',
name: ''
},
status: '',
agentName: ''
},
columns: [{
title: '成员',
dataIndex: 'name'
}, {
title: '时间',
dataIndex: 'createDate'
}, {
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
}],
cashierManagementList: [],
pagination: {
current: 1,
defaultCurrent: 1,
defaultPageSize: 10,
hideOnSinglePage: true,
total: 0
}
}
},
watch: {},
computed: {},
created: function () {
this.getCashierList()
},
methods: {
showModel (record, text, index) {
const _that = this
this.$confirm({
title: '确认要删除该管理员吗?',
content: '删除后,该人员无法在后台管理系统上登录',
okText: '确定',
cancelText: '取消',
onOk () {
_that.deleteCashier(record)
}
})
},
deleteCashier (record) {
let DeleteCashierData = {
ddUserId: record.userId,
cashierStatus: '1',
userType: '1',
id: record.id
}
$http.get(`/mingpay/v1/isv/cashier/delete_cashier`, DeleteCashierData).then((res) => {
if (res.data.resultCode === 0) {
this.$message.success('操作成功')
this.getCashierList()
} else {
this.$message.error(res.data.message)
}
}).catch(() => {
this.$message.error('删除失败')
})
},
getCashierList () {
let CashierListData = {
pageNumber: this.pagination.defaultPageSize,
currentPage: this.pagination.current,
userType: '1'
}
$http.get(`/mingpay/v1/isv/cashier/list_cashier`, CashierListData).then((res) => {
this.pagination.total = parseInt(res.data.data.total)
this.cashierManagementList = res.data.data.list
}).catch(() => {
this.$message.error('获取收银员信息失败')
})
},
createTimeToStr (time) {
let timeData = new Date(parseInt(time))
let year = timeData.getFullYear()
let month = timeData.getMonth() + 1
let date = timeData.getDate()
let hour = timeData.getHours()
let minute = timeData.getMinutes()
return `${year}年${month}月${date}日 ${hour}:${minute}`
},
choosePeople () {
config.ddready('ddchooseOne').then((res) => {
let insertCashierData = {
cashierName: res[0].name,
ddUserId: res[0].emplId,
cashierStatus: '0',
userType: '1'
}
$http.get(`/mingpay/v1/isv/cashier/insert_cashier`, insertCashierData).then((res) => {
if (res.data.resultCode === 0) {
this.$message.success('添加成功')
this.getCashierList()
} else {
this.$message.error(res.data.message)
}
}).catch((err) => {
this.$message.error('网络异常请重试')
console.log(err)
})
})
},
handleTableChange (pagination, filters, sorter) {
this.pagination.current = pagination.current
this.getCashierList()
}
}
}
</script>
<style lang="less" scoped>
.searchUserMessage{
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
font-size: 12px;
padding: 8px 8px;
border: 1px solid #cccccc;
margin-bottom: 15px;
border-radius: 8px;
position: relative;
}
.searchUserMessage img{
width: 32px;
height: 32px;
border-radius: 50%;
margin-bottom: 8px;
}
.positionDiv{
height: 12px;
width: 12px;
transform:rotate(45deg);
border-left: 1px solid #cccccc;
border-top: 1px solid #cccccc;
position: absolute;
top: -7px;
left: 30px;
background: white;
z-index: 99;
}
.clearUserMessage{
position: absolute;
right: 10px;
}
.peopleBox{
width: 100%;
border: 1px solid #d9d9d9;
min-height: 40px;
border-radius: 4px;
padding: 4px 11px;
font-size: 14px;
line-height: 1.5;
cursor: pointer;
}
</style>