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

接口联调

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