Blame view

pages/PayMoney/PayMoney.vue 12.1 KB
bb09ac81   wangming   DEV初始化
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
  <template>
  	<view class="YmContent" :animation="animationData">
  		<view class="application_for_withdrawal_71">
  			<text decode="true" class="application_for_withdrawal_74">提现金额</text>
  			<view class="application_for_withdrawal_75">
  				<text decode="true" class="application_for_withdrawal_76">¥</text>
  				<input v-model="moneys" class="application_for_withdrawal_77" maxlength="10" />
  				<!-- @input="AmountBlur"  -->
  			</view>
  			<view class="application_for_withdrawal_81">
  				<text decode="true" class="application_for_withdrawal_82">可提现金额为{{balance}}元</text>
  				<text decode="true" class="application_for_withdrawal_83" @click="AllMoney">全部提现</text>
  			</view>
  			<!-- 	<radio-group class="payType">
  					<image   src="../../static/application_for_withdrawal_85_10.jpg" mode="scaleToFill" border="0"    class="application_for_withdrawal_85"></image>
  					<text decode="true" class="application_for_withdrawal_86">微信</text>
  					<radio value="wx"  class="application_for_withdrawal_87">
  					</radio>
  					<image   src="/static/application_for_withdrawal/images/application_for_withdrawal_88_13.jpg" mode="scaleToFill" border="0"    class="application_for_withdrawal_88"></image>
  					<text decode="true" class="application_for_withdrawal_89">支付宝</text>
  					<radio value="zfb"  class="application_for_withdrawal_90">
  					</radio>
  				</radio-group> -->
  			<button class="btSubmit" @click="deposit">确认提现
  			</button>
  		</view>
  		<view class="loading">{{loadingText}}</view>
  		<view class="ymBbottom"></view>
  	</view>
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
  				balance: 0,
  				model: {
  					"openid": "",
  					// 分单位
  					"amount": 0,
  					"desc": "尚腾提现"
  				},
  				moneys: 0,
  				boolmoney: true,
  				// 提现记录
  				modelmoney: {
  					"id": 0,
  					"openid": '',
  					"remark": '',
  					"username": "",
  					"userid": 0,
  					"oldmoney": 0,
  					"nowmoney": 0,
  					"money": 0,
  					"add_time": "2022-01-18T01:51:01.541Z",
  					"status": 0
  				}
  			}
  		},
  		onLoad(item) {
  			console.log('原始', item)
  			let data = JSON.parse(decodeURIComponent(item.balance))
  			this.balance = data
  			// 原金额
  			// this.modelmoney.oldmoney=this.balance
  			console.log('数据', data)
  		},
  		methods: {
  			// 审核提现
  			checkDeposit() {
  				let regs = /^\d+(\.\d{0,2})?$/;
  				let storage = uni.getStorageSync('userinfo')
  				// this.model.openid = storage.openid
  				this.modelmoney.openid = storage.data.openid
  				if (this.moneys == 0) {
  					uni.showToast({
  						title: '请输入金额',
  						icon: 'none'
  					})
  				} else if (!regs.test(this.moneys)) {
  					uni.showToast({
  						title: '不能出现金额外的字符',
  						icon: 'none'
  					})
  				} else if (this.moneys < 1) {
  					uni.showToast({
  						title: '金额不能小于1',
  						icon: 'none'
  					})
  				} else {
9a39156a   wangming   修改
91
92
93
94
95
96
97
98
99
100
101
  					this.modelmoney.oldmoney = this.balance * 100
  					this.modelmoney.money = this.moneys * 100
  					if (this.modelmoney.oldmoney < this.modelmoney.money) {
  						uni.showToast({
  							title: '余额不足,无法进行提现',
  							icon: 'none'
  						})
  					} else {
  						this.modelmoney.nowmoney = this.modelmoney.oldmoney - this.modelmoney.money
  						let bool = this.AddMoney()
  						if (bool) {
bb09ac81   wangming   DEV初始化
102
  							uni.showToast({
9a39156a   wangming   修改
103
104
  								title: '已提交审核提现',
  								icon: 'success'
bb09ac81   wangming   DEV初始化
105
  							})
9a39156a   wangming   修改
106
  						} else {
bb09ac81   wangming   DEV初始化
107
  							uni.showToast({
9a39156a   wangming   修改
108
109
  								title: '提现失败',
  								icon: 'none'
bb09ac81   wangming   DEV初始化
110
111
  							})
  						}
9a39156a   wangming   修改
112
  					}
bb09ac81   wangming   DEV初始化
113
114
115
116
117
118
119
  				}
  			},
  			// 确认提现
  			deposit() {
  				let regs = /^\d+(\.\d{0,2})?$/;
  				let storage = uni.getStorageSync('userinfo')
  				this.model.openid = storage.data.openid
9a39156a   wangming   修改
120
  				this.modelmoney.oldmoney = this.balance * 100
bb09ac81   wangming   DEV初始化
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
  				if (this.moneys == 0) {
  					uni.showToast({
  						title: '请输入金额',
  						icon: 'none'
  					})
  				} else if (!regs.test(this.moneys)) {
  					uni.showToast({
  						title: '不能出现金额外的字符',
  						icon: 'none'
  					})
  				} else if (this.moneys < 1) {
  					uni.showToast({
  						title: '金额不能小于1',
  						icon: 'none'
  					})
  				} else {
  					this.model.amount = this.moneys * 100
9a39156a   wangming   修改
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
  					if (this.balance < this.moneys) {
  						uni.showToast({
  							title: '余额不足,无法进行提现',
  							icon: 'none'
  						})
  					}else{
  						this.API.GetPay(this.model).then(res => {
  							console.log('res支付', res)
  							if (res.data.code == 200) {
  								this.API.UpdBlanceByUser({
  									userid: storage.data.id,
  									amount: this.model.amount
  								}).then(res => {
  									console.log('res更改金额')
  									if (res.data.code == 200) {
  										storage = res.data
  										uni.setStorageSync('userinfo', storage)
  										uni.showToast({
  											title: '提现成功',
  											icon: 'success',
  											duration: 1000
bb09ac81   wangming   DEV初始化
159
  										})
9a39156a   wangming   修改
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
  										this.modelmoney.status = 0
  										setTimeout(() => {
  											uni.switchTab({
  												url: '../my/my'
  											})
  										}, 1000)
  									} else {
  										uni.showToast({
  											title: '提现失败',
  											icon: 'none'
  										})
  										this.modelmoney.status = -99
  									}
  									this.modelmoney.money = this.model.amount
  									this.modelmoney.nowmoney = this.modelmoney.oldmoney - this.modelmoney.money
  									this.AddMoney()
  								})
  						
  							} else {
  								uni.showToast({
  									title: res.message,
  									icon: 'none'
  								})
  							}
  						})
  					}
bb09ac81   wangming   DEV初始化
186
187
188
189
190
191
192
193
  				}
  
  
  			},
  			// 添加提现记录
  			AddMoney() {
  				let jsonstorage = uni.getStorageSync('userinfo').data
  				this.modelmoney.username = jsonstorage.username
9a39156a   wangming   修改
194
195
  				this.modelmoney.openid = jsonstorage.openid
  				this.modelmoney.remark = "提现"
bb09ac81   wangming   DEV初始化
196
197
  				this.modelmoney.userid = jsonstorage.id
  				// this.modelmoney.oldmoney = jsonstorage.balance
9a39156a   wangming   修改
198
  				this.model.status = 0
bb09ac81   wangming   DEV初始化
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
  				this.API.AddOrUpdMoney(this.modelmoney).then(res => {
  					console.log('添加记录', res)
  					if (res.code == 200) {
  						console.log('添加提现记录成功')
  					} else {
  						console.log('添加提现记录失败')
  					}
  				})
  				return true
  			},
  			// 全部提现
  			AllMoney() {
  				this.moneys = this.balance
  			},
  			// 输入框验证
  			AmountBlur(e) {
  				var money = e.target.value;
  				let regs = /^\d+(\.\d{0,2})?$/;
  				if (!regs.test(money)) {
  					uni.showToast({
  						title: '请输入整数或者小数(保留两位数)',
  						icon: 'none'
  					})
  					this.boolmoney = false
  				} else {
  					this.boolmoney = true
  				}
  			}
  		}
  	}
  </script>
  
  
  <style>
  	html,
  	body,
  	#app {
  		height: 100%;
  		width: 100%;
  	}
bb09ac81   wangming   DEV初始化
239
240
241
242
  	.YmContent {
  		height: 100%;
  		width: 100%;
  	}
bb09ac81   wangming   DEV初始化
243
244
245
246
  	uni-page-body,
  	#app {
  		height: 100%;
  	}
bb09ac81   wangming   DEV初始化
247
248
249
250
  	button::after {
  		border: none;
  		width: auto;
  	}
bb09ac81   wangming   DEV初始化
251
252
253
254
255
256
  	input {
  		outline: none;
  		border: none;
  		list-style: none;
  		width: auto;
  	}
bb09ac81   wangming   DEV初始化
257
258
259
  	.list_item {
  		float: left;
  	}
bb09ac81   wangming   DEV初始化
260
261
262
  	.ym_hide {
  		display: none;
  	}
bb09ac81   wangming   DEV初始化
263
264
265
  	.ym_show {
  		display: block;
  	}
bb09ac81   wangming   DEV初始化
266
267
268
269
  	.slide-image {
  		width: 100%;
  		height: 100%;
  	}
bb09ac81   wangming   DEV初始化
270
271
272
273
  	.list_horizontal {
  		width: auto;
  		display: inline-block;
  	}
bb09ac81   wangming   DEV初始化
274
275
276
277
278
279
280
281
282
283
284
  	.application_for_withdrawal_71 {
  		white-space: normal;
  		width: 749upx;
  		height: 100%;
  		padding: 0upx;
  		clear: both;
  		float: left;
  		background-color: #ffffff;
  		border-radius: 0upx;
  		font-size: 8upx;
  	}
bb09ac81   wangming   DEV初始化
285
286
287
288
289
290
291
292
293
294
295
296
297
298
  	.application_for_withdrawal_71 .application_for_withdrawal_74 {
  		white-space: normal;
  		width: 181upx;
  		height: 34upx;
  		padding: 0upx;
  		clear: both;
  		margin-top: 30upx;
  		margin-left: 34upx;
  		float: left;
  		border-radius: 0upx;
  		color: #646464;
  		font-size: 32upx;
  		line-height: 34upx;
  	}
bb09ac81   wangming   DEV初始化
299
300
301
302
303
304
305
306
307
308
309
310
311
  	.application_for_withdrawal_71 .application_for_withdrawal_75 {
  		white-space: normal;
  		width: 647upx;
  		height: 44upx;
  		padding: 0upx;
  		clear: both;
  		margin-top: 68upx;
  		margin-left: 34upx;
  		float: left;
  		border-radius: 0upx;
  		font-size: 43upx;
  		line-height: 44upx;
  	}
bb09ac81   wangming   DEV初始化
312
313
314
315
316
317
318
319
320
321
322
323
324
  	.application_for_withdrawal_71 .application_for_withdrawal_75 .application_for_withdrawal_76 {
  		white-space: normal;
  		width: auto;
  		height: 44upx;
  		padding: 0upx;
  		margin-top: 0upx;
  		margin-left: 0upx;
  		float: left;
  		border-radius: 0upx;
  		color: #646464;
  		font-size: 43upx;
  		line-height: 44upx;
  	}
bb09ac81   wangming   DEV初始化
325
326
327
328
329
330
331
332
333
334
335
336
337
338
  	.application_for_withdrawal_71 .application_for_withdrawal_75 .application_for_withdrawal_77 {
  		white-space: normal;
  		width: auto;
  		height: 44upx;
  		min-height: 44upx;
  		padding: 0upx;
  		margin-top: 0upx;
  		margin-left: 25upx;
  		float: left;
  		border-radius: 0upx;
  		color: #c8c8c8;
  		font-size: 43upx;
  		line-height: 43upx;
  	}
bb09ac81   wangming   DEV初始化
339
340
341
342
343
344
345
346
347
348
349
350
351
  	.application_for_withdrawal_71 .application_for_withdrawal_81 {
  		white-space: normal;
  		width: 704upx;
  		height: 36upx;
  		padding: 0upx;
  		clear: both;
  		margin-top: 85upx;
  		margin-left: 32upx;
  		float: left;
  		border-radius: 0upx;
  		font-size: 29upx;
  		line-height: 36upx;
  	}
bb09ac81   wangming   DEV初始化
352
353
354
355
356
357
358
359
360
361
362
363
364
  	.application_for_withdrawal_71 .application_for_withdrawal_81 .application_for_withdrawal_82 {
  		white-space: normal;
  		width: 377upx;
  		height: 36upx;
  		padding: 0upx;
  		margin-top: 0upx;
  		margin-left: 0upx;
  		float: left;
  		border-radius: 0upx;
  		color: #c8c8c8;
  		font-size: 29upx;
  		line-height: 36upx;
  	}
bb09ac81   wangming   DEV初始化
365
366
367
368
369
370
371
372
373
374
375
376
377
  	.application_for_withdrawal_71 .application_for_withdrawal_81 .application_for_withdrawal_83 {
  		white-space: normal;
  		width: 128upx;
  		height: 36upx;
  		padding: 0upx;
  		margin-top: 0upx;
  		margin-left: 186upx;
  		float: left;
  		border-radius: 0upx;
  		color: #ff4342;
  		font-size: 29upx;
  		line-height: 36upx;
  	}
bb09ac81   wangming   DEV初始化
378
379
380
381
382
383
384
385
386
387
388
389
390
  	.application_for_withdrawal_71 .payType {
  		white-space: normal;
  		width: 683upx;
  		height: 50upx;
  		padding: 0upx;
  		clear: both;
  		margin-top: 64upx;
  		margin-left: 33upx;
  		float: left;
  		border-radius: 0upx;
  		font-size: 49upx;
  		line-height: 50upx;
  	}
bb09ac81   wangming   DEV初始化
391
392
393
394
395
396
397
398
399
400
401
402
  	.application_for_withdrawal_71 .payType .application_for_withdrawal_85 {
  		white-space: normal;
  		width: 46upx;
  		height: 47upx;
  		padding: 0upx;
  		margin-top: 3upx;
  		margin-left: 2upx;
  		float: left;
  		border-radius: 0upx;
  		font-size: 48upx;
  		line-height: 47upx;
  	}
bb09ac81   wangming   DEV初始化
403
404
405
406
407
408
409
410
411
412
413
414
415
  	.application_for_withdrawal_71 .payType .application_for_withdrawal_86 {
  		white-space: normal;
  		width: 61upx;
  		height: 28upx;
  		padding: 0upx;
  		margin-top: 11upx;
  		margin-left: 23upx;
  		float: left;
  		border-radius: 0upx;
  		color: #646464;
  		font-size: 27upx;
  		line-height: 28upx;
  	}
bb09ac81   wangming   DEV初始化
416
417
418
419
420
421
422
423
424
425
426
427
  	.application_for_withdrawal_71 .payType .application_for_withdrawal_87 {
  		white-space: normal;
  		width: 43upx;
  		height: 44upx;
  		padding: 0upx;
  		margin-top: 2upx;
  		margin-left: 4upx;
  		float: left;
  		border-radius: 0upx;
  		font-size: 43upx;
  		line-height: 44upx;
  	}
bb09ac81   wangming   DEV初始化
428
429
430
431
432
433
434
435
436
437
438
439
  	.application_for_withdrawal_71 .payType .application_for_withdrawal_88 {
  		white-space: normal;
  		width: 47upx;
  		height: 47upx;
  		padding: 0upx;
  		margin-top: 3upx;
  		margin-left: 105upx;
  		float: left;
  		border-radius: 0upx;
  		font-size: 49upx;
  		line-height: 47upx;
  	}
bb09ac81   wangming   DEV初始化
440
441
442
443
444
445
446
447
448
449
450
451
452
  	.application_for_withdrawal_71 .payType .application_for_withdrawal_89 {
  		white-space: normal;
  		width: 81upx;
  		height: 29upx;
  		padding: 0upx;
  		margin-top: 11upx;
  		margin-left: 22upx;
  		float: left;
  		border-radius: 0upx;
  		color: #646464;
  		font-size: 27upx;
  		line-height: 29upx;
  	}
bb09ac81   wangming   DEV初始化
453
454
455
456
457
458
459
460
461
462
463
464
  	.application_for_withdrawal_71 .payType .application_for_withdrawal_90 {
  		white-space: normal;
  		width: 43upx;
  		height: 43upx;
  		padding: 0upx;
  		margin-top: 3upx;
  		margin-left: 11upx;
  		float: left;
  		border-radius: 0upx;
  		font-size: 42upx;
  		line-height: 43upx;
  	}
bb09ac81   wangming   DEV初始化
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
  	.application_for_withdrawal_71 .btSubmit {
  		white-space: normal;
  		width: 679upx;
  		height: 92upx;
  		padding: 0upx;
  		clear: both;
  		margin-top: 63upx;
  		margin-left: 35upx;
  		float: left;
  		background-color: #ff4342;
  		text-align: center;
  		justify-content: center;
  		border-radius: 10upx;
  		cursor: pointer;
  		color: #ffffff;
  		font-size: 27upx;
  		line-height: 92upx;
  	}
bb09ac81   wangming   DEV初始化
483
484
485
  	.application_for_withdrawal_71 .btSubmit_label {
  		float: left;
  	}
bb09ac81   wangming   DEV初始化
486
487
488
489
490
491
492
493
494
495
496
497
498
  	.application_for_withdrawal_71 .btSubmit_button {
  		float: left;
  		color: #000000;
  		font-size: 30rpx;
  		text-align: center;
  		line-height: 30rpx;
  		border-color: #e1e1e1;
  		border-width: 1rpx;
  		border-style: solid;
  		border-radius: 5rpx;
  		padding: 10rpx;
  		margin: 15rpx;
  	}
bb09ac81   wangming   DEV初始化
499
500
501
502
503
504
505
506
507
508
509
510
511
  	.application_for_withdrawal_71 .btSubmit_button_select {
  		float: left;
  		color: #ff8000;
  		font-size: 30rpx;
  		text-align: center;
  		line-height: 30rpx;
  		border-color: #ff8000;
  		border-width: 1rpx;
  		border-style: solid;
  		border-radius: 5rpx;
  		padding: 10rpx;
  		margin: 15rpx;
  	}
bb09ac81   wangming   DEV初始化
512
513
514
515
  	.application_for_withdrawal_71 .btSubmit_title {
  		float: left;
  	}
  </style>