memberAuditPage.vue
5.46 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<template>
<view class="audit-page">
<!-- 提示信息 -->
<!-- <view class="tips-box">
<uni-icons type="info" size="18" color="#C4121B"></uni-icons>
<text class="tips-text" v-if="type === 'batch'">批量审核 {{ ids.split(',').length }} 条记录</text>
<text class="tips-text" v-else>单个审核</text>
</view> -->
<!-- 审核表单 -->
<view class="form-section">
<view class="section-header">
<uni-icons type="edit" size="18" color="#AD181F"></uni-icons>
<text class="section-title">审核信息</text>
</view>
<view class="form-card">
<view class="form-item">
<text class="form-label">审批结果</text>
<radio-group @change="onFlagChange">
<view class="radio-group">
<label class="radio-item" :class="{ selected: form.flag == '1' }">
<radio value="1" :checked="form.flag == '1'" color="#C4121B" />
<text>审批通过</text>
</label>
<label class="radio-item" :class="{ selected: form.flag == '0' }">
<radio value="0" :checked="form.flag == '0'" color="#C4121B" />
<text>审批拒绝</text>
</label>
</view>
</radio-group>
</view>
<view class="form-item">
<text class="form-label">备注</text>
<textarea
v-model="form.reason"
class="textarea"
placeholder="请输入备注信息(拒绝时必填)"
:maxlength="500"
/>
</view>
</view>
</view>
<!-- 提交按钮 -->
<view class="submit-wrap">
<button class="btn-cancel" @click="goBack">取消</button>
<button class="btn-submit" @click="doSubmit" :disabled="submitting">
<text v-if="!submitting">确认提交</text>
<text v-else>提交中...</text>
</button>
</view>
</view>
</template>
<script setup>
import * as api from '@/common/api.js'
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
const type = ref('single') // single 或 batch
const ids = ref('')
const submitting = ref(false)
const form = ref({
flag: '1',
reason: ''
})
function onFlagChange(e) {
form.value.flag = e.detail.value
}
onLoad((options) => {
if (options.type) {
type.value = options.type
}
if (options.ids) {
ids.value = options.ids
}
})
function goBack() {
uni.navigateBack()
}
function doSubmit() {
if (form.value.flag == '0' && !form.value.reason) {
uni.showToast({
title: '请输入拒绝理由',
icon: 'none'
})
return
}
if (submitting.value) return
submitting.value = true
const params = {
ids: ids.value,
flag: form.value.flag,
reason: form.value.reason || ''
}
api.auditJi(params).then(res => {
uni.showToast({
title: '操作成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}).catch(err => {
console.error('审核失败', err)
uni.showToast({
title: '操作失败',
icon: 'none'
})
submitting.value = false
})
}
</script>
<style lang="scss" scoped>
.audit-page {
min-height: 100vh;
background-color: #f5f5f5;
padding: 20rpx;
// padding-bottom: 120rpx;
box-sizing: border-box;
}
.tips-box {
background-color: #e8f8f7;
border-radius: 12rpx;
padding: 24rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
gap: 12rpx;
.tips-text {
font-size: 26rpx;
color: #C4121B;
}
}
.form-section {
background-color: #fff;
border-radius: 16rpx;
padding: 30rpx;
margin-bottom: 20rpx;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 30rpx;
.section-title {
font-size: 30rpx;
font-weight: 600;
color: #333;
// margin-left: 10rpx;
}
}
.form-card {
.form-item {
margin-bottom: 30rpx;
&:last-child {
margin-bottom: 0;
}
.form-label {
display: block;
font-size: 28rpx;
color: #333;
margin-bottom: 16rpx;
font-weight: 500;
}
.radio-group {
display: flex;
gap: 24rpx;
}
.radio-item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
font-size: 28rpx;
color: #666;
padding: 20rpx 0;
border-radius: 12rpx;
border: 2rpx solid #eee;
background: #fafafa;
&.selected {
color: #C4121B;
border-color: #C4121B;
background: #fff5f5;
font-weight: 500;
}
radio {
transform: scale(0.8);
}
}
.textarea {
width: 100%;
height: 200rpx;
border: 1rpx solid #eee;
border-radius: 12rpx;
padding: 20rpx;
font-size: 28rpx;
color: #333;
background-color: #fafafa;
box-sizing: border-box;
}
}
}
.submit-wrap {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 110rpx;
background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
gap: 30rpx;
padding: 0 30rpx;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
button {
flex: 1;
height: 80rpx;
line-height: 80rpx;
font-size: 28rpx;
border-radius: 40rpx;
border: none;
}
.btn-cancel {
background-color: #f5f5f5;
color: #666;
}
.btn-submit {
background: #C4121B;
// background: linear-gradient(135deg, #C4121B, #15c5c1);
color: #fff;
&[disabled] {
background: #ccc;
}
}
}
</style>