Blame view

lvdao-miniapp/pagesA/leaseAdd/leaseAdd.vue 6.93 KB
4373acf5   wesley88   1
1
2
3
4
5
6
7
8
  <template>
  	<view class="page">
  		<view>
  			<u-form labelPosition="left" :model="model1" ref="uForm" :labelWidth="250">
  				<view class="add-list">
  					<u-form-item label="经营者姓名" prop="name" borderBottom>
  						<u-input v-model="model1.name"></u-input>
  					</u-form-item>
e94be901   wesley88   1
9
  					<!-- 		<u-form-item label="手机号" prop="phone" borderBottom>
4373acf5   wesley88   1
10
  						<u-input v-model="model1.phone"></u-input>
d64cd58f   wesley88   上传验收小程序
11
  					</u-form-item> -->
e94be901   wesley88   1
12
  					<!-- 			<u-form-item label="证件类型" prop="idCardType" borderBottom>
4373acf5   wesley88   1
13
14
  						<u-input v-model="model1.idCardType" type="select" @click="IdtypeShow = true"
  							placeholder='请选择类型' />
b69c951f   wesley88   1
15
  					</u-form-item> -->
4373acf5   wesley88   1
16
17
18
19
20
21
22
  					<u-form-item label="身份证号码" prop="idCardNumber" borderBottom>
  						<u-input v-model="model1.idCardNumber"></u-input>
  					</u-form-item>
  				</view>
  				<view class="add-list">
  					<view class="deom-box">
  						<view class="img-deom">
8984a1f4   wesley88   1
23
24
  							<u-upload :action="url" @on-choose-complete="onsuccess1" :auto-upload="false"
  								:custom-btn="true" :max-count="1" ref="idPhotoFront">
4373acf5   wesley88   1
25
26
27
28
29
30
31
32
  								<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover"
  									hover-stay-time="150">
  									<u-image width="304rpx" height="182rpx" :src="$imgUrl('/uploadID1.png')"></u-image>
  								</view>
  							</u-upload>
  							<text>点击上传证件人像面</text>
  						</view>
  						<view class="img-deom">
e94be901   wesley88   1
33
34
  							<u-upload :action="url" @on-choose-complete="onsuccess2" :auto-upload="false"
  								:custom-btn="true" :max-count="1" ref="idPhotoBack">
4373acf5   wesley88   1
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
  								<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover"
  									hover-stay-time="150">
  									<u-image width="304rpx" height="182rpx" :src="$imgUrl('/uploadID2.png')"></u-image>
  								</view>
  							</u-upload>
  							<text>点击上传证件国徽面</text>
  						</view>
  					</view>
  				</view>
  				<view class="add-list">
  					<view style="line-height: 60rpx;">上传示例</view>
  					<view class="deom-box">
  						<view class="img-deom">
  							<u-image width="304rpx" height="182rpx" :src="$imgUrl('/front-icon.png')"></u-image>
  							<text>人脸示例图</text>
  						</view>
  						<view class="img-deom">
  							<u-image width="304rpx" height="182rpx" :src="$imgUrl('/back-icon.png')"></u-image>
  							<text>国徽面示例图</text>
  						</view>
  					</view>
  				</view>
  				<text
  					style="display: inline-block; font-size: 24rpx; line-height: 30px; margin: 24rpx 30rpx 0;">请拍摄证件原件,保证照片拍摄清晰,取图完整,不反光。</text>
  			</u-form>
  		</view>
  		<u-select v-model="IdtypeShow" :list="idType" @confirm="IdtypeChange"></u-select>
  		<!-- 保存按钮 -->
  		<view class="page-footer">
  			<u-button type="success" style="flex: 1; margin: 0 10px;" @click="go">提交申请</u-button>
  		</view>
  	</view>
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
  				url: 'http://8.130.38.56:9003/file/upload',
  				model1: {
  					name: '',
  					phone: '',
b69c951f   wesley88   1
77
  					idCardType: '身份证',
4373acf5   wesley88   1
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
  					idCardNumber: '',
  					idCardFrontImage: '',
  					idCardBackImage: '',
  					checkState: '1',
  					applyTime: ''
  				},
  				idType: [{
  					value: 1,
  					label: '身份证'
  				}, ],
  				IdtypeShow: false,
  				fileList1: [],
  				fileList2: [],
  			};
  		},
  		onLoad() {
  
  		},
  		onShow() {
  
  
  		},
  		methods: {
  			getCurrentTime() {
  				const now = new Date();
  				const year = now.getFullYear();
  				const month = ('0' + (now.getMonth() + 1)).slice(-2);
  				const day = ('0' + now.getDate()).slice(-2);
  				const hours = ('0' + now.getHours()).slice(-2);
  				const minutes = ('0' + now.getMinutes()).slice(-2);
  				const seconds = ('0' + now.getSeconds()).slice(-2);
  
  				return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  			},
  			go() {
cfe2752f   杨鑫   最新
113
114
115
116
117
118
119
  				if (!this.model1.idCardNumber) {
  					uni.showToast({
  						icon: 'none',
  						title: '请输入身份证号码'
  					});
  					return false;
  				}
e94be901   wesley88   1
120
  
4373acf5   wesley88   1
121
122
123
  				this.model1.applyTime = this.getCurrentTime()
  				this.model1.idCardFrontImage = this.fileList1.join(',')
  				this.model1.idCardBackImage = this.fileList2.join(',')
cfe2752f   杨鑫   最新
124
125
126
127
128
129
130
131
132
133
134
135
136
137
  				if (!this.model1.idCardFrontImage) {
  					uni.showToast({
  						icon: 'none',
  						title: '请上传身份证照片'
  					});
  					return false;
  				}
  				if (!this.model1.idCardBackImage) {
  					uni.showToast({
  						icon: 'none',
  						title: '请上传身份证照片'
  					});
  					return false;
  				}
d64cd58f   wesley88   上传验收小程序
138
139
140
141
142
  				this.model1.username = this.model1.name
  				this.model1.phone = uni.getStorageSync('user').phone
  				console.error({
  					...this.model1
  				})
e94be901   wesley88   1
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
  				let info = {
  					"content": JSON.stringify({
  						type: '1',
  						title: '商家入驻审核申请',
  						content: '您的商家入驻申请已提交(申请时间:' + this.model1.applyTime +
  							'),正在审核中,审核通过后,我们将通过系统消息通知您,请保持关注;'
  					}), // 消息内容
  					"messageClass": 1, // 消息类型(1:指定用户发送)
  					"messageType": '通知消息', // 消息类型描述
  					"cereMessageReceipts": [ // 接收人列表
  						{
  							"phone": uni.getStorageSync('user').phone, // 用户ID
  							"messageType": '通知消息', // 消息类型
  							"content": JSON.stringify({
  								type: '1',
  								title: '商家入驻审核申请',
  								content: '您的商家入驻申请已提交(申请时间:' + this.model1.applyTime +
  									'),正在审核中,审核通过后,我们将通过系统消息通知您,请保持关注;'
  							}) // 消息内容
  						}
  					]
  				}
d64cd58f   wesley88   上传验收小程序
165
  				// return
4373acf5   wesley88   1
166
167
168
169
170
171
172
  				this.$http.sendRequest('/cerePlatformMerchant/add', 'POST', this.model1, 2).then(res => {
  					console.error(res)
  					if (res.data.code) {
  						uni.showToast({
  							icon: 'none',
  							title: '提交申请成功'
  						})
e94be901   wesley88   1
173
174
175
  						this.$http.sendRequest('/cereMessage/sendToUser', 'POST', info, 1).then(res => {
  							console.error(res)
  						})
4373acf5   wesley88   1
176
177
178
  						setTimeout(() => {
  							uni.navigateBack()
  						}, 1000);
8984a1f4   wesley88   1
179
  					} else {
4373acf5   wesley88   1
180
181
182
183
184
185
186
  						uni.showToast({
  							icon: 'none',
  							title: '提交申请失败'
  						})
  					}
  				})
  			},
e94be901   wesley88   1
187
  			onup(e, e1) {
8984a1f4   wesley88   1
188
  				uni.uploadFile({
1ab21b43   杨鑫   '策略'
189
  					url: this.$upload, // 仅为示例,请替换为您的服务器上传接口
d64cd58f   wesley88   上传验收小程序
190
  					filePath: e,
8984a1f4   wesley88   1
191
192
  					name: 'file', // 后端接收的文件参数名
  					formData: {
1ab21b43   杨鑫   '策略'
193
  						filePath: 'xcx', // 其他表单数据
8984a1f4   wesley88   1
194
195
196
197
198
199
200
  					},
  					success: (uploadFileRes) => {
  						console.log('上传成功', uploadFileRes);
  						uni.showToast({
  							title: '上传成功',
  							icon: 'success',
  						});
d64cd58f   wesley88   上传验收小程序
201
  						this[e1].push(JSON.parse(uploadFileRes.data).data)
8984a1f4   wesley88   1
202
203
204
205
206
207
208
209
210
  					},
  					fail: (err) => {
  						console.error('上传失败', err);
  						uni.showToast({
  							title: '上传失败',
  							icon: 'none',
  						});
  					},
  				});
4373acf5   wesley88   1
211
  			},
d64cd58f   wesley88   上传验收小程序
212
213
214
  			onsuccess1(e) {
  				console.error(e)
  				this.fileList1 = []
e94be901   wesley88   1
215
  				this.onup(e[0].url, 'fileList1')
d64cd58f   wesley88   上传验收小程序
216
  			},
4373acf5   wesley88   1
217
218
  			onsuccess2(e) {
  				console.error(e)
d64cd58f   wesley88   上传验收小程序
219
  				this.fileList2 = []
e94be901   wesley88   1
220
221
  				this.onup(e[0].url, 'fileList2')
  
4373acf5   wesley88   1
222
223
224
225
226
227
228
229
230
231
232
  			},
  			IdtypeChange(e) {
  				this.model1.idCardType = e[0].label;
  			},
  		}
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'leaseAdd.scss';
  </style>