turnOut.vue
7.4 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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<template>
<view style="background: #f8f8f9;height: 100vh;">
<view class="chooseAccountWrap" @click="bindAcount">
<text>请选择提现账户</text>
<view class="chooseRight" :class="{active:param.platform != ''}">
{{param.platform == 'wechat' ? '微信' : param.platform == 'alipay' ? '支付宝' : '去选择'}}
<image src="../../../static/image/right_icon.png" mode=""></image>
</view>
</view>
<view class="chooseAccountWrap" v-if="param.platform == 'alipay'">
<text>姓名</text>
<view class="chooseRight" :class="{active:param.alipay_name != ''}">
<input type="text" v-model="param.alipay_name" placeholder="请输入姓名" placeholder-class="inpPh"/>
</view>
</view>
<view class="chooseAccountWrap" v-if="param.platform == 'alipay'">
<text>账户</text>
<view class="chooseRight" :class="{active:param.alipay_account != ''}">
<input type="text" v-model="param.alipay_account" placeholder="请输入支付宝账号" placeholder-class="inpPh"/>
</view>
</view>
<view class="rechargeWrap">
<view class="recTxt">
提现金额
</view>
<view class="recInp">
<view class="recDol">¥</view><input type="number" @input="validateNumber" v-model="param.price" placeholder="请输入提现金额(24小时之内到账)" placeholder-style="color:#c8c9cc"/>
</view>
<view class="turnTxt">
可提现金额{{wallet.gift_tx}}<text @click="param.price = wallet.gift_tx">全部提现</text>
</view>
</view>
<view class="bottomBtnWrap">
<view class="bottomBtn" @click="turnOut">
提交申请
</view>
</view>
<view class="payPasWrap" v-if="showPayPas">
<view class="payPass">
<view class="title">
支付密码
</view>
<wakary-input type="bottom" @finish="finish"></wakary-input>
<view class="bottomBtnWrap">
<view class="bottomBtn" style="background: #ff7f7f;" @click="showPayPas = false">
取消
</view>
<view class="bottomBtn" style="background: #35655f;" @click="confirmTurnOut">
确认
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import wakaryInput from '@/components/wakary-input.vue'
export default{
data(){
return{
userInfo:{},
agreeStatus:false,
showPayPas:false,
wallet:{},
param:{
pwd:'',
price:'',
alipay_account:'',
alipay_name:'',
platform:''//平台:wechat=微信支付,alipay=支付宝
}
}
},
components:{
wakaryInput
},
onShow() {
this.getData()
},
methods:{
getData(){
this.$request('/wallet/gift').then((res)=>{
console.log('礼物收益',res)
this.wallet = res.data
})
//获取用户信息
this.$request('/user/info').then((res)=>{
this.userInfo = res.data
})
},
//提现
turnOut(){
if(this.param.platform == ''){
uni.showToast({
title:'请选择提现账户',
icon:'none'
})
return
}
if(this.param.platform == 'alipay' && this.param.alipay_name == ''){
uni.showToast({
title:'请输入姓名',
icon:'none'
})
return
}
if(this.param.platform == 'alipay' && this.param.alipay_account == ''){
uni.showToast({
title:'请输入提现账户',
icon:'none'
})
return
}
if(this.param.price == ''){
uni.showToast({
title:'请输入提现金额',
icon:'none'
})
return
}
if(this.param.price > this.wallet.gift_money){
uni.showToast({
title:'提现金额高于可提现金额',
icon:'none'
})
return
}
if(this.param.price < 1){
uni.showToast({
title:'提现金额最少1',
icon:'none'
})
return
}
this.showPayPas = true
},
confirmTurnOut(){
if(this.param.pwd == ''){
uni.showToast({
title:'请输入支付密码',
icon:'none'
})
return
}
this.$request('/wallet/proposed',this.param).then((res)=>{
console.log('申请礼物收益提现',res)
if(res.code == 1){
this.showPayPas = false
this.getData()
uni.showToast({
title:'提交申请成功'
})
}else{
uni.showToast({
title:res.msg,
icon:'none'
})
}
})
},
validateNumber(e){
let val = e.detail.value
val = val.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
val = val.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
val = val.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
val = val.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');//只能输入两个小数
if (val.indexOf(".") < 0 && val != "") {//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
val = parseFloat(val);
}
//重新赋值给input
this.$nextTick(() => {
this.param.price = val
})
},
finish(e){
console.log('输入支付密码',e)
this.param.pwd = e
},
//绑定提现账户
bindAcount(){
uni.showActionSheet({
itemList: ['微信','支付宝'],
success: (res) => {
// this.param.platform = 'alipay'
if (res.tapIndex == 1) {
this.param.platform = 'alipay'
console.log(1111)
} else if (res.tapIndex == 0) {
this.param.platform = 'wechat'
}
},
fail: (res) => {
console.log(res.errMsg);
}
});
}
}
}
</script>
<style lang="scss" scoped>
.chooseAccountWrap{
border-top: 2rpx solid rgba(25,24,51,0.06);
background: #fff;
height: 88rpx;
padding: 0 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
.chooseRight{
display: flex;
align-items: center;
color: #c8c9cc;
image{width: 36rpx;height: 36rpx;}
input{
font-size: 28rpx;
text-align: end;
}
.inpPh{
font-size: 28rpx;
}
}
.chooseRight.active{
color: #323232;
}
}
.topLine{height: 2rpx;background: rgba(25,24,51,0.06);}
.rechargeWrap{
margin-top: 16rpx;
background: #fff;
padding: 32rpx 32rpx 24rpx;
.recTxt{
font-size: 30rpx;
}
.recInp{
padding-top: 36rpx;
display: flex;
height: 44rpx;
border-bottom: 2rpx solid #f2f3f5;
input{margin-left: 10rpx;font-size:27rpx;width: 100%;}
.recDol{
display: flex;
align-items: flex-end;
}
}
.turnTxt{
padding-top: 24rpx;
font-size: 24rpx;
color: #646566;
text{color: #4a8b94;padding-left: 16rpx;}
}
}
.bottomBtnWrap{
padding: 64rpx 32rpx 0;
.bottomBtn{
font-size: 32rpx;
background: #35655f;
width: 686rpx;
height: 88rpx;
border-radius: 16rpx;
text-align: center;
line-height: 88rpx;
color: #fff;
}
}
.payPasWrap{
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,0.5);
display: flex;
justify-content: center;
align-items: center;
.payPass{
.title{
font-size: 40rpx;
text-align: center;
font-weight: 600;
padding-top: 40rpx;
}
width: 700rpx;
height: 400rpx;
border-radius: 30rpx;
background: #fff;
.bottomBtnWrap{
padding-top: 80rpx;
height: 88rpx;
bottom: 0;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0rpx -14rpx 44rpx 0rpx rgba(85,123,218,0.08);
.bottomBtn{
width: 300rpx;
height:75rpx;
background: #35655f;
text-align: center;
line-height: 75rpx;
color: #fff;
border-radius: 50rpx;
}
}
}
}
</style>