Commit 42a04927 authored by 张娇(东信)'s avatar 张娇(东信)

接口联调

parent b0411422
......@@ -256,4 +256,4 @@
"globalStyle": {
"navigationStyle": "custom"
}
}
\ No newline at end of file
}
......@@ -27,15 +27,28 @@
src="/static/assistingAgriculture/assets/culture.png"
style="width: 366rpx; height: 362rpx"
/>
<view>
<view v-for="(item, index) in rightList" :key="index" @click="toPresale(item.categoryId)">
<img
class="right-sort"
:src="item.icon"
style="width: 336rpx; height: 176rpx; margin-left: 8rpx"
/>
</view>
<view class="right-img">
<img
class="delicacy"
src="/static/assistingAgriculture/assets/delicacy.png"
style="height: 176rpx; margin-left: 8rpx"
/>
<img
@tap="toPresale"
class="fresh"
src="/static/assistingAgriculture/assets/fresh.png"
style="height: 176rpx; margin-left: 8rpx"
/>
</view>
<!-- <view>-->
<!-- <view v-for="(item, index) in rightList" :key="index" @click="toPresale(item.categoryId)">-->
<!-- <img-->
<!-- class="right-sort"-->
<!-- :src="item.icon"-->
<!-- style="width: 336rpx; height: 176rpx; margin-left: 8rpx"-->
<!-- />-->
<!-- </view>-->
<!-- </view>-->
</view>
</view>
<!-- 好货热卖-->
......@@ -50,24 +63,15 @@
color="#ABAAAA"
style="position: relative; float: right; top: -42rpx"
></wd-icon>
<img
@tap="toDetail"
class="rice"
src="/static/assistingAgriculture/assets/rice.png"
style="width: 670rpx; height: 236rpx"
/>
<img
@tap="toDetail"
class="potato"
src="/static/assistingAgriculture/assets/potato.png"
style="width: 650rpx; height: 236rpx; margin-left: 20rpx; margin-top: -20rpx"
/>
<view class="hot-img" v-for="(item, index) in hotImgList" :key="index">
<img class="rice" @tap="toDetail" :src="item.img" style="width: 670rpx; height: 236rpx" />
</view>
</view>
<!-- tabs-->
<scroll-view class="tabs" show-scrollbar="false" scroll-x :scroll-with-animation="true">
<text
@tap="choice(index, item.categoryId)"
v-for="(item, index) in tabsList"
@tap="choice(index, item)"
v-for="(item, index) in detailList"
:key="index"
class="text"
:class="light === index ? 'light' : ''"
......@@ -82,10 +86,10 @@
src="/static/assistingAgriculture/assets/fruit4.png"
style="width: 670rpx; height: 236rpx"
/>
<view class="sort-list">
<view class="sort-img" v-for="(item, index) in detailList" :key="index">
<img @tap="toDetail" :src="item.img" style="width: 330rpx; height: 330rpx" />
<view class="detail-title">{{ item.text }}</view>
<view>
<view class="sort-img" v-for="(item, index) in testData" :key="index">
<img @tap="toDetail" :src="item.imgUrl" style="width: 330rpx; height: 330rpx" />
<view class="detail-title">{{ item.content }}</view>
<view class="price-page">
<text class="price">{{ item.price }}</text>
</view>
......@@ -115,13 +119,16 @@ import Search from '../../../components/assistingAgriculture/index/Search.vue';
import {
getGoodSaleProdList,
getPlatformProdList,
getStrictSelection,
} from '../../../api/assistingAgriculture/building';
import { onMounted } from 'vue';
import { useRoute } from 'vue-router';
const current = ref(0);
const rightList = ref([]);
const light = ref(0);
const hotImgList = ref([]);
const testData = ref([]);
let sortData;
// 轮播图
const swiperList = ref([
'../../../static/assistingAgriculture/assets/village.png',
......@@ -129,19 +136,7 @@ const swiperList = ref([
'../../../static/assistingAgriculture/assets/village.png',
]);
// 分类列表数据
const detailList = ref([
{ img: '/static/assistingAgriculture/assets/fruit.png', price: '2555', text: '这是草莓这是草莓' },
{
img: '/static/assistingAgriculture/assets/fruit1.png',
price: '2555',
text: '这是草莓这是草莓',
},
{ img: '/static/assistingAgriculture/assets/fruit2.png', price: '2555', text: '麻辣鱼豆腐' },
{ img: '/static/assistingAgriculture/assets/fruit3.png', price: '2555', text: '麻辣鱼豆腐' },
]);
const choice = (index) => {
light.value = index;
};
const detailList = ref([]);
const params = {
current: 1,
size: 10,
......@@ -152,35 +147,44 @@ const params1 = {
size: 10,
categoryId: router.query.categoryId,
};
const filteredProdList = ref([]);
onMounted(async () => {
getStrictSelectionList();
getGoodSaleProd();
platformProdList();
});
// 筑农严选分类
const getStrictSelectionList = () => {
getStrictSelection().then((res) => {
res.data.forEach((item) => {
item.icon = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
rightList.value = res.data.splice(0, 2);
});
};
// 好货热卖
const getGoodSaleProd = () => {
getGoodSaleProdList(params).then((res) => {});
getGoodSaleProdList(params).then((res) => {
res.data.records.forEach((item) => {
item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
hotImgList.value = res.data.records.slice(0, 2);
});
};
// 筑农严选首页-分类查询商品列表
const platformProdList = () => {
getPlatformProdList(params1).then((res) => {});
getPlatformProdList({ categoryId: router.query.categoryId }).then((res) => {
detailList.value = res.data;
});
};
const choice = (index, item) => {
console.log(item.categoryId, index, 222);
testData.value = detailList.value[index].prodList;
testData.value.forEach((item) => {
item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
console.log(testData.value, 323);
light.value = index;
};
// 跳转预售
const toPresale = (id) => {
const toPresale = () => {
xma.navigateTo({
url: `/pages/assistingAgriculture/index/presale?categoryId=${id}`,
url: `/pages/assistingAgriculture/index/presale?categoryId=3273`,
});
};
function handleClick(e) {
console.log(e);
}
......@@ -423,4 +427,10 @@ page {
height: 100%;
background-color: lightgreen;
}
img.rice {
border-radius: 16rpx 16rpx 16rpx 16rpx;
margin-left: 20rpx;
margin-top: -40rpx;
padding-bottom: 40rpx;
}
</style>
......@@ -32,12 +32,17 @@
</view>
</view>
</view>
<view class="product-page" v-for="(item, index) in list" :key="index">
<view class="product-page" v-for="(item, index) in list" :key="index" @click="toDetail">
<view>
<view class="page-title">{{ item.categoryName }}</view>
<img :src="item.img" class="main-img" />
<view style="display: flex; flex-direction: row">
<view class="detail-border" v-for="(item, index) in item.commodityList" :key="index">
<view
class="detail-border"
v-for="(item, index) in item.commodityList"
:key="index"
@click="toDetail"
>
<img :src="item.commodityImg" style="width: 216rpx; height: 176rpx" />
<view class="detail-title">{{ item.prodName }}</view>
<view class="jiage-page">
......@@ -89,7 +94,6 @@ onMounted(async () => {
getList();
getPresaleCategoryList();
getPresale();
platformProdList();
});
// 获取筑农专区分类;
const getList = () => {
......
......@@ -22,9 +22,9 @@
</view>
<view class="sort">
<view style="display: flex; flex-direction: row">
<view class="borderClass" @tap="toPresale" v-for="(item, index) in sortList" :key="index">
<img :src="item.img" style="width: 48rpx; height: 48rpx" />
<view class="sort-text">{{ item.text }}</view>
<view class="borderClass" @tap="toTab(item)" v-for="(item, index) in sortList" :key="index">
<img :src="item.imgUrl" style="width: 48rpx; height: 48rpx" />
<view class="sort-text">{{ item.categoryName }}</view>
</view>
</view>
</view>
......@@ -38,7 +38,7 @@
class="text"
:class="light === index ? 'light' : ''"
>
{{ item.text }}
{{ item.categoryName }}
</text>
</scroll-view>
</view>
......@@ -149,30 +149,16 @@ import {
categoryPresaleList,
getPresaleList,
getPresaleProdList,
getStrictSelection,
} from '../../../api/assistingAgriculture/building';
const swiperList = ref([]);
const current = ref(0);
// 轮播图数据
let lunboData;
let sortData;
const light = ref(0);
const sortList = ref([
{ img: '/static/assistingAgriculture/presale/bacImg.png', price: '25', text: '应季好物' },
{ img: '/static/assistingAgriculture/presale/img2.png', price: '25', text: '猪肉蛋禽' },
{ img: '/static/assistingAgriculture/presale/img3.png', price: '25', text: '米面粮油' },
{ img: '/static/assistingAgriculture/presale/img4.png', price: '25', text: '预选蔬菜' },
{ img: '/static/assistingAgriculture/presale/img5.png', price: '25', text: '心选水果' },
]);
const tabsData = ref([
{ img: '/static/assistingAgriculture/assets/mainPicture.png', text: '全部' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类1' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类2' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类3' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类4' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类5' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类6' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类7' },
{ img: '/static/assistingAgriculture/assets/presale.png', text: '分类8' },
]);
const sortList = ref([]);
const tabsData = ref([]);
const buyList = ref([
{ img: '/static/assistingAgriculture/presale/buy.png', price: '29.9', text: '应季好物' },
{ img: '/static/assistingAgriculture/presale/buy.png', price: '29.9', text: '猪肉蛋禽' },
......@@ -244,6 +230,8 @@ onMounted(async () => {
getPresale();
getPresaleProd();
presaleSortList();
getStrictSelectionList();
// toTab(item.categoryId);
});
// 预售板块轮播图
const getPresale = () => {
......@@ -260,15 +248,34 @@ const getPresale = () => {
};
// 筑农预售分类
const presaleSortList = () => {
categoryPresaleList({ level: 1 }).then((res) => {
console.log(res, 111);
tabsList.value = res.data;
categoryPresaleList().then((res) => {
res.data.forEach((item) => {
item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
sortData = res.data;
sortList.value = res.data.map((item) => {
return item.imgUrl;
});
console.log(res.data, 111);
sortList.value = res.data;
});
};
// 筑农预售子分类
const getStrictSelectionList = () => {
getStrictSelection({ parentId: '3287' }).then((res) => {
res.data.forEach((item) => {
item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
tabsData.value = res.data;
});
};
// 筑农首页-分类查询商品列表
const getPresaleProd = () => {
getPresaleProdList(params).then((res) => {
console.log(res, 222);
// res.data.forEach((item) => {
// item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.pic;
// });
// tabsData.value = res.data;
});
};
// 左侧数据列表
......@@ -310,6 +317,9 @@ function toDetail() {
url: '/pages/assistingAgriculture/detail/detail',
});
}
function toTab(item) {
console.log(item, 222);
}
</script>
<style lang="scss" scoped>
......
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