diff --git a/.gitignore b/.gitignore index ac37b1b..c3c7e1d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ Thumbs.db *.swo coverage/ .nyc_output/ +apps/server/uploads/ diff --git a/apps/miniapp/src/api/seller-auth.ts b/apps/miniapp/src/api/seller/auth.ts similarity index 96% rename from apps/miniapp/src/api/seller-auth.ts rename to apps/miniapp/src/api/seller/auth.ts index 8b7151e..58c96d1 100644 --- a/apps/miniapp/src/api/seller-auth.ts +++ b/apps/miniapp/src/api/seller/auth.ts @@ -1,4 +1,4 @@ -import { post, get, request } from '@/utils/request'; +import { post, request } from '@/utils/request'; export interface SellerRegisterParams { phone: string; @@ -51,4 +51,4 @@ export function sellerRefreshToken(refreshToken: string) { // 获取商家信息(需要商家token) export function getSellerProfile() { return request({ url: '/seller/auth/profile', method: 'GET', useSellerToken: true }); -} \ No newline at end of file +} diff --git a/apps/miniapp/src/api/merchant.ts b/apps/miniapp/src/api/seller/merchant.ts similarity index 51% rename from apps/miniapp/src/api/merchant.ts rename to apps/miniapp/src/api/seller/merchant.ts index 0b812eb..f8e8010 100644 --- a/apps/miniapp/src/api/merchant.ts +++ b/apps/miniapp/src/api/seller/merchant.ts @@ -1,4 +1,4 @@ -import { post, get, put, request } from '@/utils/request'; +import { request } from '@/utils/request'; export interface ApplyMerchantParams { shopName: string; @@ -27,35 +27,9 @@ export interface UpdateMerchantParams { legalPerson?: string; } -export interface MerchantInfo { - id: number; - sellerId: number; - shopName: string; - logo: string; - description: string; - phone: string; - province: string; - city: string; - district: string; - address: string; - longitude: number; - latitude: number; - businessLicense: string; - licenseNo: string; - legalPerson: string; - status: 'pending' | 'approved' | 'rejected' | 'frozen'; - rejectReason: string; - deposit: number; - rating: number; - reviewCount: number; - autoConfirm: boolean; - createdAt: string; - updatedAt: string; -} - // 申请创建店铺(需要商家token) export function applyMerchant(data: ApplyMerchantParams) { - return request({ + return request({ url: '/seller/merchant/apply', method: 'POST', data, @@ -65,7 +39,7 @@ export function applyMerchant(data: ApplyMerchantParams) { // 获取我的店铺信息(需要商家token) export function getMyMerchant() { - return request({ + return request({ url: '/seller/merchant/mine', method: 'GET', useSellerToken: true, @@ -74,25 +48,10 @@ export function getMyMerchant() { // 更新店铺信息(需要商家token) export function updateMerchant(data: UpdateMerchantParams) { - return request({ + return request({ url: '/seller/merchant/update', method: 'PUT', data, useSellerToken: true, }); } - -// 获取商家详情(公开) -export function getMerchantById(id: number) { - return get(`/merchants/${id}`); -} - -// 获取商家列表(公开,已审核通过) -export function getMerchantList(params: { - page?: number; - pageSize?: number; - keyword?: string; - city?: string; -}) { - return get('/merchants', params); -} diff --git a/apps/miniapp/src/api/seller-order.ts b/apps/miniapp/src/api/seller/order.ts similarity index 100% rename from apps/miniapp/src/api/seller-order.ts rename to apps/miniapp/src/api/seller/order.ts diff --git a/apps/miniapp/src/api/room-calendar.ts b/apps/miniapp/src/api/seller/room-calendar.ts similarity index 100% rename from apps/miniapp/src/api/room-calendar.ts rename to apps/miniapp/src/api/seller/room-calendar.ts diff --git a/apps/miniapp/src/api/room.ts b/apps/miniapp/src/api/seller/room.ts similarity index 54% rename from apps/miniapp/src/api/room.ts rename to apps/miniapp/src/api/seller/room.ts index 64ebc1a..c71a7b1 100644 --- a/apps/miniapp/src/api/room.ts +++ b/apps/miniapp/src/api/seller/room.ts @@ -1,31 +1,4 @@ -import { get, request } from '@/utils/request'; - -// 公开接口 -export function getRoomList(params: { - page?: number; - pageSize?: number; - keyword?: string; - type?: string; - minPrice?: number; - maxPrice?: number; - city?: string; - merchantId?: number; - sortBy?: string; - checkIn?: string; - checkOut?: string; - roomCount?: number; - adultCount?: number; -}) { - return get('/rooms', params); -} - -export function getRoomDetail(id: number) { - return get(`/rooms/${id}`); -} - -export function getRoomCalendar(id: number, startDate: string, endDate: string) { - return get(`/rooms/${id}/calendar`, { startDate, endDate }); -} +import { request } from '@/utils/request'; // 商家管理接口(需要 sellerToken) export function getMerchantRooms(params: any) { diff --git a/apps/miniapp/src/api/auth.ts b/apps/miniapp/src/api/user/auth.ts similarity index 78% rename from apps/miniapp/src/api/auth.ts rename to apps/miniapp/src/api/user/auth.ts index 45828fb..30efaae 100644 --- a/apps/miniapp/src/api/auth.ts +++ b/apps/miniapp/src/api/user/auth.ts @@ -1,4 +1,4 @@ -import { post, get, request } from '@/utils/request'; +import { post, get } from '@/utils/request'; export function sendCode(phone: string) { return post('/auth/send-code', { phone }); @@ -23,7 +23,3 @@ export function refreshToken(refreshToken: string) { export function getUserProfile() { return get('/user/profile'); } - -export function getMerchantInfo() { - return request({ url: '/merchant/mine', method: 'GET', useSellerToken: true }); -} diff --git a/apps/miniapp/src/api/invite.ts b/apps/miniapp/src/api/user/invite.ts similarity index 95% rename from apps/miniapp/src/api/invite.ts rename to apps/miniapp/src/api/user/invite.ts index 4683985..75a2a00 100644 --- a/apps/miniapp/src/api/invite.ts +++ b/apps/miniapp/src/api/user/invite.ts @@ -1,4 +1,4 @@ -import {request} from '@/utils/request'; +import { request } from '@/utils/request'; // 获取我的邀请统计 export const getInviteStats = () => diff --git a/apps/miniapp/src/api/user/merchant.ts b/apps/miniapp/src/api/user/merchant.ts new file mode 100644 index 0000000..99b5357 --- /dev/null +++ b/apps/miniapp/src/api/user/merchant.ts @@ -0,0 +1,42 @@ +import { get } from '@/utils/request'; + +export interface MerchantInfo { + id: number; + sellerId: number; + shopName: string; + logo: string; + description: string; + phone: string; + province: string; + city: string; + district: string; + address: string; + longitude: number; + latitude: number; + businessLicense: string; + licenseNo: string; + legalPerson: string; + status: 'pending' | 'approved' | 'rejected' | 'frozen'; + rejectReason: string; + deposit: number; + rating: number; + reviewCount: number; + autoConfirm: boolean; + createdAt: string; + updatedAt: string; +} + +// 获取商家详情(公开) +export function getMerchantById(id: number) { + return get(`/merchants/${id}`); +} + +// 获取商家列表(公开,已审核通过) +export function getMerchantList(params: { + page?: number; + pageSize?: number; + keyword?: string; + city?: string; +}) { + return get('/merchants', params); +} diff --git a/apps/miniapp/src/api/order.ts b/apps/miniapp/src/api/user/order.ts similarity index 100% rename from apps/miniapp/src/api/order.ts rename to apps/miniapp/src/api/user/order.ts diff --git a/apps/miniapp/src/api/review.ts b/apps/miniapp/src/api/user/review.ts similarity index 100% rename from apps/miniapp/src/api/review.ts rename to apps/miniapp/src/api/user/review.ts diff --git a/apps/miniapp/src/api/user/room.ts b/apps/miniapp/src/api/user/room.ts new file mode 100644 index 0000000..59a9041 --- /dev/null +++ b/apps/miniapp/src/api/user/room.ts @@ -0,0 +1,28 @@ +import { get } from '@/utils/request'; + +// 公开接口 +export function getRoomList(params: { + page?: number; + pageSize?: number; + keyword?: string; + type?: string; + minPrice?: number; + maxPrice?: number; + city?: string; + merchantId?: number; + sortBy?: string; + checkIn?: string; + checkOut?: string; + roomCount?: number; + adultCount?: number; +}) { + return get('/rooms', params); +} + +export function getRoomDetail(id: number) { + return get(`/rooms/${id}`); +} + +export function getRoomCalendar(id: number, startDate: string, endDate: string) { + return get(`/rooms/${id}/calendar`, { startDate, endDate }); +} diff --git a/apps/miniapp/src/components/RoomCalendarPicker.vue b/apps/miniapp/src/components/RoomCalendarPicker.vue index dd0e2ce..345777f 100644 --- a/apps/miniapp/src/components/RoomCalendarPicker.vue +++ b/apps/miniapp/src/components/RoomCalendarPicker.vue @@ -58,7 +58,7 @@