|
@@ -129,23 +129,27 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <div class="row items-end justify-between q-mt-sm">
|
|
|
|
|
- <div class="column" style="gap: 1px">
|
|
|
|
|
- <span class="text-caption text-grey-6">
|
|
|
|
|
- {{ $t('loja.stock') }}: {{ displayStock(item) }}
|
|
|
|
|
- </span>
|
|
|
|
|
- <span class="text-caption text-grey-6">
|
|
|
|
|
- {{ $t('loja.interests') }}: {{ item.interests_count ?? 0 }}
|
|
|
|
|
- </span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="column items-end" style="gap: 1px">
|
|
|
|
|
- <span v-if="item.price" class="text-caption text-grey-5 text-strike">
|
|
|
|
|
- R$ {{ formatPrice(item.price) }}
|
|
|
|
|
- </span>
|
|
|
|
|
- <span v-if="displayPrice(item) != null" class="text-subtitle2 text-weight-bold text-violet-dark">
|
|
|
|
|
- R$ {{ formatPrice(displayPrice(item)) }}
|
|
|
|
|
- </span>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class="column items-start q-mt-sm" style="gap: 1px">
|
|
|
|
|
+ <span class="text-caption text-grey-6">
|
|
|
|
|
+ {{ $t('loja.stock') }}: {{ displayStock(item) }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span class="text-caption text-grey-6">
|
|
|
|
|
+ {{ $t('loja.interests') }}: {{ item.interests_count ?? 0 }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span
|
|
|
|
|
+ v-if="priceInfo(item).regular !== null"
|
|
|
|
|
+ class="text-caption text-grey-7 q-mt-xs"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ $t('loja.price_non_associate') }}:
|
|
|
|
|
+ R$ {{ formatPrice(priceInfo(item).regular) }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <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>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -221,10 +225,17 @@ const selectVariation = (item, variation) => {
|
|
|
|
|
|
|
|
const activeVariation = (item) => selectedVariations.value[item.id] ?? null;
|
|
const activeVariation = (item) => selectedVariations.value[item.id] ?? null;
|
|
|
|
|
|
|
|
-const displayPrice = (item) => {
|
|
|
|
|
|
|
+const hasPrice = (price) => price !== null && price !== undefined && price !== "";
|
|
|
|
|
+
|
|
|
|
|
+const priceInfo = (item) => {
|
|
|
const v = activeVariation(item);
|
|
const v = activeVariation(item);
|
|
|
- if (v && v.variation_value != null) return v.variation_value;
|
|
|
|
|
- return item.associate_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 displayStock = (item) => {
|
|
const displayStock = (item) => {
|