Commit 33f7eaa5 authored by 陈宗胤(贵阳日报)'s avatar 陈宗胤(贵阳日报)
parents ef5597af 8750a2d5
...@@ -164,7 +164,7 @@ const toStore = (item) => { ...@@ -164,7 +164,7 @@ const toStore = (item) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.cart-wrap { .cart-wrap {
height: 100%; height: 1300rpx;
background-color: #f6f6f6; background-color: #f6f6f6;
position: relative; position: relative;
padding: 20rpx; padding: 20rpx;
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
</view> </view>
<!-- 购物车悬浮按钮 --> <!-- 购物车悬浮按钮 -->
<view class="cart-floating" @tap="toCart"> <view class="cart-floating" @tap="toCart">
<wd-badge modelValue="4"> <wd-badge :modelValue="subscript">
<img <img
class="shop-car" class="shop-car"
src="/static/assistingAgriculture/presale/cart.png" src="/static/assistingAgriculture/presale/cart.png"
...@@ -136,7 +136,8 @@ import { ...@@ -136,7 +136,8 @@ import {
getGoodSaleProdList, getGoodSaleProdList,
getPlatformProdList, getPlatformProdList,
} from '../../../api/assistingAgriculture/building'; } from '../../../api/assistingAgriculture/building';
import { onMounted } from 'vue'; import { getshoppingCartList } from '@/api/packageDetail';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
const current = ref(0); const current = ref(0);
...@@ -144,6 +145,7 @@ const rightList = ref([]); ...@@ -144,6 +145,7 @@ const rightList = ref([]);
const light = ref(0); const light = ref(0);
const hotImgList = ref([]); const hotImgList = ref([]);
const testData = ref([]); const testData = ref([]);
const subscript = ref(0);
let sortData; let sortData;
// 轮播图 // 轮播图
const swiperList = ref([ const swiperList = ref([
...@@ -169,8 +171,18 @@ const filteredProdList = ref([]); ...@@ -169,8 +171,18 @@ const filteredProdList = ref([]);
onMounted(async () => { onMounted(async () => {
getGoodSaleProd(); getGoodSaleProd();
platformProdList(); platformProdList();
getshoppingCartListFn();
}); });
// 获取购物车列表
const getshoppingCartListFn = () => {
getshoppingCartList({}).then((res) => {
// 累加prodInfos长度
const totalLength = res.data.reduce((accumulator, current) => {
return accumulator + (current.prodInfos ? current.prodInfos.length : 0);
}, 0);
subscript.value = totalLength;
});
};
// 好货热卖 // 好货热卖
const getGoodSaleProd = () => { const getGoodSaleProd = () => {
getGoodSaleProdList(params).then((res) => { getGoodSaleProdList(params).then((res) => {
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
</view> </view>
<!-- 购物车悬浮按钮 --> <!-- 购物车悬浮按钮 -->
<view class="cart-floating" @tap="toCart"> <view class="cart-floating" @tap="toCart">
<wd-badge modelValue="4"> <wd-badge :modelValue="subscript">
<img <img
class="shop-car" class="shop-car"
src="/static/assistingAgriculture/presale/cart.png" src="/static/assistingAgriculture/presale/cart.png"
...@@ -133,6 +133,8 @@ import { ...@@ -133,6 +133,8 @@ import {
getPresaleProdList, getPresaleProdList,
getStrictSelection, getStrictSelection,
} from '../../../api/assistingAgriculture/building'; } from '../../../api/assistingAgriculture/building';
import { getshoppingCartList } from '@/api/packageDetail';
const swiperList = ref([]); const swiperList = ref([]);
const current = ref(0); const current = ref(0);
// 轮播图数据 // 轮播图数据
...@@ -149,11 +151,23 @@ const params = { ...@@ -149,11 +151,23 @@ const params = {
size: 10, size: 10,
categoryId: router.query.categoryId, categoryId: router.query.categoryId,
}; };
const subscript = ref(0);
const tabsList = ref([]); const tabsList = ref([]);
onMounted(async () => { onMounted(async () => {
getPresale(); getPresale();
presaleSortList(); presaleSortList();
getshoppingCartListFn();
}); });
// 获取购物车列表
const getshoppingCartListFn = () => {
getshoppingCartList({}).then((res) => {
// 累加prodInfos长度
const totalLength = res.data.reduce((accumulator, current) => {
return accumulator + (current.prodInfos ? current.prodInfos.length : 0);
}, 0);
subscript.value = totalLength;
});
};
// 预售板块轮播图 // 预售板块轮播图
const getPresale = () => { const getPresale = () => {
getPresaleList({ place: 'presale' }).then((res) => { getPresaleList({ place: 'presale' }).then((res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment