diff --git a/app-wx/config/params.php b/app-wx/config/params.php
index a96756f..f4fec54 100644
--- a/app-wx/config/params.php
+++ b/app-wx/config/params.php
@@ -2,5 +2,5 @@
return [
'adminEmail' => 'admin@example.com',
'testLoginPhones' => ['13900139001'],
- 'VERSION' => 'v0.1.0 build 21', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数
+ 'VERSION' => 'v0.1.0 build 22', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数
];
diff --git a/app-wx/modules/order/controllers/CustomerController.php b/app-wx/modules/order/controllers/CustomerController.php
index a24547a..a746cec 100644
--- a/app-wx/modules/order/controllers/CustomerController.php
+++ b/app-wx/modules/order/controllers/CustomerController.php
@@ -161,12 +161,18 @@ class CustomerController extends CustomerBaseController
$rateModel = RepairOrderRate::create($items);
$commentImages = RepairOrderRate::mvImages($orderModel->uuid, $images);
$images = [];
- foreach($commentImages as $k => $v) {
- $images[] = $v[0].$v[1];
+ if ($commentImages) {
+ foreach($commentImages as $k => $v) {
+ $images[] = $v[0].$v[1];
+ }
}
- $rateModel->images = implode(',', $images);
- //$rateModel->save();
- if ($rateModel && $rateModel->save()) {
+
+ if ($images) {
+ $rateModel->images = implode(',', $images);
+ $rateModel->save();
+ }
+
+ if ($rateModel) {
$e->success = true;
$e->message = '提交成功';
} else {
diff --git a/domain/system/SmsMessage.php b/domain/system/SmsMessage.php
index 37a29ae..84e3a72 100644
--- a/domain/system/SmsMessage.php
+++ b/domain/system/SmsMessage.php
@@ -24,6 +24,7 @@ class SmsMessage
*/
private function send(string $mobile, string $signName, string $templateCode, array $templateParam)
{
+ AppLog::DEBUG('短信发送结果:' . json_encode($templateParam, JSON_UNESCAPED_UNICODE));
if (YII_ENV_DEV) {
return true;
}
@@ -36,7 +37,7 @@ class SmsMessage
'TemplateCode' => $templateCode,
];
if ($templateParam) {
- $query['TemplateParam'] = json_encode($templateParam);
+ $query['TemplateParam'] = json_encode($templateParam, JSON_UNESCAPED_UNICODE);
}
$result = AlibabaCloud::rpc()
@@ -106,6 +107,7 @@ class SmsMessage
/*
* 模版CODE: SMS_181853499
+ *
* 尊敬的车主,您的爱车正在${maintainer}维修,预计${dateTime}维修完成,预估维修内容:${repairPlan},预估维修费:${repairPrice},维修厂地址:${address},联系电话:${tel}
* */
public function sendSubmitInfo($phone, $postData)
diff --git a/web/dist/js/order-app.js b/web/dist/js/order-app.js
index 4524d75..69e3218 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 e=Dom7,i=function(){var t=e(".ui-loading-block");0==t.length&&(e(".view-main").html('
'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",t&&(e.innerHTML='加载速度太慢?试试重新加载',t.appendChild(e))},window.waitingTime))},n=!0;return t.name="order",t.routes={index:function(){return n=!1,i(),t.runController("index")},"index/:tab":function(e){n=!1,i();var a={tab:e};return t.runController("index",a)},submit:function(){return n=!1,i(),t.runController("submit")},"order-details/:id":function(e){n=!1,i();var a={id:e};return t.runController("order-details",a)},"customer-order/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("customer-order",r)},"rate/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("rate",r)},"cost-list/:id":function(e){n=!1,i();var a={id:e};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,e,i,n){var a=Dom7,t=(Template7,new t),r="/user/default/upload-file",o="/order/default/submit-repair-plans";return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.id=t.params.id,t.imgLimit=9,t.canSubmit=!0,t.render({id:t.id})},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(e){var i=a("#cost-list .cost-list-div"),n=t.planTpl(i.length+1);a(n).insertBefore(a("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;a("#cost-list").on("click",".del-plan",function(e){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 e='';return e},t.inputPriceChangeEvent=function(){var t=this;a("#cost-list").on("input propertychange",".input-cls",function(){var e=t.computedPrice();a("#cost-list .total-plan-price").html(e)})},t.computedPrice=function(){var t=a("#cost-list .input-right"),e=0;return a.each(t,function(t,i){e+=1*a(i).val()}),Math.round(e,2)},t.uploadImgEvent=function(){var t=this;a("#cost-list #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var o=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(r),processAppendTo:"#cost-list",success:function(e,n){try{if(e.success){var r=e.tmpUrl;a('').insertBefore(o),t.imgLimit==a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#cost-list #image-list").on("click",".del-img",function(e){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(n){var r=a("#cost-list .content-div").find(".repair-item-cls"),s=[],l=!0,c=!0;if(a.each(r,function(t,e){var n=i.trim(a(e).find(".input-left").val()),r=i.trim(a(e).find(".input-right").val());""==n&&(l=!1),""!=r&&0!=r||(c=!1),s.push({content:n,price:r})}),!l)return i.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return i.toast({content:"维修清单有部分未填价格"}),!1;var u=a("#cost-list #image-list").find(".upload-item"),d=[];if(a.each(u,function(t,e){d.push(a(e).attr("data"))}),!t.canSubmit)return!1;t.canSubmit=!1;var m=t.csrf({images:d,plans:s,id:t.id});i.httpPost(o,m,function(n){t.canSubmit=!0,n.success?window.location.replace(e.to("order#index")):i.toast({content:n.message})},!0)})},t}),define("order/customer-order-controller",["mk7/controller","mk7/url","mk7/utils","mk7/photo-browser"],function(t,e,i,n){var a=Dom7,r=Template7,t=new t,o="order/customer/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.goToComment(),t.popupImageLayer(),t.agreementEvent()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(this.view="customer-order-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(o),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.goToComment=function(){var t=this;a("#customer-order .rate-btn-cls").click(function(i){window.location.replace(e.to("order/customer#rate/"+t.id+"/"+t.sn))})},t.agreementEvent=function(){a("#customer-order").on("click",".warranty-btn",function(t){a("#warranty-wrapper").remove();var e=a("#customer-order"),i=a("script#warranty-template"),n=r.compile(i.html()),o=n({});e.append(o)}),a("#customer-order").on("click",".agree-btn",function(t){a("#warranty-wrapper").remove()})},t.popupImageLayer=function(){var t=this;a("#customer-order").on("click",".view-img-cls",function(e){var i=a(this).parents("ul"),n=i.find(".view-img-cls"),r=[],o=a(this).attr("data-index");a.each(n,function(t,e){var i=a(e).attr("data-url");r.push(i)});var s=t.app.photoBrowser({photos:r,initialSlide:o});s.open()})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,a=Template7,t=new t,r="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.orderClickEvent()},t.tabEvent=function(){n(".tab-cls").click(function(t){var e=n(this).attr("data-href");window.location.replace(e)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var e=n(".nodata");0==e.length&&n("#index .order-list").append(''+t.nodata+"
"),t.app.detachInfiniteScroll(".infinite-scroll"),n("#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),n.ajax({method:"GET",url:e.to(r),data:a,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){if(1==e.success&&(i.isDefined(e.page)&&(t.page=parseInt(e.page)),i.isDefined(e.page_count)&&(t.pageCount=parseInt(e.page_count)),t.renderItems(e.items,!0),t.page>=t.pageCount))return void t.handleNodata()},error:function(t){},complete:function(e){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),n("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,e){var i=n("#index .order-list"),r=n("script#order-item-template"),o=a.compile(r.html()),s=o({list:t});0==e&&(i.html(""),i.append(s)),i.append(s)},t.addEvent=function(){n("#index .add-btn-cls").click(function(t){window.location.href=e.to("order/#submit")})},t.orderClickEvent=function(){n("#index").on("click",".order-item",function(t){var i=n(this).attr("data-id");window.location.href=e.to("order#order-details/"+i)})},t}),define("order/order-details-controller",["mk7/controller","mk7/url","mk7/utils","mk7/photo-browser"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="order/default/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.finishBtnEvent(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(t.view="order-details-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.finishBtnEvent=function(){var t=this;a("#order-details .finish-submit").click(function(i){window.location.replace(e.to("order/#cost-list/"+t.id))})},t.agreementEvent=function(){},t.popupImageLayer=function(){var t=this;a("#order-details").on("click",".view-img-cls",function(e){var i=a(this).parents("ul"),n=i.find(".view-img-cls"),r=[],o=a(this).attr("data-index");a.each(n,function(t,e){var i=a(e).attr("data-url");r.push(i)});var s=t.app.photoBrowser({photos:r,initialSlide:o});s.open()})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="order/customer/submit-rate",o="/user/default/upload-file";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.imgLimit=4,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent(),t.uploadImgEvent()},t.loadPage=function(){var t=this;t.render({servicePhone:window.$site.servicePhone})},t.starClickEvent=function(){a("#rate").on("click",".img-star",function(t){var e=a(this).attr("data-id"),i=a(this).parent(".star-div"),n=i.find(".img-star");a.each(n,function(t,n){var r=a(n).attr("data-id");if(1*r<=e){a(n).addClass("star-on");var o=i.find(".rate-text"),s=a(n).attr("data-txt");o.html(s)}else a(n).removeClass("star-on")})})},t.uploadImgEvent=function(){var t=this;a("#rate #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var r=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(o),processAppendTo:"#rate",success:function(e,n){try{if(e.success){var o=e.tmpUrl;a('').insertBefore(r),t.imgLimit==a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#rate #image-list").on("click",".del-img",function(e){a(this).parent().remove(),t.imgLimit>=a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").show()})},t.getUploadImgs=function(){var t=a("#rate #image-list").find(".up-img"),e=[];return 0==t.length?[]:(a.each(t,function(t,i){var n=a(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.submitEvent=function(){var t=this;a("#rate .submit-btn").click(function(n){var o=i.trim(a("#rate .text-content").val()),s=a("#rate .quality-box .img-star"),l=0;a.each(s,function(t,e){a(e).hasClass("star-on")&&l++});var c=a("#rate .effect-box .img-star"),u=0;a.each(c,function(t,e){a(e).hasClass("star-on")&&u++});var d=a("#rate .service-box .img-star"),m=0;a.each(d,function(t,e){a(e).hasClass("star-on")&&m++});var p=t.getUploadImgs(),v=t.csrf({comment:o,id:t.id,qualityStar:l,effectStar:u,serviceStar:m,images:p});i.httpPost(e.to(r),v,function(n){n.success?window.location.replace(e.to("order/customer#customer-order/"+t.id+"/"+t.sn)):i.toast({content:n.message})},!0)})},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs","mk7/picker"],function(t,e,n,a,r){var o=Dom7,s=Template7,t=new t,l="/user/default/upload-file",c="/order/default/do-submit",u=!0,d="";return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render(),t.loadInit()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent(),t.selectDateEvent(),t.openCarModel(),t.searchCarModel(),t.carModelClick()},t.loadInit=function(){var t=this;({id:t.id})},t.uploadImgEvent=function(){var t=this;o("#submit #upload-btn").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var i=o(this).parents("li");a.uploadFile({selector:"#upload-btn",url:e.to(l),processAppendTo:"#submit",success:function(e,a){try{if(e.success){var r=e.tmpUrl;o('').insertBefore(i),t.imgLimit==o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(s){n.toast({content:"出错",closeDelay:5e3})}}})}}),o("#submit #image-list").on("click",".del-img",function(e){o(this).parent().remove(),t.imgLimit>=o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;o("#submit .submit-btn-cls").click(function(i){var a=n.trim(o("#submit .carNo").val()),r=n.trim(o("#submit .carModel").val()),s=n.trim(o("#submit .customer").val()),l=n.trim(o("#submit .phone").val()),d=n.trim(o("#submit .preRepair").val()),m=n.trim(o("#submit .repairPrice").val()),p=n.trim(o("#submit .finishDate").val());if(0==u)return!1;if(""==a)return n.toast({content:"车牌号必填"}),!1;if(""==r)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==l)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"客联系电话有误"}),!1;if(""==d)return n.toast({content:"预估维修内容必填"}),!1;if(""==m)return n.toast({content:"预估维修费用必填"}),!1;if(""==p)return n.toast({content:"预估完成时间必填"}),!1;var v=t.getUploadImgs();if(0==v.length)return n.toast({content:"请上传车损照"}),!1;u=!1;var f=t.csrf({carNo:a,carModel:r,customer:s,phone:l,preRepair:d,repairPrice:m,finishDate:p,images:v});n.httpPost(c,f,function(t){return u=!0,t.success?void window.location.replace(e.to("order#order-details/"+t.orderId)):(n.toast({content:t.message}),!1)},!0)})},t.getUploadImgs=function(){var t=o("#submit #image-list").find(".up-img"),e=[];return 0==t.length?[]:(o.each(t,function(t,i){var n=o(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.selectDateEvent=function(){var t=this;o("#submit .finish-date-input").click(function(e){var i=o("#submit .finish-date-input").val();t.dateTimeSelector("#submit .finish-date-input",i)})},t.dateTimeSelector=function(t,e){var n=this,a=new Date,r=30,s=a.getFullYear(),l=a.getMonth(),c=a.getDate(),u=a.getHours(),m=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var p=e.split(" ");m=p[0],u=p[1]}var v=[];for(i=0;i<=r;i++){var f=new Date;f.setDate(a.getDate()+i);var h=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();v.push(h)}var g=n.app.picker({input:t,toolbarTemplate:'',value:[m,u],onChange:function(t,e,i){var n,a,r;if(e[0]instanceof Date)n=e[0].getFullYear(),a=e[0].getMonth(),r=e[0].getDate();else{var o=e[0].split("-");n=o[0],a=o[1]-1,r=o[2]}var s=new Date(n,a,r,e[1],0),l=new Date((new Date).getTime()+36e5);if(s '),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",t&&(e.innerHTML='加载速度太慢?试试重新加载',t.appendChild(e))},window.waitingTime))},n=!0;return t.name="order",t.routes={index:function(){return n=!1,i(),t.runController("index")},"index/:tab":function(e){n=!1,i();var a={tab:e};return t.runController("index",a)},submit:function(){return n=!1,i(),t.runController("submit")},"order-details/:id":function(e){n=!1,i();var a={id:e};return t.runController("order-details",a)},"customer-order/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("customer-order",r)},"rate/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("rate",r)},"cost-list/:id":function(e){n=!1,i();var a={id:e};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,e,i,n){var a=Dom7,t=(Template7,new t),r="/user/default/upload-file",o="/order/default/submit-repair-plans";return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.id=t.params.id,t.imgLimit=9,t.canSubmit=!0,t.render({id:t.id})},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(e){var i=a("#cost-list .cost-list-div"),n=t.planTpl(i.length+1);a(n).insertBefore(a("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;a("#cost-list").on("click",".del-plan",function(e){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 e='';return e},t.inputPriceChangeEvent=function(){var t=this;a("#cost-list").on("input propertychange",".input-cls",function(){var e=t.computedPrice();a("#cost-list .total-plan-price").html(e)})},t.computedPrice=function(){var t=a("#cost-list .input-right"),e=0;return a.each(t,function(t,i){e+=1*a(i).val()}),Math.round(e,2)},t.uploadImgEvent=function(){var t=this;a("#cost-list #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var o=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(r),processAppendTo:"#cost-list",success:function(e,n){try{if(e.success){var r=e.tmpUrl;a('').insertBefore(o),t.imgLimit==a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#cost-list #image-list").on("click",".del-img",function(e){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(n){var r=a("#cost-list .content-div").find(".repair-item-cls"),s=[],l=!0,c=!0;if(a.each(r,function(t,e){var n=i.trim(a(e).find(".input-left").val()),r=i.trim(a(e).find(".input-right").val());""==n&&(l=!1),""!=r&&0!=r||(c=!1),s.push({content:n,price:r})}),!l)return i.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return i.toast({content:"维修清单有部分未填价格"}),!1;var u=a("#cost-list #image-list").find(".upload-item"),d=[];if(a.each(u,function(t,e){d.push(a(e).attr("data"))}),!t.canSubmit)return!1;t.canSubmit=!1;var m=t.csrf({images:d,plans:s,id:t.id});i.httpPost(o,m,function(n){t.canSubmit=!0,n.success?window.location.replace(e.to("order#index")):i.toast({content:n.message})},!0)})},t}),define("order/customer-order-controller",["mk7/controller","mk7/url","mk7/utils","mk7/photo-browser"],function(t,e,i,n){var a=Dom7,r=Template7,t=new t,o="order/customer/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.goToComment(),t.popupImageLayer(),t.agreementEvent()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(this.view="customer-order-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(o),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.goToComment=function(){var t=this;a("#customer-order .rate-btn-cls").click(function(i){window.location.replace(e.to("order/customer#rate/"+t.id+"/"+t.sn))})},t.agreementEvent=function(){a("#customer-order").on("click",".warranty-btn",function(t){a("#warranty-wrapper").remove();var e=a("#customer-order"),i=a("script#warranty-template"),n=r.compile(i.html()),o=n({});e.append(o)}),a("#customer-order").on("click",".agree-btn",function(t){a("#warranty-wrapper").remove()})},t.popupImageLayer=function(){var t=this;a("#customer-order").on("click",".view-img-cls",function(e){var i=a(this).parents("ul"),n=i.find(".view-img-cls"),r=[],o=a(this).attr("data-index");a.each(n,function(t,e){var i=a(e).attr("data-url");r.push(i)});var s=t.app.photoBrowser({photos:r,initialSlide:o});s.open()})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,a=Template7,t=new t,r="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.orderClickEvent()},t.tabEvent=function(){n(".tab-cls").click(function(t){var e=n(this).attr("data-href");window.location.replace(e)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var e=n(".nodata");0==e.length&&n("#index .order-list").append(''+t.nodata+"
"),t.app.detachInfiniteScroll(".infinite-scroll"),n("#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),n.ajax({method:"GET",url:e.to(r),data:a,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){if(1==e.success&&(i.isDefined(e.page)&&(t.page=parseInt(e.page)),i.isDefined(e.page_count)&&(t.pageCount=parseInt(e.page_count)),t.renderItems(e.items,!0),t.page>=t.pageCount))return void t.handleNodata()},error:function(t){},complete:function(e){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),n("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,e){var i=n("#index .order-list"),r=n("script#order-item-template"),o=a.compile(r.html()),s=o({list:t});0==e&&(i.html(""),i.append(s)),i.append(s)},t.addEvent=function(){n("#index .add-btn-cls").click(function(t){window.location.href=e.to("order/#submit")})},t.orderClickEvent=function(){n("#index").on("click",".order-item",function(t){var i=n(this).attr("data-id");window.location.href=e.to("order#order-details/"+i)})},t}),define("order/order-details-controller",["mk7/controller","mk7/url","mk7/utils","mk7/photo-browser"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="order/default/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.finishBtnEvent(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(t.view="order-details-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.finishBtnEvent=function(){var t=this;a("#order-details .finish-submit").click(function(i){window.location.replace(e.to("order/#cost-list/"+t.id))})},t.agreementEvent=function(){},t.popupImageLayer=function(){var t=this;a("#order-details").on("click",".view-img-cls",function(e){var i=a(this).parents("ul"),n=i.find(".view-img-cls"),r=[],o=a(this).attr("data-index");a.each(n,function(t,e){var i=a(e).attr("data-url");r.push(i)});var s=t.app.photoBrowser({photos:r,initialSlide:o});s.open()})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="order/customer/submit-rate",o="/user/default/upload-file";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.imgLimit=4,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent(),t.uploadImgEvent()},t.loadPage=function(){var t=this;t.render({servicePhone:window.$site.servicePhone})},t.starClickEvent=function(){a("#rate").on("click",".img-star",function(t){var e=a(this).attr("data-id"),i=a(this).parent(".star-div"),n=i.find(".img-star");a.each(n,function(t,n){var r=a(n).attr("data-id");if(1*r<=e){a(n).addClass("star-on");var o=i.find(".rate-text"),s=a(n).attr("data-txt");o.html(s)}else a(n).removeClass("star-on")})})},t.uploadImgEvent=function(){var t=this;a("#rate #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var r=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(o),processAppendTo:"#rate",success:function(e,n){try{if(e.success){var o=e.tmpUrl;a('').insertBefore(r),t.imgLimit==a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#rate #image-list").on("click",".del-img",function(e){a(this).parent().remove(),t.imgLimit>=a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").show()})},t.getUploadImgs=function(){var t=a("#rate #image-list").find(".up-img"),e=[];return 0==t.length?[]:(a.each(t,function(t,i){var n=a(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.submitEvent=function(){var t=this;a("#rate .submit-btn").click(function(n){var o=i.trim(a("#rate .text-content").val()),s=a("#rate .quality-box .img-star"),l=0;a.each(s,function(t,e){a(e).hasClass("star-on")&&l++});var c=a("#rate .effect-box .img-star"),u=0;a.each(c,function(t,e){a(e).hasClass("star-on")&&u++});var d=a("#rate .service-box .img-star"),m=0;a.each(d,function(t,e){a(e).hasClass("star-on")&&m++});var p=t.getUploadImgs(),v=t.csrf({comment:o,id:t.id,qualityStar:l,effectStar:u,serviceStar:m,images:p});i.httpPost(e.to(r),v,function(n){n.success?window.location.replace(e.to("order/customer#customer-order/"+t.id+"/"+t.sn)):i.toast({content:n.message})},!0)})},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs","mk7/picker"],function(t,e,n,a,r){var o=Dom7,s=Template7,t=new t,l="/user/default/upload-file",c="/order/default/do-submit",u=!0,d="";return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render(),t.loadInit()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent(),t.selectDateEvent(),t.openCarModel(),t.searchCarModel(),t.carModelClick()},t.loadInit=function(){var t=this;({id:t.id})},t.uploadImgEvent=function(){var t=this;o("#submit #upload-btn").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var i=o(this).parents("li");a.uploadFile({selector:"#upload-btn",url:e.to(l),processAppendTo:"#submit",success:function(e,a){try{if(e.success){var r=e.tmpUrl;o('').insertBefore(i),t.imgLimit==o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(s){n.toast({content:"出错",closeDelay:5e3})}}})}}),o("#submit #image-list").on("click",".del-img",function(e){o(this).parent().remove(),t.imgLimit>=o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;o("#submit .submit-btn-cls").click(function(i){var a=n.trim(o("#submit .carNo").val()),r=n.trim(o("#submit .carModel").val()),s=n.trim(o("#submit .customer").val()),l=n.trim(o("#submit .phone").val()),d=n.trim(o("#submit .preRepair").val()),m=n.trim(o("#submit .repairPrice").val()),p=n.trim(o("#submit .finishDate").val());if(0==u)return!1;if(""==a)return n.toast({content:"车牌号必填"}),!1;if(""==r)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==l)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"客联系电话有误"}),!1;if(""==d)return n.toast({content:"预估维修内容必填"}),!1;if(""==m)return n.toast({content:"预估维修费用必填"}),!1;if(""==p)return n.toast({content:"预估完成时间必填"}),!1;var v=t.getUploadImgs();if(0==v.length)return n.toast({content:"请上传车损照"}),!1;u=!1;var f=t.csrf({carNo:a,carModel:r,customer:s,phone:l,preRepair:d,repairPrice:m,finishDate:p,images:v});n.httpPost(c,f,function(t){return u=!0,t.success?void window.location.replace(e.to("order#index")):(n.toast({content:t.message}),!1)},!0)})},t.getUploadImgs=function(){var t=o("#submit #image-list").find(".up-img"),e=[];return 0==t.length?[]:(o.each(t,function(t,i){var n=o(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.selectDateEvent=function(){var t=this;o("#submit .finish-date-input").click(function(e){var i=o("#submit .finish-date-input").val();t.dateTimeSelector("#submit .finish-date-input",i)})},t.dateTimeSelector=function(t,e){var n=this,a=new Date,r=30,s=a.getFullYear(),l=a.getMonth(),c=a.getDate(),u=a.getHours(),m=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var p=e.split(" ");m=p[0],u=p[1]}var v=[];for(i=0;i<=r;i++){var f=new Date;f.setDate(a.getDate()+i);var h=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();v.push(h)}var g=n.app.picker({input:t,toolbarTemplate:'',value:[m,u],onChange:function(t,e,i){var n,a,r;if(e[0]instanceof Date)n=e[0].getFullYear(),a=e[0].getMonth(),r=e[0].getDate();else{var o=e[0].split("-");n=o[0],a=o[1]-1,r=o[2]}var s=new Date(n,a,r,e[1],0),l=new Date((new Date).getTime()+36e5);if(s