123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <template>
- <view class="cm-order-prodcut">
- <image :src="goodsData.productImage || goodsData.mainImage" class="cover"></image>
- <view class="content">
- <view class="title">{{ goodsData.name || goodsData.productName }}</view>
- <view class="unit">规格:{{ goodsData.productUnit || goodsData.unit }}</view>
- <view class="tags">
- <template v-if="tagsList.length > 0">
- <view class="tag type4" v-for="(tag, index) in tagsList" :key="index">{{ tag }}</view>
- </template>
- <view class="tag type3" v-if="goodsData.collagePriceFlag">拼团价</view>
- <template v-if="goodsData.activeStatus">
- <view class="tag type1" v-if="userId === goodsData.heUserId">促销</view>
- <view class="tag type1" v-else>自营</view>
- <view class="tag type2" v-if="goodsData.ladderList.length > 0">活动价</view>
- </template>
- <!-- <view class="tag type2" v-if="false">优惠券</view> -->
- </view>
- <view class="price">
- <text>¥{{ goodsData.price | formatPrice }}</text>
- <text class="delete" v-if="normal && goodsData.normalPrice">单买价:¥{{ goodsData.normalPrice | formatPrice }}</text>
- </view>
- </view>
- <text class="count" v-if="countVisible">×{{ goodsData.num || goodsData.productCount }}</text>
- </view>
- </template>
- <script>
- export default {
- props:{
- countVisible: {
- type: Boolean,
- default: true
- },
- goodsData: {
- type: Object,
- default:()=>{}
- },
- normal: {
- type: Boolean,
- default: false
- },
- tagsList:{
- type: Array,
- default: ()=>[]
- }
- },
- computed:{
- userId(){
- return this.$store.getters.userId
- }
- },
- data() {
- return {}
- }
- }
- </script>
- <style lang="scss" scoped>
- /* scss中可以用mixin来扩展 */
- @mixin ellipsis($line: 1) {
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: $line;
- -webkit-box-orient: vertical;
- }
- .cm-order-prodcut {
- position: relative;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 24rpx;
-
- overflow: hidden;
- .count{
- position: absolute;
- font-size: 26rpx;
- color: #333333;
- right: 24rpx;
- bottom: 0;
- }
- .cover {
- display: block;
- width: 180rpx;
- height: 180rpx;
- border-radius: 8rpx;
- box-sizing: border-box;
- border: 1px solid #F7F7F7;
- }
- .content {
- flex: 1;
- margin-left: 24rpx;
- .title {
- @include ellipsis(2);
- font-size: 26rpx;
- color: #333333;
- text-align: justify;
- line-height: 1.6;
- height: 80rpx;
- }
- .unit {
- margin-bottom: 8rpx;
- font-size: 20rpx;
- color: #999999;
- }
- .price {
- margin-top: 4rpx;
- font-size: 26rpx;
- color: #ff457b;
- .delete {
- margin-left: 32rpx;
- font-size: 20rpx;
- color: #999999;
- }
- }
- .tags {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- width: 100%;
- height: 30rpx;
- .tag {
- margin-right: 8rpx;
- font-size: 22rpx;
- height: 30rpx;
- line-height: 30rpx;
- text-align: center;
-
- &.type1{
- padding: 0 8rpx;
- background: #f83c6c;
- border-radius: 4rpx;
- color: #fff;
- }
-
- &.type2 {
- width: 80rpx;
- color: #f83c6c;
- background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top center
- no-repeat;
- background-size: contain;
- }
- &.type3 {
- width: 80rpx;
- background: linear-gradient(270deg, #ff457b 0%, #b03bb8 51%, #6431f2 100%);
- color: #fff;
- border-radius: 4rpx;
- }
- &.type4{
- border: 1rpx solid #f83c6c;
- padding: 0 6rpx;
- color: #f83c6c;
- border-radius: 4rpx;
- }
- }
- }
- }
- }
- </style>
|