You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
10 KiB
1 lines
10 KiB
webpackJsonp([86],{"+CCe":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=r("mvHQ"),a=r.n(s),o=r("Xxa5"),i=r.n(o),n=r("exGp"),l=r.n(n),u=r("PJh5"),m=r.n(u),c={data:function(){var e=this;return{navTitle:"",showMap:!1,base_agent:[],subForm:{id:0,cover:[],title:"",attestation:"",phone:"",star:"",order_num:"",order_rate:"",positive_rate:"",business_license:[],text:"",admin_id:"",start_time:"00:00",end_time:"23:59",address:"",lat:"",lng:""},subFormRules:{cover:{required:!0,type:"array",message:"请上传门店头像",trigger:["blur","change"]},title:{required:!0,validator:this.$reg.isNotNull,text:"门店名称",reg_type:2,trigger:"blur"},attestation:{required:!0,type:"string",message:"请输入门店认证名称",trigger:"blur"},star:{required:!0,validator:function(e,t,r){""===t||!/^(([0-5]*)|(([0]\.\d{1}|[1-5]*\.\d{1})))$/.test(t)||1*t>5?r(new Error(""===t?"请输入评分":"请输入正确的评分,取值0至5,最多保留1位小数")):r()},trigger:["blur","change"]},order_num:{required:!0,validator:this.$reg.isNum,text:"服务次数",trigger:"blur"},order_rate:{required:!0,validator:this.$reg.isPercent,text:"接单率",trigger:"blur"},positive_rate:{required:!0,validator:this.$reg.isPercent,text:"好评率",trigger:"blur"},business_license:{required:!0,type:"array",message:"请上传营业执照",trigger:["blur","change"]},admin_id:{required:!0,type:"number",message:"请选择代理商",trigger:"blur"},time:{required:!0,validator:function(t,r,s){var a=e.subForm,o=a.start_time,i=a.end_time;o&&i?s():s(new Error(o?"请选择结束时间":"请选择开始时间"))},trigger:"blur"},address:{required:!0,validator:function(t,r,s){var a=e.subForm,o=a.address,i=a.lat,n=a.lng;(o=o?o.replace(/(^\s*)|(\s*$)/g,""):"")?n&&/^[\-\+]?(0(\.\d{1,15})?|([1-9](\d)?)(\.\d{1,15})?|1[0-7]\d{1}(\.\d{1,15})?|180\.0{1,15})$/.test(n)?i&&/^[\-\+]?((0|([1-8]\d?))(\.\d{1,15})?|90(\.0{1,15})?)$/.test(i)?s():s(new Error(i?"请输入正确的纬度":"请输入门店纬度")):s(new Error(n?"请输入正确的经度":"请输入门店经度")):s(new Error("请输入门店地址"))},trigger:["blur","change"]}}}},created:function(){var e=this;return l()(i.a.mark(function t(){var r;return i.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.$route.query.id,t.next=3,e.getBaseInfo();case 3:r&&(e.subForm.id=r,e.getDetail(r)),e.navTitle=e.$t(r?"menu.StoreEdit":"menu.StoreAdd");case 5:case"end":return t.stop()}},t,e)}))()},methods:{getBaseInfo:function(){var e=this;return l()(i.a.mark(function t(){var r,s,a;return i.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.$api.agent.adminSelect();case 2:if(r=t.sent,s=r.code,a=r.data,200===s){t.next=7;break}return t.abrupt("return");case 7:e.base_agent=a;case 8:case"end":return t.stop()}},t,e)}))()},getDetail:function(e){var t=this;return l()(i.a.mark(function r(){var s,a,o,n;return i.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.$api.store.storeInfo({id:e});case 2:if(s=r.sent,a=s.code,o=s.data,200===a){r.next=7;break}return r.abrupt("return");case 7:for(n in o.cover=[{url:o.cover}],o.business_license=[{url:o.business_license}],t.subForm)t.subForm[n]=o[n];case 10:case"end":return r.stop()}},r,t)}))()},getCover:function(e,t){this.subForm[t]=e},getLatLng:function(e){this.subForm.lat=e.lat,this.subForm.lng=e.lng},submitForm:function(){var e=this,t=!0;if(this.$refs.subForm.validate(function(e){e||(t=!1)}),t){var r=JSON.parse(a()(this.subForm));r.cover=r.cover[0].url,r.business_license=r.business_license[0].url;if(r.phone&&!/((^400)-([0-9]{7})$)|(^1[3-9]\d{9}$)|((^0\d{2,3})-(\d{7,8})$)/.test(r.phone))return void this.$message.error("请输入有效的联系电话");var s=r.start_time,o=r.end_time,i=r.lat,n=void 0===i?"":i,l=r.lng,u=void 0===l?"":l;if(s&&!o||!s&&o)return void this.$message.error(s?"请选择营业结束时间":"请选择营业开始时间");var m=/^[\-\+]?(0(\.\d{1,15})?|([1-9](\d)?)(\.\d{1,15})?|1[0-7]\d{1}(\.\d{1,15})?|180\.0{1,15})$/;if(u&&!m.test(u)||n&&!/^[\-\+]?((0|([1-8]\d?))(\.\d{1,15})?|90(\.0{1,15})?)$/.test(n))return void this.$message.error(u&&!m.test(u)?"请输入正确的经度":"请输入正确的纬度");var c=r.id?"storeUpdate":"storeAdd";this.$api.store[c](r).then(function(t){200===t.code&&(e.$message.success(e.$t(r.id?"tips.successRev":"tips.successSub")),e.$router.back(-1))})}}},filters:{handleStartEndTime:function(e){var t="",r=e.start_time,s=e.end_time,a=m()(Date.now()).format("YYYY-MM-DD");return r&&s&&m()(a+" "+s).unix()<m()(a+" "+r).unix()&&(t="次日"),t}}},d={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"lb-store-manage-edit"},[r("top-nav",{attrs:{title:e.navTitle,isBack:!0}}),e._v(" "),r("div",{staticClass:"page-main"},[r("el-form",{ref:"subForm",attrs:{model:e.subForm,rules:e.subFormRules,"label-width":"130px"},nativeOn:{submit:function(e){e.preventDefault()}}},[r("el-form-item",{attrs:{label:"门店头像",prop:"cover"}},[r("lb-cover",{attrs:{fileList:e.subForm.cover},on:{selectedFiles:function(t){return e.getCover(t,"cover")}}}),e._v(" "),r("lb-tool-tips",[e._v("图片建议尺寸: 160 * 143")])],1),e._v(" "),r("el-form-item",{attrs:{label:"门店名称",prop:"title"}},[r("el-input",{attrs:{maxlength:"15","show-word-limit":"",placeholder:"请输入门店名称"},model:{value:e.subForm.title,callback:function(t){e.$set(e.subForm,"title",t)},expression:"subForm.title"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"门店认证名称",prop:"attestation"}},[r("el-input",{attrs:{maxlength:"20","show-word-limit":"",placeholder:"请输入门店认证名称"},model:{value:e.subForm.attestation,callback:function(t){e.$set(e.subForm,"attestation",t)},expression:"subForm.attestation"}}),e._v(" "),r("lb-tool-tips",[e._v("营业执照上的企业名称")])],1),e._v(" "),r("el-form-item",{attrs:{label:"联系电话",prop:"phone"}},[r("el-input",{attrs:{placeholder:"请输入联系电话"},model:{value:e.subForm.phone,callback:function(t){e.$set(e.subForm,"phone",t)},expression:"subForm.phone"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"门店评分",prop:"star"}},[r("el-input",{attrs:{placeholder:"请输入门店评分"},model:{value:e.subForm.star,callback:function(t){e.$set(e.subForm,"star",t)},expression:"subForm.star"}}),e._v(" "),r("lb-tool-tips",[e._v("例如4.8,数值不超过5.0")])],1),e._v(" "),r("el-form-item",{attrs:{label:"服务次数",prop:"order_num"}},[r("el-input",{attrs:{placeholder:"请输入服务次数"},model:{value:e.subForm.order_num,callback:function(t){e.$set(e.subForm,"order_num",t)},expression:"subForm.order_num"}},[r("template",{slot:"append"},[e._v("+次")])],2)],1),e._v(" "),r("el-form-item",{attrs:{label:"接单率",prop:"order_rate"}},[r("el-input",{attrs:{placeholder:"请输入接单率"},model:{value:e.subForm.order_rate,callback:function(t){e.$set(e.subForm,"order_rate",t)},expression:"subForm.order_rate"}}),e._v(" "),r("lb-tool-tips",[e._v("请输入数值,取值0-100")])],1),e._v(" "),r("el-form-item",{attrs:{label:"好评率",prop:"positive_rate"}},[r("el-input",{attrs:{placeholder:"请输入好评率"},model:{value:e.subForm.positive_rate,callback:function(t){e.$set(e.subForm,"positive_rate",t)},expression:"subForm.positive_rate"}}),e._v(" "),r("lb-tool-tips",[e._v("请输入数值,取值0-100")])],1),e._v(" "),r("el-form-item",{attrs:{label:"营业执照",prop:"business_license"}},[r("lb-cover",{attrs:{fileList:e.subForm.business_license},on:{selectedFiles:function(t){return e.getCover(t,"business_license")}}})],1),e._v(" "),r("el-form-item",{attrs:{label:"商家简介",prop:"text"}},[r("el-input",{attrs:{type:"textarea",rows:10,maxlength:"300","show-word-limit":"",resize:"none",placeholder:"请输入商家简介"},model:{value:e.subForm.text,callback:function(t){e.$set(e.subForm,"text",t)},expression:"subForm.text"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"关联代理商",prop:"admin_id"}},[r("el-select",{attrs:{placeholder:"请选择代理商",filterable:"",clearable:""},model:{value:e.subForm.admin_id,callback:function(t){e.$set(e.subForm,"admin_id",t)},expression:"subForm.admin_id"}},e._l(e.base_agent,function(e){return r("el-option",{key:e.id,attrs:{label:e.agent_name,value:e.id}})}),1)],1),e._v(" "),r("el-form-item",{attrs:{label:"营业时间",prop:"time"}},[r("el-time-select",{staticStyle:{width:"150px"},attrs:{placeholder:"开始时间","picker-options":{start:"00:00",step:"00:01",end:"24:00"}},model:{value:e.subForm.start_time,callback:function(t){e.$set(e.subForm,"start_time",t)},expression:"subForm.start_time"}}),e._v(" "),r("block",[e._v("至"+e._s(e._f("handleStartEndTime")(e.subForm)))]),e._v(" "),r("el-time-select",{staticStyle:{width:"150px"},attrs:{placeholder:"结束时间","picker-options":{start:"00:00",step:"00:01",end:"24:00"}},model:{value:e.subForm.end_time,callback:function(t){e.$set(e.subForm,"end_time",t)},expression:"subForm.end_time"}}),e._v(" "),r("lb-tool-tips",[e._v("营业时间和入驻"+e._s(e.$t("action.attendantName"))+"的工作时间设置一致")])],1),e._v(" "),r("el-form-item",{attrs:{label:"门店地址",prop:"address"}},[r("el-input",{attrs:{placeholder:"请输入门店地址"},model:{value:e.subForm.address,callback:function(t){e.$set(e.subForm,"address",t)},expression:"subForm.address"}}),e._v(" "),r("div",{staticClass:"mt-md mb-md"},[r("el-input",{attrs:{placeholder:"请输入门店经度"},model:{value:e.subForm.lng,callback:function(t){e.$set(e.subForm,"lng",t)},expression:"subForm.lng"}})],1),e._v(" "),r("div",[r("el-input",{attrs:{placeholder:"请输入门店纬度"},model:{value:e.subForm.lat,callback:function(t){e.$set(e.subForm,"lat",t)},expression:"subForm.lat"}}),e._v(" "),r("lb-button",{staticClass:"getLocation",staticStyle:{"margin-left":"10px"},attrs:{type:"primary",plain:""},on:{click:function(t){e.showMap=!0}}},[e._v("获取经纬度")])],1)],1),e._v(" "),r("el-form-item",[r("lb-button",{directives:[{name:"preventReClick",rawName:"v-preventReClick"}],attrs:{type:"primary"},on:{click:e.submitForm}},[e._v(e._s(e.$t("action.submit")))]),e._v(" "),r("lb-button",{on:{click:function(t){return e.$router.back(-1)}}},[e._v(e._s(e.$t("action.back")))])],1)],1),e._v(" "),r("lb-map",{attrs:{dialogVisible:e.showMap},on:{"update:dialogVisible":function(t){e.showMap=t},"update:dialog-visible":function(t){e.showMap=t},selectedLatLng:e.getLatLng}})],1)],1)},staticRenderFns:[]};var b=r("VU/8")(c,d,!1,function(e){r("CZNm")},"data-v-308f8c9c",null);t.default=b.exports},CZNm:function(e,t){}}); |