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