feat: 修复bug

This commit is contained in:
黄泽群
2026-07-15 15:29:29 +08:00
parent b79fbba5b3
commit e5716b438c
2 changed files with 906 additions and 921 deletions
+76 -75
View File
@@ -3,8 +3,7 @@
<TopSafe></TopSafe>
<view class="product_info_header_warp">
<up-swiper :list="swiperList" class="product_info_header_swiper" @click="onSwiper"
@change="(e) => (currentNum = e.current)">
<up-swiper :list="swiperList" class="product_info_header_swiper" @click="onSwiper" @change="(e) => (currentNum = e.current)">
<template #indicator>
<view class="indicator-num">
<text class="indicator-num__text">{{ currentNum + 1 }}/{{ swiperList.length }}</text>
@@ -12,26 +11,28 @@
</template>
</up-swiper>
<view class="img_comm left_warp">
<up-image src="/static/common/left_b_st.png" width="30" height="30" bgColor="#f1f6ff00"
@click="jumpLeft"></up-image>
<up-image src="/static/common/left_b_st.png" width="30" height="30" bgColor="#f1f6ff00" @click="jumpLeft"></up-image>
</view>
</view>
<view class="tab-view">
<!-- 限时秒杀卡片 -->
<view class="tab-card">
<view class="tab-item" :class="{ active: activeTab === index }" @click="onActiveTabChange(index)"
v-for="(item, index) in activeTabList" :key="index">
<view class="tab-item" :class="{ active: activeTab === index }" @click="onActiveTabChange(index)" v-for="(item, index) in activeTabList" :key="index">
<text class="tab-text">{{ item.name }}</text>
</view>
</view>
<!-- 限时秒杀标签 -->
<view class="tab-list-container">
<view class="tab-list" @click="onTab(index)" v-for="(item, index) in tabList" :key="index">
<text class="text-28 text-space" :style="{
color: curTab == index ? '#7A35F6' : '#666',
}">{{ item.name }}</text>
<text
class="text-28 text-space"
:style="{
color: curTab == index ? '#7A35F6' : '#666'
}"
>
{{ item.name }}
</text>
<!-- <view class="line" v-if="curTab == index"></view> -->
</view>
</view>
@@ -39,8 +40,7 @@
<view class="setting-view">
<view class="name-box">
<mescroll-uni ref="mescrollRef" @down="downCallback" @up="upCallback" :up="upOption" :down="downOption"
@init="mescrollInit" :fixed="false">
<mescroll-uni ref="mescrollRef" @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" @init="mescrollInit" :fixed="false">
<!-- 原来单个 v-for 替换成两列 -->
<view class="mescrollUniView" v-for="item in dataList" :key="item.id">
<productSeckillCard :item="item" actived-type="seckill" :attributes="attributes" />
@@ -56,18 +56,18 @@
</template>
<script>
import { toRaw } from "vue";
import { getCascadeCategory, getCarouselImage } from "@/api/common.js";
import Header from "@/components/common/header.vue";
import TopSafe from "@/components/common/top-safe.nvue";
import MyBtn from "@/components/common/my-btn.vue";
import PingItem from "@/components/shop/ping-item.vue";
import { getSeckillGoodsList, getSeckillCurrent, getSeckillPreview } from "@/api/product.js";
import CustomTabBar from "@/components/custom-tab-bar.vue";
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue";
import productSeckillCard from "@/components/common/product-seckill-card.vue";
import { APP_PAGE_TYPE } from "@/utils/enumUtils.js";
import { toRaw } from 'vue';
import { getCascadeCategory, getCarouselImage } from '@/api/common.js';
import Header from '@/components/common/header.vue';
import TopSafe from '@/components/common/top-safe.nvue';
import MyBtn from '@/components/common/my-btn.vue';
import PingItem from '@/components/shop/ping-item.vue';
import { getSeckillGoodsList, getSeckillCurrent, getSeckillPreview } from '@/api/product.js';
import CustomTabBar from '@/components/custom-tab-bar.vue';
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js';
import MescrollUni from '@/components/mescroll-uni/mescroll-uni.vue';
import productSeckillCard from '@/components/common/product-seckill-card.vue';
import { APP_PAGE_TYPE } from '@/utils/enumUtils.js';
export default {
mixins: [MescrollMixin],
@@ -76,74 +76,75 @@ export default {
return {
swiperList: [],
currentNum: 0,
activityId: "",
activityId: '',
dataList: [],
tabList: [{ name: "推荐" }],
tabList: [{ name: '推荐' }],
curTab: 0,
activeTab: 0,
activeTabList: [
{ name: "今日秒杀", type: "current" },
{ name: "活动预告", type: "preview" }
{ name: '今日秒杀', type: 'current' },
{ name: '活动预告', type: 'preview' }
],
upOption: {
auto: false,
page: {
size: 10, // 每页数据的数量,默认10
size: 10 // 每页数据的数量,默认10
},
noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
empty: {
tip: `空空如也`,
tip: `空空如也`
},
textColor: "#333",
bgColor: "rgba(0,0,0,0)",
textColor: '#333',
bgColor: 'rgba(0,0,0,0)'
},
downOption: {
auto: false,
textColor: "#333",
bgColor: "rgba(0,0,0,0)",
textColor: '#333',
bgColor: 'rgba(0,0,0,0)'
},
mescroll: null,
attributes: {}, // 限时秒杀卡片属性
attributes: {} // 限时秒杀卡片属性
};
},
onLoad() {
this.init();
this.getCarouselImage()
this.getCarouselImage();
},
methods: {
// 查询轮播图
async getCarouselImage() {
const params = {
pageUi: APP_PAGE_TYPE.SECKILL,
pageUi: APP_PAGE_TYPE.SECKILL
};
const resp = await getCarouselImage(params);
if (resp && resp.bizcode === 100) {
const data = resp.data || [];
this.swiperList =
data.length !== 0 ? data.map((obj) => obj.carouselImage) : [];
this.swiperList = data.length !== 0 ? data.map((obj) => obj.carouselImage) : [];
}
},
// 获取秒杀
onGetSeckillCurrent(type = 'current') {
const url = type === 'current' ? getSeckillCurrent : getSeckillPreview;
url().then((res) => {
if (res.bizcode === 100) {
this.activityId = res.data.activityId;
console.log('获取秒杀当前时间', res.data);
const url = type === 'current' ? getSeckillPreview : getSeckillCurrent;
url()
.then((res) => {
if (res.bizcode === 100) {
this.activityId = res.data.activityId;
console.log('获取秒杀当前时间', res.data);
this.attributes = {
leftTime: res.data.leftTime || null,
this.attributes = {
leftTime: res.data.leftTime || null
};
this.$nextTick(() => {
this.mescroll && this.mescroll.resetUpScroll();
});
} else {
this.mescroll && this.mescroll.endErr();
}
this.$nextTick(() => {
this.mescroll && this.mescroll.resetUpScroll();
});
} else {
})
.catch(() => {
this.mescroll && this.mescroll.endErr();
}
}).catch(() => {
this.mescroll && this.mescroll.endErr();
});
});
},
upCallback(page) {
@@ -154,25 +155,27 @@ export default {
let params = {
page: page.num,
pageSize: page.size,
activityId: this.activityId,
activityId: this.activityId
};
if (this.curTab != 0) {
params["categoryId"] = this.tabList[this.curTab].id;
params['categoryId'] = this.tabList[this.curTab].id;
} else {
params["isRecomm"] = true;
params['isRecomm'] = true;
}
getSeckillGoodsList(params).then((res) => {
let curPageLen = res.data?.entitys ? res.data.entitys.length : 0;
if (page.num === 1) this.dataList = [];
if (res.data?.entitys) {
this.dataList = this.dataList.concat(res.data.entitys);
}
console.log(this.dataList);
getSeckillGoodsList(params)
.then((res) => {
let curPageLen = res.data?.entitys ? res.data.entitys.length : 0;
if (page.num === 1) this.dataList = [];
if (res.data?.entitys) {
this.dataList = this.dataList.concat(res.data.entitys);
}
console.log(this.dataList);
this.mescroll.endBySize(curPageLen, res.data ? res.data.totalCount : 0);
}).catch(() => {
this.mescroll && this.mescroll.endErr();
});
this.mescroll.endBySize(curPageLen, res.data ? res.data.totalCount : 0);
})
.catch(() => {
this.mescroll && this.mescroll.endErr();
});
},
downCallback() {
@@ -215,17 +218,17 @@ export default {
},
jumpLeft() {
uni.navigateBack({
delta: 1, // 返回的页面数,默认为1,返回到上一级
delta: 1 // 返回的页面数,默认为1,返回到上一级
});
},
onSwiper(index) {
uni.previewImage({
current: index,
loop: true,
urls: this.swiperList,
urls: this.swiperList
});
},
},
}
}
};
</script>
@@ -349,7 +352,7 @@ export default {
background-color: #fff;
.tab-text {
color: #7A35F6;
color: #7a35f6;
font-weight: 600;
}
}
@@ -371,7 +374,6 @@ export default {
padding: 24rpx 0 0;
box-sizing: border-box;
background-color: #fff;
;
overflow-x: auto;
position: absolute;
top: 520rpx;
@@ -395,7 +397,6 @@ export default {
align-items: center;
justify-content: space-between;
}
}
.setting-view {