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']
|
||||
DataTable: typeof import('primevue/datatable')['default']
|
||||
Dropdown: typeof import('primevue/dropdown')['default']
|
||||
Editor: typeof import('primevue/editor')['default']
|
||||
FirstStep: typeof import('./src/components/ProductFormSteps/FirstStep.vue')['default']
|
||||
FloatLabel: typeof import('primevue/floatlabel')['default']
|
||||
Galleria: typeof import('primevue/galleria')['default']
|
||||
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
||||
IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
|
||||
IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default']
|
||||
IconEcosystem: typeof import('./src/components/icons/IconEcosystem.vue')['default']
|
||||
IconSupport: typeof import('./src/components/icons/IconSupport.vue')['default']
|
||||
IconTooling: typeof import('./src/components/icons/IconTooling.vue')['default']
|
||||
InputGroup: typeof import('primevue/inputgroup')['default']
|
||||
InputText: typeof import('primevue/inputtext')['default']
|
||||
Listbox: typeof import('primevue/listbox')['default']
|
||||
Menu: typeof import('primevue/menu')['default']
|
||||
OverlayPanel: typeof import('primevue/overlaypanel')['default']
|
||||
Pagination: typeof import('./src/components/Pagination.vue')['default']
|
||||
@@ -36,9 +40,12 @@ declare module 'vue' {
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
SecondStep: typeof import('./src/components/ProductFormSteps/SecondStep.vue')['default']
|
||||
Sidebar: typeof import('primevue/sidebar')['default']
|
||||
Textarea: typeof import('primevue/textarea')['default']
|
||||
TheWelcome: typeof import('./src/components/TheWelcome.vue')['default']
|
||||
ThirdStep: typeof import('./src/components/ProductFormSteps/ThirdStep.vue')['default']
|
||||
ToggleButton: typeof import('primevue/togglebutton')['default']
|
||||
Toolbar: typeof import('primevue/toolbar')['default']
|
||||
TreeTable: typeof import('primevue/treetable')['default']
|
||||
UserDetails: typeof import('./src/components/UserDetails.vue')['default']
|
||||
WelcomeItem: typeof import('./src/components/WelcomeItem.vue')['default']
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</li>
|
||||
<li class="flex items-center justify-between">
|
||||
<strong>{{ $t('تغییر وضعیت') }}</strong>
|
||||
<ToggleButton v-model="checked" onLabel="فعال" offLabel="غیرفعال" />
|
||||
<ToggleButton @change="changeStatus" v-model="checked" onLabel="فعال" offLabel="غیرفعال" />
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
@@ -48,8 +48,18 @@
|
||||
import { inject, reactive } from 'vue';
|
||||
import { jDate } from '@/utils/jDate';
|
||||
import { numberFormat } from '@/utils/numberFormat';
|
||||
import {useDiscountStore} from '../stores/discounts'
|
||||
const store = useDiscountStore()
|
||||
import { ref } from 'vue';
|
||||
const checked = ref(false);
|
||||
const changeStatus = async() => {
|
||||
const change = await store.changeStatus({
|
||||
id: coupon.coupon.id,
|
||||
status: 'Active'
|
||||
})
|
||||
console.log(change);
|
||||
|
||||
};
|
||||
const tabs = ref([
|
||||
{ title: 'Tab 1', content: 'Tab 1 Content', value: '0' },
|
||||
{ title: 'Tab 2', content: 'Tab 2 Content', value: '1' },
|
||||
|
||||
+45
-35
@@ -77,6 +77,11 @@ const items = ref([
|
||||
icon: 'pi pi-exclamation-circle',
|
||||
command: () => router.push('/pages/about-us')
|
||||
},
|
||||
{
|
||||
label: t('سوالات متداول'),
|
||||
icon: 'pi pi-exclamation-circle',
|
||||
command: () => router.push('/pages/Faq')
|
||||
},
|
||||
// {
|
||||
// label: t('contactUs'),
|
||||
// icon: 'pi pi-sitemap',
|
||||
@@ -107,57 +112,62 @@ const items = ref([
|
||||
]
|
||||
},
|
||||
{
|
||||
label: t('users'),
|
||||
icon: 'pi pi-users',
|
||||
command: () => router.push('/users')
|
||||
label: t('coupons'),
|
||||
icon: 'pi pi-barcode',
|
||||
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'),
|
||||
icon: 'pi pi-th-large',
|
||||
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'),
|
||||
icon: 'pi pi-sitemap',
|
||||
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'),
|
||||
icon: 'pi pi-sitemap',
|
||||
command: () => router.push('/comments')
|
||||
},
|
||||
{
|
||||
label: t('orders'),
|
||||
icon: 'pi pi-sitemap',
|
||||
command: () => router.push('/orders')
|
||||
},
|
||||
{
|
||||
label: t('products'),
|
||||
icon: 'pi pi-sitemap',
|
||||
command: () => router.push('/products')
|
||||
},
|
||||
// {
|
||||
// label: t('orders'),
|
||||
// icon: 'pi pi-sitemap',
|
||||
// command: () => router.push('/orders')
|
||||
// },
|
||||
// {
|
||||
// label: t('products'),
|
||||
// icon: 'pi pi-sitemap',
|
||||
// command: () => router.push('/products')
|
||||
// },
|
||||
// {
|
||||
// label: t('brands'),
|
||||
// icon: 'pi pi-apple',
|
||||
|
||||
+11
-1
@@ -83,6 +83,11 @@ const router = createRouter({
|
||||
name: 'EditCoupon',
|
||||
component: () => import('@/views/EditCoupon.vue'),
|
||||
},
|
||||
{
|
||||
path: '/tickets',
|
||||
name: 'Tickets',
|
||||
component: () => import('@/views/Tickets.vue'),
|
||||
},
|
||||
{
|
||||
path: '/pages',
|
||||
children: [
|
||||
@@ -95,7 +100,12 @@ const router = createRouter({
|
||||
path: 'about-us',
|
||||
name: 'about-us',
|
||||
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
|
||||
|
||||
},
|
||||
async add(form) {
|
||||
this.fetching = true
|
||||
const { status, data } = await axios.post('/admins/discount', form)
|
||||
this.fetching = false
|
||||
return data
|
||||
},
|
||||
async getDiscount(id) {
|
||||
this.items = [];
|
||||
this.fetching = true
|
||||
@@ -26,6 +32,16 @@ export const useDiscountStore = defineStore('discounts', {
|
||||
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) {
|
||||
// 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>
|
||||
<section class="flex flex-col gap-4">
|
||||
<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">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full" v-model="data.title" />
|
||||
<label>{{ $t("متن هدر") }}</label>
|
||||
<label>{{ $t("حوزه های تخصصی") }}</label>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<Textarea v-model="data.description" rows="5" class="w-full" />
|
||||
<label>{{ $t("توضیحات هدر") }}</label>
|
||||
<InputText class="w-full" v-model="data.title" />
|
||||
<label>{{ $t("تعداد دانشجو ها") }}</label>
|
||||
</FloatLabel>
|
||||
</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">
|
||||
<FloatLabel>
|
||||
<InputText v-model="data.student" class="w-full" />
|
||||
<label>{{ $t("تعداد دانشجو ها") }}</label>
|
||||
<label>{{ $t("تعداد عناوین آموزشی") }}</label>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full" v-model="data.videosCount" />
|
||||
<label>{{ $t("تعداد ویدیو های آموزشی") }}</label>
|
||||
<label>{{ $t("تعداد ساعات آموزشی") }}</label>
|
||||
</FloatLabel>
|
||||
</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 class="flex pt-4 justify-end">
|
||||
<Button
|
||||
|
||||
@@ -69,7 +69,7 @@ const show = (coupon) => {
|
||||
const router = useRouter()
|
||||
const edit = (data) =>{
|
||||
console.log(data.id);
|
||||
router.push(`/coupon/${data.id}`)
|
||||
router.push(`/coupon/${data.id}`)
|
||||
}
|
||||
watchEffect( async() =>{
|
||||
await store.index()
|
||||
|
||||
+33
-25
@@ -4,7 +4,7 @@
|
||||
<div class="grid grid-cols-3 gap-7">
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full custom-input" v-model="date" />
|
||||
<InputText class="w-full custom-input" v-model="coupon.startDate" />
|
||||
<label>{{ $t("تاریخ شروع") }}</label>
|
||||
</FloatLabel>
|
||||
<date-picker
|
||||
@@ -13,7 +13,7 @@
|
||||
display-format="jYYYY-jMM-jDD HH:mm"
|
||||
:timezone="true"
|
||||
color="dimgray"
|
||||
v-model="date"
|
||||
v-model="coupon.startDate"
|
||||
simple
|
||||
custom-input=".custom-input"
|
||||
></date-picker>
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full custom-input2" v-model="date2" />
|
||||
<InputText class="w-full custom-input2" v-model="coupon.endDate" />
|
||||
<label>{{ $t("تاریخ پایان") }}</label>
|
||||
</FloatLabel>
|
||||
<date-picker
|
||||
@@ -30,14 +30,14 @@
|
||||
display-format="jYYYY-jMM-jDD HH:mm"
|
||||
:timezone="true"
|
||||
color="dimgray"
|
||||
v-model="date2"
|
||||
v-model="coupon.endDate"
|
||||
simple
|
||||
custom-input=".custom-input2"
|
||||
></date-picker>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full" v-model="course.duration" />
|
||||
<InputText class="w-full" v-model="coupon.code" />
|
||||
<label>{{ $t("کد تخفیف") }}</label>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
@@ -45,7 +45,8 @@
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<Dropdown
|
||||
v-model="noe"
|
||||
v-model="type"
|
||||
@change="setType"
|
||||
:options="['مبلغ', 'درصد']"
|
||||
:optionLabel="levels"
|
||||
:optionValue="levels"
|
||||
@@ -56,24 +57,24 @@
|
||||
</div>
|
||||
<div v-if="noe === 'مبلغ'" class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full" />
|
||||
<InputText class="w-full" v-model="coupon.price"/>
|
||||
<label>{{ $t("مبلغ تخفیف") }}</label>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
|
||||
<div v-if="noe === 'درصد'" class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full" />
|
||||
<InputText class="w-full" v-model="coupon.percent"/>
|
||||
<label>{{ $t("درصد تخفیف") }}</label>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 my-custom-container inline">
|
||||
<!-- <div class="flex flex-col gap-1 my-custom-container inline">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full" />
|
||||
<label>{{ $t("تخفیف برای همه کاربران") }}</label>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="flex pt-4 justify-end">
|
||||
@@ -82,7 +83,7 @@
|
||||
icon="pi pi-save"
|
||||
severity="success"
|
||||
:loading="saving"
|
||||
@click="create(course)"
|
||||
@click="create(coupon)"
|
||||
/>
|
||||
</div>
|
||||
</Panel>
|
||||
@@ -91,28 +92,35 @@
|
||||
|
||||
<script setup>
|
||||
import { useProductsStore } from "@/stores/products";
|
||||
import { useDiscountStore } from "@/stores/discounts"
|
||||
import { ref, watchEffect, reactive } from "vue";
|
||||
import moment from 'moment-jalaali'
|
||||
const date= ref(null)
|
||||
const date2= ref(null)
|
||||
const noe = ref('مبلغ')
|
||||
const store = useProductsStore();
|
||||
const discount = useDiscountStore();
|
||||
const data = ref(null);
|
||||
const course = reactive({
|
||||
name: "",
|
||||
description: "",
|
||||
slug: "",
|
||||
duration: "",
|
||||
image: "",
|
||||
categories: "",
|
||||
price: 0,
|
||||
teacher: "",
|
||||
completionPercentage: 0,
|
||||
level: "",
|
||||
language: "",
|
||||
countOfVideos: 0,
|
||||
totalFileSize: "",
|
||||
const type = ref(null);
|
||||
const setType = (val) => {
|
||||
if (val.value === 'درصد') {
|
||||
coupon.discountType = 'percent'
|
||||
}else{
|
||||
coupon.discountType = 'price'
|
||||
}
|
||||
}
|
||||
const coupon = reactive({
|
||||
startDate: "",
|
||||
endDate: "",
|
||||
code: "",
|
||||
discountType: type.value,
|
||||
price: "",
|
||||
percent: null,
|
||||
allUsers: true
|
||||
});
|
||||
const create = async(coupon) => {
|
||||
const datas = await discount.add(coupon)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
+122
-110
@@ -1,123 +1,135 @@
|
||||
<template>
|
||||
<section class="flex flex-col gap-4">
|
||||
<Panel :header="$t('ویرایش تخفیف')">
|
||||
<div class="grid grid-cols-3 gap-7">
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full custom-input" v-model="date" />
|
||||
<label>{{ $t("تاریخ شروع") }}</label>
|
||||
</FloatLabel>
|
||||
<date-picker
|
||||
type="datetime"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
display-format="jYYYY-jMM-jDD HH:mm"
|
||||
:timezone="true"
|
||||
color="dimgray"
|
||||
v-model="date"
|
||||
simple
|
||||
custom-input=".custom-input"
|
||||
></date-picker>
|
||||
</div>
|
||||
<section class="flex flex-col gap-4">
|
||||
<Panel :header="$t('ویرایش تخفیف')">
|
||||
<div class="grid grid-cols-3 gap-7">
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full custom-input" v-model="date" />
|
||||
<label>{{ $t("تاریخ شروع") }}</label>
|
||||
</FloatLabel>
|
||||
<date-picker
|
||||
type="datetime"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
display-format="jYYYY-jMM-jDD HH:mm"
|
||||
:timezone="true"
|
||||
color="dimgray"
|
||||
v-model="date"
|
||||
simple
|
||||
custom-input=".custom-input"
|
||||
></date-picker>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full custom-input2" v-model="date2" />
|
||||
<label>{{ $t("تاریخ پایان") }}</label>
|
||||
</FloatLabel>
|
||||
<date-picker
|
||||
type="datetime"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
display-format="jYYYY-jMM-jDD HH:mm"
|
||||
:timezone="true"
|
||||
color="dimgray"
|
||||
v-model="date2"
|
||||
simple
|
||||
custom-input=".custom-input2"
|
||||
></date-picker>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full" v-model="course.duration" />
|
||||
<label>{{ $t("کد تخفیف") }}</label>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full custom-input2" v-model="date2" />
|
||||
<label>{{ $t("تاریخ پایان") }}</label>
|
||||
</FloatLabel>
|
||||
<date-picker
|
||||
type="datetime"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
display-format="jYYYY-jMM-jDD HH:mm"
|
||||
:timezone="true"
|
||||
color="dimgray"
|
||||
v-model="date2"
|
||||
simple
|
||||
custom-input=".custom-input2"
|
||||
></date-picker>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<InputText class="w-full" v-model="discount.code" />
|
||||
<label>{{ $t("کد تخفیف") }}</label>
|
||||
</FloatLabel>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<Dropdown
|
||||
v-model="noe"
|
||||
:options="['مبلغ', 'درصد']"
|
||||
:optionLabel="levels"
|
||||
: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 class="flex flex-col gap-1">
|
||||
<FloatLabel>
|
||||
<Dropdown
|
||||
v-model="noe"
|
||||
@change="setType"
|
||||
:options="['مبلغ', 'درصد']"
|
||||
:optionLabel="levels"
|
||||
:optionValue="levels"
|
||||
class="w-full"
|
||||
/>
|
||||
</div>
|
||||
</Panel>
|
||||
</section>
|
||||
<label>{{ $t("نوع تخفیف") }}</label>
|
||||
</FloatLabel>
|
||||
</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>
|
||||
|
||||
<script setup>
|
||||
import { useDiscountStore } from "@/stores/discounts";
|
||||
import { ref, watchEffect, reactive } from "vue";
|
||||
import moment from 'moment-jalaali'
|
||||
import moment from "moment-jalaali";
|
||||
import { useRoute } from "vue-router";
|
||||
const date= ref(null)
|
||||
const date2= ref(null)
|
||||
const noe = ref('مبلغ')
|
||||
const date = ref(null);
|
||||
const date2 = ref(null);
|
||||
const noe = ref("مبلغ");
|
||||
const store = useDiscountStore();
|
||||
const data = ref(null);
|
||||
const course = reactive({
|
||||
name: "",
|
||||
description: "",
|
||||
slug: "",
|
||||
duration: "",
|
||||
image: "",
|
||||
categories: "",
|
||||
price: 0,
|
||||
teacher: "",
|
||||
completionPercentage: 0,
|
||||
level: "",
|
||||
language: "",
|
||||
countOfVideos: 0,
|
||||
totalFileSize: "",
|
||||
const data = ref();
|
||||
const setType = (val) => {
|
||||
if (val.value === 'درصد') {
|
||||
discount.discountType = 'percent'
|
||||
}else{
|
||||
discount.discountType = 'price'
|
||||
}
|
||||
}
|
||||
const discount = reactive({
|
||||
id: "",
|
||||
startDate: "",
|
||||
endDate: "",
|
||||
code: "",
|
||||
discountType: "",
|
||||
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>
|
||||
@@ -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