| 1 |
- import{r as p,h as D,o as q,e as _}from"./vendor-ef68d560.js";import{I as M,E as z}from"./XLSXUtils-4aee7c67.js";import{n as P,$ as E}from"./index-87faf287.js";import{b as B}from"./on-icon-02cf9fba.js";const G={__name:"templateListDialog",setup(b,{expose:t}){const e=p(!1),s=p([]);function i(){e.value=!0;const m={offset:0,limit:9999,ordering:"-id",del_flag:0,status:1,is_default:0,company:E.getters.company};HTTP.get("used_customer_templates",m).then(f=>{s.value=f.data.results})}function u(){e.value=!1}function y(m){HTTP.post("download_clue_customer_template",{template_id:m.id,type:2}).then(f=>{if(f.code==0){const r=document.createElement("a");r.href="http://sms.9haoai.com/"+f.data,r.download="",r.style.display="none",document.body.appendChild(r),r.click(),setTimeout(()=>{document.body.removeChild(r)},100)}})}return t({init:i}),{__sfc:!0,drawer:e,templateList:s,init:i,getListClose:u,getUploadUrl:y}}};var J=function(){var t=this,e=t._self._c,s=t._self._setupProxy;return e("el-drawer",{attrs:{title:"\u6A21\u677F\u4E0B\u8F7D",visible:s.drawer,"before-close":s.getListClose,direction:"rtl","append-to-body":!0,"destroy-on-close":!0},on:{"update:visible":function(i){s.drawer=i}}},[e("div",{staticClass:"template-box"},t._l(s.templateList,function(i){return e("div",{staticClass:"template-list",on:{click:function(u){return s.getUploadUrl(i)}}},[e("img",{attrs:{src:B,alt:""}}),e("div",[t._v("\u70B9\u51FB\u4E0B\u8F7D"+t._s(i.name))])])}),0),e("div",{staticClass:"footer",staticStyle:{display:"flex","justify-content":"flex-end",margin:"40px"}},[e("el-button",{attrs:{type:"primary"},on:{click:s.getListClose}},[t._v("\u8FD4\u56DE")])],1)])},K=[],O=P(G,J,K,!1,null,"3c1fd9b0",null,null);const Q=O.exports;const V={__name:"importDialog",emits:["getList"],setup(b,{expose:t,emit:e}){let s=p(!1);const i=p(),u=n=>{s.value=!0,i.value=n};let y=D(()=>h.value?"\u5386\u53F2\u5BFC\u5165\u8BB0\u5F55":"\u5BFC\u5165"),m=D(()=>r.value!=2);const f=p();let r=p(1);const T=p(),F=()=>{T.value.click()};let g=p([{name:""}]);const v=p(),H=n=>{n.target.files.length?(g.value=n.target.files,v.value=n,r.value=2):(r.value=1,g.value=[{name:""}],v.value=null)},x=p(0),w=p(0),k=p(0),R=()=>{r.value=2;const n=_.exports.Loading.service({lock:!0,text:"\u6B63\u5728\u5BFC\u5165\u6570\u636E...",spinner:"el-icon-loading",background:"rgba(255, 255, 255, 0.7)"});M(v.value).then(d=>{let a=[];d.data[0].map(c=>{let l={};l.name=c["*\u5BA2\u6237\u540D\u79F0"],l.source=c["*\u5BA2\u6237\u6765\u6E90"],l.video_link=c.\u89C6\u9891\u94FE\u63A5,l.belong_to_blogger=c.\u6240\u5C5E\u535A\u4E3B||"",l.contact=c.\u5BA2\u6237\u8054\u7CFB\u4EBA||"",l.phone=c["*\u5BA2\u6237\u624B\u673A"],l.tel=c.\u5BA2\u6237\u7535\u8BDD||"",l.wechat=c["*\u5BA2\u6237\u5FAE\u4FE1"]||"",l.industry=c.\u5BA2\u6237\u884C\u4E1A||"",l.remarks=c.\u5907\u6CE8||"",a.push(l)});const o={import_datas:a,...i.value};HTTP.post("upload_xml",o).then(c=>{_.exports.Message({type:"success",message:"\u6587\u4EF6\u4E0A\u4F20\u6210\u529F\uFF01",offset:"20px"}),x.value=c.data.total_count,w.value=c.data.success_count,k.value=c.data.fail_count,n.close(),r.value=3,e("getList")})}).catch(d=>{_.exports.Message({type:"error",message:`\u4E0A\u4F20\u5931\u8D25\uFF01${d}`,offset:"20px"}),n.close()})};function A(){r.value=2;const n=_.exports.Loading.service({lock:!0,text:"\u6B63\u5728\u5BFC\u5165\u6570\u636E...",spinner:"el-icon-loading",background:"rgba(255, 255, 255, 0.7)"});M(v.value).then(d=>{let a=[],o=!1;if(d.data[0].map(l=>{let $={};if(!l.phone)return o=!0;l.phone=l.phone.toString();for(let C of d.headers[0])C in l&&($[C]=l[C]);a.push($)}),o&&_.exports.Message.error("\u624B\u673A\u53F7\u4E0D\u80FD\u4E3A\u7A7A"),o)return n.close();a.splice(0,1);const c={import_datas:a,...i.value};HTTP.post("upload_xml",c).then(l=>{_.exports.Message({type:"success",message:"\u6587\u4EF6\u4E0A\u4F20\u6210\u529F\uFF01",offset:"20px"}),x.value=l.data.total_count,w.value=l.data.success_count,k.value=l.data.fail_count,n.close(),r.value=3,e("getList")})})}const I=()=>{r.value=1,g.value=[{name:""}],v.value=null,s.value=!1,h.value=!1},h=p(!1),U=()=>{S(),h.value=!0},L=p([]),S=()=>{HTTP.get("history_import",{is_self:i.value.is_self,type:i.value.import_type,ordering:"-id"}).then(n=>{L.value=n.data.results})},j=n=>{const d=_.exports.Loading.service({lock:!0,text:"\u6B63\u5728\u5BFC\u51FA\u6570\u636E...",spinner:"el-icon-loading",background:"rgba(255, 255, 255, 0.7)"}),a={};a.name="\u5BA2\u6237\u540D\u79F0",a.source="\u5BA2\u6237\u6765\u6E90",a.video_link="\u89C6\u9891\u94FE\u63A5",a.belong_to_blogger="\u6240\u5C5E\u535A\u4E3B",a.contact="\u5BA2\u6237\u8054\u7CFB\u4EBA",a.phone="\u5BA2\u6237\u624B\u673A",a.tel="\u5BA2\u6237\u7535\u8BDD",a.wechat="\u5BA2\u6237\u5FAE\u4FE1",a.industry="\u5BA2\u6237\u884C\u4E1A",a.remarks="\u5907\u6CE8",a.reason="\u5931\u8D25\u539F\u56E0";const o={};o.list=[],o.fileName=`${n.operator}\u7684\u5BFC\u5165\u5931\u8D25\u8BB0\u5F55 \u5BFC\u5165\u5931\u8D25\u65F6\u95F4${n.create_date}`,o.sheetName="\u5BFC\u5165\u5931\u8D25\u8BB0\u5F55",o.headers=a,o.list=n.fail_results,o.cols=[{width:20},{width:20},{width:50},{width:20},{width:20},{width:20},{width:20},{width:20},{width:20},{width:20},{width:20},{width:20}];try{z(o),d.close(),_.exports.Message({type:"success",message:"\u5BFC\u51FA\u6210\u529F\uFF01",offset:"20px"})}catch(c){_.exports.Message({type:"error",message:"\u5BFC\u51FA\u5931\u8D25\uFF01",offset:"20px"})}},N=()=>{const n={offset:0,limit:9999,ordering:"-id",del_flag:0,status:1,is_default:0,company:E.getters.company};HTTP.get("used_customer_templates",n).then(d=>{d.code==0&&(d.data.results.length==0?_.exports.Message.error("\u6682\u65E0\u4E0B\u8F7D\u6A21\u677F"):d.data.results.length==1?HTTP.post("download_clue_customer_template",{template_id:d.data.results[0].id,type:2}).then(a=>{if(a.code==0){const o=document.createElement("a");o.href="http://sms.9haoai.com/"+a.data,o.download="",o.style.display="none",document.body.appendChild(o),o.click(),setTimeout(()=>{document.body.removeChild(o)},100)}}):f.value.init())})};function X(){r.value=1,g.value=[{name:""}],v.value=null,s.value=!1,h.value=!1,e("getList")}return q(()=>{}),t({init:u}),{__sfc:!0,emits:e,drawer:s,type:i,init:u,title:y,isImport:m,templateListRef:f,isActive:r,excel_upload_input:T,selectFile:F,files:g,event:v,inputChange:H,total_count:x,success_count:w,fail_count:k,handleImport:R,readExcel:A,close:I,isShowTable:h,exportRecord:U,tableData:L,get_history_import:S,handleExport:j,downloadTemplate:N,getListClose:X,templateListDialog:Q}}};var W=function(){var i;var t=this,e=t._self._c,s=t._self._setupProxy;return e("el-drawer",{attrs:{title:s.title,visible:s.drawer,"before-close":s.getListClose,direction:"rtl","append-to-body":!0,"destroy-on-close":!0},on:{"update:visible":function(u){s.drawer=u}}},[s.isShowTable?t._e():e("div",[e("div",{staticClass:"steps"},[e("el-steps",{attrs:{active:s.isActive,"finish-status":"success"}},[e("el-step",{attrs:{title:"1.\u4E0A\u4F20\u6587\u4EF6"}}),e("el-step",{attrs:{title:"2.\u786E\u8BA4\u5BFC\u5165"}}),e("el-step",{attrs:{title:"3.\u5BFC\u5165\u6210\u529F"}})],1)],1),e("div",{staticClass:"drawer_main"},[s.isActive!==3?e("div",[e("p",[t._v(" \u4E00\u3001\u8BF7\u6309\u7167\u6570\u636E\u6A21\u677F\u51C6\u5907\u8981\u5BFC\u5165\u7684\u6570\u636E\u3002"),e("el-button",{attrs:{type:"text"},on:{click:s.downloadTemplate}},[t._v("\u70B9\u51FB\u4E0B\u8F7D\u300A\u5BA2\u6237\u6A21\u677F\u300B")])],1),e("p",{staticClass:"astrict"},[t._v("\u5BFC\u5165\u6587\u4EF6\u8BF7\u52FF\u8D85\u8FC72MB(\u7EA610000\u6761\u6570\u636E)")]),e("p",[t._v("\u4E8C\u3001\u8DDF\u73B0\u6709\u6570\u636E\u91CD\u590D\u65F6\uFF0C\u5C06\u65E0\u6CD5\u5BFC\u5165\u3002")]),e("p",[t._v("\u4E09\u3001\u8BF7\u9009\u62E9\u9700\u8981\u5BFC\u5165\u7684\u6587\u4EF6\u3002")]),e("div",{staticStyle:{display:"flex","align-items":"center"}},[e("el-button",{attrs:{type:"primary"},on:{click:s.selectFile}},[t._v("\u9009\u62E9\u6587\u4EF6")]),e("div",{staticStyle:{"margin-left":"15px"}},[t._v(t._s((i=s.files[0])==null?void 0:i.name))])],1),e("input",{ref:"excel_upload_input",staticClass:"excel-upload-input",attrs:{type:"file",accept:".xlsx, .xls"},on:{change:s.inputChange}})]):t._e(),s.isActive===3?e("p",{staticClass:"steps"},[t._v(" \u672C\u6B21\u5BFC\u5165\u603B\u6570\u636E"+t._s(s.total_count)+"\u6761\uFF0C\u6210\u529F"),e("span",{staticStyle:{color:"#55ca4a"}},[t._v(t._s(s.success_count))]),t._v("\u6761\u6570\u636E\uFF0C\u5931\u8D25"),e("span",{staticStyle:{color:"#e7405c"}},[t._v(t._s(s.fail_count))]),t._v("\u6761 ")]):t._e()]),e("div",{staticClass:"footer"},[e("el-button",{attrs:{type:"text"},on:{click:s.exportRecord}},[t._v("\u5386\u53F2\u5BFC\u51FA\u8BB0\u5F55")]),e("div",{staticClass:"btn"},[e("el-button",{attrs:{type:"primary"},on:{click:s.close}},[t._v("\u53D6\u6D88")]),e("el-button",{attrs:{type:"primary",disabled:s.isImport},on:{click:s.readExcel}},[t._v("\u786E\u8BA4\u5BFC\u5165")])],1)],1)]),s.isShowTable?e("div",{staticClass:"table"},[e("el-table",{attrs:{data:s.tableData,border:"","header-cell-style":{background:"#F6FAFF"}}},[e("el-table-column",{attrs:{prop:"create_date",label:"\u5BFC\u5165\u65F6\u95F4",width:"200px"}}),e("el-table-column",{attrs:{prop:"operator",label:"\u64CD\u4F5C\u4EBA",width:"150px"}}),e("el-table-column",{attrs:{label:"\u5BFC\u5165\u7ED3\u679C"},scopedSlots:t._u([{key:"default",fn:function({row:u}){return[t._v(" \u5BFC\u5165"+t._s(u.total_count)+"\u6761\uFF0C\u6210\u529F"+t._s(u.success_count)+"\u6761\uFF0C\u5931\u8D25"+t._s(u.fail_count)+"\u6761 ")]}}],null,!1,2343028739)}),e("el-table-column",{attrs:{label:"\u64CD\u4F5C",width:"150px"},scopedSlots:t._u([{key:"default",fn:function({row:u}){return[e("el-button",{attrs:{type:"text"},on:{click:function(y){return s.handleExport(u)}}},[t._v("\u4E0B\u8F7D\u5BFC\u5165\u5931\u8D25\u6587\u4EF6")])]}}],null,!1,3798198711)})],1),e("div",{staticClass:"footer",staticStyle:{"justify-content":"flex-end"}},[e("el-button",{attrs:{type:"primary"},on:{click:function(u){s.isShowTable=!s.isShowTable}}},[t._v("\u8FD4\u56DE")])],1)],1):t._e(),e(s.templateListDialog,{ref:"templateListRef"})],1)},Y=[],Z=P(V,W,Y,!1,null,"c1e5f148",null,null);const le=Z.exports;export{le as i};
|