285 lines
9.1 KiB
Vue
Raw Normal View History

<template>
<div class="purchaser-index-warp">
<common current-name="purchaser">
<template #main>
<el-row class="purchaser-top">
<el-col :span="12">
<div class="purchaser-top-title">行情动态</div>
2025-04-02 17:32:13 +08:00
<div class="purchaser-charts">
<marketCharts></marketCharts>
</div>
</el-col>
<el-col :span="12">
<div class="purchaser-top-title">近7天热门产品</div>
2025-04-02 17:32:13 +08:00
<div class="purchaser-charts">
<hotGoodsWordClould></hotGoodsWordClould>
</div>
</el-col>
</el-row>
<filtertop :list="treeList"></filtertop>
2025-04-02 17:32:13 +08:00
<div class="hot-list-warp">
<el-row :gutter="10">
<el-col :span="8" align="left">
<el-cascader :options="typeTree" :props="treeOption" clearable :placeholder="'请选择地区'" />
</el-col>
<el-col :span="16" align="left">
<el-radio-group v-model="filter.time">
<el-radio v-for="(n, index) in dateList" :key="index" :value="n.value">{{ n.label }}</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
2025-04-03 17:20:49 +08:00
<el-table :data="tableData" style="width: 100%" height="320" @row-click="rowClick">
2025-04-02 17:32:13 +08:00
<el-table-column prop="title" label="采购品种" />
<el-table-column prop="region" label="收货地" />
<el-table-column prop="buyer" label="采购方" />
<el-table-column prop="buyNum" label="采购量(kg)" />
<el-table-column prop="buyer" label="采购时间" />
<el-table-column fixed="right" label="操作">
<template #default>
2025-04-03 17:20:49 +08:00
<el-button link type="primary" size="small" @click.stop="handleClick"> 去报价 </el-button>
2025-04-02 17:32:13 +08:00
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</div>
</template>
</common>
2025-04-02 17:32:13 +08:00
<purchaserPopup ref="popupQuote" :list="treeList"></purchaserPopup>
</div>
</template>
<script setup name="ecommerce">
import common from './components/common.vue';
import filtertop from './components/filtertop.vue';
2025-04-02 17:32:13 +08:00
import hotGoodsWordClould from './components/hotGoodsWordClould.vue';
import marketCharts from './components/marketCharts.vue';
import purchaserPopup from './components/purchaserPopup.vue';
import { ref, reactive, onMounted, watch, computed } from 'vue';
2025-04-02 17:32:13 +08:00
import { getRegion } from '@/apis/index';
2025-04-03 17:20:49 +08:00
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();
const router = useRouter();
let treeList = reactive([
{
id: '01',
2025-05-20 13:05:37 +08:00
name: '农产品',
children: [
{
2025-05-20 13:05:37 +08:00
parentId: '01',
id: '0101',
2025-05-20 13:05:37 +08:00
name: '植物性农产品',
children: [
2025-05-20 13:05:37 +08:00
{ parentId: '0101', id: '010101', name: '谷物' },
{ parentId: '0101', id: '010102', name: '蔬菜' },
{ parentId: '0101', id: '010103', name: '水果' },
{ parentId: '0101', id: '010104', name: '坚果与油料作物' },
{ parentId: '0101', id: '010105', name: '糖料作物' },
{ parentId: '0101', id: '010106', name: '纤维作物' },
{ parentId: '0101', id: '010107', name: '茶叶' },
{ parentId: '0101', id: '010108', name: '咖啡' },
{ parentId: '0101', id: '010109', name: '香料' },
],
},
{
2025-05-20 13:05:37 +08:00
parentId: '01',
id: '0102',
2025-05-20 13:05:37 +08:00
name: '动物性农产品',
children: [
2025-05-20 13:05:37 +08:00
{ parentId: '0102', id: '010201', name: '肉类' },
{ parentId: '0102', id: '010202', name: '奶制品' },
{ parentId: '0102', id: '010203', name: '蛋类' },
{ parentId: '0102', id: '010204', name: '蜂蜜' },
{ parentId: '0102', id: '010205', name: '水产品' },
],
},
{
2025-05-20 13:05:37 +08:00
parentId: '01',
id: '0103',
2025-05-20 13:05:37 +08:00
name: '特殊农产品',
children: [
2025-05-20 13:05:37 +08:00
{ parentId: '0103', id: '010301', name: '花卉与苗木' },
{ parentId: '0103', id: '010302', name: '药材' },
{ parentId: '0103', id: '010303', name: '菌类' },
],
},
{
2025-05-20 13:05:37 +08:00
parentId: '01',
id: '0104',
2025-05-20 13:05:37 +08:00
name: '其他',
children: [{ parentId: '0104', id: '010401', name: '饲料' }],
},
],
},
{
id: '02',
2025-05-20 13:05:37 +08:00
name: '种子种苗',
children: [
{
2025-05-20 13:05:37 +08:00
parentId: '02',
id: '0101',
2025-05-20 13:05:37 +08:00
name: '花卉种子种苗',
children: [
2025-05-20 13:05:37 +08:00
{ parentId: '0101', id: '010101', name: '草本花卉' },
{ parentId: '0101', id: '010102', name: '木本花卉' },
{ parentId: '0101', id: '010103', name: '野生花卉' },
],
},
{
2025-05-20 13:05:37 +08:00
parentId: '02',
id: '0102',
2025-05-20 13:05:37 +08:00
name: '蔬菜种子种苗',
children: [
2025-05-20 13:05:37 +08:00
{ parentId: '0102', id: '010201', name: '叶菜类' },
{ parentId: '0102', id: '010202', name: '根茎类' },
{ parentId: '0102', id: '010203', name: '果实类' },
{ parentId: '0102', id: '010204', name: '豆类' },
{ parentId: '0102', id: '010205', name: '瓜类' },
],
},
{
2025-05-20 13:05:37 +08:00
parentId: '02',
id: '0103',
2025-05-20 13:05:37 +08:00
name: '果树种苗',
children: [
2025-05-20 13:05:37 +08:00
{ parentId: '0103', id: '010301', name: '柑橘类' },
{ parentId: '0103', id: '010302', name: '仁果类' },
{ parentId: '0103', id: '010303', name: '核果类' },
{ parentId: '0103', id: '010304', name: '浆果类' },
],
},
{
2025-05-20 13:05:37 +08:00
parentId: '02',
id: '0104',
2025-05-20 13:05:37 +08:00
name: '药材种子与种苗',
children: [
2025-05-20 13:05:37 +08:00
{ parentId: '0104', id: '010401', name: '寒地龙药' },
{ parentId: '0104', id: '010402', name: '常见中药材' },
],
},
{
2025-05-20 13:05:37 +08:00
parentId: '02',
id: '0105',
2025-05-20 13:05:37 +08:00
name: '其他作物',
children: [
2025-05-20 13:05:37 +08:00
{ parentId: '0105', id: '010501', name: '牧草' },
{ parentId: '0105', id: '010502', name: '经济作物' },
{ parentId: '0105', id: '010503', name: '观赏树木' },
],
},
],
},
]);
2025-04-02 17:32:13 +08:00
let popupQuote = ref(null);
const typeTree = ref([]);
const treeOption = ref({
children: 'areaChildVOS',
label: 'areaName',
});
const getTree = () => {
console.info('getTree');
getRegion().then((res) => {
if (res.code === 200) {
const { code, data } = res;
typeTree.value = data;
console.info('区域信息', typeTree.value);
}
});
};
const handleClick = () => {
popupQuote.value && popupQuote.value.doShow();
};
const dateList = reactive([
{ label: '近7天发布', value: 7 },
{ label: '近30天发布', value: 30 },
]);
let filter = ref({
region: '',
time: 7,
});
let tableData = reactive([
2025-04-03 17:20:49 +08:00
{ id: '01', title: '西红柿', region: '耿马镇', buyer: '盛源农业', buyNum: 5000, time: '2025-04-02 12:25:36' },
{ id: '02', title: '白菜', region: '孟定镇', buyer: '星悦农业', buyNum: 6000, time: '2025-04-01 12:25:36' },
{ id: '03', title: '西蓝花', region: '孟勇镇', buyer: '盛源农业', buyNum: 7000, time: '2025-04-02 13:25:36' },
{ id: '04', title: '鸡蛋', region: '勐简乡', buyer: '上好佳农业', buyNum: 8000, time: '2025-04-02 12:25:36' },
{ id: '05', title: '牛肉', region: '四排山乡', buyer: '尚嘉农业', buyNum: 5000, time: '2025-03-31 12:25:36' },
{ id: '06', title: '氮肥', region: '大兴乡', buyer: '信誉农资', buyNum: 6000, time: '2025-04-02 12:25:36' },
{ id: '07', title: '白菜种子', region: '贺派乡', buyer: '佳佳农业', buyNum: 5000, time: '2025-04-02 12:25:36' },
{ id: '08', title: '西红柿种子', region: '勐撒镇', buyer: '佳佳农业', buyNum: 8000, time: '2025-04-02 12:25:36' },
2025-04-02 17:32:13 +08:00
]);
2025-04-03 17:20:49 +08:00
const rowClick = (data) => {
2025-04-11 17:32:55 +08:00
router.push('/sub-operation-service/ecommerce-purchaserDetail?id=' + data.id);
2025-04-03 17:20:49 +08:00
};
2025-04-02 17:32:13 +08:00
onMounted(() => {
console.info('onMounted');
getTree();
});
</script>
<style lang="scss" scoped>
.purchaser-index-warp {
width: 100%;
.purchaser-top {
overflow: hidden;
2025-05-20 13:05:37 +08:00
margin-bottom: 16px;
padding: 10px;
2025-05-20 13:05:37 +08:00
width: 100%;
border-radius: 16px;
background: $color-fff;
.purchaser-top-title {
width: 100%;
font-size: 18px;
2025-05-20 13:05:37 +08:00
text-align: left;
}
.purchaser-charts {
width: 100%;
}
}
2025-04-02 17:32:13 +08:00
.hot-list-warp {
2025-05-20 13:05:37 +08:00
margin: 16px 0;
2025-04-02 17:32:13 +08:00
padding: 16px;
border-radius: 16px;
2025-05-20 13:05:37 +08:00
background: $color-fff;
2025-04-02 17:32:13 +08:00
::v-deep() {
thead {
overflow: hidden;
2025-05-20 13:05:37 +08:00
border-radius: 16px;
2025-04-02 17:32:13 +08:00
}
thead th {
padding: 16px 0;
2025-05-20 13:05:37 +08:00
border: none !important;
color: $color-999 !important;
background: $color-main-table-header;
2025-04-02 17:32:13 +08:00
}
thead th:first-child {
border-top-left-radius: 16px;
border-bottom-left-radius: 16px;
}
thead th:last-child {
border-top-right-radius: 16px;
border-bottom-right-radius: 16px;
}
table {
margin-top: 16px !important;
}
tbody td {
border: none !important;
}
.el-table__inner-wrapper::before {
display: none !important;
}
}
}
}
</style>