!function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function r(e){for(var r=1;r=0;--n){var i=this.tryEntries[n],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),s=o.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&o.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),F(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var a=r.completion;if("throw"===a.type){var n=a.arg;F(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,a){return this.delegate={iterator:G(e),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=t),y}},r}function o(e,t,r,a,n,o,i){try{var l=e[o](i),c=l.value}catch(s){return void r(s)}l.done?t(c):Promise.resolve(c).then(a,n)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(a,n){var i=e.apply(t,r);function l(e){o(i,a,n,l,c,"next",e)}function c(e){o(i,a,n,l,c,"throw",e)}l(void 0)}))}}function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw o}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r0?C.value.unshift({name:"已选标签",cate_label_list:e.data.customer_label}):C.value.unshift({name:"已选标签",cate_label_list:[]}))}))}return u((function(){H(),"edit"===_.value?("true"==p.query.sala&&(M.value=!0),L.value?B():D()):H()})),{__sfc:!0,router:t,route:p,formRef:h,LJFromRef:y,LJFromRefShow:b,type:_,status:x,customerTemplateId:w,clue:L,customList:T,selectTemplate:S,title:k,isLoading:j,clueTemplateId:E,dataList:O,gradeList:P,dialogVisible:F,sortList:C,sortIndex:G,tagList:q,clientGrade:I,sala:M,form:N,rules:R,loadConfig:H,getGradeList:J,handleTemplate:z,submitForm:function(){h.value.validate((function(e){if(!e)return y.value.validateForm();y.value.validateForm((function(e){if(e){var t=r(r({},N),{},{data:r(r({},y.value.ruleForm),I.value)});0==t.data.intention_level&&delete t.data.intention_level,t.label_id_list=[],q.value.map((function(e){t.label_id_list.push(e.id)})),L.value?(j.value=!0,t.customer_id=p.query.row.id,t.company_id=p.query.row.company,t.template_id=E.value,t.is_convert=!0,O.value.length>0&&O.value.map((function(e){t.data[e.key]=e.value})),HTTP.post("create_clue_customer",t).then((function(e){if(0!==e.code)return d.exports.Message({type:"error",message:e.msg});var t=[];t.push(p.query.row.id);var r={customer_id_list:t,template_id:w.value};HTTP.post("convert_to_customers",r).then((function(e){0==e.code?d.exports.Message({type:"success",message:"转化成功",duration:1500}):d.exports.Message.error(e.msg)})),setTimeout(V,1500)})).catch((function(e){j.value=!1,d.exports.Message({type:"error",message:e.msg||"".concat(k.value,"失败")})}))):(t.customer_id||delete t.customer_id,t.company_id=m.getters.company,j.value=!0,HTTP.post("create_customer",t).then((function(e){if(0!==e.code)return d.exports.Message({type:"error",message:e.msg});d.exports.Message({type:"success",message:"".concat(k.value,"成功!"),duration:1500}),setTimeout(V,1500)})).catch((function(e){j.value=!1,d.exports.Message({type:"error",message:e.msg||"".concat(k.value,"失败")})})))}}))}))},handleFromClearValidate:A,handleFormResetFies:$,resetForm:V,handleEditLoadConfig:D,getClueTemplateId:B,setLabel:function(){F.value=!0,U()},handleClose:function(){F.value=!1},getTagList:U,getSortItem:function(e){G.value=e},changeTag:function(e){e.is_choose=!e.is_choose,e.is_choose?C.value[0].cate_label_list.push(e):C.value[0].cate_label_list=C.value[0].cate_label_list.filter((function(t){return t.id!=e.id}))},submitTag:function(){F.value=!1,q.value=C.value[0].cate_label_list},validateNumber:function(){I.intention_money=I.intention_money.replace(/[^0-9]/g,"")},LJFrom:v}}};e("default",p(t,(function(){var e=this,t=e._self._c,r=e._self._setupProxy;return t("div",{staticClass:"clients-create-views"},[t("div",{staticClass:"title"},[t("div",{staticStyle:{"margin-left":"30px"}},[e._v(e._s(r.title)),"edit"==r.type?t("span",{staticStyle:{"margin-left":"10px","font-size":"12px",color:"#909399"}},[e._v("(*若有禁用字段,需修改请到线索详情中修改)")]):e._e()]),t("div",{staticStyle:{display:"flex","justify-content":"center","margin-right":"20px"}},[t("el-button",{on:{click:r.resetForm}},[e._v("取消")]),t("el-button",{attrs:{type:"primary",loading:r.isLoading},on:{click:r.submitForm}},[e._v("保存")])],1)]),t("div",{staticClass:"detail-cont"},[t("el-divider"),t("div",{},[t("el-form",{ref:"formRef",attrs:{model:r.form,rules:r.rules,"label-width":"100px"}},[t("el-row",{staticClass:"form_header"},[t("el-col",{attrs:{span:12}},["clue"==r.status?t("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"客户模板",prop:"template_id"}},[t("el-select",{staticStyle:{width:"50%"},attrs:{placeholder:"请选择",clearable:""},on:{change:r.handleTemplate},model:{value:r.form.template_id,callback:function(t){e.$set(r.form,"template_id",t)},expression:"form.template_id"}},e._l(r.customList,(function(e){return t("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1):t("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"客户模板",prop:"template_id"}},[t("el-select",{staticStyle:{width:"50%"},attrs:{disabled:"add"!=r.type,placeholder:"请选择",clearable:""},on:{change:r.handleTemplate},model:{value:r.form.template_id,callback:function(t){e.$set(r.form,"template_id",t)},expression:"form.template_id"}},e._l(r.customList,(function(e){return t("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1)],1)],1),r.LJFromRefShow?t("div",{staticClass:"form_header"},[t(r.LJFrom,{ref:"LJFromRef",staticStyle:{"margin-top":"20px","margin-bottom":"20px"},attrs:{templates:r.selectTemplate}}),r.sala?t("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"成单时间"}},[t("el-date-picker",{staticStyle:{width:"25%"},attrs:{type:"date","value-format":"yyyy-MM-dd",placeholder:"选择日期"},model:{value:r.clientGrade.expected_order_time,callback:function(t){e.$set(r.clientGrade,"expected_order_time",t)},expression:"clientGrade.expected_order_time"}})],1):e._e(),r.sala?t("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"销售金额"}},[t("el-input",{staticStyle:{width:"25%"},attrs:{placeholder:"请输入客户金额备注"},on:{input:r.validateNumber},model:{value:r.clientGrade.intention_money,callback:function(t){e.$set(r.clientGrade,"intention_money",t)},expression:"clientGrade.intention_money"}},[t("template",{slot:"append"},[e._v("元")])],2)],1):e._e(),t("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"客户等级"}},[t("el-select",{staticStyle:{width:"25%"},attrs:{placeholder:"请选择",clearable:""},model:{value:r.clientGrade.member_level,callback:function(t){e.$set(r.clientGrade,"member_level",t)},expression:"clientGrade.member_level"}},e._l(r.gradeList,(function(e){return t("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1),t("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"客户意向度"}},[t("el-rate",{staticStyle:{"margin-top":"8px"},model:{value:r.clientGrade.intention_level,callback:function(t){e.$set(r.clientGrade,"intention_level",t)},expression:"clientGrade.intention_level"}})],1),t("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"客户标签"}},[t("div",{staticStyle:{display:"flex"}},[e._l(r.tagList,(function(r){return t("div",{staticClass:"tag-box-list"},[t("el-tag",[e._v(e._s(r.name))])],1)})),t("el-button",{attrs:{type:"primary",plain:"",size:"mini"},on:{click:r.setLabel}},[e._v("设置客户标签")])],2)])],1):e._e()],1)],1),t("el-dialog",{attrs:{title:"设置客户标签",visible:r.dialogVisible,width:"35%","append-to-body":!0,"modal-append-to-body":!1,"before-close":r.handleClose},on:{"update:visible":function(e){r.dialogVisible=e}}},[t("div",{staticClass:"tag-box"},[t("div",{staticClass:"tag-sort-list"},e._l(r.sortList,(function(a,n){return t("div",{key:n,class:r.sortIndex==n?"tag-sort-item active":"tag-sort-item",on:{click:function(e){return r.getSortItem(n)}}},[t("span",{staticClass:"sort-name"},[e._v(e._s(a.name))]),t("span",[e._v(e._s(a.cate_label_list.filter((function(e){return e.is_choose})).length))])])})),0),t("div",{staticClass:"tag-list"},e._l(r.sortList,(function(a,n){return t("div",{key:n,staticClass:"tag-item"},[t("div",{staticClass:"tag-sort-name"},[e._v(e._s(a.name))]),t("div",{staticClass:"tag-item-list"},e._l(a.cate_label_list,(function(a,n){return t("div",{class:a.is_choose?"tag-item-name active":"tag-item-name",on:{click:function(e){return r.changeTag(a)}}},[e._v(e._s(a.name))])})),0)])})),0)]),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:r.handleClose}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary"},on:{click:r.submitTag}},[e._v("确 定")])],1)])],1)])}),[],!1,null,"0c085d6b",null,null).exports)}}}))}();