159 lines
3.2 KiB
Vue
159 lines
3.2 KiB
Vue
<template>
|
|
<u-popup
|
|
:show="show"
|
|
mode="bottom"
|
|
round="40rpx"
|
|
@close="close"
|
|
:customStyle="{height: '600rpx'}"
|
|
closeable>
|
|
<view class="cover-picker">
|
|
<view class="cover-title">选择封面</view>
|
|
<swiper
|
|
:autoplay="false"
|
|
:circular="true"
|
|
:indicator-dots="false"
|
|
@change="onChange"
|
|
previous-margin="180rpx"
|
|
next-margin="180rpx"
|
|
class="cover-swiper"
|
|
>
|
|
<swiper-item v-for="(item, index) in list" :key="index">
|
|
<view class="cover-item">
|
|
<view class="img-wrap" :class="{ 'v12-mt-8': currentIndex === index }">
|
|
<view class="pro-img-wrap ">
|
|
<image :src="product.image" class="pro-cover-image" mode="widthFix|heightFix" />
|
|
</view>
|
|
<image :src="item.cover" class="cover-image" mode="widthFix|heightFix" />
|
|
<view class="message-text">{{ 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: {
|
|
show: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
list: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
product: {
|
|
type: Object,
|
|
default: () => {}
|
|
},
|
|
message: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
currentIndex: 0
|
|
}
|
|
},
|
|
methods: {
|
|
close() {
|
|
this.$emit('update:show', false)
|
|
},
|
|
onChange(e) {
|
|
this.currentIndex = e.detail.current
|
|
},
|
|
confirm() {
|
|
this.$emit('confirm', this.list[this.currentIndex])
|
|
this.$emit('update:show', false)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.message-text{
|
|
position: absolute;
|
|
text-align: center;
|
|
top: 200rpx;
|
|
font-size: 24rpx;
|
|
color: #fff;
|
|
left: 0;
|
|
right: 0;
|
|
margin: auto;
|
|
}
|
|
.pro-cover-image{
|
|
width: 160rpx;
|
|
height: 160rpx;
|
|
}
|
|
.pro-img-wrap{
|
|
position: absolute;
|
|
width: 160rpx;
|
|
height: 160rpx;
|
|
left: 0;
|
|
right: 0;
|
|
margin: auto;
|
|
border: 10rpx solid #FDF0D3;
|
|
top: -30px;
|
|
}
|
|
.img-wrap{
|
|
position: relative;
|
|
transition: all .2s ease-in-out;
|
|
}
|
|
.tips{
|
|
font-size: 24rpx;
|
|
color: #999;
|
|
text-align: center;
|
|
margin-top: 20rpx;
|
|
}
|
|
.cover-swiper{
|
|
height: 540rpx;
|
|
}
|
|
.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;
|
|
.cover-image {
|
|
width: 320rpx;
|
|
height: 400rpx;
|
|
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;
|
|
}
|
|
}
|
|
</style>
|