<template>
|
<view class="order-item-goods">
|
<!-- 商品列表 -->
|
<view v-if="showGoods" class='item-info acea-row row-between row-top' v-for="(items, idx) in orderInfoList"
|
:key="idx">
|
<view class='pictrue'>
|
<image :src='items.image'></image>
|
<view class="gift-tag" v-if="items.isGift">赠品</view>
|
</view>
|
<view class='text acea-row row-between'>
|
<view class="acea-row row-between-wrapper name_box">
|
<view class='name line2'>{{ items.storeName }}</view>
|
<view class="num">{{ items.sku }} x{{ items.cartNum }}</view>
|
</view>
|
<view class='info'></view>
|
<view class='money'>
|
<view v-if="getPayWay(items.payPrice, items.payCareBean) == 1" class="color-blue">
|
¥{{ toNumber(items.payPrice) }}+{{ toThousands(toNumber(items.payCareBean)) }}悦养豆
|
</view>
|
<view class="color-blue" v-else-if="getPayWay(items.payPrice, items.payCareBean) == 3">
|
{{ toThousands(toNumber(items.payCareBean)) }}悦养豆
|
</view>
|
<view class="color-blue" v-else>¥{{ toNumber(items.payPrice) }}</view>
|
</view>
|
</view>
|
</view>
|
<!-- 赠品列表 -->
|
<view v-if="getCouponGifts().length > 0" class="gift-list">
|
<view v-for="(gift, index) in getCouponGifts()" :key="index"
|
class='item acea-row row-between-wrapper gift-item'>
|
<view class='picTxt acea-row row-between-wrapper' style="flex-wrap: nowrap;">
|
<view class='pictrue'>
|
<image :src='getGiftImage(gift)'></image>
|
<view class="gift-tag">赠品</view>
|
</view>
|
<view class='text' style="margin-left: 20rpx;">
|
<view class='line1'>{{ gift.giftName }}</view>
|
<view class='infor'>x{{ gift.giftNum }}</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import { getProductDetail } from '@/api/store.js';
|
|
export default {
|
props: {
|
orderInfoList: {
|
type: Array,
|
default: function () {
|
return [];
|
}
|
},
|
zonePromotionList: {
|
type: Array,
|
default: function () {
|
return [];
|
}
|
},
|
showGoods: {
|
type: Boolean,
|
default: true
|
}
|
},
|
data() {
|
return {
|
giftCache: {}
|
};
|
},
|
methods: {
|
getCouponGifts() {
|
const gifts = [];
|
if (!this.zonePromotionList || !Array.isArray(this.zonePromotionList)) return gifts;
|
this.zonePromotionList.forEach(promotion => {
|
if (promotion.giftList && Array.isArray(promotion.giftList)) {
|
promotion.giftList.forEach(gift => {
|
if (gift.giftType === 2) {
|
gifts.push(gift);
|
}
|
});
|
}
|
});
|
return gifts;
|
},
|
toNumber(val) {
|
return Number(val) || 0;
|
},
|
toThousands(val) {
|
return Number(val) || 0;
|
},
|
getPayWay(price, payCareBean) {
|
if (Number(price) > 0 && Number(payCareBean) > 0) {
|
return 1;
|
} else if (Number(payCareBean) > 0) {
|
return 3;
|
} else {
|
return 2;
|
}
|
},
|
getGiftImage(gift) {
|
if (gift.giftType === 1) {
|
if (gift._productImage) {
|
return gift._productImage;
|
}
|
if (this.giftCache[gift.giftRefId]) {
|
return this.giftCache[gift.giftRefId].image || '';
|
}
|
if (!gift._loading) {
|
gift._loading = true;
|
getProductDetail(gift.giftRefId).then(res => {
|
if (res.code === 200 && res.data && res.data.productInfo) {
|
const image = res.data.productInfo.image || '';
|
this.$set(gift, '_productImage', image);
|
this.$set(this.giftCache, gift.giftRefId, res.data.productInfo);
|
}
|
gift._loading = false;
|
}).catch(() => {
|
gift._loading = false;
|
});
|
}
|
return '';
|
}
|
return 'https://ossacmall.bluedeer.com.cn/app/static/images/coupon.png';
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.order-item-goods {
|
.item-info {
|
padding: 24rpx;
|
background-color: #fff;
|
border-bottom: 1rpx solid #f5f5f5;
|
}
|
|
.pictrue {
|
width: 140rpx;
|
height: 140rpx;
|
border-radius: 16rpx;
|
overflow: hidden;
|
flex-shrink: 0;
|
position: relative;
|
|
.gift-tag {
|
position: absolute;
|
top: 0;
|
left: 0;
|
padding: 4rpx 8rpx;
|
background: #FF6600;
|
color: #FFFFFF;
|
font-size: 18rpx;
|
border-radius: 8rpx 0 8rpx 0;
|
}
|
|
image {
|
width: 100%;
|
height: 100%;
|
background: #f4f4f4;
|
}
|
}
|
|
.text {
|
flex: 1;
|
margin-left: 20rpx;
|
flex-direction: column;
|
justify-content: flex-start;
|
align-items: flex-start;
|
}
|
|
.name_box {
|
width: 100%;
|
|
.name {
|
font-size: 28rpx;
|
color: #282828;
|
max-width: 340rpx;
|
}
|
|
.num {
|
font-size: 24rpx;
|
color: #999999;
|
margin-top: 8rpx;
|
}
|
}
|
|
.info {
|
width: 20rpx;
|
}
|
|
.money {
|
text-align: right;
|
font-size: 28rpx;
|
|
.color-blue {
|
color: #FF780D;
|
}
|
}
|
|
.gift-list {
|
padding: 0 24rpx;
|
|
.gift-item {
|
padding: 20rpx 0;
|
border-bottom: 1rpx solid #FFE4CC;
|
|
&:last-child {
|
border-bottom: none;
|
}
|
|
.pictrue {
|
width: 140rpx;
|
height: 140rpx;
|
position: relative;
|
|
.gift-tag {
|
position: absolute;
|
top: 0;
|
left: 0;
|
padding: 4rpx 8rpx;
|
background: #FF6600;
|
color: #FFFFFF;
|
font-size: 18rpx;
|
border-radius: 8rpx 0 8rpx 0;
|
}
|
}
|
|
.text {
|
.line1 {
|
font-size: 26rpx;
|
color: #282828;
|
}
|
|
.infor {
|
font-size: 24rpx;
|
color: #999999;
|
margin-top: 8rpx;
|
}
|
}
|
}
|
}
|
}
|
</style>
|