create coupon section
This commit is contained in:
Vendored
+7
@@ -15,15 +15,19 @@ declare module 'vue' {
|
|||||||
CouponDetails: typeof import('./src/components/CouponDetails.vue')['default']
|
CouponDetails: typeof import('./src/components/CouponDetails.vue')['default']
|
||||||
DataTable: typeof import('primevue/datatable')['default']
|
DataTable: typeof import('primevue/datatable')['default']
|
||||||
Dropdown: typeof import('primevue/dropdown')['default']
|
Dropdown: typeof import('primevue/dropdown')['default']
|
||||||
|
Editor: typeof import('primevue/editor')['default']
|
||||||
FirstStep: typeof import('./src/components/ProductFormSteps/FirstStep.vue')['default']
|
FirstStep: typeof import('./src/components/ProductFormSteps/FirstStep.vue')['default']
|
||||||
FloatLabel: typeof import('primevue/floatlabel')['default']
|
FloatLabel: typeof import('primevue/floatlabel')['default']
|
||||||
|
Galleria: typeof import('primevue/galleria')['default']
|
||||||
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
||||||
IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
|
IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
|
||||||
IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default']
|
IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default']
|
||||||
IconEcosystem: typeof import('./src/components/icons/IconEcosystem.vue')['default']
|
IconEcosystem: typeof import('./src/components/icons/IconEcosystem.vue')['default']
|
||||||
IconSupport: typeof import('./src/components/icons/IconSupport.vue')['default']
|
IconSupport: typeof import('./src/components/icons/IconSupport.vue')['default']
|
||||||
IconTooling: typeof import('./src/components/icons/IconTooling.vue')['default']
|
IconTooling: typeof import('./src/components/icons/IconTooling.vue')['default']
|
||||||
|
InputGroup: typeof import('primevue/inputgroup')['default']
|
||||||
InputText: typeof import('primevue/inputtext')['default']
|
InputText: typeof import('primevue/inputtext')['default']
|
||||||
|
Listbox: typeof import('primevue/listbox')['default']
|
||||||
Menu: typeof import('primevue/menu')['default']
|
Menu: typeof import('primevue/menu')['default']
|
||||||
OverlayPanel: typeof import('primevue/overlaypanel')['default']
|
OverlayPanel: typeof import('primevue/overlaypanel')['default']
|
||||||
Pagination: typeof import('./src/components/Pagination.vue')['default']
|
Pagination: typeof import('./src/components/Pagination.vue')['default']
|
||||||
@@ -36,9 +40,12 @@ declare module 'vue' {
|
|||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
SecondStep: typeof import('./src/components/ProductFormSteps/SecondStep.vue')['default']
|
SecondStep: typeof import('./src/components/ProductFormSteps/SecondStep.vue')['default']
|
||||||
Sidebar: typeof import('primevue/sidebar')['default']
|
Sidebar: typeof import('primevue/sidebar')['default']
|
||||||
|
Textarea: typeof import('primevue/textarea')['default']
|
||||||
TheWelcome: typeof import('./src/components/TheWelcome.vue')['default']
|
TheWelcome: typeof import('./src/components/TheWelcome.vue')['default']
|
||||||
ThirdStep: typeof import('./src/components/ProductFormSteps/ThirdStep.vue')['default']
|
ThirdStep: typeof import('./src/components/ProductFormSteps/ThirdStep.vue')['default']
|
||||||
|
ToggleButton: typeof import('primevue/togglebutton')['default']
|
||||||
Toolbar: typeof import('primevue/toolbar')['default']
|
Toolbar: typeof import('primevue/toolbar')['default']
|
||||||
|
TreeTable: typeof import('primevue/treetable')['default']
|
||||||
UserDetails: typeof import('./src/components/UserDetails.vue')['default']
|
UserDetails: typeof import('./src/components/UserDetails.vue')['default']
|
||||||
WelcomeItem: typeof import('./src/components/WelcomeItem.vue')['default']
|
WelcomeItem: typeof import('./src/components/WelcomeItem.vue')['default']
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="flex items-center justify-between">
|
<li class="flex items-center justify-between">
|
||||||
<strong>{{ $t('تغییر وضعیت') }}</strong>
|
<strong>{{ $t('تغییر وضعیت') }}</strong>
|
||||||
<ToggleButton v-model="checked" onLabel="فعال" offLabel="غیرفعال" />
|
<ToggleButton @change="changeStatus" v-model="checked" onLabel="فعال" offLabel="غیرفعال" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@@ -48,8 +48,18 @@
|
|||||||
import { inject, reactive } from 'vue';
|
import { inject, reactive } from 'vue';
|
||||||
import { jDate } from '@/utils/jDate';
|
import { jDate } from '@/utils/jDate';
|
||||||
import { numberFormat } from '@/utils/numberFormat';
|
import { numberFormat } from '@/utils/numberFormat';
|
||||||
|
import {useDiscountStore} from '../stores/discounts'
|
||||||
|
const store = useDiscountStore()
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
const checked = ref(false);
|
const checked = ref(false);
|
||||||
|
const changeStatus = async() => {
|
||||||
|
const change = await store.changeStatus({
|
||||||
|
id: coupon.coupon.id,
|
||||||
|
status: 'Active'
|
||||||
|
})
|
||||||
|
console.log(change);
|
||||||
|
|
||||||
|
};
|
||||||
const tabs = ref([
|
const tabs = ref([
|
||||||
{ title: 'Tab 1', content: 'Tab 1 Content', value: '0' },
|
{ title: 'Tab 1', content: 'Tab 1 Content', value: '0' },
|
||||||
{ title: 'Tab 2', content: 'Tab 2 Content', value: '1' },
|
{ title: 'Tab 2', content: 'Tab 2 Content', value: '1' },
|
||||||
|
|||||||
+45
-35
@@ -77,6 +77,11 @@ const items = ref([
|
|||||||
icon: 'pi pi-exclamation-circle',
|
icon: 'pi pi-exclamation-circle',
|
||||||
command: () => router.push('/pages/about-us')
|
command: () => router.push('/pages/about-us')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: t('سوالات متداول'),
|
||||||
|
icon: 'pi pi-exclamation-circle',
|
||||||
|
command: () => router.push('/pages/Faq')
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// label: t('contactUs'),
|
// label: t('contactUs'),
|
||||||
// icon: 'pi pi-sitemap',
|
// icon: 'pi pi-sitemap',
|
||||||
@@ -107,57 +112,62 @@ const items = ref([
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('users'),
|
label: t('coupons'),
|
||||||
icon: 'pi pi-users',
|
icon: 'pi pi-barcode',
|
||||||
command: () => router.push('/users')
|
items: [
|
||||||
|
{
|
||||||
|
label: t('همه ی تخفیف ها'),
|
||||||
|
icon: 'pi pi-angle-double-down',
|
||||||
|
command: () => router.push('/Coupons')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('ایجاد تخفیف جدید'),
|
||||||
|
icon: 'pi pi-plus-circle',
|
||||||
|
command: () => router.push('/createCoupon')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('تاریخچه ی تخفیف ها'),
|
||||||
|
icon: 'pi pi-history',
|
||||||
|
command: () => router.push('/Coupons')
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('categories'),
|
label: t('categories'),
|
||||||
icon: 'pi pi-th-large',
|
icon: 'pi pi-th-large',
|
||||||
command: () => router.push('/categories')
|
command: () => router.push('/categories')
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: t('coupons'),
|
|
||||||
icon: 'pi pi-barcode',
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
label: t('ایجاد تخفیف'),
|
|
||||||
icon: 'pi pi-barcode',
|
|
||||||
command: () => router.push('/createCoupon')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('همه ی تخفیف ها'),
|
|
||||||
icon: 'pi pi-barcode',
|
|
||||||
command: () => router.push('/Coupons')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('تاریخچه ی تخفیف ها'),
|
|
||||||
icon: 'pi pi-barcode',
|
|
||||||
command: () => router.push('/Coupons')
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: t('admins'),
|
label: t('admins'),
|
||||||
icon: 'pi pi-sitemap',
|
icon: 'pi pi-sitemap',
|
||||||
command: () => router.push('/admins')
|
command: () => router.push('/admins')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: t('users'),
|
||||||
|
icon: 'pi pi-users',
|
||||||
|
command: () => router.push('/users')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('تیکت ها'),
|
||||||
|
icon: 'pi pi-envelope',
|
||||||
|
command: () => router.push('/tickets')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('comments'),
|
label: t('comments'),
|
||||||
icon: 'pi pi-sitemap',
|
icon: 'pi pi-sitemap',
|
||||||
command: () => router.push('/comments')
|
command: () => router.push('/comments')
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: t('orders'),
|
// label: t('orders'),
|
||||||
icon: 'pi pi-sitemap',
|
// icon: 'pi pi-sitemap',
|
||||||
command: () => router.push('/orders')
|
// command: () => router.push('/orders')
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
label: t('products'),
|
// label: t('products'),
|
||||||
icon: 'pi pi-sitemap',
|
// icon: 'pi pi-sitemap',
|
||||||
command: () => router.push('/products')
|
// command: () => router.push('/products')
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// label: t('brands'),
|
// label: t('brands'),
|
||||||
// icon: 'pi pi-apple',
|
// icon: 'pi pi-apple',
|
||||||
|
|||||||
+11
-1
@@ -83,6 +83,11 @@ const router = createRouter({
|
|||||||
name: 'EditCoupon',
|
name: 'EditCoupon',
|
||||||
component: () => import('@/views/EditCoupon.vue'),
|
component: () => import('@/views/EditCoupon.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/tickets',
|
||||||
|
name: 'Tickets',
|
||||||
|
component: () => import('@/views/Tickets.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/pages',
|
path: '/pages',
|
||||||
children: [
|
children: [
|
||||||
@@ -95,7 +100,12 @@ const router = createRouter({
|
|||||||
path: 'about-us',
|
path: 'about-us',
|
||||||
name: 'about-us',
|
name: 'about-us',
|
||||||
component: () => import('@/views/About.vue')
|
component: () => import('@/views/About.vue')
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
path: 'faq',
|
||||||
|
name: 'Faq',
|
||||||
|
component: () => import('@/views/Faq.vue')
|
||||||
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ export const useDiscountStore = defineStore('discounts', {
|
|||||||
return this.items = data
|
return this.items = data
|
||||||
|
|
||||||
},
|
},
|
||||||
|
async add(form) {
|
||||||
|
this.fetching = true
|
||||||
|
const { status, data } = await axios.post('/admins/discount', form)
|
||||||
|
this.fetching = false
|
||||||
|
return data
|
||||||
|
},
|
||||||
async getDiscount(id) {
|
async getDiscount(id) {
|
||||||
this.items = [];
|
this.items = [];
|
||||||
this.fetching = true
|
this.fetching = true
|
||||||
@@ -26,6 +32,16 @@ export const useDiscountStore = defineStore('discounts', {
|
|||||||
return this.items = data
|
return this.items = data
|
||||||
|
|
||||||
},
|
},
|
||||||
|
async update(form) {
|
||||||
|
const { status, data } = await axios.put('/admins/discount', form)
|
||||||
|
this.fetching = false
|
||||||
|
return data
|
||||||
|
},
|
||||||
|
async changeStatus(form) {
|
||||||
|
const { status, data } = await axios.patch('/admins/discount/status', form)
|
||||||
|
this.fetching = false
|
||||||
|
return data
|
||||||
|
}
|
||||||
// async create(newCourse) {
|
// async create(newCourse) {
|
||||||
// const { status, data } = await axios.post('/course', newCourse)
|
// const { status, data } = await axios.post('/course', newCourse)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import axios from '../plugins/axios'
|
||||||
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
|
export const useFaqStore = defineStore('faq', {
|
||||||
|
state: () => ({
|
||||||
|
items: [],
|
||||||
|
fetching: true,
|
||||||
|
total: 0
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
async index(page, pageSize) {
|
||||||
|
this.items = [];
|
||||||
|
this.fetching = true
|
||||||
|
|
||||||
|
const params = { page, pageSize }
|
||||||
|
const { status, data } = await axios.get('/admin/user/list', { params })
|
||||||
|
|
||||||
|
this.fetching = false
|
||||||
|
this.total = 30
|
||||||
|
this.items = data;
|
||||||
|
|
||||||
|
},
|
||||||
|
async confirm(item, value) {
|
||||||
|
item.confirming = true
|
||||||
|
const result = await axios.put(`/admin/users/seller/${item.id}`, { confirmToSales: value })
|
||||||
|
item.confirming = false
|
||||||
|
|
||||||
|
if (result.status === 200) {
|
||||||
|
const index = this.items.findIndex(({ _id }) => _id == item.id)
|
||||||
|
if (index >= 0)
|
||||||
|
this.items.splice(index, 1)
|
||||||
|
else
|
||||||
|
this.items.unshift(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
+7
-30
@@ -1,56 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="flex flex-col gap-4">
|
<section class="flex flex-col gap-4">
|
||||||
<Panel :header="$t('اطلاعات صفحه ی درباره ما')">
|
<Panel :header="$t('اطلاعات صفحه ی درباره ما')">
|
||||||
<div class="grid grid-cols-1 gap-7">
|
<div class="grid grid-cols-2 gap-7">
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full" v-model="data.title" />
|
<InputText class="w-full" v-model="data.title" />
|
||||||
<label>{{ $t("متن هدر") }}</label>
|
<label>{{ $t("حوزه های تخصصی") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<Textarea v-model="data.description" rows="5" class="w-full" />
|
<InputText class="w-full" v-model="data.title" />
|
||||||
<label>{{ $t("توضیحات هدر") }}</label>
|
<label>{{ $t("تعداد دانشجو ها") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-3 gap-7 mt-7">
|
<div class="grid grid-cols-2 gap-7 mt-7">
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText v-model="data.student" class="w-full" />
|
<InputText v-model="data.student" class="w-full" />
|
||||||
<label>{{ $t("تعداد دانشجو ها") }}</label>
|
<label>{{ $t("تعداد عناوین آموزشی") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full" v-model="data.videosCount" />
|
<InputText class="w-full" v-model="data.videosCount" />
|
||||||
<label>{{ $t("تعداد ویدیو های آموزشی") }}</label>
|
<label>{{ $t("تعداد ساعات آموزشی") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1">
|
|
||||||
<FloatLabel>
|
|
||||||
<InputText class="w-full" v-model="data.rates" />
|
|
||||||
<label>{{ $t("امتیاز دانشجو ها") }}</label>
|
|
||||||
</FloatLabel>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p class="mt-7 text-lg">درباره ما :</p>
|
|
||||||
<div class="mt-2">
|
|
||||||
<FloatLabel>
|
|
||||||
<Editor v-model="data.about" editorStyle="height: 320px">
|
|
||||||
<template v-slot:toolbar>
|
|
||||||
<span class="ql-formats text-start justify-center w-full flex">
|
|
||||||
<button v-tooltip.bottom="'Bold'" class="ql-bold"></button>
|
|
||||||
<button v-tooltip.bottom="'Italic'" class="ql-italic"></button>
|
|
||||||
<button
|
|
||||||
v-tooltip.bottom="'Underline'"
|
|
||||||
class="ql-underline"
|
|
||||||
></button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</Editor>
|
|
||||||
</FloatLabel>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex pt-4 justify-end">
|
<div class="flex pt-4 justify-end">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ const show = (coupon) => {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const edit = (data) =>{
|
const edit = (data) =>{
|
||||||
console.log(data.id);
|
console.log(data.id);
|
||||||
router.push(`/coupon/${data.id}`)
|
router.push(`/coupon/${data.id}`)
|
||||||
}
|
}
|
||||||
watchEffect( async() =>{
|
watchEffect( async() =>{
|
||||||
await store.index()
|
await store.index()
|
||||||
|
|||||||
+33
-25
@@ -4,7 +4,7 @@
|
|||||||
<div class="grid grid-cols-3 gap-7">
|
<div class="grid grid-cols-3 gap-7">
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full custom-input" v-model="date" />
|
<InputText class="w-full custom-input" v-model="coupon.startDate" />
|
||||||
<label>{{ $t("تاریخ شروع") }}</label>
|
<label>{{ $t("تاریخ شروع") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
<date-picker
|
<date-picker
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
display-format="jYYYY-jMM-jDD HH:mm"
|
display-format="jYYYY-jMM-jDD HH:mm"
|
||||||
:timezone="true"
|
:timezone="true"
|
||||||
color="dimgray"
|
color="dimgray"
|
||||||
v-model="date"
|
v-model="coupon.startDate"
|
||||||
simple
|
simple
|
||||||
custom-input=".custom-input"
|
custom-input=".custom-input"
|
||||||
></date-picker>
|
></date-picker>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full custom-input2" v-model="date2" />
|
<InputText class="w-full custom-input2" v-model="coupon.endDate" />
|
||||||
<label>{{ $t("تاریخ پایان") }}</label>
|
<label>{{ $t("تاریخ پایان") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
<date-picker
|
<date-picker
|
||||||
@@ -30,14 +30,14 @@
|
|||||||
display-format="jYYYY-jMM-jDD HH:mm"
|
display-format="jYYYY-jMM-jDD HH:mm"
|
||||||
:timezone="true"
|
:timezone="true"
|
||||||
color="dimgray"
|
color="dimgray"
|
||||||
v-model="date2"
|
v-model="coupon.endDate"
|
||||||
simple
|
simple
|
||||||
custom-input=".custom-input2"
|
custom-input=".custom-input2"
|
||||||
></date-picker>
|
></date-picker>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full" v-model="course.duration" />
|
<InputText class="w-full" v-model="coupon.code" />
|
||||||
<label>{{ $t("کد تخفیف") }}</label>
|
<label>{{ $t("کد تخفیف") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div>
|
||||||
@@ -45,7 +45,8 @@
|
|||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
v-model="noe"
|
v-model="type"
|
||||||
|
@change="setType"
|
||||||
:options="['مبلغ', 'درصد']"
|
:options="['مبلغ', 'درصد']"
|
||||||
:optionLabel="levels"
|
:optionLabel="levels"
|
||||||
:optionValue="levels"
|
:optionValue="levels"
|
||||||
@@ -56,24 +57,24 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="noe === 'مبلغ'" class="flex flex-col gap-1">
|
<div v-if="noe === 'مبلغ'" class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full" />
|
<InputText class="w-full" v-model="coupon.price"/>
|
||||||
<label>{{ $t("مبلغ تخفیف") }}</label>
|
<label>{{ $t("مبلغ تخفیف") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="noe === 'درصد'" class="flex flex-col gap-1">
|
<div v-if="noe === 'درصد'" class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full" />
|
<InputText class="w-full" v-model="coupon.percent"/>
|
||||||
<label>{{ $t("درصد تخفیف") }}</label>
|
<label>{{ $t("درصد تخفیف") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-1 my-custom-container inline">
|
<!-- <div class="flex flex-col gap-1 my-custom-container inline">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full" />
|
<InputText class="w-full" />
|
||||||
<label>{{ $t("تخفیف برای همه کاربران") }}</label>
|
<label>{{ $t("تخفیف برای همه کاربران") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex pt-4 justify-end">
|
<div class="flex pt-4 justify-end">
|
||||||
@@ -82,7 +83,7 @@
|
|||||||
icon="pi pi-save"
|
icon="pi pi-save"
|
||||||
severity="success"
|
severity="success"
|
||||||
:loading="saving"
|
:loading="saving"
|
||||||
@click="create(course)"
|
@click="create(coupon)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Panel>
|
</Panel>
|
||||||
@@ -91,28 +92,35 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useProductsStore } from "@/stores/products";
|
import { useProductsStore } from "@/stores/products";
|
||||||
|
import { useDiscountStore } from "@/stores/discounts"
|
||||||
import { ref, watchEffect, reactive } from "vue";
|
import { ref, watchEffect, reactive } from "vue";
|
||||||
import moment from 'moment-jalaali'
|
import moment from 'moment-jalaali'
|
||||||
const date= ref(null)
|
const date= ref(null)
|
||||||
const date2= ref(null)
|
const date2= ref(null)
|
||||||
const noe = ref('مبلغ')
|
const noe = ref('مبلغ')
|
||||||
const store = useProductsStore();
|
const store = useProductsStore();
|
||||||
|
const discount = useDiscountStore();
|
||||||
const data = ref(null);
|
const data = ref(null);
|
||||||
const course = reactive({
|
const type = ref(null);
|
||||||
name: "",
|
const setType = (val) => {
|
||||||
description: "",
|
if (val.value === 'درصد') {
|
||||||
slug: "",
|
coupon.discountType = 'percent'
|
||||||
duration: "",
|
}else{
|
||||||
image: "",
|
coupon.discountType = 'price'
|
||||||
categories: "",
|
}
|
||||||
price: 0,
|
}
|
||||||
teacher: "",
|
const coupon = reactive({
|
||||||
completionPercentage: 0,
|
startDate: "",
|
||||||
level: "",
|
endDate: "",
|
||||||
language: "",
|
code: "",
|
||||||
countOfVideos: 0,
|
discountType: type.value,
|
||||||
totalFileSize: "",
|
price: "",
|
||||||
|
percent: null,
|
||||||
|
allUsers: true
|
||||||
});
|
});
|
||||||
|
const create = async(coupon) => {
|
||||||
|
const datas = await discount.add(coupon)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
+124
-112
@@ -1,123 +1,135 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="flex flex-col gap-4">
|
<section class="flex flex-col gap-4">
|
||||||
<Panel :header="$t('ویرایش تخفیف')">
|
<Panel :header="$t('ویرایش تخفیف')">
|
||||||
<div class="grid grid-cols-3 gap-7">
|
<div class="grid grid-cols-3 gap-7">
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full custom-input" v-model="date" />
|
<InputText class="w-full custom-input" v-model="date" />
|
||||||
<label>{{ $t("تاریخ شروع") }}</label>
|
<label>{{ $t("تاریخ شروع") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
<date-picker
|
<date-picker
|
||||||
type="datetime"
|
type="datetime"
|
||||||
format="YYYY-MM-DD HH:mm"
|
format="YYYY-MM-DD HH:mm"
|
||||||
display-format="jYYYY-jMM-jDD HH:mm"
|
display-format="jYYYY-jMM-jDD HH:mm"
|
||||||
:timezone="true"
|
:timezone="true"
|
||||||
color="dimgray"
|
color="dimgray"
|
||||||
v-model="date"
|
v-model="date"
|
||||||
simple
|
simple
|
||||||
custom-input=".custom-input"
|
custom-input=".custom-input"
|
||||||
></date-picker>
|
></date-picker>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full custom-input2" v-model="date2" />
|
<InputText class="w-full custom-input2" v-model="date2" />
|
||||||
<label>{{ $t("تاریخ پایان") }}</label>
|
<label>{{ $t("تاریخ پایان") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
<date-picker
|
<date-picker
|
||||||
type="datetime"
|
type="datetime"
|
||||||
format="YYYY-MM-DD HH:mm"
|
format="YYYY-MM-DD HH:mm"
|
||||||
display-format="jYYYY-jMM-jDD HH:mm"
|
display-format="jYYYY-jMM-jDD HH:mm"
|
||||||
:timezone="true"
|
:timezone="true"
|
||||||
color="dimgray"
|
color="dimgray"
|
||||||
v-model="date2"
|
v-model="date2"
|
||||||
simple
|
simple
|
||||||
custom-input=".custom-input2"
|
custom-input=".custom-input2"
|
||||||
></date-picker>
|
></date-picker>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<InputText class="w-full" v-model="course.duration" />
|
<InputText class="w-full" v-model="discount.code" />
|
||||||
<label>{{ $t("کد تخفیف") }}</label>
|
<label>{{ $t("کد تخفیف") }}</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<FloatLabel>
|
<FloatLabel>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
v-model="noe"
|
v-model="noe"
|
||||||
:options="['مبلغ', 'درصد']"
|
@change="setType"
|
||||||
:optionLabel="levels"
|
:options="['مبلغ', 'درصد']"
|
||||||
:optionValue="levels"
|
:optionLabel="levels"
|
||||||
class="w-full"
|
:optionValue="levels"
|
||||||
/>
|
class="w-full"
|
||||||
<label>{{ $t("نوع تخفیف") }}</label>
|
|
||||||
</FloatLabel>
|
|
||||||
</div>
|
|
||||||
<div v-if="noe === 'مبلغ'" class="flex flex-col gap-1">
|
|
||||||
<FloatLabel>
|
|
||||||
<InputText class="w-full" />
|
|
||||||
<label>{{ $t("مبلغ تخفیف") }}</label>
|
|
||||||
</FloatLabel>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="noe === 'درصد'" class="flex flex-col gap-1">
|
|
||||||
<FloatLabel>
|
|
||||||
<InputText class="w-full" />
|
|
||||||
<label>{{ $t("درصد تخفیف") }}</label>
|
|
||||||
</FloatLabel>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-1 my-custom-container inline">
|
|
||||||
<FloatLabel>
|
|
||||||
<InputText class="w-full" />
|
|
||||||
<label>{{ $t("تخفیف برای همه کاربران") }}</label>
|
|
||||||
</FloatLabel>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex pt-4 justify-end">
|
|
||||||
<Button
|
|
||||||
:label="$t('save')"
|
|
||||||
icon="pi pi-save"
|
|
||||||
severity="success"
|
|
||||||
:loading="saving"
|
|
||||||
@click="create(course)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
<label>{{ $t("نوع تخفیف") }}</label>
|
||||||
</Panel>
|
</FloatLabel>
|
||||||
</section>
|
</div>
|
||||||
|
<div v-if="noe === 'مبلغ'" class="flex flex-col gap-1">
|
||||||
|
<FloatLabel>
|
||||||
|
<InputText class="w-full" v-model="discount.price" />
|
||||||
|
<label>{{ $t("مبلغ تخفیف") }}</label>
|
||||||
|
</FloatLabel>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="noe === 'درصد'" class="flex flex-col gap-1">
|
||||||
|
<FloatLabel>
|
||||||
|
<InputText class="w-full" v-model="discount.percent" />
|
||||||
|
<label>{{ $t("درصد تخفیف") }}</label>
|
||||||
|
</FloatLabel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex pt-4 justify-end">
|
||||||
|
<Button
|
||||||
|
:label="$t('save')"
|
||||||
|
icon="pi pi-save"
|
||||||
|
severity="success"
|
||||||
|
:loading="saving"
|
||||||
|
@click="create(discount)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Panel>
|
||||||
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useDiscountStore } from "@/stores/discounts";
|
import { useDiscountStore } from "@/stores/discounts";
|
||||||
import { ref, watchEffect, reactive } from "vue";
|
import { ref, watchEffect, reactive } from "vue";
|
||||||
import moment from 'moment-jalaali'
|
import moment from "moment-jalaali";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
const date= ref(null)
|
const date = ref(null);
|
||||||
const date2= ref(null)
|
const date2 = ref(null);
|
||||||
const noe = ref('مبلغ')
|
const noe = ref("مبلغ");
|
||||||
const store = useDiscountStore();
|
const store = useDiscountStore();
|
||||||
const data = ref(null);
|
const data = ref();
|
||||||
const course = reactive({
|
const setType = (val) => {
|
||||||
name: "",
|
if (val.value === 'درصد') {
|
||||||
description: "",
|
discount.discountType = 'percent'
|
||||||
slug: "",
|
}else{
|
||||||
duration: "",
|
discount.discountType = 'price'
|
||||||
image: "",
|
}
|
||||||
categories: "",
|
}
|
||||||
price: 0,
|
const discount = reactive({
|
||||||
teacher: "",
|
id: "",
|
||||||
completionPercentage: 0,
|
startDate: "",
|
||||||
level: "",
|
endDate: "",
|
||||||
language: "",
|
code: "",
|
||||||
countOfVideos: 0,
|
discountType: "",
|
||||||
totalFileSize: "",
|
price: "",
|
||||||
|
percent: 0,
|
||||||
|
allUsers: true,
|
||||||
|
});
|
||||||
|
const route = useRoute();
|
||||||
|
const create = async(val) => {
|
||||||
|
const posts = await store.update(val)
|
||||||
|
};
|
||||||
|
watchEffect(async () => {
|
||||||
|
data.value = await store.getDiscount(route.params.id);
|
||||||
|
console.log("this", data.value);
|
||||||
|
discount.id = data.value.id;
|
||||||
|
(discount.startDate = data.value.startDate),
|
||||||
|
(discount.endDate = data.value.endDate),
|
||||||
|
(discount.code = data.value.code),
|
||||||
|
(discount.discountType = data.value.discountType),
|
||||||
|
(discount.price = data.value.price),
|
||||||
|
(discount.percent = data.value.percent);
|
||||||
|
date.value = data.value.startDate;
|
||||||
|
date2.value = data.value.endDate;
|
||||||
|
if (data.value.discountType === "percent") {
|
||||||
|
noe.value = "درصد";
|
||||||
|
} else {
|
||||||
|
noe.value = "مبلغ";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const route = useRoute()
|
|
||||||
|
|
||||||
watchEffect(async() =>{
|
|
||||||
data.value = await store.getDiscount(route.params.id)
|
|
||||||
})
|
|
||||||
console.log('this', data);
|
|
||||||
</script>
|
</script>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<template>
|
||||||
|
<h1>س</h1>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<h1>tickets</h1>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user