| var app = { |
| |
| // Application Constructor |
| initialize: function() { |
| document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); |
| }, |
| |
| onDeviceReady: function() { |
| $.showLoading("加载中"); |
| V1Cardinfor(function(ok, ret, err) { |
| if (ok) { |
| $.hideLoading(); |
| if(ret.code==200){ |
| $("#name").text(ret.name); |
| $("#cardnum").text(ret.cardno); |
| $("#cardstatus").text(ret.cardstatus); |
| }else{ |
| $.alert(ret.msg, "错误"); |
| } |
| } else { |
| $.hideLoading(); |
| $.alert("加载失败了:" + ret.status, "错误"); |
| } |
| }) |
| }, |
| unBindcard: function(){ |
| var dialog = new auiDialog({}) |
| dialog.prompt({ |
| title:"请输入支付密码", |
| text:'请输入支付密码', |
| buttons:['取消','确定'] |
| },function(ret){ |
| console.log(ret); |
| if(ret.buttonIndex == 2){ |
| if(!isEmpty(ret.text)){ |
| $.showLoading("正在请求"); |
| var param = { |
| "paypwd":ret.text |
| } |
| V1Unbindcard(param,function(ok, ret, err) { |
| if (ok) { |
| $.hideLoading(); |
| if(ret.code==200){ |
| window.localStorage.removeItem("userid"); |
| $.alert('解绑成功', "提示", function() { |
| window.location = 'main.html' |
| }); |
| }else{ |
| $.alert(ret.msg, "错误"); |
| } |
| } else { |
| $.hideLoading(); |
| $.alert("请求失败了:" + ret.status, "错误"); |
| } |
| }) |
| } |
| } |
| }); |
| var input = $(".aui-dialog-body").find("input"); |
| if(input){ |
| input.attr("type","password"); |
| } |
| } |
| }; |
| app.initialize(); |