123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view class="p30" style="padding-bottom: 200rpx;">
- <view class="levelBox" v-for="levelItem of Arrbylevel">
- <view class="levelItem" v-if="levelItem.list.length > 0" :style="'background: url(' + levelItem.itembj + ')no-repeat; background-size: 100% 100%;'">
- <view
- class="levelTitle fx-c-c"
- :style="{
- color: levelItem.color
- }"
- >
- {{ levelItem.title }}
- <span class="levelProportion">{{ getLevelA(levelItem.level) }}</span>
- </view>
- <view class="levelList">
- <view class="listBg">
- <view class="levelListScroll">
- <view
- v-for="(item, index) in levelItem.list"
- :key="index"
- class="item"
- :style="{
- backgroundImage: 'url(' + LEVEL_MAP[item.level].bg + ')'
- }"
- @click="showSwipe(item)"
- >
- <image
- class="super-image translateX"
- :src="item.spu.cover"
- mode="aspectFit"
- />
-
- <view class="text Probability">
- <text>{{ $common.ignoreRatio0(item.probability) }}%</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { LEVEL_MAP } from '@/utils/config'
- import ossurl from '../../utils/ossurl'
- export default {
- props: {
- products: Array,
- poolId: [Number,String],
- levelist: Array
- },
- data() {
- return {
- ossurl,
- LEVEL_MAP
- }
- },
- computed: {
- Arrbylevel() {
- let levelA = this.products.filter((e) => {
- return e.level == 'A'
- })
- let levelB = this.products.filter((e) => {
- return e.level == 'B'
- })
- let levelC = this.products.filter((e) => {
- return e.level == 'C'
- })
- let levelD = this.products.filter((e) => {
- return e.level == 'D'
- })
- return [
- {
- ...LEVEL_MAP['A'],
- level: 'A',
- itembj: ossurl.box.detail.itembjA,
- list: levelA
- },
- {
- ...LEVEL_MAP['B'],
- level: 'B',
- itembj: ossurl.box.detail.itembjB,
- list: levelB
- },
- {
- ...LEVEL_MAP['C'],
- level: 'C',
- itembj: ossurl.box.detail.itembjC,
- list: levelC
- },
- {
- ...LEVEL_MAP['D'],
- level: 'D',
- itembj: ossurl.box.detail.itembjD,
- list: levelD
- }
- ]
- }
- },
- methods: {
- showSwipe(item) {
- let index = this.products.findIndex(e=>{
- return e.spu.id == item.spu.id
- })
- this.$router.push('award_detail_swipe', { poolId: this.poolId, index })
- },
- getLevelA(level) {
- let item = this.levelist.find((e) => {
- return e.level == level
- })
- if (item) {
- return item.probability + '%'
- } else {
- return '0%'
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .levelBox {
-
- }
- .levelItem {
- padding: 8rpx 20rpx;
- margin-bottom: 30rpx;
- .levelTitle {
- font-size: 36rpx;
- // background: #fdd6b3;
- // display: inline-block;
- font-weight: bold;
- padding: 12rpx 28rpx;
- border-radius: 24rpx 24rpx 0 0;
- background-size: 100%;
- .levelProportion {
- font-size: 24rpx;
- font-family: Source Han Sans, Source Han Sans;
- font-weight: 350;
- background: #fff;
- border-radius: 40rpx;
- margin-left: 10rpx;
- padding: 4rpx 16rpx;
- }
- }
- .levelList {
- // background: #fdd6b3;
- padding: 12rpx 18rpx 22rpx 18rpx;
- border-radius: 0 0 24rpx 24rpx;
- .listBg {
- overflow: hidden;
- word-break: keep-all;
- white-space: nowrap;
- padding-bottom: 24rpx;
- border-radius: 24rpx;
- position: relative;
- width: 100%;
- }
- .levelListScroll {
- overflow: auto;
- }
- .item {
- width: 155rpx;
- // height: 230rpx;
- display: inline-block;
- background-position: 0 40rpx;
- background-size: 100% auto;
- background-repeat: no-repeat;
- margin-left: 10px;
- position: relative;
- padding-top: 46rpx;
- box-sizing: border-box;
- // padding-bottom: 10rpx;
- .super-image {
- width: 140rpx;
- height: 170rpx;
- }
- .text {
- color: #fff;
- border-radius: 5rpx;
- font-size: 22rpx;
- text-align: center;
- }
- .Probability {
- width: 100%;
- height: 70rpx;
- text-align: center;
- text{
- color: #000;
- }
- }
- }
- }
- }
- </style>
|