import{a2 as e,e as a,r as t,Q as s,cB as n,x as r,f as i,g as l,o,k as u,i as c,w as d,a as p,h as m,j as _,t as x,N as h,a7 as f,F as y,y as g,z as b,a8 as v,b as j,a9 as I,K as T,aa as w,J as k,m as D,aq as C}from"./index-Cg3FU-dV.js";import{t as z}from"./index.B9huFudH.js";import{d as N}from"./index.D_hliqYM.js";/* empty css */import{_ as L}from"./_plugin-vue_export-helper.BCo6x5W8.js";/* empty css */import{c as $}from"./customerListDefault.CzCTIP25.js";import{c as H}from"./customerTab.DpH_ZKvN.js";import{g as K}from"./index.vG6WzeDr.js";import{_ as R}from"./uni-datetime-picker.h8Ix41Za.js";import{s as B}from"./selectedLabel.CU9AKV_D.js";import{d as J}from"./assessment.C7cFhOQt.js";import{d as M}from"./customer.DHyt6w_W.js";import"./uni-nav-bar.BXgu2eq7.js";import"./uni-icons.D_sy4NxH.js";/* empty css *//* empty css *//* empty css */import"./uni-row.DfI4R5V8.js";import"./uni-dateformat.D7mTxFoD.js";import"./uni-list.B5vvSfhy.js";import"./uni-badge.AEsViQRE.js";import"./customer-lost.DHTY2quF.js";import"./index.Dozy1JgX.js";import"./index.BWMD6Xfl.js";import"./default-avatar.BAKNUlXW.js";/* empty css */import"./uni-datetime-picker.vue_vue_type_style_index_0_scoped_6f474695_lang.CEqmT57_.js";import"./uni-popup.B818XS1j.js";import"./uni-popup.vue_vue_type_style_index_0_scoped_90b62717_lang.D0ze9A39.js";const O={__name:"formBox",props:{type:{type:String,default:"center"},status:{type:Number,default:2}},emits:["change"],setup(j,{emit:I}){const T=j,{type:w,status:k}=e(T),D=a({typeText:"客户状态",timeText:"创建日期",usersText:"业务员",labelText:"标签筛选",typeIndex:0,usersIndex:0,usersData:[]}),C=a({time:"",salesmanId:"",customer_status:"",customer_label:[]}),z=t(null);let N=I;const L=a([{name:"全部",id:""},{name:"未成交",id:0},{name:"已成交",id:1},{name:"已流失",id:2}]);s((()=>{$()}));const $=()=>{n().then((e=>{const a=e.data?e.data:[];a.unshift({name:"所有人员",id:""}),D.usersData=a})).catch((e=>{r.error(e.message)}))},H=t(null),K=e=>{H.value.popupOpen(C.customer_label)},J=(e,a)=>{C.customer_label=e,e.length>0?D.labelText=a[0]:D.labelText="标签筛选",N("change",C)},M=e=>{const a=e.detail.value;D.typeText=L[a].name,"全部"===D.typeText&&(D.typeText="客户状态"),C.customer_status=L[a].id,N("change",C)},O=e=>{const a=e.detail.value;D.usersText=D.usersData[a].name,"所有人员"===D.usersText&&(D.usersText="业务员"),C.salesmanId=D.usersData[a].id,N("change",C)},Q=()=>{z.value.clear()},S=e=>{if(e.length>0){const a=e[0].replace(/-/g,"/")+"-"+e[1].replace(/-/g,"/");D.timeText=e[0].substring(5).replace("-","/")+"-"+e[1].substring(5).replace("-","/"),C.time=a}else D.timeText="所有日期",C.time="";N("change",C)};return(e,a)=>{const t=g,s=b,n=v,r=i(l("uni-datetime-picker"),R);return o(),u(y,null,[c(s,{class:"cr-search-content plr10"},{default:d((()=>[1===p(k)?(o(),m(n,{key:0,class:"picker-selector",mode:"selector",onChange:O,value:D.usersIndex,range:D.usersData,"range-key":"name"},{default:d((()=>[c(s,{class:"search-default-label"},{default:d((()=>[_(x(D.usersText)+" ",1),c(t,{class:"iconfont icon-zhankai1"})])),_:1})])),_:1},8,["value","range"])):h("",!0),c(s,{class:"picker-selector"},{default:d((()=>[c(s,{class:"search-default-label",onClick:K},{default:d((()=>[_(x(D.labelText)+" ",1),c(t,{class:"date-open-icon iconfont icon-zhankai1"})])),_:1})])),_:1}),c(n,{class:"picker-selector",mode:"selector",onChange:M,value:D.typeIndex,range:L,"range-key":"name"},{default:d((()=>[c(s,{class:"search-default-label"},{default:d((()=>[_(x(D.typeText)+" ",1),c(t,{class:"iconfont icon-zhankai1"})])),_:1})])),_:1},8,["value","range"]),c(r,{ref_key:"timeRef",ref:z,type:"daterange","clear-icon":!1,border:!1,onChange:S},{default:d((()=>[c(s,{class:"search-default-date"},{default:d((()=>[_(x(D.timeText)+" ",1),C.time?h("",!0):(o(),m(t,{key:0,class:"date-open-icon iconfont icon-zhankai1"}))])),_:1}),C.time?(o(),m(t,{key:0,class:"iconfont date-clear icon-shenpizhongxin-jujue",onClick:f(Q,["stop"])})):h("",!0)])),_:1},512)])),_:1}),c(B,{title:"客户标签",ref_key:"selectedLabelRef",ref:H,onChangeItem:J},null,512)],64)}}},Q=L({__name:"index",setup(e){const s=j(),n=a({typeIndex:0,tabIndex:0,tabId:2,emptyTitle:"当前暂无客户~",customStyle:{border:"none",lineHeight:"20px",background:"#ED4014"},examineTabData:J,listData:[],where:{limit:10,page:1,types:2,scope_frame:"self",customer_status:"",time:"",customer_label:[],salesman_id:""}});I((e=>{e.tab?(n.tabIndex=Number(e.tab),n.tabId=n.examineTabData[n.tabIndex].id,n.where.types=2===n.tabId?0:1,x()):x()}));const i=a([{type:1,icon:"icon-sousuo"},{type:2,icon:"icon-a-gengduo2"}]),l=t(s.state.app.currentIndex),u=e=>{1===e.type?D(`/pages/customer/list/search?index=${n.tabIndex}&type=${n.where.types}`):D(`/pages/customer/list/addCustomer?types=${n.where.types}`)},p=e=>{n.where.page>1&&C(),n.tabId=e.id,n.tabIndex=e.index,n.where.page=1,n.where.types=e.id,2==e.id?n.where.scope_frame="all":2==e.id?n.where.scope_frame="self":(n.where.scope_frame="all",n.where.salesman_id=""),x(!0)},_=e=>{n.where.page=1,n.where.customer_status=e.customer_status,n.where.time=e.time,n.where.customer_label=e.customer_label,n.where.salesman_id=e.salesmanId,x(!0)},x=(e=!1)=>{n.defaultTitle=n.examineTabData[n.tabIndex].name;const a=n.examineTabData[n.tabIndex].id;n.typeIndex=Number(a),f(e)},h=t(!1),f=(e=!1)=>{M(n.where).then((a=>{e&&(n.listData=[]),n.listData.push(...a.data.list);const t=Math.ceil(a.data.count/n.where.limit);n.listData.length<=0||n.where.page>=t?h.value=!1:h.value=!0,T()})).catch((e=>{r.error(e.message)}))};return w((()=>{h.value&&(n.where.page++,f())})),k((()=>{n.where.page=1,n.value=!1,n.listData=[],f()})),(e,a)=>{const t=b;return o(),m(t,{class:"content"},{default:d((()=>[c(t,{class:"cr-position-header"},{default:d((()=>[c(t,{class:"status_bar"}),c(N,{"jump-url":"/pages/workbench/index","is-right":!0,"right-data":i,onHandleNarItem:u},null,8,["right-data"]),c(H,{"examine-tab-data":n.examineTabData,index:n.tabIndex,onChange:p},null,8,["examine-tab-data","index"]),c(O,{onChange:_,status:n.where.types,type:"approve"},null,8,["status"])])),_:1}),c(t,{class:"examine-content m10"},{default:d((()=>[c($,{"list-data":n.listData,"type-index":n.typeIndex,types:n.where.types,"empty-title":n.emptyTitle},null,8,["list-data","type-index","types","empty-title"])])),_:1}),c(K),c(z,{currentIndex:l.value},null,8,["currentIndex"])])),_:1})}}},[["__scopeId","data-v-4c3dc1a4"]]);export{Q as default};