ordering-ui-react-native 0.24.10 → 0.24.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -72,18 +72,20 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
72
72
|
const parseOptions = typeof productInfo().options === 'string' ? JSON.parse(productInfo().options) : productInfo().options
|
|
73
73
|
|
|
74
74
|
const getProductPrice = (product: any) => {
|
|
75
|
-
let subOptionPrice = 0
|
|
76
|
-
if (product?.options
|
|
77
|
-
|
|
78
|
-
for (const
|
|
79
|
-
|
|
75
|
+
let subOptionPrice = 0
|
|
76
|
+
if (Array.isArray(product?.options)) {
|
|
77
|
+
if (product.options?.length > 0) {
|
|
78
|
+
for (const option of product.options) {
|
|
79
|
+
for (const suboption of option.suboptions) {
|
|
80
|
+
subOptionPrice += suboption.quantity * ((['left', 'right'].includes(suboption.position)) ? (suboption.half_price ?? suboption.price) : suboption.price)
|
|
81
|
+
}
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
const price = product.quantity * (product.price + subOptionPrice)
|
|
85
|
-
return parseFloat(price.toFixed(2))
|
|
86
|
-
}
|
|
86
|
+
const price = product.quantity * (product.price + subOptionPrice)
|
|
87
|
+
return parseFloat(price.toFixed(2))
|
|
88
|
+
}
|
|
87
89
|
|
|
88
90
|
const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
|
|
89
91
|
if (name !== 'No') {
|