2 lines
9.2 KiB
JavaScript
2 lines
9.2 KiB
JavaScript
import{u as A,d as z,b as v,c as m,w as o,r as R,o as u,h as Z,f as y,t as S,H as ee,i as C,p as E,a as O,F as $,m as f,s as te,G as d,y as g,_ as ae}from"./index-eLNLLYwC.js";import{a as re,b as c,X as ie}from"./model-btNVLLyF.js";import{_ as q}from"./TooltipBtn.vue_vue_type_script_setup_true_lang-CHnLAped.js";import{O as se,a as oe}from"./OrderStatusTimeline-Dm95hywe.js";import"./filters-BMytoA2k.js";import"./index-CKaD48iT.js";import"./SettingOutlined-DibNCEeh.js";import"./icons-DaMkWfMK.js";import"./UnorderedListOutlined-cPIiOEaQ.js";import"./PercentageOutlined-DyprS4lh.js";import"./UserAddOutlined-GWNEdhY8.js";import"./CreditCardOutlined-CcvN7g1Z.js";import"./AppstoreOutlined-D5DMeuPl.js";import"./TeamOutlined-Bx4ezhPp.js";import"./UserOutlined-B4M5rNrX.js";import"./CameraOutlined-CFYC5ScW.js";import"./PictureOutlined-BQUWPT2c.js";import"./SafetyCertificateOutlined-Du6lFDs_.js";function ne(){const k=A();Object.keys(k.cityFilters).length<1&&k.getCities();const n=new re("admin/orders/wholesale/list","لیست سفارش های عمده");return n.add(new c("id","شماره").filterNumber()),n.add(new c("customer.name","مشتری").filterKey("customer.fullName").filterText()),n.add(new c("customer.mobile","موبایل").filterText().hidden().noSort()),n.add(new c("input","جمع کل سفارش").filterKey("totalGoldWeightGrams").filterText()),n.add(new c("discount","جمع کل تخفیف (درصد)").filterText()),n.add(new c("customer.city_id","شهر").hidden().renderSlot("city")),n.add(new c("items","تعداد آیتم ها").renderSlot("items_len").noSort()),n.add(new c("caj","تاریخ ثبت").filterKey("createdAt").filterDate().noSort()),n.add(new c("uaj","تاریخ ویرایش").hidden().filterKey("updatedAt").filterDate().noSort()),k.roles&&k.roles.includes("order.omde.state")&&n.add(new c("sts","وضعیت").renderSlot("sts_str").noSort().filterKey("status").filterSelect({0:"معلق",1:"ثبت سفارش",2:"تایید مدیر سیستم",3:"در حال تامین",4:"در حال آماده سازی ",5:"تحویل مسئول فروش",6:"تحویل مشتری "})),n.add(new c("confirmed","وضعیت تایید مشتری").renderSlot("confirmed_str").noSort().filterSelect({1:"تایید شده",2:"در انتظار تایید"})),n.add(new c("opt","عملیات").noSort().renderSlot("opt")),n}const le={id:"page-user-list"},de={key:0},ue={key:1},ce={class:"flex"},me={key:0},ve=["onClick"],fe={key:1},pe={class:"flex justify-between flex-wrap gap-2"},ye={class:"flex gap-2 flex-wrap"},we=z({__name:"OmdeList",setup(k){const n=A(),_=a=>!!n.hasPermission(a),B=ne(),w=f(null),r=f(void 0),x=f(""),I=f(!1),h=f(!1),p=f(!1),T=f(!1),P=f(""),V=f(1),N=te(()=>_("order.omde.view.edit"));function D(a){return n.cityFilters[a]??"-"}async function b(a){const{data:e}=await g.get(`admin/orders/${a}`);return e}async function U(a){r.value=await b(a.id),x.value=JSON.stringify(r.value),p.value=!1,I.value=!0}function G(){I.value=!1,p.value=!1}function K(){if(x.value)try{r.value=JSON.parse(x.value)}catch{}p.value=!1}function j(a){var e;if((e=r.value)!=null&&e.items){if(r.value.items.length<=1){d.warning("حداقل یک آیتم باید در سفارش بماند");return}r.value.items.splice(a,1)}}function F(a){const e=a.variantId.trim();if(!e){d.warning("یک تنوع انتخاب کنید");return}r.value&&(r.value.items.push({productVariantId:e,title:a.title??"آیتم جدید",variant_title:a.variantTitle??e,qty:a.qty||1,grams:a.grams??0,flatRialCharge:a.flatRialCharge??0,wagePercent:a.wagePercent,rash:a.grams??0,image:a.image??null}),P.value="",V.value=1)}async function M(){var e,i,s,l;if(!((e=r.value)!=null&&e.id))return;const a=(r.value.items??[]).filter(t=>t.productVariantId).map(t=>({productVariantId:t.productVariantId,quantity:Number(t.qty)||1,grams:Number(t.grams)||void 0,flatRialCharge:Number(t.flatRialCharge)||0,rashWeightGrams:t.rash!=null?Number(t.rash):void 0,wagePercent:t.wagePercent!=null?Number(t.wagePercent):void 0,discountPercent:t.discountPercent!=null?Number(t.discountPercent):void 0}));if(!a.length){d
|