From d0ec21ce1662181d29c022538bd66859e7eed61f Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 16:21:51 +0800 Subject: [PATCH 01/17] =?UTF-8?q?feat(dev-mock):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=96=97=E9=B1=BC=E5=B1=A5=E7=BA=A6=20Mock=20=E4=B8=8E?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E6=8E=A7=E5=88=B6=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加斗鱼客户履约 Mock 订单与角色绑定联调能力 - 重构开发 Mock 控制台为可切换分页界面 - 补充斗鱼履约 Mock 集成测试 --- apps/backend/src/routes/admin/dev-mock.ts | 22 + .../src/services/dev-mock/dev-mock-service.ts | 461 ++++++--- .../semi-auto-task.integration.test.ts | 90 ++ .../src/pages/admin/AdminDevMockPage.tsx | 883 ++++++++++++------ apps/frontend/src/services/admin/dev-mock.ts | 18 + apps/frontend/src/styles/base.css | 12 + 6 files changed, 1076 insertions(+), 410 deletions(-) diff --git a/apps/backend/src/routes/admin/dev-mock.ts b/apps/backend/src/routes/admin/dev-mock.ts index 444e9c83..2910d9c7 100644 --- a/apps/backend/src/routes/admin/dev-mock.ts +++ b/apps/backend/src/routes/admin/dev-mock.ts @@ -3,6 +3,7 @@ import { Router } from 'express' import { buildOpen91QueryMock, createAffiliateDashMockClaim, + createDouyuFulfillmentMock, createKuaishouIndustryVoucherMockData, createSemiAutoIntegrationMock, createSemiAutoMock, @@ -77,6 +78,27 @@ router.post( }), ) +router.post( + '/dev-mock/douyu-fulfillment', + createJsonHandler((req) => createDouyuFulfillmentMock(req.body || {}), { + successMessage: '斗鱼直播账号履约测试单已生成', + errorMessage: '生成斗鱼直播账号履约测试单失败', + scope: '[admin/dev-mock/douyu-fulfillment]', + audit: (_req, data) => ({ + action: 'dev_mock_create_douyu_fulfillment', + targetType: 'dev_mock', + targetId: String((data as { orderNo?: string })?.orderNo || ''), + data: { + platform: 'douyu', + pipeline: 'order_service', + orderNo: (data as { orderNo?: string })?.orderNo, + orderItemId: (data as { orderItemId?: number })?.orderItemId, + skuKey: (data as { skuKey?: string })?.skuKey, + }, + }), + }), +) + router.post( '/dev-mock/semi-auto', createJsonHandler((req) => createSemiAutoMock(req.body || {}), { diff --git a/apps/backend/src/services/dev-mock/dev-mock-service.ts b/apps/backend/src/services/dev-mock/dev-mock-service.ts index ca4abe0c..ca8270eb 100644 --- a/apps/backend/src/services/dev-mock/dev-mock-service.ts +++ b/apps/backend/src/services/dev-mock/dev-mock-service.ts @@ -93,6 +93,20 @@ export type DevSemiAutoIntegrationResult = DevMockSemiAutoResult & { mappingId: number } +export type DevDouyuFulfillmentMockResult = { + platform: 'douyu' + pipeline: 'order_service' + orderId: number + orderNo: string + orderItemId: number + fulfillmentId: number + configId: number + mappingId: number + skuKey: string + adminPath: string + tips: string[] +} + export function getDevMockStatus() { const enabled = isDevMockEnabled() return { @@ -113,6 +127,12 @@ export function getDevMockStatus() { '创建人工渠道半自动测试单;可选择仅 Mock 订单,登录、绑定和票据注入走真实 Connector', steps: ['create_order', 'login', 'binding', 'browser_ticket', 'complete'], }, + { + key: 'douyu_fulfillment', + name: '斗鱼直播账号履约', + description: '创建正式人工渠道测试单,供 live-hub 直播账号履约工作台读取', + steps: ['create_order', 'sync_livehub', 'map_commodity'], + }, ] : [], defaultUid: '10001', @@ -531,86 +551,59 @@ export async function createSemiAutoMock( } } -/** - * 真实履约链路集成测试单。 - * - * 订单必须通过正式 upsertOrderFromSource 入库,再走 SKU 映射、渠道判定和 - * Carrier 补偿;不直接写 order/order_item/fulfillment。 - */ -export async function createSemiAutoIntegrationMock( - input: { - platform?: unknown - orderNo?: unknown - skuName?: unknown - quantity?: unknown - pageTitle?: unknown - browserTargetUrl?: unknown - connectorMode?: unknown - } = {}, -): Promise { - assertDevMockEnabled() - - const platform = normalizeMockSemiAutoPlatform(input.platform) - const suffix = `${Date.now()}_${Math.floor(Math.random() * 1_000_000)}` - const orderNo = String( - input.orderNo || `${platform === 'weibo' ? 'INTWB' : 'INTSA'}${suffix}`, - ).trim() - const skuKey = normalizeMockSemiAutoSku( - input.skuName || `${platform === 'weibo' ? '微博' : '虎牙'}真实链路测试-${suffix}`, - platform, - ) - const quantity = normalizeMockSemiAutoQuantity(input.quantity) - const connectorMode = - platform === 'weibo' ? 'embedded' : normalizeMockSemiAutoConnectorMode(input.connectorMode) - const provider = 'dev_integration' - const sourcePlatform = 'internal_test' - const shopId = 'dev-integration-shop' - const externalSkuCode = `INTEGRATION-${suffix}` - const pageTitle = String( - input.pageTitle || (platform === 'weibo' ? '微博账号登录授权' : '虎牙账号登录授权'), - ) - .trim() - .slice(0, 60) - const browserTargetUrl = String( - input.browserTargetUrl || - (platform === 'weibo' ? 'https://weibo.com/' : 'https://www.huya.com/'), - ) - .trim() - .slice(0, 1000) - - const existing = await findOrderByPlatformOrderId({ - provider, - platform: sourcePlatform, - shopId, - platformOrderId: orderNo, - }) - if (existing) { - throw createHttpError(`订单号已存在:${orderNo},请换一个或留空自动生成`, { - statusCode: 409, - errorCode: 'dev_integration_order_exists', - }) +type PersistManualIntegrationOrderInput = { + orderNo: string + skuKey: string + externalSkuCode: string + provider: string + sourcePlatform: string + shopId: string + shopName: string + buyerId: string + buyerName: string + sourceTag: string + rawPayload: Record + itemSnapshot: Record + configNote: string + quantity?: number + semiAuto?: { + platform: 'huya' | 'weibo' + config: Record } +} +type PersistManualIntegrationOrderResult = { + orderId: number + orderNo: string + orderItemId: number + fulfillmentId: number + configId: number + mappingId: number + skuKey: string +} + +/** + * 通过正式订单入口创建人工渠道测试单。 + * + * 是否生成旧半自动任务由 semi_auto_enabled 决定,调用方无需直接写订单、 + * 履约或任务表。 + */ +async function persistManualIntegrationOrder( + input: PersistManualIntegrationOrderInput, +): Promise { + const quantity = normalizeMockSemiAutoQuantity(input.quantity) const config = await saveManualFulfillmentConfig({ - skuKey, + skuKey: input.skuKey, enabled: true, - note: '开发集成测试:真实订单履约链路', + note: input.configNote, channels: [{ platformKey: 'fund_cash', creditQuantity: 100, enabled: true }], - semiAutoEnabled: true, - semiAutoPlatform: platform, - semiAutoConfig: { - pageTitle, - pageDescription: '真实入库链路测试订单:登录与 CK 获取使用当前 Connector。', - loginInstructions: '请使用本人账号完成登录授权,客服后续人工处理。', - loginMethods: ['sms', 'qr'], - browserTargets: [ - { - key: platform, - label: platform === 'weibo' ? '微博' : '虎牙', - url: browserTargetUrl, - }, - ], - }, + semiAutoEnabled: Boolean(input.semiAuto), + ...(input.semiAuto + ? { + semiAutoPlatform: input.semiAuto.platform, + semiAutoConfig: input.semiAuto.config, + } + : {}), }) const configId = Number(config.id || 0) if (!configId) { @@ -620,53 +613,47 @@ export async function createSemiAutoIntegrationMock( }) } const mappingId = await upsertInternalSkuMapping({ - provider, - shopId, + provider: input.provider, + shopId: input.shopId, matchType: 'sku_code', - matchValue: externalSkuCode, - internalSku: skuKey, + matchValue: input.externalSkuCode, + internalSku: input.skuKey, priority: 1000, - source: 'dev_integration', - note: `订单 ${orderNo}`, + source: input.sourceTag, + note: `订单 ${input.orderNo}`, }) const now = nowIso() const upserted = await upsertOrderFromSource( { - provider, - platform: sourcePlatform, - shopId, - shopName: '半自动真实链路测试店', - platformOrderId: orderNo, + provider: input.provider, + platform: input.sourcePlatform, + shopId: input.shopId, + shopName: input.shopName, + platformOrderId: input.orderNo, orderStatus: 'paid', payStatus: 'paid', - buyerId: `integration-buyer-${suffix}`, - buyerName: '集成测试客户', + buyerId: input.buyerId, + buyerName: input.buyerName, receiverContact: '', totalAmount: 100 * quantity, currency: 'CNY', rawPayload: { - source: 'dev_integration', - orderNo, - skuKey, - platform, + ...input.rawPayload, createdAt: now, }, paidAt: now, items: [ { quantity, - skuCode: externalSkuCode, - skuName: skuKey, + skuCode: input.externalSkuCode, + skuName: input.skuKey, spec: {}, - snapshot: { - source: 'dev_integration', - semiAuto: { platform }, - }, + snapshot: input.itemSnapshot, }, ], }, - { sourceLabel: 'dev_semi_auto_integration' }, + { sourceLabel: input.sourceTag }, ) if (upserted.ignored || !upserted.order) { throw createHttpError(upserted.ignoreReason || '真实链路订单入库失败', { @@ -727,38 +714,167 @@ export async function createSemiAutoIntegrationMock( expected: { status: 'assigned', channel: 'manual' }, onlyWhenConfigNull: true, }) - await ensureSemiAutoTasksForOrderItems([orderItemId]) const resolved = await query<{ fulfillment_id: number fulfillment_channel: string fulfillment_status: string - task_id: number }>( ` SELECT f.id AS fulfillment_id, f.channel AS fulfillment_channel, - f.status AS fulfillment_status, + f.status AS fulfillment_status + FROM fulfillments f + WHERE f.order_item_id = $1 + LIMIT 1 + `, + [orderItemId], + ) + const fulfillment = resolved.rows[0] + if ( + !fulfillment || + fulfillment.fulfillment_channel !== 'manual' || + fulfillment.fulfillment_status !== 'assigned' + ) { + throw createHttpError( + `真实链路未生成人工履约:channel=${fulfillment?.fulfillment_channel || ''}, status=${fulfillment?.fulfillment_status || ''}`, + { statusCode: 500, errorCode: 'dev_integration_manual_fulfillment_failed' }, + ) + } + + return { + orderId: Number(upserted.order.id), + orderNo: input.orderNo, + orderItemId, + fulfillmentId: Number(fulfillment.fulfillment_id), + configId, + mappingId, + skuKey: input.skuKey, + } +} + +/** + * 真实履约链路集成测试单。 + * + * 订单必须通过正式 upsertOrderFromSource 入库,再走 SKU 映射、渠道判定和 + * Carrier 补偿;不直接写 order/order_item/fulfillment。 + */ +export async function createSemiAutoIntegrationMock( + input: { + platform?: unknown + orderNo?: unknown + skuName?: unknown + quantity?: unknown + pageTitle?: unknown + browserTargetUrl?: unknown + connectorMode?: unknown + } = {}, +): Promise { + assertDevMockEnabled() + + const platform = normalizeMockSemiAutoPlatform(input.platform) + const suffix = `${Date.now()}_${Math.floor(Math.random() * 1_000_000)}` + const orderNo = String( + input.orderNo || `${platform === 'weibo' ? 'INTWB' : 'INTSA'}${suffix}`, + ).trim() + const skuKey = normalizeMockSemiAutoSku( + input.skuName || `${platform === 'weibo' ? '微博' : '虎牙'}真实链路测试-${suffix}`, + platform, + ) + const quantity = normalizeMockSemiAutoQuantity(input.quantity) + const connectorMode = + platform === 'weibo' ? 'embedded' : normalizeMockSemiAutoConnectorMode(input.connectorMode) + const provider = 'dev_integration' + const sourcePlatform = 'internal_test' + const shopId = 'dev-integration-shop' + const externalSkuCode = `INTEGRATION-${suffix}` + const pageTitle = String( + input.pageTitle || (platform === 'weibo' ? '微博账号登录授权' : '虎牙账号登录授权'), + ) + .trim() + .slice(0, 60) + const browserTargetUrl = String( + input.browserTargetUrl || + (platform === 'weibo' ? 'https://weibo.com/' : 'https://www.huya.com/'), + ) + .trim() + .slice(0, 1000) + + const existing = await findOrderByPlatformOrderId({ + provider, + platform: sourcePlatform, + shopId, + platformOrderId: orderNo, + }) + if (existing) { + throw createHttpError(`订单号已存在:${orderNo},请换一个或留空自动生成`, { + statusCode: 409, + errorCode: 'dev_integration_order_exists', + }) + } + + const persisted = await persistManualIntegrationOrder({ + orderNo, + skuKey, + externalSkuCode, + provider, + sourcePlatform, + shopId, + shopName: '半自动真实链路测试店', + buyerId: `integration-buyer-${suffix}`, + buyerName: '集成测试客户', + sourceTag: 'dev_semi_auto_integration', + rawPayload: { + source: 'dev_integration', + orderNo, + skuKey, + platform, + }, + itemSnapshot: { + source: 'dev_integration', + semiAuto: { platform }, + }, + configNote: '开发集成测试:真实订单履约链路', + quantity, + semiAuto: { + platform, + config: { + pageTitle, + pageDescription: '真实入库链路测试订单:登录与 CK 获取使用当前 Connector。', + loginInstructions: '请使用本人账号完成登录授权,客服后续人工处理。', + loginMethods: ['sms', 'qr'], + browserTargets: [ + { + key: platform, + label: platform === 'weibo' ? '微博' : '虎牙', + url: browserTargetUrl, + }, + ], + }, + }, + }) + await ensureSemiAutoTasksForOrderItems([persisted.orderItemId]) + + const resolved = await query<{ + task_id: number + }>( + ` + SELECT task.id AS task_id FROM fulfillments f LEFT JOIN semi_auto_tasks task ON task.order_item_id = f.order_item_id WHERE f.order_item_id = $1 LIMIT 1 `, - [orderItemId], + [persisted.orderItemId], ) const row = resolved.rows[0] - if ( - !row || - row.fulfillment_channel !== 'manual' || - row.fulfillment_status !== 'assigned' || - !Number(row.task_id) - ) { - throw createHttpError( - `真实链路未生成半自动任务:channel=${row?.fulfillment_channel || ''}, status=${row?.fulfillment_status || ''}, task=${row?.task_id || 0}`, - { statusCode: 500, errorCode: 'dev_integration_semi_auto_task_failed' }, - ) + if (!row || !Number(row.task_id)) { + throw createHttpError('真实链路未生成半自动任务', { + statusCode: 500, + errorCode: 'dev_integration_semi_auto_task_failed', + }) } await query('UPDATE semi_auto_tasks SET connector_mode = $2, updated_at = NOW() WHERE id = $1', [ @@ -771,17 +887,17 @@ export async function createSemiAutoIntegrationMock( platform: 'semi_auto', semiAutoPlatform: platform, pipeline: 'order_service', - orderId: Number(upserted.order.id), - orderNo, - orderItemId, - fulfillmentId: Number(row.fulfillment_id), - configId, + orderId: persisted.orderId, + orderNo: persisted.orderNo, + orderItemId: persisted.orderItemId, + fulfillmentId: persisted.fulfillmentId, + configId: persisted.configId, taskId: Number(row.task_id), - skuKey, + skuKey: persisted.skuKey, connectorMode, connectorConfigured, - mappingId, - customerPath: buildMockCustomerPath(platform, orderNo), + mappingId: persisted.mappingId, + customerPath: buildMockCustomerPath(platform, persisted.orderNo), adminPath: `/admin/semi-auto-tasks?keyword=${encodeURIComponent(orderNo)}`, tips: [ '订单通过正式 upsertOrderFromSource 入库。', @@ -794,6 +910,109 @@ export async function createSemiAutoIntegrationMock( } } +/** + * 斗鱼直播账号履约专用测试单。 + * + * 只生成 live-hub 工作台需要的正式人工履约数据,不启用 order_site 的 + * huya/weibo 半自动任务。 + */ +export async function createDouyuFulfillmentMock( + input: { + orderNo?: unknown + skuName?: unknown + } = {}, +): Promise { + assertDevMockEnabled() + + const suffix = `${Date.now()}_${Math.floor(Math.random() * 1_000_000)}` + const orderNo = String(input.orderNo || `LIVEHUBDOUYU${suffix}`).trim() + const requestedSkuKey = String(input.skuName || `斗鱼精英宝典联调-${suffix}`) + .trim() + .slice(0, 48) + if (!requestedSkuKey || !containsCjk(requestedSkuKey)) { + throw createHttpError('内部 SKU 名称必须包含中文', { + statusCode: 400, + errorCode: 'dev_douyu_fulfillment_sku_invalid', + }) + } + + const provider = 'livehub_douyu_dev' + const sourcePlatform = 'internal_test' + const shopId = 'livehub-douyu-dev-shop' + const existing = await findOrderByPlatformOrderId({ + provider, + platform: sourcePlatform, + shopId, + platformOrderId: orderNo, + }) + if (existing) { + throw createHttpError(`订单号已存在:${orderNo},请换一个或留空自动生成`, { + statusCode: 409, + errorCode: 'dev_douyu_fulfillment_order_exists', + }) + } + + const persisted = await persistManualIntegrationOrder({ + orderNo, + skuKey: requestedSkuKey, + externalSkuCode: `DOUYU-FULFILLMENT-${suffix}`, + provider, + sourcePlatform, + shopId, + shopName: '直播账号履约联调店', + buyerId: `douyu-fulfillment-buyer-${suffix}`, + buyerName: '斗鱼履约联调客户', + sourceTag: 'dev_douyu_fulfillment', + rawPayload: { + source: 'dev_douyu_fulfillment', + orderNo, + skuKey: requestedSkuKey, + targetPlatform: 'douyu', + }, + itemSnapshot: { + source: 'dev_douyu_fulfillment', + targetPlatform: 'douyu', + scope: 'elite', + }, + configNote: '开发 Mock:斗鱼直播账号履约', + }) + + const verification = await query<{ + semi_auto_task_count: number + semi_auto_enabled: boolean + }>( + ` + SELECT + COUNT(task.id)::int AS semi_auto_task_count, + BOOL_OR(cfg.semi_auto_enabled) AS semi_auto_enabled + FROM fulfillments f + JOIN manual_fulfillment_configs cfg ON cfg.id = f.fulfillment_config_id + LEFT JOIN semi_auto_tasks task ON task.order_item_id = f.order_item_id + WHERE f.id = $1 + `, + [persisted.fulfillmentId], + ) + const row = verification.rows[0] + if (Number(row?.semi_auto_task_count || 0) > 0 || row?.semi_auto_enabled === true) { + throw createHttpError('斗鱼专用 Mock 不应生成半自动任务', { + statusCode: 500, + errorCode: 'dev_douyu_fulfillment_semi_auto_conflict', + }) + } + + return { + platform: 'douyu', + pipeline: 'order_service', + ...persisted, + adminPath: `/admin/orders/${persisted.orderId}`, + tips: [ + '订单已通过 upsertOrderFromSource 正式入库。', + '履约渠道为 manual,状态为 assigned,且不会生成 huya/weibo 半自动任务。', + `在 live-hub 直播账号履约工作台同步后,用内部 SKU「${persisted.skuKey}」配置斗鱼商品映射。`, + ], + } +} + function normalizeMockSemiAutoPlatform(value: unknown): 'huya' | 'weibo' { return String(value || '') .trim() diff --git a/apps/backend/src/services/semi-auto/semi-auto-task.integration.test.ts b/apps/backend/src/services/semi-auto/semi-auto-task.integration.test.ts index 28dc20aa..443c457d 100644 --- a/apps/backend/src/services/semi-auto/semi-auto-task.integration.test.ts +++ b/apps/backend/src/services/semi-auto/semi-auto-task.integration.test.ts @@ -766,3 +766,93 @@ test( } }, ) + +test( + '斗鱼直播账号履约 Mock 只生成正式人工履约,不生成半自动任务', + { skip: !TEST_DATABASE_URL ? '未设置 SEMI_AUTO_TASK_TEST_DATABASE_URL' : false }, + async () => { + process.env.DATABASE_URL = TEST_DATABASE_URL + process.env.ENABLE_DEV_MOCK = '1' + const { closeDb, query, withTransaction } = await import('../../db/client.js') + const { createDouyuFulfillmentMock } = await import('../dev-mock/dev-mock-service.js') + const suffix = `${Date.now()}_${Math.floor(Math.random() * 1_000_000)}` + const orderNo = `IT-DOUYU-FULFILLMENT-${suffix}` + const skuKey = `斗鱼精英宝典联调-${suffix}` + let orderId = 0 + let configId = 0 + let mappingId = 0 + + try { + const result = await createDouyuFulfillmentMock({ + orderNo, + skuName: skuKey, + }) + orderId = result.orderId + configId = result.configId + mappingId = result.mappingId + + assert.equal(result.platform, 'douyu') + assert.equal(result.pipeline, 'order_service') + assert.equal(result.orderNo, orderNo) + assert.equal(result.skuKey, skuKey) + assert.ok(result.orderItemId > 0) + assert.ok(result.fulfillmentId > 0) + + const stored = await query<{ + channel: string + fulfillment_status: string + fulfillment_config_id: number + semi_auto_enabled: boolean + semi_auto_task_count: number + internal_sku: string + }>( + ` + SELECT + f.channel, + f.status AS fulfillment_status, + f.fulfillment_config_id, + cfg.semi_auto_enabled, + ( + SELECT COUNT(*)::int + FROM semi_auto_tasks task + WHERE task.order_item_id = f.order_item_id + ) AS semi_auto_task_count, + resolve_internal_sku(oi.manual_sku_key, oi.sku_name, oi.sku_code) AS internal_sku + FROM fulfillments f + JOIN order_items oi ON oi.id = f.order_item_id + JOIN manual_fulfillment_configs cfg ON cfg.id = f.fulfillment_config_id + WHERE f.id = $1 + `, + [result.fulfillmentId], + ) + assert.equal(stored.rows[0]?.channel, 'manual') + assert.equal(stored.rows[0]?.fulfillment_status, 'assigned') + assert.equal(Number(stored.rows[0]?.fulfillment_config_id), result.configId) + assert.equal(stored.rows[0]?.semi_auto_enabled, false) + assert.equal(Number(stored.rows[0]?.semi_auto_task_count), 0) + assert.equal(stored.rows[0]?.internal_sku, skuKey) + + const mapping = await query<{ internal_sku: string }>( + 'SELECT internal_sku FROM internal_sku_mappings WHERE id = $1', + [result.mappingId], + ) + assert.equal(mapping.rows[0]?.internal_sku, skuKey) + } finally { + await withTransaction(async (client) => { + await client.query("SET LOCAL session_replication_role = 'replica'") + if (configId > 0) { + await client.query('DELETE FROM manual_fulfillment_configs WHERE id = $1', [configId]) + } + if (orderId > 0) { + await client.query('DELETE FROM order_source_snapshots WHERE order_id = $1', [orderId]) + await client.query('DELETE FROM orders WHERE id = $1', [orderId]) + } + if (mappingId > 0) { + await client.query('DELETE FROM internal_sku_mappings WHERE id = $1', [mappingId]) + } + }) + delete process.env.ENABLE_DEV_MOCK + await closeDb() + } + }, +) diff --git a/apps/frontend/src/pages/admin/AdminDevMockPage.tsx b/apps/frontend/src/pages/admin/AdminDevMockPage.tsx index c558022c..06d6e391 100644 --- a/apps/frontend/src/pages/admin/AdminDevMockPage.tsx +++ b/apps/frontend/src/pages/admin/AdminDevMockPage.tsx @@ -1,4 +1,13 @@ -import { BugOutlined, CopyOutlined, LinkOutlined } from '@ant-design/icons' +import { + ApiOutlined, + BugOutlined, + CopyOutlined, + GiftOutlined, + LinkOutlined, + SearchOutlined, + ThunderboltOutlined, + WalletOutlined, +} from '@ant-design/icons' import { Alert, App, @@ -6,13 +15,17 @@ import { Card, Col, Divider, + Empty, Form, Input, InputNumber, Result, Row, + Segmented, Select, Space, + Tabs, + Tag, Typography, } from 'antd' import { useMutation, useQuery } from '@tanstack/react-query' @@ -23,6 +36,7 @@ import PageHeader from '@/components/admin/PageHeader' import { buildOpen91QueryDevMock, createAffiliateDashDevMock, + createDouyuFulfillmentDevMock, createKuaishouIndustryVoucherDevMock, createSemiAutoDevMock, createSemiAutoIntegrationDevMock, @@ -31,16 +45,24 @@ import { type DevMockKuaishouIndustryVoucherResult, type DevMockOpen91QueryResult, type DevMockSemiAutoResult, + type DevDouyuFulfillmentMockResult, type DevSemiAutoIntegrationResult, } from '@/services/admin' import { buildCustomerFulfillmentPath } from '@/utils/customer-fulfillment-link' +type MockTabKey = 'douyu' | 'semi-auto' | 'affiliate-dash' | 'kuaishou-voucher' | 'open91' +type SemiAutoMode = 'integration' | 'direct' + export default function AdminDevMockPage() { const { message } = App.useApp() + const [activeTab, setActiveTab] = useState('douyu') + const [semiAutoMode, setSemiAutoMode] = useState('integration') const [lastCreate, setLastCreate] = useState(null) const [lastVoucherCreate, setLastVoucherCreate] = useState(null) const [lastQuery, setLastQuery] = useState(null) + const [lastDouyuFulfillment, setLastDouyuFulfillment] = + useState(null) const [lastSemiAuto, setLastSemiAuto] = useState< DevMockSemiAutoResult | DevSemiAutoIntegrationResult | null >(null) @@ -109,8 +131,18 @@ export default function AdminDevMockPage() { }, }) + const douyuFulfillmentMutation = useMutation({ + mutationFn: createDouyuFulfillmentDevMock, + onSuccess: (response) => { + setLastDouyuFulfillment(response.data) + message.success('斗鱼直播账号履约测试单已生成') + }, + onError: (error) => { + message.error(error instanceof Error ? error.message : '生成失败') + }, + }) + const defaultOrderNo = useMemo(() => lastCreate?.orderNo || '', [lastCreate?.orderNo]) - // 页面展示按平台重新生成规范路径,避免历史 Mock 响应里的 customerPath 仍是 /c。 const semiAutoCustomerPath = lastSemiAuto ? buildCustomerFulfillmentPath(lastSemiAuto.orderNo, lastSemiAuto.semiAutoPlatform) || lastSemiAuto.customerPath @@ -148,314 +180,561 @@ export default function AdminDevMockPage() {
NODE_ENV={status?.nodeEnv || '-'} + + Mock 已开启 + NODE_ENV={status?.nodeEnv || '-'} + } /> } - message="Mock 会写入开发库真实订单/任务;除订单外,登录、绑定、票据注入和完成确认都可以走真实流程。" - description="默认使用 order_site 内置真实 Connector,不依赖 live-hub-py;只有显式选择内置 Mock 时才会 Mock 登录和绑定。" + message="仅用于开发环境" + description="Mock 会向当前开发库写入真实订单和任务。请先确认当前环境,再切换对应业务模块生成测试数据。" /> - - - - affiliateDashMutation.mutate(values)} - /> - - - - - - - semiAutoIntegrationMutation.mutate(values)} - /> - - - - - - semiAutoMutation.mutate(values)} - /> - - - - - - voucherMutation.mutate(values)} - /> - - - - - -
- open91Mutation.mutate({ - orderNo: values.orderNo, - execute: values.execute === '1', - }) - } - > - - - - - + + + + + + + + + + +
+ ) +} + function SemiAutoMockForm({ loading, submitText, diff --git a/apps/frontend/src/services/admin/dev-mock.ts b/apps/frontend/src/services/admin/dev-mock.ts index 8f44645d..af1b92df 100644 --- a/apps/frontend/src/services/admin/dev-mock.ts +++ b/apps/frontend/src/services/admin/dev-mock.ts @@ -73,6 +73,20 @@ export type DevSemiAutoIntegrationResult = DevMockSemiAutoResult & { mappingId: number } +export type DevDouyuFulfillmentMockResult = { + platform: 'douyu' + pipeline: 'order_service' + orderId: number + orderNo: string + orderItemId: number + fulfillmentId: number + configId: number + mappingId: number + skuKey: string + adminPath: string + tips: string[] +} + export function fetchDevMockStatus() { return apiGet('/api/v1/admin/dev-mock/status') } @@ -122,6 +136,10 @@ export function createSemiAutoIntegrationDevMock(payload: { ) } +export function createDouyuFulfillmentDevMock(payload: { orderNo?: string; skuName?: string }) { + return apiPost('/api/v1/admin/dev-mock/douyu-fulfillment', payload) +} + export function buildOpen91QueryDevMock(payload: { orderNo: string execute?: boolean diff --git a/apps/frontend/src/styles/base.css b/apps/frontend/src/styles/base.css index 8e2aff49..d67470f1 100644 --- a/apps/frontend/src/styles/base.css +++ b/apps/frontend/src/styles/base.css @@ -123,6 +123,18 @@ select { line-height: 1.5; } +.dev-mock-tabs > .ant-tabs-nav { + margin-bottom: 0; +} + +.dev-mock-tabs > .ant-tabs-content-holder { + margin-top: 16px; +} + +.dev-mock-tabs > .ant-tabs-nav .ant-tabs-tab { + padding-inline: 18px; +} + .total-badge { display: inline-flex; align-items: center; From 6de129d70ac203143a339bf22028ee258459d7f6 Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 19:01:24 +0800 Subject: [PATCH 02/17] =?UTF-8?q?feat(douyu):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E9=A2=86=E5=8F=96=E4=B8=8E=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=B7=A5=E4=BD=9C=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.mac-docker.example | 2 + .env.server.example | 2 + apps/backend/src/app.ts | 2 + .../src/config/env-documentation.test.ts | 7 +- .../171_douyu_customer_fulfillment.sql | 83 +++ apps/backend/src/routes/admin.ts | 2 + .../src/routes/admin/douyu-fulfillment.ts | 71 +++ apps/backend/src/routes/douyu-fulfillment.ts | 64 ++ .../manual-fulfillment-config-service.ts | 18 +- .../src/services/dev-mock/dev-mock-service.ts | 8 + .../douyu-fulfillment-service.ts | 584 ++++++++++++++++++ .../douyu-fulfillment.test.ts | 39 ++ apps/frontend/src/App.tsx | 26 +- apps/frontend/src/layouts/AdminLayout.tsx | 11 + .../src/pages/admin/AdminDevMockPage.tsx | 26 + .../pages/admin/AdminDouyuFulfillmentPage.tsx | 390 ++++++++++++ .../cost-center/ManualSkuConfigPanel.tsx | 12 + .../DouyuFulfillmentPage.tsx | 492 +++++++++++++++ .../src/services/admin/cost-center.ts | 1 + apps/frontend/src/services/admin/dev-mock.ts | 1 + .../src/services/admin/douyu-fulfillment.ts | 38 ++ apps/frontend/src/services/admin/index.ts | 1 + .../src/services/douyu-fulfillment.ts | 46 ++ apps/frontend/src/types/admin/cost-center.ts | 1 + apps/frontend/src/types/douyu-fulfillment.ts | 89 +++ .../src/utils/customer-fulfillment-link.ts | 15 + .../tests/customer-fulfillment-link.test.ts | 12 + docker-compose.yml | 2 + docs/斗鱼客户领取与角色绑定.md | 79 +++ 29 files changed, 2119 insertions(+), 5 deletions(-) create mode 100644 apps/backend/src/db/migrations/171_douyu_customer_fulfillment.sql create mode 100644 apps/backend/src/routes/admin/douyu-fulfillment.ts create mode 100644 apps/backend/src/routes/douyu-fulfillment.ts create mode 100644 apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts create mode 100644 apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts create mode 100644 apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx create mode 100644 apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx create mode 100644 apps/frontend/src/services/admin/douyu-fulfillment.ts create mode 100644 apps/frontend/src/services/douyu-fulfillment.ts create mode 100644 apps/frontend/src/types/douyu-fulfillment.ts create mode 100644 docs/斗鱼客户领取与角色绑定.md diff --git a/.env.mac-docker.example b/.env.mac-docker.example index 2bfeb72e..33933ab0 100644 --- a/.env.mac-docker.example +++ b/.env.mac-docker.example @@ -12,6 +12,8 @@ HTTP_TRUST_PROXY=1 # Claim Links CLAIM_BASE_URL=http://localhost/h5 +LIVE_HUB_PLATFORM_FULFILLMENT_URL=http://host.docker.internal:8800 +PLATFORM_FULFILLMENT_INTEGRATION_KEY= # Database POSTGRES_DB=order_site diff --git a/.env.server.example b/.env.server.example index 9e7eff0a..fd838293 100644 --- a/.env.server.example +++ b/.env.server.example @@ -24,6 +24,8 @@ HTTP_TRUST_PROXY=1 # Claim Links CLAIM_BASE_URL=https://order.khhao.com/h5 +LIVE_HUB_PLATFORM_FULFILLMENT_URL=https://live.khhao.com +PLATFORM_FULFILLMENT_INTEGRATION_KEY= CLAIM_TOKEN_TTL_HOURS=0 # Database diff --git a/apps/backend/src/app.ts b/apps/backend/src/app.ts index 0445e72e..c16b4f2a 100644 --- a/apps/backend/src/app.ts +++ b/apps/backend/src/app.ts @@ -11,6 +11,7 @@ import customerFulfillmentRouter from './routes/customer-fulfillment.js' import devMockConnectorRouter from './routes/dev-mock-connector.js' import dcAuthRouter from './routes/dcauth.js' import douyinMashidaRouter from './routes/douyin-mashida.js' +import douyuFulfillmentRouter from './routes/douyu-fulfillment.js' import kuaishouIndustryRouter from './routes/kuaishou-industry.js' import open91Router from './routes/open-91.js' import pddExtensionRouter from './routes/pdd-extension.js' @@ -119,6 +120,7 @@ export function createApp({ startupState, isShutdownStarted, config }: CreateApp app.use('/api/v1/redeem', redeemRouter) app.use('/api/v1/claim', claimsRouter) app.use('/api/v1/customer-fulfillment', customerFulfillmentRouter) + app.use('/api/v1/douyu-fulfillment', douyuFulfillmentRouter) app.use('/api/v1/semi-auto/injections', semiAutoInjectionsRouter) app.use('/api/v1/o', orderServiceRouter) app.use('/api/v1/pdd/extension', pddExtensionRouter) diff --git a/apps/backend/src/config/env-documentation.test.ts b/apps/backend/src/config/env-documentation.test.ts index 15c3b361..e0632aa8 100644 --- a/apps/backend/src/config/env-documentation.test.ts +++ b/apps/backend/src/config/env-documentation.test.ts @@ -10,7 +10,12 @@ const CURRENT_DIR = path.dirname(fileURLToPath(import.meta.url)) const BACKEND_ROOT = path.resolve(CURRENT_DIR, '../..') const WORKSPACE_ROOT = process.env.WORKSPACE_ROOT || path.resolve(BACKEND_ROOT, '../..') -const SPECIAL_RUNTIME_ENV_NAMES = ['APP_BASE_URL', 'CLAIM_BASE_URL'] +const SPECIAL_RUNTIME_ENV_NAMES = [ + 'APP_BASE_URL', + 'CLAIM_BASE_URL', + 'LIVE_HUB_PLATFORM_FULFILLMENT_URL', + 'PLATFORM_FULFILLMENT_INTEGRATION_KEY', +] const DEPLOYMENT_ONLY_ENV_NAMES = [ 'APP_DOMAIN', diff --git a/apps/backend/src/db/migrations/171_douyu_customer_fulfillment.sql b/apps/backend/src/db/migrations/171_douyu_customer_fulfillment.sql new file mode 100644 index 00000000..b0319b84 --- /dev/null +++ b/apps/backend/src/db/migrations/171_douyu_customer_fulfillment.sql @@ -0,0 +1,83 @@ +-- 171_douyu_customer_fulfillment.sql +-- +-- 斗鱼精英宝典客户领取: +-- 1. 人工 SKU 配置可显式启用斗鱼客户绑定; +-- 2. order_site 保存客户资料和 live-hub 安全状态投影; +-- 3. 内部账号、CK、积分、二维码原始协议仍由 live-hub 负责。 + +ALTER TABLE manual_fulfillment_configs + ADD COLUMN IF NOT EXISTS douyu_fulfillment_enabled BOOLEAN NOT NULL DEFAULT FALSE; + +COMMENT ON COLUMN manual_fulfillment_configs.douyu_fulfillment_enabled IS + '是否启用斗鱼精英宝典客户领取与角色绑定'; + +CREATE TABLE IF NOT EXISTS douyu_fulfillment_tasks ( + id BIGSERIAL PRIMARY KEY, + order_id BIGINT NOT NULL REFERENCES orders(id) ON DELETE CASCADE, + order_item_id BIGINT NOT NULL UNIQUE REFERENCES order_items(id) ON DELETE CASCADE, + fulfillment_id BIGINT REFERENCES fulfillments(id) ON DELETE SET NULL, + manual_fulfillment_config_id BIGINT + REFERENCES manual_fulfillment_configs(id) ON DELETE SET NULL, + live_session_id BIGINT, + status TEXT NOT NULL DEFAULT 'waiting_profile' + CHECK (status IN ( + 'waiting_profile', + 'preparing', + 'qr_pending', + 'role_ready', + 'bound', + 'waiting_operator', + 'processing', + 'completed', + 'failed', + 'manual_required', + 'cancelled' + )), + customer_role_name TEXT NOT NULL DEFAULT '', + customer_platform TEXT NOT NULL DEFAULT '' + CHECK (customer_platform IN ('', 'wechat', 'qq')), + customer_system TEXT NOT NULL DEFAULT '' + CHECK (customer_system IN ('', 'ios', 'android')), + binding_phase TEXT NOT NULL DEFAULT '', + live_execution_status TEXT NOT NULL DEFAULT '', + live_binding_status TEXT NOT NULL DEFAULT '', + issue_code TEXT NOT NULL DEFAULT '', + last_error TEXT NOT NULL DEFAULT '', + bound_role_name TEXT NOT NULL DEFAULT '', + bound_area_name TEXT NOT NULL DEFAULT '', + bound_plat_name TEXT NOT NULL DEFAULT '', + customer_link_opened_at TIMESTAMPTZ, + binding_started_at TIMESTAMPTZ, + bound_at TIMESTAMPTZ, + completed_at TIMESTAMPTZ, + last_synced_at TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS idx_douyu_fulfillment_tasks_status + ON douyu_fulfillment_tasks (status, updated_at DESC, id DESC); +CREATE INDEX IF NOT EXISTS idx_douyu_fulfillment_tasks_order + ON douyu_fulfillment_tasks (order_id, id); +CREATE INDEX IF NOT EXISTS idx_douyu_fulfillment_tasks_live + ON douyu_fulfillment_tasks (live_session_id) + WHERE live_session_id IS NOT NULL; + +CREATE TABLE IF NOT EXISTS douyu_fulfillment_events ( + id BIGSERIAL PRIMARY KEY, + task_id BIGINT NOT NULL REFERENCES douyu_fulfillment_tasks(id) ON DELETE CASCADE, + event_type TEXT NOT NULL, + actor_type TEXT NOT NULL DEFAULT 'system' + CHECK (actor_type IN ('system', 'customer', 'admin', 'integration')), + actor_id TEXT NOT NULL DEFAULT '', + detail_json JSONB NOT NULL DEFAULT '{}'::jsonb, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS idx_douyu_fulfillment_events_task + ON douyu_fulfillment_events (task_id, id DESC); + +COMMENT ON TABLE douyu_fulfillment_tasks IS + '斗鱼精英宝典客户领取任务;客户资料以本表为准,绑定状态为 live-hub 安全投影'; +COMMENT ON COLUMN douyu_fulfillment_tasks.live_session_id IS + 'live-hub platform_fulfillment_tasks.id;不得保存内部账号或 CK'; diff --git a/apps/backend/src/routes/admin.ts b/apps/backend/src/routes/admin.ts index fe90009e..05dfa2ec 100644 --- a/apps/backend/src/routes/admin.ts +++ b/apps/backend/src/routes/admin.ts @@ -6,6 +6,7 @@ import costCenterRouter from './admin/cost-center.js' import dashboardRouter from './admin/dashboard.js' import devMockRouter from './admin/dev-mock.js' import douyinMashidaRouter from './admin/douyin-mashida.js' +import douyuFulfillmentRouter from './admin/douyu-fulfillment.js' import financeRouter from './admin/finance.js' import fulfillmentChannelRouter from './admin/fulfillment-channel.js' import financeLedgerRouter from './admin/finance-ledger.js' @@ -38,6 +39,7 @@ router.use(fundRouter) router.use(usersRouter) router.use(rbacRouter) router.use(semiAutoRouter) +router.use(douyuFulfillmentRouter) router.use(auditLogsRouter) router.use(platformConfigRouter) router.use(kuaishouIndustryRouter) diff --git a/apps/backend/src/routes/admin/douyu-fulfillment.ts b/apps/backend/src/routes/admin/douyu-fulfillment.ts new file mode 100644 index 00000000..b180e093 --- /dev/null +++ b/apps/backend/src/routes/admin/douyu-fulfillment.ts @@ -0,0 +1,71 @@ +import { Router } from 'express' + +import { + ensureDouyuFulfillmentTasks, + getDouyuFulfillmentDetail, + listDouyuFulfillmentTasks, + refreshDouyuCustomerBinding, + startDouyuCustomerBinding, +} from '../../services/douyu-fulfillment/douyu-fulfillment-service.js' +import { createJsonHandler, requireAdminRoles } from './session.js' + +const router = Router() + +router.use('/douyu-fulfillment', requireAdminRoles(['admin', 'operator', 'support'])) + +router.get( + '/douyu-fulfillment/tasks', + createJsonHandler((req) => listDouyuFulfillmentTasks(req.query as Record), { + successMessage: 'ok', + errorMessage: '读取斗鱼领取任务失败', + scope: '[admin/douyu-fulfillment/tasks]', + }), +) + +router.post( + '/douyu-fulfillment/sync', + createJsonHandler(() => ensureDouyuFulfillmentTasks(), { + successMessage: '斗鱼领取任务已同步', + errorMessage: '同步斗鱼领取任务失败', + scope: '[admin/douyu-fulfillment/sync]', + audit: () => ({ + action: 'douyu_fulfillment_synced', + targetType: 'douyu_fulfillment_task', + targetId: 'all', + data: {}, + }), + }), +) + +router.get( + '/douyu-fulfillment/tasks/:orderNo', + createJsonHandler((req) => getDouyuFulfillmentDetail(String(req.params.orderNo || '')), { + successMessage: 'ok', + errorMessage: '读取斗鱼领取详情失败', + scope: '[admin/douyu-fulfillment/tasks/:orderNo]', + }), +) + +router.post( + '/douyu-fulfillment/tasks/:orderNo/binding/refresh', + createJsonHandler((req) => refreshDouyuCustomerBinding(String(req.params.orderNo || '')), { + successMessage: '绑定状态已刷新', + errorMessage: '刷新斗鱼绑定状态失败', + scope: '[admin/douyu-fulfillment/tasks/:orderNo/binding/refresh]', + }), +) + +router.post( + '/douyu-fulfillment/tasks/:orderNo/binding/start', + createJsonHandler( + (req) => + startDouyuCustomerBinding(String(req.params.orderNo || ''), req.body?.forceRefresh === true), + { + successMessage: '绑定二维码已重新准备', + errorMessage: '重新生成斗鱼绑定二维码失败', + scope: '[admin/douyu-fulfillment/tasks/:orderNo/binding/start]', + }, + ), +) + +export default router diff --git a/apps/backend/src/routes/douyu-fulfillment.ts b/apps/backend/src/routes/douyu-fulfillment.ts new file mode 100644 index 00000000..148c9c28 --- /dev/null +++ b/apps/backend/src/routes/douyu-fulfillment.ts @@ -0,0 +1,64 @@ +import { Router } from 'express' + +import { + confirmDouyuCustomerBinding, + getCustomerDouyuFulfillment, + refreshDouyuCustomerBinding, + saveDouyuCustomerProfile, + startDouyuCustomerBinding, +} from '../services/douyu-fulfillment/douyu-fulfillment-service.js' +import { createRouteHandler } from '../utils/http.js' + +const router = Router() + +router.get( + '/:orderNo', + createRouteHandler((req) => getCustomerDouyuFulfillment(String(req.params.orderNo || '')), { + errorMessage: '读取斗鱼领取信息失败', + scope: '[douyu-fulfillment/:orderNo]', + }), +) + +router.post( + '/:orderNo/profile', + createRouteHandler( + (req) => saveDouyuCustomerProfile(String(req.params.orderNo || ''), req.body || {}), + { + successMessage: '游戏资料已保存', + errorMessage: '保存游戏资料失败', + scope: '[douyu-fulfillment/:orderNo/profile]', + }, + ), +) + +router.post( + '/:orderNo/binding/start', + createRouteHandler( + (req) => + startDouyuCustomerBinding(String(req.params.orderNo || ''), req.body?.forceRefresh === true), + { + successMessage: '绑定二维码已准备', + errorMessage: '生成绑定二维码失败', + scope: '[douyu-fulfillment/:orderNo/binding/start]', + }, + ), +) + +router.get( + '/:orderNo/binding/status', + createRouteHandler((req) => refreshDouyuCustomerBinding(String(req.params.orderNo || '')), { + errorMessage: '刷新绑定状态失败', + scope: '[douyu-fulfillment/:orderNo/binding/status]', + }), +) + +router.post( + '/:orderNo/binding/confirm', + createRouteHandler((req) => confirmDouyuCustomerBinding(String(req.params.orderNo || '')), { + successMessage: '角色绑定已确认', + errorMessage: '确认角色绑定失败', + scope: '[douyu-fulfillment/:orderNo/binding/confirm]', + }), +) + +export default router diff --git a/apps/backend/src/services/cost-center/manual-fulfillment-config-service.ts b/apps/backend/src/services/cost-center/manual-fulfillment-config-service.ts index 24c0a9b5..02856436 100644 --- a/apps/backend/src/services/cost-center/manual-fulfillment-config-service.ts +++ b/apps/backend/src/services/cost-center/manual-fulfillment-config-service.ts @@ -115,6 +115,7 @@ type ManualSkuRow = { config_semi_auto_enabled: boolean | null config_semi_auto_platform: string | null config_semi_auto_config_json: unknown + config_douyu_fulfillment_enabled: boolean | null } type ManualChannelConfig = { @@ -353,7 +354,8 @@ export async function listManualSkus(input: Record = {}) { cfg.channels_json AS config_channels_json, cfg.semi_auto_enabled AS config_semi_auto_enabled, cfg.semi_auto_platform AS config_semi_auto_platform, - cfg.semi_auto_config_json AS config_semi_auto_config_json + cfg.semi_auto_config_json AS config_semi_auto_config_json, + cfg.douyu_fulfillment_enabled AS config_douyu_fulfillment_enabled FROM product_catalog p JOIN internal_skus product_sku ON product_sku.id = p.internal_sku_id LEFT JOIN LATERAL ( @@ -468,6 +470,8 @@ export async function saveManualFulfillmentConfig(payload: JsonObject) { const enabled = payload.enabled === false ? false : true const note = optionalText(payload.note, 300) const semiAuto = normalizeSemiAutoConfig(payload) + const douyuFulfillmentEnabled = + payload.douyuFulfillmentEnabled === true || payload.douyu_fulfillment_enabled === true // 消耗积分为 0 = 成本不固定,客服确认履约时手填。 const costMode = primaryChannel.costMode @@ -560,7 +564,8 @@ export async function saveManualFulfillmentConfig(payload: JsonObject) { semi_auto_enabled = $10, semi_auto_platform = $11, semi_auto_config_json = $12::jsonb, - updated_at = $13 + douyu_fulfillment_enabled = $13, + updated_at = $14 WHERE id = $1 RETURNING *`, [ @@ -576,6 +581,7 @@ export async function saveManualFulfillmentConfig(payload: JsonObject) { semiAuto.enabled, semiAuto.platform, JSON.stringify(semiAuto.config), + douyuFulfillmentEnabled, now, ], ) @@ -584,10 +590,11 @@ export async function saveManualFulfillmentConfig(payload: JsonObject) { sku_key, canonical_product_id, platform_key, credit_quantity, cost_mode, enabled, note, channels_json, semi_auto_enabled, semi_auto_platform, semi_auto_config_json, + douyu_fulfillment_enabled, created_at, updated_at ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8::jsonb, - $9, $10, $11::jsonb, $12, $12 + $9, $10, $11::jsonb, $12, $13, $13 ) RETURNING *`, [ @@ -602,6 +609,7 @@ export async function saveManualFulfillmentConfig(payload: JsonObject) { semiAuto.enabled, semiAuto.platform, JSON.stringify(semiAuto.config), + douyuFulfillmentEnabled, now, ], ) @@ -1077,6 +1085,7 @@ export async function getManualFulfillmentConfig(skuKey: string) { semi_auto_enabled: boolean semi_auto_platform: string semi_auto_config_json: unknown + douyu_fulfillment_enabled: boolean created_at: string updated_at: string }>( @@ -1208,6 +1217,7 @@ function mapManualSku(row: ManualSkuRow, unitPrices: Record( + path: string, + init: { method?: string; body?: Record } = {}, +): Promise { + const response = await fetch(`${liveHubBaseUrl()}${path}`, { + method: init.method || 'GET', + headers: { + 'Content-Type': 'application/json', + 'X-Integration-Key': integrationKey(), + }, + ...(init.body ? { body: JSON.stringify(init.body) } : {}), + signal: AbortSignal.timeout(20_000), + }) + const text = await response.text() + let payload: unknown = null + try { + payload = text ? JSON.parse(text) : null + } catch { + payload = text + } + if (!response.ok) { + const detail = + payload && typeof payload === 'object' && 'detail' in payload + ? String((payload as { detail?: unknown }).detail || '') + : String(payload || '') + throw createHttpError(detail || '直播账号履约服务请求失败', { + statusCode: response.status >= 500 ? 502 : response.status, + errorCode: 'live_hub_fulfillment_request_failed', + }) + } + return payload as T +} + +async function appendEvent( + client: Pick, + taskId: number, + eventType: string, + actorType: 'system' | 'customer' | 'admin' | 'integration', + detail: Record = {}, +) { + await client.query( + ` + INSERT INTO douyu_fulfillment_events ( + task_id, event_type, actor_type, detail_json, created_at + ) VALUES ($1, $2, $3, $4::jsonb, NOW()) + `, + [taskId, eventType, actorType, JSON.stringify(detail)], + ) +} + +export async function ensureDouyuFulfillmentTasks(orderNo = '') { + const params: unknown[] = [] + let filter = '' + const normalizedOrderNo = String(orderNo || '').trim() + if (normalizedOrderNo) { + params.push(normalizedOrderNo) + filter = 'AND o.platform_order_id = $1' + } + const candidates = await query<{ + order_id: number + order_item_id: number + fulfillment_id: number + config_id: number + platform_order_id: string + }>( + ` + SELECT + o.id AS order_id, + oi.id AS order_item_id, + f.id AS fulfillment_id, + cfg.id AS config_id, + o.platform_order_id + FROM orders o + JOIN order_items oi ON oi.order_id = o.id + JOIN fulfillments f ON f.order_item_id = oi.id + JOIN manual_fulfillment_configs cfg ON cfg.id = f.fulfillment_config_id + WHERE cfg.enabled = TRUE + AND cfg.douyu_fulfillment_enabled = TRUE + AND f.channel = 'manual' + AND f.status IN ('assigned', 'processing', 'completed') + ${filter} + ORDER BY o.id DESC, oi.id ASC + `, + params, + ) + if (candidates.rows.length === 0) return { created: 0, updated: 0 } + + let created = 0 + await withTransaction(async (client) => { + for (const row of candidates.rows) { + const inserted = await client.query<{ id: number; inserted: boolean }>( + ` + INSERT INTO douyu_fulfillment_tasks ( + order_id, order_item_id, fulfillment_id, manual_fulfillment_config_id, + status, created_at, updated_at + ) VALUES ($1, $2, $3, $4, 'waiting_profile', NOW(), NOW()) + ON CONFLICT (order_item_id) DO UPDATE SET + fulfillment_id = EXCLUDED.fulfillment_id, + manual_fulfillment_config_id = EXCLUDED.manual_fulfillment_config_id, + updated_at = CASE + WHEN douyu_fulfillment_tasks.fulfillment_id IS DISTINCT FROM EXCLUDED.fulfillment_id + OR douyu_fulfillment_tasks.manual_fulfillment_config_id + IS DISTINCT FROM EXCLUDED.manual_fulfillment_config_id + THEN NOW() + ELSE douyu_fulfillment_tasks.updated_at + END + RETURNING id, (xmax = 0) AS inserted + `, + [row.order_id, row.order_item_id, row.fulfillment_id, row.config_id], + ) + const taskId = Number(inserted.rows[0]?.id || 0) + if (!taskId) continue + if (inserted.rows[0]?.inserted) { + created += 1 + await appendEvent(client, taskId, 'task_created', 'system', { + platformOrderId: row.platform_order_id, + }) + } + } + }) + return { created, updated: candidates.rows.length - created } +} + +async function loadTaskByOrderNo(orderNo: string) { + const normalized = String(orderNo || '').trim() + if (!normalized) { + throw createHttpError('订单号不能为空', { + statusCode: 400, + errorCode: 'douyu_order_no_required', + }) + } + await ensureDouyuFulfillmentTasks(normalized) + const result = await query( + `${TASK_SELECT} + WHERE o.platform_order_id = $1 + ORDER BY task.id ASC + LIMIT 1`, + [normalized], + ) + const task = result.rows[0] + if (!task) { + throw createHttpError('订单不存在或尚未启用斗鱼领取', { + statusCode: 404, + errorCode: 'douyu_fulfillment_not_found', + }) + } + return task +} + +async function loadTask(taskId: number) { + const result = await query(`${TASK_SELECT} WHERE task.id = $1 LIMIT 1`, [taskId]) + const task = result.rows[0] + if (!task) { + throw createHttpError('斗鱼领取任务不存在', { + statusCode: 404, + errorCode: 'douyu_fulfillment_not_found', + }) + } + return task +} + +function normalizeText(value: unknown) { + return String(value || '') + .replace(/\s+/g, '') + .toLowerCase() +} + +export function compareCustomerRole(task: DouyuTaskRow, live: LiveBindingState) { + const roleMatched = + Boolean(task.customer_role_name && live.roleName) && + normalizeText(task.customer_role_name) === normalizeText(live.roleName) + const liveParts = new Set([normalizeText(live.areaName), normalizeText(live.platName)]) + const expected: string[] = [] + if (task.customer_platform === 'wechat') expected.push('微信') + if (task.customer_platform === 'qq') expected.push('qq', '手q') + if (task.customer_system === 'ios') expected.push('苹果', 'ios') + if (task.customer_system === 'android') expected.push('安卓', 'android') + const channelMatched = expected.every((item) => + [...liveParts].some((part) => part.includes(item) || item.includes(part)), + ) + return { + matched: roleMatched && channelMatched, + roleMatched, + channelMatched, + message: + roleMatched && channelMatched + ? '客户资料与平台识别角色一致' + : '客户资料与平台识别角色不一致,请修改资料或联系客服', + } +} + +function statusForLive(live: LiveBindingState): string { + if (live.executionStatus === 'completed') return 'completed' + if (live.executionStatus === 'cancelled') return 'cancelled' + if (live.bindConfirmed) return 'waiting_operator' + if (live.bindReadyForConfirm) return 'role_ready' + if (live.qrUrl) return 'qr_pending' + if (live.executionStatus === 'manual_required') return 'manual_required' + if (live.issueCode === 'binding_failed') return 'failed' + if ( + live.issueCode === 'mapping_missing' || + live.issueCode === 'no_eligible_account' || + live.issueCode === 'elite_not_opened' || + live.issueCode === 'points_short' || + !live.accountReady + ) { + return 'preparing' + } + if (live.issueCode) return 'failed' + return 'preparing' +} + +async function applyLiveState(task: DouyuTaskRow, live: LiveBindingState) { + const nextStatus = statusForLive(live) + const now = nowIso() + await withTransaction(async (client) => { + await client.query( + ` + UPDATE douyu_fulfillment_tasks + SET live_session_id = $2, + status = $3, + binding_phase = $4, + live_execution_status = $5, + live_binding_status = $6, + issue_code = $7, + last_error = $8, + bound_role_name = $9, + bound_area_name = $10, + bound_plat_name = $11, + binding_started_at = CASE + WHEN $12 <> '' THEN COALESCE(binding_started_at, NOW()) + ELSE binding_started_at + END, + bound_at = CASE + WHEN $13 THEN COALESCE(bound_at, NOW()) + ELSE bound_at + END, + completed_at = CASE + WHEN $14 THEN COALESCE(completed_at, NOW()) + ELSE completed_at + END, + last_synced_at = NOW(), + updated_at = $15 + WHERE id = $1 + `, + [ + task.id, + live.sessionId, + nextStatus, + live.bindPhase, + live.executionStatus, + live.bindingStatus, + live.issueCode, + live.message, + live.roleName, + live.areaName, + live.platName, + live.qrUrl, + live.bindConfirmed, + live.executionStatus === 'completed', + now, + ], + ) + if (nextStatus !== task.status) { + await appendEvent(client, task.id, 'status_changed', 'integration', { + fromStatus: task.status, + toStatus: nextStatus, + bindPhase: live.bindPhase, + }) + } + }) + const updated = await loadTask(task.id) + return { task: updated, live, comparison: compareCustomerRole(updated, live) } +} + +async function ensureLiveSession(task: DouyuTaskRow) { + const live = await liveHubRequest( + '/api/integration/platform-fulfillment/customer-sessions/ensure', + { + method: 'POST', + body: { + source_order_item_id: String(task.order_item_id), + platform_order_id: task.platform_order_id, + }, + }, + ) + return applyLiveState(task, live) +} + +export async function getCustomerDouyuFulfillment(orderNo: string) { + const task = await loadTaskByOrderNo(orderNo) + if (!task.customer_link_opened_at) { + await withTransaction(async (client) => { + await client.query( + `UPDATE douyu_fulfillment_tasks + SET customer_link_opened_at = COALESCE(customer_link_opened_at, NOW()) + WHERE id = $1`, + [task.id], + ) + await appendEvent(client, task.id, 'customer_link_opened', 'customer') + }) + } + const session = await ensureLiveSession(task) + return { + task: session.task, + live: session.live, + comparison: session.comparison, + linkPath: `/coll/d/${encodeURIComponent(task.platform_order_id)}`, + } +} + +export async function saveDouyuCustomerProfile( + orderNo: string, + input: { roleName?: unknown; platform?: unknown; system?: unknown }, +) { + const task = await loadTaskByOrderNo(orderNo) + if (task.status === 'completed' || task.status === 'cancelled') { + throw createHttpError('当前订单已结束,不能修改资料', { + statusCode: 409, + errorCode: 'douyu_fulfillment_closed', + }) + } + const roleName = String(input.roleName ?? '') + .trim() + .slice(0, 100) + const platform = String(input.platform ?? '') + .trim() + .toLowerCase() + const system = String(input.system ?? '') + .trim() + .toLowerCase() + if (!roleName || !['wechat', 'qq'].includes(platform) || !['ios', 'android'].includes(system)) { + throw createHttpError('请完整填写角色名、微信/QQ 和苹果/安卓', { + statusCode: 400, + errorCode: 'douyu_customer_profile_invalid', + }) + } + await withTransaction(async (client) => { + await client.query( + ` + UPDATE douyu_fulfillment_tasks + SET customer_role_name = $2, + customer_platform = $3, + customer_system = $4, + status = CASE WHEN status = 'waiting_profile' THEN 'preparing' ELSE status END, + updated_at = NOW() + WHERE id = $1 + `, + [task.id, roleName, platform, system], + ) + await appendEvent(client, task.id, 'customer_profile_saved', 'customer', { + roleName, + platform, + system, + }) + }) + return getCustomerDouyuFulfillment(orderNo) +} + +export async function startDouyuCustomerBinding(orderNo: string, forceRefresh = false) { + let task = await loadTaskByOrderNo(orderNo) + const session = await ensureLiveSession(task) + task = session.task + if (!task.live_session_id) { + throw createHttpError('直播账号履约会话尚未准备完成', { + statusCode: 409, + errorCode: 'douyu_live_session_not_ready', + }) + } + const live = await liveHubRequest( + `/api/integration/platform-fulfillment/customer-sessions/${task.live_session_id}/binding/start`, + { method: 'POST', body: { force_refresh: forceRefresh } }, + ) + return applyLiveState(task, live) +} + +export async function refreshDouyuCustomerBinding(orderNo: string) { + const task = await loadTaskByOrderNo(orderNo) + if (!task.live_session_id) return ensureLiveSession(task) + const live = await liveHubRequest( + `/api/integration/platform-fulfillment/customer-sessions/${task.live_session_id}/status`, + ) + return applyLiveState(task, live) +} + +export async function confirmDouyuCustomerBinding(orderNo: string) { + const refreshed = await refreshDouyuCustomerBinding(orderNo) + if (!refreshed.comparison.matched) { + throw createHttpError(refreshed.comparison.message, { + statusCode: 409, + errorCode: 'douyu_customer_role_mismatch', + }) + } + const task = refreshed.task + if (!task.live_session_id) { + throw createHttpError('直播账号履约会话尚未准备完成', { + statusCode: 409, + errorCode: 'douyu_live_session_not_ready', + }) + } + const live = await liveHubRequest( + `/api/integration/platform-fulfillment/customer-sessions/${task.live_session_id}/binding/confirm`, + { method: 'POST' }, + ) + return applyLiveState(task, live) +} + +export async function listDouyuFulfillmentTasks( + input: { + keyword?: unknown + status?: unknown + page?: unknown + pageSize?: unknown + } = {}, +) { + await ensureDouyuFulfillmentTasks() + const page = Math.max(1, Number(input.page || 1)) + const pageSize = Math.max(1, Math.min(100, Number(input.pageSize || 20))) + const keyword = String(input.keyword || '').trim() + const status = String(input.status || '').trim() + const params: unknown[] = [] + const filters: string[] = [] + if (keyword) { + params.push(`%${keyword}%`) + filters.push(`( + o.platform_order_id ILIKE $${params.length} + OR oi.sku_name ILIKE $${params.length} + OR task.customer_role_name ILIKE $${params.length} + )`) + } + if (status) { + params.push(status) + filters.push(`task.status = $${params.length}`) + } + const where = filters.length ? `WHERE ${filters.join(' AND ')}` : '' + const count = await query<{ total: number }>( + `SELECT COUNT(*)::int AS total + FROM douyu_fulfillment_tasks task + JOIN orders o ON o.id = task.order_id + JOIN order_items oi ON oi.id = task.order_item_id + ${where}`, + params, + ) + params.push(pageSize, (page - 1) * pageSize) + const rows = await query( + `${TASK_SELECT} + ${where} + ORDER BY task.updated_at DESC, task.id DESC + LIMIT $${params.length - 1} OFFSET $${params.length}`, + params, + ) + return { + items: rows.rows.map((task) => ({ + ...task, + linkPath: `/coll/d/${encodeURIComponent(task.platform_order_id)}`, + })), + pagination: { page, pageSize, total: Number(count.rows[0]?.total || 0) }, + } +} + +export async function getDouyuFulfillmentDetail(orderNo: string) { + const task = await loadTaskByOrderNo(orderNo) + const [session, events] = await Promise.all([ + ensureLiveSession(task), + query<{ + id: number + event_type: string + actor_type: string + detail_json: Record + created_at: string + }>( + `SELECT id, event_type, actor_type, detail_json, created_at + FROM douyu_fulfillment_events + WHERE task_id = $1 + ORDER BY id DESC + LIMIT 200`, + [task.id], + ), + ]) + return { + ...session, + linkPath: `/coll/d/${encodeURIComponent(task.platform_order_id)}`, + events: events.rows, + } +} diff --git a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts new file mode 100644 index 00000000..697721a3 --- /dev/null +++ b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts @@ -0,0 +1,39 @@ +import assert from 'node:assert/strict' +import test from 'node:test' + +import { compareCustomerRole } from './douyu-fulfillment-service.js' + +const task = { + customer_role_name: '狗鼻子弗尼亚bd', + customer_platform: 'wechat', + customer_system: 'android', +} as never + +const live = { + roleName: '狗鼻子弗尼亚bd', + areaName: '微信', + platName: '安卓(android)', +} as never + +test('斗鱼客户资料与平台角色一致', () => { + const result = compareCustomerRole(task, live) + assert.equal(result.matched, true) + assert.equal(result.roleMatched, true) + assert.equal(result.channelMatched, true) +}) + +test('斗鱼客户资料平台或系统不一致时禁止确认', () => { + const result = compareCustomerRole(task, { + ...live, + areaName: 'QQ', + platName: '苹果(iOS)', + } as never) + assert.equal(result.matched, false) + assert.equal(result.channelMatched, false) +}) + +test('斗鱼客户资料角色名不一致时禁止确认', () => { + const result = compareCustomerRole(task, { ...live, roleName: '另一个角色' } as never) + assert.equal(result.matched, false) + assert.equal(result.roleMatched, false) +}) diff --git a/apps/frontend/src/App.tsx b/apps/frontend/src/App.tsx index 8af034c3..0ddd7b77 100644 --- a/apps/frontend/src/App.tsx +++ b/apps/frontend/src/App.tsx @@ -12,7 +12,10 @@ import { import { getAdminRole, hasAdminSession } from '@/utils/admin-auth' import { isClaimPath, isH5ClaimPath } from '@/utils/claim-path' -import { isCustomerFulfillmentPath } from '@/utils/customer-fulfillment-link' +import { + isCustomerFulfillmentPath, + isDouyuFulfillmentPath, +} from '@/utils/customer-fulfillment-link' import { isLegacySupplementPath, isOrderServicePath, @@ -44,6 +47,7 @@ const AdminPlatformShopsPage = lazy(() => import('@/pages/admin/platform/AdminPl const AdminTaskDetailPage = lazy(() => import('@/pages/admin/AdminTaskDetailPage')) const AdminTasksPage = lazy(() => import('@/pages/admin/AdminTasksPage')) const AdminSemiAutoTasksPage = lazy(() => import('@/pages/admin/AdminSemiAutoTasksPage')) +const AdminDouyuFulfillmentPage = lazy(() => import('@/pages/admin/AdminDouyuFulfillmentPage')) const AdminUsersPage = lazy(() => import('@/pages/admin/AdminUsersPage')) const AdminDevMockPage = lazy(() => import('@/pages/admin/AdminDevMockPage')) const AdminWorkerPlatformPage = lazy(() => import('@/pages/admin/AdminWorkerPlatformPage')) @@ -53,6 +57,7 @@ const OrderServicePage = lazy(() => import('@/pages/public/OrderServicePage')) const CustomerFulfillmentPage = lazy( () => import('@/pages/customer-fulfillment/CustomerFulfillmentPage'), ) +const DouyuFulfillmentPage = lazy(() => import('@/pages/douyu-fulfillment/DouyuFulfillmentPage')) const NotFoundPage = lazy(() => import('@/pages/NotFoundPage')) const RedeemPage = lazy(() => import('@/pages/redeem/RedeemPage')) const WorkerHallPage = lazy(() => import('@/pages/worker/WorkerHallPage')) @@ -136,6 +141,10 @@ export default function App() { return } + if (isDouyuFulfillmentPath(window.location.pathname)) { + return + } + if (isCustomerFulfillmentPath(window.location.pathname)) { return } @@ -152,6 +161,20 @@ export default function App() { return } +function DouyuFulfillmentApplication() { + useClearStrayHash() + return ( + + }> + + } /> + } /> + + + + ) +} + function OrderServiceApplication() { useClearStrayHash() return ( @@ -214,6 +237,7 @@ function AdminApplication() { } /> } /> } /> + } /> }> } /> diff --git a/apps/frontend/src/layouts/AdminLayout.tsx b/apps/frontend/src/layouts/AdminLayout.tsx index 5d28d6e2..a2e8e8c6 100644 --- a/apps/frontend/src/layouts/AdminLayout.tsx +++ b/apps/frontend/src/layouts/AdminLayout.tsx @@ -17,6 +17,7 @@ import { SettingOutlined, SoundOutlined, TeamOutlined, + ThunderboltOutlined, TrophyOutlined, UnorderedListOutlined, UserOutlined, @@ -252,6 +253,11 @@ export default function AdminLayout() { icon: , label: '半自动履约', }, + { + key: '/admin/douyu-fulfillment', + icon: , + label: '斗鱼领取', + }, { key: '/admin/worker-platform', icon: , label: '接单平台' }, { key: '/admin/kuaishou-industry', @@ -274,6 +280,11 @@ export default function AdminLayout() { icon: , label: '半自动履约', }, + { + key: '/admin/douyu-fulfillment', + icon: , + label: '斗鱼领取', + }, { key: '/admin/worker-platform', icon: , label: '接单平台' }, { key: '/admin/kuaishou-industry', diff --git a/apps/frontend/src/pages/admin/AdminDevMockPage.tsx b/apps/frontend/src/pages/admin/AdminDevMockPage.tsx index 06d6e391..89f0c0a2 100644 --- a/apps/frontend/src/pages/admin/AdminDevMockPage.tsx +++ b/apps/frontend/src/pages/admin/AdminDevMockPage.tsx @@ -551,6 +551,8 @@ function AffiliateDashResultCard({ result }: { result: DevMockCreateResult }) { } function DouyuFulfillmentResultCard({ result }: { result: DevDouyuFulfillmentMockResult }) { + const { message } = App.useApp() + const customerUrl = `${window.location.origin}${result.customerPath}` return ( 打开订单}> @@ -576,6 +578,14 @@ function DouyuFulfillmentResultCard({ result }: { result: DevDouyuFulfillmentMoc 履约单
#{result.fulfillmentId}
+ + 客户领取链接 + + + {customerUrl} + + + + + + + + +
) diff --git a/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx b/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx new file mode 100644 index 00000000..7caa8f3d --- /dev/null +++ b/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx @@ -0,0 +1,390 @@ +import { + CopyOutlined, + LinkOutlined, + ReloadOutlined, + SyncOutlined, + ThunderboltOutlined, +} from '@ant-design/icons' +import { + Alert, + App, + Button, + Card, + Descriptions, + Drawer, + Input, + Select, + Space, + Tag, + Timeline, + Typography, +} from 'antd' +import type { TableColumnsType } from 'antd' +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' +import { useState } from 'react' + +import PageHeader from '@/components/admin/PageHeader' +import PercentTable from '@/components/common/PercentTable' +import { + fetchAdminDouyuFulfillmentDetail, + fetchAdminDouyuFulfillmentTasks, + refreshAdminDouyuBinding, + restartAdminDouyuBinding, + syncAdminDouyuFulfillmentTasks, +} from '@/services/admin' +import type { DouyuFulfillmentTask } from '@/types/douyu-fulfillment' +import { formatAdminDateTime } from '@/utils/admin-time' + +const { Text } = Typography + +const STATUS_LABELS: Record = { + waiting_profile: '待客户填资料', + preparing: '准备账号', + qr_pending: '待扫码', + role_ready: '待确认角色', + bound: '角色已绑定', + waiting_operator: '待运营处理', + processing: '处理中', + completed: '已完成', + failed: '失败', + manual_required: '人工处理', + cancelled: '已取消', +} + +const STATUS_COLORS: Record = { + waiting_profile: 'blue', + preparing: 'gold', + qr_pending: 'cyan', + role_ready: 'orange', + bound: 'green', + waiting_operator: 'volcano', + processing: 'processing', + completed: 'success', + failed: 'error', + manual_required: 'warning', + cancelled: 'default', +} + +const PLATFORM_LABELS: Record = { + wechat: '微信', + qq: 'QQ', +} + +const SYSTEM_LABELS: Record = { + ios: '苹果', + android: '安卓', +} + +export default function AdminDouyuFulfillmentPage() { + const { message } = App.useApp() + const queryClient = useQueryClient() + const [keyword, setKeyword] = useState('') + const [status, setStatus] = useState('') + const [page, setPage] = useState(1) + const [pageSize, setPageSize] = useState(20) + const [detailOrderNo, setDetailOrderNo] = useState('') + + const listQuery = useQuery({ + queryKey: ['admin-douyu-fulfillment', keyword, status, page, pageSize], + queryFn: () => + fetchAdminDouyuFulfillmentTasks({ + keyword: keyword.trim() || undefined, + status: status || undefined, + page, + pageSize, + }), + refetchInterval: 5000, + }) + const detailQuery = useQuery({ + queryKey: ['admin-douyu-fulfillment-detail', detailOrderNo], + queryFn: () => fetchAdminDouyuFulfillmentDetail(detailOrderNo), + enabled: Boolean(detailOrderNo), + refetchInterval: detailOrderNo ? 3000 : false, + }) + + const list = listQuery.data?.data.items || [] + const pagination = listQuery.data?.data.pagination + const detail = detailQuery.data?.data + + async function refreshAll() { + await Promise.all([ + queryClient.invalidateQueries({ queryKey: ['admin-douyu-fulfillment'] }), + detailOrderNo + ? queryClient.invalidateQueries({ + queryKey: ['admin-douyu-fulfillment-detail', detailOrderNo], + }) + : Promise.resolve(), + ]) + } + + const syncMutation = useMutation({ + mutationFn: syncAdminDouyuFulfillmentTasks, + onSuccess: async (response) => { + message.success(`同步完成:新增 ${response.data.created},更新 ${response.data.updated}`) + await refreshAll() + }, + onError: (error) => message.error(error instanceof Error ? error.message : '同步失败'), + }) + const refreshMutation = useMutation({ + mutationFn: refreshAdminDouyuBinding, + onSuccess: async () => { + message.success('绑定状态已刷新') + await refreshAll() + }, + onError: (error) => message.error(error instanceof Error ? error.message : '刷新失败'), + }) + const restartMutation = useMutation({ + mutationFn: restartAdminDouyuBinding, + onSuccess: async () => { + message.success('已重新生成绑定二维码') + await refreshAll() + }, + onError: (error) => message.error(error instanceof Error ? error.message : '重新生成失败'), + }) + + async function copyLink(task: DouyuFulfillmentTask) { + const url = `${window.location.origin}${task.linkPath}` + try { + await navigator.clipboard.writeText(url) + message.success('客户领取链接已复制') + } catch { + message.error('复制失败,请手动复制') + } + } + + const columns: TableColumnsType = [ + { + title: '订单 / 商品', + key: 'order', + width: 280, + render: (_, task) => ( + + {task.platform_order_id} + {task.product_name || task.sku_name || task.sku_code} + 订单项 #{task.order_item_id} + + ), + }, + { + title: '客户资料', + key: 'profile', + width: 220, + render: (_, task) => + task.customer_role_name ? ( + + {task.customer_role_name} + + {PLATFORM_LABELS[task.customer_platform] || '-'} ·{' '} + {SYSTEM_LABELS[task.customer_system] || '-'} + + + ) : ( + 待客户填写 + ), + }, + { + title: '绑定角色', + key: 'boundRole', + width: 220, + render: (_, task) => + task.bound_role_name ? ( + + {task.bound_role_name} + + {[task.bound_area_name, task.bound_plat_name].filter(Boolean).join(' · ') || '-'} + + + ) : ( + 未识别 + ), + }, + { + title: '状态', + dataIndex: 'status', + width: 140, + render: (value: string) => ( + {STATUS_LABELS[value] || value} + ), + }, + { + title: '更新时间', + dataIndex: 'updated_at', + width: 165, + render: (value: string) => formatAdminDateTime(value), + }, + { + title: '操作', + key: 'actions', + width: 360, + render: (_, task) => ( + + + + + + ), + }, + ] + + return ( +
+ + + + + { + setKeyword(event.target.value) + setPage(1) + }} + style={{ width: 300 }} + /> + setRoleName(event.target.value)} + placeholder="请输入和平精英角色名" + maxLength={100} + /> + + +
+ ) : ( +
+ + + {!live?.qrUrl && task.status !== 'completed' ? ( +
+

游戏角色绑定二维码

+
+ + 正在准备绑定二维码... +
+ +
+ ) : null} + + {live?.qrUrl && !live.bindConfirmed ? ( +
+

游戏角色绑定二维码

+ {qrImage ? ( + 和平精英角色绑定二维码 + ) : ( +
+ + 正在生成二维码图片... +
+ )} +

+ 请使用微信扫码,并选择与资料一致的和平精英角色。 +

+ {expiresInSeconds > 0 ? ( +
+ 二维码剩余 {Math.ceil(expiresInSeconds / 60)} 分钟 +
+ ) : null} + +
+ + +
+
+ ) : null} + + {live?.bindReadyForConfirm ? ( +
+

核对绑定角色

+

+ 平台识别角色:{live.roleName || '-'} · {live.areaName || '-'} ·{' '} + {live.platName || '-'} +

+

+ 已填资料:{task.customer_role_name} · {platformLabel(task.customer_platform)} ·{' '} + {systemLabel(task.customer_system)} +

+ + + + + +
+ ) : null} +
+ )} + +
+ 资料仅用于本次订单履约。内部账号和登录凭证不会展示给客户。 +
+ + ) +} + +function CustomerFrame({ title, children }: { title: string; children: ReactNode }) { + return ( +
+
+
+
+
+

{title}

+
+
+
+
{children}
+
+
+ ) +} + +function OrderCard({ data }: { data: DouyuCustomerFulfillment }) { + return ( +
+

订单信息

+
+ 订单号 + {data.task.platform_order_id} +
+
+ 商品 + + {data.task.product_name || data.task.sku_name} × {data.task.quantity} + +
+
+ 状态 + + {STATUS_LABELS[data.task.status] || data.task.status} + +
+
+ ) +} diff --git a/apps/frontend/src/services/admin/cost-center.ts b/apps/frontend/src/services/admin/cost-center.ts index bdff67b0..16e65ad3 100644 --- a/apps/frontend/src/services/admin/cost-center.ts +++ b/apps/frontend/src/services/admin/cost-center.ts @@ -365,6 +365,7 @@ export function saveAdminManualConfig(payload: { semiAutoEnabled?: boolean semiAutoPlatform?: '' | 'huya' | 'weibo' semiAutoConfig?: Record + douyuFulfillmentEnabled?: boolean }) { return apiPost('/api/v1/admin/cost-center/manual-configs', payload) } diff --git a/apps/frontend/src/services/admin/dev-mock.ts b/apps/frontend/src/services/admin/dev-mock.ts index af1b92df..0707555a 100644 --- a/apps/frontend/src/services/admin/dev-mock.ts +++ b/apps/frontend/src/services/admin/dev-mock.ts @@ -83,6 +83,7 @@ export type DevDouyuFulfillmentMockResult = { configId: number mappingId: number skuKey: string + customerPath: string adminPath: string tips: string[] } diff --git a/apps/frontend/src/services/admin/douyu-fulfillment.ts b/apps/frontend/src/services/admin/douyu-fulfillment.ts new file mode 100644 index 00000000..6dea0456 --- /dev/null +++ b/apps/frontend/src/services/admin/douyu-fulfillment.ts @@ -0,0 +1,38 @@ +import { apiGet, apiPost } from '@/lib/http' +import type { DouyuFulfillmentDetail, DouyuFulfillmentTask } from '@/types/douyu-fulfillment' + +export function fetchAdminDouyuFulfillmentTasks(params: { + keyword?: string + status?: string + page?: number + pageSize?: number +}) { + return apiGet<{ + items: DouyuFulfillmentTask[] + pagination: { page: number; pageSize: number; total: number } + }>('/api/v1/admin/douyu-fulfillment/tasks', { params }) +} + +export function syncAdminDouyuFulfillmentTasks() { + return apiPost<{ created: number; updated: number }>('/api/v1/admin/douyu-fulfillment/sync', {}) +} + +export function fetchAdminDouyuFulfillmentDetail(orderNo: string) { + return apiGet( + `/api/v1/admin/douyu-fulfillment/tasks/${encodeURIComponent(orderNo)}`, + ) +} + +export function refreshAdminDouyuBinding(orderNo: string) { + return apiPost( + `/api/v1/admin/douyu-fulfillment/tasks/${encodeURIComponent(orderNo)}/binding/refresh`, + {}, + ) +} + +export function restartAdminDouyuBinding(orderNo: string) { + return apiPost( + `/api/v1/admin/douyu-fulfillment/tasks/${encodeURIComponent(orderNo)}/binding/start`, + { forceRefresh: true }, + ) +} diff --git a/apps/frontend/src/services/admin/index.ts b/apps/frontend/src/services/admin/index.ts index 03b6d796..76c3e50d 100644 --- a/apps/frontend/src/services/admin/index.ts +++ b/apps/frontend/src/services/admin/index.ts @@ -15,3 +15,4 @@ export * from './tasks' export * from './dev-mock' export * from './notifications' export * from './worker-platform' +export * from './douyu-fulfillment' diff --git a/apps/frontend/src/services/douyu-fulfillment.ts b/apps/frontend/src/services/douyu-fulfillment.ts new file mode 100644 index 00000000..1781f729 --- /dev/null +++ b/apps/frontend/src/services/douyu-fulfillment.ts @@ -0,0 +1,46 @@ +import { apiGet, apiPost } from '@/lib/http' +import type { + DouyuCustomerFulfillment, + DouyuCustomerPlatform, + DouyuCustomerSystem, +} from '@/types/douyu-fulfillment' + +export function fetchDouyuFulfillment(orderNo: string) { + return apiGet( + `/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}`, + ) +} + +export function saveDouyuProfile( + orderNo: string, + input: { + roleName: string + platform: DouyuCustomerPlatform + system: DouyuCustomerSystem + }, +) { + return apiPost( + `/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/profile`, + input, + ) +} + +export function startDouyuBinding(orderNo: string, forceRefresh = false) { + return apiPost( + `/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/binding/start`, + { forceRefresh }, + ) +} + +export function pollDouyuBinding(orderNo: string) { + return apiGet( + `/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/binding/status`, + ) +} + +export function confirmDouyuBinding(orderNo: string) { + return apiPost( + `/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/binding/confirm`, + {}, + ) +} diff --git a/apps/frontend/src/types/admin/cost-center.ts b/apps/frontend/src/types/admin/cost-center.ts index 122490b5..63eb7d7e 100644 --- a/apps/frontend/src/types/admin/cost-center.ts +++ b/apps/frontend/src/types/admin/cost-center.ts @@ -432,6 +432,7 @@ export interface ManualFulfillmentConfig { enabled: boolean semiAutoEnabled: boolean semiAutoPlatform: '' | 'huya' | 'weibo' + douyuFulfillmentEnabled: boolean semiAutoConfig: { pageTitle?: string pageDescription?: string diff --git a/apps/frontend/src/types/douyu-fulfillment.ts b/apps/frontend/src/types/douyu-fulfillment.ts new file mode 100644 index 00000000..282d4399 --- /dev/null +++ b/apps/frontend/src/types/douyu-fulfillment.ts @@ -0,0 +1,89 @@ +export type DouyuCustomerPlatform = 'wechat' | 'qq' +export type DouyuCustomerSystem = 'ios' | 'android' + +export type DouyuFulfillmentTask = { + id: number + order_id: number + order_item_id: number + fulfillment_id: number | null + live_session_id: number | null + status: string + customer_role_name: string + customer_platform: string + customer_system: string + binding_phase: string + live_execution_status: string + live_binding_status: string + issue_code: string + last_error: string + bound_role_name: string + bound_area_name: string + bound_plat_name: string + customer_link_opened_at: string | null + binding_started_at: string | null + bound_at: string | null + completed_at: string | null + last_synced_at: string | null + created_at: string + updated_at: string + platform_order_id: string + sku_code: string + sku_name: string + quantity: number + product_name: string + fulfillment_status: string + linkPath: string +} + +export type DouyuLiveBindingState = { + sessionId: number + platformOrderId: string + sourceOrderItemId: string + productName: string + quantity: number + executionStatus: string + bindingStatus: string + exchangeStatus: string + issueCode: string + message: string + accountReady: boolean + bindTaskId: number | null + bindTaskStatus: string + bindPhase: string + qrUrl: string + qrGeneratedAt: string + qrExpiresAt: string + roleName: string + areaName: string + platName: string + bindReadyForConfirm: boolean + bindConfirmed: boolean + completedAt: string | null + updatedAt: string +} + +export type DouyuRoleComparison = { + matched: boolean + roleMatched: boolean + channelMatched: boolean + message: string +} + +export type DouyuCustomerFulfillment = { + task: DouyuFulfillmentTask + live: DouyuLiveBindingState + comparison: DouyuRoleComparison + linkPath: string +} + +export type DouyuFulfillmentEvent = { + id: number + event_type: string + actor_type: string + detail_json: Record + created_at: string +} + +export type DouyuFulfillmentDetail = DouyuCustomerFulfillment & { + events: DouyuFulfillmentEvent[] +} diff --git a/apps/frontend/src/utils/customer-fulfillment-link.ts b/apps/frontend/src/utils/customer-fulfillment-link.ts index 295a3c91..c1535659 100644 --- a/apps/frontend/src/utils/customer-fulfillment-link.ts +++ b/apps/frontend/src/utils/customer-fulfillment-link.ts @@ -20,6 +20,21 @@ export function isCustomerFulfillmentPath(pathname: unknown): boolean { return first === 'c' || first === 'd' } +/** 斗鱼客户领取入口:/coll/d/:orderNo。 */ +export function buildDouyuFulfillmentPath(orderNo: unknown): string { + const normalizedOrderNo = String(orderNo || '').trim() + return normalizedOrderNo ? `/coll/d/${encodeURIComponent(normalizedOrderNo)}` : '' +} + +export function isDouyuFulfillmentPath(pathname: unknown): boolean { + const parts = String(pathname || '') + .trim() + .split(/[?#]/)[0] + .split('/') + .filter(Boolean) + return parts[0] === 'coll' && parts[1] === 'd' +} + /** * 严格绑定下的自动归一化:当前路径对应平台没有任务、但订单只有另一个平台任务时, * 返回应跳转的平台;双平台订单返回 null(各路径只展示自己的任务), diff --git a/apps/frontend/tests/customer-fulfillment-link.test.ts b/apps/frontend/tests/customer-fulfillment-link.test.ts index 4b724053..5838cd68 100644 --- a/apps/frontend/tests/customer-fulfillment-link.test.ts +++ b/apps/frontend/tests/customer-fulfillment-link.test.ts @@ -3,8 +3,10 @@ import { readFile } from 'node:fs/promises' import test from 'node:test' import { + buildDouyuFulfillmentPath, buildCustomerFulfillmentPath, isCustomerFulfillmentPath, + isDouyuFulfillmentPath, resolveCustomerPlatformRedirect, } from '../src/utils/customer-fulfillment-link.ts' @@ -29,6 +31,15 @@ test('客户半自动履约入口不误伤相似前缀和其他路径', () => { assert.equal(isCustomerFulfillmentPath('d/1'), false) }) +test('斗鱼领取入口固定为 /coll/d/订单号', () => { + assert.equal(buildDouyuFulfillmentPath('DY-001'), '/coll/d/DY-001') + assert.equal(buildDouyuFulfillmentPath(''), '') + assert.equal(isDouyuFulfillmentPath('/coll/d/DY-001'), true) + assert.equal(isDouyuFulfillmentPath('/coll/d/DY-001?from=chat'), true) + assert.equal(isDouyuFulfillmentPath('/coll/other/DY-001'), false) + assert.equal(isDouyuFulfillmentPath('/admin/coll/d/DY-001'), false) +}) + test('按平台生成客户链接:虎牙 /c、微博 /d', () => { assert.equal( buildCustomerFulfillmentPath('INTSA1794902905684_360848', 'huya'), @@ -80,6 +91,7 @@ test('客户页路由与严格绑定接线', async () => { assert.match(page, /resolveCustomerPlatformRedirect/) assert.match(page, /buildCustomerFulfillmentPath/) assert.match(page, /task\.platform === expectedPlatform/) + assert.match(app, /path="\/coll\/d\/:orderNo"/) }) test('开发 Mock 页按平台重新生成客户路径', async () => { diff --git a/docker-compose.yml b/docker-compose.yml index 7112f9f5..e3b04ae3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -141,6 +141,8 @@ services: SEMI_AUTO_CONNECTOR_API_KEY: ${SEMI_AUTO_CONNECTOR_API_KEY:-} SEMI_AUTO_DEFAULT_CONNECTOR_MODE: ${SEMI_AUTO_DEFAULT_CONNECTOR_MODE:-embedded} SEMI_AUTO_CONNECTOR_TIMEOUT_MS: ${SEMI_AUTO_CONNECTOR_TIMEOUT_MS:-15000} + LIVE_HUB_PLATFORM_FULFILLMENT_URL: ${LIVE_HUB_PLATFORM_FULFILLMENT_URL:-http://host.docker.internal:8800} + PLATFORM_FULFILLMENT_INTEGRATION_KEY: ${PLATFORM_FULFILLMENT_INTEGRATION_KEY:-} logging: *json-log-rotation volumes: - ./apps/backend/data:/app/data diff --git a/docs/斗鱼客户领取与角色绑定.md b/docs/斗鱼客户领取与角色绑定.md new file mode 100644 index 00000000..18b50507 --- /dev/null +++ b/docs/斗鱼客户领取与角色绑定.md @@ -0,0 +1,79 @@ +# 斗鱼客户领取与角色绑定 + +更新时间:2026-11-17 + +## 入口 + +客户领取链接固定为: + +```text +<域名>/coll/d/<订单号> +``` + +例如: + +```text +https://order.khhao.com/coll/d/COLLD-E2E-001 +``` + +## 职责 + +- `order_site`:订单读取、客户资料、客户领取页、运营工作台和状态时间线。 +- `live-hub`:内部斗鱼账号、CK、二维码生成、角色识别、绑定确认、积分和兑换。 +- 客户不提交 CK,也不会看到内部账号、积分、租约或限兑信息。 + +## 客户流程 + +1. 打开 `/coll/d/<订单号>`。 +2. 填写游戏角色名、微信/QQ、苹果/安卓。 +3. `order_site` 通过服务端接口通知 live-hub 准备订单和内部账号。 +4. live-hub 返回安全绑定状态和二维码。 +5. 客户微信扫码选择和平精英角色。 +6. 平台角色与客户资料一致后,客户确认绑定。 +7. 绑定完成后等待运营在 live-hub 人工兑换。 + +斗鱼接口没有游戏 UID / 角色 ID。资料核对只使用角色名、平台和系统区服。 + +## 状态 + +```text +waiting_profile +preparing +qr_pending +role_ready +bound +waiting_operator +processing +completed +failed +manual_required +cancelled +``` + +最终绑定只认 `bindAct=1`。`bindRole=1, bindAct=0` 表示已识别角色但尚未最终确认。 + +## 环境变量 + +`order_site`: + +```env +LIVE_HUB_PLATFORM_FULFILLMENT_URL=http://127.0.0.1:8800 +PLATFORM_FULFILLMENT_INTEGRATION_KEY=<共享密钥> +``` + +`live-hub`: + +```env +PLATFORM_FULFILLMENT_INTEGRATION_KEY=<共享密钥> +PLATFORM_FULFILLMENT_INTEGRATION_ACTOR_ID= +PLATFORM_BINDING_QR_TTL_SECONDS=600 +``` + +集成操作人不填时,live-hub 使用最早创建的有效超级管理员。 + +## 数据边界 + +- `douyu_fulfillment_tasks` 只保存客户资料和 live-hub 安全状态投影。 +- `live_session_id` 指向 live-hub 履约任务。 +- 二维码原始 URL 由 live-hub 返回,不在 order_site 数据库长期保存。 +- 内部账号、Cookie、积分和租约不得进入 order_site 客户接口。 From f18bdac20693652c1d97c43169a0bc3b0a445a6f Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 19:10:40 +0800 Subject: [PATCH 03/17] =?UTF-8?q?style(douyu):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E9=A2=86=E5=8F=96=E4=BA=8C=E7=BB=B4=E7=A0=81?= =?UTF-8?q?=E6=B7=B1=E8=89=B2=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DouyuFulfillmentPage.tsx | 30 ++++--- apps/frontend/src/styles/client.css | 85 +++++++++++++++++++ 2 files changed, 102 insertions(+), 13 deletions(-) diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index 2e901208..10bac23f 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -134,7 +134,7 @@ export default function DouyuFulfillmentPage() { void QRCode.toDataURL(url, { width: 320, margin: 2, - color: { dark: '#111827', light: '#ffffff' }, + color: { dark: '#111827', light: '#e8ebef' }, }).then(setQrImage) }, [live?.qrUrl]) @@ -343,9 +343,11 @@ export default function DouyuFulfillmentPage() { {!live?.qrUrl && task.status !== 'completed' ? (

游戏角色绑定二维码

-
- - 正在准备绑定二维码... +
+
+ + 正在准备绑定二维码... +
)} - -
- 资料仅用于本次订单履约。内部账号和登录凭证不会展示给客户。 -
) } @@ -465,6 +461,7 @@ function CustomerFrame({ title, children }: { title: string; children: ReactNode +
温馨提示:未成年人禁止下单
{children}
diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index 93e411ee..89ab9be6 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -2957,6 +2957,107 @@ background: #343c4a; } +.customer-auth-page.is-douyu .customer-auth-hero { + min-height: 156px; + align-items: flex-end; + padding: 72px 18px 24px; + background-color: #111827; + background-image: + linear-gradient(180deg, rgba(11, 18, 32, 0.08) 0%, rgba(11, 18, 32, 0.56) 68%, #232936 100%), + url('/images/customer/inside-kv.jpg'); + background-repeat: no-repeat; + background-position: center 38%; + background-size: cover; +} + +.customer-auth-page.is-douyu .customer-auth-brand h1 { + text-shadow: 0 2px 12px rgba(0, 0, 0, 0.82); +} + +.customer-auth-page.is-douyu .customer-auth-warning { + padding-top: 12px; +} + +.customer-auth-page.is-douyu .customer-collect-body .ant-segmented { + overflow: hidden; + padding: 4px; + border: 1px solid #354052; + border-radius: 12px; + background: #171d27; +} + +.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-group { + overflow: hidden; + border-radius: 9px; +} + +.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item { + color: #aeb8c8; + border-radius: 9px; + transition: color 140ms ease; +} + +.customer-auth-page.is-douyu + .customer-collect-body + .ant-segmented-item:hover:not(.ant-segmented-item-selected) { + color: #e2e8f0; + background: #242c39; +} + +.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item-selected { + color: #fff; + background: #2f6fed; + box-shadow: none; +} + +.customer-auth-page.is-douyu + .customer-collect-body + .ant-segmented-item-selected + .ant-segmented-item-label { + color: #fff; + font-weight: 700; +} + +.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb { + background: #2f6fed; + box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); + backface-visibility: hidden; + transform: translateZ(0); +} + +.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb-motion-appear-active { + will-change: transform; + transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1) !important; +} + +.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item-label { + transition: color 140ms ease; +} + +@media (prefers-reduced-motion: reduce) { + .customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb-motion-appear-active { + transition: none !important; + } +} + +.customer-auth-page.is-douyu .customer-collect-submit.ant-btn { + height: 52px; + margin-top: 14px; + color: #fff !important; + border-color: #2f6fed !important; + border-radius: 12px; + background: #2f6fed !important; + font-size: 16px; + font-weight: 700; +} + +.customer-auth-page.is-douyu .customer-collect-submit.ant-btn:hover, +.customer-auth-page.is-douyu .customer-collect-submit.ant-btn:focus-visible { + color: #fff !important; + border-color: #4a83ff !important; + background: #4a83ff !important; +} + .customer-binding-next.ant-btn { width: 100%; height: 52px; From fcc66b2669590d732a3b808c899727274b2bb034 Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 19:19:59 +0800 Subject: [PATCH 05/17] =?UTF-8?q?fix(douyu):=20=E7=A7=BB=E9=99=A4=E9=A2=86?= =?UTF-8?q?=E5=8F=96=E9=A1=B5=E5=88=87=E6=8D=A2=E6=BB=91=E5=9D=97=E5=8A=A8?= =?UTF-8?q?=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DouyuFulfillmentPage.tsx | 41 +++++++++--- apps/frontend/src/styles/client.css | 62 +++++++------------ 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index a4e29da2..0aceadea 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -5,7 +5,7 @@ import { QrcodeOutlined, ReloadOutlined, } from '@ant-design/icons' -import { Alert, App, Button, Image, Input, Progress, Segmented, Space, Spin } from 'antd' +import { Alert, App, Button, Image, Input, Progress, Space, Spin } from 'antd' import QRCode from 'qrcode' import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react' import { useParams } from 'react-router' @@ -290,20 +290,20 @@ export default function DouyuFulfillmentPage() {
- setPlatform(value as DouyuCustomerPlatform)} + onChange={setPlatform} options={[ { label: '微信', value: 'wechat' }, { label: 'QQ', value: 'qq' }, ]} /> - setSystem(value as DouyuCustomerSystem)} + onChange={setSystem} options={[ { label: '安卓', value: 'android' }, { label: '苹果', value: 'ios' }, @@ -450,6 +450,33 @@ export default function DouyuFulfillmentPage() { ) } +function ChoiceSwitch(input: { + value: T + options: ReadonlyArray<{ label: string; value: T }> + ariaLabel: string + onChange: (value: T) => void +}) { + return ( +
+ {input.options.map((option) => { + const selected = input.value === option.value + return ( + + ) + })} +
+ ) +} + function CustomerFrame({ title, children }: { title: string; children: ReactNode }) { return (
diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index 89ab9be6..c92a741a 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -2978,66 +2978,46 @@ padding-top: 12px; } -.customer-auth-page.is-douyu .customer-collect-body .ant-segmented { - overflow: hidden; +.customer-choice-switch { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 4px; padding: 4px; + overflow: hidden; border: 1px solid #354052; border-radius: 12px; background: #171d27; } -.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-group { - overflow: hidden; - border-radius: 9px; -} - -.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item { +.customer-choice-option { + height: 48px; + min-width: 0; + padding: 0 12px; color: #aeb8c8; + border: 0; border-radius: 9px; - transition: color 140ms ease; + outline: none; + background: transparent; + font: inherit; + font-size: 15px; + cursor: pointer; + transition: color 100ms ease; } -.customer-auth-page.is-douyu - .customer-collect-body - .ant-segmented-item:hover:not(.ant-segmented-item-selected) { +.customer-choice-option:hover { color: #e2e8f0; background: #242c39; } -.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item-selected { +.customer-choice-option.is-selected { color: #fff; background: #2f6fed; - box-shadow: none; -} - -.customer-auth-page.is-douyu - .customer-collect-body - .ant-segmented-item-selected - .ant-segmented-item-label { - color: #fff; font-weight: 700; } -.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb { - background: #2f6fed; - box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); - backface-visibility: hidden; - transform: translateZ(0); -} - -.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb-motion-appear-active { - will-change: transform; - transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1) !important; -} - -.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item-label { - transition: color 140ms ease; -} - -@media (prefers-reduced-motion: reduce) { - .customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb-motion-appear-active { - transition: none !important; - } +.customer-choice-option:focus-visible { + outline: 2px solid #60a5fa; + outline-offset: 2px; } .customer-auth-page.is-douyu .customer-collect-submit.ant-btn { From 2fae88ad1856369e5c0eb6f89ec8c7f258cd5906 Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 19:21:14 +0800 Subject: [PATCH 06/17] =?UTF-8?q?style(douyu):=20=E6=94=B6=E7=B4=A7?= =?UTF-8?q?=E9=A2=86=E5=8F=96=E9=A1=B5=E6=A0=87=E9=A2=98=E4=B8=8E=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/frontend/src/styles/client.css | 36 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index c92a741a..481686db 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -2958,9 +2958,10 @@ } .customer-auth-page.is-douyu .customer-auth-hero { - min-height: 156px; - align-items: flex-end; - padding: 72px 18px 24px; + min-height: 148px; + align-items: flex-start; + justify-content: flex-start; + padding: 20px 20px 18px; background-color: #111827; background-image: linear-gradient(180deg, rgba(11, 18, 32, 0.08) 0%, rgba(11, 18, 32, 0.56) 68%, #232936 100%), @@ -2970,7 +2971,16 @@ background-size: cover; } +.customer-auth-page.is-douyu .customer-auth-brand { + width: 100%; + align-items: flex-start; + justify-content: flex-start; +} + .customer-auth-page.is-douyu .customer-auth-brand h1 { + font-size: 18px; + line-height: 1.4; + text-align: left; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.82); } @@ -2981,25 +2991,25 @@ .customer-choice-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 4px; - padding: 4px; + gap: 3px; + padding: 3px; overflow: hidden; border: 1px solid #354052; - border-radius: 12px; + border-radius: 10px; background: #171d27; } .customer-choice-option { - height: 48px; + height: 42px; min-width: 0; - padding: 0 12px; + padding: 0 10px; color: #aeb8c8; border: 0; - border-radius: 9px; + border-radius: 8px; outline: none; background: transparent; font: inherit; - font-size: 15px; + font-size: 14px; cursor: pointer; transition: color 100ms ease; } @@ -3021,13 +3031,13 @@ } .customer-auth-page.is-douyu .customer-collect-submit.ant-btn { - height: 52px; + height: 48px; margin-top: 14px; color: #fff !important; border-color: #2f6fed !important; - border-radius: 12px; + border-radius: 10px; background: #2f6fed !important; - font-size: 16px; + font-size: 15px; font-weight: 700; } From deca06a673ab0e4905f5f21962ea82c386036e28 Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 19:25:28 +0800 Subject: [PATCH 07/17] =?UTF-8?q?feat(douyu):=20=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E5=90=8E=E8=87=AA=E5=8A=A8=E6=94=B6=E8=B5=B7=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DouyuFulfillmentPage.tsx | 33 ++++++++++++++++--- apps/frontend/src/styles/client.css | 19 +++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index 0aceadea..2341e036 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -64,6 +64,7 @@ export default function DouyuFulfillmentPage() { const [platform, setPlatform] = useState('wechat') const [system, setSystem] = useState('android') const [qrImage, setQrImage] = useState('') + const [bindingQrExpanded, setBindingQrExpanded] = useState(false) const [nowMs, setNowMs] = useState(0) const autoStartRef = useRef('') @@ -138,6 +139,10 @@ export default function DouyuFulfillmentPage() { }).then(setQrImage) }, [live?.qrUrl]) + useEffect(() => { + setBindingQrExpanded(false) + }, [live?.bindConfirmed, live?.bindReadyForConfirm, live?.qrUrl]) + useEffect(() => { const tick = () => setNowMs(Date.now()) tick() @@ -172,6 +177,17 @@ export default function DouyuFulfillmentPage() { if (!expiresAt || Number.isNaN(expiresAt)) return 0 return Math.max(0, Math.floor((expiresAt - nowMs) / 1000)) }, [live?.qrExpiresAt, nowMs]) + const canRevealBindingQr = Boolean( + live?.qrUrl && (live.bindReadyForConfirm || live.bindConfirmed), + ) + const showBindingQr = Boolean(live?.qrUrl && (!canRevealBindingQr || bindingQrExpanded)) + const bindingDescription = + live?.message || + (live?.bindReadyForConfirm + ? '已识别游戏角色,请核对并确认绑定。' + : live?.bindConfirmed + ? '角色绑定已完成,等待运营处理。' + : '请使用微信扫描下方二维码,按提示选择和平精英角色。二维码仅用于本次订单。') async function submitProfile() { if (!roleName.trim()) { @@ -334,12 +350,19 @@ export default function DouyuFulfillmentPage() { type={live?.bindConfirmed ? 'success' : 'info'} showIcon message={STATUS_LABELS[task.status] || '等待处理'} - description={ - live?.message || - '请使用微信扫描下方二维码,按提示选择和平精英角色。二维码仅用于本次订单。' - } + description={bindingDescription} /> + {canRevealBindingQr ? ( + + ) : null} + {!live?.qrUrl && task.status !== 'completed' ? (

游戏角色绑定二维码

@@ -360,7 +383,7 @@ export default function DouyuFulfillmentPage() {
) : null} - {live?.qrUrl && !live.bindConfirmed ? ( + {live?.qrUrl && showBindingQr ? (

游戏角色绑定二维码

diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index 481686db..6f2d48da 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -2957,6 +2957,25 @@ background: #343c4a; } +.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn { + align-self: flex-end; + height: 34px; + padding-inline: 12px; + color: #b8c1cf; + border-color: #3f495a; + border-radius: 8px; + background: transparent; + font-size: 13px; + box-shadow: none; +} + +.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn:hover, +.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn:focus-visible { + color: #fff; + border-color: #64748b; + background: #2a313d; +} + .customer-auth-page.is-douyu .customer-auth-hero { min-height: 148px; align-items: flex-start; From 01c5c45e37febcbc996d58257985fc30e0249e8f Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 19:27:53 +0800 Subject: [PATCH 08/17] =?UTF-8?q?fix(douyu):=20=E7=A1=AE=E8=AE=A4=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=90=8E=E4=BB=85=E5=B1=95=E7=A4=BA=E5=AE=A2=E6=9C=8D?= =?UTF-8?q?=E5=A4=84=E7=90=86=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DouyuFulfillmentPage.tsx | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index 2341e036..f6d0a11b 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -32,7 +32,7 @@ const STATUS_LABELS: Record = { qr_pending: '等待扫码绑定', role_ready: '请确认游戏角色', bound: '角色已绑定', - waiting_operator: '等待运营处理', + waiting_operator: '等待客服处理', processing: '正在兑换', completed: '领取完成', failed: '处理失败', @@ -181,13 +181,14 @@ export default function DouyuFulfillmentPage() { live?.qrUrl && (live.bindReadyForConfirm || live.bindConfirmed), ) const showBindingQr = Boolean(live?.qrUrl && (!canRevealBindingQr || bindingQrExpanded)) - const bindingDescription = - live?.message || - (live?.bindReadyForConfirm + const waitingForSupport = Boolean( + task && (live?.bindConfirmed || task.status === 'waiting_operator' || task.status === 'bound'), + ) + const bindingDescription = live?.bindConfirmed + ? '角色绑定已完成,等待客服处理。' + : live?.bindReadyForConfirm ? '已识别游戏角色,请核对并确认绑定。' - : live?.bindConfirmed - ? '角色绑定已完成,等待运营处理。' - : '请使用微信扫描下方二维码,按提示选择和平精英角色。二维码仅用于本次订单。') + : live?.message || '请使用微信扫描下方二维码,按提示选择和平精英角色。二维码仅用于本次订单。' async function submitProfile() { if (!roleName.trim()) { @@ -228,7 +229,7 @@ export default function DouyuFulfillmentPage() { try { const response = await confirmDouyuBinding(orderNo) applyData(response.data) - message.success('角色绑定已确认,等待运营处理') + message.success('角色绑定已确认,等待客服处理') } catch (error) { message.error(error instanceof Error ? error.message : '确认角色绑定失败') } finally { @@ -344,6 +345,10 @@ export default function DouyuFulfillmentPage() {
+ ) : waitingForSupport ? ( +
+ +
) : (
Date: Tue, 17 Nov 2026 19:30:18 +0800 Subject: [PATCH 09/17] =?UTF-8?q?style(douyu):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=A2=86=E5=8F=96=E9=A1=B5=E6=A0=87=E9=A2=98=E5=B1=85=E4=B8=AD?= =?UTF-8?q?=E4=B8=8E=E5=AD=97=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/frontend/src/styles/client.css | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index 6f2d48da..e6ea7b62 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -2979,8 +2979,8 @@ .customer-auth-page.is-douyu .customer-auth-hero { min-height: 148px; align-items: flex-start; - justify-content: flex-start; - padding: 20px 20px 18px; + justify-content: center; + padding: 20px 16px 18px; background-color: #111827; background-image: linear-gradient(180deg, rgba(11, 18, 32, 0.08) 0%, rgba(11, 18, 32, 0.56) 68%, #232936 100%), @@ -2991,15 +2991,15 @@ } .customer-auth-page.is-douyu .customer-auth-brand { - width: 100%; + width: auto; align-items: flex-start; - justify-content: flex-start; + justify-content: center; } .customer-auth-page.is-douyu .customer-auth-brand h1 { - font-size: 18px; + font-size: 16px; line-height: 1.4; - text-align: left; + text-align: center; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.82); } From 4da670ce14f788937d8141bc5192605175d81893 Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 20:01:03 +0800 Subject: [PATCH 10/17] =?UTF-8?q?style(douyu):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=A2=86=E5=8F=96=E9=A1=B5=E6=A0=87=E9=A2=98=E4=B8=8E=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/admin/AdminDouyuFulfillmentPage.tsx | 2 +- .../src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx | 8 ++++---- apps/frontend/src/styles/client.css | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx b/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx index 7caa8f3d..93689e72 100644 --- a/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx @@ -43,7 +43,7 @@ const STATUS_LABELS: Record = { qr_pending: '待扫码', role_ready: '待确认角色', bound: '角色已绑定', - waiting_operator: '待运营处理', + waiting_operator: '待客服处理', processing: '处理中', completed: '已完成', failed: '失败', diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index f6d0a11b..e9811064 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -32,7 +32,7 @@ const STATUS_LABELS: Record = { qr_pending: '等待扫码绑定', role_ready: '请确认游戏角色', bound: '角色已绑定', - waiting_operator: '等待客服处理', + waiting_operator: '待客服处理', processing: '正在兑换', completed: '领取完成', failed: '处理失败', @@ -185,7 +185,7 @@ export default function DouyuFulfillmentPage() { task && (live?.bindConfirmed || task.status === 'waiting_operator' || task.status === 'bound'), ) const bindingDescription = live?.bindConfirmed - ? '角色绑定已完成,等待客服处理。' + ? '角色绑定已完成,待客服处理。' : live?.bindReadyForConfirm ? '已识别游戏角色,请核对并确认绑定。' : live?.message || '请使用微信扫描下方二维码,按提示选择和平精英角色。二维码仅用于本次订单。' @@ -229,7 +229,7 @@ export default function DouyuFulfillmentPage() { try { const response = await confirmDouyuBinding(orderNo) applyData(response.data) - message.success('角色绑定已确认,等待客服处理') + message.success('角色绑定已确认,待客服处理') } catch (error) { message.error(error instanceof Error ? error.message : '确认角色绑定失败') } finally { @@ -347,7 +347,7 @@ export default function DouyuFulfillmentPage() {
) : waitingForSupport ? (
- +
) : (
diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index e6ea7b62..0b0a7480 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -2978,9 +2978,9 @@ .customer-auth-page.is-douyu .customer-auth-hero { min-height: 148px; - align-items: flex-start; + align-items: flex-end; justify-content: center; - padding: 20px 16px 18px; + padding: 0 16px 18px; background-color: #111827; background-image: linear-gradient(180deg, rgba(11, 18, 32, 0.08) 0%, rgba(11, 18, 32, 0.56) 68%, #232936 100%), @@ -2992,7 +2992,7 @@ .customer-auth-page.is-douyu .customer-auth-brand { width: auto; - align-items: flex-start; + align-items: flex-end; justify-content: center; } From b48509c34f85184679040527df55fa0fe5698515 Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 20:01:20 +0800 Subject: [PATCH 11/17] =?UTF-8?q?feat(fulfillment):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=96=97=E9=B1=BC=E5=B7=A5=E4=BD=9C=E5=8F=B0=E5=8F=8C=E5=90=91?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.server.example | 3 +- apps/backend/src/app.integration.test.ts | 46 ++++ apps/backend/src/app.ts | 2 + .../platform-fulfillment-integration.ts | 51 ++++ .../douyu-fulfillment-service.ts | 244 +++++++++++++----- .../douyu-fulfillment.test.ts | 15 +- .../douyu-fulfillment/live-hub-notifier.ts | 54 ++++ 7 files changed, 355 insertions(+), 60 deletions(-) create mode 100644 apps/backend/src/routes/platform-fulfillment-integration.ts create mode 100644 apps/backend/src/services/douyu-fulfillment/live-hub-notifier.ts diff --git a/.env.server.example b/.env.server.example index fd838293..4eb4154f 100644 --- a/.env.server.example +++ b/.env.server.example @@ -24,7 +24,8 @@ HTTP_TRUST_PROXY=1 # Claim Links CLAIM_BASE_URL=https://order.khhao.com/h5 -LIVE_HUB_PLATFORM_FULFILLMENT_URL=https://live.khhao.com +# 生产服务器间优先走私网;直播运营后台私网地址为 172.23.71.41 +LIVE_HUB_PLATFORM_FULFILLMENT_URL=http://172.23.71.41 PLATFORM_FULFILLMENT_INTEGRATION_KEY= CLAIM_TOKEN_TTL_HOURS=0 diff --git a/apps/backend/src/app.integration.test.ts b/apps/backend/src/app.integration.test.ts index 06b8be0d..e045d3fd 100644 --- a/apps/backend/src/app.integration.test.ts +++ b/apps/backend/src/app.integration.test.ts @@ -38,3 +38,49 @@ test('HTTP health route and explicit CORS preflight', async () => { await once(server, 'close') } }) + +test('履约状态集成接口要求密钥并接受空快照', async () => { + const previousKey = process.env.PLATFORM_FULFILLMENT_INTEGRATION_KEY + process.env.PLATFORM_FULFILLMENT_INTEGRATION_KEY = 'integration-test-key' + const startupState = createStartupState() + startupState.core.ready = true + const config = createDefaultRuntimeConfig('/tmp/order-site') + const server = createApp({ + startupState, + isShutdownStarted: () => false, + config, + }).listen(0, '127.0.0.1') + await once(server, 'listening') + + try { + const address = server.address() + assert.ok(address && typeof address === 'object') + const endpoint = `http://127.0.0.1:${address.port}/api/integration/platform-fulfillment/binding-state` + + const unauthorized = await fetch(endpoint, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ items: [] }), + }) + assert.equal(unauthorized.status, 401) + + const accepted = await fetch(endpoint, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-Integration-Key': 'integration-test-key', + }, + body: JSON.stringify({ items: [] }), + }) + assert.equal(accepted.status, 200) + assert.deepEqual((await accepted.json()).data, { received: 0, updated: 0 }) + } finally { + if (previousKey === undefined) { + delete process.env.PLATFORM_FULFILLMENT_INTEGRATION_KEY + } else { + process.env.PLATFORM_FULFILLMENT_INTEGRATION_KEY = previousKey + } + server.close() + await once(server, 'close') + } +}) diff --git a/apps/backend/src/app.ts b/apps/backend/src/app.ts index c16b4f2a..504c7c97 100644 --- a/apps/backend/src/app.ts +++ b/apps/backend/src/app.ts @@ -15,6 +15,7 @@ import douyuFulfillmentRouter from './routes/douyu-fulfillment.js' import kuaishouIndustryRouter from './routes/kuaishou-industry.js' import open91Router from './routes/open-91.js' import pddExtensionRouter from './routes/pdd-extension.js' +import platformFulfillmentIntegrationRouter from './routes/platform-fulfillment-integration.js' import redeemRouter from './routes/redeem.js' import shortLinksRouter from './routes/short-links.js' import semiAutoInjectionsRouter from './routes/semi-auto-injections.js' @@ -117,6 +118,7 @@ export function createApp({ startupState, isShutdownStarted, config }: CreateApp app.use('/api/v1/open/affiliate-dash', affiliateDashRouter) app.use('/api/v1/open/91', open91Router) app.use('/api/v1/open/kuaishou-industry', kuaishouIndustryRouter) + app.use('/api/integration', platformFulfillmentIntegrationRouter) app.use('/api/v1/redeem', redeemRouter) app.use('/api/v1/claim', claimsRouter) app.use('/api/v1/customer-fulfillment', customerFulfillmentRouter) diff --git a/apps/backend/src/routes/platform-fulfillment-integration.ts b/apps/backend/src/routes/platform-fulfillment-integration.ts new file mode 100644 index 00000000..a522379c --- /dev/null +++ b/apps/backend/src/routes/platform-fulfillment-integration.ts @@ -0,0 +1,51 @@ +import { timingSafeEqual } from 'node:crypto' + +import { Router } from 'express' + +import { applyLiveBindingStateSnapshot } from '../services/douyu-fulfillment/douyu-fulfillment-service.js' +import { createRouteHandler } from '../utils/http.js' + +const router = Router() + +router.use('/platform-fulfillment', (req, res, next) => { + const expected = String(process.env.PLATFORM_FULFILLMENT_INTEGRATION_KEY || '').trim() + if (!expected) { + res.status(503).json({ + code: 1, + msg: '直播账号履约集成密钥未配置', + errorCode: 'integration_not_configured', + time: Math.floor(Date.now() / 1000), + data: null, + }) + return + } + + const provided = String(req.header('x-integration-key') || '').trim() + const expectedBuffer = Buffer.from(expected) + const providedBuffer = Buffer.from(provided) + if ( + expectedBuffer.length !== providedBuffer.length || + !timingSafeEqual(expectedBuffer, providedBuffer) + ) { + res.status(401).json({ + code: 1, + msg: '直播账号履约集成鉴权失败', + errorCode: 'integration_unauthorized', + time: Math.floor(Date.now() / 1000), + data: null, + }) + return + } + next() +}) + +router.post( + '/platform-fulfillment/binding-state', + createRouteHandler((req) => applyLiveBindingStateSnapshot(req.body), { + successMessage: '履约状态已同步', + errorMessage: '同步履约状态失败', + scope: '[integration/platform-fulfillment/binding-state]', + }), +) + +export default router diff --git a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts index 84af31e2..ca002bd4 100644 --- a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts +++ b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts @@ -3,6 +3,8 @@ import type { PoolClient } from 'pg' import { query, withTransaction } from '../../db/client.js' import { nowIso } from '../../utils/time.js' import { createHttpError } from '../../utils/http.js' +import { logWarn } from '../../utils/logger.js' +import { notifyLiveHubOrderSyncAsync } from './live-hub-notifier.js' type DouyuTaskRow = { id: number @@ -65,6 +67,17 @@ type LiveBindingState = { updatedAt: string } +type LiveBindingBatchResponse = { + items: LiveBindingState[] +} + +const AUTO_DISCOVERY_INTERVAL_MS = 60_000 +const LIVE_STATE_SYNC_INTERVAL_MS = 60_000 +const TERMINAL_TASK_STATUSES = new Set(['completed', 'cancelled']) + +let lastAutomaticDiscoveryAt = 0 +let automaticDiscoveryInFlight: Promise<{ created: number; updated: number } | null> | null = null + const TASK_SELECT = ` SELECT task.*, @@ -217,9 +230,29 @@ export async function ensureDouyuFulfillmentTasks(orderNo = '') { } } }) + if (created > 0) { + notifyLiveHubOrderSyncAsync({ created, updated: candidates.rows.length - created }) + } return { created, updated: candidates.rows.length - created } } +async function ensureDouyuFulfillmentTasksAutomatically() { + if (automaticDiscoveryInFlight) return automaticDiscoveryInFlight + if (Date.now() - lastAutomaticDiscoveryAt < AUTO_DISCOVERY_INTERVAL_MS) return null + + lastAutomaticDiscoveryAt = Date.now() + const run = ensureDouyuFulfillmentTasks() + .catch((error) => { + lastAutomaticDiscoveryAt = 0 + throw error + }) + .finally(() => { + automaticDiscoveryInFlight = null + }) + automaticDiscoveryInFlight = run + return run +} + async function loadTaskByOrderNo(orderNo: string) { const normalized = String(orderNo || '').trim() if (!normalized) { @@ -309,69 +342,126 @@ function statusForLive(live: LiveBindingState): string { return 'preparing' } -async function applyLiveState(task: DouyuTaskRow, live: LiveBindingState) { +async function updateTaskFromLiveState( + client: Pick, + task: DouyuTaskRow, + live: LiveBindingState, + now: string, +) { const nextStatus = statusForLive(live) - const now = nowIso() + await client.query( + ` + UPDATE douyu_fulfillment_tasks + SET live_session_id = $2, + status = $3, + binding_phase = $4, + live_execution_status = $5, + live_binding_status = $6, + issue_code = $7, + last_error = $8, + bound_role_name = $9, + bound_area_name = $10, + bound_plat_name = $11, + binding_started_at = CASE + WHEN $12 <> '' THEN COALESCE(binding_started_at, NOW()) + ELSE binding_started_at + END, + bound_at = CASE + WHEN $13 THEN COALESCE(bound_at, NOW()) + ELSE bound_at + END, + completed_at = CASE + WHEN $14 THEN COALESCE(completed_at, NOW()) + ELSE completed_at + END, + last_synced_at = NOW(), + updated_at = $15 + WHERE id = $1 + `, + [ + task.id, + live.sessionId, + nextStatus, + live.bindPhase, + live.executionStatus, + live.bindingStatus, + live.issueCode, + live.message, + live.roleName, + live.areaName, + live.platName, + live.qrUrl, + live.bindConfirmed, + live.executionStatus === 'completed', + now, + ], + ) + if (nextStatus !== task.status) { + await appendEvent(client, task.id, 'status_changed', 'integration', { + fromStatus: task.status, + toStatus: nextStatus, + bindPhase: live.bindPhase, + }) + } +} + +async function applyLiveState(task: DouyuTaskRow, live: LiveBindingState) { await withTransaction(async (client) => { - await client.query( - ` - UPDATE douyu_fulfillment_tasks - SET live_session_id = $2, - status = $3, - binding_phase = $4, - live_execution_status = $5, - live_binding_status = $6, - issue_code = $7, - last_error = $8, - bound_role_name = $9, - bound_area_name = $10, - bound_plat_name = $11, - binding_started_at = CASE - WHEN $12 <> '' THEN COALESCE(binding_started_at, NOW()) - ELSE binding_started_at - END, - bound_at = CASE - WHEN $13 THEN COALESCE(bound_at, NOW()) - ELSE bound_at - END, - completed_at = CASE - WHEN $14 THEN COALESCE(completed_at, NOW()) - ELSE completed_at - END, - last_synced_at = NOW(), - updated_at = $15 - WHERE id = $1 - `, - [ - task.id, - live.sessionId, - nextStatus, - live.bindPhase, - live.executionStatus, - live.bindingStatus, - live.issueCode, - live.message, - live.roleName, - live.areaName, - live.platName, - live.qrUrl, - live.bindConfirmed, - live.executionStatus === 'completed', - now, - ], - ) - if (nextStatus !== task.status) { - await appendEvent(client, task.id, 'status_changed', 'integration', { - fromStatus: task.status, - toStatus: nextStatus, - bindPhase: live.bindPhase, - }) - } + await updateTaskFromLiveState(client, task, live, nowIso()) }) const updated = await loadTask(task.id) return { task: updated, live, comparison: compareCustomerRole(updated, live) } } +async function applyLiveStates(entries: Array<{ task: DouyuTaskRow; live: LiveBindingState }>) { + if (entries.length === 0) return + const now = nowIso() + await withTransaction(async (client) => { + for (const entry of entries) { + await updateTaskFromLiveState(client, entry.task, entry.live, now) + } + }) +} + +function isLiveBindingState(value: unknown): value is LiveBindingState { + if (!value || typeof value !== 'object') return false + const item = value as Partial + return ( + Number.isInteger(Number(item.sessionId)) && + Number(item.sessionId) > 0 && + typeof item.executionStatus === 'string' && + typeof item.bindingStatus === 'string' && + typeof item.exchangeStatus === 'string' && + typeof item.issueCode === 'string' && + typeof item.message === 'string' + ) +} + +export async function applyLiveBindingStateSnapshot(input: unknown) { + const rawItems = + input && typeof input === 'object' && Array.isArray((input as { items?: unknown }).items) + ? (input as { items: unknown[] }).items + : [] + const items = rawItems.filter(isLiveBindingState) + const sessionIds = Array.from( + new Set(items.map((item) => Number(item.sessionId)).filter((id) => id > 0)), + ) + if (sessionIds.length === 0) return { received: rawItems.length, updated: 0 } + + const tasks = await query( + `${TASK_SELECT} + WHERE task.live_session_id = ANY($1::bigint[])`, + [sessionIds], + ) + const taskBySessionId = new Map(tasks.rows.map((task) => [Number(task.live_session_id), task])) + const entries = items.flatMap((live) => { + const task = taskBySessionId.get(Number(live.sessionId)) + return task ? [{ task, live }] : [] + }) + await applyLiveStates(entries) + return { received: rawItems.length, updated: entries.length } +} + async function ensureLiveSession(task: DouyuTaskRow) { const live = await liveHubRequest( '/api/integration/platform-fulfillment/customer-sessions/ensure', @@ -504,6 +594,36 @@ export async function confirmDouyuCustomerBinding(orderNo: string) { return applyLiveState(task, live) } +async function syncLiveStatesForTasks(tasks: DouyuTaskRow[]) { + const now = Date.now() + const candidates = tasks.filter((task) => { + if (!task.live_session_id || TERMINAL_TASK_STATUSES.has(task.status)) return false + const lastSyncedAt = Date.parse(task.last_synced_at || '') + return !lastSyncedAt || now - lastSyncedAt >= LIVE_STATE_SYNC_INTERVAL_MS + }) + if (candidates.length === 0) return + + try { + const response = await liveHubRequest( + '/api/integration/platform-fulfillment/customer-sessions/status/batch', + { + method: 'POST', + body: { + task_ids: candidates.map((task) => Number(task.live_session_id)), + }, + }, + ) + const taskBySessionId = new Map(candidates.map((task) => [Number(task.live_session_id), task])) + const entries = response.items.flatMap((live) => { + const task = taskBySessionId.get(Number(live.sessionId)) + return task ? [{ task, live }] : [] + }) + await applyLiveStates(entries) + } catch (error) { + logWarn('[douyu-fulfillment]', '自动同步直播账号履约状态失败', { error }) + } +} + export async function listDouyuFulfillmentTasks( input: { keyword?: unknown @@ -512,7 +632,7 @@ export async function listDouyuFulfillmentTasks( pageSize?: unknown } = {}, ) { - await ensureDouyuFulfillmentTasks() + await ensureDouyuFulfillmentTasksAutomatically() const page = Math.max(1, Number(input.page || 1)) const pageSize = Math.max(1, Math.min(100, Number(input.pageSize || 20))) const keyword = String(input.keyword || '').trim() @@ -541,7 +661,15 @@ export async function listDouyuFulfillmentTasks( params, ) params.push(pageSize, (page - 1) * pageSize) - const rows = await query( + let rows = await query( + `${TASK_SELECT} + ${where} + ORDER BY task.updated_at DESC, task.id DESC + LIMIT $${params.length - 1} OFFSET $${params.length}`, + params, + ) + await syncLiveStatesForTasks(rows.rows) + rows = await query( `${TASK_SELECT} ${where} ORDER BY task.updated_at DESC, task.id DESC diff --git a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts index 697721a3..77921153 100644 --- a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts +++ b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts @@ -1,7 +1,7 @@ import assert from 'node:assert/strict' import test from 'node:test' -import { compareCustomerRole } from './douyu-fulfillment-service.js' +import { applyLiveBindingStateSnapshot, compareCustomerRole } from './douyu-fulfillment-service.js' const task = { customer_role_name: '狗鼻子弗尼亚bd', @@ -37,3 +37,16 @@ test('斗鱼客户资料角色名不一致时禁止确认', () => { assert.equal(result.matched, false) assert.equal(result.roleMatched, false) }) + +test('直播账号状态推送忽略空数据和无效任务', async () => { + assert.deepEqual(await applyLiveBindingStateSnapshot({ items: [] }), { + received: 0, + updated: 0, + }) + assert.deepEqual( + await applyLiveBindingStateSnapshot({ + items: [{ sessionId: 0 }, null, { sessionId: 'bad' }], + }), + { received: 3, updated: 0 }, + ) +}) diff --git a/apps/backend/src/services/douyu-fulfillment/live-hub-notifier.ts b/apps/backend/src/services/douyu-fulfillment/live-hub-notifier.ts new file mode 100644 index 00000000..458d1178 --- /dev/null +++ b/apps/backend/src/services/douyu-fulfillment/live-hub-notifier.ts @@ -0,0 +1,54 @@ +import { randomUUID } from 'node:crypto' + +import { logWarn } from '../../utils/logger.js' + +const PUBLISH_ATTEMPTS = 3 +const PUBLISH_TIMEOUT_MS = 5000 + +function liveHubBaseUrl() { + return String(process.env.LIVE_HUB_PLATFORM_FULFILLMENT_URL || '') + .trim() + .replace(/\/+$/, '') +} + +export function notifyLiveHubOrderSyncAsync(detail: Record = {}) { + const baseUrl = liveHubBaseUrl() + const integrationKey = String(process.env.PLATFORM_FULFILLMENT_INTEGRATION_KEY || '').trim() + if (!baseUrl || !integrationKey) return + + const event = { + eventId: randomUUID(), + occurredAt: new Date().toISOString(), + ...detail, + } + void publish(`${baseUrl}/api/integration/platform-fulfillment/events/order-sync`, event) +} + +async function publish(url: string, event: Record) { + const integrationKey = String(process.env.PLATFORM_FULFILLMENT_INTEGRATION_KEY || '').trim() + for (let attempt = 1; attempt <= PUBLISH_ATTEMPTS; attempt += 1) { + try { + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-Integration-Key': integrationKey, + }, + body: JSON.stringify(event), + signal: AbortSignal.timeout(PUBLISH_TIMEOUT_MS), + }) + if (response.ok) return + throw new Error(`live-hub 返回 HTTP ${response.status}`) + } catch (error) { + if (attempt >= PUBLISH_ATTEMPTS) { + logWarn('[douyu-fulfillment]', '推送 live-hub 订单同步事件失败', { + eventId: event.eventId, + attempts: attempt, + error, + }) + return + } + await new Promise((resolve) => setTimeout(resolve, attempt * 500)) + } + } +} From d919c251f6d9964b0c1a33473c9b4c1dcb30dd9e Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 20:48:20 +0800 Subject: [PATCH 12/17] =?UTF-8?q?style(douyu):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81=E5=8D=A1=E7=89=87=E5=B8=83?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DouyuFulfillmentPage.tsx | 22 ++-- apps/frontend/src/styles/client.css | 110 ++++++++++++++++++ 2 files changed, 122 insertions(+), 10 deletions(-) diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index e9811064..a7b59234 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -284,6 +284,7 @@ export default function DouyuFulfillmentPage() { -

订单信息

-
+
+
+

订单信息

+ + {STATUS_LABELS[data.task.status] || data.task.status} + +
+
订单号 {data.task.platform_order_id}
-
+
商品 {data.task.product_name || data.task.sku_name} × {data.task.quantity}
-
- 状态 - - {STATUS_LABELS[data.task.status] || data.task.status} - -
) } diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index 0b0a7480..b5464eeb 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -3007,6 +3007,116 @@ padding-top: 12px; } +.customer-auth-page.is-douyu .customer-order-closed-alert.ant-alert { + align-items: flex-start; + margin: 10px 16px 0; + padding: 12px 14px; + color: #f6c66f; + border: 1px solid #6b4d1f; + border-radius: 10px; + background: #2a2418; +} + +.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-icon { + margin-top: 2px; + color: #f6ad3c; + font-size: 16px; +} + +.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-message, +.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-title { + color: #f7d394; + font-size: 14px; + font-weight: 600; + line-height: 1.4; +} + +.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-description { + margin-top: 3px; + color: #d8c39b; + font-size: 13px; + line-height: 1.5; +} + +.customer-auth-page.is-douyu .customer-douyu-order-card { + padding: 0; + overflow: hidden; + gap: 0; + border-radius: 12px; + background: #202631; +} + +.customer-auth-page.is-douyu .customer-douyu-order-head { + align-items: center; + gap: 12px; + padding: 13px 16px; + border-bottom: 1px solid #343d4c; +} + +.customer-auth-page.is-douyu .customer-douyu-order-head h3 { + margin: 0; + color: #9aa3b2; + font-size: 13px; + font-weight: 600; +} + +.customer-auth-page.is-douyu .customer-douyu-order-field { + display: grid; + grid-template-columns: 72px minmax(0, 1fr); + align-items: start; + gap: 12px; + padding: 11px 16px; + border-bottom: 1px solid #343d4c; +} + +.customer-auth-page.is-douyu .customer-douyu-order-field:last-child { + border-bottom: 0; +} + +.customer-auth-page.is-douyu .customer-douyu-order-field > span { + color: #8f9aaa; + font-size: 13px; + line-height: 1.5; +} + +.customer-auth-page.is-douyu .customer-douyu-order-field > strong { + min-width: 0; + color: #f1f5f9; + font-size: 14px; + font-weight: 600; + line-height: 1.5; + text-align: right; + overflow-wrap: anywhere; +} + +.customer-auth-page.is-douyu .customer-douyu-order-status { + flex: 0 0 auto; + padding: 2px 10px; + border-color: rgba(96, 165, 250, 0.36); + color: #dbeafe; + font-size: 12px; + font-weight: 600; + background: rgba(47, 111, 237, 0.22); +} + +.customer-auth-page.is-douyu .customer-douyu-order-status.is-cancelled { + border-color: rgba(245, 158, 11, 0.38); + color: #f8d28a; + background: rgba(245, 158, 11, 0.14); +} + +.customer-auth-page.is-douyu .customer-douyu-order-status.is-completed { + border-color: rgba(52, 211, 153, 0.38); + color: #a7f3d0; + background: rgba(6, 95, 70, 0.24); +} + +.customer-auth-page.is-douyu .customer-douyu-order-status.is-failed { + border-color: rgba(248, 113, 113, 0.38); + color: #fecaca; + background: rgba(127, 29, 29, 0.24); +} + .customer-choice-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); From 54b9f3251d7a836ecd583eeb1312302575bd0b91 Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 20:51:25 +0800 Subject: [PATCH 13/17] =?UTF-8?q?feat(douyu):=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=BE=85=E9=A2=86=E5=8F=96=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/services/douyu-fulfillment/douyu-fulfillment-service.ts | 2 +- apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts index ca002bd4..bb0dda8e 100644 --- a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts +++ b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts @@ -71,7 +71,7 @@ type LiveBindingBatchResponse = { items: LiveBindingState[] } -const AUTO_DISCOVERY_INTERVAL_MS = 60_000 +const AUTO_DISCOVERY_INTERVAL_MS = 15_000 const LIVE_STATE_SYNC_INTERVAL_MS = 60_000 const TERMINAL_TASK_STATUSES = new Set(['completed', 'cancelled']) diff --git a/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx b/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx index 93689e72..90e74105 100644 --- a/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx @@ -281,7 +281,7 @@ export default function AdminDouyuFulfillmentPage() { loading={syncMutation.isPending} onClick={() => syncMutation.mutate()} > - 同步斗鱼订单 + 立即同步 -
+

+ {qrExpired + ? '二维码已过期,请刷新后重新扫码' + : '二维码有效期内无需刷新,过期后可重新生成'} +

) : null} @@ -506,9 +571,17 @@ function ChoiceSwitch(input: { ) } -function CustomerFrame({ title, children }: { title: string; children: ReactNode }) { +function CustomerFrame({ + title, + compact = false, + children, +}: { + title: string + compact?: boolean + children: ReactNode +}) { return ( -
+
diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index b5464eeb..d8cd5a64 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -3117,6 +3117,288 @@ background: rgba(127, 29, 29, 0.24); } +.customer-douyu-qr-main { + width: 100%; + display: grid; + grid-template-columns: 30px minmax(0, 220px) 30px; + align-items: stretch; + justify-content: center; + gap: 7px; +} + +.customer-douyu-qr-rail { + display: flex; + align-items: center; + justify-content: center; + min-height: 0; + padding: 0; + color: #ff5a67; + font-size: 12px; + font-weight: 800; + line-height: 1.05; + letter-spacing: 1px; + text-align: center; + writing-mode: vertical-rl; + text-orientation: upright; + background: none; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-main .customer-binding-qr-code { + width: 100%; + max-width: none; + padding: 10px; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-preparing { + position: relative; + width: 100%; + height: 100%; + min-height: 100%; + display: grid; + place-items: center; + overflow: hidden; + border-radius: 7px; + background: #171c24; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-skeleton { + position: absolute; + inset: 18px; + opacity: 0.16; + background-image: + linear-gradient(90deg, #9fb1ca 50%, transparent 50%), + linear-gradient(#9fb1ca 50%, transparent 50%); + background-position: + 0 0, + 0 0; + background-size: + 18px 18px, + 18px 18px; + -webkit-mask-image: linear-gradient(135deg, #000 12%, transparent 82%); + mask-image: linear-gradient(135deg, #000 12%, transparent 82%); +} + +.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy { + position: relative; + z-index: 1; + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; + color: #b8c1cf; + text-align: center; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy strong { + color: #e2e8f0; + font-size: 14px; + font-weight: 600; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy span { + color: #8f9aaa; + font-size: 12px; +} + +.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn { + color: #e2e8f0; + border-color: #465063; + background: #2a313d; + box-shadow: none; +} + +.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn:hover, +.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn:focus-visible { + color: #fff; + border-color: #657186; + background: #343c4a; +} + +.customer-auth-page.is-douyu .customer-binding-qr-actions.is-single { + grid-template-columns: minmax(0, 1fr); +} + +.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn:disabled { + color: #7d8797; + border-color: #394353; + background: #252c37; + opacity: 1; +} + +.customer-auth-page.is-douyu .customer-binding-qr-countdown.is-expired { + color: #ff7a84; + font-weight: 700; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-refresh-note { + margin: -2px 0 0; + color: #8f9aaa; + font-size: 11px; + line-height: 1.4; + text-align: center; +} + +.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat { + border-color: rgba(248, 113, 113, 0.34); + background: linear-gradient(135deg, rgba(127, 29, 29, 0.26), rgba(32, 38, 49, 0.9)); +} + +.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-icon, +.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-message, +.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-title { + color: #ff8a92; +} + +.customer-auth-page.is-douyu.is-compact { + height: 100vh; + height: 100dvh; + min-height: 0; + overflow: hidden; +} + +.customer-auth-page.is-douyu.is-compact .customer-auth-shell { + height: 100%; + display: flex; + flex-direction: column; +} + +.customer-auth-page.is-douyu.is-compact .customer-auth-hero { + min-height: 148px; + padding: 0 16px 18px; + background-position: center 34%; +} + +.customer-auth-page.is-douyu.is-compact .customer-auth-warning { + padding: 8px 16px 12px; + font-size: 14px; +} + +.customer-auth-page.is-douyu.is-compact .customer-auth-main { + display: flex; + flex-direction: column; + flex: 1 1 auto; + min-height: 0; + padding-bottom: 0; + overflow: hidden; +} + +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-card { + flex: none; + margin: 10px 16px 0; +} + +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-head { + padding: 13px 16px; +} + +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field { + grid-template-columns: 72px minmax(0, 1fr); + gap: 12px; + padding: 11px 16px; +} + +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field > span, +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field > strong { + font-size: 14px; + line-height: 1.5; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-stage { + flex: 1 1 auto; + min-height: 0; + justify-content: center; + gap: 14px; + padding: 16px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert { + flex: none; + padding: 12px 14px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert-description { + margin-top: 4px; + font-size: 13px; + line-height: 1.6; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card { + flex: 0 1 auto; + justify-content: center; + gap: 10px; + padding: 18px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card h3 { + font-size: 15px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-hint { + font-size: 13px; + line-height: 1.6; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-countdown { + font-size: 13px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card .ant-progress { + line-height: 1.5; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-actions { + margin-top: 4px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-actions .ant-btn { + height: 40px; + font-size: 14px; +} + +@media (max-height: 720px) { + .customer-auth-page.is-douyu.is-compact .customer-auth-hero { + min-height: 60px; + padding-bottom: 6px; + } + + .customer-auth-page.is-douyu.is-compact .customer-auth-warning { + padding-block: 1px 4px; + font-size: 11px; + } + + .customer-auth-page.is-douyu.is-compact .customer-douyu-order-head { + padding-block: 6px; + } + + .customer-auth-page.is-douyu.is-compact .customer-douyu-order-field { + padding-block: 5px; + } + + .customer-auth-page.is-douyu.is-compact .customer-binding-stage { + justify-content: flex-start; + gap: 6px; + padding-block: 6px; + } + + .customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert-description { + display: none; + } + + .customer-auth-page.is-douyu.is-compact .customer-binding-qr-card { + gap: 4px; + padding-block: 7px; + } + + .customer-auth-page.is-douyu.is-compact .customer-douyu-qr-main { + grid-template-columns: 26px minmax(0, clamp(154px, 30dvh, 190px)) 26px; + gap: 5px; + } + + .customer-auth-page.is-douyu.is-compact .customer-douyu-qr-rail { + font-size: 10px; + } +} + .customer-choice-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); diff --git a/dev.sh b/dev.sh new file mode 100755 index 00000000..3c11104d --- /dev/null +++ b/dev.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +COMPOSE_FILE="${ROOT_DIR}/docker-compose.dev.yml" + +case "${1:-}" in + up|start) + exec bash "${ROOT_DIR}/deploy/mac-dev.sh" + ;; + logs) + shift + exec docker compose -f "${COMPOSE_FILE}" logs -f --tail=200 "$@" + ;; + down|stop) + exec docker compose -f "${COMPOSE_FILE}" down + ;; + ps|status) + exec docker compose -f "${COMPOSE_FILE}" ps + ;; + *) + exec bash "${ROOT_DIR}/deploy/mac-dev.sh" "$@" + ;; +esac From f23e8792b26f5444c365b812d56d9190e9e9cc25 Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 21:51:05 +0800 Subject: [PATCH 15/17] =?UTF-8?q?fix(douyu):=20=E5=AE=8C=E5=96=84=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=A4=B1=E8=B4=A5=E5=A4=84=E7=90=86=E4=B8=8E=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=BC=80=E5=8F=91=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 捕获斗鱼账号及客户游戏角色的换绑冷却失败 - 客户页失败后展示截图联系客服提示 - dev.sh 默认跟踪容器日志并补充日志命令入口 --- README.md | 5 +- .../DouyuFulfillmentPage.tsx | 74 +++++++++++++------ apps/frontend/src/styles/client.css | 18 +++++ dev.sh | 15 +++- 4 files changed, 88 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 1e12405d..d5dd1b71 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,9 @@ docker compose -f docker-compose.dev.yml down `order_site` 根目录提供 `./dev.sh` 快捷入口。默认直接启动源码挂载开发环境: ```bash -./dev.sh # 启动/更新 dev 环境 -./dev.sh logs # 跟踪全部 dev 日志 +./dev.sh # 启动/更新并直接跟踪应用日志 +./dev.sh up # 只启动/更新,不占用终端 +./dev.sh logs # 跟踪 backend / frontend / web 日志 ./dev.sh logs frontend # 只看 Vite HMR 日志 ./dev.sh logs backend # 只看后端热重载日志 ./dev.sh ps # 查看 dev 容器 diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index 004c2b53..c6b32370 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -25,6 +25,11 @@ import type { import { formatAdminDateTime } from '@/utils/admin-time' const POLL_INTERVAL_MS = 3000 +const BINDING_FAILURE_ISSUES = new Set([ + 'binding_failed', + 'account_role_cooldown', + 'customer_role_cooldown', +]) const STATUS_LABELS: Record = { waiting_profile: '等待填写资料', @@ -116,9 +121,11 @@ export default function DouyuFulfillmentPage() { const task = data?.task const live = data?.live const needsProfile = Boolean(task && !task.customer_role_name) + const bindingFailed = Boolean(live && BINDING_FAILURE_ISSUES.has(live.issueCode)) const activeBinding = Boolean( task && !needsProfile && + !bindingFailed && !['completed', 'cancelled'].includes(task.status) && !live?.bindConfirmed, ) @@ -201,19 +208,27 @@ export default function DouyuFulfillmentPage() { const waitingForSupport = Boolean( task && (live?.bindConfirmed || task.status === 'waiting_operator' || task.status === 'bound'), ) + const bindingFailureMessage = + live?.issueCode === 'account_role_cooldown' + ? '当前斗鱼账号暂不可换绑,本次绑定未生效。' + : live?.issueCode === 'customer_role_cooldown' + ? '该游戏角色仍处于换绑冷却期,本次绑定未生效。' + : '本次游戏角色绑定失败。' const bindingDescription = live?.bindConfirmed ? '角色绑定已完成,待客服处理。' : live?.bindReadyForConfirm ? '已识别游戏角色,请核对并确认绑定。' - : qrExpired - ? '当前二维码已过期,请刷新二维码后重新扫码。' - : live?.issueCode === 'binding_failed' - ? '暂未识别到绑定角色,请继续使用当前二维码完成扫码。' - : !live?.accountReady - ? '系统正在自动准备账号和二维码,请稍候,无需重复操作。' - : live?.qrUrl - ? '必须使用微信扫码。请选择与资料一致的和平精英角色,QQ 扫码或其他方式无效。' - : live?.message || '正在准备绑定二维码,请稍候。' + : bindingFailed + ? bindingFailureMessage + : qrExpired + ? '当前二维码已过期,请刷新二维码后重新扫码。' + : live?.issueCode === 'binding_failed' + ? '暂未识别到绑定角色,请继续使用当前二维码完成扫码。' + : !live?.accountReady + ? '系统正在自动准备账号和二维码,请稍候,无需重复操作。' + : live?.qrUrl + ? '必须使用微信扫码。请选择与资料一致的和平精英角色,QQ 扫码或其他方式无效。' + : live?.message || '正在准备绑定二维码,请稍候。' const bindingStageTitle = task?.status === 'qr_pending' && live?.qrUrl ? '必须使用微信扫码绑定' @@ -330,7 +345,9 @@ export default function DouyuFulfillmentPage() { return ( @@ -388,15 +405,27 @@ export default function DouyuFulfillmentPage() { ) : (
- + {bindingFailed ? ( +
+ +

请截图本页面并联系客服处理,客服会根据截图重新安排绑定。

+
+ ) : ( + + )} - {canRevealBindingQr ? ( + {!bindingFailed && canRevealBindingQr ? ( ) : null} - {!live?.qrUrl && task.status !== 'completed' ? ( + {!bindingFailed && + !live?.qrUrl && + !live?.bindReadyForConfirm && + task.status !== 'completed' ? (

游戏角色绑定二维码

@@ -442,7 +474,7 @@ export default function DouyuFulfillmentPage() {
) : null} - {live?.qrUrl && showBindingQr ? ( + {!bindingFailed && live?.qrUrl && showBindingQr ? (

游戏角色绑定二维码

@@ -497,7 +529,7 @@ export default function DouyuFulfillmentPage() {
) : null} - {live?.bindReadyForConfirm ? ( + {!bindingFailed && live?.bindReadyForConfirm ? (

核对绑定角色

diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index d8cd5a64..c5fb03e7 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -3249,6 +3249,24 @@ color: #ff8a92; } +.customer-douyu-binding-failure { + display: flex; + flex-direction: column; + gap: 10px; +} + +.customer-douyu-binding-failure > p { + margin: 0; + padding: 12px 14px; + color: #fecaca; + font-size: 13px; + line-height: 1.6; + text-align: center; + border: 1px solid rgba(248, 113, 113, 0.3); + border-radius: 10px; + background: rgba(127, 29, 29, 0.18); +} + .customer-auth-page.is-douyu.is-compact { height: 100vh; height: 100dvh; diff --git a/dev.sh b/dev.sh index 3c11104d..a1d12a5c 100755 --- a/dev.sh +++ b/dev.sh @@ -3,6 +3,12 @@ set -Eeuo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" COMPOSE_FILE="${ROOT_DIR}/docker-compose.dev.yml" +LOG_TAIL="${DEV_LOG_TAIL:-120}" + +follow_app_logs() { + printf '\n[dev] 跟踪 backend / frontend / web 日志(Ctrl+C 只退出日志,不停止容器)\n' + docker compose -f "${COMPOSE_FILE}" logs -f --tail="${LOG_TAIL}" backend frontend web +} case "${1:-}" in up|start) @@ -10,7 +16,10 @@ case "${1:-}" in ;; logs) shift - exec docker compose -f "${COMPOSE_FILE}" logs -f --tail=200 "$@" + if [[ $# -eq 0 ]]; then + set -- backend frontend web + fi + exec docker compose -f "${COMPOSE_FILE}" logs -f --tail="${LOG_TAIL}" "$@" ;; down|stop) exec docker compose -f "${COMPOSE_FILE}" down @@ -18,6 +27,10 @@ case "${1:-}" in ps|status) exec docker compose -f "${COMPOSE_FILE}" ps ;; + "") + bash "${ROOT_DIR}/deploy/mac-dev.sh" + follow_app_logs + ;; *) exec bash "${ROOT_DIR}/deploy/mac-dev.sh" "$@" ;; From 919fb2767b8cf1b123a54777701bfd933950bc0f Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 17 Nov 2026 21:59:08 +0800 Subject: [PATCH 16/17] =?UTF-8?q?refactor(styles):=20=E6=8C=89=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E6=B5=81=E7=A8=8B=E4=B8=8E=E5=B9=B3=E5=8F=B0=E6=8B=86?= =?UTF-8?q?=E5=88=86=E5=AE=A2=E6=88=B7=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将买家领取页拆分为领取、补资料、兑换和响应式模块 - 将客户履约公共流程与斗鱼、虎牙、微博平台样式分离 - 保持样式加载顺序和最终构建产物不变 --- apps/frontend/src/styles/client.css | 3842 +---------------- apps/frontend/src/styles/client/claim.css | 462 ++ apps/frontend/src/styles/client/collect.css | 770 ++++ apps/frontend/src/styles/client/redeem.css | 25 + .../frontend/src/styles/client/responsive.css | 177 + .../src/styles/customer/auth-form.css | 349 ++ apps/frontend/src/styles/customer/base.css | 10 + apps/frontend/src/styles/customer/binding.css | 453 ++ apps/frontend/src/styles/customer/layout.css | 229 + apps/frontend/src/styles/customer/login.css | 87 + apps/frontend/src/styles/customer/order.css | 53 + .../src/styles/customer/platform/douyu.css | 563 +++ .../src/styles/customer/platform/huya.css | 136 + .../src/styles/customer/platform/weibo.css | 33 + apps/frontend/src/styles/customer/profile.css | 234 + .../src/styles/customer/responsive.css | 162 + apps/frontend/src/styles/customer/status.css | 106 + apps/frontend/src/styles/main.css | 9 +- 18 files changed, 3861 insertions(+), 3839 deletions(-) create mode 100644 apps/frontend/src/styles/client/claim.css create mode 100644 apps/frontend/src/styles/client/collect.css create mode 100644 apps/frontend/src/styles/client/redeem.css create mode 100644 apps/frontend/src/styles/client/responsive.css create mode 100644 apps/frontend/src/styles/customer/auth-form.css create mode 100644 apps/frontend/src/styles/customer/base.css create mode 100644 apps/frontend/src/styles/customer/binding.css create mode 100644 apps/frontend/src/styles/customer/layout.css create mode 100644 apps/frontend/src/styles/customer/login.css create mode 100644 apps/frontend/src/styles/customer/order.css create mode 100644 apps/frontend/src/styles/customer/platform/douyu.css create mode 100644 apps/frontend/src/styles/customer/platform/huya.css create mode 100644 apps/frontend/src/styles/customer/platform/weibo.css create mode 100644 apps/frontend/src/styles/customer/profile.css create mode 100644 apps/frontend/src/styles/customer/responsive.css create mode 100644 apps/frontend/src/styles/customer/status.css diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index c5fb03e7..a7870bf5 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -1,3838 +1,6 @@ -/* ========================================================================== - 买家前台:提卡与信息收集页 (Buyer Claim & Collect Pages) - ========================================================================== */ +/** 买家前台公共样式入口:按领取流程拆分,具体规则见 client/。 */ -.claim-page { - min-height: 100vh; - padding: 24px; - background: linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%); - display: flex; - flex-direction: column; - align-items: center; - gap: 18px; -} - -.claim-header-card, -.claim-content-card { - width: min(680px, 100%); - border-color: rgba(148, 163, 184, 0.18); - box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08); -} - -.claim-header-card { - position: relative; -} - -.claim-header-card .ant-card-body, -.claim-content-card .ant-card-body { - display: flex; - flex-direction: column; - gap: 18px; -} - -.claim-header-copy { - min-width: 0; - padding-right: 220px; -} - -.claim-header-copy h1 { - margin: 0; - color: #0f172a; - font-size: 30px; - line-height: 1.25; - overflow-wrap: anywhere; -} - -.claim-header-copy p, -.claim-muted { - margin: 0; - color: #64748b; - line-height: 1.6; -} - -.claim-step-indicator { - position: absolute; - top: 24px; - right: 24px; - max-width: 210px; - display: flex; - flex-direction: column; - align-items: flex-end; - gap: 7px; -} - -.claim-step-dots { - display: flex; - gap: 8px; -} - -.claim-step-dot { - width: 32px; - height: 32px; - border-radius: 50%; - background: #e5e7eb; - color: #94a3b8; - display: inline-flex; - align-items: center; - justify-content: center; - font-weight: 700; -} - -.claim-step-dot.active { - background: var(--theme-primary); - color: #ffffff; -} - -.claim-step-progress-text { - color: #64748b; - font-size: 13px; - font-weight: 700; - line-height: 1.4; - text-align: right; - overflow-wrap: anywhere; -} - -.claim-content-card .ant-typography { - margin: 0; -} - -.claim-state-card .ant-card-body { - min-height: 240px; - align-items: center; - justify-content: center; - text-align: center; -} - -.claim-large-icon { - font-size: 44px; -} - -.claim-icon-success { - color: #16a34a; -} - -.claim-icon-warning { - color: #d97706; -} - -.claim-icon-info { - color: var(--theme-primary); -} - -.claim-icon-error { - color: #dc2626; -} - -.claim-qr-block { - display: flex; - flex-direction: column; - align-items: center; - gap: 14px; - padding: 14px; - border-radius: 8px; - background: #f8fbff; - border: 1px solid #dbeafe; -} - -.claim-qr-guide-panel { - display: grid; - grid-template-columns: 42px minmax(0, 280px) 42px; - grid-template-areas: - 'left code right' - '. hint .'; - gap: 10px; - align-items: center; - justify-content: center; - width: 100%; - max-width: 410px; - min-width: 0; -} - -.claim-scan-label { - align-self: stretch; - min-height: 150px; - padding: 10px 6px; - color: #e11d48; - font-weight: 900; - font-size: 17px; - line-height: 1.2; - writing-mode: vertical-rl; - text-orientation: upright; - display: flex; - align-items: center; - justify-content: center; -} - -.claim-scan-label-left { - grid-area: left; -} - -.claim-scan-label-right { - grid-area: right; -} - -.claim-qr-code { - grid-area: code; - width: 100%; - max-width: 280px; - aspect-ratio: 1 / 1; - padding: 10px; - background: #ffffff; - border-radius: 8px; - border: 1px solid #dbeafe; -} - -.claim-save-hint { - grid-area: hint; - margin: 0; - justify-self: center; - color: #64748b; - font-size: 14px; - font-weight: 700; - line-height: 1.4; - text-align: center; -} - -.claim-role-panel { - display: grid; - grid-template-columns: 1fr; - gap: 8px; -} - -.claim-role-panel.pending { - opacity: 0.82; -} - -.claim-role-panel-item { - min-width: 0; - display: grid; - grid-template-columns: 88px minmax(0, 1fr); - align-items: center; - gap: 12px; -} - -.claim-role-panel-item span { - color: #64748b; - font-size: 13px; - line-height: 1.4; - white-space: nowrap; -} - -.claim-role-panel-item strong { - min-width: 0; - color: #0f172a; - font-size: 17px; - line-height: 1.45; - overflow-wrap: anywhere; -} - -.claim-action-row { - width: 100%; -} - -.claim-action-tooltip-wrap { - display: inline-flex; -} - -.claim-meta-footer { - display: flex; - flex-wrap: wrap; - gap: 4px 10px; - justify-content: center; - color: #94a3b8; - font-size: 11px; - line-height: 1.5; -} - -.claim-info-grid { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 14px; -} - -.claim-info-grid-compact { - gap: 8px; - margin-bottom: 10px; -} - -.claim-info-grid-compact .claim-info-item { - padding: 8px 10px; - gap: 2px; - border-radius: 6px; -} - -.claim-info-grid-compact .claim-info-item span { - font-size: 11px; - line-height: 1.3; -} - -.claim-info-grid-compact .claim-info-item strong { - font-size: 13px; - line-height: 1.35; - font-weight: 600; -} - -.claim-uid-step .ant-card-body { - gap: 10px; -} - -.claim-uid-step-title.ant-typography { - margin: 0 !important; - font-size: 20px !important; - line-height: 1.3 !important; -} - -.claim-uid-step-desc { - font-size: 13px; - line-height: 1.45; -} - -.claim-uid-guide { - margin: 4px 0 0; - padding: 6px; - border-radius: 8px; - background: #f8fafc; - border: 1px solid #e5e7eb; -} - -.claim-uid-guide-image { - display: block; - width: 100%; - max-width: 360px; - max-height: 160px; - margin: 0 auto; - border-radius: 6px; - border: 1px solid #e2e8f0; - object-fit: contain; - background: #fff; -} - -.claim-uid-guide-caption { - margin: 6px 0 0; - text-align: center; - color: #64748b; - font-size: 12px; - line-height: 1.35; -} - -.claim-uid-warning { - margin: 2px 0 0; - color: #ff4d4f; - font-size: 13px; - font-weight: 600; - line-height: 1.45; -} - -.claim-info-item { - min-width: 0; - padding: 16px; - border-radius: 6px; - background: #f8fafc; - border: 1px solid #e5e7eb; - display: flex; - flex-direction: column; - gap: 6px; -} - -.claim-info-item span { - color: #64748b; - font-size: 13px; -} - -.claim-info-item strong { - color: #0f172a; - font-size: 17px; - overflow-wrap: anywhere; -} - -.claim-result-header { - display: flex; - align-items: flex-start; - gap: 14px; -} - -.claim-feifei-main { - display: grid; - gap: 8px; -} - -.claim-feifei-main p { - margin: 0; - color: var(--theme-primary); - font-weight: 700; -} - -.claim-feifei-label { - color: #64748b; - font-size: 13px; -} - -.claim-product-items { - display: flex; - flex-direction: column; - gap: 10px; -} - -.claim-product-items-header { - display: flex; - align-items: center; - justify-content: space-between; - gap: 12px; - color: #64748b; - font-size: 13px; -} - -.claim-product-items-header strong { - color: var(--theme-primary); - font-weight: 700; -} - -.claim-product-items-list { - display: flex; - flex-direction: column; - gap: 8px; -} - -.claim-product-item-row { - min-height: 44px; - padding: 10px 12px; - border: 1px solid #e5e7eb; - border-radius: 6px; - background: #f8fafc; - display: flex; - align-items: center; - justify-content: space-between; - gap: 12px; -} - -.claim-product-item-row span { - min-width: 0; - color: #0f172a; - font-weight: 700; - line-height: 1.35; - overflow-wrap: anywhere; -} - -.claim-product-item-row strong { - flex: 0 0 auto; - color: #0f172a; - font-size: 15px; -} - -.claim-product-items.compact { - margin-top: 10px; - gap: 8px; -} - -.claim-product-items.compact .claim-product-items-list { - gap: 6px; -} - -.claim-product-items.compact .claim-product-item-row { - min-height: 36px; - padding: 8px 10px; - background: rgba(248, 250, 252, 0.72); -} - -/* 待领取物品图:居中大图;imageUrl 为空或加载失败时是同一尺寸的虚线占位块(不会出现破图) */ - -.claim-product-image-wrap { - display: flex; - justify-content: center; -} - -.claim-product-image { - width: min(160px, 48%); - aspect-ratio: 1 / 1; - border-radius: 16px; - object-fit: contain; - background: #f8fafc; - padding: 8px; - border: 1px solid rgba(148, 163, 184, 0.24); - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); -} - -.claim-product-image-fallback { - display: flex; - align-items: center; - justify-content: center; - font-size: 46px; - color: rgba(100, 116, 139, 0.55); - border-style: dashed; -} - -/* ===== 收集页 (Collect Page) ===== */ - -.collect-page { - min-height: 100vh; - display: grid; - place-items: center; - padding: 32px 16px; - background: #f5f7fb; -} - -.collect-card { - width: min(520px, 100%); -} - -.collect-order-input { - flex: 1; - margin-bottom: 0; -} - -/* ===== 一次性补资料链接页 (Collect Material Link) ===== */ - -.collect-link-page { - min-height: 100vh; - padding: 32px 16px; - background: #f5f7fb; - display: flex; - justify-content: center; - align-items: flex-start; -} - -.collect-link-card { - width: min(720px, 100%); -} - -.collect-link-card .ant-card-body { - padding: 28px; -} - -/* 一单多工单时,内层商品卡片比外层容器更紧凑 */ -.collect-link-order-card .ant-card-body { - padding: 16px; -} - -.collect-link-status-card { - background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%); -} - -.collect-link-status-card .ant-card-body { - padding: 16px; -} - -.collect-link-status-head { - display: flex; - align-items: center; - justify-content: space-between; - flex-wrap: wrap; - gap: 8px; - color: #0f172a; - font-size: 15px; -} - -.collect-link-status-head .ant-tag { - margin-inline-end: 0; -} - -.collect-link-order-meta { - display: flex; - flex-wrap: wrap; - gap: 4px 18px; - color: #64748b; - font-size: 13px; -} - -.collect-link-order-meta strong { - color: #0f172a; - font-weight: 600; -} - -.collect-link-description { - margin-top: 6px; - font-size: 12px; -} - -.collect-link-submitted { - display: grid; - gap: 10px; - padding: 12px; - background: #f8fafc; - border: 1px solid #e7edf5; - border-radius: 10px; -} - -.collect-link-submitted-head { - display: flex; - flex-wrap: wrap; - align-items: flex-start; - justify-content: space-between; - gap: 5px 14px; -} - -.collect-link-submitted-head > span { - display: grid; - gap: 1px; -} - -.collect-link-submitted-head .ant-typography:last-child { - font-size: 11px; -} - -.collect-link-submitted-head > .ant-typography { - font-size: 11px; -} - -.collect-link-submitted-fields { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 7px; -} - -.collect-link-submitted-fields > div { - display: grid; - gap: 2px; - min-width: 0; - padding: 8px 10px; - background: #ffffff; - border: 1px solid #edf1f6; - border-radius: 8px; -} - -.collect-link-submitted-fields span, -.collect-link-submitted-screenshots > span { - color: #94a3b8; - font-size: 11px; -} - -.collect-link-submitted-fields strong { - color: #1e293b; - font-size: 13px; - font-weight: 500; - line-height: 1.5; - white-space: pre-wrap; - overflow-wrap: anywhere; -} - -.collect-link-submitted-screenshots { - display: grid; - gap: 7px; -} - -.collect-link-submitted-screenshots > div { - display: flex; - flex-wrap: wrap; - gap: 8px; -} - -.collect-link-submitted-screenshots .ant-image { - overflow: hidden; - border: 1px solid #dbe3ee; - border-radius: 8px; -} - -.collect-link-submitted-screenshots .ant-image-img { - object-fit: cover; -} - -.collect-link-current-status { - display: grid; - grid-template-columns: auto minmax(0, 1fr); - gap: 12px; - align-items: flex-start; - padding: 13px; - color: #475569; - background: #f8fafc; - border: 1px solid #e8edf4; - border-left: 4px solid #94a3b8; - border-radius: 9px; -} - -.collect-link-current-status-index { - display: inline-flex; - align-items: center; - justify-content: center; - width: 30px; - height: 30px; - color: #ffffff; - font-size: 13px; - font-weight: 700; - background: #64748b; - border-radius: 999px; -} - -.collect-link-current-status-copy { - display: grid; - gap: 5px; - min-width: 0; -} - -.collect-link-current-status-copy > div { - display: flex; - flex-wrap: wrap; - gap: 3px 12px; - align-items: baseline; - justify-content: space-between; -} - -.collect-link-current-status-copy > div .ant-typography:last-child { - font-size: 11px; -} - -.collect-link-current-status-copy p { - margin: 0; - color: inherit; - font-size: 13px; - line-height: 1.7; - white-space: pre-wrap; - overflow-wrap: anywhere; -} - -.collect-link-current-status.is-open, -.collect-link-current-status.is-pending_material { - color: #8a4b00; - background: #fffaf0; - border-color: #ffe7ba; - border-left-color: #faad14; -} - -.collect-link-current-status.is-open .collect-link-current-status-index, -.collect-link-current-status.is-pending_material .collect-link-current-status-index { - background: #faad14; -} - -.collect-link-current-status.is-in_progress, -.collect-link-current-status.is-unassigned { - color: #0958d9; - background: #f0f7ff; - border-color: #d6e8ff; - border-left-color: #1677ff; -} - -.collect-link-current-status.is-in_progress .collect-link-current-status-index, -.collect-link-current-status.is-unassigned .collect-link-current-status-index { - background: #1677ff; -} - -.collect-link-current-status.is-pending_acceptance { - color: #531dab; - background: #f9f0ff; - border-color: #efdbff; - border-left-color: #722ed1; -} - -.collect-link-current-status.is-pending_acceptance .collect-link-current-status-index { - background: #722ed1; -} - -.collect-link-current-status.is-accepted { - color: #237804; - background: #f6ffed; - border-color: #d9f7be; - border-left-color: #52c41a; -} - -.collect-link-current-status.is-accepted .collect-link-current-status-index { - background: #52c41a; -} - -.collect-link-current-status.is-problem { - color: #a8071a; - background: #fff1f0; - border-color: #ffccc7; - border-left-color: #ff4d4f; -} - -.collect-link-current-status.is-problem .collect-link-current-status-index { - background: #ff4d4f; -} - -.collect-link-status-message { - padding: 10px 12px; - color: #475569; - font-size: 13px; - line-height: 1.65; - background: #f8fafc; - border-left: 3px solid #94a3b8; - border-radius: 0 8px 8px 0; -} - -.collect-link-status-message.is-open, -.collect-link-status-message.is-pending_material { - color: #8a4b00; - background: #fffaf0; - border-left-color: #faad14; -} - -.collect-link-status-message.is-in_progress, -.collect-link-status-message.is-unassigned { - color: #0958d9; - background: #f0f7ff; - border-left-color: #1677ff; -} - -.collect-link-status-message.is-pending_acceptance { - color: #531dab; - background: #f9f0ff; - border-left-color: #722ed1; -} - -.collect-link-status-message.is-accepted { - color: #237804; - background: #f6ffed; - border-left-color: #52c41a; -} - -.collect-link-status-message.is-problem { - color: #a8071a; - background: #fff1f0; - border-left-color: #ff4d4f; -} - -.collect-link-status-times { - display: flex; - flex-wrap: wrap; - gap: 4px 18px; - color: #94a3b8; - font-size: 12px; -} - -.collect-link-acceptance { - display: grid; - gap: 10px; - padding-top: 12px; - border-top: 1px solid #eef2f7; -} - -.collect-link-acceptance > div:first-child { - display: flex; - align-items: baseline; - justify-content: space-between; - flex-wrap: wrap; - gap: 4px 12px; -} - -.collect-link-acceptance > div:first-child .ant-typography:last-child { - font-size: 12px; -} - -.collect-link-acceptance-images { - display: flex; - flex-wrap: wrap; - gap: 10px; -} - -.collect-link-acceptance-images .ant-image { - overflow: hidden; - border: 1px solid #dbe3ee; - border-radius: 9px; -} - -.collect-link-acceptance-images .ant-image-img { - object-fit: cover; -} - -.collect-link-acceptance-video { - display: grid; - gap: 8px; -} - -.collect-link-acceptance-video video { - width: min(100%, 520px); - max-height: 360px; - background: #0f172a; - border: 1px solid #dbe3ee; - border-radius: 10px; -} - -.collect-link-acceptance-video > div { - display: flex; - flex-wrap: wrap; - gap: 4px 14px; - align-items: center; - justify-content: space-between; - font-size: 12px; -} - -.collect-link-acceptance-video a { - color: #1677ff; -} - -.collect-link-title { - margin: 0 0 4px !important; -} - -.collect-link-heading { - display: flex; - align-items: flex-start; - justify-content: space-between; - gap: 12px; -} - -.collect-link-confirm { - display: grid; - gap: 12px; - max-height: 58vh; - padding-top: 4px; - padding-right: 4px; - overflow-y: auto; -} - -.collect-link-confirm-meta { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - gap: 4px 16px; - color: #64748b; - font-size: 12px; -} - -.collect-link-confirm-meta span:first-child { - color: #0f172a; - font-size: 14px; - font-weight: 600; -} - -.collect-link-confirm-fields { - overflow: hidden; - border: 1px solid #e8edf4; - border-radius: 9px; -} - -.collect-link-confirm-field { - display: grid; - grid-template-columns: 110px minmax(0, 1fr); - gap: 12px; - padding: 9px 12px; - font-size: 13px; - border-bottom: 1px solid #eef2f7; -} - -.collect-link-confirm-field:last-child { - border-bottom: 0; -} - -.collect-link-confirm-field span, -.collect-link-confirm-screenshots span { - color: #64748b; -} - -.collect-link-confirm-field strong, -.collect-link-confirm-screenshots strong { - color: #0f172a; - font-weight: 500; - white-space: pre-wrap; - overflow-wrap: anywhere; -} - -.collect-link-confirm-field strong.is-empty { - color: #94a3b8; -} - -.collect-link-confirm-screenshots { - display: grid; - gap: 8px; - padding: 10px 12px; - font-size: 13px; - background: #f8fafc; - border-radius: 9px; -} - -.collect-link-confirm-screenshots > div:first-child { - display: flex; - justify-content: space-between; - gap: 12px; -} - -.collect-link-confirm-images { - display: flex; - flex-wrap: wrap; - gap: 8px; -} - -.collect-link-confirm-images img { - width: 58px; - height: 58px; - object-fit: cover; - background: #ffffff; - border: 1px solid #dbe3ee; - border-radius: 8px; -} - -.collect-link-confirm-content { - padding: 10px 12px; - color: #8a4b00; - font-size: 13px; - line-height: 1.7; - background: #fff7e6; - border: 1px solid #ffe7ba; - border-radius: 9px; - white-space: pre-wrap; - overflow-wrap: anywhere; -} - -/* 商品名与订单号放在同一个信息头里,避免标题和灰色信息块分离 */ -.collect-link-order-head { - display: flex; - align-items: baseline; - justify-content: space-between; - flex-wrap: wrap; - gap: 6px 20px; - padding-bottom: 12px; - border-bottom: 1px solid #eef2f7; -} - -.collect-link-order-name { - min-width: 0; - display: flex; - align-items: center; - flex-wrap: wrap; - gap: 8px; - color: #0f172a; - font-size: 16px; - font-weight: 700; - overflow-wrap: anywhere; -} - -.collect-link-order-no { - min-width: 0; - display: flex; - align-items: baseline; - gap: 6px; - color: #64748b; - font-size: 12px; -} - -.collect-link-order-no strong { - color: #0f172a; - font-size: 14px; - font-weight: 600; - overflow-wrap: anywhere; -} - -.collect-link-state { - min-height: 220px; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - gap: 16px; -} - -/* 提交成功:居中的成功状态,不再展示订单号 */ -.collect-link-success { - min-height: 380px; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - gap: 10px; - padding: 24px 12px 8px; - text-align: center; -} - -.collect-link-success-icon { - font-size: 64px; - color: #22c55e; - filter: drop-shadow(0 10px 20px rgba(34, 197, 94, 0.18)); -} - -.collect-link-success-title { - margin: 2px 0 0 !important; - color: #0f172a; -} - -.collect-link-success-products { - max-width: 100%; - margin-top: 10px; - padding: 12px 22px; - border: 1px solid #dcfce7; - border-radius: 12px; - background: #f0fdf4; - display: flex; - flex-direction: column; - gap: 4px; -} - -.collect-link-success-products span { - color: #16a34a; - font-size: 12px; -} - -.collect-link-success-products strong { - color: #166534; - font-size: 15px; - overflow-wrap: anywhere; -} - -.collect-link-success .collect-link-footnote { - margin-top: 18px; -} - -.collect-link-screenshot-control { - display: grid; - gap: 14px; - align-items: start; -} - -.collect-link-screenshot-control.has-guide { - grid-template-columns: 120px minmax(180px, 260px); - gap: 16px; -} - -.collect-link-guide-example { - display: grid; - grid-template-columns: 1fr; - gap: 6px; - min-width: 0; - max-width: 100%; - align-content: start; - justify-items: start; -} - -.collect-link-guide-example .ant-image { - display: block; - width: 128px !important; - height: 88px !important; - overflow: hidden; - border: 1px solid #dbe3ee; - border-radius: 7px; - cursor: zoom-in; -} - -.collect-link-guide-example .ant-image-img { - display: block; - width: 128px !important; - height: 88px !important; - object-fit: cover; - object-position: center; -} - -.collect-link-guide-copy { - display: grid; - align-content: center; - gap: 3px; - min-width: 0; -} - -.collect-link-guide-copy .ant-typography:first-child { - color: #334155; - font-size: 12px; -} - -.collect-link-guide-copy .ant-typography:last-child { - max-width: 220px; - font-size: 11px; - line-height: 1.55; - white-space: pre-wrap; -} - -.collect-link-actions { - display: flex; - justify-content: flex-end; - margin-top: 4px; -} - -.collect-link-actions .ant-btn { - min-width: 180px; -} - -.collect-link-footnote { - display: block; - text-align: center; - font-size: 12px; - white-space: pre-wrap; -} - -@media (max-width: 720px) { - .collect-link-page { - padding: 14px; - } - - .collect-link-card .ant-card-body { - padding: 18px; - } - - .collect-link-screenshot-control.has-guide { - grid-template-columns: 112px minmax(160px, 220px); - gap: 12px; - } - - .collect-link-guide-example .ant-image { - width: 116px !important; - height: 80px !important; - } - - .collect-link-guide-example .ant-image-img { - width: 116px !important; - height: 80px !important; - } - - .collect-link-actions { - justify-content: stretch; - } - - .collect-link-actions .ant-btn { - width: 100%; - } -} - -@media (max-width: 480px) { - .collect-link-page { - padding: 10px; - } - - .collect-link-card .ant-card-body { - padding: 14px; - } - - .collect-link-screenshot-control.has-guide { - grid-template-columns: 104px minmax(0, 1fr); - gap: 8px; - } - - .collect-link-guide-example { - gap: 5px; - } - - .collect-link-guide-example .ant-image { - width: 96px !important; - height: 68px !important; - } - - .collect-link-guide-example .ant-image-img { - width: 96px !important; - height: 68px !important; - } - - .collect-link-guide-copy .ant-typography:first-child { - font-size: 11px; - } - - .collect-link-guide-copy .ant-typography:last-child { - font-size: 10px; - } - - .collect-link-success { - min-height: 320px; - padding: 16px 4px 4px; - } - - .collect-link-success-icon { - font-size: 52px; - } - - .collect-link-success-products { - padding: 10px 16px; - } - - .collect-link-confirm-field { - grid-template-columns: 88px minmax(0, 1fr); - padding: 8px 10px; - } - - .collect-link-order-meta, - .collect-link-submitted-fields { - grid-template-columns: 1fr; - } - - .collect-link-order-meta { - display: grid; - } -} - -/* ===== 兑换中心 (Redeem Page) ===== */ - -.redeem-page { - min-height: 100vh; - display: grid; - place-items: center; - padding: 32px 16px; - background: #f5f7fb; -} - -.redeem-card { - width: min(520px, 100%); -} - -.redeem-order-input { - flex: 1; - margin-bottom: 0; -} - -/* ===== H5 领取入口页(`/h5`,只有前缀没有订单号) ===== */ - -/* 复用领取页的卡片与背景,只把单卡在视口内垂直居中 */ -.h5-claim-entry { - justify-content: center; -} - -/* ===== 买家页面响应式断点 ===== */ - -@media (max-width: 720px) { - .claim-page { - padding: 14px; - } - - .claim-header-card .ant-card-body, - .claim-content-card .ant-card-body { - gap: 14px; - } - - .claim-header-copy { - padding-right: 150px; - } - - .claim-header-copy h1 { - font-size: 24px; - line-height: 1.22; - } - - .claim-header-copy p { - font-size: 14px; - line-height: 1.4; - } - - .claim-step-indicator { - top: 16px; - right: 16px; - max-width: 140px; - } - - .claim-step-dots { - gap: 5px; - } - - .claim-step-dot { - width: 26px; - height: 26px; - font-size: 13px; - } - - .claim-step-progress-text { - font-size: 12px; - } - - .claim-info-grid { - grid-template-columns: 1fr; - } - - .claim-qr-block { - padding: 12px; - } - - .claim-qr-guide-panel { - grid-template-columns: 34px minmax(0, 1fr) 34px; - gap: 8px; - max-width: 100%; - } - - .claim-scan-label { - min-height: 128px; - padding: 8px 4px; - font-size: 14px; - } - - .claim-qr-code { - max-width: 232px; - padding: 8px; - } - - .claim-save-hint { - font-size: 13px; - } - - .claim-role-panel-item { - grid-template-columns: 76px minmax(0, 1fr); - gap: 10px; - } - - .claim-role-panel-item span { - font-size: 12px; - } - - .claim-role-panel-item strong { - font-size: 16px; - } - - .claim-action-row { - display: flex; - flex-direction: column; - align-items: stretch; - } - - .claim-action-row .ant-space-item, - .claim-action-row .ant-btn, - .claim-action-tooltip-wrap { - width: 100%; - } - - .claim-meta-footer { - justify-content: flex-start; - } - - .claim-result-header { - display: grid; - } -} - -@media (max-width: 480px) { - .claim-page { - padding: 12px; - gap: 10px; - } - - .claim-header-card .ant-card-body, - .claim-content-card .ant-card-body { - gap: 12px; - } - - .claim-header-copy { - padding-right: 112px; - } - - .claim-header-copy h1 { - font-size: 22px; - } - - .claim-step-indicator { - position: absolute; - top: 16px; - right: 16px; - max-width: 100px; - align-items: flex-end; - } - - .claim-step-dot { - width: 26px; - height: 26px; - font-size: 12px; - } - - .claim-step-dots { - gap: 5px; - } - - .claim-step-progress-text { - text-align: right; - font-size: 12px; - } - - .claim-uid-step-title.ant-typography { - font-size: 18px !important; - } - - .claim-uid-guide-image { - max-height: 140px; - } -} - -@media (max-width: 420px) { - .claim-header-copy { - padding-right: 124px; - } - - .claim-header-copy h1 { - font-size: 22px; - } - - .claim-header-copy p { - padding-right: 0; - } - - .claim-step-indicator { - max-width: 116px; - } -} - -.customer-auth-page { - --auth-accent: #2f6fed; - --auth-accent-hover: #4a83ff; - --auth-panel: #232936; - --auth-panel-soft: #2a3140; - --auth-line: rgba(255, 255, 255, 0.08); - --auth-text: #f5f7fa; - --auth-muted: #9aa3b2; - min-height: 100vh; - display: flex; - justify-content: center; - overflow-x: hidden; - padding: 0; - color: var(--auth-text); - background: #232936; -} - -.customer-auth-shell { - width: min(560px, 100%); - min-width: 0; - align-self: stretch; - overflow: hidden; - border: none; - border-radius: 0; - background: transparent; - box-shadow: none; -} - -.customer-auth-hero { - min-height: auto; - display: flex; - align-items: center; - justify-content: center; - padding: 38px 16px 10px; - background: none; -} - -/* 微博登录页顶部 KV:与资料页共用 inside-kv.jpg,叠加深色渐变保证标题可读。 */ -.customer-auth-page.is-weibo .customer-auth-hero { - min-height: 134px; - align-items: flex-start; - justify-content: flex-start; - padding: 26px 20px 20px; - background-color: #0b1220; - background-image: - linear-gradient(180deg, rgba(11, 18, 32, 0.12) 0%, rgba(11, 18, 32, 0.72) 72%, #232936 100%), - url('/images/customer/inside-kv.jpg'); - background-repeat: no-repeat; - background-position: center 38%; - background-size: cover; -} - -.customer-auth-page.is-weibo .customer-auth-brand { - width: 100%; - justify-content: flex-start; -} - -.customer-auth-page.is-weibo .customer-auth-brand h1 { - text-align: left; - text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72); -} - -@media (max-width: 640px) { - .customer-auth-page.is-weibo .customer-auth-hero { - min-height: 118px; - padding: 20px 16px 14px; - background-position: center 42%; - } -} - -.customer-auth-brand { - display: flex; - align-items: center; - justify-content: center; - gap: 0; - min-width: 0; -} - -.customer-auth-logo { - width: 62px; - height: 62px; - flex: none; - display: grid; - place-items: center; - border: 1px solid rgba(255, 255, 255, 0.22); - border-radius: 8px; - color: var(--auth-accent); - font-size: 34px; - background: rgba(3, 12, 34, 0.58); - box-shadow: inset 0 0 24px rgba(255, 138, 0, 0.06); -} - -.customer-auth-brand h1 { - margin: 0; - color: #fff; - font-size: 20px; - line-height: 1.4; - font-weight: 700; - letter-spacing: 0; - text-align: center; - white-space: normal; - overflow-wrap: anywhere; -} - -.customer-auth-warning { - padding: 6px 16px 10px; - color: #ff6975; - text-align: center; - font-size: 14px; - font-weight: 600; - background: transparent; - border-bottom: none; -} - -.customer-auth-main { - min-width: 0; - padding-bottom: 24px; - color: var(--auth-text); - background: transparent; -} - -.customer-auth-content-stack { - min-width: 0; - display: flex; - flex-direction: column; -} - -.customer-auth-task-switcher { - display: flex; - align-items: flex-start; - gap: 16px; - padding: 20px 24px; - border-bottom: 1px solid var(--auth-line); -} - -.customer-auth-task-switcher > span { - flex: none; - padding-top: 5px; - color: var(--auth-muted); - font-size: 13px; -} - -.customer-auth-task-switcher > div { - display: flex; - flex-wrap: wrap; - gap: 8px; -} - -.customer-auth-task-switcher .ant-btn { - height: auto; - padding: 6px 10px; - color: #dce6f8; - white-space: normal; - text-align: left; - border-color: rgba(255, 255, 255, 0.16); - background: rgba(255, 255, 255, 0.04); -} - -.customer-auth-task-switcher .ant-btn-primary { - color: #111827; - border-color: var(--auth-accent); -} - -.customer-auth-facts { - min-width: 0; - padding: 0 26px; -} - -.customer-auth-facts > div { - display: grid; - grid-template-columns: 132px minmax(0, 1fr); - align-items: center; - gap: 18px; - min-height: 74px; - padding: 16px 4px; - border-bottom: 1px solid var(--auth-line); -} - -.customer-auth-facts > div > span { - color: #c0c8d8; - font-size: 16px; -} - -.customer-auth-facts > div > strong { - min-width: 0; - justify-self: end; - color: #f8fafc; - font-size: 18px; - line-height: 1.5; - font-weight: 600; - text-align: right; - word-break: break-all; - overflow-wrap: anywhere; -} - -.customer-auth-section { - min-width: 0; - padding: 16px; - border-bottom: none; -} - -.customer-auth-section-heading { - display: flex; - align-items: flex-start; - gap: 14px; -} - -.customer-auth-section-icon { - width: 36px; - height: 36px; - flex: none; - display: grid; - place-items: center; - border: 1px solid rgba(255, 255, 255, 0.15); - border-radius: 8px; - color: var(--auth-accent); - font-size: 18px; - background: rgba(255, 255, 255, 0.035); -} - -.customer-auth-section-heading h2, -.customer-auth-state h2 { - margin: 0 0 6px; - color: #fff; - font-size: 18px; - line-height: 1.4; - font-weight: 700; -} - -.customer-auth-section-heading p, -.customer-auth-state p, -.customer-auth-form-copy { - margin: 0; - color: var(--auth-muted); - font-size: 15px; - line-height: 1.75; -} - -.customer-auth-section-copy h2 { - margin: 0 0 8px; - color: #fff; - font-size: 23px; - line-height: 1.35; - font-weight: 700; -} - -.customer-auth-section-copy p { - margin: 0; - color: var(--auth-muted); - font-size: 15px; - line-height: 1.75; -} - -.customer-auth-tabs { - margin-top: 22px; -} - -.customer-auth-tabs .ant-tabs-nav { - margin-bottom: 18px; -} - -.customer-auth-tabs .ant-tabs-nav::before { - display: none; -} - -.customer-auth-tabs .ant-tabs-nav-list { - width: 100%; - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 5px; - padding: 5px; - border: 1px solid rgba(148, 163, 184, 0.18); - border-radius: 11px; - background: rgba(4, 15, 37, 0.72); -} - -.customer-auth-tabs .ant-tabs-tab { - justify-content: center; - margin: 0 !important; - padding: 11px 18px; - color: var(--auth-muted); - background: transparent; - border: 0 !important; - border-radius: 7px; -} - -.customer-auth-tabs .ant-tabs-tab.ant-tabs-tab-active { - background: var(--auth-accent); -} - -.customer-auth-tabs .ant-tabs-tab-btn { - color: inherit !important; - font-size: 16px; -} - -.customer-auth-tabs .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn { - color: #111827 !important; - font-weight: 700; -} - -.customer-auth-tabs .ant-tabs-ink-bar { - display: none; -} - -.customer-auth-form { - display: flex; - flex-direction: column; - gap: 14px; - padding-top: 18px; -} - -.customer-auth-field { - display: grid; - align-items: center; - min-height: 50px; - overflow: hidden; - border: 1px solid rgba(148, 163, 184, 0.24); - border-radius: 10px; - background: rgba(13, 29, 61, 0.72); - transition: - border-color 0.2s ease, - box-shadow 0.2s ease; -} - -.customer-auth-field:focus-within { - border-color: var(--auth-accent); - box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.12); -} - -.customer-auth-field > * { - min-width: 0; -} - -.customer-auth-phone-field { - grid-template-columns: 58px minmax(0, 1fr) 112px; - padding: 4px; -} - -.customer-auth-code-field { - grid-template-columns: minmax(0, 1fr) 122px; - gap: 5px; - padding: 5px; -} - -.customer-auth-field .ant-select-selector, -.customer-auth-field .ant-input, -.customer-auth-field .ant-input-affix-wrapper { - color: #f8fafc !important; - border: 0 !important; - border-radius: 0 !important; - background: transparent !important; - box-shadow: none !important; -} - -.customer-auth-field .ant-select-selector { - height: 48px !important; - padding-inline: 14px !important; - align-items: center; -} - -.customer-auth-field .ant-select { - height: 48px; - background: transparent !important; -} - -.customer-auth-field .ant-select-selection-item { - color: #f8fafc !important; - line-height: 46px !important; -} - -.customer-auth-field .ant-select-arrow { - color: #c4cede !important; -} - -.customer-auth-country-prefix { - display: grid; - place-items: center; - align-self: stretch; - color: #f8fafc; - font-size: 14px; - font-weight: 600; - border-right: 1px solid var(--auth-line); -} - -.customer-auth-field .ant-input-affix-wrapper { - height: 48px; - padding-inline: 15px; -} - -.customer-auth-field .ant-input { - height: 48px; - padding-inline: 10px; - font-size: 15px; -} - -.customer-auth-field .ant-input-affix-wrapper .ant-input { - padding-inline: 0; -} - -.customer-auth-field .ant-input::placeholder { - color: #7f8ca5; -} - -.customer-auth-field .ant-input-prefix { - margin-inline-end: 9px; - color: var(--auth-accent); -} - -.customer-auth-send-code { - height: 40px !important; - padding-inline: 10px !important; - color: #111827; - border: 0 !important; - border-radius: 7px !important; - background: var(--auth-accent) !important; - font-size: 14px !important; - font-weight: 700; -} - -.customer-auth-send-code:hover { - background: var(--auth-accent-hover) !important; -} - -.customer-auth-code-submit { - height: 40px !important; - color: #111827; - border: 0 !important; - border-radius: 7px !important; - background: var(--auth-accent) !important; - font-weight: 700; -} - -.customer-auth-code-submit:hover { - background: var(--auth-accent-hover) !important; -} - -.customer-auth-note { - padding: 11px 14px; - color: #fbbf24; - font-size: 13px; - line-height: 1.6; - border: 1px solid rgba(251, 191, 36, 0.48); - border-radius: 4px; - background: rgba(251, 191, 36, 0.06); -} - -.customer-auth-form-hint { - color: #7f8ca5; - font-size: 12px; -} - -.customer-auth-page .ant-btn-primary { - color: #fff; - border-color: var(--auth-accent); - background: var(--auth-accent); - font-weight: 700; - box-shadow: none; -} - -.customer-auth-page .ant-btn-primary:hover { - color: #fff !important; - border-color: var(--auth-accent-hover) !important; - background: var(--auth-accent-hover) !important; -} - -.customer-auth-page .customer-auth-secondary-button { - color: #fff; - border-color: rgba(148, 163, 184, 0.42); - background: rgba(19, 39, 77, 0.52); -} - -.customer-auth-page .customer-auth-secondary-button:hover { - color: #fff !important; - border-color: rgba(196, 210, 236, 0.72) !important; - background: rgba(31, 55, 102, 0.72) !important; -} - -.huya-slider-challenge { - display: flex; - flex-direction: column; - gap: 14px; -} - -.huya-slider-challenge > p { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - gap: 6px 12px; - margin: 0; - color: #475569; - font-size: 14px; - line-height: 1.65; -} - -.huya-challenge-progress { - color: #c2410c; - font-size: 12px; - font-weight: 700; -} - -.huya-click-tip { - display: block; - max-width: 100%; - max-height: 64px; - object-fit: contain; -} - -.huya-slider-stage { - position: relative; - width: 100%; - overflow: hidden; - border: 1px solid rgba(148, 163, 184, 0.36); - border-radius: 8px; - background: #e2e8f0; - user-select: none; -} - -.huya-slider-stage.is-click { - cursor: crosshair; -} - -.huya-slider-background, -.huya-slider-puzzle { - pointer-events: none; - user-select: none; -} - -.huya-slider-puzzle.is-rotate { - transform-origin: center; -} - -.huya-click-point { - position: absolute; - display: grid; - width: 24px; - height: 24px; - place-items: center; - color: #fff; - font-size: 12px; - font-weight: 700; - border: 2px solid #fff; - border-radius: 50%; - background: #ea580c; - box-shadow: 0 2px 8px rgba(15, 23, 42, 0.32); - transform: translate(-50%, -50%); - pointer-events: none; -} - -.huya-slider-background { - display: block; - width: 100%; - height: 100%; -} - -.huya-slider-puzzle { - position: absolute; - max-width: none; - height: auto; -} - -.huya-slider-track { - position: relative; - height: 46px; - overflow: hidden; - border: 1px solid rgba(148, 163, 184, 0.36); - border-radius: 8px; - background: #f1f5f9; - touch-action: none; -} - -.huya-slider-track-fill { - position: absolute; - inset: 0 auto 0 0; - max-width: 100%; - background: rgba(249, 115, 22, 0.16); -} - -.huya-slider-handle { - position: absolute; - top: 3px; - left: 3px; - width: 58px; - height: 38px; - padding: 0; - color: #111827; - font-size: 13px; - font-weight: 700; - border: 0; - border-radius: 6px; - background: #f97316; - cursor: grab; - touch-action: none; -} - -.huya-slider-handle:active { - cursor: grabbing; -} - -.huya-rotate-control { - display: grid; - grid-template-columns: minmax(0, 1fr) 48px; - gap: 12px; - align-items: center; -} - -.huya-rotate-control > span { - color: #475569; - font-size: 13px; - font-variant-numeric: tabular-nums; - text-align: right; -} - -.customer-auth-qr { - display: flex; - flex-direction: column; - align-items: center; - gap: 13px; - padding-top: 22px; - text-align: center; -} - -.customer-auth-qr > p { - margin: 0; - color: var(--auth-muted); - line-height: 1.7; -} - -.customer-auth-qr-image, -.customer-auth-qr-placeholder { - display: grid; - place-items: center; - width: 252px; - min-height: 252px; - padding: 10px; - border-radius: 6px; - background: #fff; -} - -.customer-auth-qr-placeholder { - color: #64748b; - font-size: 13px; - background: rgba(255, 255, 255, 0.94); -} - -.customer-auth-role-card { - width: min(100%, 580px); - display: grid; - grid-template-columns: minmax(0, 1fr) auto; - gap: 4px 18px; - padding: 15px 18px; - text-align: left; - border: 1px solid rgba(255, 138, 0, 0.42); - border-radius: 5px; - background: rgba(255, 138, 0, 0.06); -} - -.customer-auth-role-card span { - color: var(--auth-muted); - font-size: 13px; -} - -.customer-auth-role-card strong { - justify-self: end; - color: #fff; - font-size: 17px; -} - -.customer-auth-role-card small { - grid-column: 1 / -1; - color: var(--auth-muted); - font-size: 12px; -} - -.customer-auth-binding { - display: flex; - flex-direction: column; - gap: 16px; -} - -.customer-auth-binding-tip { - color: #ffb454; - font-size: 13px; -} - -.customer-auth-profile { - padding: 16px; - border: 1px solid #3a4150; - border-radius: 12px; - background: #212733; -} - -.customer-auth-profile-summary { - padding: 14px; - border: 1px solid rgba(255, 255, 255, 0.14); - border-radius: 6px; - background: rgba(255, 255, 255, 0.04); -} - -.customer-auth-profile > p { - margin: 0 0 12px; - color: #9aa3b2; - font-size: 13px; - line-height: 1.6; -} - -.customer-profile-form { - display: flex; - flex-direction: column; - gap: 12px; -} - -.customer-profile-form .customer-collect-label { - margin-top: 2px; -} - -.customer-auth-profile-summary { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 10px; -} - -.customer-auth-profile-summary span { - color: var(--auth-muted); - font-size: 13px; -} - -.customer-auth-profile-summary strong { - color: #fff; - font-size: 15px; -} - -.customer-auth-profile-summary em { - color: var(--auth-muted); - font-style: normal; - font-size: 13px; -} - -/* 客户资料页(图 1) */ -.customer-collect-page { - min-height: 100vh; - background: #0b1220; - color: #e5e7eb; -} - -/* 资料页顶部 KV:原图 https://game.gtimg.cn/images/gp/web201908/inside_kv.jpg(本地 1600×510 q82) */ -.customer-collect-hero { - position: relative; - min-height: clamp(190px, 24vw, 240px); - display: flex; - align-items: flex-end; - justify-content: center; - padding: 0 20px 16px; - overflow: hidden; - text-align: center; - background-color: #0b1220; - background-image: - linear-gradient(180deg, rgba(11, 18, 32, 0) 45%, rgba(11, 18, 32, 0.55) 72%, #0b1220 100%), - url('/images/customer/inside-kv.jpg'); - background-repeat: no-repeat; - background-position: center 38%; - background-size: cover; -} - -.customer-collect-warning { - margin: 0; - text-align: center; - color: #f87171; - font-size: 17px; - font-weight: 600; - text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); -} - -@media (max-width: 640px) { - .customer-collect-hero { - min-height: 180px; - padding: 0 16px 14px; - background-position: center 42%; - } - - .customer-collect-warning { - font-size: 15px; - } -} - -.customer-collect-body { - max-width: 560px; - margin: 0 auto; - padding: 24px 20px 48px; - display: flex; - flex-direction: column; - gap: 12px; -} - -.customer-collect-label { - margin-top: 8px; - color: #e5e7eb; - font-size: 15px; - line-height: 1.4; -} - -.customer-collect-label span { - color: #f87171; -} - -.customer-collect-readonly { - height: 48px; - display: flex; - align-items: center; - padding: 0 16px; - border-radius: 12px; - background: #1b2436; - border: 1px solid #26344d; - color: #94a3b8; - font-size: 15px; -} - -.customer-collect-card { - margin: 10px 0; - padding: 16px; - border-radius: 12px; - border: 1px solid #1e2f4a; - background: #141d30; - display: flex; - flex-direction: column; - gap: 12px; -} - -.customer-collect-card > div { - display: flex; - align-items: flex-start; - justify-content: space-between; - gap: 12px; - color: #cbd5e1; - font-size: 15px; - line-height: 1.5; -} - -.customer-collect-card > div > span { - flex: 0 0 auto; - white-space: nowrap; -} - -.customer-collect-card > div strong { - flex: 1 1 auto; - min-width: 0; - color: #fff; - font-weight: 600; - text-align: right; - overflow-wrap: anywhere; -} - -.customer-collect-card > p { - margin: 6px 0 0; - color: #fbbf24; - font-size: 13px; - text-align: center; -} - -.customer-collect-input.ant-input { - height: 48px; - border-radius: 12px; - background: #1b2436; - border-color: #26344d; - color: #fff; -} - -.customer-collect-input.ant-input::placeholder { - color: #64748b; -} - -.customer-collect-select.ant-select { - width: 100%; - height: 48px; - padding-inline: 16px; - align-items: center; - font-size: 15px; - border-radius: 12px; - border: 1px solid #26344d; - background: #1b2436; - color: #fff; - --ant-select-height: 48px; - --ant-select-border-radius: 12px; - --ant-select-border-color: #26344d; - --ant-select-background-color: #1b2436; - --ant-select-color: #fff; - --ant-select-hover-border-color: #3b4d6b; - --ant-select-active-border-color: #2563eb; - --ant-select-active-outline-color: rgba(37, 99, 235, 0.2); -} - -.customer-collect-select.ant-select:hover { - border-color: #3b4d6b; -} - -.customer-collect-select.ant-select.ant-select-focused { - border-color: #2563eb; - box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); -} - -.customer-collect-select .ant-select-content { - align-items: center; -} - -.customer-collect-select .ant-select-selection-item { - color: #fff; - line-height: 1.5; -} - -.customer-collect-select .ant-select-placeholder { - color: #64748b; -} - -.customer-collect-select .ant-select-suffix { - color: #94a3b8; -} - -.ant-select-dropdown.customer-collect-dropdown { - padding: 6px; - border-radius: 12px; - background: #141d30; - box-shadow: 0 14px 34px rgba(2, 6, 23, 0.55); - --ant-select-option-active-bg: #1b2436; - --ant-select-option-selected-bg: #1e3a8a; - --ant-select-option-selected-color: #fff; -} - -.customer-collect-dropdown .ant-select-item { - border-radius: 8px; - color: #cbd5e1; -} - -.customer-collect-dropdown .ant-select-item-option-active { - background: #1b2436 !important; - color: #fff; -} - -.customer-collect-dropdown .ant-select-item-option-selected { - background: #1e3a8a !important; - color: #fff; - font-weight: 600; -} - -.customer-collect-page .customer-collect-submit.ant-btn, -.customer-auth-profile .customer-collect-submit.ant-btn { - height: 52px; - margin-top: 14px; - border-radius: 14px; - font-size: 17px; - font-weight: 600; - --ant-btn-bg-color: #2563eb; - --ant-btn-bg-color-hover: #1d4ed8; - --ant-btn-bg-color-active: #1e40af; - --ant-btn-text-color: #fff; - --ant-btn-text-color-hover: #fff; - --ant-btn-text-color-active: #fff; - --ant-btn-border-color: #2563eb; - --ant-btn-border-color-hover: #1d4ed8; - --ant-btn-border-color-active: #1e40af; - background: #2563eb !important; - border-color: #2563eb !important; - color: #fff !important; -} - -.customer-collect-page .customer-collect-submit.ant-btn:hover, -.customer-collect-page .customer-collect-submit.ant-btn:focus-visible, -.customer-auth-profile .customer-collect-submit.ant-btn:hover, -.customer-auth-profile .customer-collect-submit.ant-btn:focus-visible { - background: #1d4ed8 !important; - border-color: #1d4ed8 !important; - color: #fff !important; -} - -/* 登录与绑定页(图 2-10) */ -.customer-login-form { - display: flex; - flex-direction: column; - gap: 12px; -} - -.customer-login-hint { - margin: 0 0 2px; - color: #d5dae3; - font-size: 16px; - line-height: 1.5; -} - -.customer-login-mobile-row { - display: flex; - align-items: stretch; - gap: 12px; -} - -.customer-login-mobile.ant-input { - flex: 1; - min-width: 0; - height: 48px; - padding: 0 16px; - border-radius: 8px; - border-color: #3a4150; - background: #1b2130; - color: #fff; - font-size: 15px; -} - -.customer-login-mobile.ant-input::placeholder { - color: #6b7482; -} - -.customer-login-code-button.ant-btn { - flex: none; - width: 118px; - height: 48px; - border-radius: 8px; - background: #3b82f6 !important; - border-color: #3b82f6 !important; - color: #fff !important; - font-size: 16px; -} - -.customer-login-code-input.ant-input { - height: 48px; - border-radius: 8px; - border-color: #3a4150; - background: #1b2130; - color: #fff; - text-align: center; - font-size: 15px; - letter-spacing: 6px; -} - -.customer-login-code-input.ant-input::placeholder { - color: #6b7482; -} - -.customer-login-submit.ant-btn { - height: 52px; - border-radius: 14px; - background: #2563eb !important; - border-color: #2563eb !important; - color: #fff !important; - font-size: 17px; - font-weight: 600; -} - -.customer-login-submit.ant-btn:hover, -.customer-login-submit.ant-btn:focus-visible { - background: #1d4ed8 !important; - border-color: #1d4ed8 !important; - color: #fff !important; -} - -.customer-login-alt.ant-btn { - height: 48px; - border-radius: 8px; - background: transparent !important; - border-color: #3a4150 !important; - color: #cbd5e1 !important; - font-size: 16px; -} - -.customer-order-card { - margin: 10px 16px 0; - padding: 16px; - border: 1px solid #3a4150; - border-radius: 12px; - background: #212733; - display: flex; - flex-direction: column; - gap: 10px; -} - -.customer-order-card h3 { - margin: 0 0 4px; - color: #94a3b8; - font-size: 13px; - font-weight: 500; -} - -.customer-order-card > div { - display: flex; - align-items: flex-start; - justify-content: space-between; - gap: 12px; - color: #cbd5e1; - font-size: 14px; - line-height: 1.5; -} - -.customer-order-card > div > span { - flex: 0 0 auto; - white-space: nowrap; - color: #9aa3b2; -} - -.customer-order-card > div strong { - flex: 1 1 auto; - min-width: 0; - color: #fff; - text-align: right; - overflow-wrap: anywhere; -} - -.customer-order-card > div strong.customer-order-status { - flex: 0 0 auto; - padding: 3px 12px; - border: 1px solid rgba(96, 165, 250, 0.38); - border-radius: 999px; - color: #dbeafe; - font-size: 13px; - font-weight: 600; - text-align: center; - background: rgba(47, 111, 237, 0.28); -} - -.customer-binding-stage { - display: flex; - flex-direction: column; - gap: 14px; - padding: 16px; -} - -.customer-binding-session-card { - display: flex; - flex-direction: column; - gap: 10px; - padding: 18px; - border: 1px solid #78350f; - border-radius: 12px; - background: rgba(120, 53, 15, 0.22); -} - -.customer-binding-session-title { - margin: 0; - color: #fbbf24; - font-size: 16px; - font-weight: 700; -} - -.customer-binding-session-desc { - margin: 0 0 4px; - color: #fcd34d; - font-size: 13px; - line-height: 1.6; -} - -.customer-binding-qr-error { - display: flex; - flex-direction: column; - align-items: center; - gap: 10px; - padding: 24px 12px; - text-align: center; -} - -.customer-binding-qr-error p { - margin: 0; - color: #fca5a5; - font-size: 15px; - font-weight: 600; -} - -.customer-binding-qr-error span { - color: #cbd5e1; - font-size: 13px; - line-height: 1.6; - overflow-wrap: anywhere; -} - -/* antd Alert 在绑定阶段统一走深色卡片,避免浅色块破坏整体深色风格 */ -.customer-binding-stage .ant-alert { - align-items: flex-start; - padding: 12px 14px; - border: 1px solid #3a4150; - border-radius: 12px; - background: #212733; -} - -.customer-binding-stage .ant-alert .ant-alert-message { - color: #e2e8f0; - font-size: 14px; - font-weight: 600; -} - -/* antd v6 的标题节点是 .ant-alert-title(v5 为 .ant-alert-message) */ -.customer-binding-stage .ant-alert .ant-alert-title { - color: #e2e8f0; - font-size: 14px; - font-weight: 600; - line-height: 1.5; -} - -.customer-binding-stage .ant-alert .ant-alert-description { - color: #cbd5e1; - font-size: 13px; - line-height: 1.6; -} - -.customer-binding-stage .ant-alert-warning { - border-color: #78350f; - background: rgba(120, 53, 15, 0.22); -} - -.customer-binding-stage .ant-alert-warning .ant-alert-icon, -.customer-binding-stage .ant-alert-warning .ant-alert-message, -.customer-binding-stage .ant-alert-warning .ant-alert-title { - color: #fbbf24; -} - -.customer-binding-stage .ant-alert-warning .ant-alert-description { - color: #fcd34d; -} - -.customer-binding-stage .ant-alert-error { - border-color: #7f1d1d; - background: rgba(127, 29, 29, 0.24); -} - -.customer-binding-stage .ant-alert-error .ant-alert-icon, -.customer-binding-stage .ant-alert-error .ant-alert-message, -.customer-binding-stage .ant-alert-error .ant-alert-title { - color: #fca5a5; -} - -.customer-binding-stage .ant-alert-error .ant-alert-description { - color: #fecaca; -} - -.customer-binding-stage .ant-alert-success { - border-color: #065f46; - background: rgba(6, 78, 59, 0.28); -} - -.customer-binding-stage .ant-alert-success .ant-alert-icon, -.customer-binding-stage .ant-alert-success .ant-alert-message, -.customer-binding-stage .ant-alert-success .ant-alert-title { - color: #6ee7b7; -} - -.customer-binding-stage .ant-alert-success .ant-alert-description { - color: #a7f3d0; -} - -.customer-binding-role-actions { - display: flex; - flex-direction: column; - gap: 12px; - width: 100%; -} - -.customer-binding-role-actions .customer-binding-confirm.ant-btn { - height: 52px; - border-radius: 14px; - background: #2563eb !important; - border-color: #2563eb !important; - color: #fff !important; - font-size: 17px; - font-weight: 600; -} - -.customer-binding-role-actions .customer-binding-confirm.ant-btn:hover, -.customer-binding-role-actions .customer-binding-confirm.ant-btn:focus-visible { - background: #1d4ed8 !important; - border-color: #1d4ed8 !important; - color: #fff !important; -} - -.customer-binding-role-actions .customer-binding-rebind.ant-btn { - height: 48px; - border-radius: 14px; - background: transparent !important; - border-color: #3a4150 !important; - color: #cbd5e1 !important; - font-size: 16px; - font-weight: 500; -} - -.customer-binding-role-actions .customer-binding-rebind.ant-btn .anticon { - color: #f59e0b; -} - -.customer-binding-role-actions .customer-binding-rebind.ant-btn:hover, -.customer-binding-role-actions .customer-binding-rebind.ant-btn:focus-visible { - background: rgba(245, 158, 11, 0.08) !important; - border-color: #b45309 !important; - color: #fbbf24 !important; -} - -.customer-binding-role-actions .customer-binding-accept.ant-btn { - height: 46px; - border-radius: 12px; - background: transparent !important; - border-color: transparent !important; - color: #94a3b8 !important; - font-size: 15px; - font-weight: 500; -} - -.customer-binding-role-actions .customer-binding-accept.ant-btn:hover, -.customer-binding-role-actions .customer-binding-accept.ant-btn:focus-visible { - background: rgba(148, 163, 184, 0.1) !important; - border-color: transparent !important; - color: #e2e8f0 !important; -} - -.customer-binding-info { - padding: 16px; - border: 1px solid #3a4150; - border-radius: 12px; - background: #212733; - display: flex; - flex-direction: column; - gap: 10px; -} - -.customer-binding-info h3 { - margin: 0 0 4px; - color: #9aa3b2; - font-size: 13px; - font-weight: 500; -} - -.customer-binding-info h3 small { - color: #64748b; - font-weight: 400; -} - -.customer-binding-info > div { - display: flex; - align-items: flex-start; - justify-content: space-between; - gap: 12px; - color: #cbd5e1; - font-size: 14px; - line-height: 1.5; -} - -.customer-binding-info > div > span { - flex: 0 0 auto; - white-space: nowrap; -} - -.customer-binding-info > div strong { - flex: 1 1 auto; - min-width: 0; - color: #fff; - text-align: right; - overflow-wrap: anywhere; -} - -.customer-binding-alert { - padding: 12px 14px; - border-radius: 8px; - border: 1px solid transparent; - font-size: 14px; -} - -.customer-binding-alert.is-warning { - color: #fbbf24; - border-color: #78350f; - background: rgba(120, 53, 15, 0.25); -} - -.customer-binding-alert.is-info { - color: #93c5fd; - border-color: #1e3a8a; - background: rgba(30, 58, 138, 0.3); -} - -.customer-binding-verify { - padding: 18px; - border: 1px solid #3a4150; - border-radius: 12px; - background: transparent; - display: flex; - flex-direction: column; - gap: 16px; - text-align: center; -} - -.customer-binding-verify p { - margin: 0; - color: #e5e7eb; - font-size: 16px; - line-height: 1.6; -} - -.customer-binding-qr-card { - padding: 18px; - border-radius: 12px; - background: #fff; - color: #111827; - display: flex; - flex-direction: column; - align-items: center; - gap: 10px; -} - -.customer-binding-qr-card h3 { - margin: 0; - color: #6b7280; - font-size: 14px; - font-weight: 500; -} - -.customer-binding-qr-hint { - margin: 0; - color: #6b7280; - font-size: 13px; -} - -.customer-binding-qr-tip { - margin: 0; - color: #f59e0b; - font-size: 13px; -} - -.customer-binding-qr-countdown { - margin: 0; - color: #6b7280; - font-size: 13px; -} - -.customer-binding-qr-actions { - width: 100%; - margin-top: 4px; - display: grid; - grid-template-columns: 1fr 1fr; - gap: 10px; -} - -.customer-binding-qr-actions .ant-btn { - height: 40px; - border-radius: 8px; -} - -/* 斗鱼客户领取页沿用后台深色二维码面板,避免大块纯白卡片刺眼。 */ -.customer-auth-page.is-douyu .customer-binding-qr-card { - padding: 18px; - color: var(--auth-text); - border: 1px solid #3a4150; - border-radius: 14px; - background: #202631; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035); -} - -.customer-auth-page.is-douyu .customer-binding-qr-card h3 { - color: #d7dee9; - font-size: 15px; - font-weight: 600; -} - -.customer-auth-page.is-douyu .customer-binding-qr-code { - width: min(100%, 292px); - aspect-ratio: 1; - display: grid; - place-items: center; - padding: 14px; - overflow: hidden; - border: 1px solid #4a5262; - border-radius: 12px; - background: #e8ebef; - box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22); -} - -.customer-auth-page.is-douyu .customer-binding-qr-code .ant-image, -.customer-auth-page.is-douyu .customer-binding-qr-code img { - width: 100%; - height: 100%; - display: block; - border-radius: 7px; -} - -.customer-auth-page.is-douyu .customer-auth-qr-placeholder { - width: 100%; - min-height: 100%; - color: #8f9aab; - border: 1px dashed #485162; - border-radius: 9px; - background: #171c24; -} - -.customer-auth-page.is-douyu .customer-binding-qr-hint { - max-width: 340px; - color: #b8c1cf; - font-size: 13px; - line-height: 1.6; - text-align: center; -} - -.customer-auth-page.is-douyu .customer-binding-qr-countdown { - color: #cbd5e1; - font-variant-numeric: tabular-nums; -} - -.customer-auth-page.is-douyu .customer-binding-qr-card .ant-progress { - width: min(100%, 292px); -} - -.customer-auth-page.is-douyu .customer-binding-qr-card .ant-progress-inner { - background: #353d4b; -} - -.customer-auth-page.is-douyu .customer-binding-qr-card .ant-progress-bg { - background: #f59e0b; -} - -.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn { - color: #e2e8f0; - border-color: #465063; - background: #2a313d; - box-shadow: none; -} - -.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn:hover, -.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn:focus-visible { - color: #fff; - border-color: #657186; - background: #343c4a; -} - -.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn { - align-self: flex-end; - height: 34px; - padding-inline: 12px; - color: #b8c1cf; - border-color: #3f495a; - border-radius: 8px; - background: transparent; - font-size: 13px; - box-shadow: none; -} - -.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn:hover, -.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn:focus-visible { - color: #fff; - border-color: #64748b; - background: #2a313d; -} - -.customer-auth-page.is-douyu .customer-auth-hero { - min-height: 148px; - align-items: flex-end; - justify-content: center; - padding: 0 16px 18px; - background-color: #111827; - background-image: - linear-gradient(180deg, rgba(11, 18, 32, 0.08) 0%, rgba(11, 18, 32, 0.56) 68%, #232936 100%), - url('/images/customer/inside-kv.jpg'); - background-repeat: no-repeat; - background-position: center 38%; - background-size: cover; -} - -.customer-auth-page.is-douyu .customer-auth-brand { - width: auto; - align-items: flex-end; - justify-content: center; -} - -.customer-auth-page.is-douyu .customer-auth-brand h1 { - font-size: 16px; - line-height: 1.4; - text-align: center; - text-shadow: 0 2px 12px rgba(0, 0, 0, 0.82); -} - -.customer-auth-page.is-douyu .customer-auth-warning { - padding-top: 12px; -} - -.customer-auth-page.is-douyu .customer-order-closed-alert.ant-alert { - align-items: flex-start; - margin: 10px 16px 0; - padding: 12px 14px; - color: #f6c66f; - border: 1px solid #6b4d1f; - border-radius: 10px; - background: #2a2418; -} - -.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-icon { - margin-top: 2px; - color: #f6ad3c; - font-size: 16px; -} - -.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-message, -.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-title { - color: #f7d394; - font-size: 14px; - font-weight: 600; - line-height: 1.4; -} - -.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-description { - margin-top: 3px; - color: #d8c39b; - font-size: 13px; - line-height: 1.5; -} - -.customer-auth-page.is-douyu .customer-douyu-order-card { - padding: 0; - overflow: hidden; - gap: 0; - border-radius: 12px; - background: #202631; -} - -.customer-auth-page.is-douyu .customer-douyu-order-head { - align-items: center; - gap: 12px; - padding: 13px 16px; - border-bottom: 1px solid #343d4c; -} - -.customer-auth-page.is-douyu .customer-douyu-order-head h3 { - margin: 0; - color: #9aa3b2; - font-size: 13px; - font-weight: 600; -} - -.customer-auth-page.is-douyu .customer-douyu-order-field { - display: grid; - grid-template-columns: 72px minmax(0, 1fr); - align-items: start; - gap: 12px; - padding: 11px 16px; - border-bottom: 1px solid #343d4c; -} - -.customer-auth-page.is-douyu .customer-douyu-order-field:last-child { - border-bottom: 0; -} - -.customer-auth-page.is-douyu .customer-douyu-order-field > span { - color: #8f9aaa; - font-size: 13px; - line-height: 1.5; -} - -.customer-auth-page.is-douyu .customer-douyu-order-field > strong { - min-width: 0; - color: #f1f5f9; - font-size: 14px; - font-weight: 600; - line-height: 1.5; - text-align: right; - overflow-wrap: anywhere; -} - -.customer-auth-page.is-douyu .customer-douyu-order-status { - flex: 0 0 auto; - padding: 2px 10px; - border-color: rgba(96, 165, 250, 0.36); - color: #dbeafe; - font-size: 12px; - font-weight: 600; - background: rgba(47, 111, 237, 0.22); -} - -.customer-auth-page.is-douyu .customer-douyu-order-status.is-cancelled { - border-color: rgba(245, 158, 11, 0.38); - color: #f8d28a; - background: rgba(245, 158, 11, 0.14); -} - -.customer-auth-page.is-douyu .customer-douyu-order-status.is-completed { - border-color: rgba(52, 211, 153, 0.38); - color: #a7f3d0; - background: rgba(6, 95, 70, 0.24); -} - -.customer-auth-page.is-douyu .customer-douyu-order-status.is-failed { - border-color: rgba(248, 113, 113, 0.38); - color: #fecaca; - background: rgba(127, 29, 29, 0.24); -} - -.customer-douyu-qr-main { - width: 100%; - display: grid; - grid-template-columns: 30px minmax(0, 220px) 30px; - align-items: stretch; - justify-content: center; - gap: 7px; -} - -.customer-douyu-qr-rail { - display: flex; - align-items: center; - justify-content: center; - min-height: 0; - padding: 0; - color: #ff5a67; - font-size: 12px; - font-weight: 800; - line-height: 1.05; - letter-spacing: 1px; - text-align: center; - writing-mode: vertical-rl; - text-orientation: upright; - background: none; -} - -.customer-auth-page.is-douyu .customer-douyu-qr-main .customer-binding-qr-code { - width: 100%; - max-width: none; - padding: 10px; -} - -.customer-auth-page.is-douyu .customer-douyu-qr-preparing { - position: relative; - width: 100%; - height: 100%; - min-height: 100%; - display: grid; - place-items: center; - overflow: hidden; - border-radius: 7px; - background: #171c24; -} - -.customer-auth-page.is-douyu .customer-douyu-qr-skeleton { - position: absolute; - inset: 18px; - opacity: 0.16; - background-image: - linear-gradient(90deg, #9fb1ca 50%, transparent 50%), - linear-gradient(#9fb1ca 50%, transparent 50%); - background-position: - 0 0, - 0 0; - background-size: - 18px 18px, - 18px 18px; - -webkit-mask-image: linear-gradient(135deg, #000 12%, transparent 82%); - mask-image: linear-gradient(135deg, #000 12%, transparent 82%); -} - -.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy { - position: relative; - z-index: 1; - display: flex; - flex-direction: column; - align-items: center; - gap: 8px; - color: #b8c1cf; - text-align: center; -} - -.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy strong { - color: #e2e8f0; - font-size: 14px; - font-weight: 600; -} - -.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy span { - color: #8f9aaa; - font-size: 12px; -} - -.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn { - color: #e2e8f0; - border-color: #465063; - background: #2a313d; - box-shadow: none; -} - -.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn:hover, -.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn:focus-visible { - color: #fff; - border-color: #657186; - background: #343c4a; -} - -.customer-auth-page.is-douyu .customer-binding-qr-actions.is-single { - grid-template-columns: minmax(0, 1fr); -} - -.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn:disabled { - color: #7d8797; - border-color: #394353; - background: #252c37; - opacity: 1; -} - -.customer-auth-page.is-douyu .customer-binding-qr-countdown.is-expired { - color: #ff7a84; - font-weight: 700; -} - -.customer-auth-page.is-douyu .customer-douyu-qr-refresh-note { - margin: -2px 0 0; - color: #8f9aaa; - font-size: 11px; - line-height: 1.4; - text-align: center; -} - -.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat { - border-color: rgba(248, 113, 113, 0.34); - background: linear-gradient(135deg, rgba(127, 29, 29, 0.26), rgba(32, 38, 49, 0.9)); -} - -.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-icon, -.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-message, -.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-title { - color: #ff8a92; -} - -.customer-douyu-binding-failure { - display: flex; - flex-direction: column; - gap: 10px; -} - -.customer-douyu-binding-failure > p { - margin: 0; - padding: 12px 14px; - color: #fecaca; - font-size: 13px; - line-height: 1.6; - text-align: center; - border: 1px solid rgba(248, 113, 113, 0.3); - border-radius: 10px; - background: rgba(127, 29, 29, 0.18); -} - -.customer-auth-page.is-douyu.is-compact { - height: 100vh; - height: 100dvh; - min-height: 0; - overflow: hidden; -} - -.customer-auth-page.is-douyu.is-compact .customer-auth-shell { - height: 100%; - display: flex; - flex-direction: column; -} - -.customer-auth-page.is-douyu.is-compact .customer-auth-hero { - min-height: 148px; - padding: 0 16px 18px; - background-position: center 34%; -} - -.customer-auth-page.is-douyu.is-compact .customer-auth-warning { - padding: 8px 16px 12px; - font-size: 14px; -} - -.customer-auth-page.is-douyu.is-compact .customer-auth-main { - display: flex; - flex-direction: column; - flex: 1 1 auto; - min-height: 0; - padding-bottom: 0; - overflow: hidden; -} - -.customer-auth-page.is-douyu.is-compact .customer-douyu-order-card { - flex: none; - margin: 10px 16px 0; -} - -.customer-auth-page.is-douyu.is-compact .customer-douyu-order-head { - padding: 13px 16px; -} - -.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field { - grid-template-columns: 72px minmax(0, 1fr); - gap: 12px; - padding: 11px 16px; -} - -.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field > span, -.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field > strong { - font-size: 14px; - line-height: 1.5; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-stage { - flex: 1 1 auto; - min-height: 0; - justify-content: center; - gap: 14px; - padding: 16px; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert { - flex: none; - padding: 12px 14px; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert-description { - margin-top: 4px; - font-size: 13px; - line-height: 1.6; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card { - flex: 0 1 auto; - justify-content: center; - gap: 10px; - padding: 18px; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card h3 { - font-size: 15px; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-qr-hint { - font-size: 13px; - line-height: 1.6; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-qr-countdown { - font-size: 13px; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card .ant-progress { - line-height: 1.5; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-qr-actions { - margin-top: 4px; -} - -.customer-auth-page.is-douyu.is-compact .customer-binding-qr-actions .ant-btn { - height: 40px; - font-size: 14px; -} - -@media (max-height: 720px) { - .customer-auth-page.is-douyu.is-compact .customer-auth-hero { - min-height: 60px; - padding-bottom: 6px; - } - - .customer-auth-page.is-douyu.is-compact .customer-auth-warning { - padding-block: 1px 4px; - font-size: 11px; - } - - .customer-auth-page.is-douyu.is-compact .customer-douyu-order-head { - padding-block: 6px; - } - - .customer-auth-page.is-douyu.is-compact .customer-douyu-order-field { - padding-block: 5px; - } - - .customer-auth-page.is-douyu.is-compact .customer-binding-stage { - justify-content: flex-start; - gap: 6px; - padding-block: 6px; - } - - .customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert-description { - display: none; - } - - .customer-auth-page.is-douyu.is-compact .customer-binding-qr-card { - gap: 4px; - padding-block: 7px; - } - - .customer-auth-page.is-douyu.is-compact .customer-douyu-qr-main { - grid-template-columns: 26px minmax(0, clamp(154px, 30dvh, 190px)) 26px; - gap: 5px; - } - - .customer-auth-page.is-douyu.is-compact .customer-douyu-qr-rail { - font-size: 10px; - } -} - -.customer-choice-switch { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 3px; - padding: 3px; - overflow: hidden; - border: 1px solid #354052; - border-radius: 10px; - background: #171d27; -} - -.customer-choice-option { - height: 42px; - min-width: 0; - padding: 0 10px; - color: #aeb8c8; - border: 0; - border-radius: 8px; - outline: none; - background: transparent; - font: inherit; - font-size: 14px; - cursor: pointer; - transition: color 100ms ease; -} - -.customer-choice-option:hover { - color: #e2e8f0; - background: #242c39; -} - -.customer-choice-option.is-selected { - color: #fff; - background: #2f6fed; - font-weight: 700; -} - -.customer-choice-option:focus-visible { - outline: 2px solid #60a5fa; - outline-offset: 2px; -} - -.customer-auth-page.is-douyu .customer-collect-submit.ant-btn { - height: 48px; - margin-top: 14px; - color: #fff !important; - border-color: #2f6fed !important; - border-radius: 10px; - background: #2f6fed !important; - font-size: 15px; - font-weight: 700; -} - -.customer-auth-page.is-douyu .customer-collect-submit.ant-btn:hover, -.customer-auth-page.is-douyu .customer-collect-submit.ant-btn:focus-visible { - color: #fff !important; - border-color: #4a83ff !important; - background: #4a83ff !important; -} - -.customer-binding-next.ant-btn { - width: 100%; - height: 52px; - margin-top: 6px; - border-radius: 14px; - background: #2563eb !important; - border-color: #2563eb !important; - color: #fff !important; - font-size: 17px; - font-weight: 600; -} - -.customer-binding-modal-footer { - display: flex; - flex-direction: column; - gap: 10px; -} - -.customer-binding-modal-actions { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 12px; -} - -.customer-binding-modal-actions .ant-btn { - height: 42px; - border-radius: 8px; -} - -.customer-binding-modal-actions.is-mismatch { - grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); -} - -.customer-binding-modal-error { - margin: 0; - color: #dc2626; - font-size: 13px; - text-align: center; -} - -.customer-binding-modal-warning { - margin: 0; - color: #d97706; - font-size: 13px; - text-align: center; -} - -.customer-binding-compare { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 12px; -} - -.customer-binding-compare-side { - display: flex; - flex-direction: column; - gap: 6px; - padding: 14px; - border: 1px solid rgba(15, 23, 42, 0.12); - border-radius: 6px; - background: rgba(15, 23, 42, 0.04); -} - -.customer-binding-compare-head { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - color: #64748b; - font-size: 13px; -} - -.customer-binding-compare-side strong { - color: #0f172a; - font-size: 16px; - word-break: break-all; -} - -.customer-binding-compare-side em { - color: #64748b; - font-style: normal; - font-size: 13px; -} - -@media (max-width: 480px) { - .customer-binding-compare { - grid-template-columns: minmax(0, 1fr); - } -} - -.customer-auth-button-stack { - width: min(100%, 580px); - display: flex; - flex-direction: column; - gap: 12px; -} - -.customer-auth-button-stack .ant-btn, -.customer-auth-form > .ant-btn { - height: 52px; - font-size: 17px; -} - -.customer-auth-status-pill { - display: inline-flex; - align-items: center; - justify-content: center; - min-height: 34px; - padding: 4px 15px; - color: #fff; - font-size: 15px !important; - font-weight: 600 !important; - text-align: center; - border-radius: 999px; - background: #3169aa; -} - -.customer-auth-status-pill.is-pending, -.customer-auth-status-pill.is-scanned { - background: #3a6fa8; -} - -.customer-auth-status-pill.is-success { - background: #237a57; -} - -.customer-auth-status-pill.is-danger { - background: #a33a48; -} - -.customer-auth-state { - display: flex; - flex-direction: column; - align-items: center; - gap: 12px; - padding: 48px 26px; - text-align: center; -} - -.customer-auth-state h2 { - margin: 0; -} - -.customer-auth-state p { - max-width: 560px; -} - -.customer-auth-state-icon { - width: 58px; - height: 58px; - display: grid; - place-items: center; - color: var(--auth-accent); - font-size: 29px; - border: 1px solid rgba(255, 255, 255, 0.16); - border-radius: 50%; - background: rgba(255, 255, 255, 0.045); -} - -.customer-auth-state.is-success .customer-auth-state-icon { - color: #52d39a; -} - -.customer-auth-state.is-error .customer-auth-state-icon { - color: #ff6975; -} - -.customer-auth-state-time { - color: var(--auth-muted); - font-size: 12px; -} - -.customer-auth-loading { - min-height: 240px; - display: grid; - place-items: center; - align-content: center; - gap: 14px; - color: var(--auth-muted); -} - -.customer-auth-privacy { - margin: 24px 26px 28px; - padding: 14px 18px; - color: #d8b46a; - font-size: 14px; - line-height: 1.65; - text-align: center; - border: 1px solid rgba(216, 180, 106, 0.64); - border-radius: 5px; - background: rgba(0, 0, 0, 0.08); -} - -.customer-auth-page .ant-spin-dot-item { - background: var(--auth-accent); -} - -@media (max-width: 640px) { - .customer-auth-page { - height: auto; - min-height: 100vh; - overflow: visible; - padding: 0; - background: var(--auth-panel); - } - - .customer-auth-shell { - width: 100%; - height: auto; - display: block; - border: 0; - border-radius: 0; - box-shadow: none; - } - - .customer-auth-hero { - min-height: auto; - padding: 38px 16px 10px; - background: none; - } - - .customer-auth-brand h1 { - font-size: 20px; - } - - .customer-auth-warning { - padding: 6px 16px 10px; - font-size: 14px; - } - - .customer-auth-main { - overflow: visible; - } - - .customer-auth-content-stack { - height: auto; - min-height: 0; - } - - .customer-auth-facts { - padding-inline: 20px; - } - - .customer-auth-facts > div { - grid-template-columns: 92px minmax(0, 1fr); - gap: 12px; - min-height: 52px; - padding-block: 8px; - } - - .customer-auth-facts > div > span { - font-size: 13px; - } - - .customer-auth-facts > div > strong { - font-size: 15px; - line-height: 1.35; - } - - .customer-auth-section { - padding: 16px; - } - - .customer-auth-section-copy h2, - .customer-auth-state h2 { - font-size: 20px; - } - - .customer-auth-section-copy p, - .customer-auth-state p, - .customer-auth-form-copy { - font-size: 13px; - line-height: 1.5; - } - - .customer-auth-tabs { - margin-top: 0; - } - - .customer-auth-tabs .ant-tabs-nav { - margin-bottom: 10px; - } - - .customer-auth-tabs .ant-tabs-nav-list { - gap: 4px; - padding: 4px; - } - - .customer-auth-tabs .ant-tabs-tab { - padding: 9px 14px; - } - - .customer-auth-tabs .ant-tabs-tab-btn { - font-size: 15px; - } - - .customer-auth-form { - gap: 10px; - padding-top: 0; - } - - .customer-auth-field { - min-height: 44px; - border-radius: 9px; - } - - .customer-auth-phone-field { - grid-template-columns: 50px minmax(0, 1fr) 104px; - } - - .customer-auth-code-field { - grid-template-columns: minmax(0, 1fr) 104px; - } - - .customer-auth-field .ant-select, - .customer-auth-field .ant-select-selector, - .customer-auth-field .ant-input, - .customer-auth-field .ant-input-affix-wrapper { - height: 44px; - } - - .customer-auth-field .ant-select-selection-item { - line-height: 42px !important; - } - - .customer-auth-field .ant-input-affix-wrapper { - padding-inline: 12px; - } - - .customer-auth-code-field { - padding: 4px; - } - - .customer-auth-code-submit { - height: 36px !important; - } - - .customer-auth-send-code { - height: 36px !important; - } - - .customer-auth-form-hint { - font-size: 10px; - line-height: 1.35; - } - - .customer-auth-qr-image, - .customer-auth-qr-placeholder { - width: 232px; - min-height: 232px; - } - - .customer-auth-privacy { - margin: 8px 16px 12px; - padding: 8px 12px; - font-size: 12px; - line-height: 1.45; - } -} +@import './client/claim.css'; +@import './client/collect.css'; +@import './client/redeem.css'; +@import './client/responsive.css'; diff --git a/apps/frontend/src/styles/client/claim.css b/apps/frontend/src/styles/client/claim.css new file mode 100644 index 00000000..c70912f1 --- /dev/null +++ b/apps/frontend/src/styles/client/claim.css @@ -0,0 +1,462 @@ +/* ========================================================================== + 买家前台:提卡与信息收集页 (Buyer Claim & Collect Pages) + ========================================================================== */ + +.claim-page { + min-height: 100vh; + padding: 24px; + background: linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%); + display: flex; + flex-direction: column; + align-items: center; + gap: 18px; +} + +.claim-header-card, +.claim-content-card { + width: min(680px, 100%); + border-color: rgba(148, 163, 184, 0.18); + box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08); +} + +.claim-header-card { + position: relative; +} + +.claim-header-card .ant-card-body, +.claim-content-card .ant-card-body { + display: flex; + flex-direction: column; + gap: 18px; +} + +.claim-header-copy { + min-width: 0; + padding-right: 220px; +} + +.claim-header-copy h1 { + margin: 0; + color: #0f172a; + font-size: 30px; + line-height: 1.25; + overflow-wrap: anywhere; +} + +.claim-header-copy p, +.claim-muted { + margin: 0; + color: #64748b; + line-height: 1.6; +} + +.claim-step-indicator { + position: absolute; + top: 24px; + right: 24px; + max-width: 210px; + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 7px; +} + +.claim-step-dots { + display: flex; + gap: 8px; +} + +.claim-step-dot { + width: 32px; + height: 32px; + border-radius: 50%; + background: #e5e7eb; + color: #94a3b8; + display: inline-flex; + align-items: center; + justify-content: center; + font-weight: 700; +} + +.claim-step-dot.active { + background: var(--theme-primary); + color: #ffffff; +} + +.claim-step-progress-text { + color: #64748b; + font-size: 13px; + font-weight: 700; + line-height: 1.4; + text-align: right; + overflow-wrap: anywhere; +} + +.claim-content-card .ant-typography { + margin: 0; +} + +.claim-state-card .ant-card-body { + min-height: 240px; + align-items: center; + justify-content: center; + text-align: center; +} + +.claim-large-icon { + font-size: 44px; +} + +.claim-icon-success { + color: #16a34a; +} + +.claim-icon-warning { + color: #d97706; +} + +.claim-icon-info { + color: var(--theme-primary); +} + +.claim-icon-error { + color: #dc2626; +} + +.claim-qr-block { + display: flex; + flex-direction: column; + align-items: center; + gap: 14px; + padding: 14px; + border-radius: 8px; + background: #f8fbff; + border: 1px solid #dbeafe; +} + +.claim-qr-guide-panel { + display: grid; + grid-template-columns: 42px minmax(0, 280px) 42px; + grid-template-areas: + 'left code right' + '. hint .'; + gap: 10px; + align-items: center; + justify-content: center; + width: 100%; + max-width: 410px; + min-width: 0; +} + +.claim-scan-label { + align-self: stretch; + min-height: 150px; + padding: 10px 6px; + color: #e11d48; + font-weight: 900; + font-size: 17px; + line-height: 1.2; + writing-mode: vertical-rl; + text-orientation: upright; + display: flex; + align-items: center; + justify-content: center; +} + +.claim-scan-label-left { + grid-area: left; +} + +.claim-scan-label-right { + grid-area: right; +} + +.claim-qr-code { + grid-area: code; + width: 100%; + max-width: 280px; + aspect-ratio: 1 / 1; + padding: 10px; + background: #ffffff; + border-radius: 8px; + border: 1px solid #dbeafe; +} + +.claim-save-hint { + grid-area: hint; + margin: 0; + justify-self: center; + color: #64748b; + font-size: 14px; + font-weight: 700; + line-height: 1.4; + text-align: center; +} + +.claim-role-panel { + display: grid; + grid-template-columns: 1fr; + gap: 8px; +} + +.claim-role-panel.pending { + opacity: 0.82; +} + +.claim-role-panel-item { + min-width: 0; + display: grid; + grid-template-columns: 88px minmax(0, 1fr); + align-items: center; + gap: 12px; +} + +.claim-role-panel-item span { + color: #64748b; + font-size: 13px; + line-height: 1.4; + white-space: nowrap; +} + +.claim-role-panel-item strong { + min-width: 0; + color: #0f172a; + font-size: 17px; + line-height: 1.45; + overflow-wrap: anywhere; +} + +.claim-action-row { + width: 100%; +} + +.claim-action-tooltip-wrap { + display: inline-flex; +} + +.claim-meta-footer { + display: flex; + flex-wrap: wrap; + gap: 4px 10px; + justify-content: center; + color: #94a3b8; + font-size: 11px; + line-height: 1.5; +} + +.claim-info-grid { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 14px; +} + +.claim-info-grid-compact { + gap: 8px; + margin-bottom: 10px; +} + +.claim-info-grid-compact .claim-info-item { + padding: 8px 10px; + gap: 2px; + border-radius: 6px; +} + +.claim-info-grid-compact .claim-info-item span { + font-size: 11px; + line-height: 1.3; +} + +.claim-info-grid-compact .claim-info-item strong { + font-size: 13px; + line-height: 1.35; + font-weight: 600; +} + +.claim-uid-step .ant-card-body { + gap: 10px; +} + +.claim-uid-step-title.ant-typography { + margin: 0 !important; + font-size: 20px !important; + line-height: 1.3 !important; +} + +.claim-uid-step-desc { + font-size: 13px; + line-height: 1.45; +} + +.claim-uid-guide { + margin: 4px 0 0; + padding: 6px; + border-radius: 8px; + background: #f8fafc; + border: 1px solid #e5e7eb; +} + +.claim-uid-guide-image { + display: block; + width: 100%; + max-width: 360px; + max-height: 160px; + margin: 0 auto; + border-radius: 6px; + border: 1px solid #e2e8f0; + object-fit: contain; + background: #fff; +} + +.claim-uid-guide-caption { + margin: 6px 0 0; + text-align: center; + color: #64748b; + font-size: 12px; + line-height: 1.35; +} + +.claim-uid-warning { + margin: 2px 0 0; + color: #ff4d4f; + font-size: 13px; + font-weight: 600; + line-height: 1.45; +} + +.claim-info-item { + min-width: 0; + padding: 16px; + border-radius: 6px; + background: #f8fafc; + border: 1px solid #e5e7eb; + display: flex; + flex-direction: column; + gap: 6px; +} + +.claim-info-item span { + color: #64748b; + font-size: 13px; +} + +.claim-info-item strong { + color: #0f172a; + font-size: 17px; + overflow-wrap: anywhere; +} + +.claim-result-header { + display: flex; + align-items: flex-start; + gap: 14px; +} + +.claim-feifei-main { + display: grid; + gap: 8px; +} + +.claim-feifei-main p { + margin: 0; + color: var(--theme-primary); + font-weight: 700; +} + +.claim-feifei-label { + color: #64748b; + font-size: 13px; +} + +.claim-product-items { + display: flex; + flex-direction: column; + gap: 10px; +} + +.claim-product-items-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + color: #64748b; + font-size: 13px; +} + +.claim-product-items-header strong { + color: var(--theme-primary); + font-weight: 700; +} + +.claim-product-items-list { + display: flex; + flex-direction: column; + gap: 8px; +} + +.claim-product-item-row { + min-height: 44px; + padding: 10px 12px; + border: 1px solid #e5e7eb; + border-radius: 6px; + background: #f8fafc; + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; +} + +.claim-product-item-row span { + min-width: 0; + color: #0f172a; + font-weight: 700; + line-height: 1.35; + overflow-wrap: anywhere; +} + +.claim-product-item-row strong { + flex: 0 0 auto; + color: #0f172a; + font-size: 15px; +} + +.claim-product-items.compact { + margin-top: 10px; + gap: 8px; +} + +.claim-product-items.compact .claim-product-items-list { + gap: 6px; +} + +.claim-product-items.compact .claim-product-item-row { + min-height: 36px; + padding: 8px 10px; + background: rgba(248, 250, 252, 0.72); +} + +/* 待领取物品图:居中大图;imageUrl 为空或加载失败时是同一尺寸的虚线占位块(不会出现破图) */ + +.claim-product-image-wrap { + display: flex; + justify-content: center; +} + +.claim-product-image { + width: min(160px, 48%); + aspect-ratio: 1 / 1; + border-radius: 16px; + object-fit: contain; + background: #f8fafc; + padding: 8px; + border: 1px solid rgba(148, 163, 184, 0.24); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); +} + +.claim-product-image-fallback { + display: flex; + align-items: center; + justify-content: center; + font-size: 46px; + color: rgba(100, 116, 139, 0.55); + border-style: dashed; +} diff --git a/apps/frontend/src/styles/client/collect.css b/apps/frontend/src/styles/client/collect.css new file mode 100644 index 00000000..c0cbe4e2 --- /dev/null +++ b/apps/frontend/src/styles/client/collect.css @@ -0,0 +1,770 @@ +/* ===== 收集页 (Collect Page) ===== */ + +.collect-page { + min-height: 100vh; + display: grid; + place-items: center; + padding: 32px 16px; + background: #f5f7fb; +} + +.collect-card { + width: min(520px, 100%); +} + +.collect-order-input { + flex: 1; + margin-bottom: 0; +} + +/* ===== 一次性补资料链接页 (Collect Material Link) ===== */ + +.collect-link-page { + min-height: 100vh; + padding: 32px 16px; + background: #f5f7fb; + display: flex; + justify-content: center; + align-items: flex-start; +} + +.collect-link-card { + width: min(720px, 100%); +} + +.collect-link-card .ant-card-body { + padding: 28px; +} + +/* 一单多工单时,内层商品卡片比外层容器更紧凑 */ +.collect-link-order-card .ant-card-body { + padding: 16px; +} + +.collect-link-status-card { + background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%); +} + +.collect-link-status-card .ant-card-body { + padding: 16px; +} + +.collect-link-status-head { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: 8px; + color: #0f172a; + font-size: 15px; +} + +.collect-link-status-head .ant-tag { + margin-inline-end: 0; +} + +.collect-link-order-meta { + display: flex; + flex-wrap: wrap; + gap: 4px 18px; + color: #64748b; + font-size: 13px; +} + +.collect-link-order-meta strong { + color: #0f172a; + font-weight: 600; +} + +.collect-link-description { + margin-top: 6px; + font-size: 12px; +} + +.collect-link-submitted { + display: grid; + gap: 10px; + padding: 12px; + background: #f8fafc; + border: 1px solid #e7edf5; + border-radius: 10px; +} + +.collect-link-submitted-head { + display: flex; + flex-wrap: wrap; + align-items: flex-start; + justify-content: space-between; + gap: 5px 14px; +} + +.collect-link-submitted-head > span { + display: grid; + gap: 1px; +} + +.collect-link-submitted-head .ant-typography:last-child { + font-size: 11px; +} + +.collect-link-submitted-head > .ant-typography { + font-size: 11px; +} + +.collect-link-submitted-fields { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 7px; +} + +.collect-link-submitted-fields > div { + display: grid; + gap: 2px; + min-width: 0; + padding: 8px 10px; + background: #ffffff; + border: 1px solid #edf1f6; + border-radius: 8px; +} + +.collect-link-submitted-fields span, +.collect-link-submitted-screenshots > span { + color: #94a3b8; + font-size: 11px; +} + +.collect-link-submitted-fields strong { + color: #1e293b; + font-size: 13px; + font-weight: 500; + line-height: 1.5; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.collect-link-submitted-screenshots { + display: grid; + gap: 7px; +} + +.collect-link-submitted-screenshots > div { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.collect-link-submitted-screenshots .ant-image { + overflow: hidden; + border: 1px solid #dbe3ee; + border-radius: 8px; +} + +.collect-link-submitted-screenshots .ant-image-img { + object-fit: cover; +} + +.collect-link-current-status { + display: grid; + grid-template-columns: auto minmax(0, 1fr); + gap: 12px; + align-items: flex-start; + padding: 13px; + color: #475569; + background: #f8fafc; + border: 1px solid #e8edf4; + border-left: 4px solid #94a3b8; + border-radius: 9px; +} + +.collect-link-current-status-index { + display: inline-flex; + align-items: center; + justify-content: center; + width: 30px; + height: 30px; + color: #ffffff; + font-size: 13px; + font-weight: 700; + background: #64748b; + border-radius: 999px; +} + +.collect-link-current-status-copy { + display: grid; + gap: 5px; + min-width: 0; +} + +.collect-link-current-status-copy > div { + display: flex; + flex-wrap: wrap; + gap: 3px 12px; + align-items: baseline; + justify-content: space-between; +} + +.collect-link-current-status-copy > div .ant-typography:last-child { + font-size: 11px; +} + +.collect-link-current-status-copy p { + margin: 0; + color: inherit; + font-size: 13px; + line-height: 1.7; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.collect-link-current-status.is-open, +.collect-link-current-status.is-pending_material { + color: #8a4b00; + background: #fffaf0; + border-color: #ffe7ba; + border-left-color: #faad14; +} + +.collect-link-current-status.is-open .collect-link-current-status-index, +.collect-link-current-status.is-pending_material .collect-link-current-status-index { + background: #faad14; +} + +.collect-link-current-status.is-in_progress, +.collect-link-current-status.is-unassigned { + color: #0958d9; + background: #f0f7ff; + border-color: #d6e8ff; + border-left-color: #1677ff; +} + +.collect-link-current-status.is-in_progress .collect-link-current-status-index, +.collect-link-current-status.is-unassigned .collect-link-current-status-index { + background: #1677ff; +} + +.collect-link-current-status.is-pending_acceptance { + color: #531dab; + background: #f9f0ff; + border-color: #efdbff; + border-left-color: #722ed1; +} + +.collect-link-current-status.is-pending_acceptance .collect-link-current-status-index { + background: #722ed1; +} + +.collect-link-current-status.is-accepted { + color: #237804; + background: #f6ffed; + border-color: #d9f7be; + border-left-color: #52c41a; +} + +.collect-link-current-status.is-accepted .collect-link-current-status-index { + background: #52c41a; +} + +.collect-link-current-status.is-problem { + color: #a8071a; + background: #fff1f0; + border-color: #ffccc7; + border-left-color: #ff4d4f; +} + +.collect-link-current-status.is-problem .collect-link-current-status-index { + background: #ff4d4f; +} + +.collect-link-status-message { + padding: 10px 12px; + color: #475569; + font-size: 13px; + line-height: 1.65; + background: #f8fafc; + border-left: 3px solid #94a3b8; + border-radius: 0 8px 8px 0; +} + +.collect-link-status-message.is-open, +.collect-link-status-message.is-pending_material { + color: #8a4b00; + background: #fffaf0; + border-left-color: #faad14; +} + +.collect-link-status-message.is-in_progress, +.collect-link-status-message.is-unassigned { + color: #0958d9; + background: #f0f7ff; + border-left-color: #1677ff; +} + +.collect-link-status-message.is-pending_acceptance { + color: #531dab; + background: #f9f0ff; + border-left-color: #722ed1; +} + +.collect-link-status-message.is-accepted { + color: #237804; + background: #f6ffed; + border-left-color: #52c41a; +} + +.collect-link-status-message.is-problem { + color: #a8071a; + background: #fff1f0; + border-left-color: #ff4d4f; +} + +.collect-link-status-times { + display: flex; + flex-wrap: wrap; + gap: 4px 18px; + color: #94a3b8; + font-size: 12px; +} + +.collect-link-acceptance { + display: grid; + gap: 10px; + padding-top: 12px; + border-top: 1px solid #eef2f7; +} + +.collect-link-acceptance > div:first-child { + display: flex; + align-items: baseline; + justify-content: space-between; + flex-wrap: wrap; + gap: 4px 12px; +} + +.collect-link-acceptance > div:first-child .ant-typography:last-child { + font-size: 12px; +} + +.collect-link-acceptance-images { + display: flex; + flex-wrap: wrap; + gap: 10px; +} + +.collect-link-acceptance-images .ant-image { + overflow: hidden; + border: 1px solid #dbe3ee; + border-radius: 9px; +} + +.collect-link-acceptance-images .ant-image-img { + object-fit: cover; +} + +.collect-link-acceptance-video { + display: grid; + gap: 8px; +} + +.collect-link-acceptance-video video { + width: min(100%, 520px); + max-height: 360px; + background: #0f172a; + border: 1px solid #dbe3ee; + border-radius: 10px; +} + +.collect-link-acceptance-video > div { + display: flex; + flex-wrap: wrap; + gap: 4px 14px; + align-items: center; + justify-content: space-between; + font-size: 12px; +} + +.collect-link-acceptance-video a { + color: #1677ff; +} + +.collect-link-title { + margin: 0 0 4px !important; +} + +.collect-link-heading { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; +} + +.collect-link-confirm { + display: grid; + gap: 12px; + max-height: 58vh; + padding-top: 4px; + padding-right: 4px; + overflow-y: auto; +} + +.collect-link-confirm-meta { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: 4px 16px; + color: #64748b; + font-size: 12px; +} + +.collect-link-confirm-meta span:first-child { + color: #0f172a; + font-size: 14px; + font-weight: 600; +} + +.collect-link-confirm-fields { + overflow: hidden; + border: 1px solid #e8edf4; + border-radius: 9px; +} + +.collect-link-confirm-field { + display: grid; + grid-template-columns: 110px minmax(0, 1fr); + gap: 12px; + padding: 9px 12px; + font-size: 13px; + border-bottom: 1px solid #eef2f7; +} + +.collect-link-confirm-field:last-child { + border-bottom: 0; +} + +.collect-link-confirm-field span, +.collect-link-confirm-screenshots span { + color: #64748b; +} + +.collect-link-confirm-field strong, +.collect-link-confirm-screenshots strong { + color: #0f172a; + font-weight: 500; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.collect-link-confirm-field strong.is-empty { + color: #94a3b8; +} + +.collect-link-confirm-screenshots { + display: grid; + gap: 8px; + padding: 10px 12px; + font-size: 13px; + background: #f8fafc; + border-radius: 9px; +} + +.collect-link-confirm-screenshots > div:first-child { + display: flex; + justify-content: space-between; + gap: 12px; +} + +.collect-link-confirm-images { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.collect-link-confirm-images img { + width: 58px; + height: 58px; + object-fit: cover; + background: #ffffff; + border: 1px solid #dbe3ee; + border-radius: 8px; +} + +.collect-link-confirm-content { + padding: 10px 12px; + color: #8a4b00; + font-size: 13px; + line-height: 1.7; + background: #fff7e6; + border: 1px solid #ffe7ba; + border-radius: 9px; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +/* 商品名与订单号放在同一个信息头里,避免标题和灰色信息块分离 */ +.collect-link-order-head { + display: flex; + align-items: baseline; + justify-content: space-between; + flex-wrap: wrap; + gap: 6px 20px; + padding-bottom: 12px; + border-bottom: 1px solid #eef2f7; +} + +.collect-link-order-name { + min-width: 0; + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 8px; + color: #0f172a; + font-size: 16px; + font-weight: 700; + overflow-wrap: anywhere; +} + +.collect-link-order-no { + min-width: 0; + display: flex; + align-items: baseline; + gap: 6px; + color: #64748b; + font-size: 12px; +} + +.collect-link-order-no strong { + color: #0f172a; + font-size: 14px; + font-weight: 600; + overflow-wrap: anywhere; +} + +.collect-link-state { + min-height: 220px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 16px; +} + +/* 提交成功:居中的成功状态,不再展示订单号 */ +.collect-link-success { + min-height: 380px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 10px; + padding: 24px 12px 8px; + text-align: center; +} + +.collect-link-success-icon { + font-size: 64px; + color: #22c55e; + filter: drop-shadow(0 10px 20px rgba(34, 197, 94, 0.18)); +} + +.collect-link-success-title { + margin: 2px 0 0 !important; + color: #0f172a; +} + +.collect-link-success-products { + max-width: 100%; + margin-top: 10px; + padding: 12px 22px; + border: 1px solid #dcfce7; + border-radius: 12px; + background: #f0fdf4; + display: flex; + flex-direction: column; + gap: 4px; +} + +.collect-link-success-products span { + color: #16a34a; + font-size: 12px; +} + +.collect-link-success-products strong { + color: #166534; + font-size: 15px; + overflow-wrap: anywhere; +} + +.collect-link-success .collect-link-footnote { + margin-top: 18px; +} + +.collect-link-screenshot-control { + display: grid; + gap: 14px; + align-items: start; +} + +.collect-link-screenshot-control.has-guide { + grid-template-columns: 120px minmax(180px, 260px); + gap: 16px; +} + +.collect-link-guide-example { + display: grid; + grid-template-columns: 1fr; + gap: 6px; + min-width: 0; + max-width: 100%; + align-content: start; + justify-items: start; +} + +.collect-link-guide-example .ant-image { + display: block; + width: 128px !important; + height: 88px !important; + overflow: hidden; + border: 1px solid #dbe3ee; + border-radius: 7px; + cursor: zoom-in; +} + +.collect-link-guide-example .ant-image-img { + display: block; + width: 128px !important; + height: 88px !important; + object-fit: cover; + object-position: center; +} + +.collect-link-guide-copy { + display: grid; + align-content: center; + gap: 3px; + min-width: 0; +} + +.collect-link-guide-copy .ant-typography:first-child { + color: #334155; + font-size: 12px; +} + +.collect-link-guide-copy .ant-typography:last-child { + max-width: 220px; + font-size: 11px; + line-height: 1.55; + white-space: pre-wrap; +} + +.collect-link-actions { + display: flex; + justify-content: flex-end; + margin-top: 4px; +} + +.collect-link-actions .ant-btn { + min-width: 180px; +} + +.collect-link-footnote { + display: block; + text-align: center; + font-size: 12px; + white-space: pre-wrap; +} + +@media (max-width: 720px) { + .collect-link-page { + padding: 14px; + } + + .collect-link-card .ant-card-body { + padding: 18px; + } + + .collect-link-screenshot-control.has-guide { + grid-template-columns: 112px minmax(160px, 220px); + gap: 12px; + } + + .collect-link-guide-example .ant-image { + width: 116px !important; + height: 80px !important; + } + + .collect-link-guide-example .ant-image-img { + width: 116px !important; + height: 80px !important; + } + + .collect-link-actions { + justify-content: stretch; + } + + .collect-link-actions .ant-btn { + width: 100%; + } +} + +@media (max-width: 480px) { + .collect-link-page { + padding: 10px; + } + + .collect-link-card .ant-card-body { + padding: 14px; + } + + .collect-link-screenshot-control.has-guide { + grid-template-columns: 104px minmax(0, 1fr); + gap: 8px; + } + + .collect-link-guide-example { + gap: 5px; + } + + .collect-link-guide-example .ant-image { + width: 96px !important; + height: 68px !important; + } + + .collect-link-guide-example .ant-image-img { + width: 96px !important; + height: 68px !important; + } + + .collect-link-guide-copy .ant-typography:first-child { + font-size: 11px; + } + + .collect-link-guide-copy .ant-typography:last-child { + font-size: 10px; + } + + .collect-link-success { + min-height: 320px; + padding: 16px 4px 4px; + } + + .collect-link-success-icon { + font-size: 52px; + } + + .collect-link-success-products { + padding: 10px 16px; + } + + .collect-link-confirm-field { + grid-template-columns: 88px minmax(0, 1fr); + padding: 8px 10px; + } + + .collect-link-order-meta, + .collect-link-submitted-fields { + grid-template-columns: 1fr; + } + + .collect-link-order-meta { + display: grid; + } +} diff --git a/apps/frontend/src/styles/client/redeem.css b/apps/frontend/src/styles/client/redeem.css new file mode 100644 index 00000000..38d47b1f --- /dev/null +++ b/apps/frontend/src/styles/client/redeem.css @@ -0,0 +1,25 @@ +/* ===== 兑换中心 (Redeem Page) ===== */ + +.redeem-page { + min-height: 100vh; + display: grid; + place-items: center; + padding: 32px 16px; + background: #f5f7fb; +} + +.redeem-card { + width: min(520px, 100%); +} + +.redeem-order-input { + flex: 1; + margin-bottom: 0; +} + +/* ===== H5 领取入口页(`/h5`,只有前缀没有订单号) ===== */ + +/* 复用领取页的卡片与背景,只把单卡在视口内垂直居中 */ +.h5-claim-entry { + justify-content: center; +} diff --git a/apps/frontend/src/styles/client/responsive.css b/apps/frontend/src/styles/client/responsive.css new file mode 100644 index 00000000..617a0e69 --- /dev/null +++ b/apps/frontend/src/styles/client/responsive.css @@ -0,0 +1,177 @@ +/* ===== 买家页面响应式断点 ===== */ + +@media (max-width: 720px) { + .claim-page { + padding: 14px; + } + + .claim-header-card .ant-card-body, + .claim-content-card .ant-card-body { + gap: 14px; + } + + .claim-header-copy { + padding-right: 150px; + } + + .claim-header-copy h1 { + font-size: 24px; + line-height: 1.22; + } + + .claim-header-copy p { + font-size: 14px; + line-height: 1.4; + } + + .claim-step-indicator { + top: 16px; + right: 16px; + max-width: 140px; + } + + .claim-step-dots { + gap: 5px; + } + + .claim-step-dot { + width: 26px; + height: 26px; + font-size: 13px; + } + + .claim-step-progress-text { + font-size: 12px; + } + + .claim-info-grid { + grid-template-columns: 1fr; + } + + .claim-qr-block { + padding: 12px; + } + + .claim-qr-guide-panel { + grid-template-columns: 34px minmax(0, 1fr) 34px; + gap: 8px; + max-width: 100%; + } + + .claim-scan-label { + min-height: 128px; + padding: 8px 4px; + font-size: 14px; + } + + .claim-qr-code { + max-width: 232px; + padding: 8px; + } + + .claim-save-hint { + font-size: 13px; + } + + .claim-role-panel-item { + grid-template-columns: 76px minmax(0, 1fr); + gap: 10px; + } + + .claim-role-panel-item span { + font-size: 12px; + } + + .claim-role-panel-item strong { + font-size: 16px; + } + + .claim-action-row { + display: flex; + flex-direction: column; + align-items: stretch; + } + + .claim-action-row .ant-space-item, + .claim-action-row .ant-btn, + .claim-action-tooltip-wrap { + width: 100%; + } + + .claim-meta-footer { + justify-content: flex-start; + } + + .claim-result-header { + display: grid; + } +} + +@media (max-width: 480px) { + .claim-page { + padding: 12px; + gap: 10px; + } + + .claim-header-card .ant-card-body, + .claim-content-card .ant-card-body { + gap: 12px; + } + + .claim-header-copy { + padding-right: 112px; + } + + .claim-header-copy h1 { + font-size: 22px; + } + + .claim-step-indicator { + position: absolute; + top: 16px; + right: 16px; + max-width: 100px; + align-items: flex-end; + } + + .claim-step-dot { + width: 26px; + height: 26px; + font-size: 12px; + } + + .claim-step-dots { + gap: 5px; + } + + .claim-step-progress-text { + text-align: right; + font-size: 12px; + } + + .claim-uid-step-title.ant-typography { + font-size: 18px !important; + } + + .claim-uid-guide-image { + max-height: 140px; + } +} + +@media (max-width: 420px) { + .claim-header-copy { + padding-right: 124px; + } + + .claim-header-copy h1 { + font-size: 22px; + } + + .claim-header-copy p { + padding-right: 0; + } + + .claim-step-indicator { + max-width: 116px; + } +} diff --git a/apps/frontend/src/styles/customer/auth-form.css b/apps/frontend/src/styles/customer/auth-form.css new file mode 100644 index 00000000..b60616d2 --- /dev/null +++ b/apps/frontend/src/styles/customer/auth-form.css @@ -0,0 +1,349 @@ +.customer-auth-tabs { + margin-top: 22px; +} + +.customer-auth-tabs .ant-tabs-nav { + margin-bottom: 18px; +} + +.customer-auth-tabs .ant-tabs-nav::before { + display: none; +} + +.customer-auth-tabs .ant-tabs-nav-list { + width: 100%; + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 5px; + padding: 5px; + border: 1px solid rgba(148, 163, 184, 0.18); + border-radius: 11px; + background: rgba(4, 15, 37, 0.72); +} + +.customer-auth-tabs .ant-tabs-tab { + justify-content: center; + margin: 0 !important; + padding: 11px 18px; + color: var(--auth-muted); + background: transparent; + border: 0 !important; + border-radius: 7px; +} + +.customer-auth-tabs .ant-tabs-tab.ant-tabs-tab-active { + background: var(--auth-accent); +} + +.customer-auth-tabs .ant-tabs-tab-btn { + color: inherit !important; + font-size: 16px; +} + +.customer-auth-tabs .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn { + color: #111827 !important; + font-weight: 700; +} + +.customer-auth-tabs .ant-tabs-ink-bar { + display: none; +} + +.customer-auth-form { + display: flex; + flex-direction: column; + gap: 14px; + padding-top: 18px; +} + +.customer-auth-field { + display: grid; + align-items: center; + min-height: 50px; + overflow: hidden; + border: 1px solid rgba(148, 163, 184, 0.24); + border-radius: 10px; + background: rgba(13, 29, 61, 0.72); + transition: + border-color 0.2s ease, + box-shadow 0.2s ease; +} + +.customer-auth-field:focus-within { + border-color: var(--auth-accent); + box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.12); +} + +.customer-auth-field > * { + min-width: 0; +} + +.customer-auth-phone-field { + grid-template-columns: 58px minmax(0, 1fr) 112px; + padding: 4px; +} + +.customer-auth-code-field { + grid-template-columns: minmax(0, 1fr) 122px; + gap: 5px; + padding: 5px; +} + +.customer-auth-field .ant-select-selector, +.customer-auth-field .ant-input, +.customer-auth-field .ant-input-affix-wrapper { + color: #f8fafc !important; + border: 0 !important; + border-radius: 0 !important; + background: transparent !important; + box-shadow: none !important; +} + +.customer-auth-field .ant-select-selector { + height: 48px !important; + padding-inline: 14px !important; + align-items: center; +} + +.customer-auth-field .ant-select { + height: 48px; + background: transparent !important; +} + +.customer-auth-field .ant-select-selection-item { + color: #f8fafc !important; + line-height: 46px !important; +} + +.customer-auth-field .ant-select-arrow { + color: #c4cede !important; +} + +.customer-auth-country-prefix { + display: grid; + place-items: center; + align-self: stretch; + color: #f8fafc; + font-size: 14px; + font-weight: 600; + border-right: 1px solid var(--auth-line); +} + +.customer-auth-field .ant-input-affix-wrapper { + height: 48px; + padding-inline: 15px; +} + +.customer-auth-field .ant-input { + height: 48px; + padding-inline: 10px; + font-size: 15px; +} + +.customer-auth-field .ant-input-affix-wrapper .ant-input { + padding-inline: 0; +} + +.customer-auth-field .ant-input::placeholder { + color: #7f8ca5; +} + +.customer-auth-field .ant-input-prefix { + margin-inline-end: 9px; + color: var(--auth-accent); +} + +.customer-auth-send-code { + height: 40px !important; + padding-inline: 10px !important; + color: #111827; + border: 0 !important; + border-radius: 7px !important; + background: var(--auth-accent) !important; + font-size: 14px !important; + font-weight: 700; +} + +.customer-auth-send-code:hover { + background: var(--auth-accent-hover) !important; +} + +.customer-auth-code-submit { + height: 40px !important; + color: #111827; + border: 0 !important; + border-radius: 7px !important; + background: var(--auth-accent) !important; + font-weight: 700; +} + +.customer-auth-code-submit:hover { + background: var(--auth-accent-hover) !important; +} + +.customer-auth-note { + padding: 11px 14px; + color: #fbbf24; + font-size: 13px; + line-height: 1.6; + border: 1px solid rgba(251, 191, 36, 0.48); + border-radius: 4px; + background: rgba(251, 191, 36, 0.06); +} + +.customer-auth-form-hint { + color: #7f8ca5; + font-size: 12px; +} + +.customer-auth-page .ant-btn-primary { + color: #fff; + border-color: var(--auth-accent); + background: var(--auth-accent); + font-weight: 700; + box-shadow: none; +} + +.customer-auth-page .ant-btn-primary:hover { + color: #fff !important; + border-color: var(--auth-accent-hover) !important; + background: var(--auth-accent-hover) !important; +} + +.customer-auth-page .customer-auth-secondary-button { + color: #fff; + border-color: rgba(148, 163, 184, 0.42); + background: rgba(19, 39, 77, 0.52); +} + +.customer-auth-page .customer-auth-secondary-button:hover { + color: #fff !important; + border-color: rgba(196, 210, 236, 0.72) !important; + background: rgba(31, 55, 102, 0.72) !important; +} + +.customer-auth-qr { + display: flex; + flex-direction: column; + align-items: center; + gap: 13px; + padding-top: 22px; + text-align: center; +} + +.customer-auth-qr > p { + margin: 0; + color: var(--auth-muted); + line-height: 1.7; +} + +.customer-auth-qr-image, +.customer-auth-qr-placeholder { + display: grid; + place-items: center; + width: 252px; + min-height: 252px; + padding: 10px; + border-radius: 6px; + background: #fff; +} + +.customer-auth-qr-placeholder { + color: #64748b; + font-size: 13px; + background: rgba(255, 255, 255, 0.94); +} + +.customer-auth-role-card { + width: min(100%, 580px); + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + gap: 4px 18px; + padding: 15px 18px; + text-align: left; + border: 1px solid rgba(255, 138, 0, 0.42); + border-radius: 5px; + background: rgba(255, 138, 0, 0.06); +} + +.customer-auth-role-card span { + color: var(--auth-muted); + font-size: 13px; +} + +.customer-auth-role-card strong { + justify-self: end; + color: #fff; + font-size: 17px; +} + +.customer-auth-role-card small { + grid-column: 1 / -1; + color: var(--auth-muted); + font-size: 12px; +} + +.customer-auth-binding { + display: flex; + flex-direction: column; + gap: 16px; +} + +.customer-auth-binding-tip { + color: #ffb454; + font-size: 13px; +} + +.customer-auth-profile { + padding: 16px; + border: 1px solid #3a4150; + border-radius: 12px; + background: #212733; +} + +.customer-auth-profile-summary { + padding: 14px; + border: 1px solid rgba(255, 255, 255, 0.14); + border-radius: 6px; + background: rgba(255, 255, 255, 0.04); +} + +.customer-auth-profile > p { + margin: 0 0 12px; + color: #9aa3b2; + font-size: 13px; + line-height: 1.6; +} + +.customer-profile-form { + display: flex; + flex-direction: column; + gap: 12px; +} + +.customer-profile-form .customer-collect-label { + margin-top: 2px; +} + +.customer-auth-profile-summary { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 10px; +} + +.customer-auth-profile-summary span { + color: var(--auth-muted); + font-size: 13px; +} + +.customer-auth-profile-summary strong { + color: #fff; + font-size: 15px; +} + +.customer-auth-profile-summary em { + color: var(--auth-muted); + font-style: normal; + font-size: 13px; +} diff --git a/apps/frontend/src/styles/customer/base.css b/apps/frontend/src/styles/customer/base.css new file mode 100644 index 00000000..6554a17f --- /dev/null +++ b/apps/frontend/src/styles/customer/base.css @@ -0,0 +1,10 @@ +/** 客户领取页公共样式入口:平台差异见 platform/huya.css、platform/weibo.css、platform/douyu.css。 */ + +@import './layout.css'; +@import './auth-form.css'; +@import './profile.css'; +@import './login.css'; +@import './order.css'; +@import './binding.css'; +@import './status.css'; +@import './responsive.css'; diff --git a/apps/frontend/src/styles/customer/binding.css b/apps/frontend/src/styles/customer/binding.css new file mode 100644 index 00000000..a505ef93 --- /dev/null +++ b/apps/frontend/src/styles/customer/binding.css @@ -0,0 +1,453 @@ +.customer-binding-stage { + display: flex; + flex-direction: column; + gap: 14px; + padding: 16px; +} + +.customer-binding-session-card { + display: flex; + flex-direction: column; + gap: 10px; + padding: 18px; + border: 1px solid #78350f; + border-radius: 12px; + background: rgba(120, 53, 15, 0.22); +} + +.customer-binding-session-title { + margin: 0; + color: #fbbf24; + font-size: 16px; + font-weight: 700; +} + +.customer-binding-session-desc { + margin: 0 0 4px; + color: #fcd34d; + font-size: 13px; + line-height: 1.6; +} + +.customer-binding-qr-error { + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; + padding: 24px 12px; + text-align: center; +} + +.customer-binding-qr-error p { + margin: 0; + color: #fca5a5; + font-size: 15px; + font-weight: 600; +} + +.customer-binding-qr-error span { + color: #cbd5e1; + font-size: 13px; + line-height: 1.6; + overflow-wrap: anywhere; +} + +/* antd Alert 在绑定阶段统一走深色卡片,避免浅色块破坏整体深色风格 */ +.customer-binding-stage .ant-alert { + align-items: flex-start; + padding: 12px 14px; + border: 1px solid #3a4150; + border-radius: 12px; + background: #212733; +} + +.customer-binding-stage .ant-alert .ant-alert-message { + color: #e2e8f0; + font-size: 14px; + font-weight: 600; +} + +/* antd v6 的标题节点是 .ant-alert-title(v5 为 .ant-alert-message) */ +.customer-binding-stage .ant-alert .ant-alert-title { + color: #e2e8f0; + font-size: 14px; + font-weight: 600; + line-height: 1.5; +} + +.customer-binding-stage .ant-alert .ant-alert-description { + color: #cbd5e1; + font-size: 13px; + line-height: 1.6; +} + +.customer-binding-stage .ant-alert-warning { + border-color: #78350f; + background: rgba(120, 53, 15, 0.22); +} + +.customer-binding-stage .ant-alert-warning .ant-alert-icon, +.customer-binding-stage .ant-alert-warning .ant-alert-message, +.customer-binding-stage .ant-alert-warning .ant-alert-title { + color: #fbbf24; +} + +.customer-binding-stage .ant-alert-warning .ant-alert-description { + color: #fcd34d; +} + +.customer-binding-stage .ant-alert-error { + border-color: #7f1d1d; + background: rgba(127, 29, 29, 0.24); +} + +.customer-binding-stage .ant-alert-error .ant-alert-icon, +.customer-binding-stage .ant-alert-error .ant-alert-message, +.customer-binding-stage .ant-alert-error .ant-alert-title { + color: #fca5a5; +} + +.customer-binding-stage .ant-alert-error .ant-alert-description { + color: #fecaca; +} + +.customer-binding-stage .ant-alert-success { + border-color: #065f46; + background: rgba(6, 78, 59, 0.28); +} + +.customer-binding-stage .ant-alert-success .ant-alert-icon, +.customer-binding-stage .ant-alert-success .ant-alert-message, +.customer-binding-stage .ant-alert-success .ant-alert-title { + color: #6ee7b7; +} + +.customer-binding-stage .ant-alert-success .ant-alert-description { + color: #a7f3d0; +} + +.customer-binding-role-actions { + display: flex; + flex-direction: column; + gap: 12px; + width: 100%; +} + +.customer-binding-role-actions .customer-binding-confirm.ant-btn { + height: 52px; + border-radius: 14px; + background: #2563eb !important; + border-color: #2563eb !important; + color: #fff !important; + font-size: 17px; + font-weight: 600; +} + +.customer-binding-role-actions .customer-binding-confirm.ant-btn:hover, +.customer-binding-role-actions .customer-binding-confirm.ant-btn:focus-visible { + background: #1d4ed8 !important; + border-color: #1d4ed8 !important; + color: #fff !important; +} + +.customer-binding-role-actions .customer-binding-rebind.ant-btn { + height: 48px; + border-radius: 14px; + background: transparent !important; + border-color: #3a4150 !important; + color: #cbd5e1 !important; + font-size: 16px; + font-weight: 500; +} + +.customer-binding-role-actions .customer-binding-rebind.ant-btn .anticon { + color: #f59e0b; +} + +.customer-binding-role-actions .customer-binding-rebind.ant-btn:hover, +.customer-binding-role-actions .customer-binding-rebind.ant-btn:focus-visible { + background: rgba(245, 158, 11, 0.08) !important; + border-color: #b45309 !important; + color: #fbbf24 !important; +} + +.customer-binding-role-actions .customer-binding-accept.ant-btn { + height: 46px; + border-radius: 12px; + background: transparent !important; + border-color: transparent !important; + color: #94a3b8 !important; + font-size: 15px; + font-weight: 500; +} + +.customer-binding-role-actions .customer-binding-accept.ant-btn:hover, +.customer-binding-role-actions .customer-binding-accept.ant-btn:focus-visible { + background: rgba(148, 163, 184, 0.1) !important; + border-color: transparent !important; + color: #e2e8f0 !important; +} + +.customer-binding-info { + padding: 16px; + border: 1px solid #3a4150; + border-radius: 12px; + background: #212733; + display: flex; + flex-direction: column; + gap: 10px; +} + +.customer-binding-info h3 { + margin: 0 0 4px; + color: #9aa3b2; + font-size: 13px; + font-weight: 500; +} + +.customer-binding-info h3 small { + color: #64748b; + font-weight: 400; +} + +.customer-binding-info > div { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; + color: #cbd5e1; + font-size: 14px; + line-height: 1.5; +} + +.customer-binding-info > div > span { + flex: 0 0 auto; + white-space: nowrap; +} + +.customer-binding-info > div strong { + flex: 1 1 auto; + min-width: 0; + color: #fff; + text-align: right; + overflow-wrap: anywhere; +} + +.customer-binding-alert { + padding: 12px 14px; + border-radius: 8px; + border: 1px solid transparent; + font-size: 14px; +} + +.customer-binding-alert.is-warning { + color: #fbbf24; + border-color: #78350f; + background: rgba(120, 53, 15, 0.25); +} + +.customer-binding-alert.is-info { + color: #93c5fd; + border-color: #1e3a8a; + background: rgba(30, 58, 138, 0.3); +} + +.customer-binding-verify { + padding: 18px; + border: 1px solid #3a4150; + border-radius: 12px; + background: transparent; + display: flex; + flex-direction: column; + gap: 16px; + text-align: center; +} + +.customer-binding-verify p { + margin: 0; + color: #e5e7eb; + font-size: 16px; + line-height: 1.6; +} + +.customer-binding-qr-card { + padding: 18px; + border-radius: 12px; + background: #fff; + color: #111827; + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; +} + +.customer-binding-qr-card h3 { + margin: 0; + color: #6b7280; + font-size: 14px; + font-weight: 500; +} + +.customer-binding-qr-hint { + margin: 0; + color: #6b7280; + font-size: 13px; +} + +.customer-binding-qr-tip { + margin: 0; + color: #f59e0b; + font-size: 13px; +} + +.customer-binding-qr-countdown { + margin: 0; + color: #6b7280; + font-size: 13px; +} + +.customer-binding-qr-actions { + width: 100%; + margin-top: 4px; + display: grid; + grid-template-columns: 1fr 1fr; + gap: 10px; +} + +.customer-binding-qr-actions .ant-btn { + height: 40px; + border-radius: 8px; +} + +/* 斗鱼客户领取页沿用后台深色二维码面板,避免大块纯白卡片刺眼。 */ +.customer-choice-switch { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 3px; + padding: 3px; + overflow: hidden; + border: 1px solid #354052; + border-radius: 10px; + background: #171d27; +} + +.customer-choice-option { + height: 42px; + min-width: 0; + padding: 0 10px; + color: #aeb8c8; + border: 0; + border-radius: 8px; + outline: none; + background: transparent; + font: inherit; + font-size: 14px; + cursor: pointer; + transition: color 100ms ease; +} + +.customer-choice-option:hover { + color: #e2e8f0; + background: #242c39; +} + +.customer-choice-option.is-selected { + color: #fff; + background: #2f6fed; + font-weight: 700; +} + +.customer-choice-option:focus-visible { + outline: 2px solid #60a5fa; + outline-offset: 2px; +} + +.customer-binding-next.ant-btn { + width: 100%; + height: 52px; + margin-top: 6px; + border-radius: 14px; + background: #2563eb !important; + border-color: #2563eb !important; + color: #fff !important; + font-size: 17px; + font-weight: 600; +} + +.customer-binding-modal-footer { + display: flex; + flex-direction: column; + gap: 10px; +} + +.customer-binding-modal-actions { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 12px; +} + +.customer-binding-modal-actions .ant-btn { + height: 42px; + border-radius: 8px; +} + +.customer-binding-modal-actions.is-mismatch { + grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); +} + +.customer-binding-modal-error { + margin: 0; + color: #dc2626; + font-size: 13px; + text-align: center; +} + +.customer-binding-modal-warning { + margin: 0; + color: #d97706; + font-size: 13px; + text-align: center; +} + +.customer-binding-compare { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; +} + +.customer-binding-compare-side { + display: flex; + flex-direction: column; + gap: 6px; + padding: 14px; + border: 1px solid rgba(15, 23, 42, 0.12); + border-radius: 6px; + background: rgba(15, 23, 42, 0.04); +} + +.customer-binding-compare-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + color: #64748b; + font-size: 13px; +} + +.customer-binding-compare-side strong { + color: #0f172a; + font-size: 16px; + word-break: break-all; +} + +.customer-binding-compare-side em { + color: #64748b; + font-style: normal; + font-size: 13px; +} + +@media (max-width: 480px) { + .customer-binding-compare { + grid-template-columns: minmax(0, 1fr); + } +} diff --git a/apps/frontend/src/styles/customer/layout.css b/apps/frontend/src/styles/customer/layout.css new file mode 100644 index 00000000..6183ac03 --- /dev/null +++ b/apps/frontend/src/styles/customer/layout.css @@ -0,0 +1,229 @@ +/** 客户领取页公共样式:布局、表单、登录、订单、角色绑定与状态。 */ + +/** + * 客户领取页样式 + * + * 覆盖虎牙、微博、斗鱼客户领取、资料收集、角色绑定与二维码阶段。 + * 从 client.css 拆分,保持原选择器和层叠顺序不变。 + */ + +.customer-auth-page { + --auth-accent: #2f6fed; + --auth-accent-hover: #4a83ff; + --auth-panel: #232936; + --auth-panel-soft: #2a3140; + --auth-line: rgba(255, 255, 255, 0.08); + --auth-text: #f5f7fa; + --auth-muted: #9aa3b2; + min-height: 100vh; + display: flex; + justify-content: center; + overflow-x: hidden; + padding: 0; + color: var(--auth-text); + background: #232936; +} + +.customer-auth-shell { + width: min(560px, 100%); + min-width: 0; + align-self: stretch; + overflow: hidden; + border: none; + border-radius: 0; + background: transparent; + box-shadow: none; +} + +.customer-auth-hero { + min-height: auto; + display: flex; + align-items: center; + justify-content: center; + padding: 38px 16px 10px; + background: none; +} + +/* 微博登录页顶部 KV:与资料页共用 inside-kv.jpg,叠加深色渐变保证标题可读。 */ +.customer-auth-brand { + display: flex; + align-items: center; + justify-content: center; + gap: 0; + min-width: 0; +} + +.customer-auth-logo { + width: 62px; + height: 62px; + flex: none; + display: grid; + place-items: center; + border: 1px solid rgba(255, 255, 255, 0.22); + border-radius: 8px; + color: var(--auth-accent); + font-size: 34px; + background: rgba(3, 12, 34, 0.58); + box-shadow: inset 0 0 24px rgba(255, 138, 0, 0.06); +} + +.customer-auth-brand h1 { + margin: 0; + color: #fff; + font-size: 20px; + line-height: 1.4; + font-weight: 700; + letter-spacing: 0; + text-align: center; + white-space: normal; + overflow-wrap: anywhere; +} + +.customer-auth-warning { + padding: 6px 16px 10px; + color: #ff6975; + text-align: center; + font-size: 14px; + font-weight: 600; + background: transparent; + border-bottom: none; +} + +.customer-auth-main { + min-width: 0; + padding-bottom: 24px; + color: var(--auth-text); + background: transparent; +} + +.customer-auth-content-stack { + min-width: 0; + display: flex; + flex-direction: column; +} + +.customer-auth-task-switcher { + display: flex; + align-items: flex-start; + gap: 16px; + padding: 20px 24px; + border-bottom: 1px solid var(--auth-line); +} + +.customer-auth-task-switcher > span { + flex: none; + padding-top: 5px; + color: var(--auth-muted); + font-size: 13px; +} + +.customer-auth-task-switcher > div { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.customer-auth-task-switcher .ant-btn { + height: auto; + padding: 6px 10px; + color: #dce6f8; + white-space: normal; + text-align: left; + border-color: rgba(255, 255, 255, 0.16); + background: rgba(255, 255, 255, 0.04); +} + +.customer-auth-task-switcher .ant-btn-primary { + color: #111827; + border-color: var(--auth-accent); +} + +.customer-auth-facts { + min-width: 0; + padding: 0 26px; +} + +.customer-auth-facts > div { + display: grid; + grid-template-columns: 132px minmax(0, 1fr); + align-items: center; + gap: 18px; + min-height: 74px; + padding: 16px 4px; + border-bottom: 1px solid var(--auth-line); +} + +.customer-auth-facts > div > span { + color: #c0c8d8; + font-size: 16px; +} + +.customer-auth-facts > div > strong { + min-width: 0; + justify-self: end; + color: #f8fafc; + font-size: 18px; + line-height: 1.5; + font-weight: 600; + text-align: right; + word-break: break-all; + overflow-wrap: anywhere; +} + +.customer-auth-section { + min-width: 0; + padding: 16px; + border-bottom: none; +} + +.customer-auth-section-heading { + display: flex; + align-items: flex-start; + gap: 14px; +} + +.customer-auth-section-icon { + width: 36px; + height: 36px; + flex: none; + display: grid; + place-items: center; + border: 1px solid rgba(255, 255, 255, 0.15); + border-radius: 8px; + color: var(--auth-accent); + font-size: 18px; + background: rgba(255, 255, 255, 0.035); +} + +.customer-auth-section-heading h2, +.customer-auth-state h2 { + margin: 0 0 6px; + color: #fff; + font-size: 18px; + line-height: 1.4; + font-weight: 700; +} + +.customer-auth-section-heading p, +.customer-auth-state p, +.customer-auth-form-copy { + margin: 0; + color: var(--auth-muted); + font-size: 15px; + line-height: 1.75; +} + +.customer-auth-section-copy h2 { + margin: 0 0 8px; + color: #fff; + font-size: 23px; + line-height: 1.35; + font-weight: 700; +} + +.customer-auth-section-copy p { + margin: 0; + color: var(--auth-muted); + font-size: 15px; + line-height: 1.75; +} diff --git a/apps/frontend/src/styles/customer/login.css b/apps/frontend/src/styles/customer/login.css new file mode 100644 index 00000000..d155b9d4 --- /dev/null +++ b/apps/frontend/src/styles/customer/login.css @@ -0,0 +1,87 @@ +/* 登录与绑定页(图 2-10) */ +.customer-login-form { + display: flex; + flex-direction: column; + gap: 12px; +} + +.customer-login-hint { + margin: 0 0 2px; + color: #d5dae3; + font-size: 16px; + line-height: 1.5; +} + +.customer-login-mobile-row { + display: flex; + align-items: stretch; + gap: 12px; +} + +.customer-login-mobile.ant-input { + flex: 1; + min-width: 0; + height: 48px; + padding: 0 16px; + border-radius: 8px; + border-color: #3a4150; + background: #1b2130; + color: #fff; + font-size: 15px; +} + +.customer-login-mobile.ant-input::placeholder { + color: #6b7482; +} + +.customer-login-code-button.ant-btn { + flex: none; + width: 118px; + height: 48px; + border-radius: 8px; + background: #3b82f6 !important; + border-color: #3b82f6 !important; + color: #fff !important; + font-size: 16px; +} + +.customer-login-code-input.ant-input { + height: 48px; + border-radius: 8px; + border-color: #3a4150; + background: #1b2130; + color: #fff; + text-align: center; + font-size: 15px; + letter-spacing: 6px; +} + +.customer-login-code-input.ant-input::placeholder { + color: #6b7482; +} + +.customer-login-submit.ant-btn { + height: 52px; + border-radius: 14px; + background: #2563eb !important; + border-color: #2563eb !important; + color: #fff !important; + font-size: 17px; + font-weight: 600; +} + +.customer-login-submit.ant-btn:hover, +.customer-login-submit.ant-btn:focus-visible { + background: #1d4ed8 !important; + border-color: #1d4ed8 !important; + color: #fff !important; +} + +.customer-login-alt.ant-btn { + height: 48px; + border-radius: 8px; + background: transparent !important; + border-color: #3a4150 !important; + color: #cbd5e1 !important; + font-size: 16px; +} diff --git a/apps/frontend/src/styles/customer/order.css b/apps/frontend/src/styles/customer/order.css new file mode 100644 index 00000000..122ff4a5 --- /dev/null +++ b/apps/frontend/src/styles/customer/order.css @@ -0,0 +1,53 @@ +.customer-order-card { + margin: 10px 16px 0; + padding: 16px; + border: 1px solid #3a4150; + border-radius: 12px; + background: #212733; + display: flex; + flex-direction: column; + gap: 10px; +} + +.customer-order-card h3 { + margin: 0 0 4px; + color: #94a3b8; + font-size: 13px; + font-weight: 500; +} + +.customer-order-card > div { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; + color: #cbd5e1; + font-size: 14px; + line-height: 1.5; +} + +.customer-order-card > div > span { + flex: 0 0 auto; + white-space: nowrap; + color: #9aa3b2; +} + +.customer-order-card > div strong { + flex: 1 1 auto; + min-width: 0; + color: #fff; + text-align: right; + overflow-wrap: anywhere; +} + +.customer-order-card > div strong.customer-order-status { + flex: 0 0 auto; + padding: 3px 12px; + border: 1px solid rgba(96, 165, 250, 0.38); + border-radius: 999px; + color: #dbeafe; + font-size: 13px; + font-weight: 600; + text-align: center; + background: rgba(47, 111, 237, 0.28); +} diff --git a/apps/frontend/src/styles/customer/platform/douyu.css b/apps/frontend/src/styles/customer/platform/douyu.css new file mode 100644 index 00000000..6f6ed284 --- /dev/null +++ b/apps/frontend/src/styles/customer/platform/douyu.css @@ -0,0 +1,563 @@ +/** 斗鱼客户领取页平台差异样式。 */ + +.customer-auth-page.is-douyu .customer-binding-qr-card { + padding: 18px; + color: var(--auth-text); + border: 1px solid #3a4150; + border-radius: 14px; + background: #202631; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035); +} + +.customer-auth-page.is-douyu .customer-binding-qr-card h3 { + color: #d7dee9; + font-size: 15px; + font-weight: 600; +} + +.customer-auth-page.is-douyu .customer-binding-qr-code { + width: min(100%, 292px); + aspect-ratio: 1; + display: grid; + place-items: center; + padding: 14px; + overflow: hidden; + border: 1px solid #4a5262; + border-radius: 12px; + background: #e8ebef; + box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22); +} + +.customer-auth-page.is-douyu .customer-binding-qr-code .ant-image, +.customer-auth-page.is-douyu .customer-binding-qr-code img { + width: 100%; + height: 100%; + display: block; + border-radius: 7px; +} + +.customer-auth-page.is-douyu .customer-auth-qr-placeholder { + width: 100%; + min-height: 100%; + color: #8f9aab; + border: 1px dashed #485162; + border-radius: 9px; + background: #171c24; +} + +.customer-auth-page.is-douyu .customer-binding-qr-hint { + max-width: 340px; + color: #b8c1cf; + font-size: 13px; + line-height: 1.6; + text-align: center; +} + +.customer-auth-page.is-douyu .customer-binding-qr-countdown { + color: #cbd5e1; + font-variant-numeric: tabular-nums; +} + +.customer-auth-page.is-douyu .customer-binding-qr-card .ant-progress { + width: min(100%, 292px); +} + +.customer-auth-page.is-douyu .customer-binding-qr-card .ant-progress-inner { + background: #353d4b; +} + +.customer-auth-page.is-douyu .customer-binding-qr-card .ant-progress-bg { + background: #f59e0b; +} + +.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn { + color: #e2e8f0; + border-color: #465063; + background: #2a313d; + box-shadow: none; +} + +.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn:hover, +.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn:focus-visible { + color: #fff; + border-color: #657186; + background: #343c4a; +} + +.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn { + align-self: flex-end; + height: 34px; + padding-inline: 12px; + color: #b8c1cf; + border-color: #3f495a; + border-radius: 8px; + background: transparent; + font-size: 13px; + box-shadow: none; +} + +.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn:hover, +.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn:focus-visible { + color: #fff; + border-color: #64748b; + background: #2a313d; +} + +.customer-auth-page.is-douyu .customer-auth-hero { + min-height: 148px; + align-items: flex-end; + justify-content: center; + padding: 0 16px 18px; + background-color: #111827; + background-image: + linear-gradient(180deg, rgba(11, 18, 32, 0.08) 0%, rgba(11, 18, 32, 0.56) 68%, #232936 100%), + url('/images/customer/inside-kv.jpg'); + background-repeat: no-repeat; + background-position: center 38%; + background-size: cover; +} + +.customer-auth-page.is-douyu .customer-auth-brand { + width: auto; + align-items: flex-end; + justify-content: center; +} + +.customer-auth-page.is-douyu .customer-auth-brand h1 { + font-size: 16px; + line-height: 1.4; + text-align: center; + text-shadow: 0 2px 12px rgba(0, 0, 0, 0.82); +} + +.customer-auth-page.is-douyu .customer-auth-warning { + padding-top: 12px; +} + +.customer-auth-page.is-douyu .customer-order-closed-alert.ant-alert { + align-items: flex-start; + margin: 10px 16px 0; + padding: 12px 14px; + color: #f6c66f; + border: 1px solid #6b4d1f; + border-radius: 10px; + background: #2a2418; +} + +.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-icon { + margin-top: 2px; + color: #f6ad3c; + font-size: 16px; +} + +.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-message, +.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-title { + color: #f7d394; + font-size: 14px; + font-weight: 600; + line-height: 1.4; +} + +.customer-auth-page.is-douyu .customer-order-closed-alert .ant-alert-description { + margin-top: 3px; + color: #d8c39b; + font-size: 13px; + line-height: 1.5; +} + +.customer-auth-page.is-douyu .customer-douyu-order-card { + padding: 0; + overflow: hidden; + gap: 0; + border-radius: 12px; + background: #202631; +} + +.customer-auth-page.is-douyu .customer-douyu-order-head { + align-items: center; + gap: 12px; + padding: 13px 16px; + border-bottom: 1px solid #343d4c; +} + +.customer-auth-page.is-douyu .customer-douyu-order-head h3 { + margin: 0; + color: #9aa3b2; + font-size: 13px; + font-weight: 600; +} + +.customer-auth-page.is-douyu .customer-douyu-order-field { + display: grid; + grid-template-columns: 72px minmax(0, 1fr); + align-items: start; + gap: 12px; + padding: 11px 16px; + border-bottom: 1px solid #343d4c; +} + +.customer-auth-page.is-douyu .customer-douyu-order-field:last-child { + border-bottom: 0; +} + +.customer-auth-page.is-douyu .customer-douyu-order-field > span { + color: #8f9aaa; + font-size: 13px; + line-height: 1.5; +} + +.customer-auth-page.is-douyu .customer-douyu-order-field > strong { + min-width: 0; + color: #f1f5f9; + font-size: 14px; + font-weight: 600; + line-height: 1.5; + text-align: right; + overflow-wrap: anywhere; +} + +.customer-auth-page.is-douyu .customer-douyu-order-status { + flex: 0 0 auto; + padding: 2px 10px; + border-color: rgba(96, 165, 250, 0.36); + color: #dbeafe; + font-size: 12px; + font-weight: 600; + background: rgba(47, 111, 237, 0.22); +} + +.customer-auth-page.is-douyu .customer-douyu-order-status.is-cancelled { + border-color: rgba(245, 158, 11, 0.38); + color: #f8d28a; + background: rgba(245, 158, 11, 0.14); +} + +.customer-auth-page.is-douyu .customer-douyu-order-status.is-completed { + border-color: rgba(52, 211, 153, 0.38); + color: #a7f3d0; + background: rgba(6, 95, 70, 0.24); +} + +.customer-auth-page.is-douyu .customer-douyu-order-status.is-failed { + border-color: rgba(248, 113, 113, 0.38); + color: #fecaca; + background: rgba(127, 29, 29, 0.24); +} + +.customer-douyu-qr-main { + width: 100%; + display: grid; + grid-template-columns: 30px minmax(0, 220px) 30px; + align-items: stretch; + justify-content: center; + gap: 7px; +} + +.customer-douyu-qr-rail { + display: flex; + align-items: center; + justify-content: center; + min-height: 0; + padding: 0; + color: #ff5a67; + font-size: 12px; + font-weight: 800; + line-height: 1.05; + letter-spacing: 1px; + text-align: center; + writing-mode: vertical-rl; + text-orientation: upright; + background: none; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-main .customer-binding-qr-code { + width: 100%; + max-width: none; + padding: 10px; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-preparing { + position: relative; + width: 100%; + height: 100%; + min-height: 100%; + display: grid; + place-items: center; + overflow: hidden; + border-radius: 7px; + background: #171c24; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-skeleton { + position: absolute; + inset: 18px; + opacity: 0.16; + background-image: + linear-gradient(90deg, #9fb1ca 50%, transparent 50%), + linear-gradient(#9fb1ca 50%, transparent 50%); + background-position: + 0 0, + 0 0; + background-size: + 18px 18px, + 18px 18px; + -webkit-mask-image: linear-gradient(135deg, #000 12%, transparent 82%); + mask-image: linear-gradient(135deg, #000 12%, transparent 82%); +} + +.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy { + position: relative; + z-index: 1; + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; + color: #b8c1cf; + text-align: center; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy strong { + color: #e2e8f0; + font-size: 14px; + font-weight: 600; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-preparing-copy span { + color: #8f9aaa; + font-size: 12px; +} + +.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn { + color: #e2e8f0; + border-color: #465063; + background: #2a313d; + box-shadow: none; +} + +.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn:hover, +.customer-auth-page.is-douyu .customer-douyu-preparing-button.ant-btn:focus-visible { + color: #fff; + border-color: #657186; + background: #343c4a; +} + +.customer-auth-page.is-douyu .customer-binding-qr-actions.is-single { + grid-template-columns: minmax(0, 1fr); +} + +.customer-auth-page.is-douyu .customer-binding-qr-actions .ant-btn:disabled { + color: #7d8797; + border-color: #394353; + background: #252c37; + opacity: 1; +} + +.customer-auth-page.is-douyu .customer-binding-qr-countdown.is-expired { + color: #ff7a84; + font-weight: 700; +} + +.customer-auth-page.is-douyu .customer-douyu-qr-refresh-note { + margin: -2px 0 0; + color: #8f9aaa; + font-size: 11px; + line-height: 1.4; + text-align: center; +} + +.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat { + border-color: rgba(248, 113, 113, 0.34); + background: linear-gradient(135deg, rgba(127, 29, 29, 0.26), rgba(32, 38, 49, 0.9)); +} + +.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-icon, +.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-message, +.customer-auth-page.is-douyu .customer-douyu-binding-alert.is-wechat .ant-alert-title { + color: #ff8a92; +} + +.customer-douyu-binding-failure { + display: flex; + flex-direction: column; + gap: 10px; +} + +.customer-douyu-binding-failure > p { + margin: 0; + padding: 12px 14px; + color: #fecaca; + font-size: 13px; + line-height: 1.6; + text-align: center; + border: 1px solid rgba(248, 113, 113, 0.3); + border-radius: 10px; + background: rgba(127, 29, 29, 0.18); +} + +.customer-auth-page.is-douyu.is-compact { + height: 100vh; + height: 100dvh; + min-height: 0; + overflow: hidden; +} + +.customer-auth-page.is-douyu.is-compact .customer-auth-shell { + height: 100%; + display: flex; + flex-direction: column; +} + +.customer-auth-page.is-douyu.is-compact .customer-auth-hero { + min-height: 148px; + padding: 0 16px 18px; + background-position: center 34%; +} + +.customer-auth-page.is-douyu.is-compact .customer-auth-warning { + padding: 8px 16px 12px; + font-size: 14px; +} + +.customer-auth-page.is-douyu.is-compact .customer-auth-main { + display: flex; + flex-direction: column; + flex: 1 1 auto; + min-height: 0; + padding-bottom: 0; + overflow: hidden; +} + +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-card { + flex: none; + margin: 10px 16px 0; +} + +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-head { + padding: 13px 16px; +} + +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field { + grid-template-columns: 72px minmax(0, 1fr); + gap: 12px; + padding: 11px 16px; +} + +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field > span, +.customer-auth-page.is-douyu.is-compact .customer-douyu-order-field > strong { + font-size: 14px; + line-height: 1.5; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-stage { + flex: 1 1 auto; + min-height: 0; + justify-content: center; + gap: 14px; + padding: 16px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert { + flex: none; + padding: 12px 14px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert-description { + margin-top: 4px; + font-size: 13px; + line-height: 1.6; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card { + flex: 0 1 auto; + justify-content: center; + gap: 10px; + padding: 18px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card h3 { + font-size: 15px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-hint { + font-size: 13px; + line-height: 1.6; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-countdown { + font-size: 13px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-card .ant-progress { + line-height: 1.5; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-actions { + margin-top: 4px; +} + +.customer-auth-page.is-douyu.is-compact .customer-binding-qr-actions .ant-btn { + height: 40px; + font-size: 14px; +} + +@media (max-height: 720px) { + .customer-auth-page.is-douyu.is-compact .customer-auth-hero { + min-height: 60px; + padding-bottom: 6px; + } + + .customer-auth-page.is-douyu.is-compact .customer-auth-warning { + padding-block: 1px 4px; + font-size: 11px; + } + + .customer-auth-page.is-douyu.is-compact .customer-douyu-order-head { + padding-block: 6px; + } + + .customer-auth-page.is-douyu.is-compact .customer-douyu-order-field { + padding-block: 5px; + } + + .customer-auth-page.is-douyu.is-compact .customer-binding-stage { + justify-content: flex-start; + gap: 6px; + padding-block: 6px; + } + + .customer-auth-page.is-douyu.is-compact .customer-binding-stage .ant-alert-description { + display: none; + } + + .customer-auth-page.is-douyu.is-compact .customer-binding-qr-card { + gap: 4px; + padding-block: 7px; + } + + .customer-auth-page.is-douyu.is-compact .customer-douyu-qr-main { + grid-template-columns: 26px minmax(0, clamp(154px, 30dvh, 190px)) 26px; + gap: 5px; + } + + .customer-auth-page.is-douyu.is-compact .customer-douyu-qr-rail { + font-size: 10px; + } +} + +.customer-auth-page.is-douyu .customer-collect-submit.ant-btn { + height: 48px; + margin-top: 14px; + color: #fff !important; + border-color: #2f6fed !important; + border-radius: 10px; + background: #2f6fed !important; + font-size: 15px; + font-weight: 700; +} + +.customer-auth-page.is-douyu .customer-collect-submit.ant-btn:hover, +.customer-auth-page.is-douyu .customer-collect-submit.ant-btn:focus-visible { + color: #fff !important; + border-color: #4a83ff !important; + background: #4a83ff !important; +} diff --git a/apps/frontend/src/styles/customer/platform/huya.css b/apps/frontend/src/styles/customer/platform/huya.css new file mode 100644 index 00000000..dc8abfb6 --- /dev/null +++ b/apps/frontend/src/styles/customer/platform/huya.css @@ -0,0 +1,136 @@ +/** 虎牙客户安全验证样式。 */ + +.huya-slider-challenge { + display: flex; + flex-direction: column; + gap: 14px; +} + +.huya-slider-challenge > p { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: 6px 12px; + margin: 0; + color: #475569; + font-size: 14px; + line-height: 1.65; +} + +.huya-challenge-progress { + color: #c2410c; + font-size: 12px; + font-weight: 700; +} + +.huya-click-tip { + display: block; + max-width: 100%; + max-height: 64px; + object-fit: contain; +} + +.huya-slider-stage { + position: relative; + width: 100%; + overflow: hidden; + border: 1px solid rgba(148, 163, 184, 0.36); + border-radius: 8px; + background: #e2e8f0; + user-select: none; +} + +.huya-slider-stage.is-click { + cursor: crosshair; +} + +.huya-slider-background, +.huya-slider-puzzle { + pointer-events: none; + user-select: none; +} + +.huya-slider-puzzle.is-rotate { + transform-origin: center; +} + +.huya-click-point { + position: absolute; + display: grid; + width: 24px; + height: 24px; + place-items: center; + color: #fff; + font-size: 12px; + font-weight: 700; + border: 2px solid #fff; + border-radius: 50%; + background: #ea580c; + box-shadow: 0 2px 8px rgba(15, 23, 42, 0.32); + transform: translate(-50%, -50%); + pointer-events: none; +} + +.huya-slider-background { + display: block; + width: 100%; + height: 100%; +} + +.huya-slider-puzzle { + position: absolute; + max-width: none; + height: auto; +} + +.huya-slider-track { + position: relative; + height: 46px; + overflow: hidden; + border: 1px solid rgba(148, 163, 184, 0.36); + border-radius: 8px; + background: #f1f5f9; + touch-action: none; +} + +.huya-slider-track-fill { + position: absolute; + inset: 0 auto 0 0; + max-width: 100%; + background: rgba(249, 115, 22, 0.16); +} + +.huya-slider-handle { + position: absolute; + top: 3px; + left: 3px; + width: 58px; + height: 38px; + padding: 0; + color: #111827; + font-size: 13px; + font-weight: 700; + border: 0; + border-radius: 6px; + background: #f97316; + cursor: grab; + touch-action: none; +} + +.huya-slider-handle:active { + cursor: grabbing; +} + +.huya-rotate-control { + display: grid; + grid-template-columns: minmax(0, 1fr) 48px; + gap: 12px; + align-items: center; +} + +.huya-rotate-control > span { + color: #475569; + font-size: 13px; + font-variant-numeric: tabular-nums; + text-align: right; +} diff --git a/apps/frontend/src/styles/customer/platform/weibo.css b/apps/frontend/src/styles/customer/platform/weibo.css new file mode 100644 index 00000000..6f80295a --- /dev/null +++ b/apps/frontend/src/styles/customer/platform/weibo.css @@ -0,0 +1,33 @@ +/** 微博客户领取页平台差异样式。 */ + +.customer-auth-page.is-weibo .customer-auth-hero { + min-height: 134px; + align-items: flex-start; + justify-content: flex-start; + padding: 26px 20px 20px; + background-color: #0b1220; + background-image: + linear-gradient(180deg, rgba(11, 18, 32, 0.12) 0%, rgba(11, 18, 32, 0.72) 72%, #232936 100%), + url('/images/customer/inside-kv.jpg'); + background-repeat: no-repeat; + background-position: center 38%; + background-size: cover; +} + +.customer-auth-page.is-weibo .customer-auth-brand { + width: 100%; + justify-content: flex-start; +} + +.customer-auth-page.is-weibo .customer-auth-brand h1 { + text-align: left; + text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72); +} + +@media (max-width: 640px) { + .customer-auth-page.is-weibo .customer-auth-hero { + min-height: 118px; + padding: 20px 16px 14px; + background-position: center 42%; + } +} diff --git a/apps/frontend/src/styles/customer/profile.css b/apps/frontend/src/styles/customer/profile.css new file mode 100644 index 00000000..5e36ae65 --- /dev/null +++ b/apps/frontend/src/styles/customer/profile.css @@ -0,0 +1,234 @@ +/* 客户资料页(图 1) */ +.customer-collect-page { + min-height: 100vh; + background: #0b1220; + color: #e5e7eb; +} + +/* 资料页顶部 KV:原图 https://game.gtimg.cn/images/gp/web201908/inside_kv.jpg(本地 1600×510 q82) */ +.customer-collect-hero { + position: relative; + min-height: clamp(190px, 24vw, 240px); + display: flex; + align-items: flex-end; + justify-content: center; + padding: 0 20px 16px; + overflow: hidden; + text-align: center; + background-color: #0b1220; + background-image: + linear-gradient(180deg, rgba(11, 18, 32, 0) 45%, rgba(11, 18, 32, 0.55) 72%, #0b1220 100%), + url('/images/customer/inside-kv.jpg'); + background-repeat: no-repeat; + background-position: center 38%; + background-size: cover; +} + +.customer-collect-warning { + margin: 0; + text-align: center; + color: #f87171; + font-size: 17px; + font-weight: 600; + text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); +} + +@media (max-width: 640px) { + .customer-collect-hero { + min-height: 180px; + padding: 0 16px 14px; + background-position: center 42%; + } + + .customer-collect-warning { + font-size: 15px; + } +} + +.customer-collect-body { + max-width: 560px; + margin: 0 auto; + padding: 24px 20px 48px; + display: flex; + flex-direction: column; + gap: 12px; +} + +.customer-collect-label { + margin-top: 8px; + color: #e5e7eb; + font-size: 15px; + line-height: 1.4; +} + +.customer-collect-label span { + color: #f87171; +} + +.customer-collect-readonly { + height: 48px; + display: flex; + align-items: center; + padding: 0 16px; + border-radius: 12px; + background: #1b2436; + border: 1px solid #26344d; + color: #94a3b8; + font-size: 15px; +} + +.customer-collect-card { + margin: 10px 0; + padding: 16px; + border-radius: 12px; + border: 1px solid #1e2f4a; + background: #141d30; + display: flex; + flex-direction: column; + gap: 12px; +} + +.customer-collect-card > div { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; + color: #cbd5e1; + font-size: 15px; + line-height: 1.5; +} + +.customer-collect-card > div > span { + flex: 0 0 auto; + white-space: nowrap; +} + +.customer-collect-card > div strong { + flex: 1 1 auto; + min-width: 0; + color: #fff; + font-weight: 600; + text-align: right; + overflow-wrap: anywhere; +} + +.customer-collect-card > p { + margin: 6px 0 0; + color: #fbbf24; + font-size: 13px; + text-align: center; +} + +.customer-collect-input.ant-input { + height: 48px; + border-radius: 12px; + background: #1b2436; + border-color: #26344d; + color: #fff; +} + +.customer-collect-input.ant-input::placeholder { + color: #64748b; +} + +.customer-collect-select.ant-select { + width: 100%; + height: 48px; + padding-inline: 16px; + align-items: center; + font-size: 15px; + border-radius: 12px; + border: 1px solid #26344d; + background: #1b2436; + color: #fff; + --ant-select-height: 48px; + --ant-select-border-radius: 12px; + --ant-select-border-color: #26344d; + --ant-select-background-color: #1b2436; + --ant-select-color: #fff; + --ant-select-hover-border-color: #3b4d6b; + --ant-select-active-border-color: #2563eb; + --ant-select-active-outline-color: rgba(37, 99, 235, 0.2); +} + +.customer-collect-select.ant-select:hover { + border-color: #3b4d6b; +} + +.customer-collect-select.ant-select.ant-select-focused { + border-color: #2563eb; + box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); +} + +.customer-collect-select .ant-select-content { + align-items: center; +} + +.customer-collect-select .ant-select-selection-item { + color: #fff; + line-height: 1.5; +} + +.customer-collect-select .ant-select-placeholder { + color: #64748b; +} + +.customer-collect-select .ant-select-suffix { + color: #94a3b8; +} + +.ant-select-dropdown.customer-collect-dropdown { + padding: 6px; + border-radius: 12px; + background: #141d30; + box-shadow: 0 14px 34px rgba(2, 6, 23, 0.55); + --ant-select-option-active-bg: #1b2436; + --ant-select-option-selected-bg: #1e3a8a; + --ant-select-option-selected-color: #fff; +} + +.customer-collect-dropdown .ant-select-item { + border-radius: 8px; + color: #cbd5e1; +} + +.customer-collect-dropdown .ant-select-item-option-active { + background: #1b2436 !important; + color: #fff; +} + +.customer-collect-dropdown .ant-select-item-option-selected { + background: #1e3a8a !important; + color: #fff; + font-weight: 600; +} + +.customer-collect-page .customer-collect-submit.ant-btn, +.customer-auth-profile .customer-collect-submit.ant-btn { + height: 52px; + margin-top: 14px; + border-radius: 14px; + font-size: 17px; + font-weight: 600; + --ant-btn-bg-color: #2563eb; + --ant-btn-bg-color-hover: #1d4ed8; + --ant-btn-bg-color-active: #1e40af; + --ant-btn-text-color: #fff; + --ant-btn-text-color-hover: #fff; + --ant-btn-text-color-active: #fff; + --ant-btn-border-color: #2563eb; + --ant-btn-border-color-hover: #1d4ed8; + --ant-btn-border-color-active: #1e40af; + background: #2563eb !important; + border-color: #2563eb !important; + color: #fff !important; +} + +.customer-collect-page .customer-collect-submit.ant-btn:hover, +.customer-collect-page .customer-collect-submit.ant-btn:focus-visible, +.customer-auth-profile .customer-collect-submit.ant-btn:hover, +.customer-auth-profile .customer-collect-submit.ant-btn:focus-visible { + background: #1d4ed8 !important; + border-color: #1d4ed8 !important; + color: #fff !important; +} diff --git a/apps/frontend/src/styles/customer/responsive.css b/apps/frontend/src/styles/customer/responsive.css new file mode 100644 index 00000000..bdc80ab7 --- /dev/null +++ b/apps/frontend/src/styles/customer/responsive.css @@ -0,0 +1,162 @@ +@media (max-width: 640px) { + .customer-auth-page { + height: auto; + min-height: 100vh; + overflow: visible; + padding: 0; + background: var(--auth-panel); + } + + .customer-auth-shell { + width: 100%; + height: auto; + display: block; + border: 0; + border-radius: 0; + box-shadow: none; + } + + .customer-auth-hero { + min-height: auto; + padding: 38px 16px 10px; + background: none; + } + + .customer-auth-brand h1 { + font-size: 20px; + } + + .customer-auth-warning { + padding: 6px 16px 10px; + font-size: 14px; + } + + .customer-auth-main { + overflow: visible; + } + + .customer-auth-content-stack { + height: auto; + min-height: 0; + } + + .customer-auth-facts { + padding-inline: 20px; + } + + .customer-auth-facts > div { + grid-template-columns: 92px minmax(0, 1fr); + gap: 12px; + min-height: 52px; + padding-block: 8px; + } + + .customer-auth-facts > div > span { + font-size: 13px; + } + + .customer-auth-facts > div > strong { + font-size: 15px; + line-height: 1.35; + } + + .customer-auth-section { + padding: 16px; + } + + .customer-auth-section-copy h2, + .customer-auth-state h2 { + font-size: 20px; + } + + .customer-auth-section-copy p, + .customer-auth-state p, + .customer-auth-form-copy { + font-size: 13px; + line-height: 1.5; + } + + .customer-auth-tabs { + margin-top: 0; + } + + .customer-auth-tabs .ant-tabs-nav { + margin-bottom: 10px; + } + + .customer-auth-tabs .ant-tabs-nav-list { + gap: 4px; + padding: 4px; + } + + .customer-auth-tabs .ant-tabs-tab { + padding: 9px 14px; + } + + .customer-auth-tabs .ant-tabs-tab-btn { + font-size: 15px; + } + + .customer-auth-form { + gap: 10px; + padding-top: 0; + } + + .customer-auth-field { + min-height: 44px; + border-radius: 9px; + } + + .customer-auth-phone-field { + grid-template-columns: 50px minmax(0, 1fr) 104px; + } + + .customer-auth-code-field { + grid-template-columns: minmax(0, 1fr) 104px; + } + + .customer-auth-field .ant-select, + .customer-auth-field .ant-select-selector, + .customer-auth-field .ant-input, + .customer-auth-field .ant-input-affix-wrapper { + height: 44px; + } + + .customer-auth-field .ant-select-selection-item { + line-height: 42px !important; + } + + .customer-auth-field .ant-input-affix-wrapper { + padding-inline: 12px; + } + + .customer-auth-code-field { + padding: 4px; + } + + .customer-auth-code-submit { + height: 36px !important; + } + + .customer-auth-send-code { + height: 36px !important; + } + + .customer-auth-form-hint { + font-size: 10px; + line-height: 1.35; + } + + .customer-auth-qr-image, + .customer-auth-qr-placeholder { + width: 232px; + min-height: 232px; + } + + .customer-auth-privacy { + margin: 8px 16px 12px; + padding: 8px 12px; + font-size: 12px; + line-height: 1.45; + } +} diff --git a/apps/frontend/src/styles/customer/status.css b/apps/frontend/src/styles/customer/status.css new file mode 100644 index 00000000..dcf8972f --- /dev/null +++ b/apps/frontend/src/styles/customer/status.css @@ -0,0 +1,106 @@ +.customer-auth-button-stack { + width: min(100%, 580px); + display: flex; + flex-direction: column; + gap: 12px; +} + +.customer-auth-button-stack .ant-btn, +.customer-auth-form > .ant-btn { + height: 52px; + font-size: 17px; +} + +.customer-auth-status-pill { + display: inline-flex; + align-items: center; + justify-content: center; + min-height: 34px; + padding: 4px 15px; + color: #fff; + font-size: 15px !important; + font-weight: 600 !important; + text-align: center; + border-radius: 999px; + background: #3169aa; +} + +.customer-auth-status-pill.is-pending, +.customer-auth-status-pill.is-scanned { + background: #3a6fa8; +} + +.customer-auth-status-pill.is-success { + background: #237a57; +} + +.customer-auth-status-pill.is-danger { + background: #a33a48; +} + +.customer-auth-state { + display: flex; + flex-direction: column; + align-items: center; + gap: 12px; + padding: 48px 26px; + text-align: center; +} + +.customer-auth-state h2 { + margin: 0; +} + +.customer-auth-state p { + max-width: 560px; +} + +.customer-auth-state-icon { + width: 58px; + height: 58px; + display: grid; + place-items: center; + color: var(--auth-accent); + font-size: 29px; + border: 1px solid rgba(255, 255, 255, 0.16); + border-radius: 50%; + background: rgba(255, 255, 255, 0.045); +} + +.customer-auth-state.is-success .customer-auth-state-icon { + color: #52d39a; +} + +.customer-auth-state.is-error .customer-auth-state-icon { + color: #ff6975; +} + +.customer-auth-state-time { + color: var(--auth-muted); + font-size: 12px; +} + +.customer-auth-loading { + min-height: 240px; + display: grid; + place-items: center; + align-content: center; + gap: 14px; + color: var(--auth-muted); +} + +.customer-auth-privacy { + margin: 24px 26px 28px; + padding: 14px 18px; + color: #d8b46a; + font-size: 14px; + line-height: 1.65; + text-align: center; + border: 1px solid rgba(216, 180, 106, 0.64); + border-radius: 5px; + background: rgba(0, 0, 0, 0.08); +} + +.customer-auth-page .ant-spin-dot-item { + background: var(--auth-accent); +} diff --git a/apps/frontend/src/styles/main.css b/apps/frontend/src/styles/main.css index fc728f8c..bb223aba 100644 --- a/apps/frontend/src/styles/main.css +++ b/apps/frontend/src/styles/main.css @@ -3,12 +3,17 @@ * 按业务模块拆分,便于维护与多人协作开发: * 1. base.css - 全局主题变量、基础排版、重置、通用工具类 * 2. admin.css - 后台管理端 (Admin Portal & Login) - * 3. client.css - 买家前台提卡与聚合页 (Buyer Claim & Collect) - * 4. worker.css - 打手接单端 PC 与移动端 (Worker Portal & Mobile) + * 3. client.css - 买家提卡、补资料与兑换页样式入口 + * 4. customer/ - 客户领取页公共流程及平台差异 + * 5. worker.css - 打手接单端 PC 与移动端 (Worker Portal & Mobile) */ @import './base.css'; @import './admin.css'; @import './client.css'; +@import './customer/base.css'; +@import './customer/platform/huya.css'; +@import './customer/platform/weibo.css'; +@import './customer/platform/douyu.css'; @import './worker.css'; @import './table.css'; From 1bc4931508489db1e0ad526abbf5e4d214ee5ffb Mon Sep 17 00:00:00 2001 From: yml Date: Wed, 18 Nov 2026 10:57:11 +0800 Subject: [PATCH 17/17] =?UTF-8?q?fix(douyu):=20=E5=90=8C=E6=AD=A5=E5=B1=A5?= =?UTF-8?q?=E7=BA=A6=E7=8A=B6=E6=80=81=E5=B9=B6=E8=A1=A5=E9=BD=90=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E8=B5=84=E6=96=99=E9=87=8D=E7=BD=AE=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 接收 order_site 客户资料重置标记,清理旧角色并恢复待填写状态 - 统一绑定失败、待人工和已分配状态的投影与页面文案 - 新增 allocated 状态迁移,避免已分配账号被折叠为准备账号 - 立即同步时同时刷新直播履约状态,主动校正历史状态差异 - 补充状态优先级、资料重置和已分配状态测试 --- ...174_douyu_fulfillment_allocated_status.sql | 24 ++++++++++ .../src/routes/admin/douyu-fulfillment.ts | 4 +- .../douyu-fulfillment-service.ts | 37 +++++++++++++-- .../douyu-fulfillment.test.ts | 45 ++++++++++++++++++- .../pages/admin/AdminDouyuFulfillmentPage.tsx | 22 +++++++-- .../DouyuFulfillmentPage.tsx | 23 ++++++++-- .../src/services/admin/douyu-fulfillment.ts | 5 ++- apps/frontend/src/types/douyu-fulfillment.ts | 2 + 8 files changed, 149 insertions(+), 13 deletions(-) create mode 100644 apps/backend/src/db/migrations/174_douyu_fulfillment_allocated_status.sql diff --git a/apps/backend/src/db/migrations/174_douyu_fulfillment_allocated_status.sql b/apps/backend/src/db/migrations/174_douyu_fulfillment_allocated_status.sql new file mode 100644 index 00000000..917ffee6 --- /dev/null +++ b/apps/backend/src/db/migrations/174_douyu_fulfillment_allocated_status.sql @@ -0,0 +1,24 @@ +-- 174_douyu_fulfillment_allocated_status.sql +-- +-- 直播账号履约工作台的 allocated 是正式状态,order_site 需要原样投影, +-- 不能折叠成 preparing,否则两边状态不一致。 + +ALTER TABLE douyu_fulfillment_tasks + DROP CONSTRAINT IF EXISTS douyu_fulfillment_tasks_status_check; + +ALTER TABLE douyu_fulfillment_tasks + ADD CONSTRAINT douyu_fulfillment_tasks_status_check + CHECK (status IN ( + 'waiting_profile', + 'preparing', + 'allocated', + 'qr_pending', + 'role_ready', + 'bound', + 'waiting_operator', + 'processing', + 'completed', + 'failed', + 'manual_required', + 'cancelled' + )); diff --git a/apps/backend/src/routes/admin/douyu-fulfillment.ts b/apps/backend/src/routes/admin/douyu-fulfillment.ts index b180e093..8151a404 100644 --- a/apps/backend/src/routes/admin/douyu-fulfillment.ts +++ b/apps/backend/src/routes/admin/douyu-fulfillment.ts @@ -1,11 +1,11 @@ import { Router } from 'express' import { - ensureDouyuFulfillmentTasks, getDouyuFulfillmentDetail, listDouyuFulfillmentTasks, refreshDouyuCustomerBinding, startDouyuCustomerBinding, + syncDouyuFulfillmentTasks, } from '../../services/douyu-fulfillment/douyu-fulfillment-service.js' import { createJsonHandler, requireAdminRoles } from './session.js' @@ -24,7 +24,7 @@ router.get( router.post( '/douyu-fulfillment/sync', - createJsonHandler(() => ensureDouyuFulfillmentTasks(), { + createJsonHandler(() => syncDouyuFulfillmentTasks(), { successMessage: '斗鱼领取任务已同步', errorMessage: '同步斗鱼领取任务失败', scope: '[admin/douyu-fulfillment/sync]', diff --git a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts index 1566ac85..01d31bb0 100644 --- a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts +++ b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts @@ -66,6 +66,8 @@ type LiveBindingState = { platName: string bindReadyForConfirm: boolean bindConfirmed: boolean + customerProfileReset?: boolean + resetReason?: string completedAt: string | null updatedAt: string } @@ -321,14 +323,24 @@ export function compareCustomerRole(task: DouyuTaskRow, live: LiveBindingState) } } -function statusForLive(live: LiveBindingState): string { +const BINDING_FAILURE_ISSUES = new Set([ + 'binding_failed', + 'account_role_cooldown', + 'customer_role_cooldown', +]) + +export function statusForLive(live: LiveBindingState): string { + if (live.customerProfileReset === true) return 'waiting_profile' if (live.executionStatus === 'completed') return 'completed' if (live.executionStatus === 'cancelled') return 'cancelled' + if (live.bindingStatus === 'failed' || BINDING_FAILURE_ISSUES.has(live.issueCode)) { + return 'failed' + } + if (live.executionStatus === 'manual_required') return 'manual_required' + if (live.executionStatus === 'allocated') return 'allocated' if (live.bindConfirmed) return 'waiting_operator' if (live.bindReadyForConfirm) return 'role_ready' if (live.qrUrl) return 'qr_pending' - if (live.executionStatus === 'manual_required') return 'manual_required' - if (live.issueCode === 'binding_failed') return 'failed' if ( live.issueCode === 'mapping_missing' || live.issueCode === 'no_eligible_account' || @@ -348,6 +360,7 @@ async function updateTaskFromLiveState( live: LiveBindingState, now: string, ) { + const resetCustomerProfile = live.customerProfileReset === true const nextStatus = statusForLive(live) await client.query( ` @@ -363,17 +376,23 @@ async function updateTaskFromLiveState( bound_area_name = $10, bound_plat_name = $11, binding_started_at = CASE + WHEN $19 THEN NULL WHEN $12 <> '' THEN COALESCE(binding_started_at, NOW()) ELSE binding_started_at END, bound_at = CASE + WHEN $19 THEN NULL WHEN $13 THEN COALESCE(bound_at, NOW()) ELSE bound_at END, completed_at = CASE + WHEN $19 THEN NULL WHEN $14 THEN COALESCE(completed_at, NOW()) ELSE completed_at END, + customer_role_name = CASE WHEN $19 THEN '' ELSE customer_role_name END, + customer_platform = CASE WHEN $19 THEN '' ELSE customer_platform END, + customer_system = CASE WHEN $19 THEN '' ELSE customer_system END, qr_url = $15, qr_generated_at = NULLIF($16, '')::timestamptz, qr_expires_at = NULLIF($17, '')::timestamptz, @@ -400,6 +419,7 @@ async function updateTaskFromLiveState( live.qrGeneratedAt, live.qrExpiresAt, now, + resetCustomerProfile, ], ) if (nextStatus !== task.status) { @@ -409,6 +429,11 @@ async function updateTaskFromLiveState( bindPhase: live.bindPhase, }) } + if (resetCustomerProfile) { + await appendEvent(client, task.id, 'customer_profile_reset', 'integration', { + reason: String(live.resetReason || ''), + }) + } } async function applyLiveState(task: DouyuTaskRow, live: LiveBindingState) { @@ -760,6 +785,12 @@ export async function reconcileDouyuFulfillmentStates() { return { checked: rows.rows.length } } +export async function syncDouyuFulfillmentTasks() { + const synced = await ensureDouyuFulfillmentTasks() + const states = await reconcileDouyuFulfillmentStates() + return { ...synced, checked: states.checked } +} + export async function listDouyuFulfillmentTasks( input: { keyword?: unknown diff --git a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts index 77921153..03f2eecd 100644 --- a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts +++ b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts @@ -1,7 +1,11 @@ import assert from 'node:assert/strict' import test from 'node:test' -import { applyLiveBindingStateSnapshot, compareCustomerRole } from './douyu-fulfillment-service.js' +import { + applyLiveBindingStateSnapshot, + compareCustomerRole, + statusForLive, +} from './douyu-fulfillment-service.js' const task = { customer_role_name: '狗鼻子弗尼亚bd', @@ -38,6 +42,45 @@ test('斗鱼客户资料角色名不一致时禁止确认', () => { assert.equal(result.roleMatched, false) }) +test('绑定失败优先于旧角色确认标记', () => { + const status = statusForLive({ + executionStatus: 'manual_required', + bindingStatus: 'failed', + issueCode: 'customer_role_cooldown', + bindReadyForConfirm: true, + bindConfirmed: false, + qrUrl: 'https://example.com/old-qr', + accountReady: true, + } as never) + assert.equal(status, 'failed') +}) + +test('绑定失败代码优先于旧待确认状态', () => { + const status = statusForLive({ + executionStatus: 'role_ready', + bindingStatus: 'role_ready', + issueCode: 'binding_failed', + bindReadyForConfirm: true, + bindConfirmed: false, + qrUrl: '', + accountReady: true, + } as never) + assert.equal(status, 'failed') +}) + +test('已分配账号保持 allocated,不折叠成准备账号', () => { + const status = statusForLive({ + executionStatus: 'allocated', + bindingStatus: 'not_started', + issueCode: '', + bindReadyForConfirm: false, + bindConfirmed: false, + qrUrl: '', + accountReady: true, + } as never) + assert.equal(status, 'allocated') +}) + test('直播账号状态推送忽略空数据和无效任务', async () => { assert.deepEqual(await applyLiveBindingStateSnapshot({ items: [] }), { received: 0, diff --git a/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx b/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx index 2c3ee15a..da9b4496 100644 --- a/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/admin/AdminDouyuFulfillmentPage.tsx @@ -40,13 +40,14 @@ const { Text } = Typography const STATUS_LABELS: Record = { waiting_profile: '待客户填资料', preparing: '准备账号', + allocated: '已分配', qr_pending: '待扫码', role_ready: '待确认角色', bound: '角色已绑定', waiting_operator: '待客服处理', processing: '处理中', completed: '已完成', - failed: '失败', + failed: '绑定失败', manual_required: '人工处理', cancelled: '已取消', } @@ -54,6 +55,7 @@ const STATUS_LABELS: Record = { const STATUS_COLORS: Record = { waiting_profile: 'blue', preparing: 'gold', + allocated: 'geekblue', qr_pending: 'cyan', role_ready: 'orange', bound: 'green', @@ -75,6 +77,14 @@ const SYSTEM_LABELS: Record = { android: '安卓', } +const EVENT_LABELS: Record = { + task_created: '订单进入斗鱼领取队列', + customer_link_opened: '客户打开领取链接', + customer_profile_saved: '客户保存游戏资料', + customer_profile_reset: '客服重置客户角色资料', + status_changed: '领取状态更新', +} + export default function AdminDouyuFulfillmentPage() { const { message } = App.useApp() const queryClient = useQueryClient() @@ -118,7 +128,9 @@ export default function AdminDouyuFulfillmentPage() { const syncMutation = useMutation({ mutationFn: syncAdminDouyuFulfillmentTasks, onSuccess: async (response) => { - message.success(`同步完成:新增 ${response.data.created},更新 ${response.data.updated}`) + message.success( + `同步完成:新增 ${response.data.created},更新 ${response.data.updated},核验状态 ${response.data.checked}`, + ) await refreshAll() }, onError: (error) => message.error(error instanceof Error ? error.message : '同步失败'), @@ -371,7 +383,11 @@ export default function AdminDouyuFulfillmentPage() { color: event.event_type.includes('failed') ? 'red' : 'blue', children: ( - {event.event_type} + {EVENT_LABELS[event.event_type] || event.event_type} + {event.event_type === 'customer_profile_reset' && + event.detail_json.reason ? ( + {String(event.detail_json.reason)} + ) : null} {formatAdminDateTime(event.created_at)} · {event.actor_type} diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index c6b32370..1642a148 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -34,13 +34,14 @@ const BINDING_FAILURE_ISSUES = new Set([ const STATUS_LABELS: Record = { waiting_profile: '等待填写资料', preparing: '正在准备账号', + allocated: '账号已分配', qr_pending: '等待扫码绑定', role_ready: '请确认游戏角色', bound: '角色已绑定', waiting_operator: '待客服处理', processing: '正在兑换', completed: '领取完成', - failed: '处理失败', + failed: '角色绑定失败', manual_required: '等待人工处理', cancelled: '订单已取消', } @@ -79,10 +80,20 @@ export default function DouyuFulfillmentPage() { const [bindingQrExpanded, setBindingQrExpanded] = useState(false) const [nowMs, setNowMs] = useState(() => Date.now()) const autoStartRef = useRef('') + const customerRoleRef = useRef('') const applyData = useCallback((next: DouyuCustomerFulfillment) => { + const previousRole = customerRoleRef.current + const nextRole = next.task.customer_role_name || '' + customerRoleRef.current = nextRole setData(next) - setRoleName((current) => current || next.task.customer_role_name || '') + if (previousRole && !nextRole) { + setRoleName('') + setPlatform('wechat') + setSystem('android') + } else { + setRoleName((current) => current || nextRole) + } if (next.task.customer_platform === 'qq' || next.task.customer_platform === 'wechat') { setPlatform(next.task.customer_platform) } @@ -167,7 +178,13 @@ export default function DouyuFulfillmentPage() { useEffect(() => { if (!task || !live || needsProfile || live.qrUrl || live.bindConfirmed) return if (!live.accountReady) return - if (task.status !== 'preparing' && task.status !== 'waiting_profile') return + if ( + task.status !== 'preparing' && + task.status !== 'allocated' && + task.status !== 'waiting_profile' + ) { + return + } if (autoStartRef.current === orderNo) return autoStartRef.current = orderNo let cancelled = false diff --git a/apps/frontend/src/services/admin/douyu-fulfillment.ts b/apps/frontend/src/services/admin/douyu-fulfillment.ts index 6dea0456..48ceb1dc 100644 --- a/apps/frontend/src/services/admin/douyu-fulfillment.ts +++ b/apps/frontend/src/services/admin/douyu-fulfillment.ts @@ -14,7 +14,10 @@ export function fetchAdminDouyuFulfillmentTasks(params: { } export function syncAdminDouyuFulfillmentTasks() { - return apiPost<{ created: number; updated: number }>('/api/v1/admin/douyu-fulfillment/sync', {}) + return apiPost<{ created: number; updated: number; checked: number }>( + '/api/v1/admin/douyu-fulfillment/sync', + {}, + ) } export function fetchAdminDouyuFulfillmentDetail(orderNo: string) { diff --git a/apps/frontend/src/types/douyu-fulfillment.ts b/apps/frontend/src/types/douyu-fulfillment.ts index 282d4399..68c38552 100644 --- a/apps/frontend/src/types/douyu-fulfillment.ts +++ b/apps/frontend/src/types/douyu-fulfillment.ts @@ -58,6 +58,8 @@ export type DouyuLiveBindingState = { platName: string bindReadyForConfirm: boolean bindConfirmed: boolean + customerProfileReset?: boolean + resetReason?: string completedAt: string | null updatedAt: string }