| 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"); |
| } |
| }, |
| doNext: function () { |
| $.confirm('您正在进行解除签约操作,是否确定?', '解除签约确认', |
| function () { |
| V1UnSignbxy(null, function(ok, ret, err) { |
| if (ok) { |
| $.hideLoading(); |
| if (ret.code == 200) { |
| window.localStorage.setItem("signed", ret.signed); |
| $.alert('解除成功', "提示", function() { |
| window.location = 'main.html' |
| }); |
| } else { |
| $.alert(ret.msg, "错误"); |
| } |
| } else { |
| $.hideLoading(); |
| $.alert("请求失败了:" + ret.status + "请稍后再试", "错误"); |
| } |
| }) |
| }); |
| } |
| }; |
| app.initialize(); |