fix error on order
This commit is contained in:
Vendored
+1
@@ -7,6 +7,7 @@ export {}
|
||||
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
ABadge: typeof import('ant-design-vue/es')['Badge']
|
||||
AButton: typeof import('ant-design-vue/es')['Button']
|
||||
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
||||
ADivider: typeof import('ant-design-vue/es')['Divider']
|
||||
|
||||
Generated
+897
-57
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,7 @@
|
||||
"axios": "^1.6.2",
|
||||
"dayjalali": "^1.0.1",
|
||||
"echarts": "^5.4.3",
|
||||
"express": "^5.2.1",
|
||||
"jalaliday": "^2.3.0",
|
||||
"lodash": "^4.17.21",
|
||||
"moment": "^2.29.4",
|
||||
|
||||
@@ -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
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -144,7 +144,9 @@
|
||||
<!-- <div class="text-xs mt-1 font-bold">دریافت فیزیکی</div>-->
|
||||
<!-- </div>-->
|
||||
<div :class="setNavColor('cart')" class="tab" @click="setRoute('cart')">
|
||||
<Icon icon="vuesax-linear:shopping-cart" />
|
||||
<a-badge :count="cartStore.itemCount">
|
||||
<Icon icon="vuesax-linear:shopping-cart" />
|
||||
</a-badge>
|
||||
<div class="text-xs mt-1 font-bold">سبد خرید</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -180,7 +182,10 @@
|
||||
<div class="text-xs mt-1 font-bold">خرید محصول</div>
|
||||
</div>-->
|
||||
<div :class="setNavColor('cart')" class="tab" @click="setRoute('cart')">
|
||||
<Icon icon="vuesax-linear:shopping-cart" />
|
||||
dd
|
||||
<a-badge :count="cartStore.itemCount">
|
||||
<Icon icon="vuesax-linear:shopping-cart" />
|
||||
</a-badge>
|
||||
<div class="text-xs mt-1 font-bold">سبد خرید</div>
|
||||
</div>
|
||||
<div :class="setNavColor('login')" class="tab" @click="setRoute('login')">
|
||||
@@ -205,11 +210,14 @@ import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import type { Transaction } from '@/models/transaction'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import {isToken} from "@/utils";
|
||||
import { useCartStore } from '@/store/cartStore'
|
||||
|
||||
const currentRoute = computed(() => router.currentRoute.value.name)
|
||||
const cartStore = useCartStore()
|
||||
|
||||
const popVisible = ref(false)
|
||||
|
||||
const currentRoute = computed(() => router.currentRoute.value.name)
|
||||
|
||||
function setNavColor(val: string) {
|
||||
if (currentRoute.value === val) {
|
||||
return 'text-primary'
|
||||
|
||||
Reference in New Issue
Block a user