This commit is contained in:
Viet An
2026-06-30 15:12:04 +07:00
parent 8b3da71895
commit e9e4fbe24f
18 changed files with 149 additions and 158 deletions

View File

@@ -1,21 +1,16 @@
<script setup>
import CartItem from "~/components/pos/CartItem.vue";
import useActiveCart from "~/components/pos/composables/useActiveCart";
import useOrderInfo from "~/components/pos/composables/useOrderInfo";
import usePlaceOrder from "~/components/pos/composables/usePlaceOrder";
const id = "confirmOrderModal";
const emit = defineEmits(["close"]);
const { activeCart, activeCartItems, invalidCartItems, orderInfo, fullAddress, getCarts, subtotal, total } =
inject("pos");
const posStore = usePosStore();
const { orderInfo, invalidCartItems } = storeToRefs(posStore);
const { activeCart, activeCartItems, subtotal } = useActiveCart();
const { fullAddress, total } = useOrderInfo();
const { isPending, showVietQRModal, placeOrder, testReturnPage } = usePlaceOrder({
activeCart,
activeCartItems,
invalidCartItems,
orderInfo,
fullAddress,
subtotal,
total,
getCarts,
onSuccess: () => emit("close"),
});
</script>
@@ -144,6 +139,7 @@ const { isPending, showVietQRModal, placeOrder, testReturnPage } = usePlaceOrder
<button
@click="placeOrder"
:class="['button is-success', isPending && 'is-loading']"
:disabled="invalidCartItems.length > 0 || activeCartItems.length === 0"
>
Đặt hàng
</button>