| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <!-- eslint-disable vue/no-mutating-props -->
- <template>
- <view class="shop-item-wrapper" @click="navigateToDetails(item)">
- <view class="item-left-wrap">
- <image :src="item.content?.image" mode="aspectFill" />
- </view>
- <view class="item-right-wrap">
- <view class="top">
- <view class="title u-line-1">{{ item.title }}</view>
- <view class="rate-box">
- <uni-rate allow-half :value="item.content?.rate || 0" disabled color="#ddd" disabledColor="#ff5702" activeColor="#ff5702" size="20" />
- <text class="rate-text">{{ (Number(item.content?.rate) || 0).toFixed(1) }}</text>
- </view>
- <view class="price" v-if="price">¥{{ item.content?.price }}/人</view>
- </view>
- <view class="bottom">
- <view class="tag-item" v-for="(tag, index) in item.content?.tags" :key="index">{{ tag }}</view>
- </view>
- </view>
- </view>
- </template>
- <script lang="ts" setup>
- const props = defineProps({
- price: {
- type: Boolean,
- default: false
- },
- item: {
- type: Object,
- default: () => ({})
- }
- })
- const navigateToDetails = (item: any) => {
- if (props.price) {
- uni.navigateTo({
- url: '/base/shop/details?id=' + item.id
- })
- } else {
- uni.navigateTo({
- url: '/base/shop/detailsShop?id=' + item.id
- })
- }
- }
- </script>
- <style lang="scss" scoped>
- .shop-item-wrapper {
- width: 100%;
- box-sizing: border-box;
- padding: 30rpx;
- background-color: #fff;
- border-radius: 14rpx;
- display: flex;
- margin-bottom: 32rpx;
- .item-left-wrap {
- width: 188rpx;
- height: 188rpx;
- background-color: #f6f7fb;
- border-radius: 14rpx;
- margin-right: 28rpx;
- image {
- width: 188rpx;
- height: 199rpx;
- border-radius: 14rpx;
- }
- }
- .item-right-wrap {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .top {
- .title {
- font-size: 28rpx;
- color: #333;
- font-weight: 500;
- width: 400rpx;
- margin-bottom: 10rpx;
- }
- .rate-box {
- display: flex;
- align-items: flex-end;
- .rate-text {
- margin-left: 14rpx;
- }
- }
- .price {
- font-size: 25rpx;
- color: #ff5704;
- margin-top: 4rpx;
- }
- }
- .bottom {
- display: flex;
- align-items: center;
- .tag-item {
- font-size: 26rpx;
- color: #999;
- margin-right: 22rpx;
- }
- }
- }
- }
- </style>
|