Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cf1b2f23
authored
Sep 14, 2026
by
renyizhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
赠送金額相关修改
parent
8ab82181
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
9 deletions
+82
-9
src/views/console/components/token.vue
+11
-1
src/views/console/tokenLog.vue
+71
-8
No files found.
src/views/console/components/token.vue
View file @
cf1b2f23
...
...
@@ -141,7 +141,9 @@
<p>
12.3 如本协议中的任何条款被认定为无效或不可执行,不影响其他条款的效力。
</p>
<p>
12.4 乙方未行使或延迟行使本协议项下的任何权利,不构成对该权利的放弃。
</p>
<p>
12.5 甲方确认:在点击"同意"前,已仔细阅读并充分理解本协议全部条款,特别是涉及甲方权利义务限制、责任免除及争议解决的条款,乙方已对相关条款进行了充分提示和说明。
</p>
<p>
甲方(客户)确认:我已仔细阅读并完全同意本协议全部条款,自愿充值并使用平台服务。
</p>
<p>
甲方(客户)确认:
</p>
<p>
本次充值金額
{{
rechargeForm
.
amount
||
0
}}
元,余额合计
{{
displayTotalBalance
}}
元
</p>
<p>
我已仔细阅读并完全同意本协议全部条款,自愿充值并使用平台服务。
</p>
<p>
乙方(平台运营方):面向科创园区的普惠算力公共服务平台
</p>
<p>
协议生效日期:
{{
agreementDate
}}
</p>
</div>
...
...
@@ -195,6 +197,14 @@ const userNickname = computed(() => {
return
userStore
.
mobile
||
userStore
.
name
||
""
;
});
// 协议里的"余额合计":当前余额 + 本次充值金额(前端预览,与后端 PDF 保持一致)
// balance 是字符串(如 "100.00"),rechargeForm.amount 是 number
const
displayTotalBalance
=
computed
(()
=>
{
const
current
=
Number
(
balance
.
value
)
||
0
;
const
recharge
=
Number
(
rechargeForm
.
amount
)
||
0
;
return
(
current
+
recharge
).
toFixed
(
2
);
});
const
loading
=
ref
(
false
);
const
hasToken
=
ref
(
false
);
const
balance
=
ref
(
"0.00"
);
...
...
src/views/console/tokenLog.vue
View file @
cf1b2f23
...
...
@@ -113,6 +113,31 @@
</
template
>
</el-table>
</el-tab-pane>
<!-- 赠送 -->
<el-tab-pane
label=
"赠送"
name=
"gift"
>
<el-table
v-loading=
"loading"
:data=
"giftList"
:max-height=
"620"
border
stripe
>
<el-table-column
label=
"时间"
align=
"center"
prop=
"created_at"
width=
"220"
>
<
template
#
default=
"scope"
>
<span>
{{
formatTime
(
scope
.
row
.
created_at
)
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"赠送金额"
align=
"center"
prop=
"amount"
min-width=
"180"
>
<
template
#
default=
"scope"
>
<span
class=
"recharge-amount"
>
¥
{{
extractRechargeAmount
(
scope
.
row
.
content
)
}}
</span>
</
template
>
</el-table-column>
<
template
#
empty
>
<el-empty
description=
"暂无赠送记录"
/>
</
template
>
</el-table>
</el-tab-pane>
</el-tabs>
<pagination
...
...
@@ -138,6 +163,7 @@ const activeTab = ref('consume')
const
loading
=
ref
(
false
)
const
consumeList
=
ref
([])
const
rechargeList
=
ref
([])
const
giftList
=
ref
([])
const
total
=
ref
(
0
)
const
stat
=
reactive
({
...
...
@@ -194,7 +220,12 @@ const queryParams = reactive({
})
// 当前 tab 对应的 type
const
currentType
=
computed
(()
=>
(
activeTab
.
value
===
'consume'
?
2
:
1
))
const
currentType
=
computed
(()
=>
{
if
(
activeTab
.
value
===
'consume'
)
return
2
if
(
activeTab
.
value
===
'recharge'
)
return
1
if
(
activeTab
.
value
===
'gift'
)
return
3
return
0
})
/** 构造带时间戳的请求参数 */
function
buildParams
()
{
...
...
@@ -204,10 +235,26 @@ function buildParams() {
start_timestamp
:
dateRange
.
value
&&
dateRange
.
value
[
0
]
?
Math
.
floor
(
dateRange
.
value
[
0
]
/
1000
)
:
''
,
end_timestamp
:
dateRange
.
value
&&
dateRange
.
value
[
1
]
?
Math
.
floor
(
dateRange
.
value
[
1
]
/
1000
)
:
''
end_timestamp
:
buildEndTimestamp
()
}
}
/**
* 构造结束时间戳
* 当 el-date-picker (type="daterange") 用户只选了日期时,结束时间会被默认设为 00:00:00,
* 这会漏掉当天 23:59:59 的数据。这里检测到时分秒为 0 时,自动扩展到当天 23:59:59。
* 默认 "近30天" 范围(end 为当前时刻)不受影响。
*/
function
buildEndTimestamp
()
{
if
(
!
dateRange
.
value
||
!
dateRange
.
value
[
1
])
return
''
const
endMs
=
dateRange
.
value
[
1
]
const
d
=
new
Date
(
endMs
)
if
(
d
.
getHours
()
===
0
&&
d
.
getMinutes
()
===
0
&&
d
.
getSeconds
()
===
0
&&
d
.
getMilliseconds
()
===
0
)
{
// 用户只选了日期(daterange 默认行为),扩展到当天 23:59:59
return
Math
.
floor
((
endMs
+
86399000
)
/
1000
)
}
// 结束时间本身已经有时分秒(如默认 "近30天" 的 end = 当前时间),保持原样
return
Math
.
floor
(
endMs
/
1000
)
}
/** 加载统计(消费/充值总额) */
...
...
@@ -230,12 +277,19 @@ function loadList() {
queryParams
.
type
=
currentType
.
value
getTokenLog
(
params
).
then
((
res
)
=>
{
const
data
=
res
.
data
||
{}
const
items
=
data
.
items
||
[]
const
data
=
(
res
&&
res
.
data
)
||
{}
let
items
=
data
.
items
||
[]
// 赠送 tab 只保留"管理员增加用户额度"格式的记录,过滤掉其他 type=3 数据
if
(
activeTab
.
value
===
'gift'
)
{
items
=
items
.
filter
((
it
)
=>
isAdminGrantContent
(
it
.
content
))
}
// 按当前 tab 直接给对应的 list ref 赋值(不能赋给 computed)
if
(
activeTab
.
value
===
'consume'
)
{
consumeList
.
value
=
items
}
else
{
}
else
if
(
activeTab
.
value
===
'recharge'
)
{
rechargeList
.
value
=
items
}
else
{
giftList
.
value
=
items
}
total
.
value
=
data
.
total
||
0
loading
.
value
=
false
...
...
@@ -253,7 +307,7 @@ function refresh() {
/** 切换 tab */
function
handleTabChange
(
name
)
{
queryParams
.
p
=
1
queryParams
.
type
=
name
===
'consume'
?
2
:
1
queryParams
.
type
=
name
===
'consume'
?
2
:
(
name
===
'gift'
?
3
:
1
)
refresh
()
}
...
...
@@ -301,6 +355,15 @@ function extractRechargeAmount(content) {
return
Number
(
match
[
1
]).
toFixed
(
2
)
}
/** 判断是否是"管理员增加用户额度"记录
* 匹配格式:"管理员增加用户额度 ¥xxx 额度"
* 严格匹配:前缀 + ¥金额 + 额度 后缀
*/
function
isAdminGrantContent
(
content
)
{
if
(
!
content
||
typeof
content
!==
'string'
)
return
false
return
/^管理员增加用户额度
\s
+¥
\d
+
(\.\d
+
)?\s
+额度$/
.
test
(
content
)
}
/** 解析计费方式:按次(model_ratio===0 && model_price!==-1) vs 按量 */
function
getBillingType
(
other
)
{
if
(
!
other
)
return
'-'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment