Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0cb056e11 | ||
|
|
9f7a98e064 | ||
|
|
db29b7d0d3 | ||
|
|
6e898323d4 | ||
|
|
3e4c0e018e |
@@ -0,0 +1,177 @@
|
|||||||
|
---
|
||||||
|
description: دستورالعمل اجباری AI — پروژه ابشوده/خانگی (توکن کم، پچ محدود)
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
# دستورالعمل اجباری برای هوش مصنوعی — پروژه ابشوده / خانگی
|
||||||
|
|
||||||
|
این فایل را کامل به AI بده (Project Rules / Custom Instructions / System prompt).
|
||||||
|
هدف: **توکن کمتر، یادگیری پایدار، حل سریع اصل کار، بدون تغییر الکی.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۱) با هر پرامپت کاربر — همین ترتیب
|
||||||
|
|
||||||
|
1. اصل قضیه را **یک خط** مشخص کن (یک باگ / یک UI / یک فیچر).
|
||||||
|
2. مسیر را از **نقشه و یادداشت** بگیر — کل ریپو را سرچ نکن.
|
||||||
|
3. فقط **۱ تا ۳ فایل** مربوط را باز/پچ کن.
|
||||||
|
4. تمام کن؛ جواب کوتاه بده.
|
||||||
|
5. یک خط **یادداشت بخش** بنویس (پایین ببین) تا دفعهٔ بعد فراموش نشود.
|
||||||
|
|
||||||
|
```
|
||||||
|
پرامپت → اصل کار → نقشه/یادداشت → Grep فقط همان پوشه → پچ محدود → یادداشت → تمام
|
||||||
|
```
|
||||||
|
|
||||||
|
### ممنوع (سوخت توکن)
|
||||||
|
|
||||||
|
- دوباره پیدا کردن فایلی که در نقشه/یادداشت هست
|
||||||
|
- explore / گشت سراسری برای «X کجاست؟»
|
||||||
|
- خواندن کل فایل بلند وقتی چند ده خط کافی است
|
||||||
|
- refactor یا «درست کردن» فایلهای همجوار بدون درخواست
|
||||||
|
- کپی پچ به سیستم/اپ دیگر «برای کامل بودن»
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۲) محدودهٔ تغییر — حساس
|
||||||
|
|
||||||
|
- **فقط** همان چیزی که کاربر گفته؛ جای بیربط را دست نزن.
|
||||||
|
- مبهم بود (هدف، اپ، برنچ، سیستم حسابداری) → **بپرس**؛ حدس نزن.
|
||||||
|
- روی **برنچ فعلی** بمان؛ checkout/merge به برنچ دیگر بدون اجازه ممنوع.
|
||||||
|
- هر زیرپروژه git جدا دارد؛ فقط همان ریپوی مربوط را عوض کن.
|
||||||
|
|
||||||
|
| کار | فقط این ریپو |
|
||||||
|
|-----|----------------|
|
||||||
|
| ادمین | `khaneghi_admin` |
|
||||||
|
| API / SQL | `khaneghi_server` |
|
||||||
|
| اپ کاربر | `khaneghi_user` + تم + `ghatreh_user` (هر سه اگر رفتاری است) |
|
||||||
|
| سوپرادمین | `controlpanel_server` / `controlpanel_user` |
|
||||||
|
| بورس مس | فقط با درخواست صریح |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۳) حسابداری — قانون سخت
|
||||||
|
|
||||||
|
سیستمها **جدا** هستند: زرین (`zarin`) / تهحساب (`tahesab`) / پرگار (`pargar`).
|
||||||
|
|
||||||
|
1. اگر گفت حسابداری/سند/سینک مشتری و **نام نبرد** → اول بپرس کدام؟
|
||||||
|
2. تا جواب ندادی کد نزن و فایل سیستم دیگر را باز نکن.
|
||||||
|
3. پچ یک سیستم را به بقیه کپی نکن مگر در همان پیام صریح بگوید.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۴) یادگیری قوی — یادداشت بخشها
|
||||||
|
|
||||||
|
هر کار تمامشده را در دفتر پروژه ثبت کن (اگر در این ریپو هست:
|
||||||
|
`.cursor/skills/abshode-domain-lookup/learned-notes.md`):
|
||||||
|
|
||||||
|
```
|
||||||
|
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
|
||||||
|
```
|
||||||
|
|
||||||
|
قبل از هر Grep سراسری: **یادداشتها را بخوان.**
|
||||||
|
اگر مسیر آنجا بود، دوباره سرچ نکن.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۵) نقشهٔ سریع مسیرها
|
||||||
|
|
||||||
|
| موضوع | کجا |
|
||||||
|
|-------|-----|
|
||||||
|
| تنظیمات ادمین | `khaneghi_admin/src/pages/menuPages/configuration/` |
|
||||||
|
| فلگ منو از settings | `khaneghi_admin/src/utils/config.ts` |
|
||||||
|
| مشتریان | `khaneghi_admin/src/pages/menuPages/customers/` |
|
||||||
|
| همگام تهحساب | `…/accounting/components/TahesabCustomerSync.vue`, `TahesabWalletBulkSync.vue` |
|
||||||
|
| کد حساب همکار | `…/colleagueOrders/components/ColleagueAccountingAccounts.vue` |
|
||||||
|
| API تهحساب (فرانت) | `khaneghi_admin/src/api/tahesab.ts` |
|
||||||
|
| تنظیمات سرور / overlay سوپرادمین | `SuperAdminProgramSettingsOverlay`, `SettingsController` |
|
||||||
|
| deploy settings | `khaneghi_server/database/sql/deploy_settings_const.sql` — **value موجود را UPDATE نکن** |
|
||||||
|
| قیمت ویژه مشتری | `customer_special_pricing` + منوی `customers/special-price` |
|
||||||
|
|
||||||
|
نقشهٔ کاملتر (اگر موجود): `.cursor/skills/abshode-domain-lookup/project-map.md`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۶) فرانت — زیاد از Ant + UnoCSS + lodash استفاده کن
|
||||||
|
|
||||||
|
اولویت:
|
||||||
|
|
||||||
|
1. **BasicPacks** پروژه (دکمه/آیکون/اینپوت/مدال) اگر هست
|
||||||
|
2. **Ant Design Vue** (`a-button`, `a-input`, `a-table`, `a-spin`, `a-form`, …)
|
||||||
|
3. **UnoCSS** برای layout و فاصله (`flex`, `grid`, `gap-*`, `w-full`, `min-w-0`, `sm:`)
|
||||||
|
4. **lodash** برای داده (`get`, `debounce`, `cloneDeep`, `isEmpty`, …) — helper تکراری ننویس
|
||||||
|
5. CSS/`<style>` فقط وقتی utility کافی نیست (توکن تم، انیمیشن خاص)
|
||||||
|
|
||||||
|
```text
|
||||||
|
❌ button خام + CSS بزرگ برای layout
|
||||||
|
✅ Ant/Basic + کلاسهای Uno روی تمپلیت + lodash برای منطق داده
|
||||||
|
```
|
||||||
|
|
||||||
|
- `BasicButton` را با `:deep` برای عوض کردن layout داخلی خراب نکن.
|
||||||
|
- رنگ: توکن تم؛ از `bg-primary/10` روی CSS variable پرهیز کن (اغلب میشکند).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۷) UI حرفهای — عینک گرافیککار
|
||||||
|
|
||||||
|
- هر بلوک جدید: **عنوان + یک خط راهنما** (این کار چیست / دکمه کی زده شود).
|
||||||
|
- **باکسبندی خوب است؛ فضای مرده بد است** — کارت عریض با محتوا فقط در یک گوشه ممنوع.
|
||||||
|
- یا `sm:grid-cols-2` / `flex` تا پر شود، یا عرض باکس را محدود کن.
|
||||||
|
- موبایل: اکشن **زیر** توضیح (`flex-col`).
|
||||||
|
- دسکتاپ: کنار یا ستون دوم پر (`sm:flex-row` / `sm:grid`).
|
||||||
|
- **نسبت سرچ و دکمه:**
|
||||||
|
- موبایل: سرچ `w-full`؛ بعد دکمهها با عرض مساوی (`grid` / `1fr`).
|
||||||
|
- اینپوت باریک کنار دکمهٔ پهن در یک ردیف wrap = زشت → ممنوع.
|
||||||
|
- بنر گرادیان جیغ و دکمهٔ `block` تمامعرض الکی ممنوع مگر اکشن اصلی صفحه باشد.
|
||||||
|
- فشرده باش: `p-2.5` / `gap-2`؛ عدد و padding غولپیکر نگذار.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۸) مهندسی بکاند / فرانت — بدون باگ الکی
|
||||||
|
|
||||||
|
- یک مسئولیت در هر کامپوننت / متد / سرویس؛ خدا-فایل نساز.
|
||||||
|
- UI نازک؛ منطق سنگین در composable یا Service.
|
||||||
|
- Controller نازک → Service؛ SQL و business را قاطی نکن.
|
||||||
|
- خطا، خالی، timeout، دوبار کلیک / race را طراحی کن (`running` قفل، early return).
|
||||||
|
- الگوی همان پوشه را کپی کن؛ اختراع ساختار جدید نکن مگر لازم باشد.
|
||||||
|
- نامگذاری گویا؛ قرارداد API فرانت و بک یکی باشد.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۹) سوپرادمین / تنظیمات دسترسی
|
||||||
|
|
||||||
|
- کلیدهای دسترسی مشتری (`customer_special_pricing`, `has_page_*`, …) مال سوپرادمیناند؛ در پنل خانگی معمولاً فقطخواندنی.
|
||||||
|
- منوی وابسته به فلگ باید از `get_settings` / overlay زنده بیاید؛ کش کهنه برای این کلیدها مطلوب نیست.
|
||||||
|
- دکمهٔ بروزرسانی تنظیمات پیشرفته باید همگام زنده از سوپرادمین را هم بزند اگر فلگ منو میخواهد عوض شود.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۱۰) چک قبل از اتمام
|
||||||
|
|
||||||
|
- [ ] diff فقط به درخواست مربوط است؟
|
||||||
|
- [ ] سیستم حسابداری / اپ / برنچ اشتباه درگیر نشده؟
|
||||||
|
- [ ] اگر مبهم بود سؤال شد؟
|
||||||
|
- [ ] یادداشت یکخطی نوشته شد؟
|
||||||
|
- [ ] UI: راهنما + بدون فضای مرده + نسبت سرچ/دکمه درست؟
|
||||||
|
- [ ] Ant / Uno / lodash بهجای reinvent؟
|
||||||
|
- [ ] جواب کوتاه است؛ توضیح اضافه نداری؟
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۱۱) نمونهٔ رفتار درست / غلط
|
||||||
|
|
||||||
|
```text
|
||||||
|
❌ «همگامسازی مشتری خراب» → هر سه زرین/تهحساب/پرگار را عوض کند
|
||||||
|
✅ بپرسد کدام؟ بعد فقط همان
|
||||||
|
|
||||||
|
❌ UI یک کارت → کل صفحه accounting را redesign کند
|
||||||
|
✅ فقط همان کارت / همان فایل
|
||||||
|
|
||||||
|
❌ هر بار از صفر Grep مونوریپو
|
||||||
|
✅ learned-notes + project-map → مستقیم فایل
|
||||||
|
|
||||||
|
❌ CSS سفارشی ۵۰ خط برای flex ساده
|
||||||
|
✅ class="flex flex-col gap-2 sm:grid sm:grid-cols-2"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**پایان.** این سند را بهروز نگه دار؛ نکات جدید حساس را همینجا یا در `learned-notes.md` اضافه کن.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# یادداشتهای یادگیری — abshode-domain-lookup
|
||||||
|
|
||||||
|
فرمت هر خط:
|
||||||
|
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
# دستورالعمل اجباری برای هوش مصنوعی — پروژه ابشوده / خانگی
|
||||||
|
|
||||||
|
این فایل را کامل به AI بده (Project Rules / Custom Instructions / System prompt).
|
||||||
|
هدف: **توکن کمتر، یادگیری پایدار، حل سریع اصل کار، بدون تغییر الکی.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۱) با هر پرامپت کاربر — همین ترتیب
|
||||||
|
|
||||||
|
1. اصل قضیه را **یک خط** مشخص کن (یک باگ / یک UI / یک فیچر).
|
||||||
|
2. مسیر را از **نقشه و یادداشت** بگیر — کل ریپو را سرچ نکن.
|
||||||
|
3. فقط **۱ تا ۳ فایل** مربوط را باز/پچ کن.
|
||||||
|
4. تمام کن؛ جواب کوتاه بده.
|
||||||
|
5. یک خط **یادداشت بخش** بنویس (پایین ببین) تا دفعهٔ بعد فراموش نشود.
|
||||||
|
|
||||||
|
```
|
||||||
|
پرامپت → اصل کار → نقشه/یادداشت → Grep فقط همان پوشه → پچ محدود → یادداشت → تمام
|
||||||
|
```
|
||||||
|
|
||||||
|
### ممنوع (سوخت توکن)
|
||||||
|
|
||||||
|
- دوباره پیدا کردن فایلی که در نقشه/یادداشت هست
|
||||||
|
- explore / گشت سراسری برای «X کجاست؟»
|
||||||
|
- خواندن کل فایل بلند وقتی چند ده خط کافی است
|
||||||
|
- refactor یا «درست کردن» فایلهای همجوار بدون درخواست
|
||||||
|
- کپی پچ به سیستم/اپ دیگر «برای کامل بودن»
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۲) محدودهٔ تغییر — حساس
|
||||||
|
|
||||||
|
- **فقط** همان چیزی که کاربر گفته؛ جای بیربط را دست نزن.
|
||||||
|
- مبهم بود (هدف، اپ، برنچ، سیستم حسابداری) → **بپرس**؛ حدس نزن.
|
||||||
|
- روی **برنچ فعلی** بمان؛ checkout/merge به برنچ دیگر بدون اجازه ممنوع.
|
||||||
|
- هر زیرپروژه git جدا دارد؛ فقط همان ریپوی مربوط را عوض کن.
|
||||||
|
|
||||||
|
| کار | فقط این ریپو |
|
||||||
|
|-----|----------------|
|
||||||
|
| ادمین | `khaneghi_admin` |
|
||||||
|
| API / SQL | `khaneghi_server` |
|
||||||
|
| اپ کاربر | `khaneghi_user` + تم + `ghatreh_user` (هر سه اگر رفتاری است) |
|
||||||
|
| سوپرادمین | `controlpanel_server` / `controlpanel_user` |
|
||||||
|
| بورس مس | فقط با درخواست صریح |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۳) حسابداری — قانون سخت
|
||||||
|
|
||||||
|
سیستمها **جدا** هستند: زرین (`zarin`) / تهحساب (`tahesab`) / پرگار (`pargar`).
|
||||||
|
|
||||||
|
1. اگر گفت حسابداری/سند/سینک مشتری و **نام نبرد** → اول بپرس کدام؟
|
||||||
|
2. تا جواب ندادی کد نزن و فایل سیستم دیگر را باز نکن.
|
||||||
|
3. پچ یک سیستم را به بقیه کپی نکن مگر در همان پیام صریح بگوید.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۴) یادگیری قوی — یادداشت بخشها
|
||||||
|
|
||||||
|
هر کار تمامشده را در دفتر پروژه ثبت کن (اگر در این ریپو هست:
|
||||||
|
`.cursor/skills/abshode-domain-lookup/learned-notes.md`):
|
||||||
|
|
||||||
|
```
|
||||||
|
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
|
||||||
|
```
|
||||||
|
|
||||||
|
قبل از هر Grep سراسری: **یادداشتها را بخوان.**
|
||||||
|
اگر مسیر آنجا بود، دوباره سرچ نکن.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۵) نقشهٔ سریع مسیرها
|
||||||
|
|
||||||
|
| موضوع | کجا |
|
||||||
|
|-------|-----|
|
||||||
|
| تنظیمات ادمین | `khaneghi_admin/src/pages/menuPages/configuration/` |
|
||||||
|
| فلگ منو از settings | `khaneghi_admin/src/utils/config.ts` |
|
||||||
|
| مشتریان | `khaneghi_admin/src/pages/menuPages/customers/` |
|
||||||
|
| همگام تهحساب | `…/accounting/components/TahesabCustomerSync.vue`, `TahesabWalletBulkSync.vue` |
|
||||||
|
| کد حساب همکار | `…/colleagueOrders/components/ColleagueAccountingAccounts.vue` |
|
||||||
|
| API تهحساب (فرانت) | `khaneghi_admin/src/api/tahesab.ts` |
|
||||||
|
| تنظیمات سرور / overlay سوپرادمین | `SuperAdminProgramSettingsOverlay`, `SettingsController` |
|
||||||
|
| deploy settings | `khaneghi_server/database/sql/deploy_settings_const.sql` — **value موجود را UPDATE نکن** |
|
||||||
|
| قیمت ویژه مشتری | `customer_special_pricing` + منوی `customers/special-price` |
|
||||||
|
|
||||||
|
نقشهٔ کاملتر (اگر موجود): `.cursor/skills/abshode-domain-lookup/project-map.md`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۶) فرانت — زیاد از Ant + UnoCSS + lodash استفاده کن
|
||||||
|
|
||||||
|
اولویت:
|
||||||
|
|
||||||
|
1. **BasicPacks** پروژه (دکمه/آیکون/اینپوت/مدال) اگر هست
|
||||||
|
2. **Ant Design Vue** (`a-button`, `a-input`, `a-table`, `a-spin`, `a-form`, …)
|
||||||
|
3. **UnoCSS** برای layout و فاصله (`flex`, `grid`, `gap-*`, `w-full`, `min-w-0`, `sm:`)
|
||||||
|
4. **lodash** برای داده (`get`, `debounce`, `cloneDeep`, `isEmpty`, …) — helper تکراری ننویس
|
||||||
|
5. CSS/`<style>` فقط وقتی utility کافی نیست (توکن تم، انیمیشن خاص)
|
||||||
|
|
||||||
|
```text
|
||||||
|
❌ button خام + CSS بزرگ برای layout
|
||||||
|
✅ Ant/Basic + کلاسهای Uno روی تمپلیت + lodash برای منطق داده
|
||||||
|
```
|
||||||
|
|
||||||
|
- `BasicButton` را با `:deep` برای عوض کردن layout داخلی خراب نکن.
|
||||||
|
- رنگ: توکن تم؛ از `bg-primary/10` روی CSS variable پرهیز کن (اغلب میشکند).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۷) UI حرفهای — عینک گرافیککار
|
||||||
|
|
||||||
|
- هر بلوک جدید: **عنوان + یک خط راهنما** (این کار چیست / دکمه کی زده شود).
|
||||||
|
- **باکسبندی خوب است؛ فضای مرده بد است** — کارت عریض با محتوا فقط در یک گوشه ممنوع.
|
||||||
|
- یا `sm:grid-cols-2` / `flex` تا پر شود، یا عرض باکس را محدود کن.
|
||||||
|
- موبایل: اکشن **زیر** توضیح (`flex-col`).
|
||||||
|
- دسکتاپ: کنار یا ستون دوم پر (`sm:flex-row` / `sm:grid`).
|
||||||
|
- **نسبت سرچ و دکمه:**
|
||||||
|
- موبایل: سرچ `w-full`؛ بعد دکمهها با عرض مساوی (`grid` / `1fr`).
|
||||||
|
- اینپوت باریک کنار دکمهٔ پهن در یک ردیف wrap = زشت → ممنوع.
|
||||||
|
- بنر گرادیان جیغ و دکمهٔ `block` تمامعرض الکی ممنوع مگر اکشن اصلی صفحه باشد.
|
||||||
|
- فشرده باش: `p-2.5` / `gap-2`؛ عدد و padding غولپیکر نگذار.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۸) مهندسی بکاند / فرانت — بدون باگ الکی
|
||||||
|
|
||||||
|
- یک مسئولیت در هر کامپوننت / متد / سرویس؛ خدا-فایل نساز.
|
||||||
|
- UI نازک؛ منطق سنگین در composable یا Service.
|
||||||
|
- Controller نازک → Service؛ SQL و business را قاطی نکن.
|
||||||
|
- خطا، خالی، timeout، دوبار کلیک / race را طراحی کن (`running` قفل، early return).
|
||||||
|
- الگوی همان پوشه را کپی کن؛ اختراع ساختار جدید نکن مگر لازم باشد.
|
||||||
|
- نامگذاری گویا؛ قرارداد API فرانت و بک یکی باشد.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۹) سوپرادمین / تنظیمات دسترسی
|
||||||
|
|
||||||
|
- کلیدهای دسترسی مشتری (`customer_special_pricing`, `has_page_*`, …) مال سوپرادمیناند؛ در پنل خانگی معمولاً فقطخواندنی.
|
||||||
|
- منوی وابسته به فلگ باید از `get_settings` / overlay زنده بیاید؛ کش کهنه برای این کلیدها مطلوب نیست.
|
||||||
|
- دکمهٔ بروزرسانی تنظیمات پیشرفته باید همگام زنده از سوپرادمین را هم بزند اگر فلگ منو میخواهد عوض شود.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۱۰) چک قبل از اتمام
|
||||||
|
|
||||||
|
- [ ] diff فقط به درخواست مربوط است؟
|
||||||
|
- [ ] سیستم حسابداری / اپ / برنچ اشتباه درگیر نشده؟
|
||||||
|
- [ ] اگر مبهم بود سؤال شد؟
|
||||||
|
- [ ] یادداشت یکخطی نوشته شد؟
|
||||||
|
- [ ] UI: راهنما + بدون فضای مرده + نسبت سرچ/دکمه درست؟
|
||||||
|
- [ ] Ant / Uno / lodash بهجای reinvent؟
|
||||||
|
- [ ] جواب کوتاه است؛ توضیح اضافه نداری؟
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ۱۱) نمونهٔ رفتار درست / غلط
|
||||||
|
|
||||||
|
```text
|
||||||
|
❌ «همگامسازی مشتری خراب» → هر سه زرین/تهحساب/پرگار را عوض کند
|
||||||
|
✅ بپرسد کدام؟ بعد فقط همان
|
||||||
|
|
||||||
|
❌ UI یک کارت → کل صفحه accounting را redesign کند
|
||||||
|
✅ فقط همان کارت / همان فایل
|
||||||
|
|
||||||
|
❌ هر بار از صفر Grep مونوریپو
|
||||||
|
✅ learned-notes + project-map → مستقیم فایل
|
||||||
|
|
||||||
|
❌ CSS سفارشی ۵۰ خط برای flex ساده
|
||||||
|
✅ class="flex flex-col gap-2 sm:grid sm:grid-cols-2"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**پایان.** این سند را بهروز نگه دار؛ نکات جدید حساس را همینجا یا در `learned-notes.md` اضافه کن.
|
||||||
Vendored
+4
-1
@@ -7,7 +7,6 @@ export {}
|
|||||||
|
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
ABadge: typeof import('ant-design-vue/es')['Badge']
|
|
||||||
AButton: typeof import('ant-design-vue/es')['Button']
|
AButton: typeof import('ant-design-vue/es')['Button']
|
||||||
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
||||||
ADivider: typeof import('ant-design-vue/es')['Divider']
|
ADivider: typeof import('ant-design-vue/es')['Divider']
|
||||||
@@ -16,13 +15,16 @@ declare module 'vue' {
|
|||||||
AInput: typeof import('ant-design-vue/es')['Input']
|
AInput: typeof import('ant-design-vue/es')['Input']
|
||||||
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
||||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||||
|
ARadio: typeof import('ant-design-vue/es')['Radio']
|
||||||
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
||||||
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
||||||
ASelect: typeof import('ant-design-vue/es')['Select']
|
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||||
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
||||||
ASlider: typeof import('ant-design-vue/es')['Slider']
|
ASlider: typeof import('ant-design-vue/es')['Slider']
|
||||||
ASpin: typeof import('ant-design-vue/es')['Spin']
|
ASpin: typeof import('ant-design-vue/es')['Spin']
|
||||||
|
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
||||||
ATag: typeof import('ant-design-vue/es')['Tag']
|
ATag: typeof import('ant-design-vue/es')['Tag']
|
||||||
|
ATextarea: typeof import('ant-design-vue/es')['Textarea']
|
||||||
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
||||||
BaseDatePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/BaseDatePicker.vue')['default']
|
BaseDatePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/BaseDatePicker.vue')['default']
|
||||||
Basic: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/basic.vue')['default']
|
Basic: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/basic.vue')['default']
|
||||||
@@ -66,5 +68,6 @@ declare module 'vue' {
|
|||||||
TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default']
|
TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default']
|
||||||
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
||||||
VanDialog: typeof import('vant/es')['Dialog']
|
VanDialog: typeof import('vant/es')['Dialog']
|
||||||
|
VanField: typeof import('vant/es')['Field']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,3 +352,19 @@ body {
|
|||||||
.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{
|
.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{
|
||||||
color: white !important;
|
color: white !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-spin-dot-item,
|
||||||
|
.ant-spin-dot i {
|
||||||
|
background-color: @primary-color !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* لودینگ محتوای صفحه — وسط ناحیه محتوا (موبایل و دسکتاپ یکسان) */
|
||||||
|
.app-page-content-loading {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
min-height: min(52vh, 22rem);
|
||||||
|
padding: 2rem 1rem;
|
||||||
|
}
|
||||||
+10
-10
@@ -20,16 +20,16 @@ const router = createRouter({
|
|||||||
redirect: {name: 'buyProduct'},
|
redirect: {name: 'buyProduct'},
|
||||||
component: () => import('../views/base/index.vue'),
|
component: () => import('../views/base/index.vue'),
|
||||||
children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'home',
|
path: 'home',
|
||||||
// name: 'home',
|
name: 'home',
|
||||||
// component: () => import('../views/base/home/index.vue')
|
component: () => import('../views/base/home/index.vue')
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'gold',
|
path: 'gold',
|
||||||
// name: 'gold',
|
name: 'gold',
|
||||||
// component: () => import('@/views/base/gold/index.vue')
|
component: () => import('@/views/base/gold/index.vue')
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'buyProduct',
|
path: 'buyProduct',
|
||||||
name: 'buyProduct',
|
name: 'buyProduct',
|
||||||
|
|||||||
+1
-58
@@ -2,8 +2,6 @@ import { computed, ref } from 'vue'
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import type { CartItem } from '@/models/cart'
|
import type { CartItem } from '@/models/cart'
|
||||||
import type { Product } from '@/models/products'
|
import type { Product } from '@/models/products'
|
||||||
import type { Price } from '@/models/home'
|
|
||||||
import { getProducts } from '@/api/products'
|
|
||||||
|
|
||||||
const CART_STORAGE_KEY = 'ghatre_cart'
|
const CART_STORAGE_KEY = 'ghatre_cart'
|
||||||
|
|
||||||
@@ -95,58 +93,6 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
return cartItems.value.length
|
return cartItems.value.length
|
||||||
})
|
})
|
||||||
|
|
||||||
function syncProductsFromServer(serverProducts: Product[]): number {
|
|
||||||
const productMap = new Map(serverProducts.map(p => [p.id, p]))
|
|
||||||
const beforeCount = cartItems.value.length
|
|
||||||
|
|
||||||
cartItems.value = cartItems.value
|
|
||||||
.filter(item => productMap.has(item.product.id))
|
|
||||||
.map(item => ({
|
|
||||||
...item,
|
|
||||||
product: { ...productMap.get(item.product.id)! }
|
|
||||||
}))
|
|
||||||
|
|
||||||
if (cartItems.value.length > 0 || beforeCount > 0) {
|
|
||||||
saveCartToStorage()
|
|
||||||
}
|
|
||||||
|
|
||||||
return beforeCount - cartItems.value.length
|
|
||||||
}
|
|
||||||
|
|
||||||
function recalculateCartPrices(lastPrice: Price) {
|
|
||||||
if (!lastPrice || cartItems.value.length === 0) return
|
|
||||||
|
|
||||||
cartItems.value.forEach((item) => {
|
|
||||||
const product = item.product
|
|
||||||
let newPrice = 0
|
|
||||||
|
|
||||||
if (product.group_type == 'آبشده') {
|
|
||||||
newPrice = lastPrice.price_last ?? 0
|
|
||||||
} else {
|
|
||||||
newPrice = product.amount * (lastPrice.price_last ?? 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
product.price = newPrice
|
|
||||||
product.sellPrice = product.amount * (lastPrice.sell ?? 0)
|
|
||||||
item.price = newPrice + (product.cash_fee_buy ?? 0)
|
|
||||||
item.totalPrice = parseInt(String(item.price * item.quantity))
|
|
||||||
})
|
|
||||||
|
|
||||||
saveCartToStorage()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function refreshCartFromServer(): Promise<number> {
|
|
||||||
if (cartItems.value.length === 0) return 0
|
|
||||||
|
|
||||||
try {
|
|
||||||
const serverProducts: Product[] = await getProducts()
|
|
||||||
return syncProductsFromServer(serverProducts)
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error refreshing cart from server:', e)
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cartItems,
|
cartItems,
|
||||||
addToCart,
|
addToCart,
|
||||||
@@ -156,10 +102,7 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
totalPrice,
|
totalPrice,
|
||||||
itemCount,
|
itemCount,
|
||||||
loadCartFromStorage,
|
loadCartFromStorage,
|
||||||
saveCartToStorage,
|
saveCartToStorage
|
||||||
syncProductsFromServer,
|
|
||||||
recalculateCartPrices,
|
|
||||||
refreshCartFromServer
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<GoldLoading v-model:show="infoVisible" title=""/>
|
<GoldLoading v-model:show="infoVisible" title=""/>
|
||||||
<div class="px-5 pt-26 pb-30" :class="loading ? 'h-[60vh]' : ''">
|
<div class="px-5 pt-26 pb-30">
|
||||||
<template v-if="loading">
|
|
||||||
<TransactionSkeleton v-for="i in 3" :key="i" class="mt-4" />
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<!-- Empty Cart Message -->
|
<!-- Empty Cart Message -->
|
||||||
<div v-if="cartStore.itemCount === 0" class="flex flex-col items-center justify-center h-[60vh]">
|
<div v-if="cartStore.itemCount === 0" class="flex flex-col items-center justify-center h-[60vh]">
|
||||||
<div class="text-gray-500 text-lg font-semibold mb-4">سبد خرید شما خالی است</div>
|
<div class="text-gray-500 text-lg font-semibold mb-4">سبد خرید شما خالی است</div>
|
||||||
@@ -79,8 +75,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Total and Checkout -->
|
<!-- Total and Checkout -->
|
||||||
<div class=" flex justify-center fixed bottom-20 left-0 right-0 z-1">
|
<div class="fixed bottom-20 left-0 right-0 bg-white border-t border-gray-200 p-4 shadow-lg z-1">
|
||||||
<div class="md:w-[426px] w-full bg-white border-t border-gray-200 p-4 shadow-lg">
|
|
||||||
<div class="flex justify-between items-center mb-4">
|
<div class="flex justify-between items-center mb-4">
|
||||||
<div class="text-lg font-semibold">مجموع:</div>
|
<div class="text-lg font-semibold">مجموع:</div>
|
||||||
<div class="flex flex-col gap-2 ">
|
<div class="flex flex-col gap-2 ">
|
||||||
@@ -111,11 +106,8 @@
|
|||||||
تسویه حساب
|
تسویه حساب
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<AModal v-model:visible="showDiscountModal" ok-text="اعمال کد تخفیف" cancel-text="انصراف" @ok="submitDiscount"
|
<AModal v-model:visible="showDiscountModal" ok-text="اعمال کد تخفیف" cancel-text="انصراف" @ok="submitDiscount"
|
||||||
@cancel="showDiscountModal=false">
|
@cancel="showDiscountModal=false">
|
||||||
@@ -160,7 +152,6 @@ import parsianImg from '@/assets/img/parsianImg.svg'
|
|||||||
import venusImg from '@/assets/img/venousImg.svg'
|
import venusImg from '@/assets/img/venousImg.svg'
|
||||||
import {loading, getToken} from '@/utils'
|
import {loading, getToken} from '@/utils'
|
||||||
import GoldLoading from '@/components/GoldLoading.vue'
|
import GoldLoading from '@/components/GoldLoading.vue'
|
||||||
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
|
||||||
import {registerCodeDiscount} from "@/api/giftCard";
|
import {registerCodeDiscount} from "@/api/giftCard";
|
||||||
|
|
||||||
const cartStore = useCartStore()
|
const cartStore = useCartStore()
|
||||||
@@ -176,8 +167,28 @@ const price = computed((): Price => <Price>lastPrice.value ?? 0)
|
|||||||
|
|
||||||
// Watch for price updates and update cart items
|
// Watch for price updates and update cart items
|
||||||
watch(lastPrice, () => {
|
watch(lastPrice, () => {
|
||||||
if (lastPrice.value) {
|
if (lastPrice.value && cartStore.cartItems.length > 0) {
|
||||||
cartStore.recalculateCartPrices(lastPrice.value)
|
cartStore.cartItems.forEach((item) => {
|
||||||
|
const product = item.product
|
||||||
|
let newPrice = 0
|
||||||
|
|
||||||
|
if (product.group_type == 'آبشده') {
|
||||||
|
newPrice = lastPrice.value?.price_last ?? 0
|
||||||
|
} else {
|
||||||
|
newPrice = product.amount * (lastPrice.value?.price_last ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update product price
|
||||||
|
product.price = newPrice
|
||||||
|
product.sellPrice = product.amount * (lastPrice.value?.sell ?? 0)
|
||||||
|
|
||||||
|
// Update item price and total price
|
||||||
|
item.price = newPrice + (product.cash_fee_buy ?? 0)
|
||||||
|
item.totalPrice = parseInt(item.price * item.quantity)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Save updated prices to storage
|
||||||
|
cartStore.saveCartToStorage()
|
||||||
}
|
}
|
||||||
}, {deep: true, immediate: false})
|
}, {deep: true, immediate: false})
|
||||||
|
|
||||||
@@ -302,8 +313,8 @@ async function handleCheckout() {
|
|||||||
|
|
||||||
if (cashItemsTotal > 0) {
|
if (cashItemsTotal > 0) {
|
||||||
// Ensure wallet info is loaded
|
// Ensure wallet info is loaded
|
||||||
if (discountInfo.value?.amount && discountInfo.value?.amount>0){
|
if (discountInfo.value.amount>0){
|
||||||
cashItemsTotal=cashItemsTotal-cashItemsTotal*discountInfo.value?.amount
|
cashItemsTotal=cashItemsTotal-cashItemsTotal*discountInfo.value.amount
|
||||||
}
|
}
|
||||||
if (!walletStore.walletInfo) {
|
if (!walletStore.walletInfo) {
|
||||||
await walletStore.getMyWallet()
|
await walletStore.getMyWallet()
|
||||||
@@ -359,7 +370,7 @@ async function handleCheckout() {
|
|||||||
product_id: product.id,
|
product_id: product.id,
|
||||||
method: item.method,
|
method: item.method,
|
||||||
number: item.quantity,
|
number: item.quantity,
|
||||||
discount_code:discountInfo.value?.code
|
discount_code:discountInfo.value.code
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -402,37 +413,40 @@ async function initPrice() {
|
|||||||
try {
|
try {
|
||||||
await getLastPrices()
|
await getLastPrices()
|
||||||
await setIntervalGetLastPrice()
|
await setIntervalGetLastPrice()
|
||||||
if (lastPrice.value) {
|
|
||||||
cartStore.recalculateCartPrices(lastPrice.value)
|
// Update prices for all cart items
|
||||||
|
if (lastPrice.value && cartStore.cartItems.length > 0) {
|
||||||
|
cartStore.cartItems.forEach((item) => {
|
||||||
|
const product = item.product
|
||||||
|
let newPrice = 0
|
||||||
|
|
||||||
|
if (product.group_type == 'آبشده') {
|
||||||
|
newPrice = lastPrice.value?.price_last ?? 0
|
||||||
|
} else {
|
||||||
|
newPrice = product.amount * (lastPrice.value?.price_last ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update product price
|
||||||
|
product.price = newPrice
|
||||||
|
product.sellPrice = product.amount * (lastPrice.value?.sell ?? 0)
|
||||||
|
|
||||||
|
// Update item price and total price
|
||||||
|
item.price = newPrice + (product.cash_fee_buy ?? 0)
|
||||||
|
item.totalPrice = parseInt(item.price * item.quantity)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Save updated prices to storage
|
||||||
|
cartStore.saveCartToStorage()
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refreshCart() {
|
|
||||||
const removedCount = await cartStore.refreshCartFromServer()
|
|
||||||
if (removedCount > 0) {
|
|
||||||
message.warning(`${removedCount} محصول از سبد خرید حذف شد (دیگر در دسترس نیست)`)
|
|
||||||
}
|
|
||||||
if (lastPrice.value) {
|
|
||||||
cartStore.recalculateCartPrices(lastPrice.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
// Load cart from storage if needed
|
||||||
cartStore.loadCartFromStorage()
|
cartStore.loadCartFromStorage()
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
await initPrice()
|
await initPrice()
|
||||||
await refreshCart()
|
|
||||||
const refreshCartInfo=setInterval(async () => {
|
|
||||||
await refreshCart()
|
|
||||||
// await getUpPrice()
|
|
||||||
}, 10000)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
<div class="ml-1 text-base text-black">{{ info?.wallet[0]?.gold }}</div>
|
<div class="ml-1 text-base text-black">{{ info?.wallet[0]?.gold }}</div>
|
||||||
گرم
|
گرم
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="rialEquivalent !== null" class="mt-1 text-xs text-gray-400">
|
||||||
|
{{ usePriceWithoutType(rialEquivalent) }} ریال
|
||||||
|
</div>
|
||||||
<div class="text-gray-400">موجودی قلک {{ info?.title }}</div>
|
<div class="text-gray-400">موجودی قلک {{ info?.title }}</div>
|
||||||
<div class="w-full p-5">
|
<div class="w-full p-5">
|
||||||
<div class="w-full flex gap-3">
|
<div class="w-full flex gap-3">
|
||||||
@@ -145,6 +148,8 @@ import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
|||||||
import DialogVant from '@/components/DialogVant.vue'
|
import DialogVant from '@/components/DialogVant.vue'
|
||||||
import { useFundUserStore } from '@/store/fundStore'
|
import { useFundUserStore } from '@/store/fundStore'
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { getLastPrices, lastPrice } from '@/utils/price'
|
||||||
|
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||||
|
|
||||||
const info = ref<Fund>()
|
const info = ref<Fund>()
|
||||||
const items = ref<Transaction[]>([])
|
const items = ref<Transaction[]>([])
|
||||||
@@ -159,8 +164,16 @@ let fundStore = useFundUserStore()
|
|||||||
let walletStore = useWalletStore()
|
let walletStore = useWalletStore()
|
||||||
|
|
||||||
|
|
||||||
|
const rialEquivalent = computed(() => {
|
||||||
|
const unit = Number(lastPrice.value?.price_last ?? 0)
|
||||||
|
if (!unit) return null
|
||||||
|
const gold = Number(info.value?.wallet?.[0]?.gold ?? 0)
|
||||||
|
return Math.round(gold * unit)
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initInfo()
|
initInfo()
|
||||||
|
if (!lastPrice.value) getLastPrices()
|
||||||
// initTable()
|
// initTable()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -144,9 +144,7 @@
|
|||||||
<!-- <div class="text-xs mt-1 font-bold">دریافت فیزیکی</div>-->
|
<!-- <div class="text-xs mt-1 font-bold">دریافت فیزیکی</div>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<div :class="setNavColor('cart')" class="tab" @click="setRoute('cart')">
|
<div :class="setNavColor('cart')" class="tab" @click="setRoute('cart')">
|
||||||
<a-badge :count="cartStore.itemCount">
|
|
||||||
<Icon icon="vuesax-linear:shopping-cart" />
|
<Icon icon="vuesax-linear:shopping-cart" />
|
||||||
</a-badge>
|
|
||||||
<div class="text-xs mt-1 font-bold">سبد خرید</div>
|
<div class="text-xs mt-1 font-bold">سبد خرید</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -182,9 +180,7 @@
|
|||||||
<div class="text-xs mt-1 font-bold">خرید محصول</div>
|
<div class="text-xs mt-1 font-bold">خرید محصول</div>
|
||||||
</div>-->
|
</div>-->
|
||||||
<div :class="setNavColor('cart')" class="tab" @click="setRoute('cart')">
|
<div :class="setNavColor('cart')" class="tab" @click="setRoute('cart')">
|
||||||
<a-badge :count="cartStore.itemCount">
|
|
||||||
<Icon icon="vuesax-linear:shopping-cart" />
|
<Icon icon="vuesax-linear:shopping-cart" />
|
||||||
</a-badge>
|
|
||||||
<div class="text-xs mt-1 font-bold">سبد خرید</div>
|
<div class="text-xs mt-1 font-bold">سبد خرید</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="setNavColor('login')" class="tab" @click="setRoute('login')">
|
<div :class="setNavColor('login')" class="tab" @click="setRoute('login')">
|
||||||
@@ -209,14 +205,11 @@ import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
|||||||
import type { Transaction } from '@/models/transaction'
|
import type { Transaction } from '@/models/transaction'
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
import {isToken} from "@/utils";
|
import {isToken} from "@/utils";
|
||||||
import { useCartStore } from '@/store/cartStore'
|
|
||||||
|
|
||||||
const cartStore = useCartStore()
|
|
||||||
|
|
||||||
const popVisible = ref(false)
|
|
||||||
|
|
||||||
const currentRoute = computed(() => router.currentRoute.value.name)
|
const currentRoute = computed(() => router.currentRoute.value.name)
|
||||||
|
|
||||||
|
const popVisible = ref(false)
|
||||||
|
|
||||||
function setNavColor(val: string) {
|
function setNavColor(val: string) {
|
||||||
if (currentRoute.value === val) {
|
if (currentRoute.value === val) {
|
||||||
return 'text-primary'
|
return 'text-primary'
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
class="text-gray-500 text-xs number-ltr">{{ item.gold }}
|
class="text-gray-500 text-xs number-ltr">{{ item.gold }}
|
||||||
<div>{{item.unit}}</div>
|
<div>{{item.unit}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!isShopProduct" class="text-gray-500 flex gap-1 text-xs items-center number-ltr">
|
<div class="text-gray-500 flex gap-1 text-xs items-center number-ltr">
|
||||||
<div :class="item.cash > 0 ? 'text-green-600':'text-red-600'" class="text-base">
|
<div :class="item.cash > 0 ? 'text-green-600':'text-red-600'" class="text-base">
|
||||||
{{ usePriceWithoutType(item.cash?? 0) }}
|
{{ usePriceWithoutType(item.cash?? 0) }}
|
||||||
</div>
|
</div>
|
||||||
@@ -25,27 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="isShopProduct">
|
<div v-if="isGold" class="flex w-full justify-between mt-2">
|
||||||
<div class="flex w-full justify-between mt-2">
|
|
||||||
<div class="text-gray-500">تعداد:</div>
|
|
||||||
<div class="text-gray-500 text-xs number-ltr">{{ item?.gold ?? 0 }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex w-full justify-between mt-2">
|
|
||||||
<div class="text-gray-500">قیمت کل:</div>
|
|
||||||
<div class="text-gray-500 flex gap-1 text-xs items-center number-ltr">
|
|
||||||
<div class="text-base">{{ usePriceWithoutType(item.order?.total_price ?? 0) }}</div>
|
|
||||||
ریال
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex w-full justify-between mt-2">
|
|
||||||
<div class="text-gray-500">قیمت واحد:</div>
|
|
||||||
<div class="text-gray-500 flex gap-1 text-xs items-center number-ltr">
|
|
||||||
<div class="text-base">{{ usePriceWithoutType(item.order?.price ?? 0) }}</div>
|
|
||||||
ریال
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<div v-else-if="isGold" class="flex w-full justify-between mt-2">
|
|
||||||
<div class="text-gray-500">قیمت معامله:</div>
|
<div class="text-gray-500">قیمت معامله:</div>
|
||||||
<div class="text-gray-500 flex gap-1 text-xs items-center">
|
<div class="text-gray-500 flex gap-1 text-xs items-center">
|
||||||
<!-- <div class="text-base">{{ typeof parseInt((Math.abs(item.cash) / Math.abs(item.gold)).toFixed(0)) }}</div>-->
|
<!-- <div class="text-base">{{ typeof parseInt((Math.abs(item.cash) / Math.abs(item.gold)).toFixed(0)) }}</div>-->
|
||||||
@@ -80,29 +60,6 @@
|
|||||||
ریال
|
ریال
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="isShopProduct">
|
|
||||||
<div class="flex justify-between mb-3">
|
|
||||||
<div class="text-primary">تعداد:</div>
|
|
||||||
<div class="flex text-xs items-center number-ltr">
|
|
||||||
<div class="text-base ml-1">{{ item.order?.number ?? 0 }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between mb-3">
|
|
||||||
<div class="text-primary">قیمت کل:</div>
|
|
||||||
<div class="flex text-xs items-center number-ltr">
|
|
||||||
<div class="text-base ml-1">{{ usePriceWithoutType(item.order?.total_price ?? 0) }}</div>
|
|
||||||
ریال
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between mb-3">
|
|
||||||
<div class="text-primary">قیمت واحد:</div>
|
|
||||||
<div class="flex text-xs items-center number-ltr">
|
|
||||||
<div class="text-base ml-1">{{ usePriceWithoutType(item.order?.price ?? 0) }}</div>
|
|
||||||
ریال
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<div v-if="item.order" class="flex justify-between mb-3">
|
<div v-if="item.order" class="flex justify-between mb-3">
|
||||||
<div class="text-primary">قیمت هر گرم طلا حین معامله:</div>
|
<div class="text-primary">قیمت هر گرم طلا حین معامله:</div>
|
||||||
<div class="flex text-xs items-center number-ltr">
|
<div class="flex text-xs items-center number-ltr">
|
||||||
@@ -117,7 +74,6 @@
|
|||||||
{{item.unit}}
|
{{item.unit}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
<div class="flex justify-between mb-3">
|
<div class="flex justify-between mb-3">
|
||||||
<div class="text-primary">موجودی کیف پول:</div>
|
<div class="text-primary">موجودی کیف پول:</div>
|
||||||
<div :class="item.cash > 0? 'text-green-600' : 'text-red-600'" class="flex text-xs items-center number-ltr">
|
<div :class="item.cash > 0? 'text-green-600' : 'text-red-600'" class="flex text-xs items-center number-ltr">
|
||||||
@@ -200,7 +156,6 @@ interface Prop {
|
|||||||
const props = withDefaults(defineProps<Prop>(), {})
|
const props = withDefaults(defineProps<Prop>(), {})
|
||||||
const isUp = computed(() => props.item.type === 3 || props.item.type === 1 || props.item.type === 8 || props.item.type === 9)
|
const isUp = computed(() => props.item.type === 3 || props.item.type === 1 || props.item.type === 8 || props.item.type === 9)
|
||||||
const isGold = computed(() => props.item.type === 1 || props.item.type === 2 || props.item.type === 10)
|
const isGold = computed(() => props.item.type === 1 || props.item.type === 2 || props.item.type === 10)
|
||||||
const isShopProduct = computed(() => !!props.item?.product_id)
|
|
||||||
/*const title = computed(() => {
|
/*const title = computed(() => {
|
||||||
if (isUp.value) {
|
if (isUp.value) {
|
||||||
if (isGold.value) {
|
if (isGold.value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user