import{b as e,e as s,a9 as a,r as t,c as i,T as n,h as c,w as l,z as o,o as d,i as r,j as u,t as _,k as p,l as m,F as f,aY as g,aG as v,x as h,a0 as y,y as x,a1 as b,A as j,N as k}from"./index-DXvjTqMr.js";import{d as U}from"./index.D3kEQn5y.js";import{a as I}from"./index.CLXfhtlu.js";import{t as N,u as z,v as C}from"./customer.BB8HSfBC.js";import{_ as q}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-nav-bar.BZJJc0Hh.js";import"./uni-icons.Dxt3pfrw.js";/* empty css                                                                  *//* empty css                                                                    *//* empty css                                                              */import"./default-avatar.BAKNUlXW.js";/* empty css                                                              */const w=q({__name:"shift",setup(q){const w=e(),D=s({selectUser:[],listData:[{name:"客户转移",icon:"icon-kehuxiangqing-kehuzhuanyi",id:1},{name:"合同转移",icon:"icon-kehuxiangqing-hetongzhuanyi",id:2},{name:"发票转移",icon:"icon-kehuxiangqing-fapiaozhuanyi1",id:3}],tabIds:[],type:1,eid:-1,cid:-1,iid:-1});a((e=>{D.type=Number(e.type),D.eid=Number(e.eid),D.cid=Number(e.cid),D.iid=Number(e.iid),D.tabIds.push(D.type)}));const G=()=>{g()},S=t(!1),Y=i((()=>w.state.app.depSelectPeople));n(Y,((e,s)=>{D.selectUser=e}),{immediate:!0});const A=()=>{v("isShow=true&mode=selector","pages/customer/list/shift")},B=()=>{if(D.selectUser.length<=0)return h.error("请选择转移的业务员"),!1;if(!S.value)if(1===D.type){const e={contract:D.tabIds.includes(2)?1:0,invoice:D.tabIds.includes(3)?1:0,to_uid:D.selectUser[0].id};F(D.eid,e)}else if(2===D.type){const e={invoice:D.tabIds.includes(3)?1:0,to_uid:D.selectUser[0].id};K(D.cid,e)}else if(3===D.type){const e={ids:[D.iid],to_uid:D.selectUser[0].id};M(e)}},F=(e,s)=>{S.value=!0,N(e,s).then((e=>{h.success(e.message),S.value=!0,y("/pages/customer/list/index"),g()})).catch((e=>{S.value=!1,h.error(e.message)}))},K=(e,s)=>{S.value=!0,z(e,s).then((e=>{h.success(e.message),S.value=!0,y("/pages/customer/contract/index"),g()})).catch((e=>{S.value=!1,h.error(e.message)}))},M=e=>{S.value=!0,C(e).then((e=>{h.success(e.message),S.value=!0,y("/pages/customer/invoice/index"),g()})).catch((e=>{S.value=!1,h.error(e.message)}))};return(e,s)=>{const a=o,t=x,i=b;return d(),c(a,{class:"content"},{default:l((()=>[r(a,{class:"cr-position-header"},{default:l((()=>[r(a,{class:"status_bar"}),r(U,{"is-right":!0,onGoBackChange:G})])),_:1}),r(a,{class:"examine-content"},{default:l((()=>[r(a,{class:"add",onClick:A},{default:l((()=>[r(a,{class:"box"},{default:l((()=>[D.selectUser.length>0?(d(),c(I,{key:0,src:D.selectUser[0].avatar,radius:8},null,8,["src"])):(d(),c(t,{key:1,class:"iconfont icon-xuanfuanniu-jia"}))])),_:1}),r(t,{class:"member"},{default:l((()=>[u(_(D.selectUser.length>0?D.selectUser[0].name:"选择成员"),1)])),_:1})])),_:1}),r(a,{class:"content-list"},{default:l((()=>[(d(!0),p(f,null,m(D.listData,((e,s)=>(d(),p(f,{key:e.id},[e.id>=D.type?(d(),c(a,{key:0,class:j(["list-item",D.tabIds.includes(e.id)?"active":""]),onClick:s=>(e=>{if(D.selectUser.length<=0)return h.error("请选择转移的业务员"),!1;if(e<=D.type)return!1;const s=D.tabIds.indexOf(e);s>-1?D.tabIds.splice(s,1):D.tabIds.push(e)})(e.id)},{default:l((()=>[r(a,{class:j(["iconfont icon-center",e.icon])},null,8,["class"]),r(a,{class:"text"},{default:l((()=>[u(_(e.name),1)])),_:2},1024),r(a,{class:"iconfont icon-xuanzhong1"})])),_:2},1032,["class","onClick"])):k("",!0)],64)))),128))])),_:1})])),_:1}),r(a,{class:"examine-button"},{default:l((()=>[r(i,{class:"button",loading:S.value,type:"primary",onClick:B},{default:l((()=>[u("提交")])),_:1},8,["loading"])])),_:1})])),_:1})}}},[["__scopeId","data-v-1e548de7"]]);export{w as default};
