diff --git a/README.md b/README.md index 68afba2..902c725 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# 解班客 - 宠物认领平台 +# 结伴客 - 宠物认领平台 一个基于Vue.js和Node.js的宠物认领平台,帮助流浪动物找到温暖的家。 ## 项目概述 -解班客是一个专业的宠物认领平台,致力于为流浪动物提供一个温暖的归宿。平台通过现代化的Web技术,为用户提供便捷的宠物发布、搜索、认领服务,同时为管理员提供完善的后台管理功能。 +结伴客是一个专业的宠物认领平台,致力于为流浪动物提供一个温暖的归宿。平台通过现代化的Web技术,为用户提供便捷的宠物发布、搜索、认领服务,同时为管理员提供完善的后台管理功能。 ### 核心功能 diff --git a/admin-system/src/api/flower.ts b/admin-system/src/api/flower.ts new file mode 100644 index 0000000..43300a4 --- /dev/null +++ b/admin-system/src/api/flower.ts @@ -0,0 +1,115 @@ +import { request } from '.' + +// 定义花卉相关类型 +export interface Flower { + id: number + name: string + type: string + variety: string + price: number + stock: number + image: string + description: string + merchantId: number + merchantName: string + status: string + createdAt: string + updatedAt: string +} + +export interface FlowerQueryParams { + page?: number + limit?: number + keyword?: string + type?: string + status?: string + merchantId?: number + startDate?: string + endDate?: string +} + +export interface FlowerCreateData { + name: string + type: string + variety: string + price: number + stock: number + image: string + description: string + merchantId: number + status?: string +} + +export interface FlowerUpdateData { + name?: string + type?: string + variety?: string + price?: number + stock?: number + image?: string + description?: string + merchantId?: number + status?: string +} + +export interface FlowerSale { + id: number + flowerId: number + flowerName: string + buyerId: number + buyerName: string + quantity: number + price: number + totalAmount: number + status: string + saleTime: string + createdAt: string +} + +export interface Merchant { + id: number + name: string + contact: string + phone: string + address: string + status: string + createdAt: string +} + +// 获取花卉列表 +export const getFlowers = (params?: FlowerQueryParams) => + request.get<{ success: boolean; code: number; message: string; data: { flowers: Flower[]; pagination: any } }>('/flowers', { params }) + +// 获取花卉详情 +export const getFlower = (id: number) => + request.get<{ success: boolean; code: number; message: string; data: { flower: Flower } }>(`/flowers/${id}`) + +// 创建花卉 +export const createFlower = (data: FlowerCreateData) => + request.post<{ success: boolean; code: number; message: string; data: { flower: Flower } }>('/flowers', data) + +// 更新花卉 +export const updateFlower = (id: number, data: FlowerUpdateData) => + request.put<{ success: boolean; code: number; message: string; data: { flower: Flower } }>(`/flowers/${id}`, data) + +// 删除花卉 +export const deleteFlower = (id: number) => + request.delete<{ success: boolean; code: number; message: string }>(`/flowers/${id}`) + +// 获取花卉销售记录 +export const getFlowerSales = (params?: any) => + request.get<{ success: boolean; code: number; message: string; data: { sales: FlowerSale[]; pagination: any } }>('/flower-sales', { params }) + +// 获取商家列表 +export const getMerchants = (params?: any) => + request.get<{ success: boolean; code: number; message: string; data: { merchants: Merchant[] } }>('/merchants', { params }) + +export default { + getFlowers, + getFlower, + createFlower, + updateFlower, + deleteFlower, + getFlowerSales, + getMerchants +} \ No newline at end of file diff --git a/admin-system/src/layouts/MainLayout.vue b/admin-system/src/layouts/MainLayout.vue index a0052b7..fb22f51 100644 --- a/admin-system/src/layouts/MainLayout.vue +++ b/admin-system/src/layouts/MainLayout.vue @@ -60,6 +60,14 @@ + + + 花卉管理 + + +