import{d as z,r as l,A as M,t as E,f as O,k as V,u as W,g as G,j as s,ar as H,D as U,S as X,I as q,B as F,a as r,v as J}from"./index-BtzNP73w.js";import{M as K,W as Q}from"./ConsultantsWuman-xRHtPEIs.js";const Z=z.div`
  width: 100%;
  height: 100%;
  overflow: auto;
  .topPointBar {
    height: 40px;
    margin-bottom: 70px;
    display: flex;
    background-color: ${a=>a.theme.colorBgContainer};
    .leftBack {
      width: 40px;
      height: 40px;
      font-size: 20px;
      font-weight: 600;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .centerTitle {
      flex: 1;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 18px;
      font-weight: 600;
    }
  }
  .counsellorInfo {
    border-radius: 10px;
    position: relative;
    .imgbg {
      width: 80px;
      height: 80px;
      position: absolute;
      border-radius: 50px;
      background-color: ${a=>a.theme.colorBgContainer};
      overflow: hidden;
      top: -50px;
      left: 50%;
      transform: translateX(-50%);
      .img {
        width: 100%;
        height: 100%;
      }
    }
    background-color: ${a=>a.theme.colorBgContainer};
    .counsellorNameAndGoodAt {
      border-radius: 10px;
      padding-top: 36px;
      .name {
        height: 24px;
        line-height: 30px;
        font-size: 18px;
        text-align: center;
      }
      .good_at{
        padding: 15px;
        text-indent: 2em;
        line-height: 24px;
        font-size: 12px;
        p {
          transition: all 0.5s;
        }
        .p {
          word-break: break-all;
          display: -webkit-box;
          -webkit-line-clamp: 2; /* 控制显示的行数 */
          -webkit-box-orient: vertical;
          overflow: hidden;
          text-overflow: ellipsis;
        }
        
        .expand {
          padding-bottom: 30px;
          overflow: hidden;
        }
        .expandBtn {
          display: flex;
          justify-content: right;
        }
      }
    }

    /* 可预约样式 */
    .condition {
      padding: 15px;
      .reservationsAvailable {
        height: 50px;
        font-size: 14px;
        display: flex;
        align-items: center;
        border-bottom: 1px dashed ${a=>a.theme.colorBorder};
        .leftTitle {
          width: 60px;
        }

        .rightValue {
          flex: 1;
          display: flex;
          justify-content: right;
        }
      }

      .appointmentDate {
        height: 50px;
        font-size: 14px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed ${a=>a.theme.colorBorder};
       
        .dateTitle {
           width: 60px;
        }
        .picker {
           width: 180px;
        }
      }
      .timePeriod {
        height: 50px;
        font-size: 14px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed ${a=>a.theme.colorBorder};
       
        .timeTitle {
           width: 80px;
        }
        .select {
           width: 180px;
        }
      }
      .remark {
        min-height: 50px;
        font-size: 14px;
        padding: 10px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed ${a=>a.theme.colorBorder};
       
        .timeTitle {
          width: 80px;
          }
        .textarea {
          
        }
      }
    }
  }

  /* 提交按钮 */
  .submit {
    height: 50px;
    padding-top: 25px;
    text-align: center;
    .btn {
      width: 100%;
      height: 36px;
      border-radius: 18px;
    }
  }
`,x=[{id:1,title:"周一",checked:!1,timeRangeList:[]},{id:2,title:"周二",checked:!1,timeRangeList:[]},{id:3,title:"周三",checked:!1,timeRangeList:[]},{id:4,title:"周四",checked:!1,timeRangeList:[]},{id:5,title:"周五",checked:!1,timeRangeList:[]},{id:6,title:"周六",checked:!1,timeRangeList:[]},{id:7,title:"周日",checked:!1,timeRangeList:[]}],{TextArea:ee}=q,te=l.memo(()=>{const{message:a}=M.useApp(),{token:y}=E.useToken(),{userInfo:w}=O(t=>t),N=V(),g=W(),[c,_]=l.useState(null),[m,f]=l.useState(null),[R,L]=l.useState([]),[u,b]=l.useState([]),[j,B]=l.useState(""),[p,A]=l.useState(!1),[D,h]=l.useState(!1),[k,v]=l.useState(x),d=N.state;l.useEffect(()=>{d&&G("/api/PsyCounse/All",{c_id:d.id,pageIndex:1,pageSize:999}).then(t=>{if(t.code===200&&t.data.items[0]){const e=t.data.items[0];let i=e.opentime.split(",");i[0]===""&&(i=[]),b(i);const n=x.map(o=>i.includes(String(o.id))?(o.checked=!0,o):(o.checked=!1,o));n[0].timeRangeList=e.time_mon?e.time_mon.split("|"):[],n[1].timeRangeList=e.time_tue?e.time_tue.split("|"):[],n[2].timeRangeList=e.time_wed?e.time_wed.split("|"):[],n[3].timeRangeList=e.time_thu?e.time_thu.split("|"):[],n[4].timeRangeList=e.time_fri?e.time_fri.split("|"):[],n[5].timeRangeList=e.time_sat?e.time_sat.split("|"):[],n[6].timeRangeList=e.time_sun?e.time_sun.split("|"):[],v(n)}else{let e=[];b(e);const i=x.map(n=>e.includes(String(n.id))?(n.checked=!0,n):(n.checked=!1,n));i[0].timeRangeList=[],i[1].timeRangeList=[],i[2].timeRangeList=[],i[3].timeRangeList=[],i[4].timeRangeList=[],i[5].timeRangeList=[],i[6].timeRangeList=[],v(i)}})},[d]);const S=t=>{let e=parseInt(r(t).format("d"));e===0&&(e=7),k.filter(i=>i.checked).forEach(i=>{if(i.id===e){const n=i.timeRangeList.map(o=>({label:o,value:o,disabled:P(t,o)}));L(n)}}),f(null),_(t)},T=t=>{console.log(`selected ${t}`),f(t)},C=t=>t&&t<r().startOf("day"),I=t=>{let e=parseInt(r(t).format("d"));return e===0&&(e=7),t?!u.includes(String(e)):!1},P=(t,e)=>{if(!e)return;const i=r(),[n]=e.split("-");return r(`${t.format("YYYY-MM-DD")} ${n}`,"YYYY-MM-DD HH:mm").isBefore(i)},Y=t=>{B(t.target.value)},$=()=>{if(!c){a.warning("请选择预约日期"),console.log(c);return}if(!m){a.warning("请选择时间段"),console.log(c);return}const t=[{person_id:w.id,c_id:d.id,order_date:r(c).format("YYYY-MM-DD"),order_time:m,status:1,remark:j}];h(!0),J("/api/PsyCounse/AddOrUpdate_order",t).then(e=>{e.code===200?(a.success(e.msg),h(!1),g("/layout/psy_counsel_manage")):(a.error(e.msg),h(!1))})};return s.jsxs(Z,{theme:y,children:[s.jsxs("div",{className:"topPointBar",children:[s.jsx("div",{className:"leftBack",onClick:()=>g("/layout/psy_counsel_manage"),children:s.jsx(H,{})}),s.jsx("div",{className:"centerTitle",children:"添加预约"}),s.jsx("div",{className:"leftBack"})]}),s.jsxs("div",{className:"counsellorInfo",children:[s.jsx("div",{className:"imgbg",children:d.sex===1?s.jsx("img",{className:"img",src:K,alt:""}):s.jsx("img",{className:"img",src:Q,alt:""})}),s.jsxs("div",{className:"counsellorNameAndGoodAt",children:[s.jsx("div",{className:"name",children:d.name}),s.jsxs("div",{className:"good_at",children:[s.jsxs("p",{className:`${p?"expand":"p"}`,children:["治疗技术: ",d.good_at.split("|").join(", "),"。"]}),s.jsx("div",{className:"expandBtn",onClick:()=>A(!p),children:p?"收起":"展开..."})]})]}),s.jsxs("div",{className:"condition",children:[s.jsxs("div",{className:"reservationsAvailable",children:[s.jsx("span",{className:"leftTitle",children:"可预约"}),s.jsx("span",{className:"rightValue",children:k.filter(t=>t.checked).map(t=>t.title+", ")})]}),s.jsxs("div",{className:"appointmentDate",children:[s.jsx("span",{className:"dateTitle",children:"预约日期"}),s.jsx(U,{className:"picker",placeholder:"请选择预约日期",inputReadOnly:!0,value:c,disabledDate:t=>C(t)||I(t),onChange:S})]}),s.jsxs("div",{className:"timePeriod",children:[s.jsx("span",{className:"timeTitle",children:"预约时间段"}),s.jsx(X,{className:"select",value:m,placeholder:"请选择时间段",onChange:T,options:R})]}),s.jsxs("div",{className:"remark",children:[s.jsx("span",{className:"timeTitle",children:"留言"}),s.jsx(ee,{className:"ysh_antd_input textarea",rows:3,value:j,onChange:Y})]})]})]}),s.jsx("div",{className:"submit",children:s.jsx(F,{className:"btn",type:"primary",disabled:u.length===0||D,onClick:$,children:"立即预约"})})]})});te.displayName="AddAppointmentPhone";export{te as default};
