receiptRegistration.vue
7.96 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
<template>
<view class="page">
<view class="content">
<view class="top-box" @click="gopath('/pages/receiptRegistration/receiptRegistrationList')">
<view>上报历史</view>
<view class="top-box-img"><image src="../../static/right2.png"></image></view>
</view>
<view class="titleall-left"><view class="titleall-left-line"></view>我要上报</view>
<view class="message-list">
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">发生地点</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.incidentLocation" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">儿童姓名</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.childName" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">儿童性别</view>
<view class="serve-right">
<picker @change="bindPickerChangeSex" :value="index" :range="sexArray">
<view class="uni-input">{{form.sex?sexArray[form.sex]:'请选择'}}</view>
</picker>
<image src="../../static/down3.png"></image>
</view>
</view>
</view>
</view>
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">儿童年龄</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.age" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">报告原因</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.reportReason" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">其他信息</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.reportRecord" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
</view>
<view class="titleall-left"><view class="titleall-left-line"></view>报告人信息</view>
<view class="message-list">
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">姓名</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.reporterName" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">与儿童关系</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.relationshipWithChild" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">电话</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.phone" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
<view class="info-box">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">报告主体</view>
<view class="serve-right">
<picker @change="bindPickerChangeSubject" :value="index" :range="SubjectArray">
<view class="uni-input">{{form.reporterType?SubjectArray[index]:'请选择'}}</view>
</picker>
<image src="../../static/down3.png"></image>
</view>
</view>
</view>
</view>
<view class="info-box" v-if="form.reporterType == '群众'">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">职业</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.reporterOccupation" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
<view class="info-box" v-if="form.reporterType == '单位' || form.reporterType == '社会组织'">
<view class="info-box-list">
<view class="serve">
<view class="serve-title">单位名称</view>
<view>
<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;" v-model="form.reporterOrganizationName" placeholder="请输入" style="text-align: right;"/>
</view>
</view>
</view>
</view>
</view>
<view class="page-footer">
<view class="footer-buy">
<view class="cart-add" @click="register">
<image src="../../static/btn5.png"></image>
<text>立即上报</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
form:{
reportTime: "",
reportPlatform: "",
incidentLocation: "",
childName: "",
sex: "",
age: "",
reportReason: "",
reportRecord: "",
reporterName: "",
relationshipWithChild: "",
phone: "",
reporterType: "",
reporterOrganizationName: "",
reporterOccupation: "",
userId: uni.getStorageSync('USERS_KEY').userId,
reportPlatform: '数字民政服务平台小程序'
},
// 性别下拉框
sexArray: ['男', '女'],
// 报告主体
SubjectArray: ['群众', '单位', '社会组织'],
index: 0
};
},
methods:{
gopath(e) {
uni.navigateTo({
url:e
})
},
// 选择性别
bindPickerChangeSex: function(e) {
console.log('picker发送选择改变,携带值为', e)
this.form.sex = e.detail.value;
},
// 选择主体
bindPickerChangeSubject: function(e) {
console.log('picker发送选择改变,携带值为', e)
this.index = e.detail.value;
this.form.reporterType = this.SubjectArray[this.index];
},
// 获取当前时间
getTime() {
var now = new Date();
var year = now.getFullYear(); //获取完整的年份(4位,1970-????)
var month = now.getMonth() + 1; //获取当前月份(0-11,0代表1月)
var day = now.getDate(); //获取当前日(1-31)
var hour = now.getHours(); //获取当前小时数(0-23)
var minute = now.getMinutes(); //获取当前分钟数(0-59)
var second = now.getSeconds(); //获取当前秒数(0-59)
this.form.reportTime = year + "-" + (month<10?"0"+month:month) + "-" + (day<10?"0"+day:day) + " " + (hour<10?"0"+hour:hour) + ":" + (minute<10?"0"+minute:minute) + ":" + (second<10?"0"+second:second);
},
register(){
this.getTime();
this.API.addRegistration(this.form).then(res => {
console.log(res)
if (res.code == 200 ) {
uni.showToast({
icon: 'success',
title: '上报成功'
})
setTimeout(() => {
uni.redirectTo({
url: '/pages/receiptRegistrationSuccess/receiptRegistrationSuccess',
})
}, 800)
}
})
}
}
}
</script>
<style scoped lang="scss">
@import 'receiptRegistration.scss';
</style>