From 14b506036c54666ed3c92c26a42fd82ac9c97229 Mon Sep 17 00:00:00 2001 From: huangzhenbao <17818024429@163.com> Date: Thu, 19 Mar 2026 09:56:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=90=88=E5=B9=B6=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=90=8E=E7=9A=84=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.uvue | 4 +- pages/mall/admin/错误信息.txt | 112 +++++++++++++++++++++++----- services/admin/financeService.uts | 33 ++++++++ services/admin/marketingService.uts | 55 ++++++++++++++ 4 files changed, 182 insertions(+), 22 deletions(-) diff --git a/App.uvue b/App.uvue index 180becfb..07c3d3e2 100644 --- a/App.uvue +++ b/App.uvue @@ -22,7 +22,7 @@ if (session.user != null) { console.log('已有有效会话,恢复登录状态') setIsLoggedIn(true) - uni.reLaunch({ url: '/pages/mall/consumer/index' }) + uni.reLaunch({ url: '/pages/mall/admin/homePage/index' }) return } @@ -34,7 +34,7 @@ if (profile != null) { console.log('会话恢复成功') setIsLoggedIn(true) - uni.reLaunch({ url: '/pages/mall/consumer/index' }) + uni.reLaunch({ url: '/pages/mall/admin/homePage/index' }) } }).catch(() => { console.log('会话恢复失败,需要重新登录') diff --git a/pages/mall/admin/错误信息.txt b/pages/mall/admin/错误信息.txt index 7cafdeed..900d9c01 100644 --- a/pages/mall/admin/错误信息.txt +++ b/pages/mall/admin/错误信息.txt @@ -1,21 +1,5 @@ -[Vue warn]: Unhandled error during execution of component event handler - at -at -at -at -at -at -at -at -at -at -at -at -at -at -at -at -at +main.uts:30 [Vue warn]: Unhandled error during execution of async component loader + at at at at @@ -23,5 +7,93 @@ at at at at -vue.runtime.esm.js:1443 TypeError: Cannot create property 'value' on string '' - at _createVNode.onInput._cache.._cache. (DriverAddDrawer.uvue?import:96:56) +warnHandler @ uni-h5.es.js:19975 +callWithErrorHandling @ vue.runtime.esm.js:1381 +warn$1 @ vue.runtime.esm.js:1207 +logError @ vue.runtime.esm.js:1438 +errorHandler @ uni-h5.es.js:19600 +callWithErrorHandling @ vue.runtime.esm.js:1381 +handleError @ vue.runtime.esm.js:1421 +onError @ vue.runtime.esm.js:3724 +(anonymous) @ vue.runtime.esm.js:3767 +Promise.catch +setup @ vue.runtime.esm.js:3766 +callWithErrorHandling @ vue.runtime.esm.js:1381 +setupStatefulComponent @ vue.runtime.esm.js:8985 +setupComponent @ vue.runtime.esm.js:8946 +mountComponent @ vue.runtime.esm.js:7262 +processComponent @ vue.runtime.esm.js:7228 +patch @ vue.runtime.esm.js:6694 +mountChildren @ vue.runtime.esm.js:6942 +processFragment @ vue.runtime.esm.js:7158 +patch @ vue.runtime.esm.js:6668 +mountChildren @ vue.runtime.esm.js:6942 +processFragment @ vue.runtime.esm.js:7158 +patch @ vue.runtime.esm.js:6668 +mountChildren @ vue.runtime.esm.js:6942 +mountElement @ vue.runtime.esm.js:6849 +processElement @ vue.runtime.esm.js:6814 +patch @ vue.runtime.esm.js:6682 +mountChildren @ vue.runtime.esm.js:6942 +mountElement @ vue.runtime.esm.js:6849 +processElement @ vue.runtime.esm.js:6814 +patch @ vue.runtime.esm.js:6682 +mountChildren @ vue.runtime.esm.js:6942 +processFragment @ vue.runtime.esm.js:7158 +patch @ vue.runtime.esm.js:6668 +componentUpdateFn @ vue.runtime.esm.js:7372 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +setupRenderEffect @ vue.runtime.esm.js:7507 +mountComponent @ vue.runtime.esm.js:7274 +processComponent @ vue.runtime.esm.js:7228 +patch @ vue.runtime.esm.js:6694 +mountChildren @ vue.runtime.esm.js:6942 +mountElement @ vue.runtime.esm.js:6849 +processElement @ vue.runtime.esm.js:6814 +patch @ vue.runtime.esm.js:6682 +componentUpdateFn @ vue.runtime.esm.js:7372 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +setupRenderEffect @ vue.runtime.esm.js:7507 +mountComponent @ vue.runtime.esm.js:7274 +processComponent @ vue.runtime.esm.js:7228 +patch @ vue.runtime.esm.js:6694 +componentUpdateFn @ vue.runtime.esm.js:7372 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +setupRenderEffect @ vue.runtime.esm.js:7507 +mountComponent @ vue.runtime.esm.js:7274 +processComponent @ vue.runtime.esm.js:7228 +patch @ vue.runtime.esm.js:6694 +componentUpdateFn @ vue.runtime.esm.js:7453 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +updateComponent @ vue.runtime.esm.js:7305 +processComponent @ vue.runtime.esm.js:7239 +patch @ vue.runtime.esm.js:6694 +componentUpdateFn @ vue.runtime.esm.js:7453 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +callWithErrorHandling @ vue.runtime.esm.js:1381 +flushJobs @ vue.runtime.esm.js:1585 +Promise.then +queueFlush @ vue.runtime.esm.js:1494 +queueJob @ vue.runtime.esm.js:1488 +scheduler @ vue.runtime.esm.js:3179 +resetScheduling @ vue.runtime.esm.js:236 +triggerEffects @ vue.runtime.esm.js:280 +triggerRefValue @ vue.runtime.esm.js:1033 +set value @ vue.runtime.esm.js:1078 +finalizeNavigation @ vue-router.mjs?v=ed041164:2474 +(anonymous) @ vue-router.mjs?v=ed041164:2384 +Promise.then +pushWithRedirect @ vue-router.mjs?v=ed041164:2352 +push @ vue-router.mjs?v=ed041164:2278 +install @ vue-router.mjs?v=ed041164:2631 +use @ vue.runtime.esm.js:5190 +initRouter @ uni-h5.es.js:19886 +install @ uni-h5.es.js:19955 +use @ vue.runtime.esm.js:5190 +(anonymous) @ main.uts:30 +main.uts:30 SyntaxError: The requested module '/services/admin/financeService.uts?import' does not provide an export named 'fetchAdminBalanceDistribution' (at index.uvue:150:3) \ No newline at end of file diff --git a/services/admin/financeService.uts b/services/admin/financeService.uts index 969bd593..5ef05b9f 100644 --- a/services/admin/financeService.uts +++ b/services/admin/financeService.uts @@ -164,3 +164,36 @@ export async function fetchFinanceBillSummary( p_interval: interval } as any)) as any } + +/** + * 获取余额汇总指标(当前总余额、累计充值、累计消耗) + */ +export async function fetchAdminBalanceStats() : Promise { + return await rpcOrNull('rpc_admin_balance_stats', {} as UTSJSONObject) +} + +/** + * 获取余额趋势(按天,每条记录含 date_group / accumulation / consumption) + */ +export async function fetchAdminBalanceTrend( + startTime : string, + endTime : string +) : Promise> { + return (await rpcOrEmptyArray('rpc_admin_balance_trend', { + p_start_time: startTime, + p_end_time: endTime + } as UTSJSONObject)) as Array +} + +/** + * 获取余额来源与消耗分布(返回 { income: any[], expense: any[] }) + */ +export async function fetchAdminBalanceDistribution( + startTime : string, + endTime : string +) : Promise { + return await rpcOrNull('rpc_admin_balance_distribution', { + p_start_time: startTime, + p_end_time: endTime + } as UTSJSONObject) +} diff --git a/services/admin/marketingService.uts b/services/admin/marketingService.uts index 22486835..c2749f65 100644 --- a/services/admin/marketingService.uts +++ b/services/admin/marketingService.uts @@ -205,6 +205,61 @@ export async function saveSignInConfig(config : SignInConfig) : Promise return true } +/** + * 签到配置模型(含模式、提醒、积分、经验) + */ +export type CheckinConfig = { + id ?: string + merchant_id ?: string + is_open : boolean + mode : string // 'none' | 'week' | 'month' + notice_enabled : boolean + integral_reward : number + exp_reward : number + updated_at ?: string +} + +/** + * 获取签到配置(扩展版) + */ +export async function fetchCheckinConfig() : Promise { + const { data, error } = await supa + .from('ak_signin_configs') + .select('*') + .eq('id', 'signin_config') + .single() + .execute() + + if (error != null) { + return null + } + return data as CheckinConfig | null +} + +/** + * 保存签到配置(扩展版) + */ +export async function saveCheckinConfig(config : CheckinConfig) : Promise { + const uid = getCurrentUid() + if (uid == null) return false + + const { error } = await supa + .from('ak_signin_configs') + .upsert({ + ...config, + id: 'signin_config', + merchant_id: uid, + updated_at: new Date().toISOString() + }) + .execute() + + if (error != null) { + console.error('保存签到配置(扩展)失败:', error) + return false + } + return true +} + /** * 切换优惠券状态 */