fix error on order

This commit is contained in:
2026-05-30 12:52:44 +03:30
parent 518a5316cb
commit 53a3e2f61a
6 changed files with 1516 additions and 274 deletions
+4 -2
View File
@@ -313,7 +313,7 @@ async function handleCheckout() {
if (cashItemsTotal > 0) {
// Ensure wallet info is loaded
if (discountInfo.value.amount>0){
if (discountInfo.value?.amount>0){
cashItemsTotal=cashItemsTotal-cashItemsTotal*discountInfo.value.amount
}
if (!walletStore.walletInfo) {
@@ -351,8 +351,10 @@ async function handleCheckout() {
loading.value = true
infoVisible.value = true
// console.log(cartStore.cartItems)
// Prepare orders array with same structure as createOrder for each product
const orders: Order[] = cartStore.cartItems.map(item => {
console.log(item)
const product = item.product
// Calculate price similar to createOrder (buy price)
let productPrice = 0
@@ -370,7 +372,7 @@ async function handleCheckout() {
product_id: product.id,
method: item.method,
number: item.quantity,
discount_code:discountInfo.value.code
discount_code:discountInfo.value?.code
}
})