基础版本
diff --git a/www/js/main.js b/www/js/main.js
new file mode 100644
index 0000000..87d6f53
--- /dev/null
+++ b/www/js/main.js
@@ -0,0 +1,229 @@
+var app = {
+
+    // Application Constructor
+    initialize: function() {
+        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
+    },
+
+    onDeviceReady: function() {
+        var uid = window.localStorage.getItem("token");
+        console.log(CURRENT_INDEX);
+        $('#scanBtn').click(function() {
+            //window.location = "scan.html";
+            app.checkBefore(function() {
+                app.checkOther(function() {
+                    window.location = "scan.html";
+                })
+            })
+        });
+        $('#qrcodeBtn').click(function() {
+            app.checkBefore(function() {
+                app.checkOther(function() {
+                    window.location = "qrcode.html";
+                })
+            })
+        });
+        $('#cardBtn').click(function() {
+            app.checkBefore(function() {
+                app.checkOther(function() {
+                    window.location = "card.html";
+                })
+            })
+        });
+        $('#billBtn').click(function() {
+            app.checkBefore(function() {
+                window.location = "bill.html";
+            })
+        });
+        $('#moreBtn').click(function() {
+            app.checkBefore(function() {
+                window.location = "bill.html";
+            })
+        });
+        $('#secBtn').click(function() {
+            app.checkBefore(function() {
+                window.location = "security.html";
+            })
+        });
+        $('#usersec').click(function() {
+            app.checkBefore(function() {
+                window.location = "security.html";
+            })
+        });
+        this.initData();
+    },
+    initData: function() {
+        this.loadBill()
+
+    },
+    loadBill: function() {
+        $("#loaddata").show()
+        $("#nodata").hide();
+        var param = {
+            "pageno": 1
+        }
+        V1Bills(param, function(ok, ret) {
+            if (ok) {
+                console.log(ret)
+                if (ret.code == 200) {
+                    $("#maingt").text(ret.t + "!")
+                    $("#user-amount").text(ret.amount)
+                    $("#user-point").text(ret.point)
+                    if (ret.needrebind) {
+                        window.localStorage.removeItem("userid");
+                    } else {
+                        window.localStorage.setItem("userid", ret.userid);
+                    }
+                    window.localStorage.setItem("signed", ret.signed);
+                    window.localStorage.setItem("paypwdset", ret.paypwdset);
+                    window.localStorage.setItem("name", ret.name);
+                    if (ret.page && ret.page.count > 0) {
+                        GLOBAL_TODAY = ret.today;
+                        GLOBAL_YESTERDAY = ret.yesterday;
+                        app.initBillView(ret.page)
+                        app.initView();
+                    } else {
+                        $("#loaddata").hide()
+                        $("#nodatahint").text("暂无数据")
+                        $("#nodata").show();
+                        app.initView();
+                    }
+                } else {
+                    $("#loaddata").hide()
+                    $("#nodatahint").text("数据加载异常")
+                    $("#nodata").show();
+                    app.initView();
+                }
+            } else {
+                $("#loaddata").hide()
+                $("#nodatahint").text("请求数据失败")
+                $("#nodata").show();
+                app.initView();
+            }
+        })
+    },
+
+    initBillView: function(page) {
+        var html = '';
+        for (var i = 0; i < page.data.length; i++) {
+            var bean = page.data[i]
+            html += '<div class="aui-card-list-header aui-card-list-user" onclick="app.toBillDetail(\'' + bean.refno + '\')">';
+            html += '<div class="aui-card-list-user-avatar"><img src="img/icon_meal.png" class="aui-margin-r-10 aui-img-round" />';
+            html += '</div><div class="aui-card-list-user-name">';
+            html += '<div>' + bean.transdesc + '</div>';
+            if (bean.tradeflag == 'in') {
+                html += '<div class="aui-list-item-right">+' + bean.amount + '</div>';
+            } else {
+                html += '<div class="aui-list-item-right">' + bean.amount + '</div>';
+            }
+            html += '</div><div class="aui-card-list-user-info">' + formatDateNoYear(bean.transdate, bean.transtime) + '</div></div>';
+        }
+        $("#billcontent").html(html);
+        $("#loaddata").hide()
+        $("#nodata").hide();
+        $("#billcontent").show();
+        
+    },
+    initView: function() {
+        var userid = window.localStorage.getItem("userid");
+        var signed = window.localStorage.getItem("signed");
+        if (isEmpty(userid)) {
+            $("#userbank").text("未绑定");
+            $("#userbank").css("color", "red")
+        } else {
+            $("#userbank").text("已绑定");
+            $("userbank").css("color", "#757575");
+        }
+        if (isEmpty(signed) || signed != 'yes') {
+            $("#usersign").text("未签约");
+            $("#usersign").css("color", "red")
+        } else {
+            $("#usersign").text("已签约");
+            $("usersign").css("color", "#757575");
+        }
+        var phone = window.localStorage.getItem("phoneX");
+        if (!isEmpty(phone)) {
+            $("#userphone").text(phone)
+        }
+        var name = window.localStorage.getItem("name");
+        if (isEmpty(name)) {
+            $("#username").text("匿名")
+        } else {
+            $("#username").text(name)
+            $("#homename").text(name)
+        }
+    },
+    checkBefore: function(callback) {
+        var uid = window.localStorage.getItem("token");
+        if (isEmpty(uid)) {
+            window.location = "login.html";
+        } else {
+            var userid = window.localStorage.getItem("userid");
+            if (isEmpty(userid)) {
+                var cum = new auiDialog({});
+                var confirm = cum.alert({
+                    title: "提示",
+                    msg: '为了不影响您正常使用相关功能,请先绑定银行卡',
+                    buttons: ['取消', '去绑卡']
+                }, function(ret) {
+                    if (ret.buttonIndex == 2) {
+                        window.location = 'bindcard.html'
+                    }
+                })
+            } else {
+                if (callback) {
+                    callback()
+                }
+            }
+        }
+    },
+    checkOther: function(callback) {
+        var payseted = window.localStorage.getItem("paypwdset");
+        var signed = window.localStorage.getItem("signed");
+        var cum = new auiDialog({});
+        console.log(payseted, signed)
+        if (isEmpty(payseted) || !payseted || payseted != 'true') {
+            var confirm = cum.alert({
+                title: "提示",
+                msg: '您还没有设置支付密码,无法使用该功能',
+                buttons: ['取消', '去设置']
+            }, function(ret) {
+                if (ret.buttonIndex == 2) {
+                    window.location = 'paypwdset.html'
+                }
+            })
+        } else {
+            if (isEmpty(signed) || signed != 'yes') {
+                var confirm = cum.alert({
+                    title: "提示",
+                    msg: '您尚未签约代扣免密付协议,无法使用该功能',
+                    buttons: ['取消', '去签约']
+                }, function(ret) {
+                    if (ret.buttonIndex == 2) {
+                        window.location = 'signxy.html'
+                    }
+                })
+            } else {
+                if (callback) {
+                    callback()
+                }
+            }
+        }
+    },
+    toSign:function(){
+        window.location = 'signxycheck.html'
+    },
+    toBillDetail: function(refno) {
+        window.localStorage.setItem("currentrefno", refno);
+        window.location = 'billdetail.html';
+    },
+    toCard:function(){
+        var userid = window.localStorage.getItem("userid");
+        if (isEmpty(userid)) {
+            window.location = 'bindcard.html'
+        }else{
+            window.location = 'cardinfor.html'
+        }
+    }
+};
+app.initialize();
\ No newline at end of file