1405/02/14-add giftCard
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
import useAxios from "@/utils/useAxios";
|
||||||
|
|
||||||
|
|
||||||
|
//customer
|
||||||
|
export const registerCodeGiftCard = async (code: string) => await useAxios.post(`/customer/giftcard/use`, {code:code})
|
||||||
@@ -15,6 +15,7 @@ import VueLazyLoad from 'vue3-lazyload'
|
|||||||
import { getMe } from '@/api/me'
|
import { getMe } from '@/api/me'
|
||||||
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router'
|
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router'
|
||||||
import { useAuthStore } from '@/store/useAuthStore'
|
import { useAuthStore } from '@/store/useAuthStore'
|
||||||
|
import {getConfigApp} from "@/utils/config";
|
||||||
|
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
@@ -85,6 +86,8 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (timeoutId) {
|
if (timeoutId) {
|
||||||
clearTimeout(timeoutId)
|
clearTimeout(timeoutId)
|
||||||
}
|
}
|
||||||
|
if (to.name=='giftCard' && getConfigApp('name')!='garoosi')
|
||||||
|
return next({ name: from.name })
|
||||||
// Start a new timeout to reset fingerprint after 5 seconds of inactivity
|
// Start a new timeout to reset fingerprint after 5 seconds of inactivity
|
||||||
if (from.name !== 'login' || from.name !== undefined) {
|
if (from.name !== 'login' || from.name !== undefined) {
|
||||||
timeoutId = setTimeout(async () => {
|
timeoutId = setTimeout(async () => {
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ const router = createRouter({
|
|||||||
name: 'earnMoney',
|
name: 'earnMoney',
|
||||||
component: () => import('@/views/base/earnMoney/index.vue')
|
component: () => import('@/views/base/earnMoney/index.vue')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'giftCard',
|
||||||
|
name: 'giftCard',
|
||||||
|
component: () => import('@/views/base/giftCard/index.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'fund',
|
path: 'fund',
|
||||||
name: 'fund',
|
name: 'fund',
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="bg-white py-3 px-3 text-black font-bold drop-shadow z-[1999] wrap-fix">کارت هدیه</div>
|
||||||
|
<div class="px-5 pt-26 pb-2">
|
||||||
|
<a-form :model="form" class="!mt-5" name="basic" @finish="registerGiftCard">
|
||||||
|
<div class="border-gray-200 border-1 rounded-xl p-5 trans h-40 relative">
|
||||||
|
<bg_main />
|
||||||
|
<div class="z-100 relative">
|
||||||
|
<a-form-item :rules="[required()]" label="کد کارت هدیه" name="code">
|
||||||
|
<BasicInput
|
||||||
|
v-model:value="form.code"
|
||||||
|
place-holder="کد کارت هدیه را وارد کنید"
|
||||||
|
size="large"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<div class="font-bold text-xs mt-3">
|
||||||
|
کد کارت هدیه خود را در فیلد بالا وارد کنید و سپس دکمه ثبت را بزنید.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a-form-item>
|
||||||
|
<BasicButton
|
||||||
|
:disabled="disableButton"
|
||||||
|
class="w-full py-2 mt-5"
|
||||||
|
html-type="submit"
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<a-spin v-if="loading" size="small" />
|
||||||
|
<div v-else>ثبت کد</div>
|
||||||
|
</div>
|
||||||
|
</BasicButton>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import Bg_main from '@/components/bg_main.vue'
|
||||||
|
import { registerCodeGiftCard } from '@/api/giftCard'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||||
|
import { required } from '@/utils/inputRules'
|
||||||
|
|
||||||
|
const form = ref<{ code: string }>({
|
||||||
|
code: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const disableButton = computed(() => {
|
||||||
|
if (!loading.value) {
|
||||||
|
return !form.value.code || form.value.code.trim().length === 0
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
async function registerGiftCard() {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
await registerCodeGiftCard(form.value.code)
|
||||||
|
message.success('کد کارت هدیه با موفقیت ثبت شد')
|
||||||
|
form.value.code = ''
|
||||||
|
} catch (e: any) {
|
||||||
|
message.error(e?.response?.data?.message || 'خطا در ثبت کد کارت هدیه')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -50,6 +50,13 @@
|
|||||||
<div>قوانین و مقررات</div>
|
<div>قوانین و مقررات</div>
|
||||||
</div>
|
</div>
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
|
<BasicButton icon-size="16" class="!font-bold w-15rem"
|
||||||
|
@click="$router.push({name: 'giftCard'}); popVisible = false">
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
|
<BasicIcon icon="vuesax-linear:gift" size="16" class="absolute right-2" />
|
||||||
|
<div>ثبت کارت هدیه</div>
|
||||||
|
</div>
|
||||||
|
</BasicButton>
|
||||||
<!-- <BasicButton icon-size="16" class="!font-bold w-50vw md:w-full"
|
<!-- <BasicButton icon-size="16" class="!font-bold w-50vw md:w-full"
|
||||||
@click="$router.push({name: 'permissions'}); popVisible = false">
|
@click="$router.push({name: 'permissions'}); popVisible = false">
|
||||||
<div class="flex gap-2 items-center">
|
<div class="flex gap-2 items-center">
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
<div>ویرایش اطلاعات کاربری</div>
|
<div>ویرایش اطلاعات کاربری</div>
|
||||||
</div>
|
</div>
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
<div class="h-40vh overflow-y-auto mt-4">
|
<div class="h-45vh overflow-y-auto mt-4">
|
||||||
<BasicButton
|
<BasicButton
|
||||||
class="mt-2 w-full"
|
class="mt-2 w-full"
|
||||||
icon=""
|
icon=""
|
||||||
@@ -115,6 +115,19 @@
|
|||||||
<div>درباره ما</div>
|
<div>درباره ما</div>
|
||||||
</div>
|
</div>
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
|
<BasicButton
|
||||||
|
v-if="getConfigApp('name')=='garoosi'"
|
||||||
|
class="mt-2 w-full"
|
||||||
|
icon=""
|
||||||
|
iconSize="18"
|
||||||
|
size="large"
|
||||||
|
@click="$router.push({ name: 'giftCard' })"
|
||||||
|
>
|
||||||
|
<div class="flex">
|
||||||
|
<BasicIcon icon="vuesax-linear:gift" class="absolute right-8"/>
|
||||||
|
<div>ثبت کارت هدیه</div>
|
||||||
|
</div>
|
||||||
|
</BasicButton>
|
||||||
<BasicButton
|
<BasicButton
|
||||||
class="mt-2 w-full"
|
class="mt-2 w-full"
|
||||||
icon=""
|
icon=""
|
||||||
|
|||||||
Reference in New Issue
Block a user