|
@@ -39,12 +39,18 @@
|
|
class="xs-goods-price font-OPPOSANS"
|
|
class="xs-goods-price font-OPPOSANS"
|
|
:style="[{ color: goodsFields.price.color }]"
|
|
:style="[{ color: goodsFields.price.color }]"
|
|
>
|
|
>
|
|
- <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
<!-- 活动价格 -->
|
|
<!-- 活动价格 -->
|
|
- <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
- <text v-else>
|
|
|
|
- {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
|
|
+ <text v-if="data.activityType && data.activityType === PromotionActivityTypeEnum.POINT.type">
|
|
|
|
+ {{ data.point }}积分
|
|
|
|
+ {{ !data.pointPrice || data.pointPrice === 0 ? '' : `+${fen2yuan(data.pointPrice)}元` }}
|
|
</text>
|
|
</text>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
+ <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
+ <text v-else>
|
|
|
|
+ {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
+ </text>
|
|
|
|
+ </template>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -87,12 +93,18 @@
|
|
class="sm-goods-price font-OPPOSANS"
|
|
class="sm-goods-price font-OPPOSANS"
|
|
:style="[{ color: goodsFields.price.color }]"
|
|
:style="[{ color: goodsFields.price.color }]"
|
|
>
|
|
>
|
|
- <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
<!-- 活动价格 -->
|
|
<!-- 活动价格 -->
|
|
- <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
- <text v-else>
|
|
|
|
- {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
|
|
+ <text v-if="data.activityType && data.activityType === PromotionActivityTypeEnum.POINT.type">
|
|
|
|
+ {{ data.point }}积分
|
|
|
|
+ {{ !data.pointPrice || data.pointPrice === 0 ? '' : `+${fen2yuan(data.pointPrice)}元` }}
|
|
</text>
|
|
</text>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
+ <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
+ <text v-else>
|
|
|
|
+ {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
+ </text>
|
|
|
|
+ </template>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -149,12 +161,18 @@
|
|
class="md-goods-price ss-m-t-16 font-OPPOSANS ss-m-r-10"
|
|
class="md-goods-price ss-m-t-16 font-OPPOSANS ss-m-r-10"
|
|
:style="[{ color: goodsFields.price.color }]"
|
|
:style="[{ color: goodsFields.price.color }]"
|
|
>
|
|
>
|
|
- <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
<!-- 活动价格 -->
|
|
<!-- 活动价格 -->
|
|
- <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
- <text v-else>
|
|
|
|
- {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
|
|
+ <text v-if="data.activityType && data.activityType === PromotionActivityTypeEnum.POINT.type">
|
|
|
|
+ {{ data.point }}积分
|
|
|
|
+ {{ !data.pointPrice || data.pointPrice === 0 ? '' : `+${fen2yuan(data.pointPrice)}元` }}
|
|
</text>
|
|
</text>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
+ <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
+ <text v-else>
|
|
|
|
+ {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
+ </text>
|
|
|
|
+ </template>
|
|
</view>
|
|
</view>
|
|
<view
|
|
<view
|
|
v-if="
|
|
v-if="
|
|
@@ -236,29 +254,31 @@
|
|
{{ item }}
|
|
{{ item }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view class="ss-flex ss-col-bottom ss-m-t-10">
|
|
|
|
- <view
|
|
|
|
- v-if="goodsFields.price?.show"
|
|
|
|
- class="lg-goods-price ss-m-r-12 ss-flex ss-col-bottom font-OPPOSANS"
|
|
|
|
- :style="[{ color: goodsFields.price.color }]"
|
|
|
|
- >
|
|
|
|
- <text class="ss-font-24">{{ priceUnit }}</text>
|
|
|
|
- {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
|
|
+ <view v-if="goodsFields.price?.show" class="ss-flex ss-col-bottom font-OPPOSANS">
|
|
|
|
+ <view class="sl-goods-price ss-m-r-12" :style="[{ color: goodsFields.price.color }]">
|
|
|
|
+ <!-- 活动价格 -->
|
|
|
|
+ <text v-if="data.activityType && data.activityType === PromotionActivityTypeEnum.POINT.type">
|
|
|
|
+ {{ data.point }}积分
|
|
|
|
+ {{ !data.pointPrice || data.pointPrice === 0 ? '' : `+${fen2yuan(data.pointPrice)}元` }}
|
|
|
|
+ </text>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
+ <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
+ <text v-else>
|
|
|
|
+ {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
+ </text>
|
|
|
|
+ </template>
|
|
</view>
|
|
</view>
|
|
<view
|
|
<view
|
|
v-if="
|
|
v-if="
|
|
(goodsFields.original_price?.show || goodsFields.marketPrice?.show) &&
|
|
(goodsFields.original_price?.show || goodsFields.marketPrice?.show) &&
|
|
(data.original_price > 0 || data.marketPrice > 0)
|
|
(data.original_price > 0 || data.marketPrice > 0)
|
|
"
|
|
"
|
|
- class="goods-origin-price ss-flex ss-col-bottom font-OPPOSANS"
|
|
|
|
|
|
+ class="goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex"
|
|
:style="[{ color: originPriceColor }]"
|
|
:style="[{ color: originPriceColor }]"
|
|
>
|
|
>
|
|
<text class="price-unit ss-font-20">{{ priceUnit }}</text>
|
|
<text class="price-unit ss-font-20">{{ priceUnit }}</text>
|
|
- <!-- 活动价格 -->
|
|
|
|
- <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
- <text v-else>
|
|
|
|
- {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
- </text>
|
|
|
|
|
|
+ <view class="ss-m-l-8">{{ fen2yuan(data.marketPrice) }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="ss-m-t-8 ss-flex ss-col-center ss-flex-wrap">
|
|
<view class="ss-m-t-8 ss-flex ss-col-center ss-flex-wrap">
|
|
@@ -268,7 +288,7 @@
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<slot name="cart">
|
|
<slot name="cart">
|
|
- <view class="buy-box ss-flex ss-col-center ss-row-center" v-if="buttonShow"> 去购买 </view>
|
|
|
|
|
|
+ <view class="buy-box ss-flex ss-col-center ss-row-center" v-if="buttonShow"> 去购买</view>
|
|
</slot>
|
|
</slot>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
@@ -324,12 +344,18 @@
|
|
</view>
|
|
</view>
|
|
<view v-if="goodsFields.price?.show" class="ss-flex ss-col-bottom font-OPPOSANS">
|
|
<view v-if="goodsFields.price?.show" class="ss-flex ss-col-bottom font-OPPOSANS">
|
|
<view class="sl-goods-price ss-m-r-12" :style="[{ color: goodsFields.price.color }]">
|
|
<view class="sl-goods-price ss-m-r-12" :style="[{ color: goodsFields.price.color }]">
|
|
- <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
<!-- 活动价格 -->
|
|
<!-- 活动价格 -->
|
|
- <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
- <text v-else>
|
|
|
|
- {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
|
|
+ <text v-if="data.activityType && data.activityType === PromotionActivityTypeEnum.POINT.type">
|
|
|
|
+ {{ data.point }}积分
|
|
|
|
+ {{ !data.pointPrice || data.pointPrice === 0 ? '' : `+${fen2yuan(data.pointPrice)}元` }}
|
|
</text>
|
|
</text>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <text class="price-unit ss-font-24">{{ priceUnit }}</text>
|
|
|
|
+ <text v-if="data.promotionPrice > 0">{{ fen2yuan(data.promotionPrice) }}</text>
|
|
|
|
+ <text v-else>
|
|
|
|
+ {{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
|
|
|
|
+ </text>
|
|
|
|
+ </template>
|
|
</view>
|
|
</view>
|
|
<view
|
|
<view
|
|
v-if="
|
|
v-if="
|
|
@@ -361,39 +387,41 @@
|
|
* 商品卡片
|
|
* 商品卡片
|
|
*
|
|
*
|
|
* @property {Array} size = [xs | sm | md | lg | sl ] - 列表数据
|
|
* @property {Array} size = [xs | sm | md | lg | sl ] - 列表数据
|
|
- * @property {String} tag - md及以上才有
|
|
|
|
- * @property {String} img - 图片
|
|
|
|
- * @property {String} background - 背景色
|
|
|
|
- * @property {String} topRadius - 上圆角
|
|
|
|
- * @property {String} bottomRadius - 下圆角
|
|
|
|
- * @property {String} title - 标题
|
|
|
|
- * @property {String} titleColor - 标题颜色
|
|
|
|
|
|
+ * @property {String} tag - md及以上才有
|
|
|
|
+ * @property {String} img - 图片
|
|
|
|
+ * @property {String} background - 背景色
|
|
|
|
+ * @property {String} topRadius - 上圆角
|
|
|
|
+ * @property {String} bottomRadius - 下圆角
|
|
|
|
+ * @property {String} title - 标题
|
|
|
|
+ * @property {String} titleColor - 标题颜色
|
|
* @property {Number} titleWidth = 0 - 标题宽度,默认0,单位rpx
|
|
* @property {Number} titleWidth = 0 - 标题宽度,默认0,单位rpx
|
|
- * @property {String} subTitle - 副标题
|
|
|
|
- * @property {String} subTitleColor - 副标题颜色
|
|
|
|
- * @property {String} subTitleBackground - 副标题背景
|
|
|
|
- * @property {String | Number} price - 价格
|
|
|
|
- * @property {String} priceColor - 价格颜色
|
|
|
|
- * @property {String | Number} originPrice - 原价/划线价
|
|
|
|
- * @property {String} originPriceColor - 原价颜色
|
|
|
|
- * @property {String | Number} sales - 销售数量
|
|
|
|
- * @property {String} salesColor - 销售数量颜色
|
|
|
|
|
|
+ * @property {String} subTitle - 副标题
|
|
|
|
+ * @property {String} subTitleColor - 副标题颜色
|
|
|
|
+ * @property {String} subTitleBackground - 副标题背景
|
|
|
|
+ * @property {String | Number} price - 价格
|
|
|
|
+ * @property {String} priceColor - 价格颜色
|
|
|
|
+ * @property {String | Number} originPrice - 原价/划线价
|
|
|
|
+ * @property {String} originPriceColor - 原价颜色
|
|
|
|
+ * @property {String | Number} sales - 销售数量
|
|
|
|
+ * @property {String} salesColor - 销售数量颜色
|
|
*
|
|
*
|
|
* @slots activity - 活动插槽
|
|
* @slots activity - 活动插槽
|
|
* @slots cart - 购物车插槽,默认包含文字,背景色,文字颜色 || 图片 || 行为
|
|
* @slots cart - 购物车插槽,默认包含文字,背景色,文字颜色 || 图片 || 行为
|
|
*
|
|
*
|
|
- * @event {Function()} click - 点击卡片
|
|
|
|
|
|
+ * @event {Function()} click - 点击卡片
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
- import { computed, getCurrentInstance, onMounted, nextTick } from 'vue';
|
|
|
|
|
|
+ import { computed, getCurrentInstance, nextTick, onMounted } from 'vue';
|
|
import sheep from '@/sheep';
|
|
import sheep from '@/sheep';
|
|
import {
|
|
import {
|
|
fen2yuan,
|
|
fen2yuan,
|
|
|
|
+ formatExchange,
|
|
formatSales,
|
|
formatSales,
|
|
|
|
+ formatStock,
|
|
getRewardActivityRuleItemDescriptions,
|
|
getRewardActivityRuleItemDescriptions,
|
|
} from '@/sheep/hooks/useGoods';
|
|
} from '@/sheep/hooks/useGoods';
|
|
- import { formatStock } from '@/sheep/hooks/useGoods';
|
|
|
|
import { isArray } from 'lodash-es';
|
|
import { isArray } from 'lodash-es';
|
|
|
|
+ import { PromotionActivityTypeEnum } from '@/sheep/util/const';
|
|
|
|
|
|
// 接收参数
|
|
// 接收参数
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -520,10 +548,18 @@
|
|
const salesAndStock = computed(() => {
|
|
const salesAndStock = computed(() => {
|
|
let text = [];
|
|
let text = [];
|
|
if (props.goodsFields.salesCount?.show) {
|
|
if (props.goodsFields.salesCount?.show) {
|
|
- text.push(formatSales(props.data.sales_show_type, props.data.salesCount));
|
|
|
|
|
|
+ if (props.data.activityType && props.data.activityType === PromotionActivityTypeEnum.POINT.type) {
|
|
|
|
+ text.push(formatExchange(props.data.sales_show_type, (props.data.pointTotalStock || 0) - (props.data.pointStock || 0)));
|
|
|
|
+ }else {
|
|
|
|
+ text.push(formatSales(props.data.sales_show_type, props.data.salesCount));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (props.goodsFields.stock?.show) {
|
|
if (props.goodsFields.stock?.show) {
|
|
- text.push(formatStock(props.data.stock_show_type, props.data.stock));
|
|
|
|
|
|
+ if (props.data.activityType && props.data.activityType === PromotionActivityTypeEnum.POINT.type) {
|
|
|
|
+ text.push(formatStock(props.data.stock_show_type, props.data.pointTotalStock));
|
|
|
|
+ }else {
|
|
|
|
+ text.push(formatStock(props.data.stock_show_type, props.data.stock));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return text.join(' | ');
|
|
return text.join(' | ');
|
|
});
|
|
});
|
|
@@ -560,6 +596,7 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
getGoodsPriceCardWH();
|
|
getGoodsPriceCardWH();
|