added kashkool
This commit is contained in:
@@ -310,7 +310,7 @@ const SETTING_GROUPS: Array<{
|
|||||||
title: 'ویژگیها و صفحات',
|
title: 'ویژگیها و صفحات',
|
||||||
icon: 'vuesax-linear:menu',
|
icon: 'vuesax-linear:menu',
|
||||||
match: (k) =>
|
match: (k) =>
|
||||||
/^(has_page_|has_chat|display_montzar|close_price|startDay|endDay|auto_active|open_register|charge_notif|group_sms|show_last_price|product_update|product_auto_close|goldir_price|tabanGohar_price|main_product_price)/.test(k)
|
/^(has_page_|has_chat|display_montzar|close_price|startDay|endDay|auto_active|open_register|charge_notif|group_sms|show_last_price|product_update|product_auto_close|goldir_price|tabanGohar_price|main_product_price|is_store|store_status)/.test(k)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'integrations',
|
id: 'integrations',
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ const KEY_TYPE_FALLBACK: Record<string, SettingFieldType> = {
|
|||||||
product_auto_close_open_on_list: 'switch',
|
product_auto_close_open_on_list: 'switch',
|
||||||
payping_fin_sync_enabled: 'switch',
|
payping_fin_sync_enabled: 'switch',
|
||||||
external_order_api_enabled: 'switch',
|
external_order_api_enabled: 'switch',
|
||||||
|
is_store: 'switch',
|
||||||
store_status: 'select',
|
store_status: 'select',
|
||||||
credit_rial_price_unit: 'select',
|
credit_rial_price_unit: 'select',
|
||||||
zaarbox_price_key: 'select',
|
zaarbox_price_key: 'select',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="h-full min-h-0 min-w-0 max-w-full overflow-hidden">
|
<div class="h-full min-h-0 min-w-0 max-w-full overflow-hidden">
|
||||||
<BasicShowContext title="لیست کارت های هدیه">
|
<BasicShowContext title="لیست کارت های هدیه">
|
||||||
<template v-if="!customerId" #extra>
|
<template v-if="!customerId" #extra>
|
||||||
<BaseButton type="primary" size="small" class="flex shrink-0 md:hidden" @click="emits('add')">
|
<BaseButton type="primary" size="small" class="flex shrink-0 md:hidden" @click="emits('add', 'gift')">
|
||||||
<div>افزودن</div>
|
<div>افزودن</div>
|
||||||
<BaseIcon icon="vuesax-linear:receipt-add" Size="16px" />
|
<BaseIcon icon="vuesax-linear:receipt-add" Size="16px" />
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
@@ -11,10 +11,22 @@
|
|||||||
<div class="flex h-full min-h-0 flex-col">
|
<div class="flex h-full min-h-0 flex-col">
|
||||||
<BaseTable v-if="!isMobile" class="h-full min-h-0 min-w-0" v-bind="tblProps" @register="submit" ref="tbl">
|
<BaseTable v-if="!isMobile" class="h-full min-h-0 min-w-0" v-bind="tblProps" @register="submit" ref="tbl">
|
||||||
<template #extraHeader>
|
<template #extraHeader>
|
||||||
<BaseButton v-if="!customerId" type="primary" size="small" class="flex" @click="emits('add')">
|
<div class="flex gap-2">
|
||||||
<div>افزودن کارت هدیه</div>
|
<BaseButton v-if="!customerId" type="primary" size="small" class="flex" @click="emits('add', 'gift')">
|
||||||
<BaseIcon icon="vuesax-linear:receipt-add" Size="16px" />
|
<div>افزودن کارت هدیه</div>
|
||||||
</BaseButton>
|
<BaseIcon icon="vuesax-linear:receipt-add" Size="16px" />
|
||||||
|
</BaseButton>
|
||||||
|
<BaseButton
|
||||||
|
v-if="!customerId && isStoreApp()"
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
class="flex"
|
||||||
|
@click="emits('add', 'discount')"
|
||||||
|
>
|
||||||
|
<div>افزودن کد تخفیف</div>
|
||||||
|
<BaseIcon icon="vuesax-linear:discount-circle" Size="16px" />
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #action="{ column, record }">
|
<template #action="{ column, record }">
|
||||||
<div class="gap-2 flex justify-center">
|
<div class="gap-2 flex justify-center">
|
||||||
@@ -26,7 +38,7 @@
|
|||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('giftcardcodes', record)">
|
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('giftcardcodes', record)">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span>کدهای کارت هدیه</span>
|
<span>کدهای {{ record.unit == 3 ? 'تخفیف' : 'کارت هدیه' }}</span>
|
||||||
</template>
|
</template>
|
||||||
<Icon icon="vuesax-linear:document-text" color="#1890ff" />
|
<Icon icon="vuesax-linear:document-text" color="#1890ff" />
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
@@ -55,6 +67,7 @@ import { usePrefix } from '@core/composable/usePrefix'
|
|||||||
import { getGiftCardTable } from '@/api/giftCard'
|
import { getGiftCardTable } from '@/api/giftCard'
|
||||||
import GiftCardMobileCardList from './GiftCardMobileCardList.vue'
|
import GiftCardMobileCardList from './GiftCardMobileCardList.vue'
|
||||||
import { isMobile } from '@core/utils/is'
|
import { isMobile } from '@core/utils/is'
|
||||||
|
import { isStoreApp } from '@/utils/config'
|
||||||
|
|
||||||
interface Prop {
|
interface Prop {
|
||||||
customerId?: number
|
customerId?: number
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
@info="info"
|
@info="info"
|
||||||
@edit="edit"
|
@edit="edit"
|
||||||
@delete="deleteItem"
|
@delete="deleteItem"
|
||||||
@add="add"
|
@add="addGiftOrDiscount"
|
||||||
@giftcardcodes="showGiftCardCodes"
|
@giftcardcodes="showGiftCardCodes"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -17,6 +17,40 @@
|
|||||||
<!-- <BasicShowContext title="پروژه ها"> <Search /> </BasicShowContext>-->
|
<!-- <BasicShowContext title="پروژه ها"> <Search /> </BasicShowContext>-->
|
||||||
</div>
|
</div>
|
||||||
</BasicMainCard>
|
</BasicMainCard>
|
||||||
|
<BasicActionSheet
|
||||||
|
v-model:visible="addDiscountVisible"
|
||||||
|
:title="discountSheetTitle"
|
||||||
|
modal-width="30rem"
|
||||||
|
drawer-height="90vh"
|
||||||
|
:loading="loading"
|
||||||
|
:showButton="true"
|
||||||
|
:showCancel="true"
|
||||||
|
:showOk="true"
|
||||||
|
ok-text="ثبت"
|
||||||
|
cancel-text="انصراف"
|
||||||
|
@ok="okDiscount"
|
||||||
|
@close="closeDiscountSheet"
|
||||||
|
@cancel="closeDiscountSheet"
|
||||||
|
>
|
||||||
|
<div v-if="isMobile" class="mb-3 text-base font-700">{{ discountSheetTitle }}</div>
|
||||||
|
<a-form :model="discountForm" ref="discountFormRef" autocomplete="off" layout="vertical">
|
||||||
|
<a-form-item label="نام پویش" name="name" :rules="inputRules()">
|
||||||
|
<BasicInput v-model:value="discountForm.name" placeholder="نام پویش" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="درصد تخفیف" name="amount" :rules="inputRulesNumber()">
|
||||||
|
<BasicInput v-model:value="discountForm.amount" type="tel" placeholder="مثلاً 10" addon-before="%" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="تعداد کدها" name="count" :rules="inputRulesNumber()">
|
||||||
|
<BasicInput v-model:value="discountForm.count" type="tel" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="تاریخ انقضا" name="expiry_date" :rules="inputRules()">
|
||||||
|
<BaseDatePicker v-model:value="discountForm.expiry_date" format="YYYY-MM-DD" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="توضیحات" name="description">
|
||||||
|
<BasicTextArea v-model:value="discountForm.description" place-holder="توضیحات اختیاری" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</BasicActionSheet>
|
||||||
<BasicActionSheet
|
<BasicActionSheet
|
||||||
v-model:visible="addGiftCardVisible"
|
v-model:visible="addGiftCardVisible"
|
||||||
:title="giftCardSheetTitle"
|
:title="giftCardSheetTitle"
|
||||||
@@ -72,6 +106,11 @@ import type { Giftcard, Giftcardcode, GiftcardInput } from '@/model/giftCard'
|
|||||||
import { createGiftCard } from '@/api/giftCard'
|
import { createGiftCard } from '@/api/giftCard'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { isMobile } from '@core/utils/is'
|
import { isMobile } from '@core/utils/is'
|
||||||
|
import { isStoreApp } from '@/utils/config'
|
||||||
|
import { inputRules, inputRulesNumber } from '@/utils/inputRules'
|
||||||
|
import BasicInput from '@core/components/BasicInput/src/BasicInput.vue'
|
||||||
|
import BasicTextArea from '@core/components/BasicTextArea/src/BasicTextArea.vue'
|
||||||
|
import BaseDatePicker from '@core/components/BaseDatePicker/src/BaseDatePicker.vue'
|
||||||
|
|
||||||
//loading
|
//loading
|
||||||
const loading = ref<boolean>(false)
|
const loading = ref<boolean>(false)
|
||||||
@@ -89,6 +128,16 @@ const giftCardEditorRef = ref<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
const giftCardSheetTitle = computed(() => `${editId ? 'ویرایش' : 'افزودن'} کارت هدیه`)
|
const giftCardSheetTitle = computed(() => `${editId ? 'ویرایش' : 'افزودن'} کارت هدیه`)
|
||||||
|
const discountSheetTitle = computed(() => `${editId ? 'ویرایش' : 'افزودن'} کد تخفیف`)
|
||||||
|
const addDiscountVisible = ref(false)
|
||||||
|
const discountFormRef = ref<FormInstance>()
|
||||||
|
const discountForm = ref({
|
||||||
|
name: '',
|
||||||
|
count: undefined as number | undefined,
|
||||||
|
amount: undefined as number | undefined,
|
||||||
|
expiry_date: '',
|
||||||
|
description: ''
|
||||||
|
})
|
||||||
|
|
||||||
function closeGiftCardSheet() {
|
function closeGiftCardSheet() {
|
||||||
addGiftCardVisible.value = false
|
addGiftCardVisible.value = false
|
||||||
@@ -125,7 +174,7 @@ function info(val: Giftcard) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'نوع کارت هدیه',
|
key: 'نوع کارت هدیه',
|
||||||
value: val.unit === 2 ? 'طلایی' : 'ریالی'
|
value: val.unit === 3 ? 'تخفیف' : val.unit === 2 ? 'طلایی' : 'ریالی'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'تعداد کدها',
|
key: 'تعداد کدها',
|
||||||
@@ -194,9 +243,57 @@ async function edit(record: Giftcard) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeDiscountSheet() {
|
||||||
|
addDiscountVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetDiscountData() {
|
||||||
|
discountForm.value = {
|
||||||
|
name: '',
|
||||||
|
count: undefined,
|
||||||
|
amount: undefined,
|
||||||
|
expiry_date: '',
|
||||||
|
description: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function okDiscount() {
|
||||||
|
await discountFormRef.value?.validateFields?.().then(async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const formData: any = {
|
||||||
|
...discountForm.value,
|
||||||
|
unit: '3',
|
||||||
|
use_once: 0
|
||||||
|
}
|
||||||
|
if (formData.expiry_date) {
|
||||||
|
formData.expiry_date = dayjs(formData.expiry_date)
|
||||||
|
.calendar('gregory')
|
||||||
|
.endOf('day')
|
||||||
|
.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
}
|
||||||
|
await createGiftCard(formData)
|
||||||
|
message.success('کد تخفیف با موفقیت ثبت شد')
|
||||||
|
addDiscountVisible.value = false
|
||||||
|
resetDiscountData()
|
||||||
|
refreshTable()
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
message.error('خطا در ثبت کد تخفیف')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//add
|
//add
|
||||||
async function add() {
|
async function addGiftOrDiscount(type: 'gift' | 'discount' = 'gift') {
|
||||||
editId = undefined
|
editId = undefined
|
||||||
|
if (type === 'discount' && isStoreApp()) {
|
||||||
|
resetDiscountData()
|
||||||
|
addDiscountVisible.value = true
|
||||||
|
return
|
||||||
|
}
|
||||||
resetData()
|
resetData()
|
||||||
addGiftCardVisible.value = true
|
addGiftCardVisible.value = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="h-full min-h-0 min-w-0 overflow-hidden">
|
<CustomersStoreView v-if="isStoreApp()" />
|
||||||
|
<div v-else class="h-full min-h-0 min-w-0 overflow-hidden">
|
||||||
<tbl ref="table" class="h-full min-h-0 w-full" @edit="edit" @add="add" />
|
<tbl ref="table" class="h-full min-h-0 w-full" @edit="edit" @add="add" />
|
||||||
<BasicActionSheet
|
<BasicActionSheet
|
||||||
v-model:visible="addUserVisible"
|
v-model:visible="addUserVisible"
|
||||||
@@ -56,6 +57,8 @@ import { cloneDeep } from 'lodash'
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
||||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||||
|
import CustomersStoreView from '@/pages/menuPages/customers/base/index.vue'
|
||||||
|
import { isStoreApp } from '@/utils/config'
|
||||||
import { createProduct, getCustomerById, updateCustomer } from '@/api/product'
|
import { createProduct, getCustomerById, updateCustomer } from '@/api/product'
|
||||||
import { fetchProductImageUrl } from '@/api/file'
|
import { fetchProductImageUrl } from '@/api/file'
|
||||||
import { getLastPrice, methodePrices } from '@/api/price'
|
import { getLastPrice, methodePrices } from '@/api/price'
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@
|
|||||||
//import router from '@/core/router/index'
|
//import router from '@/core/router/index'
|
||||||
import { useRouterStore } from '@core/stores/router'
|
import { useRouterStore } from '@core/stores/router'
|
||||||
import type { Router, RouteRecordRaw } from 'vue-router'
|
import type { Router, RouteRecordRaw } from 'vue-router'
|
||||||
import { getConfigApp } from '@/utils/config'
|
import { getConfigApp, isStoreApp } from '@/utils/config'
|
||||||
//const _router = useRouter()
|
//const _router = useRouter()
|
||||||
//import { cloneDeep } from 'lodash'
|
//import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
@@ -48,10 +48,10 @@ export function setupRoutes(permissionsKeys: string[], router?: Router) {
|
|||||||
if (!routes.children) return
|
if (!routes.children) return
|
||||||
routes.children = routes.children.filter((item) => {
|
routes.children = routes.children.filter((item) => {
|
||||||
|
|
||||||
if (item.name === 'discounts' && appName !== 'goldsun') return false
|
if (item.name === 'discounts' && (isStoreApp() || appName !== 'goldsun')) return false
|
||||||
if (item.name === 'banners' && appName !== 'garoosi') return false
|
if (item.name === 'banners' && appName !== 'garoosi') return false
|
||||||
if (item.name === 'authentication' && appName !== 'garoosi') return false
|
if (item.name === 'authentication' && appName !== 'garoosi') return false
|
||||||
if (item.name === 'giftCardMain' && appName !== 'garoosi') return false
|
if (item.name === 'giftCardMain' && !isStoreApp() && appName !== 'garoosi') return false
|
||||||
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { RouteRecordRaw } from 'vue-router'
|
import type { RouteRecordRaw } from 'vue-router'
|
||||||
import {getConfigApp} from "@/utils/config";
|
import { getConfigApp, isStoreApp } from '@/utils/config'
|
||||||
|
|
||||||
const Orders: RouteRecordRaw = {
|
const Orders: RouteRecordRaw = {
|
||||||
name: 'giftCard',
|
name: 'giftCard',
|
||||||
@@ -9,9 +9,9 @@ const Orders: RouteRecordRaw = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: 'vuesax-linear:gift',
|
icon: 'vuesax-linear:gift',
|
||||||
permissionsKey: 'giftCard',
|
permissionsKey: 'giftCard',
|
||||||
title: 'کارت هدیه',
|
title: isStoreApp() ? 'کارت هدیه و تخفیف' : 'کارت هدیه',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
hideMenu: getConfigApp('name')!='garoosi',
|
hideMenu: !isStoreApp() && getConfigApp('name') != 'garoosi',
|
||||||
hideChildren: true,
|
hideChildren: true,
|
||||||
order: 7
|
order: 7
|
||||||
},
|
},
|
||||||
@@ -24,7 +24,7 @@ const Orders: RouteRecordRaw = {
|
|||||||
permissionsKey: 'project',
|
permissionsKey: 'project',
|
||||||
icon: 'vuesax-linear:empty-wallet-time',
|
icon: 'vuesax-linear:empty-wallet-time',
|
||||||
order: 3,
|
order: 3,
|
||||||
title: 'کارت هدیه',
|
title: isStoreApp() ? 'کارت هدیه و تخفیف' : 'کارت هدیه',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
hideMenu: false
|
hideMenu: false
|
||||||
//hideChildren: false
|
//hideChildren: false
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { RouteRecordRaw } from 'vue-router'
|
import type { RouteRecordRaw } from 'vue-router'
|
||||||
import {getConfigApp} from "@/utils/config";
|
import { getConfigApp, isStoreApp } from '@/utils/config'
|
||||||
const Setting: RouteRecordRaw = {
|
const Setting: RouteRecordRaw = {
|
||||||
name: 'settings',
|
name: 'settings',
|
||||||
path: '/settings',
|
path: '/settings',
|
||||||
@@ -70,7 +70,7 @@ const Setting: RouteRecordRaw = {
|
|||||||
permissionsKey: 'discounts',
|
permissionsKey: 'discounts',
|
||||||
icon: 'vuesax-linear:discount-shape',
|
icon: 'vuesax-linear:discount-shape',
|
||||||
title: 'تخفیفات',
|
title: 'تخفیفات',
|
||||||
hideMenu: getConfigApp('name') !== "goldsun"
|
hideMenu: isStoreApp() || getConfigApp('name') !== 'goldsun'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,3 +7,12 @@ export function getConfigApp(key: string) {
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isStoreApp(): boolean {
|
||||||
|
const value = getConfigApp('is_store')
|
||||||
|
if (value === true || value === 1) return true
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return ['true', '1', 'yes'].includes(value.trim().toLowerCase())
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user