基础版本
diff --git a/www/js/scan.js b/www/js/scan.js
new file mode 100644
index 0000000..e75eba8
--- /dev/null
+++ b/www/js/scan.js
@@ -0,0 +1,129 @@
+var app = {
+
+    // Application Constructor
+    initialize: function() {
+        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
+    },
+
+    onDeviceReady: function() {
+        console.log(2);
+        if (typeof(QRScanner) != 'undefined') {
+            //初始化检测,申请摄像头等权限
+            console.log(1);
+            QRScanner.destroy();
+            QRScanner.prepare(onDone); // show the prompt
+        } else {
+            $.alert('插件加载失败');
+        }
+        //showRet("http://ykt.supwisdom.com:9116/epay/wxpage/index")
+        function onDone(err, status) {
+            if (err) {
+                console.log(err);
+                $.alert('启动扫描出错:' + JSON.stringify(err), '提示');
+            }
+            if (status.authorized) {
+                //绑定扫描监听
+                // `QRScanner.cancelScan()` is called.
+                QRScanner.scan(displayContents);
+
+                function displayContents(err, text) {
+                    if (err) {
+                        // an error occurred, or the scan was canceled (error code `6`)
+                        $.alert('扫描出错,请稍后再试:' + JSON.stringify(err), '提示');
+                    } else {
+                        // The scan completed, display the contents of the QR code:
+                        //$.alert(text, '提示');
+                        showRet(text);
+                        QRScanner.destroy();
+                    }
+                }
+                //开始扫描,需要将页面的背景设置成透明
+                QRScanner.show();
+                console.log("QRScanner.scan");
+            } else if (status.denied) {
+                // The video preview will remain black, and scanning is disabled. We can
+                // try to ask the user to change their mind, but we'll have to send them
+                // to their device settings with `QRScanner.openSettings()`.
+                $.alert('无法请求道相机权限,请在设置中开启', '提示');
+            } else {
+                // we didn't get permission, but we didn't get permanently denied. (On
+                // Android, a denial isn't permanent unless the user checks the "Don't
+                // ask again" box.) We can ask again at the next relevant opportunity.
+                $.alert('无法请求道相机权限,请在设置中开启', '提示');
+            }
+        }
+        this.receivedEvent()
+    },
+    receivedEvent: function() {
+        var light = false;
+        $('#lightBtn').click(function() {
+            if (light) {
+                QRScanner.enableLight();
+            } else {
+                QRScanner.disableLight();
+            }
+            light = !light;
+        });
+    },
+    goPage: function() {
+        QRScanner.destroy();
+        window.location = "main.html"
+    }
+};
+app.initialize();
+var inAppBrowserRef;
+function showRet(url) {
+    if(isEmpty(url)){
+        return;
+    }
+    var userid = window.localStorage.getItem("userid"); 
+    if(url.indexOf("?")>0){
+        url=url+'&uid='+userid;
+    }else{
+        url=url+'?uid='+userid;
+    }
+    inAppBrowserRef = cordova.ThemeableBrowser.open(url, '_blank', {
+        statusbar: {
+            color: '#03a9f4ff'
+        },
+        toolbar: {
+            height: 44,
+            color: '#03a9f4ff'
+        },
+        title: {
+            color: '#ffffffff',
+            showPageTitle: true
+        },
+        backButton: {
+            image: 'back.png',
+            imagePressed: 'back.png',
+            align: 'left',
+            event: 'backPressed'
+        },
+        closeButton: {
+            image: 'close.png',
+            imagePressed: 'close.png',
+            align: 'left',
+            event: 'closePressed'
+        },
+        backButtonCanClose: true
+    }).addEventListener('backPressed', function(e) {
+        //alert('back pressed');
+    }).addEventListener('closePressed', function(e) {
+        //alert('closePressed pressed');
+        inAppBrowserRef.close();
+        window.location = "main.html"
+    }).addEventListener(cordova.ThemeableBrowser.EVT_ERR, function(e) {
+        console.error(e.message);
+    }).addEventListener(cordova.ThemeableBrowser.EVT_WRN, function(e) {
+        console.log(e.message);
+    });
+    inAppBrowserRef.addEventListener('loadstart', loadStartCallBack);
+    inAppBrowserRef.addEventListener('beforeload', beforeloadCallBack);
+}
+function loadStartCallBack(params,callback) {
+    console.log("1",params.url);
+}
+function beforeloadCallBack(params,callback) {
+    console.log("2",params.url);
+}