/* 全部一行两个 */ <template> <div class="tab_content abroad"> <div class="padding_box"> <template v-for="(item,index) in list"> <!-- <div class="uni_item_mini" :key="index" @click="handleUniDetail(item)" v-if="index<=3"> --> <div class="uni_item_mini" :key="index" @click="handleUniDetail(item)"> <div class="img_box"> <!-- <img :loading="defaultImg" v-lazy="item.coverUrl" alt=""> --> <img :src="item.coverUrl?item.coverUrl:defaultImg" alt=""> <template v-if="item.startDate"> <p class="time" v-if="item.startDate==item.endDate">活动时间:{{item.startDate}} {{item.week}}</p> <p class="time" v-else>活动时间:{{item.startDate}}-{{item.endDate}}</p> </template> <div class="bottom" v-if="item.cityAddress||item.areaAddress"> <span class="address"> <van-icon name="location" /> {{item.cityAddress}}{{item.cityAddress&&item.areaAddress?'·':''}}{{item.areaAddress}} </span> </div> </div> <div class="content"> <p class="title">{{item.course_name}}</p> <div class="tag_box"> <template v-for="(tag,index2) in item.course_labels"> <span class="tag" v-if="tag" :key="index2">{{tag}}</span> </template> </div> <div class="flex_box"> <p class="price" v-if="item.showPrice>0"><span class="icon">¥</span>{{item.showPrice}}<span class="tint">起 </span><span class="limit">/{{item.minPeopleCount}}{{item.unitName}}成团</span></p> <p class="price free" v-else>¥{{item.price}}</p> <span class="count"> <van-icon name="eye-o" /> {{item.read_count}} </span> </div> </div> </div> </template> <van-empty v-if="list.length==0" description="暂无活动" /> </div> </div> </template> <script> export default { props: { list: { type: Array, default: [] } }, data () { return { active: 0, defaultImg: require('@/assets/service/defCoure.jpg'), } }, methods: { handleUniDetail (item) { this.$router.push({ name: 'ServiceAbroadDetail', query: { courseId: item.id } }) }, } } </script> <style lang="scss" scoped> .tab_content { box-sizing: border-box; overflow: auto; } .tab_btn_box { .tab_btn { width: 178px; height: 52px; border-radius: 16px; border: none; background: rgba(255, 255, 255, 0.36); color: #666666; padding: 0; margin-right: 16px; &.active { background: #ffffff; color: #4092ff; } } } .abroad { padding: 18px 0; padding-bottom: 146px; .padding_box { padding: 0 28px; } .uni_item_mini { position: relative; margin-top: 16px; display: inline-block; width: 336px; vertical-align: top; &:nth-of-type(2n-1) { margin-right: 22px; clear: both; } .img_box { position: relative; border-radius: 16px; overflow: hidden; width: 336px; img { width: 448px; height: 336px; margin-left: -56px; } .time { position: absolute; top: 0; left: 0; width: 100%; line-height: 52px; font-size: 21px; font-weight: bold; background: rgba(0, 0, 0, 0.27); border-radius: 16px; color: #fff; text-align: center; white-space: nowrap; } .bottom { position: absolute; bottom: 0; left: 0; color: #fff; height: 64px; display: flex; align-items: center; justify-content: space-between; width: 100%; box-sizing: border-box; padding: 0 20px; background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5)); .address { font-size: 24px; } } } .content { margin-top: 6px; .title { display: -webkit-box; font-size: 28px; -webkit-line-clamp: 2; text-overflow: ellipsis; overflow: hidden; -webkit-box-orient: vertical; } .address { font-size: 24px; margin-top: 8px; } .tag_box { padding-top: 6px; .tag { display: inline-block; margin-bottom: 10px; margin-right: 10px; color: #4092ff; font-size: 20px; border-radius: 4px; border: 2px solid #4092ff; padding: 0px 6px; } } .flex_box { display: flex; justify-content: space-between; align-items: center; } .count { font-size: 24px; color: #999; } .price { font-size: 34px; font-weight: bold; color: #f64c37; .icon { font-size: 24px; color: #f64c37; } .tint { font-size: 22px; font-weight: normal; color: #909399; } .limit { font-size: 22px; font-weight: normal; color: #333333; } } .free { font-size: 28px; white-space: nowrap; overflow: hidden; max-width: 240px; text-overflow: ellipsis; } } } .line { width: 100%; height: 16px; background: #f5f6fa; } } </style> <style lang="scss"> // 长辈版 .elder { .abroad { } } </style>