Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
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
baiguangyao
mr-julyedu
Commits
ecf63dbe
Commit
ecf63dbe
authored
Nov 01, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
膨胀券排序
parent
08c3adaa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
22 deletions
+20
-22
src/components/coupons/myCoupons/index.js
+20
-22
No files found.
src/components/coupons/myCoupons/index.js
View file @
ecf63dbe
...
...
@@ -6,7 +6,6 @@ import Coupon from '../Coupon'
import
{
http
,
getParam
}
from
'@/utils'
import
{
WithFullSize
}
from
'@/HOCs'
import
{
Toast
}
from
'antd-mobile'
import
{
isEmpty
}
from
'lodash'
import
{
connect
}
from
'react-redux'
@
connect
()
...
...
@@ -110,19 +109,13 @@ class UseCoupon extends PureComponent {
getMyCoupons
=
()
=>
{
Promise
.
all
([
http
.
get
(
`
${
API
.
home
}
/m/coupon/all
`
),
http
.
get
(
`
${
API
.
home
}
/m/coupon/expansion
`
)
http
.
get
(
`
${
API
.
home
}
/m/coupon/expansion
`
),
http
.
get
(
`
${
API
.
home
}
/m/coupon/all
`
)
]).
then
((
coupons
)
=>
{
let
myCoupons
=
[]
const
[
allCoupons
,
expansion
Coupons
]
=
coupons
const
[
expansionCoupons
,
all
Coupons
]
=
coupons
const
{
data
:
all
}
=
allCoupons
const
{
data
:
expansion
}
=
expansionCoupons
if
(
all
.
code
==
200
)
{
Array
.
isArray
(
all
.
data
)
&&
(
myCoupons
=
myCoupons
.
concat
(
all
.
data
))
}
else
{
Toast
.
info
(
all
.
msg
)
}
if
(
expansion
.
code
==
200
)
{
Array
.
isArray
(
expansion
.
data
)
&&
(
expansion
.
data
=
expansion
.
data
.
map
(
item
=>
(
item
.
ctype
=
4
,
item
)))
...
...
@@ -130,6 +123,11 @@ class UseCoupon extends PureComponent {
}
else
{
Toast
.
info
(
expansion
.
msg
)
}
if
(
all
.
code
==
200
)
{
Array
.
isArray
(
all
.
data
)
&&
(
myCoupons
=
myCoupons
.
concat
(
all
.
data
))
}
else
{
Toast
.
info
(
all
.
msg
)
}
this
.
setState
({
couponList
:
myCoupons
...
...
@@ -139,12 +137,21 @@ class UseCoupon extends PureComponent {
getAllCoupons
=
()
=>
{
Promise
.
all
([
http
.
post
(
`
${
API
.
home
}
/m/coupon/select`
,
{
course_id
:
this
.
state
.
courseId
}
),
http
.
get
(
`
${
API
.
home
}
/m/coupon/expansion`
)
http
.
get
(
`
${
API
.
home
}
/m/coupon/expansion`
),
http
.
post
(
`
${
API
.
home
}
/m/coupon/select`
,
{
course_id
:
this
.
state
.
courseId
}
)
]).
then
((
coupons
)
=>
{
const
[
selectCoupons
,
expansion
Coupons
]
=
coupons
const
[
expansionCoupons
,
select
Coupons
]
=
coupons
const
{
data
:
select
}
=
selectCoupons
const
{
data
:
expansion
}
=
expansionCoupons
if
(
expansion
.
code
==
200
)
{
Array
.
isArray
(
expansion
.
data
)
&&
(
expansion
.
data
=
expansion
.
data
.
map
(
item
=>
(
item
.
ctype
=
4
,
item
)))
&&
(
this
.
setState
({
valid_coupons
:
this
.
state
.
valid_coupons
.
concat
(
expansion
.
data
)
}))
}
else
{
Toast
.
info
(
expansion
.
msg
)
}
if
(
select
.
code
===
200
)
{
const
inuse_coupon
=
select
.
data
[
'inuse_coupon'
]
this
.
setState
({
...
...
@@ -158,15 +165,6 @@ class UseCoupon extends PureComponent {
}
else
{
Toast
.
info
(
data
.
msg
)
}
if
(
expansion
.
code
==
200
)
{
Array
.
isArray
(
expansion
.
data
)
&&
(
expansion
.
data
=
expansion
.
data
.
map
(
item
=>
(
item
.
ctype
=
4
,
item
)))
&&
(
this
.
setState
({
valid_coupons
:
this
.
state
.
valid_coupons
.
concat
(
expansion
.
data
)
}))
}
else
{
Toast
.
info
(
expansion
.
msg
)
}
})
...
...
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