6/8/1404
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import useAxios from '@/utils/useAxios'
|
||||
import type { Transfer, Verification } from '@/models/physicalreceive'
|
||||
|
||||
export const cardVerification = async (obj: Verification): Promise<any> => {
|
||||
return await useAxios.post(`/customer/vc_validate`, obj)
|
||||
}
|
||||
|
||||
export const transferRegister = async (obj: Transfer): Promise<any> => {
|
||||
return await useAxios.post(`/customer/havale`, obj)
|
||||
}
|
||||
|
||||
export const getTransfers = async () => await useAxios.get<Transfer[]>(`/customer/price_triggers`)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 250 KiB |
+2
-2
@@ -86,7 +86,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
// Start a new timeout to reset fingerprint after 5 seconds of inactivity
|
||||
if (from.name !== 'login' || from.name !== undefined) {
|
||||
console.log(from.name)
|
||||
// console.log(from.name)
|
||||
timeoutId = setTimeout(async () => {
|
||||
if (hasFingerPrint) {
|
||||
fingerPosition = false
|
||||
@@ -126,7 +126,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
goToLogin(to, next) // Redirect to login if authentication fails
|
||||
}
|
||||
} else {
|
||||
console.log('salam')
|
||||
// console.log('salam')
|
||||
if (from.path === '/') {
|
||||
// goToHome(to, next)
|
||||
}
|
||||
|
||||
@@ -30,4 +30,13 @@ export interface Customer {
|
||||
id: number
|
||||
name: string
|
||||
mobile: string
|
||||
}
|
||||
|
||||
export interface CardVerification {
|
||||
cardNumber: string
|
||||
}
|
||||
|
||||
export interface Transfer {
|
||||
destination: string
|
||||
amount: string
|
||||
}
|
||||
@@ -60,6 +60,11 @@ const router = createRouter({
|
||||
name: 'notifyTrigger',
|
||||
component: () => import('@/views/base/priceTrigger/index.vue')
|
||||
},
|
||||
{
|
||||
path: 'transfer',
|
||||
name: 'transfer',
|
||||
component: () => import('@/views/base/transfer/index.vue')
|
||||
},
|
||||
{
|
||||
path: 'address',
|
||||
name: 'address',
|
||||
|
||||
@@ -50,7 +50,7 @@ _axios.interceptors.response.use(
|
||||
return response.data
|
||||
},
|
||||
async function (error) {
|
||||
console.log('this is axios error', error)
|
||||
// console.log('this is axios error', error)
|
||||
if (error.response.data && error.response.data.message) {
|
||||
checkStatus(error.response.data.message, error.response.status, error.config)
|
||||
}
|
||||
@@ -92,7 +92,7 @@ function checkStatus(msg: string, code: number, config: any) {
|
||||
errorMessage = config.meta.message
|
||||
}
|
||||
}*/
|
||||
console.log('this is config', config)
|
||||
// console.log('this is config', config)
|
||||
if (errorMessage == 'none') return
|
||||
switch (errorMessage) {
|
||||
case 'message':
|
||||
|
||||
@@ -57,6 +57,13 @@
|
||||
<div>قوانین و مقررات</div>
|
||||
</div>
|
||||
</BasicButton>
|
||||
<BasicButton icon-size="16" class="!font-bold w-15rem"
|
||||
@click="$router.push({name: 'transfer'}); popVisible = false">
|
||||
<div class="flex gap-2 items-center">
|
||||
<BasicIcon icon="vuesax-linear:bill" size="16" class="absolute right-2" />
|
||||
<div>انتقال قطره</div>
|
||||
</div>
|
||||
</BasicButton>
|
||||
|
||||
|
||||
<!-- <BasicButton icon-size="16" class="!font-bold w-50vw md:w-full"
|
||||
|
||||
@@ -112,7 +112,7 @@ onMounted(async () => {
|
||||
})
|
||||
onUnmounted(() => {
|
||||
stopPriceInterval()
|
||||
console.log('stop product')
|
||||
// console.log('stop product')
|
||||
})
|
||||
|
||||
async function initPrice() {
|
||||
|
||||
@@ -118,7 +118,7 @@ onMounted(async () => {
|
||||
})
|
||||
onUnmounted(() => {
|
||||
stopPriceInterval()
|
||||
console.log('stop product')
|
||||
// console.log('stop product')
|
||||
|
||||
// console.log('okgold')
|
||||
})
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div @click="infoVisible = true" class="shadow mb-2 p-2 rounded-lg">
|
||||
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<!-- <div class="font-bold text-base mb-2">{{usePrice(item.target_price) }}</div>-->
|
||||
</div>
|
||||
<div class="flex gap-2 ">
|
||||
<BasicIcon color="red" icon="vuesax-linear:trash" @click.stop="deleteConfirmVisible = true" class="p-1"/>
|
||||
</div>
|
||||
</div>
|
||||
<a-divider class="!my-3" />
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <teleport to="app">-->
|
||||
<DialogVant v-model:show="deleteConfirmVisible" teleport="body" :closeOnClickOverlay="false" :timeOut="-1">
|
||||
<!-- <template v-slot:img>
|
||||
<img :src="registerDelayImage" alt="" class="opacity-80">
|
||||
</template>-->
|
||||
|
||||
<template v-slot:title>
|
||||
<div class="flex flex-col items-center">
|
||||
<div class="p-5 text-sm">
|
||||
آیا از حذف هشدار اطمینان دارید؟
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:button>
|
||||
<div class="text-center text-red flex items-center justify-center">
|
||||
<a-spin :spinning="deleteLoading" size="small">
|
||||
تایید
|
||||
</a-spin>
|
||||
</div>
|
||||
<div class="text-center" @click="deleteConfirmVisible = false">
|
||||
انصراف
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</DialogVant>
|
||||
<!-- </teleport>-->
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import type { Transfer } from '@/models/physicalreceive'
|
||||
import DialogVant from '@/components/DialogVant.vue'
|
||||
|
||||
const infoVisible = ref<boolean>(false)
|
||||
|
||||
const isActive = ref<boolean>(false)
|
||||
|
||||
const deleteLoading = ref(false)
|
||||
const deleteConfirmVisible = ref(false)
|
||||
|
||||
interface Prop {
|
||||
item: Transfer
|
||||
}
|
||||
onMounted(()=> isActive.value = props.item.is_active)
|
||||
|
||||
|
||||
const props = withDefaults(defineProps<Prop>(), {})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,241 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="bg-white py-3 px-3 text-primary font-bold drop-shadow wrap-fix flex z-10">
|
||||
<div @click="router.back()">
|
||||
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
||||
</div>
|
||||
<div class="mr-2">انتقال های فعلی</div>
|
||||
</div>
|
||||
<!-- <a-spin :spinning="loading">-->
|
||||
<div ref="el" :class="loading? 'h-screen': ''" class="px-3 pt-16 pb-2 overflow-y-scroll"
|
||||
style="max-height: calc(100vh - 50px)">
|
||||
<list-anim v-if="!loading" class="pb-12vh">
|
||||
<Item v-for="item in items" :key="item.id" :item="item" @refresh="initItems" />
|
||||
<!-- <TransactionSkeleton v-if="loadingMore" class="mt-1 mb-8" />-->
|
||||
</list-anim>
|
||||
<div v-if="loading">
|
||||
<TransactionSkeleton v-for="i in 13" :key="i" class="mt-1" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- </a-spin>-->
|
||||
<BasicActionSheet v-model:show="addTransferVisible" teleport="body">
|
||||
<a-form ref="formRef" :model="form" class="!mt-5" name="basic"
|
||||
@finish="ok()">
|
||||
<div class="flex flex-col gap-4 pb-12 w-full">
|
||||
<div class="font-bold text-lg">انتقال قطره</div>
|
||||
<a-form-item
|
||||
:rules="required()"
|
||||
class="w-full gap-2 !flex-col"
|
||||
label="شناسه مقصد"
|
||||
name="cardNumber"
|
||||
>
|
||||
<BasicInput place-holder="شناسه یا موبایل مقصد را وارد کنید" v-model:value="form.cardNumber" type="number" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-spin :spinning="loading">
|
||||
<BasicButton class="w-full" type="primary" html-type="submit">
|
||||
ثبت
|
||||
</BasicButton>
|
||||
</a-spin>
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</BasicActionSheet>
|
||||
<BasicActionSheet v-model:show="verificationCardVisible" teleport="body">
|
||||
<a-form ref="formRef" :model="transferForm" class="!mt-5" name="basic"
|
||||
@finish="submitTransfer()">
|
||||
<div class="flex flex-col gap-4 pb-12 w-full">
|
||||
<div class="font-bold text-lg">انتقال قطره</div>
|
||||
<a-form-item
|
||||
:rules="required()"
|
||||
class="w-full mb-4rem gap-2 !flex-col"
|
||||
label="وزن انتقالی"
|
||||
name="amount"
|
||||
>
|
||||
<BasicInput place-holder="وزن مورد نظر جهت انتقال به حساب مقصد" v-model:value="transferForm.amount" type="number" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-spin :spinning="loading">
|
||||
<BasicButton class="w-full" type="primary" html-type="submit">
|
||||
ثبت انتقال
|
||||
</BasicButton>
|
||||
</a-spin>
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</BasicActionSheet>
|
||||
<BasicActionSheet v-model:show="finalRegisterSheet" teleport="body">
|
||||
<a-form ref="formRef" :model="transferForm" class="!mt-5" name="basic"
|
||||
@finish="finalRegister()">
|
||||
<div class="flex flex-col gap-4 pb-12 w-full">
|
||||
<!-- <div class="font-bold text-lg">انتقال قطره</div>-->
|
||||
|
||||
|
||||
<div class="flex items-center justify-center gap-4">
|
||||
<!-- آدمک مبدا -->
|
||||
<div class="flex flex-col items-center justify-center text-center">
|
||||
<div class="flex items-center justify-center border-2 border-gray-300 rounded-full w-20 h-20 bg-white shadow-sm">
|
||||
<img src="@/assets/img/logo_full_.png" alt="avatar" class="w-16 h-16 object-contain" />
|
||||
</div>
|
||||
<!-- فاصلهی خالی برای حفظ تراز -->
|
||||
<div class="mt-2 h-10"></div>
|
||||
</div>
|
||||
|
||||
<!-- دایرههای وسط -->
|
||||
<div class="flex items-center justify-center gap-1">
|
||||
<div class="w-2 h-2 bg-gray-200 rounded-full"></div>
|
||||
<div class="w-2 h-2 bg-gray-300 rounded-full"></div>
|
||||
<div class="w-2 h-2 bg-gray-400 rounded-full"></div>
|
||||
<div class="w-2 h-2 bg-gray-500 rounded-full"></div>
|
||||
</div>
|
||||
|
||||
<!-- آدمک مقصد + اطلاعات زیرش -->
|
||||
<div class="flex flex-col items-center justify-center text-center">
|
||||
<div class="flex items-center justify-center border-2 border-gray-300 rounded-full w-24 h-24 bg-white shadow-sm">
|
||||
<img src="@/assets/img/avatar-icon.png" alt="avatar" class="w-24 h-24 object-contain" />
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<div class="text-base font-medium">{{ data?.name }}</div>
|
||||
<div class="text-gray-500 text-sm">{{ data?.virtual_card_number }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mb-2rem text-center font-semibold mt-2">آیا مطمعن به انتقال {{transferForm.amount}} گرم به حساب {{ data.name }} هستید؟</div>
|
||||
<a-form-item>
|
||||
<a-spin :spinning="loading">
|
||||
<BasicButton class="w-full" type="primary" html-type="submit">
|
||||
ثبت نهایی
|
||||
</BasicButton>
|
||||
</a-spin>
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</BasicActionSheet>
|
||||
<Transition mode="out-in" name="fade">
|
||||
<div
|
||||
class="wrap-fix bottom-0 h-[16vh] bg-[#FBFBFC] shadow-lg rounded-3xl flex justify-center pt-3 z-200"
|
||||
style="box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 26px 11px"
|
||||
@click="openAdd()">
|
||||
<BasicIcon icon="vuesax-linear:add" />
|
||||
<div>انتقال جدید</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { loading, loadingMore } from '@/utils'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import ListAnim from '@/components/ListAnim.vue'
|
||||
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||
import { required } from '@/utils/inputRules'
|
||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||
import { type FormInstance, message } from 'ant-design-vue'
|
||||
import type { CardVerification, Transfer } from '@/models/physicalreceive'
|
||||
import Item from './components/Item.vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import router from '@/router'
|
||||
import { cardVerification, getTransfers, transferRegister } from '@/api/transfer'
|
||||
import defaultResult from 'ant-design-vue/es/_util/isMobile'
|
||||
import any = defaultResult.any
|
||||
const items = ref<CardVerification[]>([])
|
||||
const addTransferVisible = ref<boolean>(false)
|
||||
const verificationCardVisible = ref<boolean>(false)
|
||||
const finalRegisterSheet = ref<boolean>(false)
|
||||
const editId = ref<number | undefined>(undefined)
|
||||
const el = ref()
|
||||
|
||||
const form = ref<CardVerification>({
|
||||
cardNumber: ''
|
||||
})
|
||||
|
||||
const transferForm = ref<Transfer>({
|
||||
destination: '',
|
||||
amount: ''
|
||||
})
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
onMounted(() => {
|
||||
initItems()
|
||||
})
|
||||
|
||||
function resetFields() {
|
||||
form.value = {
|
||||
cardNumber: ''
|
||||
}
|
||||
}
|
||||
|
||||
function openAdd() {
|
||||
resetFields()
|
||||
editId.value = undefined
|
||||
addTransferVisible.value = true
|
||||
}
|
||||
|
||||
async function initItems() {
|
||||
try {
|
||||
items.value = []
|
||||
items.value = await getTransfers()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
loadingMore.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const data = ref<object>()
|
||||
async function ok() {
|
||||
formRef.value?.validateFields().then(async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
data.value = await cardVerification(form.value)
|
||||
addTransferVisible.value = false
|
||||
verificationCardVisible.value = true
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function submitTransfer() {
|
||||
formRef.value?.validateFields().then(async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
transferForm.value.destination = data.value?.virtual_card_number
|
||||
finalRegisterSheet.value = true
|
||||
verificationCardVisible.value = false
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function finalRegister() {
|
||||
formRef.value?.validateFields().then(async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
await transferRegister(transferForm.value)
|
||||
message.success('انتقال باموفقیت انجام شد.')
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
finalRegisterSheet.value = false
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user