From a43d21ac1df2dec6e0fd7f0fd151f9e7771f2d8c Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Fri, 18 Oct 2024 10:45:54 +0700 Subject: [PATCH] fix: type error --- src/pages/05_quotation/peview/ViewForm.vue | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pages/05_quotation/peview/ViewForm.vue b/src/pages/05_quotation/peview/ViewForm.vue index b730563b..510f0b0b 100644 --- a/src/pages/05_quotation/peview/ViewForm.vue +++ b/src/pages/05_quotation/peview/ViewForm.vue @@ -159,16 +159,18 @@ onMounted(async () => { data.value = JSON.parse(sessionStorage.getItem('quotation-preview') || '{}'); - productList.value = data.value?.productServiceList.map((v) => ({ - id: v.product.id, - code: v.product.code, - detail: v.product.detail, - amount: v.amount, - priceUnit: v.pricePerUnit, - discount: v.discount, - vat: v.vat, - value: 0, - })); + if (data.value) { + productList.value = data.value?.productServiceList.map((v) => ({ + id: v.product.id, + code: v.product.code, + detail: v.product.detail, + amount: v.amount, + priceUnit: v.pricePerUnit || 0, + discount: v.discount || 0, + vat: v.vat || 0, + value: 0, + })); + } summaryPrice.value = obj.productServiceList.reduce( (a, c) => {