218 lines
4.8 KiB
Vue
218 lines
4.8 KiB
Vue
<template>
|
|
<u-popup
|
|
:show="show"
|
|
mode="bottom"
|
|
round="40rpx"
|
|
:customStyle="{height: '600rpx'}"
|
|
@close="close"
|
|
>
|
|
<view class="cover-picker v12-pt-4">
|
|
<swiper
|
|
:current="currentIndex"
|
|
:autoplay="false"
|
|
:circular="true"
|
|
:indicator-dots="false"
|
|
@change="onChange"
|
|
previous-margin="180rpx"
|
|
next-margin="180rpx"
|
|
class="cover-swiper"
|
|
>
|
|
<swiper-item v-for="(item, i) in list" :key="i" class="cover-swiper-item" :class="{'n-actived' : currentIndex !== i}">
|
|
<view class="cover-item" :class="{'ios-cover': isIOS}">
|
|
<view class="img-wrap">
|
|
<view class="pro-img-wrap " :style="{
|
|
left: (item.productImageX*2 || 0) + 'rpx',
|
|
top: (item.productImageY*2 || -40) + 'rpx'
|
|
}">
|
|
<image :src="product.image" class="pro-cover-image" mode="widthFix|heightFix" />
|
|
</view>
|
|
<view class="good-story"
|
|
|
|
v-if="product.productStory && item.isShowProductStory"
|
|
:style="{
|
|
right: (item.productStoryX*2 || 0) + 'rpx',
|
|
top: (item.productStoryY*2 || 0) + 'rpx'
|
|
}"
|
|
>
|
|
<view v-for="(line, j) in product.productStory.split('/n')" :key="j">{{ line }}</view>
|
|
</view>
|
|
<image :src="item.cover" class="cover-image" mode="widthFix" />
|
|
<!-- <view class="message-text" :style="{top: currentIndex !== index ? '260rpx' : '220rpx'}">{{ message }}</view> -->
|
|
</view>
|
|
<!-- <view class="cover-name">{{ item.name }} </view> -->
|
|
</view>
|
|
</swiper-item>
|
|
</swiper>
|
|
<view class="v12-justify-center">
|
|
<view class="cover-confirm" @click="confirm">
|
|
确定
|
|
</view>
|
|
</view>
|
|
<view class="tips">礼包封面在对方领取时展示</view>
|
|
</view>
|
|
</u-popup>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
index: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
show: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
list: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
product: {
|
|
type: Object,
|
|
default: () => {}
|
|
},
|
|
message: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
productStory: '源自云南的宣威火腿月饼,/n以匠心手作,外皮酥香,/n内馅甜咸交融。/n每一口,都是月圆情浓的/n团圆滋味,载着滇地独特的/n饮食文化记忆。',
|
|
currentIndex: this.index
|
|
}
|
|
},
|
|
computed: {
|
|
isIOS() {
|
|
return uni.getSystemInfoSync().osName === 'ios'
|
|
}
|
|
},
|
|
watch: {
|
|
index(val) {
|
|
this.currentIndex = val
|
|
}
|
|
},
|
|
methods: {
|
|
close() {
|
|
this.currentIndex = 0
|
|
this.$emit('update:show', false)
|
|
},
|
|
onChange(e) {
|
|
this.currentIndex = e.detail.current
|
|
this.$forceUpdate()
|
|
},
|
|
confirm() {
|
|
this.$emit('confirm', this.list[this.currentIndex])
|
|
this.$emit('update:show', false)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.n-actived{
|
|
.cover-item{
|
|
transform: scale(0.8);
|
|
margin-bottom: -70rpx !important;
|
|
}
|
|
|
|
}
|
|
.cover-swiper-item{
|
|
height: fit-content !important;
|
|
bottom: 0;
|
|
overflow: visible;
|
|
}
|
|
.message-text{
|
|
position: absolute;
|
|
text-align: center;
|
|
top: 200rpx;
|
|
font-size: 24rpx;
|
|
color: #fff;
|
|
left: 0;
|
|
right: 0;
|
|
margin: auto;
|
|
}
|
|
.pro-cover-image{
|
|
width: 320rpx;
|
|
height: 320rpx;
|
|
border-radius: 16rpx;
|
|
}
|
|
.pro-img-wrap{
|
|
position: absolute;
|
|
width: 320rpx;
|
|
height: 320rpx;
|
|
left: 0;
|
|
right: 0;
|
|
margin: auto;
|
|
/*border: 10rpx solid #FDF0D3;*/
|
|
top: -40px;
|
|
border-radius: 16rpx;
|
|
}
|
|
.img-wrap{
|
|
position: relative;
|
|
overflow: visible;
|
|
}
|
|
.tips{
|
|
font-size: 24rpx;
|
|
color: #999;
|
|
text-align: center;
|
|
margin-top: 20rpx;
|
|
}
|
|
.cover-swiper{
|
|
height: 800rpx;
|
|
}
|
|
.cover-picker {
|
|
.cover-title {
|
|
padding: 30rpx;
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
margin-bottom: 30rpx;
|
|
}
|
|
|
|
.cover-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
overflow: visible;
|
|
transition: all .3s ease-in-out;
|
|
margin-bottom: 30rpx;
|
|
.cover-image {
|
|
width: 420rpx;
|
|
// height: 580rpx;
|
|
border-radius: 16rpx;
|
|
transition: all .2s ease-in-out;
|
|
}
|
|
.cover-name {
|
|
margin-top: 20rpx;
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
}
|
|
}
|
|
.cover-confirm {
|
|
margin-top: 40rpx;
|
|
width: 240rpx;
|
|
height: 80rpx;
|
|
border-radius: 16rpx;
|
|
font-size: 32rpx;
|
|
background-color: #C52733 !important;
|
|
color: #fff !important;
|
|
text-align: center;
|
|
line-height: 80rpx;
|
|
}
|
|
}
|
|
.good-story{
|
|
position: absolute;
|
|
color: #fff;
|
|
height: 320rpx;
|
|
writing-mode: vertical-rl;
|
|
color: #ffefd2;
|
|
font-size: 24rpx;
|
|
line-height: 36rpx;
|
|
}
|
|
.ios-cover{
|
|
zoom: 1.01
|
|
}
|
|
</style>
|