This commit is contained in:
2025-08-05 21:53:39 +03:00
parent 50bf9061be
commit ef137729ac
22 changed files with 221 additions and 87 deletions

View File

@@ -90,7 +90,9 @@
class="btn btn-primary"
:disabled="cart.canCheckout === false"
@click="goToCheckout"
>Перейти к оформлению</button>
>
Перейти к оформлению
</button>
</div>
</div>

View File

@@ -55,7 +55,14 @@
<div
class="fixed px-4 pb-10 pt-4 bottom-0 left-0 w-full bg-base-200 z-50 flex flex-col justify-between items-center gap-2 border-t-1 border-t-base-300">
<div v-if="error" class="text-error text-sm">{{ error }}</div>
<button class="btn btn-primary w-full" @click="onCreateBtnClick">Создать заказ</button>
<button
:disabled="checkout.isLoading"
class="btn btn-primary w-full"
@click="onCreateBtnClick"
>
<span v-if="checkout.isLoading" class="loading loading-spinner loading-sm"></span>
{{ btnText }}
</button>
</div>
</div>
</template>
@@ -65,13 +72,16 @@ import {useCheckoutStore} from "@/stores/CheckoutStore.js";
import TgInput from "@/components/Form/TgInput.vue";
import TgTextarea from "@/components/Form/TgTextarea.vue";
import {useRouter} from "vue-router";
import {ref} from "vue";
import {computed, ref} from "vue";
const checkout = useCheckoutStore();
const router = useRouter();
const error = ref(null);
const btnText = computed(() => {
return checkout.isLoading ? 'Подождите...' : 'Создать заказ';
});
async function onCreateBtnClick() {
try {
error.value = null;

View File

@@ -72,9 +72,10 @@
<button
class="btn btn-primary btn-lg w-full"
:class="isInCart ? 'btn-success' : 'btn-primary'"
:disabled="canAddToCart === false"
:disabled="cart.isLoading || canAddToCart === false"
@click="actionBtnClick"
>
<span v-if="cart.isLoading" class="loading loading-spinner loading-sm"></span>
{{ btnText }}
</button>
</div>