From 494b2c068a812c058e56ea5674e54097c0ebf3df Mon Sep 17 00:00:00 2001 From: yml Date: Mon, 8 Jun 2026 20:00:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AF=E9=80=9A=E5=95=86=E5=93=81=E7=BC=96?= =?UTF-8?q?=E5=8F=B7=E5=85=A8=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/modules/dispute/dto.go | 1 + .../internal/modules/dispute/repository.go | 9 +- backend/internal/modules/order/dto.go | 1 + backend/internal/modules/order/repository.go | 14 ++- .../admin/views/AdminDisputesView.vue | 10 ++- .../admin/views/AdminListingDetailView.vue | 16 +++- .../admin/views/AdminListingReviewView.vue | 23 ++++- .../admin/views/AdminOrderDetailView.vue | 12 ++- .../features/admin/views/AdminOrdersView.vue | 6 ++ .../src/features/disputes/api/disputes.ts | 1 + .../listings/views/ListingDetailView.vue | 27 ++++++ .../features/listings/views/ListingsView.vue | 85 +------------------ .../views/MobileListingDetailView.vue | 25 ++++++ frontend/src/features/orders/api/orders.ts | 1 + .../orders/views/MobileOrderDetailView.vue | 30 ++++++- .../orders/views/MobileOrdersView.vue | 28 ++++++ .../features/orders/views/OrderDetailView.vue | 21 ++++- .../src/features/orders/views/OrdersView.vue | 49 ++++++++++- .../seller/views/SellerHandoffsView.vue | 6 ++ .../seller/views/SellerListingsView.vue | 42 ++++++++- frontend/src/shared/utils/listingDisplay.ts | 11 ++- frontend/src/utils/listingDisplay.ts | 11 ++- 22 files changed, 322 insertions(+), 107 deletions(-) diff --git a/backend/internal/modules/dispute/dto.go b/backend/internal/modules/dispute/dto.go index 4dd9a02..0f4ab8a 100644 --- a/backend/internal/modules/dispute/dto.go +++ b/backend/internal/modules/dispute/dto.go @@ -12,6 +12,7 @@ type DisputeDTO struct { ID uint64 `json:"id"` OrderID uint64 `json:"order_id"` OrderNo string `json:"order_no"` + ListingNo string `json:"listing_no"` Title string `json:"title"` InitiatorID uint64 `json:"initiator_id"` TargetUserID uint64 `json:"target_user_id"` diff --git a/backend/internal/modules/dispute/repository.go b/backend/internal/modules/dispute/repository.go index 10f10bd..5c14900 100644 --- a/backend/internal/modules/dispute/repository.go +++ b/backend/internal/modules/dispute/repository.go @@ -403,15 +403,17 @@ func roundMoney(value float64) float64 { func (r *Repository) baseQuery() *gorm.DB { return r.db.Table("disputes AS d"). - Select("d.*, o.order_no, a.title"). + Select("d.*, o.order_no, l.listing_no, a.title"). Joins("JOIN rental_orders AS o ON o.id = d.order_id"). + Joins("JOIN rental_listings AS l ON l.id = o.listing_id"). Joins("JOIN game_accounts AS a ON a.id = o.account_id") } type disputeRow struct { model.Dispute - OrderNo string - Title string + OrderNo string + ListingNo string + Title string } func (row disputeRow) toDTO() DisputeDTO { @@ -419,6 +421,7 @@ func (row disputeRow) toDTO() DisputeDTO { ID: row.ID, OrderID: row.OrderID, OrderNo: row.OrderNo, + ListingNo: row.ListingNo, Title: row.Title, InitiatorID: row.InitiatorID, TargetUserID: row.TargetUserID, diff --git a/backend/internal/modules/order/dto.go b/backend/internal/modules/order/dto.go index b6ed123..da3f8e8 100644 --- a/backend/internal/modules/order/dto.go +++ b/backend/internal/modules/order/dto.go @@ -12,6 +12,7 @@ type OrderDTO struct { ID uint64 `json:"id"` OrderNo string `json:"order_no"` ListingID uint64 `json:"listing_id"` + ListingNo string `json:"listing_no"` AccountID uint64 `json:"account_id"` OwnerID uint64 `json:"owner_id"` RenterID uint64 `json:"renter_id"` diff --git a/backend/internal/modules/order/repository.go b/backend/internal/modules/order/repository.go index 9ab10b0..fcc0182 100644 --- a/backend/internal/modules/order/repository.go +++ b/backend/internal/modules/order/repository.go @@ -163,7 +163,7 @@ func (r *Repository) Create(renterID uint64, req CreateRequest) (*OrderDTO, erro if err := tx.Clauses(clause.Locking{Strength: "UPDATE"}).First(&account, listing.AccountID).Error; err != nil { return err } - snapshot, err := makeAccountSnapshot(account) + snapshot, err := makeAccountSnapshot(account, listing) if err != nil { return err } @@ -1374,13 +1374,15 @@ func (r *Repository) findCheckout(id uint64) (*model.OrderCheckout, error) { func (r *Repository) baseQuery() *gorm.DB { return r.db.Table("rental_orders AS o"). - Select("o.*, a.title, a.server_region, a.login_platform"). + Select("o.*, l.listing_no, a.title, a.server_region, a.login_platform"). + Joins("JOIN rental_listings AS l ON l.id = o.listing_id"). Joins("JOIN game_accounts AS a ON a.id = o.account_id") } func (r *Repository) adminQuery() *gorm.DB { return r.db.Table("rental_orders AS o"). - Select("o.*, a.title, a.server_region, a.login_platform, owner.phone AS owner_phone, renter.phone AS renter_phone"). + Select("o.*, l.listing_no, a.title, a.server_region, a.login_platform, owner.phone AS owner_phone, renter.phone AS renter_phone"). + Joins("JOIN rental_listings AS l ON l.id = o.listing_id"). Joins("JOIN game_accounts AS a ON a.id = o.account_id"). Joins("JOIN users AS owner ON owner.id = o.owner_id"). Joins("JOIN users AS renter ON renter.id = o.renter_id") @@ -1389,6 +1391,7 @@ func (r *Repository) adminQuery() *gorm.DB { type orderRow struct { model.RentalOrder Title string + ListingNo string ServerRegion string LoginPlatform string OwnerPhone string @@ -1405,6 +1408,7 @@ func (row orderRow) toAdminDTO() OrderDTO { ID: row.ID, OrderNo: row.OrderNo, ListingID: row.ListingID, + ListingNo: row.ListingNo, AccountID: row.AccountID, OwnerID: row.OwnerID, RenterID: row.RenterID, @@ -1607,8 +1611,10 @@ func sanitizeOrderSnapshot(snapshot *datatypes.JSON, role string) { *snapshot = datatypes.JSON(raw) } -func makeAccountSnapshot(account model.GameAccount) (datatypes.JSON, error) { +func makeAccountSnapshot(account model.GameAccount, listing model.RentalListing) (datatypes.JSON, error) { payload := map[string]any{ + "listing_id": listing.ID, + "listing_no": listing.ListingNo, "account_id": account.ID, "title": account.Title, "game_name": account.GameName, diff --git a/frontend/src/features/admin/views/AdminDisputesView.vue b/frontend/src/features/admin/views/AdminDisputesView.vue index 9e805ea..2aadde7 100644 --- a/frontend/src/features/admin/views/AdminDisputesView.vue +++ b/frontend/src/features/admin/views/AdminDisputesView.vue @@ -6,6 +6,7 @@ import { arbitrateDispute, fetchAdminDisputes, type Dispute } from '@/features/d import { fetchAdminFileBlob } from '@/shared/api/files' import { disputeStatusLabel } from '@/utils/statusLabels' import { formatDateTime } from '@/utils/time' +import { formatListingNo } from '@/utils/listingDisplay' import AdminTablePagination from '../components/AdminTablePagination.vue' const loading = ref(false) @@ -114,6 +115,9 @@ function readError(error: unknown, fallback: string) { + + + @@ -164,7 +168,8 @@ function readError(error: unknown, fallback: string) { >

- {{ activeDispute.order_no }} · {{ activeDispute.title }} + {{ activeDispute.order_no }} · 商品编号 + {{ formatListingNo(activeDispute.listing_no) }} · {{ activeDispute.title }}

{{ activeDispute.description }}

@@ -215,7 +220,8 @@ function readError(error: unknown, fallback: string) { >

- {{ evidenceDispute.order_no }} · {{ evidenceDispute.title }} + {{ evidenceDispute.order_no }} · 商品编号 + {{ formatListingNo(evidenceDispute.listing_no) }} · {{ evidenceDispute.title }}

{{ item }} diff --git a/frontend/src/features/admin/views/AdminListingDetailView.vue b/frontend/src/features/admin/views/AdminListingDetailView.vue index a5bef3e..d5e0123 100644 --- a/frontend/src/features/admin/views/AdminListingDetailView.vue +++ b/frontend/src/features/admin/views/AdminListingDetailView.vue @@ -1,4 +1,5 @@