addMobilize.vue
6.29 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
<template>
<view class="hasfixedbottom">
<view class="nolineform">
<uni-forms :border="true" :modelValue="baseFormData" label-width="90">
<!-- <uni-forms-item label="姓名" required name="name">
<uni-easyinput :styles="inputstyle" :clearable='false' :placeholderStyle="placeholderStyle"
v-model="baseFormData.name" placeholder="请输入姓名" />
</uni-forms-item> -->
<uni-forms-item label="证件类型" required name="idcType">
<uni-data-select v-model="baseFormData.idcType" :localdata="idcTypeList"
:clear="false"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="证件号码" required name="idcCode">
<uni-easyinput :styles="inputstyle" :clearable='false' :placeholderStyle="placeholderStyle"
v-model="baseFormData.idcCode" placeholder="请输入证件号码" />
</uni-forms-item>
</uni-forms>
<view class="button-group">
<button type="primary" size="mini" @click="selectMember">查询</button>
<button type="primary" size="mini" :disabled="flag" @click="submitForm">添加</button>
</view>
</view>
<view class="wBox">
<view class="info">
<view>人数合计 <text class="text-danger"> {{ total}} </text> 人</view>
</view>
<uni-swipe-action>
<uni-swipe-action-item class="personitem" v-for="(n,index) in list" :key="index">
<view class="content-box" @click="handleInfo(n)">
<view class="flexbox">
<view class="photobox">
<view class="colorful">{{n.perName?.slice(0,1)}}</view>
</view>
<view>
{{n.perName}}
<view class="date">
{{getIdcType(n.perIdcType)}}: {{n.perIdcCode}}
</view>
</view>
</view>
</view>
<template v-slot:right>
<view class="slot-button">
<view class="danger-button" @click="handleDelete(n)">
<uni-icons type="trash" color="#fff" size="20"></uni-icons>
<text class="slot-button-text">删除</text>
</view>
</view>
</template>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</view>
<view class="fixedBottom">
<button class="btn-red" :disabled="list?.length <= 0" @click="commitFN">保存并提交</button>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
import * as api from '@/common/api.js'
const inputstyle = ref({
borderColor: '#fff',
fontSize: '30rpx'
})
const placeholderStyle = ref('text-align: right;font-size:30rpx')
const idcTypeList = ref([{
value: '0',
text: "身份证"
},
{
value: '1',
text: "来往大陆(内地)通行证 "
},
{
value: '3',
text: "护照"
},
{
value: '5',
text: "香港身份证"
}
])
const baseFormData = ref({
idcType: '0'
})
const list = ref([])
const total = ref(0)
const flag = ref(true)
const queryParams = ref({
rangeId: -1
})
onLoad((option) => {
if (option.rangId) {
baseFormData.value.rangeId = option.rangId
queryParams.value.rangeId = option.rangId
getList()
}
})
function getIdcType(type) {
for (var item of idcTypeList.value){
if (item.value == type) {
return item.text
}
}
}
// 查询会员
function selectMember() {
// if (!baseFormData.value.name) {
// uni.showToast({
// title: '请输入姓名',
// icon: 'none'
// })
// return
// }
if (!baseFormData.value.idcCode) {
uni.showToast({
title: '请输入证件号',
icon: 'none'
})
return
}
baseFormData.value.fromTransfer = '1'
api.pickUp(baseFormData.value).then(res => {
baseFormData.value.perId = res.data.perId
baseFormData.value.ancestorNameList = res.data.ancestorNameList
baseFormData.value.memName = res.data.memName
baseFormData.value.personIdArray = res.data.perId
flag.value = false
uni.showToast({
title: '查询成功!'
})
})
}
function submitForm() {
// if (!baseFormData.value.name) {
// uni.showToast({
// title: '请输入姓名',
// icon: 'none'
// })
// return
// }
if (!baseFormData.value.idcCode) {
uni.showToast({
title: '请输入证件号',
icon: 'none'
})
return
}
api.addTransferToRange({
rangeId: baseFormData.value.rangeId || -1,
personIdArray: baseFormData.value.personIdArray
}).then(res => {
if(res.data.result == 0){
uni.showModal({
content: res.data?.list?.[0]?.msg,
success: function(res) {
}
})
} else {
uni.showToast({
title:'新增成功'
})
}
baseFormData.value.rangeId = res.data.rangeId
queryParams.value.rangeId = res.data.rangeId
flag.value = true
baseFormData.value.idcType = '0'
baseFormData.value.idcCode = ''
baseFormData.value.name = ''
getList()
})
}
function getList() {
uni.showLoading({
title:'加载中'
})
api.getTransferList(queryParams.value).then(res => {
list.value = res.rows
total.value = res.total
uni.hideLoading()
})
}
function commitFN() {
if (baseFormData.value.rangeId == -1) return
api.commit([baseFormData.value.rangeId] || [queryParams.value.rangeId]).then(res => {
uni.showToast({
title: '提交成功!'
})
uni.navigateBack()
})
}
function handleDelete(row){
uni.showModal({
title: '提示',
content: `确定删除吗`,
success: function(res) {
if (res.confirm) {
api.deltransferRange([row.id]).then(Response=>{
uni.showToast({
icon:"none",
title:'删除成功!'
})
if (total.value == 1) {
baseFormData.value.rangeId = '-1'
queryParams.value.rangeId = '-1'
}
getList()
})
}
}
})
}
</script>
<style scoped lang="scss">
.wBox {
width: 700rpx;
padding: 30rpx;
margin: 20rpx auto 0;
background: #FFFFFF;
box-shadow: 0rpx 12rpx 116rpx 0rpx rgba(196, 203, 214, 0.1);
border-radius: 15rpx;
.tt {
color: #0A1629;
font-size: 30rpx;
}
}
.button-group {
text-align: right;
button {
margin-left: 30rpx;
}
}
.info {
display: flex;
margin: 30rpx 0 20rpx;
font-size: 28rpx;
view {
color: #7D8592;
margin-right: 20rpx;
}
}
</style>