-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathbank.html
201 lines (174 loc) · 7.44 KB
/
bank.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Cache-Control" content="private">
<meta content="telephone=no,email=no" name="format-detection">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta http-equiv="Access-Control-Allow-Origin" content="*" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>银行卡管理</title>
<link rel="stylesheet" href="./css/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="./css/common/style.css">
<script src="./js/lib/rem.js"></script>
<script src="./js/lib/jquery-3.3.1.min.js"></script>
<script src="./js/lib/common.js"></script>
</head>
<style>
.bank{width:100%;height:100%;background:#fff;position:fixed;}
.head{width:100%;height:1rem;line-height:1rem;text-align:center;background:#0c5dac;position:relative}
.head-back{width:20%;height:1rem;position:absolute;left:0;top:0;display:flex;flex-direction:row;align-items:center;justify-content:center;}
.head-back > i.back{width:0.4rem;height:0.4rem;display:inline-block;background:url('./img/icons/left.png') no-repeat;background-size:0.4rem;}
.head-back > span{font-size:0.3rem;color:#fff;}
.head-title{width:100%;height:1rem;line-height:1rem;text-align:center;background:#0c5dac;}
.head-title > span{font-size:0.34rem;color:#fff;}
.add-bank{width:15%;height:1rem;position:absolute;right:0;top:0;display:flex;flex-direction:row;align-items:center;justify-content:center;}
.add-bank > i.add{width:0.4rem;height:0.4rem;background:url('./img/icons/add.png') no-repeat;background-size:0.4rem;}
.platform-empty{width:100%;height:4rem;display:flex;flex-direction:column;justify-content:center;align-items:center;}
.platform-empty > img{width:1.5rem;height:1rem;}
.platform-empty > span{font-size:0.3rem;color:#666;margin-top:0.3rem;}
.bank-list{width:100%;height:calc(100% - 1.2rem);margin-top:0.2rem;}
.bank-item{width:100%;height:1.2rem;margin-bottom:0.2rem;border-bottom:0.02rem solid #ccc;display:flex;flex-direction:row;}
.bank-img{width:25%;height:1.2rem;line-height:1.2rem;text-align:center;}
.bank-img > img{width:0.7rem;height:0.7rem;}
.bank-infor{width:50%;height:1.2rem;display:flex;flex-direction:column;justify-content:center;}
.bank-infor > span{color:#222;font-size:0.32rem;}
.bank-infor > p{color:#999;font-size:0.26rem;margin:0 !important;}
.unbind-card{width:25%;height:1.2rem;line-height:1.2rem;text-align:center;}
.unbind-card > span{font-size:0.28rem;color:#f00;}
.unbind-bankCard{display:none;position:absolute;left:0;top:0;z-index:2;width:100%;height:100%;background:rgba(0,0,0,0.2);}
.unbind-bankCard-bg{position:absolute;left:0;bottom:-25%;z-index:3;width:100%;height:25%;background:#f2f2f2;}
.unbind-contain{width:100%;height:auto;}
.unbind-contain > div{height:1.2rem;line-height:1.2rem;margin-bottom:0.2rem;text-align:center;background:#fff;}
.unbind-contain > div#confirmUnbind > span{font-size:0.32rem;color:#f00;}
.unbind-contain > div#cancelBtn > span{font-size:0.32rem;color:#222;}
</style>
<body>
<div class="bank">
<div class="head">
<div class="head-back" onClick='location.href="./person-infor.html"'>
<i class="back"></i>
<span>返回</span>
</div>
<div class="head-title">
<span>银行卡管理</span>
</div>
<a href="./bank-add.html" class="add-bank" >
<i class="add"></i>
</a>
</div>
<div class="bank-list" id="bankList">
</div>
<div id="unbindCard-mask" class="unbind-bankCard"></div>
<div id="unbindCard" class="unbind-bankCard-bg">
<div class="unbind-contain">
<div id="confirmUnbind">
<span>确定解除绑定</span>
</div>
<div id="cancelBtn">
<span>取消</span>
</div>
</div>
</div>
</div>
<div id="taskdiv"></div>
<script src="./js/sendtask.js"></script>
<script src="./js/update.js"></script>
<script src="./js/lib/map/maps-1.4.14.js"></script>
<script>
var taskstate = localStorage.getItem('taskstate');
if(taskstate === "true"){
//after five minutes send task start
setTimeSendTaskStart();
}
var userid = localStorage.getItem('userid');
var pageIndex = 1;
var pageTotal = null;
showBindBankCardList(url,userid,pageIndex);
function showBindBankCardList(url,userid,pageIndex){
if(userid){
$.ajax({
type:'POST',
url:url+'bank/selectBank',
dataType:'json',
data:{
userId:userid,
pageNum:pageIndex, //当前页
pageDataCount:20,
},
success:function(data){
if(data.code === 403){
location.href = './login.html';
}else if(data.code === 404){
alert('设备被锁');
}else if(data.code === 5000 ){
pageTotal = data.pages;
if(data.pageList.length !== 0){
var bankListHtml = '';
var bankImg = '';
for(var i=0;i<data.pageList.length;i++){
switch(data.pageList[i].openingBank){
case '中国银行': bankListHtml += bankInfor(data.pageList[i].id,'./img/bank-zg.png','中国银行',data.pageList[i].bankNumber);;break;
case '中国建设银行':bankListHtml += bankInfor(data.pageList[i].id,'./img/bank-js.png','中国建设银行',data.pageList[i].bankNumber);;break;
case '中国农业银行':bankListHtml += bankInfor(data.pageList[i].id,'./img/bank-ny.png','中国农业银行',data.pageList[i].bankNumber);;break;
case '中国工商银行':bankListHtml += bankInfor(data.pageList[i].id,'./img/bank-gs.png','中国工商银行',data.pageList[i].bankNumber);;break;
}
}
$('#bankList').append(bankListHtml);
//show unbind bank card modal
showUnbindCardModal(url,userid);
}else{
$('#bankList').html('<div class="platform-empty"><img src="./img/icons/no-record.png" alt=""><span>暂无数据</span></div>');
}
}
}
});
}else{
location.href = './login.html';
}
}
function bankInfor(bankid,bankimg,bankname,banknumber){
return '<div class="bank-item"><div class="bank-img" data-bankid="'+ bankid +'">'+
'<img src="'+ bankimg +'" alt="">'+
'</div><div class="bank-infor">'+
'<span>'+ bankname +'</span>'+
'<p>尾号'+ banknumber.substr(banknumber.length-4,4) +' 储蓄卡</p>'+
'</div><div class="unbind-card"><span>解除绑定</span></div></div>';
}
//show unbind bank card modal
function showUnbindCardModal(url,userid){
$('.unbind-card').unbind('click').click(function(){
var curIndex = $(this).index();
var bankid = $(this).attr('data-bankid');
$('#unbindCard-mask').show();
$('#unbindCard').animate({bottom:'0'},300);
//confirm unbind bank card
confirmUnbindBankCard(url,userid,bankid);
});
//hide bottom cancel unbind bank card Modal
$('#cancelBtn').unbind('click').click(function(){
$('#unbindCard-mask').hide();
$('#unbindCard').animate({bottom:'-25%'},400);
});
}
//confirm unbind bank card
function confirmUnbindBankCard(url,userid,bankid){
$('#confirmUnbind').unbind('click').click(function(){
$.ajax({
type:'POST',
url:url+'bank/unbindBank',
dataType:'json',
data:{
userId:userid,
bankid:bankid
},
success:function(data){
console.log(data);
}
});
})
}
</script>
</body>
</html>