clientsCEViews.68db4a98.js 11 KB

1
  1. import{n as ae,r as n,f as N,$ as L,o as le,e as u,t as j}from"./index.9d8a3e8d.js";import{u as se,a as ie}from"./composables.2846c723.js";import{L as oe,g as R}from"./LJFrom.935076a8.js";import"./LJUploadFiles.1bb9dd7d.js";import"./qiNiu.config.c702bce6.js";import"./LJUploadImages.72882c70.js";const re={__name:"clientsCEViews",setup(A){const a=se(),e=ie(),t=n(),l=n(),_=n(!1),d=n(e.query.type||"add"),S=n(e.query.status||""),b=n(null),h=n(e.query.clue||!1),y=n({}),p=n([]),x=n(d.value==="edit"?"\u7F16\u8F91\u5BA2\u6237":"\u65B0\u5EFA\u5BA2\u6237"),g=n(!1),F=n(null),T=n([]),G=n([]),C=n(!1),f=n([]),$=n(0),k=n([]),v=n({expected_order_time:"",intention_money:0}),I=n(!1),m=N({customer_id:null,company_id:L.getters.company,template_id:null,data:{}}),K=N({customer_id:[{required:!1,message:"\u8BF7\u9009\u62E9\u5BA2\u6237\u6A21\u677F",trigger:"change"}],template_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u5BA2\u6237\u6A21\u677F",trigger:"change"}]});function q(){console.log(e.query.row);const r={offset:0,limit:9999,ordering:"-id",fileds:"id,name",del_flag:0,is_default:0};d.value=="add"?r.status=1:delete r.status,HTTP.get("used_customer_templates",r).then(o=>{o.code==0&&(y.value=o.data.results,h.value&&(m.template_id=y.value[0].id,V(m.template_id),HTTP.getReadById("customTemplate",m.template_id).then(s=>{if(s.code!==0)return u.exports.Message.error(s.msg);R(s.data).then(i=>{for(const c of i)c.value=e.query.row[c.key];w()}).catch(i=>{u.exports.Message.error(i)})})))})}function P(){const r={offset:0,limit:999,fileds:"id,name",company:L.getters.company,del_flag:0};HTTP.get("customer_templates_member_level",r).then(o=>{o.code==0&&(G.value=o.data.results)})}function V(r){b.value=r,_.value=!1,p.value=[];const o=y.value.find(s=>s.id==r);R(o).then(s=>{if(console.log("template:",s),S.value=="clue"){for(const i of s)i.value=e.query.row[i.key];p.value=s.filter(i=>i.value==""||i.value==null)}else p.value=s;p.value=p.value.filter(i=>i.is_hide==0),_.value=!0,T.value=s.filter(i=>i.value),console.log(p.value,"selectTemplate.value"),w()}).catch(s=>{u.exports.Message.error(s)})}function O(){t.value.validate(r=>{if(!r)return l.value.validateForm();l.value.validateForm(o=>{if(!o)return;const s={...m,data:{...l.value.ruleForm,...v.value}};s.data.intention_level==0&&delete s.data.intention_level,s.label_id_list=[],k.value.map(i=>{s.label_id_list.push(i.id)}),h.value?(g.value=!0,s.customer_id=e.query.row.id,s.company_id=e.query.row.company,s.template_id=F.value,s.is_convert=!0,T.value.length>0&&T.value.map(i=>{s.data[i.key]=i.value}),HTTP.post("create_clue_customer",s).then(i=>{if(i.code!==0)return u.exports.Message({type:"error",message:i.msg});let c=[];c.push(e.query.row.id);const te={customer_id_list:c,template_id:b.value};HTTP.post("convert_to_customers",te).then(z=>{z.code==0?u.exports.Message({type:"success",message:"\u8F6C\u5316\u6210\u529F",duration:1500}):u.exports.Message.error(z.msg)}),setTimeout(M,1500)}).catch(i=>{g.value=!1,u.exports.Message({type:"error",message:i.msg||`${x.value}\u5931\u8D25`})})):(s.customer_id||delete s.customer_id,s.company_id=L.getters.company,g.value=!0,HTTP.post("create_customer",s).then(i=>{if(i.code!==0)return u.exports.Message({type:"error",message:i.msg});u.exports.Message({type:"success",message:`${x.value}\u6210\u529F\uFF01`,duration:1500}),setTimeout(M,1500)}).catch(i=>{g.value=!1,u.exports.Message({type:"error",message:i.msg||`${x.value}\u5931\u8D25`})}))})})}function w(){j(()=>{t.value.clearValidate(),l.value.clearValidate()})}function E(){j(()=>{t.value.resetFields(),l.value.resetFieldsForm()})}function M(){g.value=!1,E(),a.back()}function H(){HTTP.getReadById("customerList",e.query.id).then(r=>{const o=r.data;try{m.customer_id=o.id,m.company_id=o.company,m.template_id=o.customer_templates.id,v.value.member_level=o.member_level,v.value.intention_money=o.intention_money,v.value.expected_order_time=o.expected_order_time,v.value.intention_level=o.intention_level,o.customer_label&&(o.customer_label=o.customer_label.split(",").map(s=>{k.value.push({name:s})})),y.value=[o.customer_templates]}catch(s){}if(!m.template_id)return u.exports.Message({type:"error",message:"\u6A21\u677F\u4FE1\u606F\u7F3A\u5931",offset:"20px"});HTTP.getReadById("customTemplate",m.template_id).then(s=>{if(s.code!==0)return u.exports.Message.error(s.msg);R(s.data).then(i=>{for(const c of i)c.is_custom==1?c.value=o.customer_fields[c.key]:c.value=o[c.key],e.query.was_clue==1&&(c.value?c.disabled=!0:c.disabled=!1);p.value=i.filter(c=>c.is_hide==0),_.value=!0,w()}).catch(i=>{u.exports.Message.error(i)})})})}function J(){HTTP.getReadById("customerList",e.query.row.id).then(r=>{F.value=r.data.clue_customer_templates.id})}function Q(){C.value=!0,B()}function W(){C.value=!1}function B(){const r={company_id:L.getters.company,templates_id:m.template_id};e.query.id&&(r.customer_id=e.query.id,delete r.templates_id,delete r.company_id),HTTP.post("get_customer_label",r).then(o=>{o.code==0&&(f.value=o.data.label_cate,o.data.customer_label.length>0?f.value.unshift({name:"\u5DF2\u9009\u6807\u7B7E",cate_label_list:o.data.customer_label}):f.value.unshift({name:"\u5DF2\u9009\u6807\u7B7E",cate_label_list:[]}))})}function X(r){$.value=r}function Y(r){r.is_choose=!r.is_choose,r.is_choose?f.value[0].cate_label_list.push(r):f.value[0].cate_label_list=f.value[0].cate_label_list.filter(o=>o.id!=r.id)}function Z(){C.value=!1,k.value=f.value[0].cate_label_list}function ee(){v.intention_money=v.intention_money.replace(/[^0-9]/g,"")}return le(()=>{q(),P(),d.value==="edit"?(e.query.sala=="true"&&(I.value=!0),h.value?J():H()):q()}),{__sfc:!0,router:a,route:e,formRef:t,LJFromRef:l,LJFromRefShow:_,type:d,status:S,customerTemplateId:b,clue:h,customList:y,selectTemplate:p,title:x,isLoading:g,clueTemplateId:F,dataList:T,gradeList:G,dialogVisible:C,sortList:f,sortIndex:$,tagList:k,clientGrade:v,sala:I,form:m,rules:K,loadConfig:q,getGradeList:P,handleTemplate:V,submitForm:O,handleFromClearValidate:w,handleFormResetFies:E,resetForm:M,handleEditLoadConfig:H,getClueTemplateId:J,setLabel:Q,handleClose:W,getTagList:B,getSortItem:X,changeTag:Y,submitTag:Z,validateNumber:ee,LJFrom:oe}}};var D=function(){var a=this,e=a._self._c,t=a._self._setupProxy;return e("div",{staticClass:"clients-create-views"},[e("div",{staticClass:"title"},[e("div",{staticStyle:{"margin-left":"30px"}},[a._v(a._s(t.title)),t.type=="edit"?e("span",{staticStyle:{"margin-left":"10px","font-size":"12px",color:"#909399"}},[a._v("(*\u82E5\u6709\u7981\u7528\u5B57\u6BB5\uFF0C\u9700\u4FEE\u6539\u8BF7\u5230\u7EBF\u7D22\u8BE6\u60C5\u4E2D\u4FEE\u6539)")]):a._e()]),e("div",{staticStyle:{display:"flex","justify-content":"center","margin-right":"20px"}},[e("el-button",{on:{click:t.resetForm}},[a._v("\u53D6\u6D88")]),e("el-button",{attrs:{type:"primary",loading:t.isLoading},on:{click:t.submitForm}},[a._v("\u4FDD\u5B58")])],1)]),e("div",{staticClass:"detail-cont"},[e("el-divider"),e("div",{},[e("el-form",{ref:"formRef",attrs:{model:t.form,rules:t.rules,"label-width":"100px"}},[e("el-row",{staticClass:"form_header"},[e("el-col",{attrs:{span:12}},[t.status=="clue"?e("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"\u5BA2\u6237\u6A21\u677F",prop:"template_id"}},[e("el-select",{staticStyle:{width:"50%"},attrs:{placeholder:"\u8BF7\u9009\u62E9",clearable:""},on:{change:t.handleTemplate},model:{value:t.form.template_id,callback:function(l){a.$set(t.form,"template_id",l)},expression:"form.template_id"}},a._l(t.customList,function(l){return e("el-option",{key:l.id,attrs:{label:l.name,value:l.id}})}),1)],1):e("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"\u5BA2\u6237\u6A21\u677F",prop:"template_id"}},[e("el-select",{staticStyle:{width:"50%"},attrs:{disabled:t.type!="add",placeholder:"\u8BF7\u9009\u62E9",clearable:""},on:{change:t.handleTemplate},model:{value:t.form.template_id,callback:function(l){a.$set(t.form,"template_id",l)},expression:"form.template_id"}},a._l(t.customList,function(l){return e("el-option",{key:l.id,attrs:{label:l.name,value:l.id}})}),1)],1)],1)],1),t.LJFromRefShow?e("div",{staticClass:"form_header"},[e(t.LJFrom,{ref:"LJFromRef",staticStyle:{"margin-top":"20px","margin-bottom":"20px"},attrs:{templates:t.selectTemplate}}),t.sala?e("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"\u6210\u5355\u65F6\u95F4"}},[e("el-date-picker",{staticStyle:{width:"25%"},attrs:{type:"date","value-format":"yyyy-MM-dd",placeholder:"\u9009\u62E9\u65E5\u671F"},model:{value:t.clientGrade.expected_order_time,callback:function(l){a.$set(t.clientGrade,"expected_order_time",l)},expression:"clientGrade.expected_order_time"}})],1):a._e(),t.sala?e("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"\u9500\u552E\u91D1\u989D"}},[e("el-input",{staticStyle:{width:"25%"},attrs:{placeholder:"\u8BF7\u8F93\u5165\u5BA2\u6237\u91D1\u989D\u5907\u6CE8"},on:{input:t.validateNumber},model:{value:t.clientGrade.intention_money,callback:function(l){a.$set(t.clientGrade,"intention_money",l)},expression:"clientGrade.intention_money"}},[e("template",{slot:"append"},[a._v("\u5143")])],2)],1):a._e(),e("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"\u5BA2\u6237\u7B49\u7EA7"}},[e("el-select",{staticStyle:{width:"25%"},attrs:{placeholder:"\u8BF7\u9009\u62E9",clearable:""},model:{value:t.clientGrade.member_level,callback:function(l){a.$set(t.clientGrade,"member_level",l)},expression:"clientGrade.member_level"}},a._l(t.gradeList,function(l){return e("el-option",{key:l.id,attrs:{label:l.name,value:l.id}})}),1)],1),e("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"\u5BA2\u6237\u610F\u5411\u5EA6"}},[e("el-rate",{staticStyle:{"margin-top":"8px"},model:{value:t.clientGrade.intention_level,callback:function(l){a.$set(t.clientGrade,"intention_level",l)},expression:"clientGrade.intention_level"}})],1),e("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"\u5BA2\u6237\u6807\u7B7E"}},[e("div",{staticStyle:{display:"flex"}},[a._l(t.tagList,function(l){return e("div",{staticClass:"tag-box-list"},[e("el-tag",[a._v(a._s(l.name))])],1)}),e("el-button",{attrs:{type:"primary",plain:"",size:"mini"},on:{click:t.setLabel}},[a._v("\u8BBE\u7F6E\u5BA2\u6237\u6807\u7B7E")])],2)])],1):a._e()],1)],1),e("el-dialog",{attrs:{title:"\u8BBE\u7F6E\u5BA2\u6237\u6807\u7B7E",visible:t.dialogVisible,width:"35%","append-to-body":!0,"modal-append-to-body":!1,"before-close":t.handleClose},on:{"update:visible":function(l){t.dialogVisible=l}}},[e("div",{staticClass:"tag-box"},[e("div",{staticClass:"tag-sort-list"},a._l(t.sortList,function(l,_){return e("div",{key:_,class:t.sortIndex==_?"tag-sort-item active":"tag-sort-item",on:{click:function(d){return t.getSortItem(_)}}},[e("span",{staticClass:"sort-name"},[a._v(a._s(l.name))]),e("span",[a._v(a._s(l.cate_label_list.filter(d=>d.is_choose).length))])])}),0),e("div",{staticClass:"tag-list"},a._l(t.sortList,function(l,_){return e("div",{key:_,staticClass:"tag-item"},[e("div",{staticClass:"tag-sort-name"},[a._v(a._s(l.name))]),e("div",{staticClass:"tag-item-list"},a._l(l.cate_label_list,function(d,S){return e("div",{class:d.is_choose?"tag-item-name active":"tag-item-name",on:{click:function(b){return t.changeTag(d)}}},[a._v(a._s(d.name))])}),0)])}),0)]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:t.handleClose}},[a._v("\u53D6 \u6D88")]),e("el-button",{attrs:{type:"primary"},on:{click:t.submitTag}},[a._v("\u786E \u5B9A")])],1)])],1)])},ne=[];D._withStripped=!0;var U=ae(re,D,ne,!1,null,"aa3f9c87",null,null);U.options.__file="E:/\u5341\u4E8C\u79D1\u6280/\u9879\u76EE/\u4E5D\u53F7\u540C\u4E8B/salary-management-web/src/views/markets/clients/clientRoot/clientsCEViews.vue";const fe=U.exports;export{fe as default};