修改绑定功能
diff --git a/www/js/bill.js b/www/js/bill.js
index 4b0bca5..c0af3fd 100644
--- a/www/js/bill.js
+++ b/www/js/bill.js
@@ -9,6 +9,9 @@
curpage = 1;
this.loadBill(curpage)
},
+ toBack: function (){
+ window.history.back();
+ },
loadBill:function(pageno){
$.showLoading("加载中");
var param={
diff --git a/www/js/billdetail.js b/www/js/billdetail.js
index 057b106..3615234 100644
--- a/www/js/billdetail.js
+++ b/www/js/billdetail.js
@@ -8,6 +8,9 @@
onDeviceReady: function() {
this.loadBill()
},
+ toBack: function (){
+ window.history.back();
+ },
loadBill: function() {
var refno = window.localStorage.getItem("currentrefno");
if (isEmpty(refno)) {
diff --git a/www/js/bindcard.js b/www/js/bindcard.js
index 53ac0cf..e9cb86c 100644
--- a/www/js/bindcard.js
+++ b/www/js/bindcard.js
@@ -1,25 +1,58 @@
+var dict;
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
-
+
onDeviceReady: function() {
var uid = window.localStorage.getItem("uid");
- var phone = window.localStorage.getItem("phoneX");
- if(!isEmpty(phone)){
- $("#phone").val(phone)
- }else{
- phone = window.localStorage.getItem("phone");
- $("#phone").val(phone)
- }
+ this.loadData();
+ },
+ loadData: function() {
+ $.showLoading("正在加载");
+ V1Idtypes(function(ok, ret) {
+ if (ok) {
+ $.hideLoading();
+ if (ret.code == 200) {
+ dict = ret.idtypes;
+ let keys = Object.keys(dict);
+ let vals = Object.values(dict);
+ console.log(keys, vals)
+ var items=[];
+ for(var key of keys){
+ var bean = {
+ "title":dict[key],
+ "value":key
+ }
+ items.push(bean)
+ }
+ $("#idtype").val(items[0].title)
+ $("#idtype").attr("data-values",items[0].value)
+ $("#idtype").select({
+ title: "请选择证件类型",
+ items: items
+ });
+ } else {
+ $.alert(ret.msg, "错误");
+ }
+ } else {
+ $.hideLoading();
+ $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
+ }
+ })
},
doNext: function() {
- var code = $("#code").val();
- var cardnum = $("#cardnum").val();
- var name = $("#name").val();
- if(isEmpty(name)||isEmpty(code)||isEmpty(cardnum)){
+ var cardnum = $("#cardnum").val();
+ var name = $("#name").val();
+ var idno = $("#idno").val();
+ if (isEmpty(name) || isEmpty(cardnum)||isEmpty(idno)) {
+ return;
+ }
+ var idtype = $("#idtype").attr("data-values")
+ if(isEmpty(idtype)){
+ $.alert("请选择证件类型", "错误");
return;
}
/*var agree = $("input[type=checkbox]:checked").val();
@@ -28,62 +61,37 @@
return;
}*/
$.showLoading("正在处理");
- var param={
- "card":cardnum,
- "code":code,
- "name":name
+ var param = {
+ "cardno": cardnum,
+ "idtype": idtype,
+ "name": name,
+ "idno": idno
}
- V1Bindcard(param,function(ok,ret){
- if(ok){
+ V1Bindcard(param, function(ok, ret) {
+ if (ok) {
$.hideLoading();
console.log(ret)
- if(ret.code==200){
- window.localStorage.setItem("paypwdtype","new");
- window.localStorage.setItem("userid",ret.userid);
- window.localStorage.setItem("signed",ret.signed);
- window.localStorage.setItem("name",name);
- window.localStorage.setItem("paypwdset",ret.paypwdset);
- if(ret.paypwdset){
- if(!isEmpty(ret.signed)&&signed=='yes'){
- window.location='main.html'
- }else{
- window.location='signxy.html'
- }
- }else{
- window.location="paypwdset.html";
- }
- }else{
- if(ret.code==-1){
- $.alert(ret.msg, "提示",function(){
- window.location="main.html"
+ if (ret.code == 200) {
+ window.localStorage.setItem("phoneX",ret.phonex);
+ window.localStorage.setItem("name", name);
+ window.localStorage.setItem("personid", ret.personid);
+ window.localStorage.setItem("signed", ret.signed);
+ window.localStorage.setItem("paypwdset", ret.paypwdset);
+ window.location = "bindcheck.html";
+ } else {
+ if (ret.code == -1) {
+ $.alert(ret.msg, "提示", function() {
+ window.location = "main.html"
});
- }else{
- $.alert(ret.msg, "错误");
+ } else {
+ $.alert(ret.msg, "错误");
}
- }
- }else{
+ }
+ } else {
$.hideLoading();
- $.alert("请求失败了 "+ret.status+",请稍后再试", "错误");
- }
- })
- },
- getCode :function(){
- $.showLoading("请求中");
- V1Code(function(ok,ret){
- if(ok){
- $.hideLoading();
- if(ret.code==200){
- $("#codebtn").attr("disabled","disabled")
- $("#codebtn").addClass("vcodedisabled")
- btnTime('codebtn');
- }else{
- $.alert(ret.msg, "错误");
- }
- }else{
- $.hideLoading();
- $.alert("请求失败了"+ret.status+",请稍后再试", "错误");
+ $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
}
})
}
};
-app.initialize();
+app.initialize();
\ No newline at end of file
diff --git a/www/js/bindcheck.js b/www/js/bindcheck.js
new file mode 100644
index 0000000..a4214fc
--- /dev/null
+++ b/www/js/bindcheck.js
@@ -0,0 +1,57 @@
+var dict;
+var app = {
+
+ // Application Constructor
+ initialize: function() {
+ document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
+ },
+ onDeviceReady: function() {
+ var phone = window.localStorage.getItem("phoneX");
+ if(!isEmpty(phone)){
+ $("#phone").text(phone)
+ }else{
+ phone = window.localStorage.getItem("phone");
+ $("#phone").text(phone)
+ }
+ },
+ doNext: function() {
+ var code = $("#code").val();
+ if(isEmpty(code)){
+ return;
+ }
+ var personid = window.localStorage.getItem("personid");
+ $.showLoading("正在处理");
+ var param={
+ "personid":personid,
+ "code":code,
+ }
+ V1Checkcode(param,function(ok,ret){
+ if(ok){
+ $.hideLoading();
+ console.log(ret)
+ if(ret.code==200){
+ window.localStorage.setItem("paypwdtype", "new");
+ window.localStorage.setItem("userid", personid);
+ var signed = window.localStorage.getItem("signed");
+ var paypwdset = window.localStorage.getItem("paypwdset");
+ console.log(paypwdset)
+ if (!paypwdset||'false'==paypwdset) {
+ window.location = "paypwdset.html";
+ } else {
+ if (!isEmpty(signed) && signed == 'yes') {
+ window.location = 'main.html'
+ } else {
+ window.location = 'signxy.html'
+ }
+ }
+ }else{
+ $.alert(ret.msg, "错误");
+ }
+ }else{
+ $.hideLoading();
+ $.alert("请求失败了"+ret.status+",请稍后再试", "错误");
+ }
+ })
+ }
+};
+app.initialize();
\ No newline at end of file
diff --git a/www/js/card.js b/www/js/card.js
index 0c0a91e..8dc9675 100644
--- a/www/js/card.js
+++ b/www/js/card.js
@@ -4,17 +4,17 @@
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
-
+
onDeviceReady: function() {
var uid = window.localStorage.getItem("uid");
-
+
},
doNext: function() {
- var pwd = $("#pwd").val();
- if(isEmpty(pwd)){
+ var pwd = $("#pwd").val();
+ if (isEmpty(pwd)) {
return;
}
- if(pwd.length!=6){
+ if (pwd.length != 6) {
$.alert("支付密码为6位数字", "提示");
return;
}
@@ -26,24 +26,26 @@
}, function(ret) {
if (ret.buttonIndex == 2) {
$.showLoading("正在处理");
- var param={
- "paypwd":pwd
+ var param = {
+ "paypwd": pwd
}
- V1CardLost(param,function(ok,ret){
- if(ok){
+ V1CardLost(param, function(ok, ret) {
+ if (ok) {
$.hideLoading();
- if(ret.code==200){
- $.alert("卡片挂失成功", "提示");
- }else{
+ if (ret.code == 200) {
+ $.alert("卡片挂失成功", "提示", function() {
+ window.location = "main.html"
+ });
+ } else {
$.alert(ret.msg, "错误");
- }
- }else{
+ }
+ } else {
$.hideLoading();
- $.alert("请求失败了"+ret.status+",请稍后再试", "错误");
+ $.alert("请求失败了" + ret.status + ",请稍后再试", "错误");
}
})
}
})
}
};
-app.initialize();
+app.initialize();
\ No newline at end of file
diff --git a/www/js/index.js b/www/js/index.js
index ba4ea86..112a927 100644
--- a/www/js/index.js
+++ b/www/js/index.js
@@ -41,9 +41,10 @@
if(ret.now-t>1000*60*10){
window.location = "login.html";
}else{
-
window.location = "main.html";
}
+ }else{
+ window.location = "login.html";
}
} else {
//alert('无法请求到服务器,请检查网络并稍后再试');
diff --git a/www/js/main.js b/www/js/main.js
index 87d6f53..3b01a2a 100644
--- a/www/js/main.js
+++ b/www/js/main.js
@@ -2,6 +2,7 @@
// Application Constructor
initialize: function() {
+ this.initTab();
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
@@ -42,19 +43,47 @@
});
$('#secBtn').click(function() {
app.checkBefore(function() {
- window.location = "security.html";
+ app.checkOther(function() {
+ window.location = "security.html";
+ })
})
});
$('#usersec').click(function() {
app.checkBefore(function() {
- window.location = "security.html";
+ app.checkOther(function() {
+ window.location = "security.html";
+ })
})
});
this.initData();
},
+ initTab:function(){
+ $("#maincontent").css("top", $("#maintop").height())
+ var tab = new auiTab({
+ element: document.getElementById("footer"),
+ }, function(ret) {
+ window.localStorage.setItem("tabindex",ret.index);
+
+ changeTab(ret.index);
+ });
+ var tabindex = window.localStorage.getItem("tabindex");
+ if(!tabindex||tabindex==0){
+ tabindex = 1
+ }
+ changeTab(tabindex);
+ tab.setActive(tabindex)
+ function changeTab(index){
+ if (index == 1) {
+ $("#main1").show();
+ $("#main2").hide();
+ } else if (index == 2) {
+ $("#main1").hide();
+ $("#main2").show();
+ }
+ }
+ },
initData: function() {
this.loadBill()
-
},
loadBill: function() {
$("#loaddata").show()
@@ -122,7 +151,7 @@
$("#loaddata").hide()
$("#nodata").hide();
$("#billcontent").show();
-
+
},
initView: function() {
var userid = window.localStorage.getItem("userid");
@@ -210,18 +239,18 @@
}
}
},
- toSign:function(){
+ toSign: function() {
window.location = 'signxycheck.html'
},
toBillDetail: function(refno) {
window.localStorage.setItem("currentrefno", refno);
window.location = 'billdetail.html';
},
- toCard:function(){
+ toCard: function() {
var userid = window.localStorage.getItem("userid");
if (isEmpty(userid)) {
window.location = 'bindcard.html'
- }else{
+ } else {
window.location = 'cardinfor.html'
}
}
diff --git a/www/js/server.js b/www/js/server.js
index 3194de9..94f7c65 100644
--- a/www/js/server.js
+++ b/www/js/server.js
@@ -6,6 +6,9 @@
if (dev) {
SERVER = "http://172.28.43.3:8099/payapi/mobileapi";
}
+function V1Idtypes(callback) {
+ ajaxPost("/v1/idtypes", {}, callback)
+}
function V1Cardinfor(callback) {
ajaxPost("/v1/cardinfor", {}, callback)
}
diff --git a/www/js/signxycheck.js b/www/js/signxycheck.js
index f97f3d4..4e52298 100644
--- a/www/js/signxycheck.js
+++ b/www/js/signxycheck.js
@@ -10,17 +10,23 @@
$.showLoading("加载中");
V1Bxy(function(ok, ret, err) {
if (ok) {
- $.hideLoading();
- if(ret.code==200){
+ $.hideLoading();
+ if (ret.code == 200) {
$("#content").html(ret.page);
- if(isEmpty(ret.signed)||ret.signed!='yes'){
- $("#btn").show();
- $("#content").css("bottom","135px");
- }else{
- $("#content").css("bottom","10px");
+ if (isEmpty(ret.signed) || ret.signed != 'yes') {
+ $("#btn").show();
+ $("#content").css("bottom", "135px");
+ } else {
+ $("#content").css("bottom", "10px");
}
- }else{
- $.alert(ret.msg, "错误");
+ } else {
+ if (ret.code == -1) {
+ $.alert(ret.msg, "提示", function() {
+ window.location = 'bindcard.html'
+ });
+ } else {
+ $.alert(ret.msg, "错误");
+ }
}
} else {
$.hideLoading();
@@ -28,28 +34,28 @@
}
})
},
- agreeXY:function(){
+ agreeXY: function() {
var agree = $("input[type=checkbox]:checked").val();
- if(isEmpty(agree)){
+ if (isEmpty(agree)) {
$.alert("请同意签约代扣协议", "提示");
return;
}
$.showLoading("正在请求");
- var param={
- "agree":agree
+ var param = {
+ "agree": agree
}
- V1Signbxy(param,function(ok, ret, err) {
+ V1Signbxy(param, function(ok, ret, err) {
if (ok) {
- $.hideLoading();
- if(ret.code==200){
- window.localStorage.setItem("signed",ret.signed);
- window.location="main.html";
- }else{
+ $.hideLoading();
+ if (ret.code == 200) {
+ window.localStorage.setItem("signed", ret.signed);
+ window.location = "main.html";
+ } else {
$.alert(ret.msg, "错误");
}
} else {
$.hideLoading();
- $.alert("请求失败了:" + ret.status+"请稍后再试", "错误");
+ $.alert("请求失败了:" + ret.status + "请稍后再试", "错误");
}
})
}