12.22晚
This commit is contained in:
parent
0d3dd7e43f
commit
2b68401d29
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
|
@ -3,12 +3,13 @@ import request from '@/utils/request'
|
|||
// 查询评论信息列表
|
||||
export function listComment(query) {
|
||||
return request({
|
||||
url: '/system/comment/list',
|
||||
url: '/system/comment/list2',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 查询评论信息详细
|
||||
export function getComment(id) {
|
||||
return request({
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询收藏信息列表
|
||||
export function listFavorite(query) {
|
||||
return request({
|
||||
url: '/system/favorite/list2',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询收藏信息详细
|
||||
export function getFavorite(id) {
|
||||
return request({
|
||||
url: '/system/favorite/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增收藏信息
|
||||
export function addFavorite(data) {
|
||||
return request({
|
||||
url: '/system/favorite',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改收藏信息
|
||||
export function updateFavorite(data) {
|
||||
return request({
|
||||
url: '/system/favorite',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除收藏信息
|
||||
export function delFavorite(id) {
|
||||
return request({
|
||||
url: '/system/favorite/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||
// 查询订单信息列表
|
||||
export function listOrder(query) {
|
||||
return request({
|
||||
url: '/system/order/list',
|
||||
url: '/system/order/list2',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
|
|
@ -1,40 +1,54 @@
|
|||
<template>
|
||||
<div class="app-container home">
|
||||
<h2>校园二手交易后台管理框架</h2>
|
||||
<!-- 整体页面布局容器 -->
|
||||
<div class="main-content">
|
||||
<!-- 数据统计区域 -->
|
||||
<div class="stats-container">
|
||||
<div class="stat-box">
|
||||
<div class="stat-box quantity-box" style="margin-right: 20px;" @click="goToShangpinIndex">
|
||||
<span>商品数量</span>
|
||||
<p>50</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<span>商品销量</span>
|
||||
<div class="stat-box sales-box" style="margin-right: 20px;">
|
||||
<span>评价数量</span>
|
||||
<p>120</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<div class="stat-box order-box">
|
||||
<span>订单数量</span>
|
||||
<p>30</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 商品公告栏 -->
|
||||
<div class="notice-board">
|
||||
<h3>商品公告</h3>
|
||||
<ul>
|
||||
<li>近期将对二手电子产品进行质量审核。</li>
|
||||
<li>新上架一批优质二手教材。</li>
|
||||
<li>校园内交易地点调整,请留意。</li>
|
||||
</ul>
|
||||
<h3 class="notice-title">商品公告</h3>
|
||||
<div class="notice-content">
|
||||
<div class="notice-item" v-for="(notice, index) in notices" :key="index" v-show="currentNoticeIndex === index">
|
||||
<p>{{ notice }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 日期时间显示区域(右上角) -->
|
||||
<div class="datetime-display" :class="timeColorClass" style="position: absolute; right: 20px; top: 20px;">
|
||||
<p class="datetime-text">{{ currentDateTime }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 商品栏 -->
|
||||
<div class="product-board">
|
||||
<h3 class="product-title">商品信息</h3>
|
||||
<div class="product-list">
|
||||
<div class="product-item" v-for="(product, index) in products" :key="index">
|
||||
<img :src="product.image" alt="Product Image" class="product-image">
|
||||
<div class="product-details">
|
||||
<h4 class="product-name">{{ product.name }}</h4>
|
||||
<p class="product-price">价格: {{ product.price }}元</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
@ -44,6 +58,42 @@ const currentDateTime = ref('');
|
|||
// 根据时间判断对应的颜色类名
|
||||
const timeColorClass = ref('');
|
||||
|
||||
// 商品数据
|
||||
const products = ref([
|
||||
{ name: '二手笔记本电脑', price: 500, image: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.d4V1ZPj4wpf_WblLOVUv5gHaJ4?w=156&h=180&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
{ name: '二手手机', price: 300, image: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.6yDvn_IN5ZPE9Zp422cNywHaHa?w=191&h=191&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
{ name: '二手自行车', price: 150, image: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.Jt1C6IDvDyx0wJAb3z2nrQHaFj?w=209&h=180&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
{ name: '二手教材', price: 20, image: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.60iJRy1kFWQCCaCSgfhCywHaFj?w=234&h=180&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
{ name: '二手文具', price: 10, image: 'https://tse1-mm.cn.bing.net/th/id/OIP-C.Rx5Cda_OtnGlKJrmweOH3wHaFn?w=257&h=195&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
{ name: '二手相机', price: 800, image: 'https://ts1.cn.mm.bing.net/th?id=OIP-C.ZYPyZ8bVYNhNRRXJyH8riAHaHe&w=173&h=185&c=8&rs=1&qlt=90&o=6&dpr=1.4&pid=3.1&rm=2' },
|
||||
{ name: '二手游戏机', price: 600, image: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.FsXIBRY7CJtSmvVgypjhkQAAAA?w=178&h=179&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
{ name: '二手耳机', price: 150, image: 'https://tse1-mm.cn.bing.net/th/id/OIP-C.2yjkWqOxK6HJh3sh07MClgHaHa?w=188&h=189&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
{ name: '二手书籍', price: 30, image: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.AwEY_C44lxChhRGn0HECZgHaFd?w=287&h=211&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
{ name: '二手笔', price: 5, image: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.dFUljtINEPjJ3xFZf_gfWwHaFj?w=269&h=202&c=7&r=0&o=5&dpr=1.4&pid=1.7' },
|
||||
]);
|
||||
|
||||
// 公告数据
|
||||
const notices = ref([
|
||||
'1.近期我们将对二手电子产品进行质量审核,不合格的将不允许上架!!!',
|
||||
'2.新上架一批优质二手教材,有需要的同学可以去商城选购!!!',
|
||||
'3.校园内商品交易地点调整,请各位同学留意!!',
|
||||
'4.二手自行车已完成清洁保养,欢迎广大同学们选购!',
|
||||
'5.本周六将举办二手物品交换活动,地点在操场!',
|
||||
'6.部分二手文具价格有所下调,大家快来选购吧!!',
|
||||
]);
|
||||
|
||||
// 当前显示的公告索引
|
||||
const currentNoticeIndex = ref(0);
|
||||
|
||||
// 当前显示的公告内容
|
||||
const currentNotices = ref([]);
|
||||
|
||||
// 更新当前显示的公告内容
|
||||
const updateCurrentNotices = () => {
|
||||
const startIndex = currentNoticeIndex.value;
|
||||
currentNotices.value = notices.value.slice(startIndex, startIndex + 3).map((notice, i) => notices.value[(startIndex + i) % notices.value.length]);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 初始化时设置当前日期时间和颜色类名
|
||||
updateDateTimeAndColor();
|
||||
|
@ -51,6 +101,15 @@ onMounted(() => {
|
|||
setInterval(() => {
|
||||
updateDateTimeAndColor();
|
||||
}, 1000);
|
||||
|
||||
// 初始化当前显示的公告内容
|
||||
updateCurrentNotices();
|
||||
|
||||
// 每5秒切换一次公告
|
||||
setInterval(() => {
|
||||
currentNoticeIndex.value = (currentNoticeIndex.value + 1) % notices.value.length;
|
||||
updateCurrentNotices();
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
const updateDateTimeAndColor = () => {
|
||||
|
@ -65,40 +124,133 @@ const updateDateTimeAndColor = () => {
|
|||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
background-color: #f4f4f4;
|
||||
display: flex;
|
||||
height: 100vh; /* 设置整个容器的高度为100%视口高度 */
|
||||
}
|
||||
|
||||
.main-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 66.6666%; /* 设置宽度为页面宽度的三分之二 */
|
||||
flex-grow: 1; /* 让 main-content 占满剩余的高度 */
|
||||
margin-right: 20px; /* 添加右侧间距 */
|
||||
// 检查是否存在影响公告栏高度的属性,比如高度被固定
|
||||
height: auto; // 假如存在这样固定高度的设置,可能限制公告栏伸展,可根据需求调整或删除此属性
|
||||
}
|
||||
|
||||
.stats-container {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
justify-content: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.stat-box {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
padding: 20px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
border-radius: 10px;
|
||||
flex: 1;
|
||||
height: 300px; /* 增加每个统计框的高度 */
|
||||
width: 150px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
&:hover {
|
||||
box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
opacity: 0;
|
||||
animation: fadeIn 0.5s ease forwards;
|
||||
animation-delay: 0.2s;
|
||||
|
||||
span {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.quantity-box {
|
||||
background-color: #66ccff;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.sales-box {
|
||||
background-color: #99ff99;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.order-box {
|
||||
background-color: #ff9999;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-board {
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
border: 2px solid #ccc;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
||||
padding: 10px;
|
||||
background-color: #e6f7ff;
|
||||
max-height: none;// 根据实际需求保留或调整此值
|
||||
// overflow-y: auto;
|
||||
}
|
||||
|
||||
.notice-board h3 {
|
||||
.product-board {
|
||||
width: 33.3333%; /* 设置宽度为页面宽度的三分之一 */
|
||||
border: 2px solid #ccc;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
||||
padding: 10px;
|
||||
background-color: #f8f8f8; /* 更换背景色,可选择更合适的颜色 */
|
||||
flex-grow: 1; /* 让 product-board 占满剩余的高度 */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: calc(100vh - 100px); /* 设置最大高度为视口高度减去一些顶部空间 */
|
||||
overflow-y: auto; /* 添加垂直滚动条 */
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
margin-top: 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding-bottom: 5px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
font-size: 25px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.notice-content {
|
||||
max-height: 100%; /* 设置最大高度为100% */
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.notice-item {
|
||||
margin-bottom: 5px;
|
||||
p {
|
||||
font-size: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.datetime-display {
|
||||
|
@ -121,4 +273,57 @@ const updateDateTimeAndColor = () => {
|
|||
margin: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
|
||||
.product-title {
|
||||
margin-top: 0;
|
||||
font-size: 25px; /* 增加字体大小 */
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.product-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
flex-grow: 1; /* 让 product-list 占满剩余的高度 */
|
||||
overflow-y: auto; /* 添加垂直滚动条 */
|
||||
}
|
||||
|
||||
.product-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.product-image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
object-fit: cover;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.product-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="评论时间" prop="time">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.time"
|
||||
|
@ -76,9 +77,25 @@
|
|||
<el-table v-loading="loading" :data="commentList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="用户id" align="center" prop="personid" />
|
||||
<el-table-column label="商品id" align="center" prop="commodityid" />
|
||||
<el-table-column label="用户名字" align="center" prop="personname" />
|
||||
|
||||
<el-table-column label="用户头像" align="center" prop="personpicture" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.personpicture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="商品名字" align="center" prop="commodityname" />
|
||||
|
||||
<el-table-column label="商品图片" align="center" prop="commoditypicture" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.commoditypicture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="评论内容" align="center" prop="content" />
|
||||
|
||||
<el-table-column label="评论时间" align="center" prop="time" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.time, '{y}-{m}-{d}') }}</span>
|
||||
|
@ -89,7 +106,7 @@
|
|||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:comment:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:comment:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
|
@ -112,6 +129,7 @@
|
|||
<el-form-item label="评论内容">
|
||||
<editor v-model="form.content" :min-height="192"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="评论时间" prop="time">
|
||||
<el-date-picker clearable
|
||||
v-model="form.time"
|
||||
|
@ -146,6 +164,7 @@ const multiple = ref(true);
|
|||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
|
@ -154,7 +173,11 @@ const data = reactive({
|
|||
personid: null,
|
||||
commodityid: null,
|
||||
content: null,
|
||||
time: null
|
||||
time: null,
|
||||
personname:null,
|
||||
personpicture:null,
|
||||
commodityname:null,
|
||||
commoditypicture:null
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
|
@ -172,6 +195,7 @@ function getList() {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
|
|
|
@ -121,7 +121,15 @@
|
|||
<el-table-column label="价格" align="center" prop="price" />
|
||||
<el-table-column label="分类" align="center" prop="classification" />
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="图片" align="center" prop="picture" />
|
||||
|
||||
<el-table-column label="商品图片" align="center" prop="picture" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.picture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
|
||||
<el-table-column label="状态" align="center" prop="state" />
|
||||
<el-table-column label="上架时间" align="center" prop="time" width="180">
|
||||
<template #default="scope">
|
||||
|
|
|
@ -0,0 +1,264 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="用户id" prop="personid">
|
||||
<el-input
|
||||
v-model="queryParams.personid"
|
||||
placeholder="请输入用户id"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品id" prop="commodityid">
|
||||
<el-input
|
||||
v-model="queryParams.commodityid"
|
||||
placeholder="请输入商品id"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:favorite:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:favorite:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:favorite:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:favorite:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="favoriteList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="用户昵称" align="center" prop="personname" />
|
||||
<el-table-column label="用户头像" align="center" prop="personpicture" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.personpicture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" align="center" prop="commodityname" />
|
||||
<el-table-column label="商品图片" align="center" prop="commoditypicture" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.commoditypicture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品价格" align="center" prop="price" />
|
||||
<el-table-column label="商品类型" align="center" prop="classification" />
|
||||
<el-table-column label="商品描述" align="center" prop="description" />
|
||||
<el-table-column label="商品状态" align="center" prop="state" />
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:favorite:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:favorite:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改收藏信息对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="favoriteRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="用户id" prop="personid">
|
||||
<el-input v-model="form.personid" placeholder="请输入用户id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品id" prop="commodityid">
|
||||
<el-input v-model="form.commodityid" placeholder="请输入商品id" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Favorite">
|
||||
import { listFavorite, getFavorite, delFavorite, addFavorite, updateFavorite } from "@/api/system/favorite";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const favoriteList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
personid: null,
|
||||
commodityid: null,
|
||||
personname:null,
|
||||
personpicture:null,
|
||||
commodityname:null,
|
||||
commoditypicture:null,
|
||||
price:null,
|
||||
classification:null,
|
||||
description:null,
|
||||
state:null,
|
||||
time:null
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询收藏信息列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listFavorite(queryParams.value).then(response => {
|
||||
favoriteList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
personid: null,
|
||||
commodityid: null
|
||||
};
|
||||
proxy.resetForm("favoriteRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加收藏信息";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _id = row.id || ids.value
|
||||
getFavorite(_id).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改收藏信息";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["favoriteRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateFavorite(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addFavorite(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除收藏信息编号为"' + _ids + '"的数据项?').then(function() {
|
||||
return delFavorite(_ids);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('system/favorite/export', {
|
||||
...queryParams.value
|
||||
}, `favorite_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
|
@ -76,14 +76,30 @@
|
|||
<el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="商品id" align="center" prop="commodityid" />
|
||||
<el-table-column label="买家id" align="center" prop="buyerid" />
|
||||
<el-table-column label="用户名" align="center" prop="buyername" />
|
||||
<!-- <el-table-column label="用户头像" align="center" prop="buyerpicture" /> -->
|
||||
<el-table-column label="用户头像图片" align="center" prop="buyerpicture" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.buyerpicture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名" align="center" prop="commodityname" />
|
||||
|
||||
<el-table-column label="商品图片" align="center" prop="commoditypicture" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.commoditypicture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="商品价格" align="center" prop="price" />
|
||||
|
||||
<el-table-column label="购买时间" align="center" prop="time" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.time, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:order:edit']">修改</el-button>
|
||||
|
@ -151,7 +167,13 @@ const data = reactive({
|
|||
commodityid: null,
|
||||
buyerid: null,
|
||||
time: null,
|
||||
status: null
|
||||
status: null,
|
||||
commodityname: null,
|
||||
commoditypicture:null,
|
||||
price:null,
|
||||
buyername:null,
|
||||
buyerpicture:null,
|
||||
status:null
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="张三" prop="name">
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入张三"
|
||||
placeholder="请输入姓名"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
|
@ -116,8 +116,12 @@
|
|||
<el-table v-loading="loading" :data="personList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="张三" align="center" prop="name" />
|
||||
<el-table-column label="图片" align="center" prop="picture" />
|
||||
<el-table-column label="姓名" align="center" prop="name" />
|
||||
<el-table-column label="用户头像" align="center" prop="picture" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.picture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="性别" align="center" prop="gender" />
|
||||
<el-table-column label="年龄" align="center" prop="age" />
|
||||
<el-table-column label="手机号" align="center" prop="phone" />
|
||||
|
@ -143,8 +147,8 @@
|
|||
<!-- 添加或修改用户信息对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="personRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="张三" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入张三" />
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" prop="picture">
|
||||
<el-input v-model="form.picture" placeholder="请输入图片" />
|
||||
|
|
Loading…
Reference in New Issue