From d1cdc3cd5c14a504e033a2f545824629aef0d76c Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Wed, 5 Jul 2023 09:58:34 +0300 Subject: [PATCH] feat: show shipping cost for order --- static/components/order-list/order-list.html | 17 +++++++++++++---- static/components/order-list/order-list.js | 3 ++- static/js/index.js | 1 - 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/static/components/order-list/order-list.html b/static/components/order-list/order-list.html index 8be42e5..d3c7705 100644 --- a/static/components/order-list/order-list.html +++ b/static/components/order-list/order-list.html @@ -69,14 +69,14 @@ -
+
Products:
-
Quantity
+
Quantity
-
Name
-
Price
+
Name
+
Price
@@ -96,6 +96,15 @@
+
+
+
+
Shipping Cost
+
+ {{props.row.extra.shipping_cost}} {{props.row.extra.currency}} +
+
+
diff --git a/static/components/order-list/order-list.js b/static/components/order-list/order-list.js index 849ebb1..8a1cca9 100644 --- a/static/components/order-list/order-list.js +++ b/static/components/order-list/order-list.js @@ -145,10 +145,11 @@ async function orderList(path) { return '' }, orderTotal: function (order) { - return order.items.reduce((t, item) => { + const productCost = order.items.reduce((t, item) => { product = order.extra.products.find(p => p.id === item.product_id) return t + item.quantity * product.price }, 0) + return productCost + order.extra.shipping_cost }, getOrders: async function () { try { diff --git a/static/js/index.js b/static/js/index.js index 11eeffd..6d2a6cb 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -182,7 +182,6 @@ const merchant = async () => { } if (data.type === 'dm:2') { const orderStatus = JSON.parse(data.dm.message) - console.log('### orderStatus', orderStatus) this.$q.notify({ timeout: 5000, type: 'positive',