@monkeyplus/payscope 1.0.0
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/THIRD-PARTY-LICENSES.md +41 -0
- package/dist/_chunks/auth.d.mts +707 -0
- package/dist/_chunks/database.mjs +831 -0
- package/dist/_chunks/db.d.mts +7100 -0
- package/dist/_chunks/index.d.mts +178 -0
- package/dist/_chunks/lib.mjs +3073 -0
- package/dist/_chunks/libs/better-call.d.mts +478 -0
- package/dist/_chunks/libs/postgres.d.mts +1 -0
- package/dist/_chunks/rolldown-runtime.mjs +11 -0
- package/dist/server/db.d.mts +2 -0
- package/dist/server/db.mjs +108 -0
- package/dist/server/env.d.mts +21 -0
- package/dist/server/env.mjs +22 -0
- package/dist/server/lib.d.mts +362 -0
- package/dist/server/lib.mjs +2 -0
- package/dist/server/router.d.mts +1218 -0
- package/dist/server/router.mjs +1157 -0
- package/dist/server/schemas/auth.d.mts +2 -0
- package/dist/server/schemas/auth.mjs +62 -0
- package/package.json +58 -0
- package/storefront/Readme.md +0 -0
- package/storefront/auth.ts +29 -0
- package/storefront/cart/ResumeCart.vue +217 -0
- package/storefront/cart/ResumeCartSelect.vue +32 -0
- package/storefront/cart/ShoppinCart.vue +100 -0
- package/storefront/cart/ShoppinCartItem.vue +99 -0
- package/storefront/checkout/App.vue +36 -0
- package/storefront/checkout/AppCart.vue +72 -0
- package/storefront/checkout/AppCartDiscount.vue +74 -0
- package/storefront/checkout/AppCartTotals.vue +72 -0
- package/storefront/checkout/AppLoading.vue +55 -0
- package/storefront/checkout/composables.ts +28 -0
- package/storefront/checkout/constants.ts +0 -0
- package/storefront/checkout/main.ts +11 -0
- package/storefront/checkout/pages/Address/Address.vue +95 -0
- package/storefront/checkout/pages/Info/Info.vue +94 -0
- package/storefront/checkout/pages/Info/InfoUser.vue +38 -0
- package/storefront/checkout/pages/Pay/Pay.vue +115 -0
- package/storefront/checkout/pages/Pay/Providers/BancoEconomico/BancoEconomico.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Cybersource/Cybersource.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Datafast/Datafast.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Multipago/Multipago.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Pagomedios/Pagomedios.vue +93 -0
- package/storefront/checkout/pages/Pay/Providers/Pagomedios/composable.ts +23 -0
- package/storefront/checkout/pages/Pay/Providers/Paypal/Paypal.vue +168 -0
- package/storefront/checkout/pages/Pay/Providers/Paypal/composable.ts +33 -0
- package/storefront/checkout/pages/Pay/Providers/Placetopay/Placetopay.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Wabi/Wabi.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/composable.ts +30 -0
- package/storefront/checkout/pages/Payment/Payment.vue +19 -0
- package/storefront/checkout/pages/Payment/PaymentStatus.vue +187 -0
- package/storefront/checkout/pages/Payment/PaymentStatusDetail.vue +77 -0
- package/storefront/checkout/pages/Payment/composable.ts +81 -0
- package/storefront/checkout/pages/Shipping/Shipping.vue +67 -0
- package/storefront/checkout/pages/StepInfo.vue +37 -0
- package/storefront/checkout/router.ts +59 -0
- package/storefront/index.ts +3 -0
- package/storefront/login/App.vue +9 -0
- package/storefront/login/main.ts +10 -0
- package/storefront/login/pages/SignIn/Login.vue +82 -0
- package/storefront/login/pages/SignUp/SignUp.vue +99 -0
- package/storefront/login/router.ts +15 -0
- package/storefront/product/AddProduct.vue +303 -0
- package/storefront/product/AddProductNumber.vue +62 -0
- package/storefront/product/AddProductVariant.vue +66 -0
- package/storefront/profile/App.vue +88 -0
- package/storefront/profile/main.ts +10 -0
- package/storefront/profile/pages/Addresses/Addresses.vue +79 -0
- package/storefront/profile/pages/Addresses/AddressesForm.vue +95 -0
- package/storefront/profile/pages/Addresses/AddressesModal.vue +24 -0
- package/storefront/profile/pages/Buys/Buys.vue +8 -0
- package/storefront/profile/pages/Me/Me.vue +15 -0
- package/storefront/profile/pages/Me/MeBilling.vue +79 -0
- package/storefront/profile/pages/Me/MeBillingForm.vue +66 -0
- package/storefront/profile/pages/Me/MeBillingModal.vue +24 -0
- package/storefront/profile/pages/Me/MeInfo.vue +75 -0
- package/storefront/profile/pages/Me/MePassword.vue +53 -0
- package/storefront/profile/pages/Me/MeSubscriptions.vue +15 -0
- package/storefront/profile/pages/Returns/Returns.vue +8 -0
- package/storefront/profile/pages/Whislist/Whislist.vue +8 -0
- package/storefront/profile/router.ts +32 -0
- package/storefront/stores.ts +320 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { __exportAll } from "../../_chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { boolean, date, index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
3
|
+
var auth_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
account: () => account,
|
|
5
|
+
session: () => session,
|
|
6
|
+
user: () => user,
|
|
7
|
+
verification: () => verification
|
|
8
|
+
});
|
|
9
|
+
const user = pgTable("user", {
|
|
10
|
+
id: text("id").primaryKey(),
|
|
11
|
+
name: text("name").notNull(),
|
|
12
|
+
email: text("email").notNull().unique(),
|
|
13
|
+
emailVerified: boolean("email_verified").default(false).notNull(),
|
|
14
|
+
image: text("image"),
|
|
15
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
16
|
+
updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull(),
|
|
17
|
+
role: text("role"),
|
|
18
|
+
banned: boolean("banned").default(false),
|
|
19
|
+
banReason: text("ban_reason"),
|
|
20
|
+
banExpires: timestamp("ban_expires"),
|
|
21
|
+
username: text("username").unique(),
|
|
22
|
+
displayUsername: text("display_username"),
|
|
23
|
+
surname: text("surname"),
|
|
24
|
+
identification: text("identification"),
|
|
25
|
+
phone: text("phone"),
|
|
26
|
+
birthday: date("birthday")
|
|
27
|
+
});
|
|
28
|
+
const session = pgTable("session", {
|
|
29
|
+
id: text("id").primaryKey(),
|
|
30
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
31
|
+
token: text("token").notNull().unique(),
|
|
32
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
33
|
+
updatedAt: timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull(),
|
|
34
|
+
ipAddress: text("ip_address"),
|
|
35
|
+
userAgent: text("user_agent"),
|
|
36
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
37
|
+
impersonatedBy: text("impersonated_by")
|
|
38
|
+
}, (table) => [index("session_userId_idx").on(table.userId)]);
|
|
39
|
+
const account = pgTable("account", {
|
|
40
|
+
id: text("id").primaryKey(),
|
|
41
|
+
accountId: text("account_id").notNull(),
|
|
42
|
+
providerId: text("provider_id").notNull(),
|
|
43
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
44
|
+
accessToken: text("access_token"),
|
|
45
|
+
refreshToken: text("refresh_token"),
|
|
46
|
+
idToken: text("id_token"),
|
|
47
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
48
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
49
|
+
scope: text("scope"),
|
|
50
|
+
password: text("password"),
|
|
51
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
52
|
+
updatedAt: timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
53
|
+
}, (table) => [index("account_userId_idx").on(table.userId)]);
|
|
54
|
+
const verification = pgTable("verification", {
|
|
55
|
+
id: text("id").primaryKey(),
|
|
56
|
+
identifier: text("identifier").notNull(),
|
|
57
|
+
value: text("value").notNull(),
|
|
58
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
59
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
60
|
+
updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
61
|
+
}, (table) => [index("verification_identifier_idx").on(table.identifier)]);
|
|
62
|
+
export { account, auth_exports, session, user, verification };
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@monkeyplus/payscope",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"packageManager": "pnpm@10.8.1",
|
|
6
|
+
"author": "",
|
|
7
|
+
"keywords": [],
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./storefront/index.ts",
|
|
10
|
+
"./stores": "./storefront/stores.ts",
|
|
11
|
+
"./auth": "./storefront/auth.ts",
|
|
12
|
+
"./appProfile": "./storefront/profile/main.ts",
|
|
13
|
+
"./appLogin": "./storefront/login/main.ts",
|
|
14
|
+
"./appCheckout": "./storefront/checkout/main.ts",
|
|
15
|
+
"./product/*": "./storefront/product/*",
|
|
16
|
+
"./cart/*": "./storefront/cart/*",
|
|
17
|
+
"./checkout/*": "./storefront/checkout/*",
|
|
18
|
+
"./login/*": "./storefront/login/*",
|
|
19
|
+
"./profile/*": "./storefront/profile/*",
|
|
20
|
+
"./server/*.js": {
|
|
21
|
+
"types": "./dist/server/*.d.mts",
|
|
22
|
+
"import": "./dist/server/*.mjs",
|
|
23
|
+
"default": "./dist/server/*.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./server/*": {
|
|
26
|
+
"types": "./dist/server/*.d.mts",
|
|
27
|
+
"import": "./dist/server/*.mjs",
|
|
28
|
+
"default": "./dist/server/*.mjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"./dist",
|
|
33
|
+
"./storefront"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"prepack": "obuild",
|
|
37
|
+
"build": "obuild",
|
|
38
|
+
"stub": "obuild --stub",
|
|
39
|
+
"publish:package": "pnpm build && npm publish --access public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@vueuse/core": "^14.3.0",
|
|
43
|
+
"better-auth": "^1.6.11",
|
|
44
|
+
"dayjs": "^1.11.21",
|
|
45
|
+
"defu": "^6.1.7",
|
|
46
|
+
"drizzle-orm": "1.0.0-rc.3",
|
|
47
|
+
"h3": "^2.0.1-rc.22",
|
|
48
|
+
"ofetch": "^1.5.1",
|
|
49
|
+
"pinia": "^3.0.4",
|
|
50
|
+
"qs": "^6.14.0",
|
|
51
|
+
"ufo": "^1.6.4",
|
|
52
|
+
"vue": "^3.5.38",
|
|
53
|
+
"zod": "^4.4.3"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"obuild": "^0.4.37"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { adminClient, usernameClient } from 'better-auth/client/plugins';
|
|
2
|
+
import { createAuthClient } from 'better-auth/vue';
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
|
|
5
|
+
export const authClient = createAuthClient({
|
|
6
|
+
baseURL: `${window.location.origin || 'http://localhost'}/api/auth`, // not used but required
|
|
7
|
+
plugins: [
|
|
8
|
+
adminClient(),
|
|
9
|
+
usernameClient(),
|
|
10
|
+
],
|
|
11
|
+
fetchOptions: {
|
|
12
|
+
baseURL: `${window.location.origin || 'http://localhost'}/api/auth`, // Use the custom protocol for authentication requests
|
|
13
|
+
auth: {
|
|
14
|
+
type: 'Bearer',
|
|
15
|
+
token: () => localStorage.getItem('auth_token')?.replace('Bearer ', '') || '', // get the token from localStorage
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export function useSession() {
|
|
21
|
+
const session = authClient.useSession();
|
|
22
|
+
const role = computed(() => session.value?.data?.user?.role);
|
|
23
|
+
const user = computed(() => session.value?.data?.user);
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
role,
|
|
27
|
+
user,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useEventBus } from '@vueuse/core';
|
|
3
|
+
import { ofetch } from 'ofetch';
|
|
4
|
+
import { inject, onBeforeMount, ref } from 'vue';
|
|
5
|
+
import { useCartStore } from '../stores';
|
|
6
|
+
import ResumeCartSelect from './ResumeCartSelect.vue';
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
theme: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'fatto',
|
|
12
|
+
},
|
|
13
|
+
notePrices: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'El precio ya contiene impuestos',
|
|
16
|
+
},
|
|
17
|
+
notePricesExtra: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'Los costos de envio y desglose de impuestos se calculan en el checkout',
|
|
20
|
+
},
|
|
21
|
+
priceValue: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: 'lineItemsSubtotalPrice',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const cart = useCartStore();
|
|
27
|
+
|
|
28
|
+
const busSession = useEventBus('busSession');
|
|
29
|
+
|
|
30
|
+
const isAuth = ref(false);
|
|
31
|
+
// const dialog = ref(false);
|
|
32
|
+
// const loadingGo = ref(false);
|
|
33
|
+
onBeforeMount(() => {
|
|
34
|
+
// init();
|
|
35
|
+
});
|
|
36
|
+
const checkoutPage = '/checkout/';
|
|
37
|
+
|
|
38
|
+
const loading = ref(false);
|
|
39
|
+
const checkoutItems = inject('checkoutItems', (items: any) => items);
|
|
40
|
+
async function toCheckout() {
|
|
41
|
+
//
|
|
42
|
+
loading.value = true;
|
|
43
|
+
try {
|
|
44
|
+
// if (!isAuth.value) {
|
|
45
|
+
// busSession.emit({ action: 'login' });
|
|
46
|
+
// return undefined;
|
|
47
|
+
// }
|
|
48
|
+
|
|
49
|
+
const items = cart.items;
|
|
50
|
+
sessionStorage.removeItem('eCustomer');
|
|
51
|
+
sessionStorage.removeItem('eQuery');
|
|
52
|
+
localStorage.removeItem('eCustomer');
|
|
53
|
+
localStorage.removeItem('eQuery');
|
|
54
|
+
|
|
55
|
+
// console.log(items);
|
|
56
|
+
const _items = checkoutItems(items);
|
|
57
|
+
|
|
58
|
+
await ofetch('/storefront/checkout', { method: 'POST', body: { items: _items, total: 0 } });
|
|
59
|
+
|
|
60
|
+
// if(state.i)
|
|
61
|
+
location.href = checkoutPage;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.warn(error);
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
loading.value = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// const form = ref('login');
|
|
71
|
+
// function changeForm(view: string) {
|
|
72
|
+
// form.value = view;
|
|
73
|
+
// }
|
|
74
|
+
const isDefault = props.theme === 'default';
|
|
75
|
+
const isFatto: boolean = props.theme === 'fatto';
|
|
76
|
+
async function removeItem(id: string) {
|
|
77
|
+
loading.value = true;
|
|
78
|
+
try {
|
|
79
|
+
// await crud.delete(id);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.warn(error);
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
loading.value = false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function toStore() {
|
|
89
|
+
location.href = '/my-store';
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<div class="max-w-screen-xl p-4 z-0">
|
|
95
|
+
<div
|
|
96
|
+
class="flex sm:space-x-4 items-start relative "
|
|
97
|
+
:class="{
|
|
98
|
+
'opacity-50': loading,
|
|
99
|
+
'<md:flex-col <md:items-end <md:space-y-2 <md:space-x-0': isDefault,
|
|
100
|
+
'flex-col': isFatto,
|
|
101
|
+
}"
|
|
102
|
+
>
|
|
103
|
+
<div v-show="loading" title="blocker" class="absolute w-full h-full z-10" />
|
|
104
|
+
<div class=" p-4 rounded flex-1 w-full">
|
|
105
|
+
<div v-if="isDefault" class="text-3xl font-medium dark:text-white">
|
|
106
|
+
Carrito
|
|
107
|
+
</div>
|
|
108
|
+
<div class="border-b text-gray-700 text-sm text-right dark:text-gray-100">
|
|
109
|
+
Precio
|
|
110
|
+
</div>
|
|
111
|
+
<div v-for="item in cart.items" :key="item.id" class="border-b p-3 flex <md:flex-col relative">
|
|
112
|
+
<div class="w-[160px] h-[160px] pr-2 overflow-hidden bg-gray-300/50 mr-3">
|
|
113
|
+
<img :src="item.variant?.image?.src" alt="">
|
|
114
|
+
</div>
|
|
115
|
+
<div class="flex-1 pt-2 dark:text-white">
|
|
116
|
+
<div class="text-xl">
|
|
117
|
+
{{ item.title }}
|
|
118
|
+
</div>
|
|
119
|
+
<div v-if="isDefault" class="text-sm text-green-600">
|
|
120
|
+
Disponible
|
|
121
|
+
</div>
|
|
122
|
+
<div>
|
|
123
|
+
<template
|
|
124
|
+
v-for="(option) in item?.variant?.selectedOptions || []"
|
|
125
|
+
:key="option.name"
|
|
126
|
+
>
|
|
127
|
+
<div v-show="option.name !== 'x'">
|
|
128
|
+
<span class=" capitalize font-bold"> {{ option.name }}: </span>
|
|
129
|
+
<span class="capitalize">
|
|
130
|
+
{{ option.value }}
|
|
131
|
+
</span>
|
|
132
|
+
</div>
|
|
133
|
+
</template>
|
|
134
|
+
</div>
|
|
135
|
+
<div>
|
|
136
|
+
<ResumeCartSelect :item="item" />
|
|
137
|
+
</div>
|
|
138
|
+
<div class="pt-[.2rem]">
|
|
139
|
+
<button class="text-sm flex hover:underline py-3 text-red-600" @click="removeItem(item.id)">
|
|
140
|
+
<i-mdi-delete />
|
|
141
|
+
Eliminar
|
|
142
|
+
</button>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<div class="font-bold sm:text-xl pt-2 absolute sm:static -top-1 right-0 dark:text-white">
|
|
147
|
+
US${{ item.variant.price }}
|
|
148
|
+
<!-- -->
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
<div v-if="isDefault" class="text-right pt-1">
|
|
152
|
+
<div class=" sm:inline-flex items-end ">
|
|
153
|
+
<div>
|
|
154
|
+
<span class="text-lg">
|
|
155
|
+
Subtotal
|
|
156
|
+
|
|
157
|
+
</span>
|
|
158
|
+
<span class="text-lg">
|
|
159
|
+
({{ cart.items.length }} producto)
|
|
160
|
+
</span> :
|
|
161
|
+
</div>
|
|
162
|
+
<div class="font-bold text-2xl pl-2">
|
|
163
|
+
US$ {{ cart.total }}
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
<div
|
|
169
|
+
class="w-full sm:min-w-320px p-4"
|
|
170
|
+
|
|
171
|
+
:class="{
|
|
172
|
+
border: isDefault,
|
|
173
|
+
}"
|
|
174
|
+
>
|
|
175
|
+
<!-- -->
|
|
176
|
+
<div
|
|
177
|
+
:class="{
|
|
178
|
+
'text-center': isFatto,
|
|
179
|
+
}"
|
|
180
|
+
>
|
|
181
|
+
<div class=" items-end dark:text-gray-50">
|
|
182
|
+
<div>
|
|
183
|
+
<span class="text-xl">
|
|
184
|
+
Subtotal
|
|
185
|
+
|
|
186
|
+
</span>
|
|
187
|
+
<span class="text-sm">
|
|
188
|
+
({{ cart.items.length }} producto)
|
|
189
|
+
</span>
|
|
190
|
+
:
|
|
191
|
+
</div>
|
|
192
|
+
<div class="font-bold text-2xl">
|
|
193
|
+
US$ {{ cart.total }}
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="pt-2 dark:text-white">
|
|
197
|
+
{{ notePrices }}
|
|
198
|
+
<div class="text-gray-600 italic text-xs dark:text-gray-200">
|
|
199
|
+
* {{ notePricesExtra }}
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
<div class="space-x-3 flex justify-center pt-3">
|
|
204
|
+
<UButton :loading="loading" size="xl" @click="toStore">
|
|
205
|
+
Seguir comprando
|
|
206
|
+
</UButton>
|
|
207
|
+
<UButton
|
|
208
|
+
:loading="loading" size="xl"
|
|
209
|
+
@click="toCheckout"
|
|
210
|
+
>
|
|
211
|
+
Proceder al pago
|
|
212
|
+
</UButton>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import { ref, watch } from 'vue';
|
|
4
|
+
import { useCartStore } from '../stores';
|
|
5
|
+
|
|
6
|
+
type LineItemsCart = any;
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
item: {
|
|
9
|
+
type: Object as PropType<LineItemsCart>,
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const values = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
15
|
+
const value = ref(props.item.quantity);
|
|
16
|
+
const cart = useCartStore();
|
|
17
|
+
function onUpdate(quantity: number) {
|
|
18
|
+
// props.crud?.update('item', { id: props.item.id, quantity });
|
|
19
|
+
cart.addToCart({
|
|
20
|
+
id: props.item.id,
|
|
21
|
+
quantity,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
watch(value, (val) => {
|
|
26
|
+
onUpdate(val);
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<USelect v-model="value" :items="values" class="w-[110px]" />
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import { useCartStore } from '../stores';
|
|
4
|
+
import ShoppinCartItem from './ShoppinCartItem.vue';
|
|
5
|
+
|
|
6
|
+
const toast = useToast();
|
|
7
|
+
const cart = useCartStore();
|
|
8
|
+
const loading = ref(false);
|
|
9
|
+
function onOpen() {
|
|
10
|
+
console.log('toast');
|
|
11
|
+
cart.drawer = !cart.drawer;
|
|
12
|
+
// toast.add({
|
|
13
|
+
// title: 'Event added to calendar',
|
|
14
|
+
// description: `This event is scheduled.`,
|
|
15
|
+
// icon: 'i-lucide-calendar-days',
|
|
16
|
+
// });
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<!-- <UApp> -->
|
|
22
|
+
<UDrawer direction="right">
|
|
23
|
+
<UButton icon="i-bytesize-cart" size="xl" variant="ghost" class="mx-3" @click="onOpen" />
|
|
24
|
+
|
|
25
|
+
<template #content>
|
|
26
|
+
<div
|
|
27
|
+
class="h-full flex flex-col !overflow-y-hidden py-4 lg:w-[360px]"
|
|
28
|
+
:class="{ 'opacity-60': loading }"
|
|
29
|
+
>
|
|
30
|
+
<!-- <div class="absolute ">
|
|
31
|
+
e
|
|
32
|
+
</div> -->
|
|
33
|
+
<div class="flex-0 px-20px">
|
|
34
|
+
<div class="text-3xl text-gray-700 font-medium flex ">
|
|
35
|
+
<div>
|
|
36
|
+
Mi Carrito
|
|
37
|
+
</div>
|
|
38
|
+
<div />
|
|
39
|
+
</div>
|
|
40
|
+
<div class=" text-gray-500 font-light pt-1">
|
|
41
|
+
<span> Total articulos: </span>
|
|
42
|
+
<span class="font-medium text-gray-700 text-lg">
|
|
43
|
+
{{ cart.items.length }}
|
|
44
|
+
</span>
|
|
45
|
+
</div>
|
|
46
|
+
<!-- <button v-show="cart.drawer" class="z-30 shadow h-12 w-12 bg-eprimary text-econtrast flex dark:shadow-slate-400 items-center justify-center rounded-full absolute -left-2 sm:-left-6 hover:shadow-lg" @click="cart.drawer = false">
|
|
47
|
+
<i-mdi-arrow-right v-if="!loading" />
|
|
48
|
+
<svg v-else aria-hidden="true" role="status" class="inline w-5 h-5 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
49
|
+
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB" />
|
|
50
|
+
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor" />
|
|
51
|
+
</svg>
|
|
52
|
+
</button> -->
|
|
53
|
+
</div>
|
|
54
|
+
<div class="flex-auto overflow-y-auto relative">
|
|
55
|
+
<div v-if="loading" class="absolute h-full w-full z-20 cursor-not-allowed" />
|
|
56
|
+
<div class="h-full flex flex-col">
|
|
57
|
+
<div class="flex-auto pt-6 px-2">
|
|
58
|
+
<ShoppinCartItem
|
|
59
|
+
v-for="item in cart.items"
|
|
60
|
+
:key="item.id"
|
|
61
|
+
:item="item"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="flex-0">
|
|
67
|
+
<div class="pr-4 pb-1">
|
|
68
|
+
<div class="flex p-2 text-gray-800 font-bold text-lg">
|
|
69
|
+
<div>Total estimado:</div>
|
|
70
|
+
<div class="flex-auto" />
|
|
71
|
+
<div class="text-xl">
|
|
72
|
+
$ {{ cart.total }}
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<a
|
|
76
|
+
href="/cart"
|
|
77
|
+
class="
|
|
78
|
+
bg-gray-900
|
|
79
|
+
hover:bg-gray-800
|
|
80
|
+
h-12
|
|
81
|
+
rounded
|
|
82
|
+
w-full
|
|
83
|
+
flex
|
|
84
|
+
items-center
|
|
85
|
+
justify-center
|
|
86
|
+
cursor-pointer
|
|
87
|
+
"
|
|
88
|
+
>
|
|
89
|
+
<span class="text-white uppercase font-medium">
|
|
90
|
+
Finalizar pedido
|
|
91
|
+
</span>
|
|
92
|
+
</a>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
</UDrawer>
|
|
98
|
+
|
|
99
|
+
<!-- </UApp> -->
|
|
100
|
+
</template>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// import type { LineItemsCart } from '@monkeyplus/e-schema/models';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
4
|
+
import { ref } from 'vue';
|
|
5
|
+
import InputNumber from '../product/AddProductNumber.vue';
|
|
6
|
+
|
|
7
|
+
type LineItemsCart = any;
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
item: {
|
|
11
|
+
type: Object as PropType<LineItemsCart>,
|
|
12
|
+
default: () => ({}),
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
const emit = defineEmits(['remove', 'update']);
|
|
16
|
+
const quantity = ref(props.item.quantity);
|
|
17
|
+
function onUpdate(id: string): void {
|
|
18
|
+
setTimeout(() => {
|
|
19
|
+
emit('update', { id, quantity: quantity.value });
|
|
20
|
+
}, 0);
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<div
|
|
26
|
+
class="
|
|
27
|
+
cart-item
|
|
28
|
+
flex
|
|
29
|
+
space-x-3
|
|
30
|
+
hover:bg-gray-50
|
|
31
|
+
rounded
|
|
32
|
+
p-3
|
|
33
|
+
relative
|
|
34
|
+
items-center
|
|
35
|
+
"
|
|
36
|
+
:class="{ 'opacity-70': !item.variant?.available }"
|
|
37
|
+
>
|
|
38
|
+
<div>
|
|
39
|
+
<div class="border-1 border-gray-200 overflow-hidden">
|
|
40
|
+
<img
|
|
41
|
+
class="object-cover h-28 w-28"
|
|
42
|
+
:src="item?.variant?.image?.src"
|
|
43
|
+
alt=""
|
|
44
|
+
>
|
|
45
|
+
</div>
|
|
46
|
+
<!-- <div class="text-center absolute w-full bottom-2"></div> -->
|
|
47
|
+
</div>
|
|
48
|
+
<div class="flex flex-col auto">
|
|
49
|
+
<div>
|
|
50
|
+
<div class="text-lg font-light text-gray-700">
|
|
51
|
+
{{ item.title }}
|
|
52
|
+
</div>
|
|
53
|
+
<div class="text-xl text-gray-900">
|
|
54
|
+
$
|
|
55
|
+
{{ item?.variant?.price }}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<template
|
|
59
|
+
v-for="(option) in item?.variant?.selectedOptions || []"
|
|
60
|
+
:key="option.name"
|
|
61
|
+
>
|
|
62
|
+
<div v-show="option.name !== 'x'" class="text-gray-900">
|
|
63
|
+
<span class="font-bold"> {{ option.name }}: </span>
|
|
64
|
+
<span>
|
|
65
|
+
{{ option.value }}
|
|
66
|
+
</span>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
<div class="flex-auto" />
|
|
70
|
+
<div class="text-gray-800 pt-1">
|
|
71
|
+
<div v-show="item.variant?.available">
|
|
72
|
+
<InputNumber
|
|
73
|
+
v-model="quantity"
|
|
74
|
+
:min="1"
|
|
75
|
+
:max="8"
|
|
76
|
+
small
|
|
77
|
+
light
|
|
78
|
+
class="w-32"
|
|
79
|
+
@change="onUpdate(item.id)"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
<div v-show="!item.variant?.available" class="text-red-600">
|
|
83
|
+
No disponible
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="pt-2">
|
|
87
|
+
<button class="text-sm hover:underline py-1 text-red-600" @click="$emit('remove', item.id)">
|
|
88
|
+
Eliminar
|
|
89
|
+
</button>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<style>
|
|
96
|
+
.cart-item:hover .btn-delete{
|
|
97
|
+
display: flex !important;
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// import type { TabsItem } from '@nuxt/ui';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
|
+
import { useCheckoutStore } from '../stores.ts';
|
|
5
|
+
import AppCart from './AppCart.vue';
|
|
6
|
+
import AppLoading from './AppLoading.vue';
|
|
7
|
+
|
|
8
|
+
const checkout = useCheckoutStore();
|
|
9
|
+
const open = ref(true);
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<UApp>
|
|
14
|
+
<div class=" mx-auto h-screen flex flex-col ">
|
|
15
|
+
<div class="border-b border-gray-300">
|
|
16
|
+
Header {{ checkout.isReady }}
|
|
17
|
+
</div>
|
|
18
|
+
<div v-if="checkout.isReady" class="flex-1 flex container contain-[paint] mx-auto">
|
|
19
|
+
<div class="flex-1 flex flex-col">
|
|
20
|
+
<router-view />
|
|
21
|
+
</div>
|
|
22
|
+
<USidebar
|
|
23
|
+
v-model:open="open"
|
|
24
|
+
side="right"
|
|
25
|
+
:style="{ '--sidebar-width': '24rem' }"
|
|
26
|
+
>
|
|
27
|
+
<AppCart />
|
|
28
|
+
</USidebar>
|
|
29
|
+
</div>
|
|
30
|
+
<AppLoading v-else />
|
|
31
|
+
<div class="border-t border-gray-300">
|
|
32
|
+
Footer
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</UApp>
|
|
36
|
+
</template>
|