修复对公转账
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
# App
|
# App
|
||||||
APP_NAME=VideoGen API
|
APP_NAME=VideoGen API
|
||||||
APP_VERSION=1.0.0
|
APP_VERSION=1.0.0
|
||||||
DEBUG=true
|
DEBUG=false
|
||||||
SECRET_KEY=local-dev-secret-key-not-for-production
|
SECRET_KEY=local-dev-secret-key-not-for-production
|
||||||
|
|
||||||
# Database (PostgreSQL)
|
# Database (PostgreSQL)
|
||||||
|
|||||||
@@ -148,9 +148,10 @@ async def run_task(
|
|||||||
if task is None:
|
if task is None:
|
||||||
raise HTTPException(status_code=404, detail="任务不存在")
|
raise HTTPException(status_code=404, detail="任务不存在")
|
||||||
|
|
||||||
|
from app.tasks.celery_app import RECOVERY_QUEUE
|
||||||
from app.tasks.scheduled_tasks import execute_scheduled_task
|
from app.tasks.scheduled_tasks import execute_scheduled_task
|
||||||
|
|
||||||
execute_scheduled_task.apply_async(args=[task_id])
|
execute_scheduled_task.apply_async(args=[task_id], queue=RECOVERY_QUEUE)
|
||||||
return {"message": "任务已提交执行"}
|
return {"message": "任务已提交执行"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ logger = logging.getLogger("video_gen")
|
|||||||
_PAGE_SIZE = 100
|
_PAGE_SIZE = 100
|
||||||
|
|
||||||
|
|
||||||
def sync_bank_transactions(
|
async def sync_bank_transactions(
|
||||||
url: str = "",
|
url: str = "",
|
||||||
api_key: str = "",
|
api_key: str = "",
|
||||||
acct_no: str = "",
|
acct_no: str = "",
|
||||||
@@ -85,24 +85,16 @@ def sync_bank_transactions(
|
|||||||
"errors": [],
|
"errors": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
import asyncio
|
await _do_sync(
|
||||||
loop = asyncio.new_event_loop()
|
url=url,
|
||||||
asyncio.set_event_loop(loop)
|
api_key=api_key,
|
||||||
try:
|
acct_no=acct_no,
|
||||||
loop.run_until_complete(
|
start_date=start_date,
|
||||||
_do_sync(
|
end_date=end_date,
|
||||||
url=url,
|
dc_flag=dc_flag,
|
||||||
api_key=api_key,
|
sync_batch=sync_batch,
|
||||||
acct_no=acct_no,
|
stats=stats,
|
||||||
start_date=start_date,
|
)
|
||||||
end_date=end_date,
|
|
||||||
dc_flag=dc_flag,
|
|
||||||
sync_batch=sync_batch,
|
|
||||||
stats=stats,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
finally:
|
|
||||||
loop.close()
|
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"银行流水同步完成: batch=%s, acct=%s, 翻页=%d, 获取=%d, 新增=%d, 重复=%d",
|
"银行流水同步完成: batch=%s, acct=%s, 翻页=%d, 获取=%d, 新增=%d, 重复=%d",
|
||||||
|
|||||||
@@ -31,28 +31,28 @@ from app.tasks.celery_app import celery_app
|
|||||||
logger = logging.getLogger("video_gen")
|
logger = logging.getLogger("video_gen")
|
||||||
|
|
||||||
|
|
||||||
def _update_task_status(task_id: str, status: str, error_msg: str | None = None) -> None:
|
async def _update_task_status(task_id: str, status: str, error_msg: str | None = None) -> None:
|
||||||
"""更新任务最后执行状态。"""
|
"""更新任务最后执行状态。"""
|
||||||
|
async with async_session() as db:
|
||||||
async def _do():
|
result = await db.execute(select(ScheduledTask).where(ScheduledTask.id == task_id))
|
||||||
async with async_session() as db:
|
task = result.scalar_one_or_none()
|
||||||
result = await db.execute(select(ScheduledTask).where(ScheduledTask.id == task_id))
|
if task is None:
|
||||||
task = result.scalar_one_or_none()
|
return
|
||||||
if task is None:
|
task.last_run_at = datetime.now(timezone.utc).isoformat()
|
||||||
return
|
task.last_status = status
|
||||||
task.last_run_at = datetime.now(timezone.utc).isoformat()
|
task.last_error = error_msg
|
||||||
task.last_status = status
|
await db.commit()
|
||||||
task.last_error = error_msg
|
|
||||||
await db.commit()
|
|
||||||
|
|
||||||
run_async(_do())
|
|
||||||
|
|
||||||
|
|
||||||
def _execute_internal_method(config: str | None) -> dict:
|
async def _execute_internal_method(config: str | None) -> dict:
|
||||||
"""执行内部方法调用。
|
"""执行内部方法调用。
|
||||||
|
|
||||||
配置 JSON 中 module 和 function 指定要调用的函数,其余字段作为 kwargs 传入。
|
配置 JSON 中 module 和 function 指定要调用的函数,其余字段作为 kwargs 传入。
|
||||||
|
支持同步函数和异步函数(async def)。
|
||||||
"""
|
"""
|
||||||
|
import importlib
|
||||||
|
from inspect import iscoroutinefunction
|
||||||
|
|
||||||
cfg = json.loads(config or "{}")
|
cfg = json.loads(config or "{}")
|
||||||
module_path = cfg.pop("module", "").strip()
|
module_path = cfg.pop("module", "").strip()
|
||||||
function_name = cfg.pop("function", "").strip()
|
function_name = cfg.pop("function", "").strip()
|
||||||
@@ -60,8 +60,6 @@ def _execute_internal_method(config: str | None) -> dict:
|
|||||||
if not module_path or not function_name:
|
if not module_path or not function_name:
|
||||||
raise ValueError("内部方法需要指定 module 和 function")
|
raise ValueError("内部方法需要指定 module 和 function")
|
||||||
|
|
||||||
import importlib
|
|
||||||
|
|
||||||
module = importlib.import_module(module_path)
|
module = importlib.import_module(module_path)
|
||||||
func = getattr(module, function_name, None)
|
func = getattr(module, function_name, None)
|
||||||
if func is None or not callable(func):
|
if func is None or not callable(func):
|
||||||
@@ -69,7 +67,11 @@ def _execute_internal_method(config: str | None) -> dict:
|
|||||||
|
|
||||||
# 剩余字段作为 kwargs 传给函数
|
# 剩余字段作为 kwargs 传给函数
|
||||||
start = time.monotonic()
|
start = time.monotonic()
|
||||||
result = func(**cfg)
|
if iscoroutinefunction(func):
|
||||||
|
# 异步函数:直接 await
|
||||||
|
result = await func(**cfg)
|
||||||
|
else:
|
||||||
|
result = func(**cfg)
|
||||||
duration_ms = int((time.monotonic() - start) * 1000)
|
duration_ms = int((time.monotonic() - start) * 1000)
|
||||||
return {
|
return {
|
||||||
"duration_ms": duration_ms,
|
"duration_ms": duration_ms,
|
||||||
@@ -91,16 +93,15 @@ def execute_scheduled_task(self, task_id: str):
|
|||||||
if not task.is_active:
|
if not task.is_active:
|
||||||
logger.info("定时任务已禁用,跳过执行: %s", task_id)
|
logger.info("定时任务已禁用,跳过执行: %s", task_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
task_config = task.config
|
task_config = task.config
|
||||||
|
|
||||||
try:
|
try:
|
||||||
exec_result = _execute_internal_method(task_config)
|
exec_result = await _execute_internal_method(task_config)
|
||||||
_update_task_status(task_id, "success")
|
await _update_task_status(task_id, "success")
|
||||||
logger.info("定时任务执行成功: %s -> %s", task_id, exec_result)
|
logger.info("定时任务执行成功: %s -> %s", task_id, exec_result)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = str(e)
|
error_msg = str(e)
|
||||||
_update_task_status(task_id, "error", error_msg)
|
await _update_task_status(task_id, "error", error_msg)
|
||||||
logger.exception("定时任务执行失败: %s", task_id)
|
logger.exception("定时任务执行失败: %s", task_id)
|
||||||
|
|
||||||
run_async(_run())
|
run_async(_run())
|
||||||
|
|||||||
+100
-100
File diff suppressed because one or more lines are too long
Vendored
+35
-35
@@ -1,36 +1,36 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==" id="favicon" />
|
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==" id="favicon" />
|
||||||
<script>
|
<script>
|
||||||
// 立即从 localStorage 设置 favicon,避免闪烁
|
// 立即从 localStorage 设置 favicon,避免闪烁
|
||||||
(function() {
|
(function() {
|
||||||
try {
|
try {
|
||||||
var cached = localStorage.getItem('siteInfo');
|
var cached = localStorage.getItem('siteInfo');
|
||||||
if (cached) {
|
if (cached) {
|
||||||
var info = JSON.parse(cached);
|
var info = JSON.parse(cached);
|
||||||
if (info.siteLogo) {
|
if (info.siteLogo) {
|
||||||
var link = document.getElementById('favicon');
|
var link = document.getElementById('favicon');
|
||||||
link.href = info.siteLogo;
|
link.href = info.siteLogo;
|
||||||
link.type = 'image/png';
|
link.type = 'image/png';
|
||||||
}
|
}
|
||||||
if (info.siteName) {
|
if (info.siteName) {
|
||||||
document.title = info.siteName;
|
document.title = info.siteName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
|
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
|
||||||
<title>民众智创</title>
|
<title>民众智创</title>
|
||||||
<script type="module" crossorigin src="/assets/index-BMPNcnJK.js"></script>
|
<script type="module" crossorigin src="/assets/index-JDcJqWtB.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DSYnuUvx.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DSYnuUvx.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>␍
|
<div id="root"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -574,6 +574,20 @@ export async function setDefaultInvoiceHeader(id: string): Promise<any> {
|
|||||||
return api.put(`/invoice-headers/${id}/set-default`);
|
return api.put(`/invoice-headers/${id}/set-default`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Bank Accounts ──────────────────────────────────────────
|
||||||
|
|
||||||
|
export interface BankAccountInfo {
|
||||||
|
id: string;
|
||||||
|
accountName: string;
|
||||||
|
bankName: string;
|
||||||
|
accountNo: string;
|
||||||
|
description: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getDefaultBankAccount(): Promise<{ hasAccount: boolean; account: BankAccountInfo | null }> {
|
||||||
|
return api.get('/bank/default-account');
|
||||||
|
}
|
||||||
|
|
||||||
export async function getCreditRatios(): Promise<any[]> {
|
export async function getCreditRatios(): Promise<any[]> {
|
||||||
return api.get('/credits/ratios');
|
return api.get('/credits/ratios');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import {
|
|||||||
CrownFilled,
|
CrownFilled,
|
||||||
FireOutlined,
|
FireOutlined,
|
||||||
BankFilled,
|
BankFilled,
|
||||||
|
BankOutlined,
|
||||||
CheckCircleFilled,
|
CheckCircleFilled,
|
||||||
WechatOutlined,
|
WechatOutlined,
|
||||||
AlipayCircleOutlined,
|
AlipayCircleOutlined,
|
||||||
@@ -60,7 +61,7 @@ import {
|
|||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { Outlet, useNavigate, useLocation } from 'react-router-dom';
|
import { Outlet, useNavigate, useLocation } from 'react-router-dom';
|
||||||
import { useAuthStore } from '../../store/useAuthStore';
|
import { useAuthStore } from '../../store/useAuthStore';
|
||||||
import { getMenuConfigs, getCreditProductCatalog, getPaymentMethods, createRechargeOrder, getPaymentOrder, cancelPaymentOrder, getSiteInfo, getUnreadCount, createContactRequest, getUser, changePassword, changeUsername } from '../../api';
|
import { getMenuConfigs, getCreditProductCatalog, getPaymentMethods, createRechargeOrder, getPaymentOrder, cancelPaymentOrder, getSiteInfo, getUnreadCount, createContactRequest, getUser, changePassword, changeUsername, getDefaultBankAccount } from '../../api';
|
||||||
import type { CreditProduct, CreditProductCatalog } from '../../types';
|
import type { CreditProduct, CreditProductCatalog } from '../../types';
|
||||||
import NotificationPopup from '../NotificationPopup';
|
import NotificationPopup from '../NotificationPopup';
|
||||||
import ActivityBanner from './ActivityBanner';
|
import ActivityBanner from './ActivityBanner';
|
||||||
@@ -495,6 +496,24 @@ const AppLayout: React.FC = () => {
|
|||||||
const [pendingProduct, setPendingProduct] = useState<{ id: string; product: CreditProduct; } | null>(null);
|
const [pendingProduct, setPendingProduct] = useState<{ id: string; product: CreditProduct; } | null>(null);
|
||||||
const [purchaseQuantity, setPurchaseQuantity] = useState(1);
|
const [purchaseQuantity, setPurchaseQuantity] = useState(1);
|
||||||
const [qrRevealed, setQrRevealed] = useState(false);
|
const [qrRevealed, setQrRevealed] = useState(false);
|
||||||
|
const [paymentTab, setPaymentTab] = useState<'alipay' | 'corporate'>('alipay');
|
||||||
|
const [corporateTransferForm] = Form.useForm();
|
||||||
|
const [corporateSubmitting, setCorporateSubmitting] = useState(false);
|
||||||
|
const [bankAccountInfo, setBankAccountInfo] = useState<{ hasAccount: boolean; account: any } | null>(null);
|
||||||
|
const [bankAccountLoading, setBankAccountLoading] = useState(false);
|
||||||
|
|
||||||
|
const fetchBankAccount = useCallback(async () => {
|
||||||
|
if (bankAccountInfo || bankAccountLoading) return;
|
||||||
|
setBankAccountLoading(true);
|
||||||
|
try {
|
||||||
|
const data = await getDefaultBankAccount();
|
||||||
|
setBankAccountInfo(data);
|
||||||
|
} catch {
|
||||||
|
setBankAccountInfo({ hasAccount: false, account: null });
|
||||||
|
} finally {
|
||||||
|
setBankAccountLoading(false);
|
||||||
|
}
|
||||||
|
}, [bankAccountInfo, bankAccountLoading]);
|
||||||
|
|
||||||
const PENDING_ORDER_KEY = 'pending_payment_order';
|
const PENDING_ORDER_KEY = 'pending_payment_order';
|
||||||
const [unreadCount, setUnreadCount] = useState(0);
|
const [unreadCount, setUnreadCount] = useState(0);
|
||||||
@@ -886,6 +905,8 @@ const AppLayout: React.FC = () => {
|
|||||||
setPendingProduct({ id: productId, product });
|
setPendingProduct({ id: productId, product });
|
||||||
setPurchaseQuantity(product.productType === 'team_subscription' ? 2 : 1);
|
setPurchaseQuantity(product.productType === 'team_subscription' ? 2 : 1);
|
||||||
setQrRevealed(false);
|
setQrRevealed(false);
|
||||||
|
setPaymentTab('alipay');
|
||||||
|
corporateTransferForm.resetFields();
|
||||||
setCurrentPaymentInfo(null);
|
setCurrentPaymentInfo(null);
|
||||||
setCreditsModalOpen(false);
|
setCreditsModalOpen(false);
|
||||||
setQrCodeModalOpen(true);
|
setQrCodeModalOpen(true);
|
||||||
@@ -944,6 +965,50 @@ const AppLayout: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}, [pendingProduct, paymentMethod, purchaseQuantity]);
|
}, [pendingProduct, paymentMethod, purchaseQuantity]);
|
||||||
|
|
||||||
|
const submitCorporateTransfer = useCallback(async () => {
|
||||||
|
if (!pendingProduct) return;
|
||||||
|
try {
|
||||||
|
const values: any = await corporateTransferForm.validateFields();
|
||||||
|
setCorporateSubmitting(true);
|
||||||
|
const { id: productId, product } = pendingProduct;
|
||||||
|
const order = await createRechargeOrder(productId, 'corporate');
|
||||||
|
const finalPrice = Number(order.amount ?? product.currentPrice ?? product.price ?? 0);
|
||||||
|
const credits = Number(product.grantCredits || product.monthlyGrantCredits || 0);
|
||||||
|
const originalPrice = product.regularPrice;
|
||||||
|
const cycleMap: Record<string, string> = { monthly: '月套餐', quarterly: '季套餐', yearly: '年套餐' };
|
||||||
|
const isSubscription = !!product.billingCycle;
|
||||||
|
const periodLabel = product.billingCycle ? cycleMap[product.billingCycle] : '';
|
||||||
|
const tierName = product.name || '积分充值';
|
||||||
|
const displayTitle = isSubscription ? `${tierName} ${periodLabel}` : tierName;
|
||||||
|
const paymentInfo = {
|
||||||
|
price: finalPrice,
|
||||||
|
credits,
|
||||||
|
qrCode: '',
|
||||||
|
method: 'corporate',
|
||||||
|
title: displayTitle,
|
||||||
|
originalPrice: originalPrice ? Number(originalPrice) : undefined,
|
||||||
|
tierName,
|
||||||
|
periodLabel,
|
||||||
|
isSubscription,
|
||||||
|
};
|
||||||
|
void values;
|
||||||
|
setCurrentPaymentInfo(paymentInfo);
|
||||||
|
message.success('已提交对公转账信息,客服将在1-3个工作日内审核到账');
|
||||||
|
setQrCodeModalOpen(false);
|
||||||
|
setPendingProduct(null);
|
||||||
|
corporateTransferForm.resetFields();
|
||||||
|
await useAuthStore.getState().refreshUser();
|
||||||
|
await loadCreditCatalog();
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err?.errorFields) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
message.error(err?.message || '提交失败,请重试');
|
||||||
|
} finally {
|
||||||
|
setCorporateSubmitting(false);
|
||||||
|
}
|
||||||
|
}, [pendingProduct, corporateTransferForm]);
|
||||||
|
|
||||||
const startPolling = useCallback((orderNo: string, timeoutSeconds: number = 180) => {
|
const startPolling = useCallback((orderNo: string, timeoutSeconds: number = 180) => {
|
||||||
stopPolling();
|
stopPolling();
|
||||||
setCountdown(timeoutSeconds);
|
setCountdown(timeoutSeconds);
|
||||||
@@ -1921,9 +1986,11 @@ const AppLayout: React.FC = () => {
|
|||||||
setCurrentPaymentInfo(null);
|
setCurrentPaymentInfo(null);
|
||||||
setPendingProduct(null);
|
setPendingProduct(null);
|
||||||
setQrRevealed(false);
|
setQrRevealed(false);
|
||||||
|
setPaymentTab('alipay');
|
||||||
|
corporateTransferForm.resetFields();
|
||||||
}}
|
}}
|
||||||
footer={null}
|
footer={null}
|
||||||
width={760}
|
width={'50%'}
|
||||||
closable
|
closable
|
||||||
title={
|
title={
|
||||||
<Typography.Title level={5} style={{ margin: 0 }}>
|
<Typography.Title level={5} style={{ margin: 0 }}>
|
||||||
@@ -1998,31 +2065,150 @@ const AppLayout: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 右侧:在线支付方式。后台线下成交不在客户端创建。 */}
|
{/* 右侧:支付方式 */}
|
||||||
<div style={{ width: 300, padding: 20, background: '#fff', display: 'flex', flexDirection: 'column' }}>
|
<div style={{ width: '50%', padding: 20, background: '#fff', display: 'flex', flexDirection: 'column' }}>
|
||||||
<Typography.Text strong style={{ marginBottom: 12 }}>选择支付方式</Typography.Text>
|
{/* Tab 切换 */}
|
||||||
<div style={{ display: 'flex', gap: 8, marginBottom: 18 }}>
|
<div style={{ display: 'flex', background: '#f3f4f6', borderRadius: 10, padding: 4, marginBottom: 20 }}>
|
||||||
{enabledMethods.alipay && <Button type={paymentMethod === 'alipay' ? 'primary' : 'default'} onClick={() => { if (!qrRevealed) setPaymentMethod('alipay'); }} icon={<AlipayCircleOutlined />}>支付宝</Button>}
|
<div
|
||||||
{enabledMethods.wechat && <Button type={paymentMethod === 'wechat' ? 'primary' : 'default'} onClick={() => { if (!qrRevealed) setPaymentMethod('wechat'); }} icon={<WechatOutlined />}>微信支付</Button>}
|
onClick={() => setPaymentTab('alipay')}
|
||||||
|
style={{
|
||||||
|
flex: 1, textAlign: 'center', padding: '8px 0', borderRadius: 8,
|
||||||
|
cursor: 'pointer', fontSize: 14, fontWeight: 600,
|
||||||
|
background: paymentTab === 'alipay' ? '#fff' : 'transparent',
|
||||||
|
color: paymentTab === 'alipay' ? '#1677ff' : '#64748b',
|
||||||
|
boxShadow: paymentTab === 'alipay' ? '0 2px 8px rgba(0,0,0,0.08)' : 'none',
|
||||||
|
transition: 'all 0.2s',
|
||||||
|
display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<AlipayCircleOutlined style={{ color: paymentTab === 'alipay' ? '#1677ff' : '#94a3b8' }} />
|
||||||
|
支付宝支付
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
onClick={() => { setPaymentTab('corporate'); fetchBankAccount(); }}
|
||||||
|
style={{
|
||||||
|
flex: 1, textAlign: 'center', padding: '8px 0', borderRadius: 8,
|
||||||
|
cursor: 'pointer', fontSize: 14, fontWeight: 600,
|
||||||
|
background: paymentTab === 'corporate' ? '#fff' : 'transparent',
|
||||||
|
color: paymentTab === 'corporate' ? '#6366f1' : '#64748b',
|
||||||
|
boxShadow: paymentTab === 'corporate' ? '0 2px 8px rgba(0,0,0,0.08)' : 'none',
|
||||||
|
transition: 'all 0.2s',
|
||||||
|
display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<BankOutlined style={{ color: paymentTab === 'corporate' ? '#6366f1' : '#94a3b8' }} />
|
||||||
|
对公转账
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
||||||
<div style={{ marginBottom: 12, color: '#64748b' }}>{paymentMethod === 'wechat' ? '请用微信扫码支付' : '请用支付宝扫码支付'}</div>
|
{/* 支付宝 Tab */}
|
||||||
<div style={{ position: 'relative', width: 180, height: 180, borderRadius: 12, border: '1px solid #f0f0f0', display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#fff' }}>
|
{paymentTab === 'alipay' && (
|
||||||
{qrRevealed && currentPaymentInfo?.qrCode ? <QRCodeSVG value={currentPaymentInfo.qrCode} size={150} level="M" /> : (
|
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 12 }}>
|
||||||
<div style={{ fontSize: 13, color: '#64748b', marginBottom: 12 }}>确认商品和金额后生成二维码</div>
|
<AlipayCircleOutlined style={{ fontSize: 18, color: '#1677ff' }} />
|
||||||
<Button type="primary" loading={paying} onClick={confirmPayment}>确认支付</Button>
|
<span style={{ fontSize: 14, color: '#64748b' }}>请用支付宝扫码支付</span>
|
||||||
|
</div>
|
||||||
|
<div style={{ position: 'relative', width: 180, height: 180, borderRadius: 12, border: '1px solid #f0f0f0', display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#fff' }}>
|
||||||
|
{qrRevealed && currentPaymentInfo?.qrCode ? (
|
||||||
|
<QRCodeSVG value={currentPaymentInfo.qrCode} size={150} level="M" />
|
||||||
|
) : (
|
||||||
|
<div style={{ textAlign: 'center' }}>
|
||||||
|
<div style={{ fontSize: 13, color: '#64748b', marginBottom: 12 }}>确认商品和金额后<br/>生成二维码</div>
|
||||||
|
<Button type="primary" loading={paying} onClick={confirmPayment} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>
|
||||||
|
确认使用支付宝支付
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{qrRevealed && (
|
||||||
|
<div style={{ marginTop: 12, fontSize: 12, color: '#94a3b8' }}>
|
||||||
|
{countdown} 秒后二维码失效
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{qrRevealed && (
|
||||||
|
<Button
|
||||||
|
danger
|
||||||
|
style={{ marginTop: 14, borderRadius: 8 }}
|
||||||
|
onClick={async () => {
|
||||||
|
stopPolling();
|
||||||
|
if (currentOrderNoRef.current) { try { await cancelPaymentOrder(currentOrderNoRef.current); } catch { } currentOrderNoRef.current = null; }
|
||||||
|
localStorage.removeItem(PENDING_ORDER_KEY); setQrCodeModalOpen(false); setCurrentPaymentInfo(null); setPendingProduct(null); setQrRevealed(false); message.info('已取消支付');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
取消转账
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<div style={{ marginTop: 8, fontSize: 11, color: '#94a3b8', textAlign: 'center' }}>
|
||||||
|
开通即代表同意<br/>《用户服务协议》
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{qrRevealed && <div style={{ marginTop: 12, fontSize: 12, color: '#94a3b8' }}>{countdown} 秒后二维码失效</div>}
|
)}
|
||||||
{qrRevealed && <Button danger style={{ marginTop: 14 }} onClick={async () => {
|
|
||||||
stopPolling();
|
{/* 对公转账 Tab */}
|
||||||
if (currentOrderNoRef.current) { try { await cancelPaymentOrder(currentOrderNoRef.current); } catch { } currentOrderNoRef.current = null; }
|
{paymentTab === 'corporate' && (
|
||||||
localStorage.removeItem(PENDING_ORDER_KEY); setQrCodeModalOpen(false); setCurrentPaymentInfo(null); setPendingProduct(null); setQrRevealed(false); message.info('已取消支付');
|
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', overflowY: 'auto' }}>
|
||||||
}}>取消支付</Button>}
|
{/* 收款账户信息 */}
|
||||||
</div>
|
<div style={{ marginBottom: 16 }}>
|
||||||
<div style={{ marginTop: 8, fontSize: 11, color: '#94a3b8', textAlign: 'center' }}>线上订单仅支持已启用的支付宝/微信支付;后台线下成交请联系客服处理。</div>
|
<Typography.Text style={{ fontSize: 12, color: '#64748b', marginBottom: 8, display: 'block', fontWeight: 600 }}>收款账户信息</Typography.Text>
|
||||||
|
<div style={{ padding: 12, background: '#f8fafc', borderRadius: 8, border: '1px solid #e2e8f0', minHeight: 80, display: 'flex', alignItems: 'center' }}>
|
||||||
|
{bankAccountLoading ? (
|
||||||
|
<div style={{ width: '100%', textAlign: 'center', color: '#94a3b8', fontSize: 12 }}>加载中...</div>
|
||||||
|
) : bankAccountInfo?.hasAccount && bankAccountInfo?.account ? (
|
||||||
|
<div style={{ width: '100%' }}>
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '4px 0', fontSize: 12, marginBottom: 4 }}>
|
||||||
|
<span style={{ color: '#64748b' }}>账户名称</span>
|
||||||
|
<span style={{ color: '#1a1a2e', fontWeight: 500 }}>{bankAccountInfo.account.accountName}</span>
|
||||||
|
</div>
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '4px 0', fontSize: 12, marginBottom: 4 }}>
|
||||||
|
<span style={{ color: '#64748b' }}>开户银行</span>
|
||||||
|
<span style={{ color: '#1a1a2e', fontWeight: 500, display: 'flex', alignItems: 'center', gap: 4 }}>
|
||||||
|
{/* <BankFilled style={{ color: '#c8161d', fontSize: 14 }} /> */}
|
||||||
|
{bankAccountInfo.account.bankName}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '4px 0', fontSize: 12 }}>
|
||||||
|
<span style={{ color: '#64748b' }}>账号</span>
|
||||||
|
<span style={{ color: '#1a1a2e', fontWeight: 500, fontFamily: 'monospace' }}>{bankAccountInfo.account.accountNo}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div style={{ width: '100%', textAlign: 'center', color: '#94a3b8', fontSize: 12 }}>暂无收款账户信息</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 打款信息填写 */}
|
||||||
|
<div style={{ marginBottom: 12 }}>
|
||||||
|
<Typography.Text style={{ fontSize: 12, color: '#64748b', marginBottom: 4, display: 'block', fontWeight: 600 }}>填写您的打款信息</Typography.Text>
|
||||||
|
<Typography.Text style={{ fontSize: 11, color: '#ef4444', marginBottom: 8, display: 'block' }}>注:打款金额需与所标注金额一致,不然无法开通,银行信息需正确填写</Typography.Text>
|
||||||
|
<Form form={corporateTransferForm} layout="vertical" size="small" requiredMark={false}>
|
||||||
|
<Form.Item name="accountName" label="账户名称" rules={[{ required: true, message: '请输入账户名称' }]} style={{ marginBottom: 10 }}>
|
||||||
|
<Input placeholder="请输入付款方账户名称" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="bankName" label="开户银行" rules={[{ required: true, message: '请输入开户银行' }]} style={{ marginBottom: 10 }}>
|
||||||
|
<Input placeholder="请输入开户银行" prefix={<BankOutlined style={{ color: '#94a3b8' }} />} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="bankAccount" label="账号" rules={[{ required: true, message: '请输入账号' }]} style={{ marginBottom: 8 }}>
|
||||||
|
<Input placeholder="请输入付款方账号" />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
block
|
||||||
|
size="large"
|
||||||
|
loading={corporateSubmitting}
|
||||||
|
onClick={submitCorporateTransfer}
|
||||||
|
style={{ borderRadius: 8, background: 'linear-gradient(135deg, #6366f1, #8b5cf6)', border: 'none', fontWeight: 600, height: 38, fontSize: 14 }}
|
||||||
|
>
|
||||||
|
提交对公转账
|
||||||
|
</Button>
|
||||||
|
<div style={{ marginTop: 8, fontSize: 11, color: '#94a3b8', textAlign: 'center' }}>
|
||||||
|
提交后客服将在 12 个小时日内审核到账,如遇问题,请联系客服。
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -964,13 +964,15 @@ const GenerateConver: React.FC = () => {
|
|||||||
|
|
||||||
{/* 上传视频 */}
|
{/* 上传视频 */}
|
||||||
<div style={{ marginBottom: 16 }}>
|
<div style={{ marginBottom: 16 }}>
|
||||||
<p style={{ margin: 0, fontSize: 14, fontWeight: 600, color: '#1e293b', marginBottom: 10 }}>
|
<div style={{ marginBottom: 10 }}>
|
||||||
上传复刻视频
|
<p style={{ margin: 0, fontSize: 14, fontWeight: 600, color: '#1e293b' }}>
|
||||||
<span style={{ color: '#f94444' }}>(必选)</span>
|
上传复刻视频
|
||||||
<p style={{ fontSize: 12, color: '#64748b', fontWeight: 400, }}>
|
<span style={{ color: '#f94444' }}>(必选)</span>
|
||||||
|
</p>
|
||||||
|
<p style={{ fontSize: 12, color: '#64748b', fontWeight: 400, margin: '4px 0 0' }}>
|
||||||
当前引擎最多可上传 {currentMaxDuration} 秒
|
当前引擎最多可上传 {currentMaxDuration} 秒
|
||||||
</p>
|
</p>
|
||||||
</p>
|
</div>
|
||||||
{videoUrl ? (
|
{videoUrl ? (
|
||||||
<div style={{ position: 'relative' }}>
|
<div style={{ position: 'relative' }}>
|
||||||
<video
|
<video
|
||||||
|
|||||||
Reference in New Issue
Block a user