注册
登录
diff --git a/web/dist/js/order-app.js b/web/dist/js/order-app.js
index e4a160b..37f8184 100644
--- a/web/dist/js/order-app.js
+++ b/web/dist/js/order-app.js
@@ -1 +1 @@
-define("order-app",["mk7/app"],function(t){var n=Dom7,e=function(){var t=n(".ui-loading-block");0==t.length&&(n(".view-main").html('
'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",t&&(n.innerHTML='加载速度太慢?试试
重新加载',t.appendChild(n))},window.waitingTime))},i=!0;return t.name="order",t.routes={index:function(){return i=!1,e(),t.runController("index")},"index/:tab":function(n){i=!1,e();var r={tab:n};return t.runController("index",r)},rate:function(){return i=!1,e(),t.runController("rate")},submit:function(){return i=!1,e(),t.runController("submit")},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var i=Dom7,r=Template7,t=new t,o="order/default/order-list";return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.tab=t.params.tab,t.page=0,t.nodata="",t.loading=!1,t.pageCount=1,t.render({tab:t.tab}),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.tabEvent(),t.bindScrollEvent(),t.addEvent()},t.tabEvent=function(){i(".tab-cls").click(function(t){var n=i(this).attr("data-href");window.location.replace(n)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var n=i(".nodata");0==n.length&&i("#index .order-list").append('
'+t.nodata+"
"),t.app.detachInfiniteScroll(".infinite-scroll"),i("#index .infinite-scroll-preloader").remove()},t.loadPage=function(){var t=this;if(t.loading=!0,t.page>=t.pageCount)return void t.handleNodata();var r={status:t.tab};r.page=t.page+1,r=t.csrf(r),i.ajax({method:"GET",url:n.to(o),data:r,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(n){1==n.success&&(e.isDefined(n.page)&&(t.page=parseInt(n.page)),e.isDefined(n.page_count)&&(t.pageCount=parseInt(n.page_count)),t.renderItems(n.items,!0))},error:function(t){},complete:function(n){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),i("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,n){var e=i("#index .order-list"),o=i("script#order-item-template"),a=r.compile(o.html()),l=a({list:t});0==n&&(e.html(""),e.append(l)),e.append(l)},t.addEvent=function(){i("#index .add-btn-cls").click(function(t){window.location.href=n.to("order/#submit")})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("评价"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/repairing-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,n,e){var t=(Dom7,Template7,new t);return t.run=function(){var t=this;t.setPageTitle("维修单"),t.render()},t.bindEvents=function(){console.log("bindEvents")},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,n,e,i){var r=Dom7,t=(Template7,new t),o="/user/default/upload-file",a="/order/default/submit",l=!0;return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent()},t.uploadImgEvent=function(){var t=this;r("#submit #upload-btn").change(function(){if(""!=r(this).val()&&null!=r(this).val()){var a=r(this).parents("li");i.uploadFile({selector:"#upload-btn",url:n.to(o),processAppendTo:"#submit",success:function(n,i){try{if(n.success){var o=n.tmpUrl;r('
').insertBefore(a),t.imgLimit==r("#submit #image-list").find(".up-img").length&&r("#submit .upload-btn-li").hide()}else e.toast({content:n.message,closeDelay:5e3})}catch(l){console.log(l),e.toast({content:"出错",closeDelay:5e3})}}})}}),r("#submit #image-list").on("click",".del-img",function(n){r(this).parent().remove(),t.imgLimit>=r("#submit #image-list").find(".up-img").length&&r("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;r("#submit .submit-btn-cls").click(function(i){var o=e.trim(r("#submit .carNo").val()),s=e.trim(r("#submit .carModel").val()),u=e.trim(r("#submit .customer").val()),d=e.trim(r("#submit .phone").val()),c=e.trim(r("#submit .preRepair").val()),m=e.trim(r("#submit .repairPrice").val()),f=e.trim(r("#submit .finishDate").val());if(0==l)return!1;if(""==o)return e.toast({content:"车牌号必填"}),!1;if(""==s)return e.toast({content:"车辆型号必填"}),!1;if(""==u)return e.toast({content:"客户名称必填"}),!1;if(""==d)return e.toast({content:"客联系电话必填"}),!1;if(!e.isMobile(d)&&!uitls.isTelephone(d))return e.toast({content:"客联系电话有误"}),!1;if(""==c)return e.toast({content:"预估维修内容必填"}),!1;if(""==m)return e.toast({content:"预估维修费用必填"}),!1;if(""==f)return e.toast({content:"预估完成时间必填"}),!1;var p=t.getUploadImgs();if(0==p.length)return e.toast({content:"请上传车损照"}),!1;l=!1;var v=t.csrf({carNo:o,carModel:s,customer:u,phone:d,preRepair:c,repairPrice:m,finishDate:f,images:p});e.httpPost(a,v,function(t){return l=!0,t.success?void(window.location.href=n.to("/")):(e.toast({content:message}),!1)},!0)})},t.getUploadImgs=function(){var t=r("#submit #image-list").find(".up-img"),n=[];return 0==t.length?[]:(r.each(t,function(t,e){var i=r(e).find(".upload-item");n.push(i.attr("data"))}),n)},t});
\ No newline at end of file
+define("order-app",["mk7/app"],function(t){var i=Dom7,n=function(){var t=i(".ui-loading-block");0==t.length&&(i(".view-main").html('
'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),i=document.createElement("p");i.className="notice",t&&(i.innerHTML='加载速度太慢?试试
重新加载',t.appendChild(i))},window.waitingTime))},e=!0;return t.name="order",t.routes={index:function(){return e=!1,n(),t.runController("index")},"index/:tab":function(i){e=!1,n();var a={tab:i};return t.runController("index",a)},"rate/:id":function(i){e=!1,n();var a={id:i};return t.runController("rate",a)},submit:function(){return e=!1,n(),t.runController("submit")},"order-details/:id":function(i){e=!1,n();var a={id:i};return t.runController("order-details",a)},"cost-list/:id":function(i){e=!1,n();var a={id:i};return t.runController("cost-list",a)},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,i,n,e){var a=Dom7,t=(Template7,new t),o="/user/default/upload-file",r="/order/default/submit-repair-plans";return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.imgLimit=9,t.canSubmit=!0,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.addEvent(),t.uploadImgEvent(),t.delPlanEvent(),t.inputPriceChangeEvent(),t.submitEvent()},t.addEvent=function(){var t=this;a("#cost-list .add-repair-plan").click(function(i){var n=a("#cost-list .cost-list-div"),e=t.planTpl(n.length+1);a(e).insertBefore(a("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;a("#cost-list").on("click",".del-plan",function(i){console.log("del plan event"),a(this).parents(".cost-list-div").remove(),a("#cost-list .total-plan-price").html(t.computedPrice())})},t.planTpl=function(t){var i='
';return i},t.inputPriceChangeEvent=function(){var t=this;a("#cost-list").on("input propertychange",".input-cls",function(){var i=t.computedPrice();a("#cost-list .total-plan-price").html(i)})},t.computedPrice=function(){var t=a("#cost-list .input-right"),i=0;return a.each(t,function(t,n){i+=1*a(n).val()}),Math.round(i,2)},t.uploadImgEvent=function(){var t=this;a("#cost-list #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var r=a(this).parents("li");e.uploadFile({selector:"#upload-btn",url:i.to(o),processAppendTo:"#cost-list",success:function(i,e){try{if(i.success){var o=i.tmpUrl;a('
').insertBefore(r),t.imgLimit==a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").hide()}else n.toast({content:i.message,closeDelay:5e3})}catch(l){console.log(l),n.toast({content:"出错",closeDelay:5e3})}}})}}),a("#cost-list #image-list").on("click",".del-img",function(i){a(this).parent().remove(),t.imgLimit>=a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").show()})},t.submitEvent=function(){var t=this;a("#cost-list .btn-submit").click(function(e){var o=a("#cost-list .content-div").find(".repair-item-cls"),l=[],s=!0,c=!0;if(a.each(o,function(t,i){var e=n.trim(a(i).find(".input-left").val()),o=n.trim(a(i).find(".input-right").val());""==e&&(s=!1),""!=o&&0!=o||(c=!1),l.push({content:e,price:o})}),!s)return n.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return n.toast({content:"维修清单有部分未填价格"}),!1;var d=a("#cost-list #image-list").find(".upload-item"),u=[];if(a.each(d,function(t,i){u.push(a(i).attr("data"))}),!t.canSubmit)return!1;t.canSubmit=!1;var m=t.csrf({images:u,plans:l});n.httpPost(r,m,function(e){t.canSubmit=!0,e.success?window.location.replace(i.to("order/#item-details/"+t.id)):n.toast({content:e.message})},!0)})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,i,n){var e=Dom7,a=Template7,t=new t,o="order/default/order-list";return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.tab=t.params.tab,t.page=0,t.nodata="",t.loading=!1,t.pageCount=1,t.render({tab:t.tab}),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.tabEvent(),t.bindScrollEvent(),t.addEvent()},t.tabEvent=function(){e(".tab-cls").click(function(t){var i=e(this).attr("data-href");window.location.replace(i)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var i=e(".nodata");0==i.length&&e("#index .order-list").append('
'+t.nodata+"
"),t.app.detachInfiniteScroll(".infinite-scroll"),e("#index .infinite-scroll-preloader").remove()},t.loadPage=function(){var t=this;if(t.loading=!0,t.page>=t.pageCount)return void t.handleNodata();var a={status:t.tab};a.page=t.page+1,a=t.csrf(a),e.ajax({method:"GET",url:i.to(o),data:a,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(i){1==i.success&&(n.isDefined(i.page)&&(t.page=parseInt(i.page)),n.isDefined(i.page_count)&&(t.pageCount=parseInt(i.page_count)),t.renderItems(i.items,!0))},error:function(t){},complete:function(i){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),e("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,i){var n=e("#index .order-list"),o=e("script#order-item-template"),r=a.compile(o.html()),l=r({list:t});0==i&&(n.html(""),n.append(l)),n.append(l)},t.addEvent=function(){e("#index .add-btn-cls").click(function(t){window.location.href=i.to("order/#submit")})},t}),define("order/order-details-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,i,n){var e=Dom7,t=(Template7,new t),a="order/default/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.finishBtnEvent(),t.goToComment()},t.loadPage=function(){var t=this,i=t.csrf({id:t.id});n.httpGet(a,i,function(i){var n=i;t.render(n)},!0)},t.finishBtnEvent=function(){var t=this;e("#order-details .finish-submit").click(function(n){window.location.href=i.to("order/#cost-list/"+t.id)})},t.goToComment=function(){var t=this;e("#order-details .rate-btn-cls").click(function(n){window.location.href=i.to("order/#rate/"+t.id)})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,i,n){var e=Dom7,t=(Template7,new t),a="order/default/submit-rate";return t.run=function(){var t=this;t.id=t.params.id,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent()},t.loadPage=function(){var t=this;t.render()},t.starClickEvent=function(){e("#rate").on("click",".quality-box .img-star",function(t){var i=e(this).attr("data-id"),n=e("#rate .quality-box .img-star");e.each(n,function(t,n){var a=e(n).attr("data-id");if(1*a<=i){e(n).addClass("star-on");var o=e("#rate .quality-box").find(".rate-text"),r=e(n).attr("data-txt");o.html(r)}else e(n).removeClass("star-on")})})},t.submitEvent=function(){var t=this;e("#rate .submit-btn").click(function(o){var r=n.trim(e("#rate .text-content").val()),l=e("#rate .img-star"),s=0;e.each(l,function(t,i){e(i).hasClass("star-on")&&s++});var c=t.csrf({star:s,comment:r});n.httpPost(i.to(a),c,function(i){i.success?window.location.replace("order/#order-details/"+t.id):n.toast({content:i.message})},!0)})},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,i,n,e){var a=Dom7,t=(Template7,new t),o="/user/default/upload-file",r="/order/default/submit",l=!0;return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent()},t.uploadImgEvent=function(){var t=this;a("#submit #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var r=a(this).parents("li");e.uploadFile({selector:"#upload-btn",url:i.to(o),processAppendTo:"#submit",success:function(i,e){try{if(i.success){var o=i.tmpUrl;a('
').insertBefore(r),t.imgLimit==a("#submit #image-list").find(".up-img").length&&a("#submit .upload-btn-li").hide()}else n.toast({content:i.message,closeDelay:5e3})}catch(l){console.log(l),n.toast({content:"出错",closeDelay:5e3})}}})}}),a("#submit #image-list").on("click",".del-img",function(i){a(this).parent().remove(),t.imgLimit>=a("#submit #image-list").find(".up-img").length&&a("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;a("#submit .submit-btn-cls").click(function(e){var o=n.trim(a("#submit .carNo").val()),s=n.trim(a("#submit .carModel").val()),c=n.trim(a("#submit .customer").val()),d=n.trim(a("#submit .phone").val()),u=n.trim(a("#submit .preRepair").val()),m=n.trim(a("#submit .repairPrice").val()),p=n.trim(a("#submit .finishDate").val());if(0==l)return!1;if(""==o)return n.toast({content:"车牌号必填"}),!1;if(""==s)return n.toast({content:"车辆型号必填"}),!1;if(""==c)return n.toast({content:"客户名称必填"}),!1;if(""==d)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(d)&&!uitls.isTelephone(d))return n.toast({content:"客联系电话有误"}),!1;if(""==u)return n.toast({content:"预估维修内容必填"}),!1;if(""==m)return n.toast({content:"预估维修费用必填"}),!1;if(""==p)return n.toast({content:"预估完成时间必填"}),!1;var f=t.getUploadImgs();if(0==f.length)return n.toast({content:"请上传车损照"}),!1;l=!1;var v=t.csrf({carNo:o,carModel:s,customer:c,phone:d,preRepair:u,repairPrice:m,finishDate:p,images:f});n.httpPost(r,v,function(t){return l=!0,t.success?void(window.location.href=i.to("/")):(n.toast({content:message}),!1)},!0)})},t.getUploadImgs=function(){var t=a("#submit #image-list").find(".up-img"),i=[];return 0==t.length?[]:(a.each(t,function(t,n){var e=a(n).find(".upload-item");i.push(e.attr("data"))}),i)},t});
\ No newline at end of file
diff --git a/web/dist/js/user-app.js b/web/dist/js/user-app.js
index 78c290e..681f3b8 100644
--- a/web/dist/js/user-app.js
+++ b/web/dist/js/user-app.js
@@ -1 +1 @@
-define("user-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".view-main").html('
'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试
重新加载',e.appendChild(t))},window.waitingTime))},o=!0;return e.name="user",e.routes={index:function(){return o=!1,n(),e.runController("index")},register:function(){return o=!1,n(),e.runController("register")},login:function(){return o=!1,n(),e.runController("login")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/login-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var o=Dom7,e=(Template7,new e),i="/user/login/get-code",r="/user/login/login",l=!0,c=!0,s=null;return e.run=function(){var e=this;e.setPageTitle("登录"),e.codeDuration=60,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;o("#login .get-code-cls").click(function(){if(0==l)return!1;clearInterval(s),l=!1;var r=e.csrf({action:"login"});n.httpGet(t.to(i),r,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;var i=t.codeDuration;e.codeDuration=i,s=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#login .get-code-cls").html("获取验证码"),clearInterval(s),e.codeDuration=i,l=!0):o("#login .get-code-cls").html('
'+e.codeDuration+"s后重新获取")},1e3)})})},e.loginEvent=function(){var e=this;o("#login .login-btn").click(function(i){var l=n.trim(o("#login .mobile").val()),s=n.trim(o("#login .code").val());if(""==l)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(l))return n.toast({content:"手机号码不合格"}),!1;if(""==s)return n.toast({content:"验证码必填"}),!1;if(0==c)return!1;c=!1;var a=e.csrf({mobile:l,code:s});n.httpPost(t.to(r),a,function(e){return e.success?(c=!0,void(window.location.href=t.to("/"))):(n.toast({content:e.message,closeDelay:3e3}),c=!0,!1)})})},e.gotoRegisterEvent=function(){o("#login .register-btn").click(function(e){window.location.href=t.to("user/#register")})},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(e,t,n,o){var i=Dom7,e=(Template7,new e),r="/user/login/register",l="/user/default/upload-file",c="/user/login/get-code",s=!0,a=!0,u=null;return e.run=function(){var e=this;e.setPageTitle("注册"),e.codeDuration=60,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent()},e.uploadEvent=function(){i("#register #upload-btn").change(function(){if(""!=i(this).val()&&null!=i(this).val()){var e=i(this).parent();o.uploadFile({selector:"#upload-btn",url:t.to(l),processAppendTo:"#register",success:function(t,o){try{if(t.success){var i=t.tmpUrl;e.css("background-image","url("+t.tmpMinUrl+")"),e.attr("data",t.tmpFile),e.attr("data-url",i)}else n.toast({content:t.message,closeDelay:5e3})}catch(r){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;i("#register .get-code-cls").click(function(){if(0==s)return!1;clearInterval(u),s=!1;var o=e.csrf({action:"register"});n.httpGet(t.to(c),o,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),s=!0,!1;var o=t.codeDuration;e.codeDuration=o,u=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(i("#register .get-code-cls").html("获取验证码"),clearInterval(u),e.codeDuration=o,s=!0):i("#register .get-code-cls").html('
'+e.codeDuration+"s后重新获取")},1e3)})})},e.registerEvent=function(){var e=this;i("#register .register-btn").click(function(o){var l=n.trim(i("#register .name").val()),c=n.trim(i("#register .mobile").val()),s=n.trim(i("#register .code").val());if(""==l)return n.toast({content:"车厂名称必填"}),!1;if(""==c)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(c))return n.toast({content:"手机号码不合格"}),!1;if(""==s)return n.toast({content:"验证码必填"}),!1;var u=i("#register .upload-btn-cls").attr("data");if(void 0===u||null==u)return n.toast({content:"请上传营业执照"}),!1;if(0==a)return!1;a=!1;var d=e.csrf({name:l,mobile:c,code:s,img:u});n.httpPost(t.to(r),d,function(e){return e.success?void(window.location.href=t.to("/")):(n.toast({content:e.message,closeDelay:3e3}),a=!0,!1)})})},e.gotoLoginEvent=function(){i("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e});
\ No newline at end of file
+define("user-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".view-main").html('
'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试
重新加载',e.appendChild(t))},window.waitingTime))},o=!0;return e.name="user",e.routes={index:function(){return o=!1,n(),e.runController("index")},register:function(){return o=!1,n(),e.runController("register")},login:function(){return o=!1,n(),e.runController("login")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/login-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var o=Dom7,e=(Template7,new e),i="/user/login/get-code",r="/user/login/login",l=!0,c=!0,s=null;return e.run=function(){var e=this;e.setPageTitle("登录"),e.codeDuration=60,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;o("#login .get-code-cls").click(function(){if(0==l)return!1;clearInterval(s),l=!1;var r=e.csrf({action:"login"});n.httpGet(t.to(i),r,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;var i=t.codeDuration;e.codeDuration=i,s=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#login .get-code-cls").html("获取验证码"),clearInterval(s),e.codeDuration=i,l=!0):o("#login .get-code-cls").html('
'+e.codeDuration+"s后重新获取")},1e3)})})},e.loginEvent=function(){var e=this;o("#login .login-btn").click(function(i){var l=n.trim(o("#login .mobile").val()),s=n.trim(o("#login .code").val());if(""==l)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(l))return n.toast({content:"手机号码不合格"}),!1;if(""==s)return n.toast({content:"验证码必填"}),!1;if(0==c)return!1;c=!1;var a=e.csrf({mobile:l,code:s});n.httpPost(t.to(r),a,function(e){return e.success?(c=!0,void(window.location.href=t.to("/"))):(n.toast({content:e.message,closeDelay:3e3}),c=!0,!1)})})},e.gotoRegisterEvent=function(){o("#login .register-btn").click(function(e){window.location.href=t.to("user/#register")})},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(e,t,n,o){var i=Dom7,e=(Template7,new e),r="/user/login/register",l="/user/default/upload-file",c="/user/login/get-code",s=!0,a=!0,u=null;return e.run=function(){var e=this;e.setPageTitle("注册"),e.codeDuration=60,e.render()},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent()},e.uploadEvent=function(){i("#register .upload-input-cls").change(function(){if(""!=i(this).val()&&null!=i(this).val()){var e=i(this).attr("id"),r=i(this).parent();o.uploadFile({selector:"#"+e,url:t.to(l),processAppendTo:"#register",success:function(e,t){try{if(e.success){var o=e.tmpUrl;r.css("background-image","url("+e.tmpMinUrl+")"),r.attr("data",e.tmpFile),r.attr("data-url",o)}else n.toast({content:e.message,closeDelay:5e3})}catch(i){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;i("#register .get-code-cls").click(function(){if(0==s)return!1;clearInterval(u),s=!1;var o=e.csrf({action:"register"});n.httpGet(t.to(c),o,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),s=!0,!1;var o=t.codeDuration;e.codeDuration=o,u=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(i("#register .get-code-cls").html("获取验证码"),clearInterval(u),e.codeDuration=o,s=!0):i("#register .get-code-cls").html('
'+e.codeDuration+"s后重新获取")},1e3)})})},e.registerEvent=function(){var e=this;i("#register .register-btn").click(function(o){var l=n.trim(i("#register .name").val()),c=n.trim(i("#register .mobile").val()),s=n.trim(i("#register .code").val());if(""==l)return n.toast({content:"车厂名称必填"}),!1;if(""==c)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(c))return n.toast({content:"手机号码不合格"}),!1;if(""==s)return n.toast({content:"验证码必填"}),!1;var u=i("#register .upload-btn-cls").attr("data");if(void 0===u||null==u)return n.toast({content:"请上传营业执照"}),!1;if(0==a)return!1;a=!1;var d=e.csrf({name:l,mobile:c,code:s,img:u});n.httpPost(t.to(r),d,function(e){return e.success?void(window.location.href=t.to("/")):(n.toast({content:e.message,closeDelay:3e3}),a=!0,!1)})})},e.gotoLoginEvent=function(){i("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e});
\ No newline at end of file
diff --git a/web/i/order/order-details_tip_image.png b/web/i/order/order-details_tip_image.png
new file mode 100644
index 0000000..ba3c3ed
Binary files /dev/null and b/web/i/order/order-details_tip_image.png differ
diff --git a/web/i/order/repairing_tip_image.png b/web/i/order/repairing_tip_image.png
deleted file mode 100644
index ba3c3ed..0000000
Binary files a/web/i/order/repairing_tip_image.png and /dev/null differ
diff --git a/web/src/js/order/app.js b/web/src/js/order/app.js
index 41514ca..b8884eb 100644
--- a/web/src/js/order/app.js
+++ b/web/src/js/order/app.js
@@ -47,16 +47,35 @@ define(
}
return app.runController('index',params);
},
- 'rate': function () {
+ 'rate/:id': function (id) {
fromOutside = false;
_autoLoading();
- return app.runController('rate');
+ var params = {
+ id:id
+ }
+ return app.runController('rate',params);
},
'submit': function () {
fromOutside = false;
_autoLoading();
return app.runController('submit');
},
+ 'order-details/:id': function (id) {
+ fromOutside = false;
+ _autoLoading();
+ var params = {
+ id:id
+ }
+ return app.runController('order-details', params);
+ },
+ 'cost-list/:id': function (id) {
+ fromOutside = false;
+ _autoLoading();
+ var params = {
+ id:id
+ }
+ return app.runController('cost-list', params);
+ },
'*': function(){
return app.runController('index');
}
diff --git a/web/src/js/order/cost-list-controller.js b/web/src/js/order/cost-list-controller.js
index dcbe972..84f274c 100644
--- a/web/src/js/order/cost-list-controller.js
+++ b/web/src/js/order/cost-list-controller.js
@@ -1,5 +1,5 @@
/**
- * 订单评价-首页
+ * 首页
*/
define(
"order/cost-list-controller",
@@ -7,24 +7,161 @@ define(
'mk7/controller',
'mk7/url',
'mk7/utils',
+ 'mk7/uploadjs',
],
- function(ctrl, url, utils) {
+ function(ctrl, url, utils, uploadjs) {
var $$ = Dom7;
var t7 = Template7;
var ctrl = new ctrl();
-
+ var uploadURL = '/user/default/upload-file';
+ var submitURL = '/order/default/submit-repair-plans';
ctrl.run = function () {
var me = this;
me.setPageTitle("费用列表");
+ me.imgLimit = 9;
+ me.canSubmit = true;
me.render();
}
ctrl.bindEvents = function () {
var me = this;
console.log("bindEvents");
+ me.addEvent();
+ me.uploadImgEvent();
+ me.delPlanEvent();
+ me.inputPriceChangeEvent();
+ me.submitEvent();
}
+ ctrl.addEvent = function() {
+ var me = this;
+ $$('#cost-list .add-repair-plan').click(function (e) {
+ var costList = $$('#cost-list .cost-list-div');
+ var tpl = me.planTpl(costList.length + 1);
+ //console.log(tpl)
+ $$(tpl).insertBefore($$('#cost-list .cost-total-list-div'))
+ })
+ }
+ ctrl.delPlanEvent = function (){
+ var me = this;
+ $$('#cost-list').on('click', '.del-plan', function(e) {
+ console.log('del plan event')
+ $$(this).parents('.cost-list-div').remove();
+ $$('#cost-list .total-plan-price').html(me.computedPrice());
+ })
+ }
+ ctrl.planTpl = function(i){
+ var str = '
';
+ return str;
+ }
+ ctrl.inputPriceChangeEvent = function() {
+ var me = this;
+ $$('#cost-list').on('input propertychange', '.input-cls', function() {
+ var p = me.computedPrice();
+ $$('#cost-list .total-plan-price').html(p)
+ })
+ }
+ ctrl.computedPrice = function() {
+ var items = $$('#cost-list .input-right');
+ var totalP = 0;
+ $$.each(items, function(i, n) {
+ totalP = totalP + ($$(n).val()*1);
+ })
+ return Math.round(totalP,2);
+ }
+ ctrl.uploadImgEvent = function() {
+ var me = this;
+ $$('#cost-list #upload-btn').change(function () {
+ if ('' == $$(this).val() || null == $$(this).val()) {
+ return;
+ }
+ var uploadParent = $$(this).parents('li');
+
+ uploadjs.uploadFile({
+ selector: '#upload-btn',
+ url: url.to(uploadURL),
+ processAppendTo: '#cost-list',
+ success: function (response, e) {
+ try {
+ if (response.success) {
+ var imgUrl = response.tmpUrl;
+
+ $$('
' + '
').insertBefore(uploadParent);
+ if (me.imgLimit == $$('#cost-list #image-list').find('.up-img').length) {
+ $$('#cost-list .upload-btn-li').hide();
+ }
+ } else {
+ utils.toast({content: response.message, closeDelay: 5000});
+ }
+ } catch (ex) {
+ console.log(ex)
+ utils.toast({content: '出错', closeDelay: 5000});
+ }
+ }
+ });
+ })
+
+ $$('#cost-list #image-list').on('click', '.del-img', function(e){
+ $$(this).parent().remove();
+ if (me.imgLimit >= $$('#cost-list #image-list').find('.up-img').length) {
+ $$('#cost-list .upload-btn-li').show();
+ }
+ })
+ }
+ ctrl.submitEvent = function() {
+ var me = this;
+ $$('#cost-list .btn-submit').click(function(e) {
+ var contentList = $$('#cost-list .content-div').find('.repair-item-cls');
+ var repairPlan = [];
+ var fillContent = true;
+ var fillPrice = true;
+ $$.each(contentList, function(i,n){
+ var rContent = utils.trim($$(n).find('.input-left').val())
+ var rPrice= utils.trim($$(n).find('.input-right').val());
+ if ('' == rContent) {
+ fillContent = false;
+ }
+ if ('' == rPrice || 0 == rPrice) {
+ fillPrice = false;
+ }
+ repairPlan.push({content:rContent, price:rPrice})
+ })
+ if (!fillContent) {
+ utils.toast({content:'维修清单有部分未填内容'});
+ return false;
+ }
+ if (!fillPrice) {
+ utils.toast({content:'维修清单有部分未填价格'});
+ return false;
+ }
+ var imagesDom = $$('#cost-list #image-list').find('.upload-item');
+ var images = [];
+ $$.each(imagesDom, function(i,n) {
+ images.push($$(n).attr('data'))
+ })
+
+ if (!me.canSubmit) {
+ return false;
+ }
+ me.canSubmit = false;
+ var pData = me.csrf({images:images, plans: repairPlan});
+ utils.httpPost(submitURL,pData, function(res){
+ me.canSubmit = true;
+ if (res.success) {
+ window.location.replace(url.to('order/#item-details/'+me.id))
+ } else {
+ utils.toast({content:res.message})
+ }
+ }, true)
+ })
+ }
return ctrl;
}
);
diff --git a/web/src/js/order/order-details-controller.js b/web/src/js/order/order-details-controller.js
new file mode 100644
index 0000000..d936ffe
--- /dev/null
+++ b/web/src/js/order/order-details-controller.js
@@ -0,0 +1,55 @@
+/**
+ * 维修中页
+ */
+define(
+ "order/order-details-controller",
+ [
+ 'mk7/controller',
+ 'mk7/url',
+ 'mk7/utils',
+ ],
+
+ function(ctrl, url, utils) {
+
+ var $$ = Dom7;
+ var t7 = Template7;
+ var ctrl = new ctrl();
+
+ var pageURL = 'order/default/order-details';
+ ctrl.run = function () {
+ var me = this;
+ me.id = me.params.id;
+ me.setPageTitle("维修单");
+ me.loadPage();
+ }
+ ctrl.bindEvents = function () {
+ var me = this;
+ console.log("bindEvents");
+ me.finishBtnEvent();
+ me.goToComment();
+ }
+ ctrl.loadPage = function() {
+ var me = this
+ var pData = me.csrf({id: me.id});
+ utils.httpGet(pageURL, pData, function(res) {
+ var rData = res;
+ me.render(rData);
+ }, true)
+
+ }
+ ctrl.finishBtnEvent = function() {
+ var me = this;
+ $$('#order-details .finish-submit').click(function(e){
+ window.location.href = url.to('order/#cost-list/'+me.id);
+ })
+ }
+ ctrl.goToComment = function() {
+ var me = this;
+ $$('#order-details .rate-btn-cls').click(function(e){
+ window.location.href = url.to('order/#rate/'+me.id)
+ })
+
+ }
+ return ctrl;
+ }
+);
diff --git a/web/src/js/order/rate-controller.js b/web/src/js/order/rate-controller.js
index eafd08a..fd583bb 100644
--- a/web/src/js/order/rate-controller.js
+++ b/web/src/js/order/rate-controller.js
@@ -15,16 +15,64 @@ define(
var t7 = Template7;
var ctrl = new ctrl();
+ var submitURL = 'order/default/submit-rate';
ctrl.run = function () {
var me = this;
+ me.id = me.params.id;
me.setPageTitle("评价");
- me.render();
+ me.loadPage();
}
ctrl.bindEvents = function () {
var me = this;
console.log("bindEvents");
+ me.starClickEvent();
+ me.submitEvent();
}
+ ctrl.loadPage = function(){
+ var me = this;
+ me.render();
+ }
+ ctrl.starClickEvent = function() {
+ $$('#rate').on('click','.quality-box .img-star',function(e) {
+ var id = $$(this).attr('data-id');
+ var stars = $$('#rate .quality-box .img-star')
+ $$.each(stars, function(i,n){
+ var cid = $$(n).attr('data-id');
+ if ((cid*1) <= id) {
+ $$(n).addClass('star-on');
+ var rateText = $$('#rate .quality-box').find('.rate-text');
+ var txt = $$(n).attr('data-txt');
+ rateText.html(txt);
+ } else {
+ $$(n).removeClass('star-on');
+ }
+ })
+ })
+ }
+ ctrl.submitEvent = function() {
+ var me = this;
+ $$('#rate .submit-btn').click(function(e){
+ var comment = utils.trim($$('#rate .text-content').val());
+ var stars = $$('#rate .img-star')
+ var star = 0;
+ $$.each(stars, function(i,n){
+ if($$(n).hasClass('star-on')) {
+ star++
+ }
+ })
+
+ var pData = me.csrf({star:star,comment:comment});
+ utils.httpPost(url.to(submitURL), pData, function(res) {
+ if (res.success) {
+ window.location.replace('order/#order-details/'+me.id);
+ } else {
+ utils.toast({content:res.message});
+ }
+ }, true)
+ })
+
+ }
return ctrl;
}
);
diff --git a/web/src/js/order/repairing-controller.js b/web/src/js/order/repairing-controller.js
deleted file mode 100644
index 47ad35f..0000000
--- a/web/src/js/order/repairing-controller.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 维修中页
- */
-define(
- "order/repairing-controller",
- [
- 'mk7/controller',
- 'mk7/url',
- 'mk7/utils',
- ],
-
- function(ctrl, url, utils) {
-
- var $$ = Dom7;
- var t7 = Template7;
- var ctrl = new ctrl();
-
- ctrl.run = function () {
- var me = this;
- me.setPageTitle("维修单");
- me.render();
- }
- ctrl.bindEvents = function () {
- var me = this;
- console.log("bindEvents");
- }
-
- return ctrl;
- }
-);
diff --git a/web/src/js/user/register-controller.js b/web/src/js/user/register-controller.js
index 6e2b17b..636572f 100644
--- a/web/src/js/user/register-controller.js
+++ b/web/src/js/user/register-controller.js
@@ -39,13 +39,14 @@ define(
me.gotoLoginEvent();
}
ctrl.uploadEvent = function() {
- $$('#register #upload-btn').change(function() {
+ $$('#register .upload-input-cls').change(function() {
if ('' == $$(this).val() || null == $$(this).val()) {
return ;
}
+ var id = $$(this).attr('id');
var parent = $$(this).parent();
uploadjs.uploadFile({
- selector:'#upload-btn',
+ selector:'#'+id,
url:url.to(uploadURL),
processAppendTo:'#register',
success:function(response, e) {
--
libgit2 0.21.0