feat: 完善会员资金明细与退款转账逻辑,新增支付密码组件与资金流水界面

这个提交包含在:
2026-10-24 17:55:36 +08:00
父节点 6b86177b5f
当前提交 b6c53abb84
共有 30 个文件被更改,包括 1222 次插入 和 537 次删除

查看文件

@@ -13,8 +13,12 @@ export const memberApi = {
open: (payload) => post('/member/open', payload, { silent: true }),
/** 订单管理(发布/会员/充值) */
orders: (params = {}) => get('/member/orders', params, { silent: true }),
/** 我的资产(余额/优惠券/积分) */
/** 我的资产(余额/优惠券/积分/支付密码状态) */
assets: () => get('/member/assets', {}, { silent: true }),
/** 余额明细(余额中心交易记录) */
flows: (params = {}) => get('/member/flows', params, { silent: true }),
/** 设置/修改支付密码(6 位数字;已设置时需传 oldPassword) */
setPayPassword: (payload) => post('/member/pay-password/set', payload, { silent: true }),
}
export default memberApi

查看文件

@@ -210,6 +210,16 @@ export const datasets = {
points: 320,
},
/** 余额明细(fc_wallet_flow 用户钱包流水,字段与后端 /member/flows 一致;type: income=入账 expense=支出) */
financeFlows: [
{ flowNo: 'W202610240001', type: 'income', scene: '后台充值', amount: 2000, balance: 2128.5, createdAt: iso(0) },
{ flowNo: 'W202610230002', type: 'expense', scene: '付费查看', amount: 2, balance: 128.5, createdAt: iso(-1) },
{ flowNo: 'W202610220003', type: 'income', scene: '余额充值', amount: 100, balance: 130.5, createdAt: iso(-2) },
{ flowNo: 'W202610210004', type: 'expense', scene: '发布付费', amount: 5, balance: 30.5, createdAt: iso(-3) },
{ flowNo: 'W202610200005', type: 'income', scene: '订单退款(余额)', amount: 5, balance: 35.5, createdAt: iso(-4) },
{ flowNo: 'W202610190006', type: 'expense', scene: '会员开通', amount: 168, balance: 30.5, createdAt: iso(-5) },
],
/** 可领取的优惠券定义(fc_coupon) */
coupons: [
{ id: 1, name: '发布立减 3 元', type: 'fixed', amount: 3, minAmount: 0, total: 1000, receivedCount: 12, enabled: true, sort: 1, days: 30 },

查看文件

@@ -508,6 +508,21 @@ export const mockRoutes = {
const coupons = buildUserCoupons()
return ok({ ...datasets.assets, coupons, couponCount: coupons.length })
},
/** 余额明细(支持 type 筛选:recharge=充值 / expense=消费 / refund=退款,与后端 Member::flows 口径一致) */
'GET /member/flows': ({ data }) => {
let rows = datasets.financeFlows || []
const type = data && data.type
if (type === 'recharge') rows = rows.filter((f) => f.scene === '余额充值')
else if (type === 'expense') rows = rows.filter((f) => f.type === 'expense')
else if (type === 'refund') rows = rows.filter((f) => (f.scene || '').includes('退款'))
return ok(paginate(rows, data && data.page, data && data.size))
},
/** 设置/修改支付密码(6 位数字) */
'POST /member/pay-password/set': ({ data }) => {
const password = data && data.password
if (!/^\d{6}$/.test(String(password || ''))) fail('支付密码必须是 6 位数字')
return ok({ hasPayPassword: true })
},
// ==================== 用户端 · 收藏与关注 ====================
'GET /favorite/list': ({ data }) => {

查看文件

@@ -25,6 +25,8 @@ export const uiState = reactive({
aboutUs: '',
shareTitle: '',
subscribe: {},
// 余额支付密码开关(后台「支付配置」下发;开启后余额支付需验证 6 位支付密码)
payPasswordEnabled: false,
loaded: false,
})
@@ -41,6 +43,7 @@ export function applyUiConfig(cfg = {}) {
uiState.aboutUs = cfg.aboutUs || ''
uiState.shareTitle = cfg.shareTitle || cfg.siteName || cfg.appName || ''
uiState.subscribe = cfg.subscribe || {}
uiState.payPasswordEnabled = !!(cfg && cfg.payPasswordEnabled)
setRemoteUi(cfg)
}