feat: 选品广场购买结算返回原位

This commit is contained in:
2026-09-08 11:10:52 +08:00
parent a573a61be7
commit 34b2ac37b8
8 changed files with 1039 additions and 630 deletions
@@ -1,48 +1,53 @@
<template>
<view class="earnings-carousel">
<view class="earnings-header">
<view class="earnings-header" @click="toggleCollapsed">
<view class="earnings-title">
<view class="earnings-title__icon">
<image class="earnings-title__icon-img" src="/static/icon/medal.png" mode="aspectFit" />
</view>
<view class="earnings-title__text">销量风云榜</view>
</view>
<view class="earnings-collapse-icon" :class="{ collapsed: isCollapsed }">
<text class="earnings-collapse-arrow">▾</text>
</view>
</view>
<swiper
class="earnings-swiper"
:current="currentPageIndex"
:autoplay="autoplay"
:interval="interval"
:duration="duration"
:circular="swiperPages.length > 1"
:disable-touch="true"
:indicator-dots="false"
@change="onSwiperChange"
>
<swiper-item v-for="(page, pageIndex) in swiperPages" :key="pageIndex">
<view class="earnings-page">
<view class="earnings-row">
<view class="rank-card" v-for="(item, i) in page" :key="item.orderItemId || i">
<view class="rank-top">
<image class="rank-avatar" :src="getAvatar(item)" mode="aspectFill" />
</view>
<view class="rank-name lineOne">{{ item.nickname || maskMobile(item.mobile) || '-' }}</view>
<view class="rank-goods">
<image class="rank-goods__img" :src="getGoodsPic(item)" mode="aspectFill" />
<view class="rank-goods__mask">
<view class="rank-rate">{{ formatPercent(item.progress) }}</view>
<view class="rank-progress">
<view class="rank-progress__bar" :style="{ width: `${clampProgress(item.progress)}%` }" />
<view v-show="!isCollapsed" class="earnings-content">
<swiper
class="earnings-swiper"
:current="currentPageIndex"
:autoplay="autoplay && !isCollapsed"
:interval="interval"
:duration="duration"
:circular="swiperPages.length > 1"
:disable-touch="true"
:indicator-dots="false"
@change="onSwiperChange"
>
<swiper-item v-for="(page, pageIndex) in swiperPages" :key="pageIndex">
<view class="earnings-page">
<view class="earnings-row">
<view class="rank-card" v-for="(item, i) in page" :key="item.orderItemId || i">
<view class="rank-top">
<image class="rank-avatar" :src="getAvatar(item)" mode="aspectFill" />
</view>
<view class="rank-name lineOne">{{ item.nickname || maskMobile(item.mobile) || '-' }}</view>
<view class="rank-goods">
<image class="rank-goods__img" :src="getGoodsPic(item)" mode="aspectFill" />
<view class="rank-goods__mask">
<view class="rank-rate">{{ formatPercent(item.progress) }}</view>
<view class="rank-progress">
<view class="rank-progress__bar" :style="{ width: `${clampProgress(item.progress)}%` }" />
</view>
</view>
</view>
<view class="rank-goods__name lineOne">{{ item.spuName || '-' }}</view>
</view>
<view class="rank-goods__name lineOne">{{ item.spuName || '-' }}</view>
</view>
</view>
</view>
</swiper-item>
</swiper>
</swiper-item>
</swiper>
</view>
</view>
</template>
@@ -72,11 +77,25 @@
type: Number,
default: 450,
},
defaultCollapsed: {
type: Boolean,
default: false,
},
});
const MAX_PAGES = 30;
const DISPLAY_SIZE = 5;
const isCollapsed = ref(Boolean(props.defaultCollapsed));
const toggleCollapsed = () => {
isCollapsed.value = !isCollapsed.value;
if (!isCollapsed.value) {
schedulePrefetchNext(true);
} else {
clearPrefetch();
}
};
const currentPageIndex = ref(0);
const total = ref(0);
const pagesMap = ref({});
@@ -263,7 +282,8 @@
.earnings-header {
display: flex;
align-items: center;
padding: 0 6rpx 0;
justify-content: space-between;
padding: 0 6rpx 12rpx;
}
.earnings-title {
@@ -294,6 +314,28 @@
color: #1d4ed8;
}
.earnings-collapse-icon {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.25s ease;
&.collapsed {
transform: rotate(-90deg);
}
.earnings-collapse-arrow {
font-size: 36rpx;
color: #1d4ed8;
line-height: 1;
font-weight: 700;
}
}
.earnings-content {
overflow: hidden;
}
.earnings-swiper {
height: 280rpx;
}