1 line
9.6 KiB
JavaScript
1 line
9.6 KiB
JavaScript
import{D as e,E as t,Et as n,G as ee,J as r,Kt as te,M as i,N as a,O as o,P as s,T as c,Xt as l,Yt as u,Z as d,b as f,g as ne,j as re,t as p,vt as m,w as h}from"./_plugin-vue_export-helper-Bo3WtfwJ.js";import{l as ie,t as g}from"./BasicIcon-BXxbbWA_.js";import{o as _,r as ae}from"./format-C72AoJ2H.js";import{O as oe,S as se,c as ce,d as le,o as ue,r as v,s as y,u as b}from"./index-COC09WBR.js";import{r as x,t as S}from"./constants-DXXK14Zz.js";import{t as C}from"./PageSkeleton-DHtB6RUa.js";import{n as w,t as T}from"./crm-Cbr1tRzB.js";var E={class:`page profile-page`},D={class:`page__scroll page__scroll--with-nav profile-scroll`},O={class:`hero`},k={class:`hero__pin`},A={class:`hero__top mobile-only`},j=[`aria-label`],M={class:`hero__meta`},N={key:0},P={key:1,class:`level-pill`},F={class:`hero__desk-actions desktop-only-flex`},I={class:`profile-sheet`},L={key:0,class:`panel`},R={class:`panel__head`},z={class:`panel__period`},B={class:`stats`},V={class:`stat-card`},H={class:`stat-card__text`},U={class:`stat-card__value`},de={class:`stat-card__icon stat-card__icon--orders`},fe={class:`stat-card`},pe={class:`stat-card__text`},me={class:`stat-card__value`},he={class:`stat-card__icon stat-card__icon--customers`},ge={class:`stat-card`},_e={class:`stat-card__text`},ve={class:`stat-card__value`},ye={class:`stat-card__icon stat-card__icon--profit`},be={class:`stat-card`},xe={class:`stat-card__text`},Se={class:`stat-card__value`},Ce={class:`stat-card__icon stat-card__icon--sales`},we={key:1,class:`loyalty`},Te={class:`loyalty__row`},Ee={class:`loyalty__text`},De={class:`loyalty__text-next`},Oe={class:`loyalty__bar`},ke={class:`quick-section`},Ae={class:`quick-grid`},je=[`onClick`],Me={class:`quick-item__icon`},Ne={class:`orders-box`},Pe={class:`section-head`},Fe=[`onClick`,`onKeydown`],Ie={class:`order-row__meta`},Le={class:`order-row__date`},Re={class:`order-row__title`},ze={key:0,class:`order-row__customer`},Be={class:`price-section`},Ve={class:`price-card`},He={class:`price-card__body`},Ue={class:`price-card__info`},W=p(s({__name:`MobileProfilePage`,setup(s){let p={id:`sample-base-price`,name:`پارچه فاستونی ایتالیایی`,code:`DF-1204`,categoryId:``,season:`all_season`,widthCm:160,composition:``,colors:[`1`,`2`,`3`,`4`,`5`,`6`],tags:[],isNew:!1,rollMeters:0,basePrice:38e4},W=ne(),G=ce(),K=le(),We=T(),q=b(),J=m(null),Y=m(p),X=m(!1),Ge=[{label:`ثبت مشتری جدید`,to:`/customers`,icon:`vuesax-linear:add`},{label:`سفارشها`,to:`/orders`,icon:`vuesax-linear:document-text`},{label:`مشتریان من`,to:`/customers`,icon:`vuesax-linear:people`},{label:`گزارشها`,to:`/reminders`,icon:`vuesax-linear:chart-2`},{label:`درخواست کالیته`,to:`/categories`,icon:`vuesax-linear:category`},{label:`قیمتگذاری`,to:`/categories`,icon:`vuesax-linear:money-4`}],Ke=[{label:`سفارشها`,to:`/orders`,icon:`vuesax-linear:document-text`},{label:`دستهبندی`,to:`/categories`,icon:`vuesax-linear:category-2`},{label:`درخواست کالیته`,to:`/categories`,icon:`vuesax-linear:category`},{label:`علاقهمندیها`,to:`/favorites`,icon:`vuesax-linear:heart`}],qe=h(()=>G.isAgent?Ge:Ke),Je=h(()=>[...K.orders].sort((e,t)=>String(t.createdAt).localeCompare(String(e.createdAt))).slice(0,3).map(e=>{let t=x[e.status]??`info`,n=t===`danger`||t===`neutral`?`danger`:t===`success`?`success`:t===`warning`?`warning`:`info`;return{id:e.id,title:`سفارش #${e.orderNumber}`,date:e.createdAt?ae(e.createdAt):``,customer:e.companyName||``,statusLabel:S[e.status]||e.status,statusTone:n}})),Z=h(()=>G.fullName||`کاربر`),Ye=h(()=>J.value?.code||G.user?.agentCode||`—`),Q=h(()=>G.isAgent?`کد واسطه`:`کد مشتری`),$=h(()=>J.value?.levelLabel||G.user?.levelLabel||`برنزی`),Xe=h(()=>J.value?.nextLevelLabel||G.user?.nextLevelLabel||`نقرهای`),Ze=h(()=>J.value?.pointsToNext??G.user?.pointsToNext??0),Qe=h(()=>J.value?.periodLabel||`۳۰ روز اخیر`),$e=h(()=>J.value?.customersCount??0),et=h(()=>J.value?.ordersCount??K.orders.length),tt=h(()=>J.value?.salesVolumeToman??0),nt=h(()=>J.value?.profitToman??0),rt=h(()=>J.value?.levelProgress??G.user?.levelProgress??0),it=h(()=>q.unreadCount>9?`9+`:String(q.unreadCount)),at=h(()=>Y.value.basePrice??p.basePrice??0);return ee(async()=>{X.value=!0;try{if(q.hydrate(),G.isAgent)try{J.value=await w()}catch{J.value=null}try{let e=(await We.loadBrowseProducts())[0];Y.value=e?{...p,...e,basePrice:e.basePrice??p.basePrice}:p}catch{Y.value=p}K.orders.length||await K.hydrate()}finally{X.value=!1}}),(ee,s)=>(r(),o(`div`,E,[c(`div`,D,[c(`header`,O,[c(`div`,k,[c(`div`,A,[c(`button`,{type:`button`,class:`icon-btn`,"aria-label":`تنظیمات`,onClick:s[0]||=e=>n(W).push(`/profile/display`)},[a(se,{size:20,color:`#ffffff`})]),s[5]||=c(`h1`,null,`پروفایل من`,-1),c(`button`,{type:`button`,class:`icon-btn`,"aria-label":`اعلانها`,onClick:s[1]||=e=>n(W).push(`/profile/notifications`)},[a(y,{size:20,color:`#ffffff`}),n(q).hasUnread?(r(),o(`span`,{key:0,class:`icon-btn__badge`,"aria-label":`${n(q).unreadCount} اعلان خواندهنشده`},l(it.value),9,j)):e(``,!0)])]),a(v,{class:`hero__avatar`,src:n(G).user?.avatarUrl,initials:Z.value.charAt(0),size:84},null,8,[`src`,`initials`])]),c(`div`,M,[c(`h2`,null,l(Z.value),1),n(G).isAgent?(r(),o(`p`,N,l(Q.value)+`: `+l(Ye.value),1)):e(``,!0),n(G).isAgent?(r(),o(`span`,P,[s[6]||=c(`svg`,{class:`level-pill__crown`,viewBox:`0 0 24 24`,"aria-hidden":`true`},[c(`path`,{fill:`currentColor`,d:`M3.5 17.5h17l-1.2-8.2a1 1 0 0 0-1.5-.7L14 11l-2.5-5.2a1 1 0 0 0-1.8 0L7.2 11 4.2 8.6a1 1 0 0 0-1.5.7L3.5 17.5Zm1.7 1.5h13.6v1.2H5.2V19Z`})],-1),i(` سطح: `+l($.value),1)])):e(``,!0)]),c(`div`,F,[c(`button`,{type:`button`,class:`hero__desk-btn`,onClick:s[2]||=e=>n(W).push(`/profile/edit`)},` ویرایش اطلاعات `)])]),c(`div`,I,[X.value?(r(),t(C,{key:0,variant:`profile`})):(r(),o(f,{key:1},[n(G).isAgent?(r(),o(`section`,L,[c(`div`,R,[s[7]||=c(`h3`,null,`خلاصه عملکرد`,-1),c(`span`,z,[i(l(Qe.value)+` `,1),a(g,{icon:`vuesax-linear:arrow-down`,size:14,"stroke-width":1.5})])]),c(`div`,B,[c(`div`,V,[c(`div`,H,[s[8]||=c(`span`,{class:`stat-card__label`},`سفارشها`,-1),c(`strong`,U,l(n(_)(et.value)),1),s[9]||=c(`em`,{class:`stat-card__hint`},`سفارش`,-1)]),c(`span`,de,[a(oe,{size:18})])]),c(`div`,fe,[c(`div`,pe,[s[10]||=c(`span`,{class:`stat-card__label`},`مشتریان من`,-1),c(`strong`,me,l(n(_)($e.value)),1),s[11]||=c(`em`,{class:`stat-card__hint`},`مشتری فعال`,-1)]),c(`span`,he,[a(g,{icon:`vuesax-linear:people`,size:18,"stroke-width":1.5})])]),c(`div`,ge,[c(`div`,_e,[s[12]||=c(`span`,{class:`stat-card__label`},`سود شما (ریال)`,-1),c(`strong`,ve,l(n(_)(nt.value)),1),s[13]||=c(`em`,{class:`stat-card__hint`},`تومان`,-1)]),c(`span`,ye,[a(g,{icon:`vuesax-linear:chart-2`,size:18,"stroke-width":1.5})])]),c(`div`,be,[c(`div`,xe,[s[14]||=c(`span`,{class:`stat-card__label`},`حجم فروش (ریال)`,-1),c(`strong`,Se,l(n(_)(tt.value)),1),s[15]||=c(`em`,{class:`stat-card__hint`},`تومان`,-1)]),c(`span`,Ce,[a(g,{icon:`vuesax-linear:wallet`,size:18,"stroke-width":1.5})])])])])):e(``,!0),n(G).isAgent?(r(),o(`section`,we,[c(`div`,Te,[s[16]||=re(`<div class="loyalty__crown" aria-hidden="true" data-v-ae8a86d0><svg viewBox="0 0 48 48" width="40" height="40" data-v-ae8a86d0><path fill="#E0C35A" d="M8 34h32l-2.4-16.2a2 2 0 0 0-3-.1L28 24l-4.8-10a2 2 0 0 0-3.6 0L14.8 24 9.4 17.7a2 2 0 0 0-3.1.1L8 34Z" data-v-ae8a86d0></path><path fill="#C9A227" d="M10 36h28v3H10z" data-v-ae8a86d0></path><circle cx="24" cy="28" r="3" fill="#F7E7A1" data-v-ae8a86d0></circle></svg></div>`,1),c(`p`,Ee,[c(`span`,null,`شما در سطح `+l($.value)+` قرار دارید.`,1),c(`span`,De,` تا سطح `+l(Xe.value)+` فقط `+l(n(_)(Ze.value))+` تومان فروش دیگر نیاز دارید. `,1)])]),c(`div`,Oe,[c(`span`,{style:u({width:`${Math.min(100,Math.max(0,rt.value))}%`})},null,4)])])):e(``,!0),c(`section`,ke,[s[17]||=c(`h3`,{class:`section-title`},`دسترسی سریع`,-1),c(`div`,Ae,[(r(!0),o(f,null,d(qe.value,e=>(r(),o(`button`,{key:e.label,type:`button`,class:`quick-item`,onClick:t=>n(W).push(e.to)},[c(`span`,Me,[a(g,{icon:e.icon,size:22,"stroke-width":1.5},null,8,[`icon`])]),i(` `+l(e.label),1)],8,je))),128))])]),c(`section`,Ne,[c(`div`,Pe,[s[18]||=c(`h3`,null,`آخرین سفارشها`,-1),c(`button`,{type:`button`,class:`link`,onClick:s[3]||=e=>n(W).push(`/orders`)},`مشاهده همه`)]),(r(!0),o(f,null,d(Je.value,t=>(r(),o(`article`,{key:t.id,class:`order-row`,role:`button`,tabindex:`0`,onClick:e=>n(W).push({path:`/order`,query:{id:t.id}}),onKeydown:ie(e=>n(W).push({path:`/order`,query:{id:t.id}}),[`enter`])},[c(`div`,Ie,[c(`span`,Le,l(t.date),1),c(`strong`,Re,l(t.title),1),t.customer?(r(),o(`p`,ze,`مشتری: `+l(t.customer),1)):e(``,!0)]),c(`span`,{class:te([`tone`,`tone--${t.statusTone}`])},l(t.statusLabel),3),a(ue,{size:16,class:`order-row__chevron`})],40,Fe))),128)),c(`button`,{type:`button`,class:`orders-all`,onClick:s[4]||=e=>n(W).push(`/orders`)},` مشاهده همه سفارشها `)]),c(`section`,Be,[s[19]||=c(`h3`,{class:`section-title`},`قیمتهای پایه (نمونه)`,-1),c(`div`,Ve,[c(`div`,He,[c(`div`,Ue,[c(`strong`,null,l(Y.value.name),1),c(`p`,null,`کد: `+l(Y.value.code),1),c(`p`,null,`عرض: `+l(n(_)(Y.value.widthCm))+` سانتیمتر`,1),c(`p`,null,`رنگها: `+l(n(_)(Y.value.colors.length))+` رنگ`,1)]),c(`div`,{class:`price-card__image`,style:u(Y.value.imageUrl?{backgroundImage:`url(${Y.value.imageUrl})`}:void 0)},null,4)]),c(`footer`,null,`قیمت پایه به شما: `+l(n(_)(at.value))+` تومان / متر`,1)])])],64))])])]))}}),[[`__scopeId`,`data-v-ae8a86d0`]]),G=s({__name:`ProfileView`,setup(e){return(e,n)=>(r(),t(W))}});export{G as default}; |