商店首页

parent 6adfc6d6
<template> <template>
<view class="page"> <view class="page">
<view class="banner"> <view class="banner">
<img src="/static/assistingAgriculture/shop/banner.png" alt="" /> <wd-swiper :list="shopImgList" height="236rpx" autoplay></wd-swiper>
</view> </view>
<view class="commodity-wrap"> <view class="commodity-wrap">
<view class="top-bar"> <view class="top-bar">
<view class="header">分类</view> <view class="header">分类</view>
<view class="search"> <view class="search">
<wd-search @search="searchFn" hide-cancel placeholder="请输入要搜索的内容" /> <wd-search
@clear="clearFn"
@search="searchFn"
hide-cancel
placeholder="请输入要搜索的内容"
/>
</view> </view>
</view> </view>
<view class="content"> <view class="content">
...@@ -16,7 +21,6 @@ ...@@ -16,7 +21,6 @@
v-for="(v, i) in listOfDishCategories" v-for="(v, i) in listOfDishCategories"
:key="i" :key="i"
@click="changeCate(v)" @click="changeCate(v)"
@clear="clearFn"
:class="{ active: acitveNav == v.categoryId }" :class="{ active: acitveNav == v.categoryId }"
> >
{{ v.categoryName }} {{ v.categoryName }}
...@@ -101,12 +105,14 @@ ...@@ -101,12 +105,14 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { shopCategoryByShop, searchProdPage, sgyBasketlist } from '@/api/assistingAgriculture/shop'; import { shopCategoryByShop, searchProdPage, sgyBasketlist } from '@/api/assistingAgriculture/shop';
import { addOrder } from '@/api/packageDetail'; import { addOrder } from '@/api/packageDetail';
import { getStoreInformation } from '@/api/shop';
const format = ref('DD-HH:mm:ss'); const format = ref('DD-HH:mm:ss');
const imgUrl = import.meta.env.VITE_APP_IMG_URL; const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const currentShopId = ref(''); const currentShopId = ref('');
const scrollTop = ref(0); const scrollTop = ref(0);
const prodList = ref([]); const prodList = ref([]);
const listOfDishCategories = ref([]); const listOfDishCategories = ref([]);
const shopImgList = ref([]);
const params = ref({ const params = ref({
isEnd: false, isEnd: false,
current: 1, current: 1,
...@@ -122,6 +128,7 @@ onLoad((options) => { ...@@ -122,6 +128,7 @@ onLoad((options) => {
searchProdPageFn(); searchProdPageFn();
}); });
sgyBasketlistFn(); sgyBasketlistFn();
getStoreInformationFn();
}); });
const shopCategoryByShopFn = (shopId) => { const shopCategoryByShopFn = (shopId) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -134,7 +141,19 @@ const shopCategoryByShopFn = (shopId) => { ...@@ -134,7 +141,19 @@ const shopCategoryByShopFn = (shopId) => {
}); });
}); });
}; };
const getStoreInformationFn = () => {
getStoreInformation(currentShopId.value).then((res) => {
if (res.code === 0) {
shopImgList.value = res.data.imgList.map((item) => {
console.log('imgUrl.value', imgUrl.value);
item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.imgUrl;
return item.imgUrl;
});
console.log('shopImgList', shopImgList);
}
});
};
const acitveNav = ref(1); const acitveNav = ref(1);
const searchFn = (e) => { const searchFn = (e) => {
const { value } = e; const { value } = e;
...@@ -155,6 +174,7 @@ const refreshData = (item) => { ...@@ -155,6 +174,7 @@ const refreshData = (item) => {
params.value.isEnd = false; params.value.isEnd = false;
params.value.current = 1; params.value.current = 1;
prodList.value = []; prodList.value = [];
params.value.prodName = '';
resolve(); resolve();
}); });
}; };
...@@ -183,10 +203,9 @@ const scrolltolowerFn = () => { ...@@ -183,10 +203,9 @@ const scrolltolowerFn = () => {
searchProdPageFn(); searchProdPageFn();
}; };
function clearFn() { function clearFn() {
console.log('111111111111111111111111'); refreshData().then((res) => {
searchProdPageFn();
params.value.prodName = ''; });
searchProdPageFn();
} }
const addPurchase = ref(0); const addPurchase = ref(0);
...@@ -243,9 +262,8 @@ uni-page-body { ...@@ -243,9 +262,8 @@ uni-page-body {
width: 710rpx; width: 710rpx;
height: 236rpx; height: 236rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
img { :deep(.wd-swiper__track) {
width: 100%; border-radius: 0;
height: 100%;
} }
} }
.commodity-wrap { .commodity-wrap {
......
...@@ -917,7 +917,7 @@ page { ...@@ -917,7 +917,7 @@ page {
font-weight: 500; font-weight: 500;
} }
img { img {
width: 100%; max-width: 100%;
height: auto; height: auto;
margin-top: 20rpx; margin-top: 20rpx;
} }
......
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