1 line
9.5 KiB
JavaScript
1 line
9.5 KiB
JavaScript
import{A as e,Ct as t,E as n,Et as r,I as ee,L as i,M as a,N as o,O as s,P as c,R as l,St as u,Tt as d,Y as f,Z as p,_ as m,j as h,mt as g,n as te,q as ne,t as _,z as v}from"./BasicIcon-C6boaehV.js";import{o as y,r as re}from"./format-BHJptHdF.js";import{C as ie,c as ae,d as oe,o as se,r as ce,s as le,u as ue}from"./index-spodxsRN.js";import{r as b,t as x}from"./constants-DXXK14Zz.js";import{t as S}from"./PageSkeleton-uO-jhbNm.js";import{n as C,t as w}from"./crm-CtglbPsN.js";var T=v({__name:`IconSettings`,props:{size:{default:24},strokeWidth:{default:1.5},color:{default:null}},setup(e){return(t,n)=>(f(),a(_,{icon:`vuesax-linear:setting-2`,size:e.size,"stroke-width":e.strokeWidth,color:e.color},null,8,[`size`,`stroke-width`,`color`]))}}),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={class:`level-pill`},P={class:`hero__desk-actions desktop-only-flex`},F={class:`profile-sheet`},I={class:`panel`},L={class:`panel__head`},R={class:`panel__period`},z={class:`stats`},B={class:`stat-card`},V={class:`stat-card__text`},H={class:`stat-card__value`},U={class:`stat-card__icon stat-card__icon--orders`},de={class:`stat-card`},fe={class:`stat-card__text`},pe={class:`stat-card__value`},me={class:`stat-card__icon stat-card__icon--customers`},he={class:`stat-card`},ge={class:`stat-card__text`},_e={class:`stat-card__value`},ve={class:`stat-card__icon stat-card__icon--profit`},ye={class:`stat-card`},be={class:`stat-card__text`},xe={class:`stat-card__value`},Se={class:`stat-card__icon stat-card__icon--sales`},Ce={class:`loyalty`},W={class:`loyalty__row`},we={class:`loyalty__text`},Te={class:`loyalty__bar`},Ee={class:`quick-section`},De={class:`quick-grid`},Oe=[`onClick`],ke={class:`quick-item__icon`},Ae={class:`orders-box`},je={class:`section-head`},Me=[`onClick`,`onKeydown`],Ne={class:`order-row__meta`},Pe={class:`order-row__date`},Fe={class:`order-row__title`},Ie={key:0,class:`order-row__customer`},Le={class:`price-section`},Re={class:`price-card`},ze={class:`price-card__body`},Be={class:`price-card__info`},G=te(v({__name:`MobileProfilePage`,setup(te){let v={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},G=m(),K=ae(),q=oe(),Ve=w(),J=ue(),Y=g(null),X=g(v),Z=g(!1),He=[{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:`/catalog-request`,icon:`vuesax-linear:category`},{label:`قیمتگذاری`,to:`/categories`,icon:`vuesax-linear:money-4`}],Ue=e(()=>[...q.orders].sort((e,t)=>String(t.createdAt).localeCompare(String(e.createdAt))).slice(0,3).map(e=>{let t=b[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?re(e.createdAt):``,customer:e.companyName||``,statusLabel:x[e.status]||e.status,statusTone:n}})),Q=e(()=>K.fullName||`کاربر`),We=e(()=>Y.value?.code||K.user?.agentCode||`—`),$=e(()=>Y.value?.levelLabel||K.user?.levelLabel||`برنزی`),Ge=e(()=>Y.value?.nextLevelLabel||K.user?.nextLevelLabel||`نقرهای`),Ke=e(()=>Y.value?.pointsToNext??K.user?.pointsToNext??0),qe=e(()=>Y.value?.periodLabel||`۳۰ روز اخیر`),Je=e(()=>Y.value?.customersCount??0),Ye=e(()=>Y.value?.ordersCount??q.orders.length),Xe=e(()=>Y.value?.salesVolumeToman??0),Ze=e(()=>Y.value?.profitToman??0),Qe=e(()=>Y.value?.levelProgress??K.user?.levelProgress??72),$e=e(()=>J.unreadCount>9?`9+`:String(J.unreadCount)),et=e(()=>X.value.basePrice??v.basePrice??0);return ne(async()=>{Z.value=!0;try{J.hydrate();try{Y.value=await C()}catch{Y.value=null}try{let e=(await Ve.loadBrowseProducts())[0];X.value=e?{...v,...e,basePrice:e.basePrice??v.basePrice}:v}catch{X.value=v}q.orders.length||await q.hydrate()}finally{Z.value=!1}}),(e,m)=>(f(),c(`div`,E,[h(`div`,D,[h(`header`,O,[h(`div`,k,[h(`div`,A,[h(`button`,{type:`button`,class:`icon-btn`,"aria-label":`تنظیمات`,onClick:m[0]||=e=>u(G).push(`/profile/display`)},[l(T,{size:20,color:`#ffffff`})]),m[7]||=h(`h1`,null,`پروفایل من`,-1),h(`button`,{type:`button`,class:`icon-btn`,"aria-label":`اعلانها`,onClick:m[1]||=e=>u(G).push(`/profile/notifications`)},[l(le,{size:20,color:`#ffffff`}),u(J).hasUnread?(f(),c(`span`,{key:0,class:`icon-btn__badge`,"aria-label":`${u(J).unreadCount} اعلان خواندهنشده`},r($e.value),9,j)):o(``,!0)])]),l(ce,{class:`hero__avatar`,src:u(K).user?.avatarUrl,initials:Q.value.charAt(0),size:84},null,8,[`src`,`initials`])]),h(`div`,M,[h(`h2`,null,r(Q.value),1),h(`p`,null,`کد واسطه: `+r(We.value),1),h(`span`,N,[m[8]||=h(`svg`,{class:`level-pill__crown`,viewBox:`0 0 24 24`,"aria-hidden":`true`},[h(`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(` سطح: `+r($.value),1)])]),h(`div`,P,[h(`button`,{type:`button`,class:`hero__desk-btn`,onClick:m[2]||=e=>u(G).push(`/profile/edit`)},` ویرایش اطلاعات `),h(`button`,{type:`button`,class:`hero__desk-btn`,onClick:m[3]||=e=>u(G).push(`/profile/checks`)},` لیست چکها `),h(`button`,{type:`button`,class:`hero__desk-btn`,onClick:m[4]||=e=>u(G).push(`/profile/display`)},` تنظیمات `)])]),h(`div`,F,[Z.value?(f(),a(S,{key:0,variant:`profile`})):(f(),c(s,{key:1},[h(`section`,I,[h(`div`,L,[m[9]||=h(`h3`,null,`خلاصه عملکرد`,-1),h(`span`,R,[i(r(qe.value)+` `,1),l(_,{icon:`vuesax-linear:arrow-down`,size:14,"stroke-width":1.5})])]),h(`div`,z,[h(`div`,B,[h(`div`,V,[m[10]||=h(`span`,{class:`stat-card__label`},`سفارشها`,-1),h(`strong`,H,r(u(y)(Ye.value)),1),m[11]||=h(`em`,{class:`stat-card__hint`},`سفارش`,-1)]),h(`span`,U,[l(ie,{size:18})])]),h(`div`,de,[h(`div`,fe,[m[12]||=h(`span`,{class:`stat-card__label`},`مشتریان من`,-1),h(`strong`,pe,r(u(y)(Je.value)),1),m[13]||=h(`em`,{class:`stat-card__hint`},`مشتری فعال`,-1)]),h(`span`,me,[l(_,{icon:`vuesax-linear:people`,size:18,"stroke-width":1.5})])]),h(`div`,he,[h(`div`,ge,[m[14]||=h(`span`,{class:`stat-card__label`},`سود شما (ریال)`,-1),h(`strong`,_e,r(u(y)(Ze.value)),1),m[15]||=h(`em`,{class:`stat-card__hint`},`تومان`,-1)]),h(`span`,ve,[l(_,{icon:`vuesax-linear:chart-2`,size:18,"stroke-width":1.5})])]),h(`div`,ye,[h(`div`,be,[m[16]||=h(`span`,{class:`stat-card__label`},`حجم فروش (ریال)`,-1),h(`strong`,xe,r(u(y)(Xe.value)),1),m[17]||=h(`em`,{class:`stat-card__hint`},`تومان`,-1)]),h(`span`,Se,[l(_,{icon:`vuesax-linear:wallet`,size:18,"stroke-width":1.5})])])])]),h(`section`,Ce,[h(`div`,W,[m[18]||=ee(`<div class="loyalty__crown" aria-hidden="true" data-v-7cfe559f><svg viewBox="0 0 48 48" width="40" height="40" data-v-7cfe559f><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-7cfe559f></path><path fill="#C9A227" d="M10 36h28v3H10z" data-v-7cfe559f></path><circle cx="24" cy="28" r="3" fill="#F7E7A1" data-v-7cfe559f></circle></svg></div>`,1),h(`p`,we,` شما در سطح `+r($.value)+` قرار دارید. تا سطح `+r(Ge.value)+` فقط `+r(u(y)(Ke.value))+` تومان فروش دیگر نیاز دارید. `,1)]),h(`div`,Te,[h(`span`,{style:d({width:`${Math.min(100,Math.max(0,Qe.value))}%`})},null,4)])]),h(`section`,Ee,[m[19]||=h(`h3`,{class:`section-title`},`دسترسی سریع`,-1),h(`div`,De,[(f(),c(s,null,p(He,e=>h(`button`,{key:e.label,type:`button`,class:`quick-item`,onClick:t=>u(G).push(e.to)},[h(`span`,ke,[l(_,{icon:e.icon,size:22,"stroke-width":1.5},null,8,[`icon`])]),i(` `+r(e.label),1)],8,Oe)),64))])]),h(`section`,Ae,[h(`div`,je,[m[20]||=h(`h3`,null,`آخرین سفارشها`,-1),h(`button`,{type:`button`,class:`link`,onClick:m[5]||=e=>u(G).push(`/orders`)},`مشاهده همه`)]),(f(!0),c(s,null,p(Ue.value,e=>(f(),c(`article`,{key:e.id,class:`order-row`,role:`button`,tabindex:`0`,onClick:t=>u(G).push({path:`/order`,query:{id:e.id}}),onKeydown:n(t=>u(G).push({path:`/order`,query:{id:e.id}}),[`enter`])},[h(`div`,Ne,[h(`span`,Pe,r(e.date),1),h(`strong`,Fe,r(e.title),1),e.customer?(f(),c(`p`,Ie,`مشتری: `+r(e.customer),1)):o(``,!0)]),h(`span`,{class:t([`tone`,`tone--${e.statusTone}`])},r(e.statusLabel),3),l(se,{size:16,class:`order-row__chevron`})],40,Me))),128)),h(`button`,{type:`button`,class:`orders-all`,onClick:m[6]||=e=>u(G).push(`/orders`)},` مشاهده همه سفارشها `)]),h(`section`,Le,[m[21]||=h(`h3`,{class:`section-title`},`قیمتهای پایه (نمونه)`,-1),h(`div`,Re,[h(`div`,ze,[h(`div`,Be,[h(`strong`,null,r(X.value.name),1),h(`p`,null,`کد: `+r(X.value.code),1),h(`p`,null,`عرض: `+r(u(y)(X.value.widthCm))+` سانتیمتر`,1),h(`p`,null,`رنگها: `+r(u(y)(X.value.colors.length))+` رنگ`,1)]),h(`div`,{class:`price-card__image`,style:d(X.value.imageUrl?{backgroundImage:`url(${X.value.imageUrl})`}:void 0)},null,4)]),h(`footer`,null,`قیمت پایه به شما: `+r(u(y)(et.value))+` تومان / متر`,1)])])],64))])])]))}}),[[`__scopeId`,`data-v-7cfe559f`]]),K=v({__name:`ProfileView`,setup(e){return(e,t)=>(f(),a(G))}});export{K as default}; |