@@ -218,6 +247,9 @@ const tagsInputValue = ref('');
// ── mobile slider (legacy key: mobile_main_slider)
const sliders = ref<{ image: string; link: string }[]>([]);
+// ── custom button (Setting key: custom_button)
+const customButton = ref({ enabled: false, title: '', link: '' });
+
// ── collections
const collections = ref<{ id: string; title: string }[]>([]);
const newCollection = ref('');
@@ -315,6 +347,27 @@ async function saveSliders() {
}
}
+async function saveCustomButton() {
+ const title = customButton.value.title.trim();
+ const link = customButton.value.link.trim();
+ if (customButton.value.enabled && (!title || !link)) {
+ message.warning('برای فعالسازی، عنوان و لینک را وارد کنید');
+ return;
+ }
+ try {
+ await api.put('const/custom_button', {
+ val: {
+ enabled: customButton.value.enabled,
+ title,
+ link,
+ },
+ });
+ message.success('دکمه سفارشی ذخیره شد');
+ } catch (e: any) {
+ message.error(e?.response?.data?.message ?? 'خطا در ذخیره');
+ }
+}
+
// ── collections
async function loadCollections() {
const { data } = await api.post('ciny', { page: 1, limit: 200 });
@@ -363,9 +416,20 @@ onMounted(async () => {
try {
loading.value = true;
await Promise.all([loadBrands(), users.isSuperAdmin ? loadCollections() : Promise.resolve()]);
- const [t, s] = await Promise.all([api.get('const/__list__tags'), api.get('const/slider')]);
+ const [t, s, btn] = await Promise.all([
+ api.get('const/__list__tags'),
+ api.get('const/slider'),
+ api.get('const/custom_button'),
+ ]);
tags.value = Array.isArray(t.data) ? t.data : [];
sliders.value = Array.isArray(s.data) ? s.data : [];
+ if (btn.data && typeof btn.data === 'object' && !Array.isArray(btn.data)) {
+ customButton.value = {
+ enabled: Boolean(btn.data.enabled),
+ title: String(btn.data.title ?? ''),
+ link: String(btn.data.link ?? ''),
+ };
+ }
} catch (e) {
console.log(e);
} finally {
@@ -446,6 +510,9 @@ onMounted(async () => {
.mt-4 {
margin-top: 1rem;
}
+.custom-btn-form {
+ max-width: 480px;
+}
@media (max-width: 575px) {
/* the add-row input fills what the button leaves instead of a fixed 260px */
diff --git a/apps/admin-panel/src/views/order/List.vue b/apps/admin-panel/src/views/order/List.vue
index 014ee57..0a984df 100644
--- a/apps/admin-panel/src/views/order/List.vue
+++ b/apps/admin-panel/src/views/order/List.vue
@@ -128,6 +128,9 @@
/>
{{ item.qty }}
+
+ {{ Number(item.flatRialCharge).toLocaleString('fa-IR') }} ریال
+
{{ item.note }}
diff --git a/apps/admin-panel/src/views/order/OmdeList.vue b/apps/admin-panel/src/views/order/OmdeList.vue
index 2ded720..89c2cc0 100644
--- a/apps/admin-panel/src/views/order/OmdeList.vue
+++ b/apps/admin-panel/src/views/order/OmdeList.vue
@@ -121,6 +121,9 @@
{{ item.qty }}
+
+ {{ Number(item.flatRialCharge).toLocaleString('fa-IR') }} ریال
+
diff --git a/apps/admin-panel/src/views/order/TaminList.vue b/apps/admin-panel/src/views/order/TaminList.vue
index 5f807de..f70e71e 100644
--- a/apps/admin-panel/src/views/order/TaminList.vue
+++ b/apps/admin-panel/src/views/order/TaminList.vue
@@ -108,6 +108,9 @@