<template>
  <div class="rounded-borders overflow-hidden q-pb-md" :style="{'width':width,'background-color':bgColor}" v-if="product">
    <q-img :src="product.ImgCover" spinner-color="white" :ratio="16/9" fit="cover">
        <div class="absolute-top text-shadow" style="background: linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0));">
            {{ formatEnum(product.ProductType) }}
        </div>
    </q-img>
    <div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer"  style="height: 74px;">{{ product.Title }}</div>
    <div class="text-subtitle2 text-weight-bolder text-dark q-mx-md">
        <span>CNY {{moneyFormat(product.B2CPrice,2)}}</span>
        <span class="f12 q-ml-sm">起</span>
    </div>
  </div>
</template>


<script>
import ListProductTypeEnum from 'src/utils/listProductType';
import EnumHelper from '../../utils/enumhelper'
export default {
    props:{
        product:{
            type:Object,
            required:true
        },
        width:{
            type:String,
            default:"250px"
        },
        bgColor:{
            type:String,
            default:'#fff'
        }
    },
    data() {
        return {
            
        }
    },
    methods: {
        formatEnum(t){
            let temp = EnumHelper.ParseToEnum(ListProductTypeEnum,t,'value')
            return temp.desc
        }
    },
}
</script>

<style>

</style>