productcard.vue 3.3 KB
Newer Older
sin's avatar
sin committed
1
<template>
2 3 4 5 6 7 8 9 10
    <router-link :to="'/product/' + product.id">
        <van-cell-group class="additional">
            <van-card
                    :title="product.name"
                    :desc="product.sellPoint"
                    :num="(iscard?null:product.quantity)"
                    style="background:#fff"
            >
                <template slot="thumb">
11
                    <img :src="product.picUrls && product.picUrls ? product.picUrls[0] : ''"/>
12 13
                </template>
                <template slot="tags">
14 15 16 17 18
                    <p class="price" v-if="product.buyPrice || product.price">
<span>{{product.buyPrice ? product.buyPrice / 100.00 : product.price / 100.00}}</span>
                        <van-tag v-if="product.promotionActivityTitle" plain type="danger">
                            {{ product.promotionActivityTitle }}
                        </van-tag>
19

20
                    </p>
21 22
                    <!--  TODO 芋艿 暂时去掉 -->
<!--                    <van-stepper v-if="iscard" v-model="product.quantity" :max="product.max" :min="product.min"/>-->
23 24 25 26 27 28 29 30 31 32 33 34
                </template>
            </van-card>
            <!-- TODO 芋艿,暂时去掉赠品 -->
            <!--<van-cell  v-for="(gift,j) in product.gift" :key="j"  :value="'x'+gift.quantity" >-->
            <!--<template slot="title">-->
            <!--<van-tag type="danger" v-if="j==0" >赠品</van-tag>-->
            <!--<span class="van-cell-text" :style="(j>0?'margin-left: 35px;':'')" >{{gift.title}}</span>-->
            <!--</template>-->
            <!--</van-cell>-->
            <slot/>
        </van-cell-group>
    </router-link>
sin's avatar
sin committed
35 36 37
</template>

<script>
38 39 40 41 42 43 44 45
  export default {
    name: 'product-card',
    props: {
      product: Object,
      iscard: {
        type: Boolean,
        default: false
      },
sin's avatar
sin committed
46
    }
47
  }
sin's avatar
sin committed
48 49 50
</script>

<style lang="less">
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
    .additional {
        .van-cell {
            padding: 0 15px;
            font-size: 12px;
        }

        .van-cell:not(:last-child)::after {
            border: 0;
        }

        .van-card__title {
            font-size: 14px;
        }

        .van-cell__title {
            flex: 10;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .van-tag {
            line-height: 12px;
sin's avatar
sin committed
74 75
            margin-right: 5px;
        }
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116

        .price {
            color: #e93b3d;
            font-size: 10px;
            overflow: hidden;
            height: 18px;

            span {
                font-size: 16px;
                margin-right: 5px;
            }

            .van-tag {
                font-size: 12px;
            }
        }

        .van-stepper {
            position: absolute;
            bottom: 5px;
            right: 5px;

            &__plus {
                width: 30px;
            }

            &__minus {
                width: 30px;
            }
        }

        .image_tag {
            position: absolute;
            bottom: 0;
            width: 90px;
            height: 20px;
            line-height: 20px;
            font-size: 10px;
            color: #fff;
            text-align: center;
            background-color: rgba(0, 0, 0, .7);
sin's avatar
sin committed
117 118 119
        }
    }

120 121 122 123
    .additional::after {
        border-color: #f7f7f7;

    }
sin's avatar
sin committed
124
</style>