| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template>
- <view class="hot-item">
- <image :src="item.cover" class="book-cover" mode="aspectFill"></image>
- <view class="info-right">
- <view class="info-top">
- <text class="title">{{ item.title }}</text>
- <view class="price-row">
- <text class="currency">¥</text>
- <text class="price">{{ item.price }}</text>
- </view>
- <view class="flex space-between">
- <view class="discount-tag" v-if="item.discountDesc">
- <text class="discount">{{ item.discount }}</text>
- <text class="discount-desc">{{ item.discountDesc }}</text>
- </view>
- <view class="btn-cart" @click.stop="handleAddToCart">
- <text>加入购物车</text>
- </view>
- </view>
- </view>
- </view>
- <!-- Product Selection Popup -->
- <SelectGoodPopup ref="popup" @confirm="onPopupConfirm"></SelectGoodPopup>
- </view>
- </template>
- <script>
- import SelectGoodPopup from '../select-good-popup/index.vue';
- export default {
- name: 'HotRecommendItem',
- components: {
- SelectGoodPopup
- },
- props: {
- item: {
- type: Object,
- required: true,
- default: () => ({})
- }
- },
- methods: {
- handleAddToCart() {
- this.$refs.popup.open(this.item);
- },
- onPopupConfirm(data) {
- this.$emit('add-cart', data);
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .hot-item {
- display: flex;
- border-radius: 16rpx;
- .book-cover {
- width: 140rpx;
- height: 180rpx;
- border-radius: 4rpx;
- background-color: #f5f5f5;
- margin-right: 20rpx;
- flex-shrink: 0;
- }
- .info-right {
- flex: 1;
- .info-top {
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 10rpx;
- display: block;
- }
- .price-row {
- display: flex;
- align-items: baseline;
- margin-bottom: 10rpx;
- .currency {
- font-size: 32rpx;
- color: #D81A00;
- font-weight: bold;
- }
- .price {
- font-size: 36rpx;
- color: #D81A00;
- font-weight: bold;
- }
- }
- .discount-tag {
- display: inline-block;
- border-radius: 10rpx;
- font-family: Source Han Sans SC;
- font-weight: 500;
- font-size: 22rpx;
- height: 40rpx;
- line-height: 40rpx;
- background-color: #fff;
- border: 2rpx solid #D81A00;
- box-sizing: border-box;
- overflow: auto;
- .discount {
- background: #D81A00;
- color: #fff;
- display: inline-block;
- padding: 0 12rpx;
- box-sizing: border-box;
- }
- .discount-desc {
- color: #D81A00;
- padding: 0 10rpx;
- }
- }
- }
- .btn-cart {
- align-self: flex-end;
- background: #38C248;
- border-radius: 30rpx;
- height: 60rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0 20rpx;
- text {
- font-size: 28rpx;
- color: #fff;
- }
- }
- }
- }
- </style>
|