my_withdraw.html
4.3 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
<!DOCTYPE html>
<html lang="en">
{include file="public/head"/}
<link rel="stylesheet" href="__CDN__/assets/advertising/css/record.css">
<style>
.btn {
margin: 0.3rem 0;
}
</style>
<body>
<div class="my_wallet">
<!-- 钱包余额 -->
<div class="wallet_money layout align_center justify_center flex_diection">
<div class="wallet_tips">我的钱包金额</div>
<div class="wallet_coupon">{$user.exp}</div>
<div class="wallet_num">约¥{$user.rmb}</div>
</div>
<!-- 提现金额 -->
<div class="with_drawal_money">
<div class="width_drawal_box">
<div class="width_drawal_tips">提现金额</div>
<div class="choice_with_drawal layout align_center justify flex_row flex_wrap">
{foreach name="$data" item="vo"}
<div class="choice_single layout align_center justify_center flex_diection" data-exp="{$vo}" data-rmb="{$key}">
<div class="choice_money">{$key}元</div>
<div class="choice_coupon">消耗{$vo}红包券</div>
</div>
{/foreach}
</div>
<div class="btn">立即提现</div>
</div>
</div>
<!-- 提现弹窗 -->
<div class="with_drawal_modal"></div>
<div class="with_drawal_dialog">
<div class="with_drawal_dialog_box">
<div class="layout justify flex_row with_dialog_title">
<div class="with_drawal_tips">提现账户</div>
<div class="with_drawal_account">微信余额</div>
</div>
<div class="layout justify flex_row with_dialog_msg">
<div>提现金额</div>
<div class="rmb">10元</div>
</div>
<div class="layout justify flex_row with_dialog_msg">
<div>消耗红包劵</div>
<div class="exp">-10000</div>
</div>
<div class="layout justify flex_row with_dialog_btns">
<div class="with_btn_l">取消</div>
<div class="with_btn_r">确认</div>
</div>
</div>
</div>
</div>
{include file="public/js" /}
<script>
// 选择提现金额
$(".choice_single").click(function() {
$(this).addClass("choiced");
$(this).siblings().removeClass("choiced");
})
// 提现
$(".btn").click(function() {
var user_exp = $('.wallet_coupon').text();
var exp = $('.choiced').attr('data-exp');
var rmb = $('.choiced').attr('data-rmb');
if(exp == undefined){
toast('请选择提现金额');
return false;
}else if(user_exp < exp){
toast('提现金额过高');
return false;
}
$(".rmb").text(rmb+"元");
$(".exp").text("-"+exp);
$(".with_drawal_modal").show();
$(".with_drawal_dialog").show();
})
// 取消
$(".with_btn_l").click(function() {
$(".with_drawal_modal").hide();
$(".with_drawal_dialog").hide();
})
// 确认提现
$(".with_btn_r").click(function() {
var user_id = "{$user.id}";
var exp = $('.choiced').attr('data-exp');
$.ajax({
url:"{:url('withdraw')}",
type:"POST",
data:{'user_id':user_id,'exp':exp},
success:function(res){
if(res.code == 1){
toast("请等待提现审核");
setTimeout(function(){
window.location.href = '';
},2000)
}else{
toast(res.msg);
if(res.url != ''){
setTimeout(function(){
window.location.href = res.url;
},2000)
}
}
},
error:function(res){
toast("与服务器断开连接");
}
})
})
</script>
</body>
</html>