Compare commits

..

No commits in common. "92cf909ee63a9c4cdcd59912962a304bbc0dfe0b" and "304be8b129314109e5f0e346fea8036a30e7f175" have entirely different histories.

3 changed files with 10 additions and 68 deletions

View File

@ -4,7 +4,6 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.png" /> <link rel="icon" type="image/svg+xml" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<title>运营服务</title> <title>运营服务</title>
</head> </head>
<body> <body>

View File

@ -1,12 +1,11 @@
<template> <template>
<div class="c-goods-item-warp" @click="toDetail(data.id)"> <div class="c-goods-item-warp" @click="toDetail">
<div class="goods-img"> <div class="goods-img">
<img :src="data.goodUrl ? data.goodUrl : ''" alt="" style="width: 100%" /> <el-image :src="getAssetsFile('images/ecommerce/' + 'pic.png')?.href ?? ''" fit="cover" />
<!-- <el-image :src="encodeURIComponent(data.goodUrl) ? encodeURIComponent(data.goodUrl) : ''" fit="cover" @error="handleImageError" />-->
</div> </div>
<div class="goods-name txt-ellipsis clamp2">{{ data.title }}</div> <div class="goods-name txt-ellipsis clamp2">{{ '遇合堂新款禽泰克家禽通用药250遇合堂新款禽泰克家禽通用药250' }}</div>
<div class="goods-do"> <div class="goods-do">
<div class="price txt-ellipsis clamp">{{ data.goodPrice }}</div> <div class="price txt-ellipsis clamp">25.00</div>
<div class="do"> <div class="do">
<div class="iconfont icon-cart"></div> <div class="iconfont icon-cart"></div>
</div> </div>
@ -14,25 +13,13 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, computed } from 'vue';
import { isEmpty, getAssetsFile } from '@/utils'; import { isEmpty, getAssetsFile } from '@/utils';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { encodeURL } from 'js-base64';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const props = defineProps({ const toDetail = () => {
data: { let id = '01';
type: Object,
default: () => {},
},
});
const handleImageError = (e) => {
console.error('图片加载失败:', e);
};
const toDetail = (id) => {
router.push('/sub-operation-service/ecommerce-agriculturalDetail?id=' + id); router.push('/sub-operation-service/ecommerce-agriculturalDetail?id=' + id);
}; };
</script> </script>

View File

@ -3,25 +3,15 @@
<common current-name="agricultural"> <common current-name="agricultural">
<template #main> <template #main>
<banner :imglist="bannerList"></banner> <banner :imglist="bannerList"></banner>
<filtertop :list="treeList" @select="selected"></filtertop> <filtertop :list="treeList"></filtertop>
<div class="goods-list-warp"> <div class="goods-list-warp">
<div class="goods-list"> <div class="goods-list">
<template v-for="(n, index) in list" :key="n.id"> <template v-for="(n, index) in 10" :key="n.id">
<div class="goods-item"> <div class="goods-item">
<goodsItem :data="n"></goodsItem> <goodsItem></goodsItem>
</div> </div>
</template> </template>
</div> </div>
<el-pagination
:current-page="pagination.current"
:page-sizes="[10, 20, 50, 100]"
:page-size="pagination.size"
layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
</div> </div>
</template> </template>
</common> </common>
@ -91,49 +81,15 @@ let params = reactive({
parentId: null, parentId: null,
childrenId: null, childrenId: null,
}); });
let pagination = reactive({
current: 1,
size: 10,
total: 0,
});
const handleSizeChange = (val) => {
pagination.size = val;
getList();
};
const handleCurrentChange = (val) => {
pagination.current = val;
getList();
};
const getList = () => { const getList = () => {
params.current = pagination.current;
params.size = pagination.size;
agriculturalList(params).then((res) => { agriculturalList(params).then((res) => {
if (res.code === 200) { if (res.code === 200) {
list.splice(0, list.length, ...res.data.records); console.log('res', res);
pagination.total = res.data.total;
} }
}); });
}; };
let bannerList = reactive(['images/ecommerce/' + 'banner.png', 'images/ecommerce/' + 'banner1.png']); let bannerList = reactive(['images/ecommerce/' + 'banner.png', 'images/ecommerce/' + 'banner1.png']);
const selected = (data) => {
//
const val = Object.values(data);
console.log(data);
if (val.length === 1) {
params.parentId = val[0].id;
} else {
if (val[0].id === '') {
params.childrenId = '';
params.parentId = null;
} else {
params.childrenId = val[val.length - 1].id;
params.parentId = val[val.length - 1].parentId;
}
}
getList();
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.goods-list-warp { .goods-list-warp {