|
|
@@ -101,11 +101,19 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="column items-start q-mt-sm">
|
|
|
- <span v-if="item.price" class="text-caption text-grey-5 text-strike">
|
|
|
- R$ {{ formatPrice(item.price) }}
|
|
|
+ <span
|
|
|
+ v-if="priceInfo(item).regular !== null"
|
|
|
+ class="text-caption text-grey-7"
|
|
|
+ >
|
|
|
+ {{ $t("loja.price_non_associate") }}:
|
|
|
+ R$ {{ formatPrice(priceInfo(item).regular) }}
|
|
|
</span>
|
|
|
- <span class="text-subtitle1 text-weight-bold text-violet-dark">
|
|
|
- R$ {{ formatPrice(displayPrice(item)) }}
|
|
|
+ <span
|
|
|
+ v-if="priceInfo(item).associate !== null"
|
|
|
+ class="text-body2 text-weight-bold text-violet-dark"
|
|
|
+ >
|
|
|
+ {{ $t("loja.price_associate") }}:
|
|
|
+ R$ {{ formatPrice(priceInfo(item).associate) }}
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -198,10 +206,17 @@ const selectVariation = (item, variation) => {
|
|
|
const activeVariation = (item) =>
|
|
|
selectedVariations.value[item.id] ?? item.variations?.[0] ?? null;
|
|
|
|
|
|
-const displayPrice = (item) => {
|
|
|
+const hasPrice = (price) => price !== null && price !== undefined && price !== "";
|
|
|
+
|
|
|
+const priceInfo = (item) => {
|
|
|
const v = activeVariation(item);
|
|
|
- if (v?.variation_value != null) return v.variation_value;
|
|
|
- return item.associate_price ?? item.price;
|
|
|
+ const associate = hasPrice(v?.variation_value) ? v.variation_value : item.associate_price;
|
|
|
+
|
|
|
+ if (hasPrice(item.price) && hasPrice(associate)) {
|
|
|
+ return { regular: item.price, associate };
|
|
|
+ }
|
|
|
+ const single = hasPrice(associate) ? associate : item.price;
|
|
|
+ return { regular: null, associate: hasPrice(single) ? single : null };
|
|
|
};
|
|
|
|
|
|
const variationTypeLabel = (item) => {
|