@unsource/ui 2.7.18 → 2.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/UnModal.d.vue.ts +31 -0
- package/dist/runtime/components/UnModal.vue +60 -0
- package/dist/runtime/components/UnModal.vue.d.ts +31 -0
- package/dist/runtime/components/UnModalPaymentMethod.d.vue.ts +7 -0
- package/dist/runtime/components/UnModalPaymentMethod.vue +26 -0
- package/dist/runtime/components/UnModalPaymentMethod.vue.d.ts +7 -0
- package/dist/runtime/components/UnModalTransfer.d.vue.ts +3 -0
- package/dist/runtime/components/UnModalTransfer.vue +118 -0
- package/dist/runtime/components/UnModalTransfer.vue.d.ts +3 -0
- package/dist/runtime/components/UnModalWalletIncrease.d.vue.ts +7 -0
- package/dist/runtime/components/UnModalWalletIncrease.vue +53 -0
- package/dist/runtime/components/UnModalWalletIncrease.vue.d.ts +7 -0
- package/dist/runtime/components/UnModalWalletSelection.d.vue.ts +7 -0
- package/dist/runtime/components/UnModalWalletSelection.vue +26 -0
- package/dist/runtime/components/UnModalWalletSelection.vue.d.ts +7 -0
- package/dist/runtime/components/UnModalWithdrawal.d.vue.ts +7 -0
- package/dist/runtime/components/UnModalWithdrawal.vue +66 -0
- package/dist/runtime/components/UnModalWithdrawal.vue.d.ts +7 -0
- package/dist/runtime/components/UnNumberInput.d.vue.ts +17 -0
- package/dist/runtime/components/UnNumberInput.vue +55 -0
- package/dist/runtime/components/UnNumberInput.vue.d.ts +17 -0
- package/dist/runtime/components/UnPaymentMethods.d.vue.ts +20 -0
- package/dist/runtime/components/UnPaymentMethods.vue +48 -0
- package/dist/runtime/components/UnPaymentMethods.vue.d.ts +20 -0
- package/dist/runtime/components/UnTransaction.d.vue.ts +8 -0
- package/dist/runtime/components/UnTransaction.vue +83 -0
- package/dist/runtime/components/UnTransaction.vue.d.ts +8 -0
- package/dist/runtime/components/UnWallet.d.vue.ts +11 -0
- package/dist/runtime/components/UnWallet.vue +150 -0
- package/dist/runtime/components/UnWallet.vue.d.ts +11 -0
- package/dist/runtime/components/UnWalletActions.d.vue.ts +10 -0
- package/dist/runtime/components/UnWalletActions.vue +37 -0
- package/dist/runtime/components/UnWalletActions.vue.d.ts +10 -0
- package/dist/runtime/composables/global.js +18 -9
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
head?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
mini?: boolean;
|
|
5
|
+
collapsable?: boolean;
|
|
6
|
+
noBackdrop?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_defaultModels: {
|
|
9
|
+
modelValue: boolean;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_ModelProps = {
|
|
12
|
+
modelValue?: typeof __VLS_defaultModels['modelValue'];
|
|
13
|
+
};
|
|
14
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
15
|
+
declare var __VLS_9: {}, __VLS_19: {};
|
|
16
|
+
type __VLS_Slots = {} & {
|
|
17
|
+
title?: (props: typeof __VLS_9) => any;
|
|
18
|
+
} & {
|
|
19
|
+
default?: (props: typeof __VLS_19) => any;
|
|
20
|
+
};
|
|
21
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
22
|
+
modal: any;
|
|
23
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="modal"
|
|
4
|
+
class="flex flex-col items-stretch justify-end bg-gray-500 w-full max-w-120 <md:(max-w-unset left-0 translate-x-0) h-full fixed bottom-0 left-1/2 transform -translate-x-1/2 z-50"
|
|
5
|
+
:class="[noBackdrop ? 'bg-op-0' : 'bg-op-20', { ' backdrop-blur-[2px]': !collapsable }]"
|
|
6
|
+
@click.self="emit('close')"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="flex flex-col gap-6 bg-primary-100 rounded-t-xl max-h-9.5/10 w-full px-3"
|
|
10
|
+
:class="[collapsable ? 'pt-2 pb-4' : 'py-4']"
|
|
11
|
+
>
|
|
12
|
+
<UnNuxtIcon
|
|
13
|
+
v-if="collapsable"
|
|
14
|
+
:name="collapse ? 'solar:alt-arrow-down-line-duotone' : 'solar:alt-arrow-up-line-duotone'"
|
|
15
|
+
class="self-center text-(3xl primary-500) cursor-pointer"
|
|
16
|
+
@click="toggleCollapse"
|
|
17
|
+
/>
|
|
18
|
+
<div
|
|
19
|
+
v-show="!collapsable"
|
|
20
|
+
class="flex flex-col gap-1"
|
|
21
|
+
>
|
|
22
|
+
<div class="flex items-center justify-between">
|
|
23
|
+
<p class="font-semibold text-(lg gray-600) flex gap-3 items-center">
|
|
24
|
+
{{ head }}
|
|
25
|
+
<slot name="title" />
|
|
26
|
+
</p>
|
|
27
|
+
<UnNuxtIcon
|
|
28
|
+
name="solar:close-circle-line-duotone"
|
|
29
|
+
class="text-2xl cursor-pointer"
|
|
30
|
+
@click="emit('close')"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
<p
|
|
34
|
+
v-if="title"
|
|
35
|
+
class="text-(sm gray-600)"
|
|
36
|
+
>
|
|
37
|
+
{{ title }}
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
<slot />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup>
|
|
46
|
+
defineProps({
|
|
47
|
+
head: { type: String, required: false },
|
|
48
|
+
title: { type: String, required: false },
|
|
49
|
+
mini: { type: Boolean, required: false },
|
|
50
|
+
collapsable: { type: Boolean, required: false },
|
|
51
|
+
noBackdrop: { type: Boolean, required: false }
|
|
52
|
+
});
|
|
53
|
+
const emit = defineEmits(["close", "collapse"]);
|
|
54
|
+
const collapse = defineModel({ default: false });
|
|
55
|
+
const toggleCollapse = () => {
|
|
56
|
+
collapse.value = !collapse.value;
|
|
57
|
+
};
|
|
58
|
+
const modal = ref();
|
|
59
|
+
defineExpose({ modal });
|
|
60
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
head?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
mini?: boolean;
|
|
5
|
+
collapsable?: boolean;
|
|
6
|
+
noBackdrop?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_defaultModels: {
|
|
9
|
+
modelValue: boolean;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_ModelProps = {
|
|
12
|
+
modelValue?: typeof __VLS_defaultModels['modelValue'];
|
|
13
|
+
};
|
|
14
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
15
|
+
declare var __VLS_9: {}, __VLS_19: {};
|
|
16
|
+
type __VLS_Slots = {} & {
|
|
17
|
+
title?: (props: typeof __VLS_9) => any;
|
|
18
|
+
} & {
|
|
19
|
+
default?: (props: typeof __VLS_19) => any;
|
|
20
|
+
};
|
|
21
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
22
|
+
modal: any;
|
|
23
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
|
+
modelValue?: any;
|
|
3
|
+
'method'?: any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UnModal
|
|
3
|
+
head="روش پرداخت"
|
|
4
|
+
@close="emit('close')"
|
|
5
|
+
>
|
|
6
|
+
<UnPaymentMethods
|
|
7
|
+
v-model="selectedPayment"
|
|
8
|
+
v-model:method="selectedMethod"
|
|
9
|
+
:gateway-filter="() => true"
|
|
10
|
+
:wallets-filter="() => false"
|
|
11
|
+
/>
|
|
12
|
+
<UnButton
|
|
13
|
+
class="sticky bottom-0"
|
|
14
|
+
variant="primary-fill"
|
|
15
|
+
:label="$t('\u062A\u0627\u06CC\u06CC\u062F')"
|
|
16
|
+
:disable="!selectedMethod?.id"
|
|
17
|
+
@click="$emit('submit')"
|
|
18
|
+
/>
|
|
19
|
+
</UnModal>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
const emit = defineEmits(["close"]);
|
|
24
|
+
const selectedPayment = defineModel();
|
|
25
|
+
const selectedMethod = defineModel("method");
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
|
+
modelValue?: any;
|
|
3
|
+
'method'?: any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UnModal
|
|
3
|
+
head="انتقال وجه"
|
|
4
|
+
class="!z-80"
|
|
5
|
+
@close="emit('close')"
|
|
6
|
+
>
|
|
7
|
+
<UnFormList
|
|
8
|
+
ref="schema"
|
|
9
|
+
v-model="form"
|
|
10
|
+
:items="items"
|
|
11
|
+
:errors
|
|
12
|
+
/>
|
|
13
|
+
<UnNuxtIcon
|
|
14
|
+
v-show="loadingUser"
|
|
15
|
+
name="loading"
|
|
16
|
+
icon-type="svg"
|
|
17
|
+
class="text-2xl"
|
|
18
|
+
/>
|
|
19
|
+
<p v-if="toUser">
|
|
20
|
+
{{ toUser.profile?.firstName || "" }} {{ toUser.profile?.lastName || "" }}
|
|
21
|
+
</p>
|
|
22
|
+
<UnNumberInput
|
|
23
|
+
v-model="amount"
|
|
24
|
+
:max="wallet?.balance"
|
|
25
|
+
/>
|
|
26
|
+
<UnButton
|
|
27
|
+
variant="primary-fill"
|
|
28
|
+
label="انتقال"
|
|
29
|
+
:disable="!toUser"
|
|
30
|
+
:loading="loadingUser || loading"
|
|
31
|
+
@click="submit"
|
|
32
|
+
/>
|
|
33
|
+
</UnModal>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
import {
|
|
38
|
+
_cloneDeep,
|
|
39
|
+
_debounce,
|
|
40
|
+
ajv,
|
|
41
|
+
computed,
|
|
42
|
+
ref,
|
|
43
|
+
s2n,
|
|
44
|
+
submitPayment,
|
|
45
|
+
useGet,
|
|
46
|
+
useNuxtApp,
|
|
47
|
+
useWallets,
|
|
48
|
+
watch
|
|
49
|
+
} from "#imports";
|
|
50
|
+
const emit = defineEmits(["close"]);
|
|
51
|
+
const wallets = await useWallets(true);
|
|
52
|
+
const amount = ref("0");
|
|
53
|
+
const wallet = computed(() => wallets.value.find((e) => e.coin.unit === "wallet"));
|
|
54
|
+
const schema = ref();
|
|
55
|
+
const { $toast } = useNuxtApp();
|
|
56
|
+
const loading = ref(false);
|
|
57
|
+
const form = ref({});
|
|
58
|
+
const errors = ref([]);
|
|
59
|
+
const toUser = ref(null);
|
|
60
|
+
const items = computed(() => [
|
|
61
|
+
{
|
|
62
|
+
priority: 0,
|
|
63
|
+
required: true,
|
|
64
|
+
input: {
|
|
65
|
+
key: "phoneNumber",
|
|
66
|
+
title: "\u0634\u0645\u0627\u0631\u0647 \u062A\u0644\u0641\u0646 \u0645\u0642\u0635\u062F",
|
|
67
|
+
type: "text",
|
|
68
|
+
keyboadType: "numeric"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]);
|
|
72
|
+
const submit = async () => {
|
|
73
|
+
const isConfirm = confirm("\u0622\u06CC\u0627 \u0645\u0637\u0645\u0639\u0646 \u0647\u0633\u062A\u06CC\u062F\u061F");
|
|
74
|
+
if (!isConfirm) return;
|
|
75
|
+
if (!toUser.value) return;
|
|
76
|
+
if (!ajv.validate(schema.value.schema, form.value)) {
|
|
77
|
+
errors.value = _cloneDeep(ajv.errors?.map((e) => e.params.missingProperty || e.instancePath.replace(/^\//, "")));
|
|
78
|
+
return $toast.error("\u0644\u0637\u0641\u0627 \u0645\u0648\u0627\u0631\u062F \u0631\u0627 \u0628\u0647 \u062F\u0631\u0633\u062A\u06CC \u062A\u06A9\u0645\u06CC\u0644 \u0646\u0645\u0627\u06CC\u06CC\u062F.");
|
|
79
|
+
}
|
|
80
|
+
if (loading.value) return;
|
|
81
|
+
loading.value = true;
|
|
82
|
+
const w = await useWallets(void 0, toUser.value?.id);
|
|
83
|
+
const details = {
|
|
84
|
+
walletId: wallet.value.id,
|
|
85
|
+
toWalletId: w.value?.find((e) => e.coin.unit === "wallet").id,
|
|
86
|
+
status: "ACCEPTED",
|
|
87
|
+
type: "TRANSFER",
|
|
88
|
+
redirectUrl: window.urlPrefix + location.href,
|
|
89
|
+
amount: Number(s2n(amount.value))
|
|
90
|
+
};
|
|
91
|
+
const res = await submitPayment(0, details, void 0, false);
|
|
92
|
+
if (res) {
|
|
93
|
+
emit("close");
|
|
94
|
+
}
|
|
95
|
+
loading.value = false;
|
|
96
|
+
};
|
|
97
|
+
const loadingUser = ref(false);
|
|
98
|
+
watch(() => form.value.phoneNumber, _debounce(async (phoneNumber) => {
|
|
99
|
+
toUser.value = null;
|
|
100
|
+
if (phoneNumber?.length === 11) {
|
|
101
|
+
loadingUser.value = true;
|
|
102
|
+
const { result } = await useGet(`/User/phoneNumber/${phoneNumber}`, {
|
|
103
|
+
params: {
|
|
104
|
+
"$i.profile": true
|
|
105
|
+
},
|
|
106
|
+
headers: {
|
|
107
|
+
"no-error": true
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
if (!result) {
|
|
111
|
+
loadingUser.value = false;
|
|
112
|
+
return $toast.error("\u06A9\u0627\u0631\u0628\u0631\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F");
|
|
113
|
+
}
|
|
114
|
+
toUser.value = result;
|
|
115
|
+
loadingUser.value = false;
|
|
116
|
+
}
|
|
117
|
+
}, 500));
|
|
118
|
+
</script>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Wallet } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
wallet: Wallet;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UnModal
|
|
3
|
+
head="افزایش اعتبار"
|
|
4
|
+
@close="emit('close')"
|
|
5
|
+
>
|
|
6
|
+
<p class="text-gray-500 text-sm">
|
|
7
|
+
{{ $t("\u0645\u0628\u0644\u063A \u0645\u0648\u0631\u062F \u0646\u0638\u0631 \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F") }}
|
|
8
|
+
</p>
|
|
9
|
+
<UnNumberInput v-model="depositAmount" />
|
|
10
|
+
<UnButton
|
|
11
|
+
class="sticky bottom-0"
|
|
12
|
+
variant="primary-fill"
|
|
13
|
+
:label="$t('\u067E\u0631\u062F\u0627\u062E\u062A')"
|
|
14
|
+
:loading="loading"
|
|
15
|
+
@click="paymentMethodModal = true"
|
|
16
|
+
/>
|
|
17
|
+
<UnModalPaymentMethod
|
|
18
|
+
v-show="paymentMethodModal"
|
|
19
|
+
v-model:method="selectedMethod"
|
|
20
|
+
v-model="selectedPayment"
|
|
21
|
+
class="z-51"
|
|
22
|
+
@submit="deposit"
|
|
23
|
+
@close="paymentMethodModal = false"
|
|
24
|
+
/>
|
|
25
|
+
</UnModal>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import { ref, s2n, submitPayment } from "#imports";
|
|
30
|
+
const { wallet } = defineProps({
|
|
31
|
+
wallet: { type: Object, required: true }
|
|
32
|
+
});
|
|
33
|
+
const paymentMethodModal = ref(false);
|
|
34
|
+
const selectedPayment = ref(0);
|
|
35
|
+
const selectedMethod = ref();
|
|
36
|
+
const emit = defineEmits(["close"]);
|
|
37
|
+
const loading = ref(false);
|
|
38
|
+
const deposit = async () => {
|
|
39
|
+
if (loading.value) return;
|
|
40
|
+
loading.value = true;
|
|
41
|
+
const details = {
|
|
42
|
+
walletId: wallet.id,
|
|
43
|
+
gatewayId: selectedMethod.value?.id,
|
|
44
|
+
status: "PENDING",
|
|
45
|
+
type: "DEPOSIT",
|
|
46
|
+
redirectUrl: window.urlPrefix + location.href,
|
|
47
|
+
amount: Number(s2n(depositAmount.value))
|
|
48
|
+
};
|
|
49
|
+
await submitPayment(0, details, void 0, true).catch(() => loading.value = false);
|
|
50
|
+
loading.value = false;
|
|
51
|
+
};
|
|
52
|
+
const depositAmount = ref("10,000");
|
|
53
|
+
</script>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Wallet } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
wallet: Wallet;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
|
+
modelValue?: any;
|
|
3
|
+
'method'?: any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UnModal
|
|
3
|
+
head="کیف پول ها"
|
|
4
|
+
@close="emit('close')"
|
|
5
|
+
>
|
|
6
|
+
<UnPaymentMethods
|
|
7
|
+
v-model="selectedPayment"
|
|
8
|
+
v-model:method="selectedMethod"
|
|
9
|
+
:gateway-filter="() => false"
|
|
10
|
+
:wallets-filter="() => true"
|
|
11
|
+
/>
|
|
12
|
+
<UnButton
|
|
13
|
+
class="sticky bottom-0"
|
|
14
|
+
variant="primary-fill"
|
|
15
|
+
:label="$t('\u062A\u0627\u06CC\u06CC\u062F')"
|
|
16
|
+
:disable="!selectedMethod?.id"
|
|
17
|
+
@click="$emit('submit')"
|
|
18
|
+
/>
|
|
19
|
+
</UnModal>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
const emit = defineEmits(["close"]);
|
|
24
|
+
const selectedPayment = defineModel();
|
|
25
|
+
const selectedMethod = defineModel("method");
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
|
+
modelValue?: any;
|
|
3
|
+
'method'?: any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Wallet } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
wallet: Wallet;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UnModal
|
|
3
|
+
head="درخواست برداشت"
|
|
4
|
+
@close="emit('close')"
|
|
5
|
+
>
|
|
6
|
+
<UnForm
|
|
7
|
+
ref="formRef"
|
|
8
|
+
v-model="form"
|
|
9
|
+
name="withdrawal"
|
|
10
|
+
:options="inputOptions"
|
|
11
|
+
/>
|
|
12
|
+
<UnButton
|
|
13
|
+
class="sticky bottom-0"
|
|
14
|
+
variant="primary-fill"
|
|
15
|
+
:label="$t('\u062B\u0628\u062A')"
|
|
16
|
+
:loading="loading"
|
|
17
|
+
@click="submitWithdrawal"
|
|
18
|
+
/>
|
|
19
|
+
</UnModal>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
import { saveWithdraw } from "../composables/services";
|
|
24
|
+
import { computed, navigateTo, ref, useNuxtApp, useTemplateRef } from "#imports";
|
|
25
|
+
const { wallet } = defineProps({
|
|
26
|
+
wallet: { type: Object, required: true }
|
|
27
|
+
});
|
|
28
|
+
const emit = defineEmits(["close"]);
|
|
29
|
+
const { $toast } = useNuxtApp();
|
|
30
|
+
const loading = ref(false);
|
|
31
|
+
const form = ref({});
|
|
32
|
+
const formRef = useTemplateRef("formRef");
|
|
33
|
+
const inputOptions = computed(() => ({
|
|
34
|
+
branchKey: {
|
|
35
|
+
required: !wallet.coin?.isFiat,
|
|
36
|
+
activatedBy: wallet.coin?.isFiat ? "test" : null
|
|
37
|
+
},
|
|
38
|
+
amount: {
|
|
39
|
+
append: wallet.coin?.isFiat ? "\u062A\u0648\u0645\u0627\u0646" : wallet.coin?.unit,
|
|
40
|
+
description: `\u0645\u0648\u062C\u0648\u062F\u06CC : ${wallet.balance?.toLocaleString("en") || 0} ${wallet.coin?.isFiat ? "\u062A\u0648\u0645\u0627\u0646" : wallet.coin?.unit}`,
|
|
41
|
+
hint: `\u062D\u062F\u0627\u0642\u0644 \u0645\u0642\u062F\u0627\u0631 \u0628\u0631\u062F\u0627\u0634\u062A: ${wallet.coin?.minWithdraw?.toLocaleString("en") || 0} ${wallet.coin?.isFiat ? "\u062A\u0648\u0645\u0627\u0646" : wallet.coin?.unit}`,
|
|
42
|
+
min: wallet.coin?.minWithdraw,
|
|
43
|
+
max: wallet.balance
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
const submitWithdrawal = async () => {
|
|
47
|
+
if (await formRef.value?.validate()) return;
|
|
48
|
+
if (loading.value) return;
|
|
49
|
+
if (wallet.balance < form.value?.amount) return $toast.error("\u0645\u0648\u062C\u0648\u062F\u06CC \u06A9\u0627\u0641\u06CC \u0646\u06CC\u0633\u062A.");
|
|
50
|
+
loading.value = true;
|
|
51
|
+
const res = await saveWithdraw(
|
|
52
|
+
{
|
|
53
|
+
amount: form.value?.amount,
|
|
54
|
+
status: "PENDING",
|
|
55
|
+
walletId: wallet.id,
|
|
56
|
+
userId: wallet.userId,
|
|
57
|
+
branchKey: form.value?.branchKey
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
if (res) {
|
|
61
|
+
$toast.success("\u062F\u0631\u062E\u0648\u0627\u0633\u062A \u0634\u0645\u0627 \u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u062B\u0628\u062A \u0634\u062F.");
|
|
62
|
+
await navigateTo({ name: "requests" });
|
|
63
|
+
}
|
|
64
|
+
loading.value = false;
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Wallet } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
wallet: Wallet;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
label?: string;
|
|
3
|
+
max?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue?: string | number;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: string | number | undefined) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-wrap items-center gap-1 pt-1 px-1">
|
|
3
|
+
<p
|
|
4
|
+
v-if="label"
|
|
5
|
+
class="basis-full -mb-2"
|
|
6
|
+
>
|
|
7
|
+
{{ label }}
|
|
8
|
+
</p>
|
|
9
|
+
<UnNuxtIcon
|
|
10
|
+
name="solar:add-circle-bold-duotone"
|
|
11
|
+
class="text-3xl text-primary-500 cursor-pointer "
|
|
12
|
+
@click.prevent.stop="increment(_min([step, remain]))"
|
|
13
|
+
/>
|
|
14
|
+
<UnInput
|
|
15
|
+
v-model="amount"
|
|
16
|
+
class="grow h-10"
|
|
17
|
+
class-name="border-none rounded-2xl bg-bg children:(text-center)"
|
|
18
|
+
@update:model-value="handler"
|
|
19
|
+
/>
|
|
20
|
+
<UnNuxtIcon
|
|
21
|
+
name="solar:minus-circle-line-duotone"
|
|
22
|
+
class="text-3xl text-primary-500 cursor-pointer"
|
|
23
|
+
@click.prevent.stop="increment(-step)"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import { _min, computed, s2n, toLocal } from "#imports";
|
|
30
|
+
const { max = 999999999, min = 0, step = 1e3 } = defineProps({
|
|
31
|
+
label: { type: String, required: false },
|
|
32
|
+
max: { type: Number, required: false },
|
|
33
|
+
min: { type: Number, required: false },
|
|
34
|
+
step: { type: Number, required: false }
|
|
35
|
+
});
|
|
36
|
+
const amount = defineModel({ type: [String, Number] });
|
|
37
|
+
const remain = computed(() => max - Number(s2n(amount.value)));
|
|
38
|
+
const increment = (e) => {
|
|
39
|
+
console.log(e);
|
|
40
|
+
if (e < 0 && Number(s2n(amount.value)) <= Math.abs(e)) {
|
|
41
|
+
amount.value = "0";
|
|
42
|
+
} else {
|
|
43
|
+
amount.value = toLocal(Number(s2n(amount.value)) + e, 0);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const handler = (e) => {
|
|
47
|
+
if (Number(s2n(amount.value)) < min) {
|
|
48
|
+
amount.value = min;
|
|
49
|
+
} else if (Number(s2n(amount.value)) > max) {
|
|
50
|
+
amount.value = toLocal(max, 0);
|
|
51
|
+
} else {
|
|
52
|
+
amount.value = toLocal(e, 0);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
label?: string;
|
|
3
|
+
max?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue?: string | number;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: string | number | undefined) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CoinGateway, Wallet } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
gatewayFilter?: (item: CoinGateway, i: number) => boolean;
|
|
4
|
+
walletsFilter?: (item: Wallet, i: number) => boolean;
|
|
5
|
+
walletsDisable?: (item: Wallet, i: number) => boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue?: any;
|
|
9
|
+
'method'?: any;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:modelValue": (value: any) => any;
|
|
14
|
+
"update:method": (value: any) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
17
|
+
"onUpdate:method"?: ((value: any) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UnSelect
|
|
3
|
+
v-model="selectedPayment"
|
|
4
|
+
:custom-class="{ innerWrapper: '<md:(!max-h-unset bg-white !pb-0 !border-(1 solid transparent))' }"
|
|
5
|
+
value-key="value"
|
|
6
|
+
light
|
|
7
|
+
class="z-1 grow-1 shrink-0"
|
|
8
|
+
inline
|
|
9
|
+
:items="deliverPayments"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
import { _ceil, computed, useGateways, useWallets, watch } from "#imports";
|
|
15
|
+
const { gatewayFilter, walletsFilter, walletsDisable } = defineProps({
|
|
16
|
+
gatewayFilter: { type: Function, required: false },
|
|
17
|
+
walletsFilter: { type: Function, required: false },
|
|
18
|
+
walletsDisable: { type: Function, required: false }
|
|
19
|
+
});
|
|
20
|
+
const wallets = await useWallets(true);
|
|
21
|
+
const gateways = await useGateways(true);
|
|
22
|
+
const selectedPayment = defineModel();
|
|
23
|
+
const selectedMethod = defineModel("method");
|
|
24
|
+
const deliverPayments = computed(() => [
|
|
25
|
+
...gateways.filter((e, i) => gatewayFilter?.(e, i) ?? true).map((e, index) => ({
|
|
26
|
+
...e,
|
|
27
|
+
avatar: e.gateway?.icon,
|
|
28
|
+
title: e.gateway?.label,
|
|
29
|
+
// description: e.gateway?.label,
|
|
30
|
+
value: index,
|
|
31
|
+
type: "gateway"
|
|
32
|
+
})),
|
|
33
|
+
...wallets.value.filter((e, i) => walletsFilter?.(e, i) ?? true).map((e, index) => ({
|
|
34
|
+
...e,
|
|
35
|
+
avatar: e.coin?.icon,
|
|
36
|
+
title: e.coin?.name,
|
|
37
|
+
unit: e.coin?.unit,
|
|
38
|
+
description: ["\u0645\u0627\u0646\u062F\u0647:", _ceil(e.balance || 0, e.coin?.precision || 0)?.toLocaleString("en"), e.coin?.isFiat ? "\u062A\u0648\u0645\u0627\u0646" : e.coin?.unit].join(" "),
|
|
39
|
+
value: gateways.filter((e2, i) => gatewayFilter?.(e2, i) ?? true)?.length + index,
|
|
40
|
+
type: "wallet"
|
|
41
|
+
})).map((e, i) => ({ ...e, disable: walletsDisable?.(e, i) }))
|
|
42
|
+
]);
|
|
43
|
+
watch(selectedPayment, () => {
|
|
44
|
+
selectedMethod.value = deliverPayments.value[selectedPayment.value] || deliverPayments.value[0];
|
|
45
|
+
}, {
|
|
46
|
+
immediate: true
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CoinGateway, Wallet } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
gatewayFilter?: (item: CoinGateway, i: number) => boolean;
|
|
4
|
+
walletsFilter?: (item: Wallet, i: number) => boolean;
|
|
5
|
+
walletsDisable?: (item: Wallet, i: number) => boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
modelValue?: any;
|
|
9
|
+
'method'?: any;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:modelValue": (value: any) => any;
|
|
14
|
+
"update:method": (value: any) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
17
|
+
"onUpdate:method"?: ((value: any) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Transaction } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
transaction: Transaction;
|
|
4
|
+
titleKey?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UnCard
|
|
3
|
+
:item="{
|
|
4
|
+
avatar: statusIcon,
|
|
5
|
+
description: Title
|
|
6
|
+
}"
|
|
7
|
+
:custom-class="{ title: '!text-sm', description: '!font-bold !text-gray-400', body: '!items-center', avatar: `!w-10 !h-10 !border-none ${statusVariant}` }"
|
|
8
|
+
>
|
|
9
|
+
<template #title>
|
|
10
|
+
<p
|
|
11
|
+
v-if="isProviderSide(config)"
|
|
12
|
+
class="font-bold"
|
|
13
|
+
>
|
|
14
|
+
{{ transaction.status === "SETTLED" ? "\u062A\u0633\u0648\u06CC\u0647 \u0634\u062F\u0647" : "\u062A\u0633\u0648\u06CC\u0647 \u0646\u0634\u062F\u0647" }}
|
|
15
|
+
</p>
|
|
16
|
+
<p
|
|
17
|
+
v-else
|
|
18
|
+
class="font-bold"
|
|
19
|
+
>
|
|
20
|
+
{{ _get(transaction, titleKey) || titleType[transaction.type] }}
|
|
21
|
+
{{ ["REJECTED", "FAILED"].includes(transaction.status) ? "(\u0646\u0627\u0645\u0648\u0641\u0642)" : "" }}
|
|
22
|
+
</p>
|
|
23
|
+
<p class="font-bold">
|
|
24
|
+
{{ transaction.amount?.toLocaleString("en") }} {{ $t("\u062A\u0648\u0645\u0627\u0646") }}
|
|
25
|
+
</p>
|
|
26
|
+
</template>
|
|
27
|
+
<template #bodyEnd>
|
|
28
|
+
<p class="text-gray-400 text-sm">
|
|
29
|
+
{{ moment(transaction.createdAt).locale("fa").format("jDD jMMMM jYYYY \u0633\u0627\u0639\u062A H:mm ") }}
|
|
30
|
+
</p>
|
|
31
|
+
</template>
|
|
32
|
+
</UnCard>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup>
|
|
36
|
+
import { _get, computed, isProviderSide, moment, useConfig, useUserId } from "#imports";
|
|
37
|
+
const config = useConfig();
|
|
38
|
+
const { titleKey = "booking.provider.fullName", transaction } = defineProps({
|
|
39
|
+
transaction: { type: Object, required: true },
|
|
40
|
+
titleKey: { type: String, required: false }
|
|
41
|
+
});
|
|
42
|
+
const userId = useUserId();
|
|
43
|
+
const titleType = {
|
|
44
|
+
DEPOSIT: "\u0648\u0627\u0631\u06CC\u0632",
|
|
45
|
+
PAYMENT: "\u067E\u0631\u062F\u0627\u062E\u062A",
|
|
46
|
+
TRANSFER: "\u0627\u0646\u062A\u0642\u0627\u0644",
|
|
47
|
+
WITHDRAW: "\u0628\u0631\u062F\u0627\u0634\u062A"
|
|
48
|
+
};
|
|
49
|
+
const Title = computed(() => {
|
|
50
|
+
if (transaction.description) {
|
|
51
|
+
return transaction.description;
|
|
52
|
+
}
|
|
53
|
+
if (transaction.type === "DEPOSIT" && transaction.bookingId) {
|
|
54
|
+
return `\u0628\u0627\u0632\u06AF\u0634\u062A \u0648\u062C\u0647 (${transaction.wallet?.coin?.name})`;
|
|
55
|
+
}
|
|
56
|
+
if (transaction.type === "DEPOSIT" && transaction.walletId && transaction.gatewayId) {
|
|
57
|
+
return `\u0634\u0627\u0631\u0698 ${transaction.wallet?.coin?.name} (\u062F\u0631\u06AF\u0627\u0647 ${transaction.gateway?.gateway?.label})`;
|
|
58
|
+
}
|
|
59
|
+
if (transaction.type === "DEPOSIT" && transaction.userId !== userId.value) {
|
|
60
|
+
return `\u0627\u0639\u062A\u0628\u0627\u0631 \u0647\u062F\u06CC\u0647 (${transaction.wallet?.coin?.name})`;
|
|
61
|
+
}
|
|
62
|
+
if (transaction.type === "PAYMENT" && transaction.gateway?.gateway) {
|
|
63
|
+
return `\u067E\u0631\u062F\u0627\u062E\u062A \u0622\u0646\u0644\u0627\u06CC\u0646 (\u062F\u0631\u06AF\u0627\u0647 ${transaction.gateway?.gateway?.label})`;
|
|
64
|
+
}
|
|
65
|
+
if (transaction.type === "PAYMENT" && transaction.walletId) {
|
|
66
|
+
return `\u067E\u0631\u062F\u0627\u062E\u062A \u0627\u0632 ${transaction.wallet?.coin?.name}`;
|
|
67
|
+
}
|
|
68
|
+
if (transaction.type === "DEPOSIT" && transaction.walletId && transaction.wallet?.userId !== userId.value) {
|
|
69
|
+
return `\u0634\u0627\u0631\u0698 ${transaction.wallet?.coin?.name} ${transaction.wallet?.user?.profile?.firstName || ""} ${transaction.wallet?.user?.profile?.lastName || ""}`;
|
|
70
|
+
}
|
|
71
|
+
if (transaction.type === "DEPOSIT" && transaction.walletId) {
|
|
72
|
+
return `\u0634\u0627\u0631\u0698 ${transaction.wallet?.coin?.name}`;
|
|
73
|
+
}
|
|
74
|
+
if (transaction.type === "TRANSFER" && transaction.toWallet?.userId === userId.value) {
|
|
75
|
+
return `\u0634\u0627\u0631\u0698 ${transaction.wallet?.coin?.name} \u0627\u0632 \u0637\u0631\u0641 ${transaction.wallet?.user?.profile?.firstName || ""} ${transaction.wallet?.user?.profile?.lastName || ""}`;
|
|
76
|
+
}
|
|
77
|
+
if (transaction.type === "TRANSFER" && transaction.toWallet?.userId !== userId.value) {
|
|
78
|
+
return `\u0627\u0631\u0633\u0627\u0644 \u0634\u0627\u0631\u0698 ${transaction.wallet?.coin?.name} \u0628\u0647 ${transaction.toWallet?.user?.profile?.firstName || ""} ${transaction.toWallet?.user?.profile?.lastName || ""}`;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const statusVariant = computed(() => ["REJECTED", "FAILED"].includes(transaction.status) ? "text-danger" : transaction.type === "DEPOSIT" || transaction.type === "TRANSFER" && transaction.toWallet?.userId === userId.value ? "text-success" : "text-danger");
|
|
82
|
+
const statusIcon = computed(() => ["REJECTED", "FAILED"].includes(transaction.status) ? "solar:danger-circle-bold-duotone" : transaction.type === "DEPOSIT" || transaction.type === "TRANSFER" && transaction.toWallet?.userId === userId.value ? "solar:import-bold-duotone" : "solar:export-bold-duotone");
|
|
83
|
+
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Transaction } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
transaction: Transaction;
|
|
4
|
+
titleKey?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
multi?: boolean;
|
|
3
|
+
noWithdraw?: boolean;
|
|
4
|
+
noDeposit?: boolean;
|
|
5
|
+
noTransfer?: boolean;
|
|
6
|
+
trxQuery?: Record<string, string | number | boolean>;
|
|
7
|
+
trxTitleKey?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-4 grow">
|
|
3
|
+
<UnTab
|
|
4
|
+
v-if="multi"
|
|
5
|
+
v-model="tab"
|
|
6
|
+
:items="tabs"
|
|
7
|
+
:custom-class="{ label: '[&.selected]:bg-transparent' }"
|
|
8
|
+
/>
|
|
9
|
+
<div
|
|
10
|
+
v-else
|
|
11
|
+
class="mt-2 relative bg-white rounded-2xl py-4 flex flex-col items-center font-bold text-lg text-center text-primary-500"
|
|
12
|
+
>
|
|
13
|
+
<UnNuxtIcon
|
|
14
|
+
name="solar:refresh-circle-bold-duotone"
|
|
15
|
+
class="!absolute right-4 top-4 text-primary-500 cursor-pointer"
|
|
16
|
+
@click="showWalletModal = true"
|
|
17
|
+
/>
|
|
18
|
+
<p>
|
|
19
|
+
{{ $t("\u0627\u0639\u062A\u0628\u0627\u0631") + " " + selectedWallet?.coin?.name }}:
|
|
20
|
+
</p>
|
|
21
|
+
<p>
|
|
22
|
+
{{ _round(selectedWallet?.balance || 0, selectedWallet?.coin?.precision || 0)?.toLocaleString("en") }}
|
|
23
|
+
{{ $t("\u062A\u0648\u0645\u0627\u0646") }}
|
|
24
|
+
</p>
|
|
25
|
+
</div>
|
|
26
|
+
<UnSelect
|
|
27
|
+
v-if="tab === 'wallet' && multi"
|
|
28
|
+
v-model="selectedWallet"
|
|
29
|
+
:custom-class="{ innerWrapper: '<md:(!max-h-unset bg-white !pb-0 !border-(1 solid transparent)' }"
|
|
30
|
+
inline
|
|
31
|
+
light
|
|
32
|
+
:items="mappedWallet"
|
|
33
|
+
class="z-1"
|
|
34
|
+
/>
|
|
35
|
+
<template v-else>
|
|
36
|
+
<div class="flex items-center justify-between">
|
|
37
|
+
<UnSelect
|
|
38
|
+
v-model="filterWallet"
|
|
39
|
+
light
|
|
40
|
+
:custom-class="{ header: '!h-unset !px-2', radio: '!p-1 !px-3', radioItem: { card: 'grow-1', item: { body: '!p-1' } } }"
|
|
41
|
+
:items="[{ title: '\u0647\u0645\u0647 \u062A\u0631\u0627\u06A9\u0646\u0634 \u0647\u0627', id: null }, ...mappedWallet]"
|
|
42
|
+
value-key="id"
|
|
43
|
+
/>
|
|
44
|
+
<!-- <TheChips label="تراکنش های کیف پول" prepend="solar:check-read-outline" -->
|
|
45
|
+
<!-- :variant="onlyWallet ? 'secondary-fill' : 'secondary'" @click="toggleOnlyWallet"/> -->
|
|
46
|
+
</div>
|
|
47
|
+
<div class="relative grow">
|
|
48
|
+
<div
|
|
49
|
+
v-if="status === 'success' && filteredTransactions?.length"
|
|
50
|
+
class="children:shrink-0 absolute h-full w-full overflow-y-auto flex flex-col items-stretch grow gap-3"
|
|
51
|
+
>
|
|
52
|
+
<UnTransaction
|
|
53
|
+
v-for="transaction in filteredTransactions"
|
|
54
|
+
:key="transaction.id"
|
|
55
|
+
:title-key="trxTitleKey"
|
|
56
|
+
:transaction="transaction"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
<UnWalletActions
|
|
62
|
+
v-if="selectedWallet?.id && tab === 'wallet'"
|
|
63
|
+
:selected-wallet="selectedWallet"
|
|
64
|
+
:no-deposit
|
|
65
|
+
:no-withdraw
|
|
66
|
+
:no-transfer
|
|
67
|
+
@withdraw="withdraw"
|
|
68
|
+
@transfer="transferModal = true"
|
|
69
|
+
@deposit="showModal = true"
|
|
70
|
+
/>
|
|
71
|
+
<UnModalWalletIncrease
|
|
72
|
+
v-if="showModal && selectedWallet?.id"
|
|
73
|
+
:wallet="selectedWallet"
|
|
74
|
+
@close="showModal = false"
|
|
75
|
+
/>
|
|
76
|
+
<UnModalTransfer
|
|
77
|
+
v-if="transferModal"
|
|
78
|
+
@close="transferModal = false;
|
|
79
|
+
refresh()"
|
|
80
|
+
/>
|
|
81
|
+
<UnModalWithdrawal
|
|
82
|
+
v-if="withdrawalModal"
|
|
83
|
+
:wallet="selectedWallet"
|
|
84
|
+
@close="withdrawalModal = false"
|
|
85
|
+
/>
|
|
86
|
+
<UnModalWalletSelection
|
|
87
|
+
v-if="!multi"
|
|
88
|
+
v-show="showWalletModal"
|
|
89
|
+
v-model="selectedWalletIndex"
|
|
90
|
+
v-model:method="selectedWallet"
|
|
91
|
+
@update:method="showWalletModal = false"
|
|
92
|
+
@close="showWalletModal = false"
|
|
93
|
+
@submit="showWalletModal = false"
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<script setup>
|
|
99
|
+
import { _ceil, _round, computed, ref, useAsyncData, useNuxtApp, useUser, useWallets } from "#imports";
|
|
100
|
+
import { getMyTransactions } from "../composables/services";
|
|
101
|
+
const { multi = true, trxQuery = {} } = defineProps({
|
|
102
|
+
multi: { type: Boolean, required: false },
|
|
103
|
+
noWithdraw: { type: Boolean, required: false },
|
|
104
|
+
noDeposit: { type: Boolean, required: false },
|
|
105
|
+
noTransfer: { type: Boolean, required: false },
|
|
106
|
+
trxQuery: { type: Object, required: false },
|
|
107
|
+
trxTitleKey: { type: String, required: false }
|
|
108
|
+
});
|
|
109
|
+
const tabs = [
|
|
110
|
+
{
|
|
111
|
+
value: "wallet",
|
|
112
|
+
title: "\u06A9\u06CC\u0641 \u067E\u0648\u0644"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: "transaction",
|
|
116
|
+
title: "\u062A\u0631\u0627\u06A9\u0646\u0634 \u0647\u0627"
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
const tab = ref("wallet");
|
|
120
|
+
const filterWallet = ref(null);
|
|
121
|
+
const wallets = await useWallets(true);
|
|
122
|
+
const mappedWallet = computed(() => wallets.value.map((e) => ({
|
|
123
|
+
...e,
|
|
124
|
+
icon: e.coin?.icon,
|
|
125
|
+
title: e.coin?.name,
|
|
126
|
+
unit: e.coin?.unit,
|
|
127
|
+
description: ["\u0645\u0627\u0646\u062F\u0647:", _ceil(e.balance || 0, e.coin?.precision || 0)?.toLocaleString("en"), e.coin?.isFiat ? "\u062A\u0648\u0645\u0627\u0646" : e.coin?.unit].join(" "),
|
|
128
|
+
type: "wallet"
|
|
129
|
+
})));
|
|
130
|
+
const selectedWalletIndex = ref(wallets.value[0]?.id);
|
|
131
|
+
const selectedWallet = ref(mappedWallet.value[0]);
|
|
132
|
+
const showModal = ref(false);
|
|
133
|
+
const transferModal = ref(false);
|
|
134
|
+
const withdrawalModal = ref(false);
|
|
135
|
+
const showWalletModal = ref(false);
|
|
136
|
+
const {
|
|
137
|
+
data: transactions,
|
|
138
|
+
status,
|
|
139
|
+
refresh
|
|
140
|
+
} = useAsyncData("get-trxs", () => getMyTransactions(trxQuery));
|
|
141
|
+
const user = useUser();
|
|
142
|
+
const { $toast } = useNuxtApp();
|
|
143
|
+
const withdraw = () => {
|
|
144
|
+
if (selectedWallet.value?.coin?.isFiat && (!user.value?.profile?.idCard || !user.value?.profile?.iban)) {
|
|
145
|
+
return $toast.error("\u062C\u0647\u062A \u062B\u0628\u062A \u0628\u0631\u062F\u0627\u0634\u062A \u0644\u0637\u0641\u0627 \u06A9\u062F\u0645\u0644\u06CC \u0648 \u0634\u0645\u0627\u0631\u0647 \u0634\u0628\u0627 \u0631\u0627 \u062F\u0631 \u062D\u0633\u0627\u0628 \u06A9\u0627\u0631\u0628\u0631\u06CC \u062A\u06A9\u0645\u06CC\u0644 \u0646\u0645\u0627\u06CC\u06CC\u062F.");
|
|
146
|
+
}
|
|
147
|
+
withdrawalModal.value = true;
|
|
148
|
+
};
|
|
149
|
+
const filteredTransactions = computed(() => transactions.value?.filter((e) => `${e.walletId} ${e.toWalletId}`.includes(filterWallet.value || "")));
|
|
150
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
multi?: boolean;
|
|
3
|
+
noWithdraw?: boolean;
|
|
4
|
+
noDeposit?: boolean;
|
|
5
|
+
noTransfer?: boolean;
|
|
6
|
+
trxQuery?: Record<string, string | number | boolean>;
|
|
7
|
+
trxTitleKey?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Wallet } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
selectedWallet: Wallet | null;
|
|
4
|
+
noWithdraw?: boolean;
|
|
5
|
+
noDeposit?: boolean;
|
|
6
|
+
noTransfer?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="border-t-(1 solid border) flex flex-wrap children:grow-1 sticky bottom-0 mt-auto z-2 bg-white rounded-t-xl -mx-4 <md:-mx-3 px-4 py-3 gap-3">
|
|
3
|
+
<UnCard
|
|
4
|
+
:item="selectedWallet"
|
|
5
|
+
class="basis-full"
|
|
6
|
+
/>
|
|
7
|
+
<UnButton
|
|
8
|
+
v-if="selectedWallet?.coin?.withdrawable && !noWithdraw"
|
|
9
|
+
variant="primary-fill"
|
|
10
|
+
class="basis-full"
|
|
11
|
+
label="برداشت"
|
|
12
|
+
@click="$emit('withdraw')"
|
|
13
|
+
/>
|
|
14
|
+
<UnButton
|
|
15
|
+
v-if="selectedWallet?.coin?.transferable && !noTransfer"
|
|
16
|
+
variant="primary-fill"
|
|
17
|
+
label="انتقال"
|
|
18
|
+
@click="$emit('transfer')"
|
|
19
|
+
/>
|
|
20
|
+
<UnButton
|
|
21
|
+
v-if="selectedWallet?.coin?.depositable && !noDeposit"
|
|
22
|
+
variant="primary-fill"
|
|
23
|
+
label="افزایش اعتبار"
|
|
24
|
+
@click="$emit('deposit')"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup>
|
|
30
|
+
defineProps({
|
|
31
|
+
selectedWallet: { type: [Object, null], required: true },
|
|
32
|
+
noWithdraw: { type: Boolean, required: false },
|
|
33
|
+
noDeposit: { type: Boolean, required: false },
|
|
34
|
+
noTransfer: { type: Boolean, required: false }
|
|
35
|
+
});
|
|
36
|
+
defineEmits(["withdraw", "transfer", "deposit"]);
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Wallet } from '../types/models.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
selectedWallet: Wallet | null;
|
|
4
|
+
noWithdraw?: boolean;
|
|
5
|
+
noDeposit?: boolean;
|
|
6
|
+
noTransfer?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
navigateTo,
|
|
11
11
|
onBeforeUnmount,
|
|
12
12
|
ref,
|
|
13
|
+
useDevice,
|
|
13
14
|
useGet,
|
|
15
|
+
useI18n,
|
|
14
16
|
useNuxtApp,
|
|
15
17
|
usePost,
|
|
16
18
|
useState
|
|
@@ -213,9 +215,9 @@ export const useWallets = async (isActive = void 0, id = void 0) => {
|
|
|
213
215
|
const { result: currentWallets } = await useGet("/wallet", {
|
|
214
216
|
params: {
|
|
215
217
|
"$w.userId": userId.value,
|
|
216
|
-
|
|
217
|
-
"$i.coin.$i.gateways.$w.active":
|
|
218
|
-
"$i.coin.$i.gateways.$i.gateway":
|
|
218
|
+
// '$w.isActive': isActive,
|
|
219
|
+
"$i.coin.$i.gateways.$w.active": isActive,
|
|
220
|
+
"$i.coin.$i.gateways.$i.gateway": isActive
|
|
219
221
|
}
|
|
220
222
|
});
|
|
221
223
|
const { result: coins } = await useGet("/coin", { params: { "$w.walletable": true } });
|
|
@@ -225,14 +227,14 @@ export const useWallets = async (isActive = void 0, id = void 0) => {
|
|
|
225
227
|
coinId: e.id,
|
|
226
228
|
userId: userId.value
|
|
227
229
|
})).filter((c) => !wallet.value?.find((w) => w.coinId === c.coinId));
|
|
228
|
-
if (wallets
|
|
230
|
+
if (wallets?.length) {
|
|
229
231
|
await usePost("/wallet", wallets);
|
|
230
232
|
const { result: w } = await useGet("/wallet", {
|
|
231
233
|
params: {
|
|
232
234
|
"$w.userId": userId.value,
|
|
233
|
-
"$i.coin.$i.gateways.$w.active":
|
|
234
|
-
"$i.coin.$i.gateways.$i.gateway":
|
|
235
|
-
|
|
235
|
+
"$i.coin.$i.gateways.$w.active": isActive,
|
|
236
|
+
"$i.coin.$i.gateways.$i.gateway": isActive
|
|
237
|
+
// '$w.isActive': isActive,
|
|
236
238
|
}
|
|
237
239
|
});
|
|
238
240
|
wallet.value = w || [];
|
|
@@ -293,20 +295,27 @@ export const getDiscountInfo = async (code, shop = null) => {
|
|
|
293
295
|
};
|
|
294
296
|
export const submitPayment = async (amount, details = {}, giftCode = void 0, redirect = true) => {
|
|
295
297
|
const userId = useUserId();
|
|
298
|
+
const { isIos } = useDevice();
|
|
296
299
|
const { $toast } = useNuxtApp();
|
|
297
300
|
const { result } = await usePost("/transaction", {
|
|
298
301
|
amount,
|
|
299
302
|
userId: userId.value || "",
|
|
300
303
|
discountCode: giftCode,
|
|
301
304
|
type: "PAYMENT",
|
|
302
|
-
redirectUrl: location.origin + "/verify",
|
|
305
|
+
redirectUrl: window.urlPrefix + location.origin + "/verify",
|
|
303
306
|
...details
|
|
304
307
|
});
|
|
305
308
|
console.log("here", result);
|
|
306
309
|
if (redirect) {
|
|
307
310
|
if (result?.paymentUrl) {
|
|
308
311
|
$toast.success("\u062F\u0631\u062D\u0627\u0644 \u0627\u0646\u062A\u0642\u0627\u0644 \u0628\u0647 \u062F\u0631\u06AF\u0627\u0647 \u067E\u0631\u062F\u0627\u062E\u062A");
|
|
309
|
-
|
|
312
|
+
if (result) {
|
|
313
|
+
if (isIos && window.urlPrefix) {
|
|
314
|
+
window.parent.location.href = result?.paymentUrl;
|
|
315
|
+
} else {
|
|
316
|
+
window.open(result?.paymentUrl, window.urlPrefix ? "_blank" : "_self");
|
|
317
|
+
}
|
|
318
|
+
}
|
|
310
319
|
} else if (result?.id) {
|
|
311
320
|
$toast.success("\u067E\u0631\u062F\u0627\u062E\u062A \u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u0627\u0646\u062C\u0627\u0645 \u0634\u062F.");
|
|
312
321
|
navigateTo({ name: "verify", query: { txId: result.id } });
|