diff --git a/src/views/base/products/index.vue b/src/views/base/products/index.vue index d009e57..4448788 100644 --- a/src/views/base/products/index.vue +++ b/src/views/base/products/index.vue @@ -144,8 +144,8 @@ watch(lastPrice, async () => { val.price = lastPrice.value?.price_last val.sellPrice = lastPrice.value?.sell } else { - val.price = val.amount * lastPrice.value?.price_last - val.sellPrice = val.amount * lastPrice.value?.sell + val.price = parseInt(val.amount * lastPrice.value?.price_last) + val.sellPrice = parseInt(val.amount * lastPrice.value?.sell) // console.log(lastPrice.value?.price_last + "*" + val.amount + ' ' + val.price) } @@ -154,11 +154,11 @@ watch(lastPrice, async () => { if (firstItems.value) { firstItems.value.forEach((val) => { if (val.group_type == 'آبشده') { - val.price = lastPrice.value?.price_last - val.sellPrice = lastPrice.value?.sell + val.price = parseInt(lastPrice.value?.price_last) + val.sellPrice = parseInt(lastPrice.value?.sell) } else { - val.price = val.amount * lastPrice.value?.price_last - val.sellPrice = val.amount * lastPrice.value?.sell + val.price = parseInt(val.amount * lastPrice.value?.price_last) + val.sellPrice = parseInt(val.amount * lastPrice.value?.sell) } }) } @@ -177,22 +177,22 @@ async function initPrice() { if (lastPrice.value && items.value) { items.value.forEach((val) => { if (val.group_type == 'آبشده') { - val.price = lastPrice.value?.price_last - val.sellPrice = lastPrice.value?.sell + val.price = parseInt(lastPrice.value?.price_last) + val.sellPrice = parseInt(lastPrice.value?.sell) } else { - val.price = val.amount * lastPrice.value?.price_last - val.sellPrice = val.amount * lastPrice.value?.sell + val.price = parseInt(val.amount * lastPrice.value?.price_last) + val.sellPrice = parseInt(val.amount * lastPrice.value?.sell) } }) // Update firstItems as well if (firstItems.value) { firstItems.value.forEach((val) => { if (val.group_type == 'آبشده') { - val.price = lastPrice.value?.price_last - val.sellPrice = lastPrice.value?.sell + val.price = parseInt(lastPrice.value?.price_last) + val.sellPrice =parseInt( lastPrice.value?.sell) } else { - val.price = val.amount * lastPrice.value?.price_last - val.sellPrice = val.amount * lastPrice.value?.sell + val.price = parseInt(val.amount * lastPrice.value?.price_last) + val.sellPrice = parseInt(val.amount * lastPrice.value?.sell) } }) } diff --git a/src/views/base/products/product/[id].vue b/src/views/base/products/product/[id].vue index 348cfc8..9006a11 100644 --- a/src/views/base/products/product/[id].vue +++ b/src/views/base/products/product/[id].vue @@ -179,11 +179,11 @@ async function initPrice() { loading.value = true if (lastPrice.value && product.value) { if (product.value.group_type == 'آبشده') { - product.value.price = lastPrice.value?.price_last - product.value.sellPrice = lastPrice.value?.sell + product.value.price = parseInt(lastPrice.value?.price_last) + product.value.sellPrice = parseInt(lastPrice.value?.sell) } else { - product.value.price = product.value.amount * lastPrice.value?.price_last - product.value.sellPrice = product.value.amount * lastPrice.value?.sell + product.value.price = parseInt(product.value.amount * lastPrice.value?.price_last) + product.value.sellPrice = parseInt(product.value.amount * lastPrice.value?.sell) } } } catch (e: any) {