This commit is contained in:
Viet An
2026-06-10 19:48:58 +07:00
parent d0b12dc647
commit 8ba1a0b5cf
4 changed files with 58 additions and 42 deletions

View File

@@ -8,8 +8,11 @@ const props = defineProps({
</script>
<template>
<h1 class="subtitle">Sản phẩm</h1>
<ProductForm :variantId="variant.id" />
<h1 class="subtitle">Phiên bản</h1>
<ProductVariantForm :variantId="variant.id" />
<div>
<h1 class="subtitle">Sản phẩm</h1>
<ProductForm :variantId="variant.id" />
<hr />
<h1 class="subtitle">Phiên bản</h1>
<ProductVariantForm :variantId="variant.id" />
</div>
</template>

View File

@@ -24,10 +24,10 @@ function toggleSelected(imeiRec) {
const { cartItems, getCart } = inject("pos");
const isAdding = ref(false);
async function addToCart() {
try {
isAdding.value = true;
console.log("store.customer", store.customer);
let cart = await $getdata("Cart", {
filter: { customer: store.customer },
first: true,

View File

@@ -66,11 +66,16 @@ async function createOrder() {
$snackbar("Tạo đơn hàng thành công", "Success");
await Promise.all(cartItems.value.map(({ id }) => $deleteapi("Cart_Item", id)));
await $patchapi("Cart", {
id: cartItems.value[0].cart,
customer: null,
});
await Promise.all([
$deleteapi(
"Cart_Item",
cartItems.value.map((c) => c.id),
),
$patchapi("Cart", {
id: cartItems.value[0].cart,
customer: null,
}),
]);
getCart();
emit("close");
} catch (error) {