e 8 years ago
parent
commit
f074382099

File diff suppressed because it is too large
+ 0 - 0
www/webapp/o2o/dist/js/api.js


File diff suppressed because it is too large
+ 0 - 0
www/webapp/o2o/dist/js/build/template.js


File diff suppressed because it is too large
+ 0 - 0
www/webapp/o2o/dist/js/main.js


+ 1 - 1
www/webapp/o2o/dist/js/page/balanceLog.js

@@ -1 +1 @@
-define(["$","template","IScroll","user","product","native","config","address","api"],function(e,t,n,r,i,s,o,u,a){function l(t){t.preventDefault(),e(document).trigger("spa:navigate",{hash:f,pushData:{dontNeedReload:!0}})}var f;return{title:"家庭保洁",body:"",init:function(t,n){var r=this,i=e(document);r.on("swipeRight",function(e){l.call(this,e)}),e.newTouch(".back-button",function(e){l.call(this,e)},r),r.on("tapBackButton",function(e){l.call(this,e)}),n.resolve()},beforeopen:function(e,t){var n=e.pushData;f=n.backHash?n.backHash:"",t.resolve()},afteropen:function(i,s){var u=this,f=e(document);a.getBalanceLog({id:r.id},function(e){console.log(e),e.success?console.log(e):e.error&&console.log("error")});if(i.pushData&&i.pushData.needReset){var l=t("balanceLog/index",{showNavBar:!o.isWX});e(".spa-page-body",u).html(l),setTimeout(function(){i.scroll=new n("#balanceLogScroll")},500)}s.resolve()},beforeclose:function(e,t){t.resolve()}}});
+define(["$","template","IScroll","user","product","native","config","address","api"],function(e,t,n,r,i,s,o,u,a){function c(t){t.preventDefault(),e(document).trigger("spa:navigate",{hash:f,pushData:{dontNeedReload:!0}})}var f,l;return{title:"家庭保洁",body:"",init:function(t,n){var r=this,i=e(document);r.on("swipeRight",function(e){c.call(this,e)}),e.newTouch(".back-button",function(e){c.call(this,e)},r),r.on("tapBackButton",function(e){c.call(this,e)}),n.resolve()},beforeopen:function(e,t){var n=e.pushData;f=n.backHash?n.backHash:"",t.resolve()},afteropen:function(i,s){var o=this,u=e(document);a.getBalanceLog({id:r.id},function(r){if(r.success){console.log(r);for(var s=0;s<r.length;s++)console.log(r[s]);var u=t("balanceLog/index",{balanceLog:r.message});e(".spa-page-body",o).html(u),setTimeout(function(){i.scroll=new n("#balanceLogScroll")},500)}else r.error&&console.log("error")}),console.log(l),s.resolve()},beforeclose:function(e,t){t.resolve()}}});

+ 1 - 1
www/webapp/o2o/js/api.js

@@ -85,7 +85,7 @@ define(['config', 'base'], function (config, base) {
         var that = this;
         this.isLoading = true;
         $.signAjax({
-            url: 'http://admin.yiguanjia.me/index.php?r=rUser/balanceLog',
+            url: config.apiPath + '/index.php?r=o2o/user/getUserBalanceLog',
             data: data,
             dataType: 'JSON',
             success: function (res) {

File diff suppressed because it is too large
+ 2 - 2
www/webapp/o2o/js/build/template.js


+ 19 - 24
www/webapp/o2o/js/page/balanceLog.js

@@ -1,5 +1,7 @@
-define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'address','api'], function ($, template, IScroll, user, product, native, config, address,api) {
+define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'address', 'api'], function ($, template, IScroll, user, product, native, config, address, api) {
     var backHash;
+    var balanceLog;
+
     function back(event) {
         event.preventDefault();
         $(document).trigger('spa:navigate', {
@@ -9,6 +11,7 @@ define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'addr
             }
         });
     }
+
     return {
         title: '家庭保洁',
         body: '',
@@ -16,26 +19,16 @@ define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'addr
             /* this是什么? */
             var $view = this;
             var $doc = $(document);
-
-            /* 定义按钮事件。
-             * 为什么不是$(selector).onclick(function)呢?
-             */
-
-
             // 返回
             $view.on('swipeRight', function (event) {
                 back.call(this, event);
             });
-
             $.newTouch('.back-button', function (event) {
                 back.call(this, event);
             }, $view);
-
             $view.on('tapBackButton', function (event) {
                 back.call(this, event);
             });
-
-
             dtd.resolve();
         },
         beforeopen: function (pageData, dtd) {
@@ -48,25 +41,27 @@ define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'addr
             var $view = this;
             var $doc = $(document);
             api.getBalanceLog({
-                id:user.id
-            },function (res) {
-                console.log(res);
-                if(res.success){
+                id: user.id
+            }, function (res) {
+                if (res.success) {
                     console.log(res);
-                }else if(res.error){
+                    for(var i=0;i<res.length;i++){
+                        console.log(res[i]);
+                    }
+                    var tpl = template('balanceLog/index', {
+                        balanceLog: res.message
+                    });
+                    $('.spa-page-body', $view).html(tpl);
+                    setTimeout(function () {
+                        pageData.scroll = new IScroll('#balanceLogScroll');
+                    }, 500);
+                } else if (res.error) {
                     console.log('error');
                 }
             });
-            if (pageData.pushData && pageData.pushData.needReset) {
-                var tpl = template('balanceLog/index', {showNavBar: !config.isWX});
-                $('.spa-page-body', $view).html(tpl);
-                setTimeout(function () {
-                    pageData.scroll = new IScroll('#balanceLogScroll');
-                }, 500);
+            console.log(balanceLog);
 
-            }
 
-            /* 又是这个。不知道什么玩意…… */
             dtd.resolve();
         },
         beforeclose: function (pageData, dtd) {

+ 0 - 9
www/webapp/o2o/tpl/balanceLog/index.html

@@ -1,12 +1,3 @@
-{{ if showNavBar }}
-<header class="bar bar-nav">
-    <a class="left-button back-button">
-        <div class="icon icon-left-nav"></div>
-    </a>
-    <h1 class="title">消费记录</h1>
-</header>
-{{ /if }}
-
 <div class="content">
     <div class="box-container">
         <div class="box-container box box-vertical">

Some files were not shown because too many files changed in this diff