feat: 新增抖音核销功能(首页入口+核销页+购卡须知弹窗)

- 首页金刚区新增「抖音核销」入口,未登录拦截跳转登录页
- 新增核销页:按手机号查券(有券单选 / 无券手输券号并校验纯数字)、绑卡信息、人脸上传、证件类型选择
- 购卡须知弹窗(单图 aspx.png),确认核销后模拟成功并跳转旅游卡页
- 核销页背景对齐设计稿改为白底,原生窗口底色同步置白
- 接口层 DOUYIN_BACKEND_READY 开关,后端未就绪时返回模拟数据
- 修正金刚区图标域名 hntgov.net -> hn12301.net

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jacobxu666
2026-07-30 11:12:16 +08:00
co-authored by Claude Opus 4.8
parent 8cc76dec6c
commit d1bff755d9
4 changed files with 983 additions and 4 deletions
+98
View File
@@ -0,0 +1,98 @@
// xuchao: 抖音核销接口层。接口契约依赖后端 /mp-api/douyin/*;后端尚未提供时由 DOUYIN_BACKEND_READY 控制直接返回模拟数据以便测试。
// xuchao: 后端就绪后只需将 DOUYIN_BACKEND_READY 置为 true,即可走真实请求(无需改其它代码)。
import { post } from '../../../api/request'
// xuchao: 后端 /mp-api/douyin/* 是否已就绪。false=用模拟数据测试;true=走真实后端。
const DOUYIN_BACKEND_READY = false
/** 券码实名信息(用于回填绑卡表单) */
export interface VoucherRealnameInfo {
voucher_id: string
realname: string
card_id: string
/** 证件类型文案,如「身份证」 */
card_type: string
mobile: string
}
/** 单张券码(对齐小泥人 voucher-list 的 ret 元素) */
export interface VoucherItem {
id: string
order_id: string
/** 券码,列表展示与提交均使用此值 */
code: string
/** 1=未使用 3=已使用 5=已取消 */
status: number
mobile: string
product_name: string
merchant_name: string
voucherRealnameInfo?: VoucherRealnameInfo[]
}
export interface QueryVoucherListParams {
mobile: string
/** 1=未使用,默认查未使用 */
status?: number
}
export interface ActivateAndBindParams {
voucherId: string
voucherCode: string
quantity: number
mobile: string
userName: string
idType: string
idNo: string
faceImg: string
}
const delay = (ms: number) => new Promise<void>((r) => setTimeout(r, ms))
// xuchao: 模拟券码数据(后端未就绪时使用),含一条带实名信息用于验证回填。
const MOCK_VOUCHERS: VoucherItem[] = [
{
id: '1001',
order_id: 'DY202607280001',
code: '20260728192093019',
status: 1,
mobile: '',
product_name: '赣湘全域旅游年卡',
merchant_name: '爱上萍乡',
voucherRealnameInfo: [
{ voucher_id: '1001', realname: '张三', card_id: '360302199001011234', card_type: '身份证', mobile: '' },
],
},
{
id: '1002',
order_id: 'DY202607280002',
code: '20260728192093011',
status: 1,
mobile: '',
product_name: '赣湘全域旅游年卡',
merchant_name: '爱上萍乡',
},
]
/**
* xuchao: 查询当前手机号可核销的券码列表。
* 后端接口:POST /mp-api/douyin/voucherList,入参 { mobile, status }。
*/
export async function queryVoucherList(params: QueryVoucherListParams): Promise<VoucherItem[]> {
if (!DOUYIN_BACKEND_READY) {
await delay(300)
return MOCK_VOUCHERS.map((v) => ({ ...v, mobile: params.mobile }))
}
return post<VoucherItem[]>('/mp-api/douyin/voucherList', params)
}
/**
* xuchao: 激活且绑定(核销)。
* 后端接口:POST /mp-api/douyin/activateAndBind,入参见 ActivateAndBindParams。
*/
export async function activateAndBind(params: ActivateAndBindParams): Promise<void> {
if (!DOUYIN_BACKEND_READY) {
await delay(800)
return
}
await post<null>('/mp-api/douyin/activateAndBind', params)
}