feat(settlement): 门店未出账手动提现与总部审核(OPT-010)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -314,6 +314,12 @@ enum StorePayoutStatus {
|
||||
PAID
|
||||
}
|
||||
|
||||
enum StoreWithdrawStatus {
|
||||
PENDING_REVIEW
|
||||
REJECTED
|
||||
PAID
|
||||
}
|
||||
|
||||
enum ThirdPartyProvider {
|
||||
WECHAT_PAY
|
||||
WECHAT_REFUND
|
||||
@@ -1064,6 +1070,8 @@ model Store {
|
||||
settlementRate Decimal @default(0.60) @map("settlement_rate") @db.Decimal(5, 4)
|
||||
/// Online test: only listed phones can see store on C-end when enabled
|
||||
visibilityWhitelistEnabled Boolean @default(false) @map("visibility_whitelist_enabled")
|
||||
/// FIN-001:允许未出账手动提现的白名单门店
|
||||
withdrawWhitelistEnabled Boolean @default(false) @map("withdraw_whitelist_enabled")
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
|
||||
|
||||
@@ -1077,6 +1085,7 @@ model Store {
|
||||
ratings StoreRating[]
|
||||
payouts StorePayout[]
|
||||
storeBills StoreBill[]
|
||||
withdrawRequests StoreWithdrawRequest[]
|
||||
visibilityPhones StoreVisibilityPhone[]
|
||||
|
||||
@@index([cityId, status])
|
||||
@@ -1121,6 +1130,7 @@ model StoreAccount {
|
||||
childAccounts StoreAccount[] @relation("StoreAccountHierarchy")
|
||||
bindings StoreAccountStore[]
|
||||
redeemPendingRecords RedeemPendingRecord[]
|
||||
withdrawRequests StoreWithdrawRequest[]
|
||||
|
||||
@@index([parentAccountId])
|
||||
@@map("store_account")
|
||||
@@ -1432,12 +1442,52 @@ model StorePayout {
|
||||
redeemRecord RedeemRecord @relation(fields: [redeemRecordId], references: [id], onDelete: Restrict)
|
||||
store Store @relation(fields: [storeId], references: [id], onDelete: Restrict)
|
||||
storeBill StoreBill? @relation(fields: [storeBillId], references: [id], onDelete: SetNull)
|
||||
withdrawItem StoreWithdrawPayoutItem?
|
||||
|
||||
@@index([storeId, status])
|
||||
@@index([storeBillId])
|
||||
@@map("store_payout")
|
||||
}
|
||||
|
||||
model StoreWithdrawRequest {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
withdrawNo String @unique @map("withdraw_no") @db.VarChar(32)
|
||||
storeId BigInt @map("store_id") @db.UnsignedBigInt
|
||||
storeAccountId BigInt @map("store_account_id") @db.UnsignedBigInt
|
||||
amount Decimal @db.Decimal(10, 2)
|
||||
payoutCount Int @default(0) @map("payout_count")
|
||||
status StoreWithdrawStatus @default(PENDING_REVIEW)
|
||||
rejectReason String? @map("reject_reason") @db.VarChar(512)
|
||||
appliedAt DateTime @default(now()) @map("applied_at") @db.DateTime(3)
|
||||
reviewedAt DateTime? @map("reviewed_at") @db.DateTime(3)
|
||||
reviewedByHqId BigInt? @map("reviewed_by_hq_id") @db.UnsignedBigInt
|
||||
paidAt DateTime? @map("paid_at") @db.DateTime(3)
|
||||
paymentRef String? @map("payment_ref") @db.VarChar(128)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
|
||||
|
||||
store Store @relation(fields: [storeId], references: [id], onDelete: Restrict)
|
||||
storeAccount StoreAccount @relation(fields: [storeAccountId], references: [id], onDelete: Restrict)
|
||||
items StoreWithdrawPayoutItem[]
|
||||
|
||||
@@index([storeId, status])
|
||||
@@index([status, appliedAt])
|
||||
@@map("store_withdraw_request")
|
||||
}
|
||||
|
||||
model StoreWithdrawPayoutItem {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
withdrawRequestId BigInt @map("withdraw_request_id") @db.UnsignedBigInt
|
||||
storePayoutId BigInt @unique @map("store_payout_id") @db.UnsignedBigInt
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||
|
||||
withdrawRequest StoreWithdrawRequest @relation(fields: [withdrawRequestId], references: [id], onDelete: Cascade)
|
||||
storePayout StorePayout @relation(fields: [storePayoutId], references: [id], onDelete: Restrict)
|
||||
|
||||
@@index([withdrawRequestId])
|
||||
@@map("store_withdraw_payout_item")
|
||||
}
|
||||
|
||||
model WineryBill {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
billNo String @unique @map("bill_no") @db.VarChar(32)
|
||||
|
||||
Reference in New Issue
Block a user