Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
runner
9 years ago
Commit
9bcc690f7097dfe5103a0d3977d3f02a3ebaaf55
1 parent
244b7b6d
discount bug update
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
apps/product/models/outlet.js
apps/product/models/outlet.js
View file @
9bcc690
...
...
@@ -30,6 +30,20 @@ const dateFormate = (str) =>{
return
y
+
'年'
+
m
+
'月'
+
d
+
'日'
+
h
+
'时'
;
};
const
transDiscountToArr
=
(
discount
)
=>
{
return
discount
.
replace
(
/
(?:\d
+
[
.
\d]?)([\u
4e00-
\u
9fa5
]{1})
/g
,
function
(
fullMatch
,
capture
)
{
if
(
capture
)
{
const
arr
=
[];
arr
.
push
(
fullMatch
.
replace
(
capture
,
''
));
arr
.
push
(
capture
);
return
arr
;
}
else
{
return
fullMatch
;
}
}).
split
(
','
);
}
const
getOutletResource
=
(
channel
,
contentcode
)
=>
{
const
params
=
{
content_code
:
contentcode
||
'c19ffa03f053f4cac3690b22c8da26b7'
,
...
...
@@ -93,11 +107,11 @@ const convertActicityData = (data) => {
_
.
forEach
(
data
,
(
item
)
=>
{
discountArr
=
item
.
promotionName
.
split
(
'~'
);
if
(
discountArr
.
length
===
1
)
{
discountNum
=
discountArr
[
0
].
replace
(
/
[^
0-9
]
/g
,
''
);
discountText
=
discountArr
[
0
].
replace
(
/
[
0-9
]
/g
,
''
);
discountNum
=
transDiscountToArr
(
discountArr
[
0
])[
0
];
discountText
=
transDiscountToArr
(
discountArr
[
0
])[
1
];
}
else
{
discountNum
=
discountArr
[
0
]
+
'~'
+
discountArr
[
1
].
replace
(
/
[^
0-9
]
/g
,
''
);
discountText
=
discountArr
[
1
].
replace
(
/
[
0-9
]
/g
,
''
);
discountNum
=
discountArr
[
0
]
+
'~'
+
transDiscountToArr
(
discountArr
[
1
])[
0
];
discountText
=
transDiscountToArr
(
discountArr
[
1
])[
1
];
}
formatData
.
push
({
...
...
Please
register
or
login
to post a comment