Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jz_Travel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengke
jz_Travel
Commits
3a1c913b
Commit
3a1c913b
authored
Mar 03, 2025
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
价格显示
parent
995830f0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
174 additions
and
10 deletions
+174
-10
details.vue
pages/coupon/details/details.vue
+2
-10
utils.js
plugin/utils.js
+172
-0
No files found.
pages/coupon/details/details.vue
View file @
3a1c913b
...
...
@@ -105,17 +105,9 @@
},
methods
:
{
UnitCalculation
(
num
)
{
let
data
if
(
num
>
999.99
&&
num
<
10000
){
data
=
num
/
10000
;
return
`
${
data
}
千`
;
}
else
if
(
num
>
9999.99
){
data
=
num
/
10000
;
return
`
${
data
}
万`
;
}
else
{
return
num
;
}
return
num
},
receive
(
id
){
this
.
apipost
(
"b2c_post_CustomerGrantCoupon"
,
{
Id
:
id
...
...
plugin/utils.js
View file @
3a1c913b
...
...
@@ -171,6 +171,177 @@ function formatDates(date, fmt) {
function
padLeftZero
(
str
)
{
return
(
'00'
+
str
).
substr
(
str
.
length
);
}
function
changeMoneyToChinese
(
Num
)
{
// 数字转中文大写
if
(
!
Num
)
{
return
'零'
}
var
isNegative
=
false
;
// 是否负数
if
(
Num
<
0
)
{
Num
=
-
Num
;
isNegative
=
true
;
}
if
(
typeof
Num
==
'number'
)
{
Num
=
Num
.
toString
();
}
for
(
var
i
=
Num
.
length
-
1
;
i
>=
0
;
i
--
)
{
Num
=
Num
.
replace
(
","
,
""
);
// 替换money中的“,”
Num
=
Num
.
replace
(
" "
,
""
);
// 替换money中的空格
}
Num
=
Num
.
replace
(
"¥"
,
""
);
// 替换掉可能出现的¥字符
if
(
isNaN
(
Num
))
{
// 验证输入的字符是否为数字
return
;
}
// ---字符处理完毕,开始转换,转换采用前后两部分分别转换---//
let
part
=
String
(
Num
).
split
(
"."
);
let
newchar
=
""
;
// 小数点前进行转化
for
(
var
i
=
part
[
0
].
length
-
1
;
i
>=
0
;
i
--
)
{
if
(
part
[
0
].
length
>
10
)
{
// alertWarning("位数过大,无法计算");
return
""
;
}
// 若数量超过拾亿单位,提示
let
tmpnewchar
=
""
;
let
perchar
=
part
[
0
].
charAt
(
i
);
switch
(
perchar
)
{
case
"0"
:
tmpnewchar
=
"零"
+
tmpnewchar
;
break
;
case
"1"
:
tmpnewchar
=
"壹"
+
tmpnewchar
;
break
;
case
"2"
:
tmpnewchar
=
"贰"
+
tmpnewchar
;
break
;
case
"3"
:
tmpnewchar
=
"叁"
+
tmpnewchar
;
break
;
case
"4"
:
tmpnewchar
=
"肆"
+
tmpnewchar
;
break
;
case
"5"
:
tmpnewchar
=
"伍"
+
tmpnewchar
;
break
;
case
"6"
:
tmpnewchar
=
"陆"
+
tmpnewchar
;
break
;
case
"7"
:
tmpnewchar
=
"柒"
+
tmpnewchar
;
break
;
case
"8"
:
tmpnewchar
=
"捌"
+
tmpnewchar
;
break
;
case
"9"
:
tmpnewchar
=
"玖"
+
tmpnewchar
;
break
;
}
switch
(
part
[
0
].
length
-
i
-
1
)
{
case
0
:
tmpnewchar
=
tmpnewchar
+
"元"
;
break
;
case
1
:
if
(
perchar
!=
0
)
tmpnewchar
=
tmpnewchar
+
"拾"
;
break
;
case
2
:
if
(
perchar
!=
0
)
tmpnewchar
=
tmpnewchar
+
"佰"
;
break
;
case
3
:
if
(
perchar
!=
0
)
tmpnewchar
=
tmpnewchar
+
"仟"
;
break
;
case
4
:
tmpnewchar
=
tmpnewchar
+
"万"
;
break
;
case
5
:
if
(
perchar
!=
0
)
tmpnewchar
=
tmpnewchar
+
"拾"
;
break
;
case
6
:
if
(
perchar
!=
0
)
tmpnewchar
=
tmpnewchar
+
"佰"
;
break
;
case
7
:
if
(
perchar
!=
0
)
tmpnewchar
=
tmpnewchar
+
"仟"
;
break
;
case
8
:
tmpnewchar
=
tmpnewchar
+
"亿"
;
break
;
case
9
:
tmpnewchar
=
tmpnewchar
+
"拾"
;
break
;
}
newchar
=
tmpnewchar
+
newchar
;
}
// 小数点之后进行转化
if
(
Num
.
indexOf
(
"."
)
!=
-
1
)
{
if
(
part
[
1
].
length
>
2
)
{
// alertWarning("小数点之后只能保留两位,系统将自动截段");
part
[
1
]
=
part
[
1
].
substr
(
0
,
2
);
}
for
(
var
i
=
0
;
i
<
part
[
1
].
length
;
i
++
)
{
let
tmpnewchar
=
""
;
let
perchar
=
part
[
1
].
charAt
(
i
);
switch
(
perchar
)
{
case
"0"
:
tmpnewchar
=
"零"
+
tmpnewchar
;
break
;
case
"1"
:
tmpnewchar
=
"壹"
+
tmpnewchar
;
break
;
case
"2"
:
tmpnewchar
=
"贰"
+
tmpnewchar
;
break
;
case
"3"
:
tmpnewchar
=
"叁"
+
tmpnewchar
;
break
;
case
"4"
:
tmpnewchar
=
"肆"
+
tmpnewchar
;
break
;
case
"5"
:
tmpnewchar
=
"伍"
+
tmpnewchar
;
break
;
case
"6"
:
tmpnewchar
=
"陆"
+
tmpnewchar
;
break
;
case
"7"
:
tmpnewchar
=
"柒"
+
tmpnewchar
;
break
;
case
"8"
:
tmpnewchar
=
"捌"
+
tmpnewchar
;
break
;
case
"9"
:
tmpnewchar
=
"玖"
+
tmpnewchar
;
break
;
}
if
(
i
==
0
)
tmpnewchar
=
tmpnewchar
+
"角"
;
if
(
i
==
1
)
tmpnewchar
=
tmpnewchar
+
"分"
;
newchar
=
newchar
+
tmpnewchar
;
}
}
// 替换所有无用汉字
while
(
newchar
.
search
(
"零零"
)
!=
-
1
)
newchar
=
newchar
.
replace
(
"零零"
,
"零"
);
newchar
=
newchar
.
replace
(
"零亿"
,
"亿"
);
newchar
=
newchar
.
replace
(
"亿万"
,
"亿"
);
newchar
=
newchar
.
replace
(
"零万"
,
"万"
);
newchar
=
newchar
.
replace
(
"零元"
,
""
);
newchar
=
newchar
.
replace
(
"零角"
,
""
);
newchar
=
newchar
.
replace
(
"零分"
,
""
);
if
(
newchar
.
charAt
(
newchar
.
length
-
1
)
==
"元"
||
newchar
.
charAt
(
newchar
.
length
-
1
)
==
"角"
)
{
newchar
=
newchar
+
"整"
;
}
if
(
isNegative
)
{
newchar
=
'负'
+
newchar
;
}
return
newchar
;
}
export
default
{
calcContentHeight
,
SystemInfo
,
...
...
@@ -181,4 +352,5 @@ export default {
// #endif
VersionUpdate
,
formatDates
,
changeMoneyToChinese
,
}
\ No newline at end of file
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