blob: 8862e73788309b8cc0ff3674df7bda496320a38a [file] [log] [blame]
qiaowei60c27e42019-07-11 16:43:54 +08001var dict;
2var app = {
3
4 // Application Constructor
5 initialize: function() {
6 document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
7 },
8 onDeviceReady: function() {
9 var phone = window.localStorage.getItem("phoneX");
10 if(!isEmpty(phone)){
11 $("#phone").text(phone)
12 }else{
13 phone = window.localStorage.getItem("phone");
14 $("#phone").text(phone)
15 }
qiaowei5f8f92f2019-11-15 10:27:57 +080016 $("#codebtn").attr("disabled","disabled")
17 $("#codebtn").addClass("vcodedisabled")
18 btnTime('codebtn');
19 },
20 getCode: function() {
qiaowei5f8f92f2019-11-15 10:27:57 +080021 $.showLoading("正在请求");
22 var param = {
qiaowei5f8f92f2019-11-15 10:27:57 +080023 }
qiaoweic5a87f72020-03-27 12:40:19 +080024 V1Bindcardcode(param, function(ok, ret) {
qiaowei5f8f92f2019-11-15 10:27:57 +080025 if (ok) {
26 $.hideLoading();
27 if (ret.code == 200) {
28 $("#codebtn").attr("disabled","disabled")
29 $("#codebtn").addClass("vcodedisabled")
30 btnTime('codebtn');
31 } else {
32 if (ret.code == -1) {
33 $.alert(ret.msg, "提示", function() {
34 window.location = "main.html"
35 });
36 } else {
37 $.alert(ret.msg, "错误");
38 }
39 }
40 } else {
41 $.hideLoading();
42 $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
43 }
44 })
qiaowei60c27e42019-07-11 16:43:54 +080045 },
46 doNext: function() {
47 var code = $("#code").val();
48 if(isEmpty(code)){
49 return;
50 }
qiaoweic5a87f72020-03-27 12:40:19 +080051 var agree = $("input[type=checkbox]:checked").val();
52 if(isEmpty(agree)){
53 $.alert("请同意市民卡免密代扣签约协议", "提示");
54 return;
55 }
qiaowei60c27e42019-07-11 16:43:54 +080056 $.showLoading("正在处理");
57 var param={
qiaoweic5a87f72020-03-27 12:40:19 +080058 "agree":code
qiaowei60c27e42019-07-11 16:43:54 +080059 }
qiaoweic5a87f72020-03-27 12:40:19 +080060 V1Signbxy(param,function(ok, ret, err) {
61 if (ok) {
62 $.hideLoading();
qiaowei60c27e42019-07-11 16:43:54 +080063 if(ret.code==200){
qiaoweic5a87f72020-03-27 12:40:19 +080064 window.localStorage.setItem("signed",ret.signed);
65 window.location="main.html";
qiaowei60c27e42019-07-11 16:43:54 +080066 }else{
qiaoweic5a87f72020-03-27 12:40:19 +080067 $.alert(ret.msg, "错误");
68 }
69 } else {
qiaowei60c27e42019-07-11 16:43:54 +080070 $.hideLoading();
qiaoweic5a87f72020-03-27 12:40:19 +080071 $.alert("请求失败了:" + ret.status+"请稍后再试", "错误");
qiaowei60c27e42019-07-11 16:43:54 +080072 }
73 })
74 }
75};
76app.initialize();