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
7b0f6787
Commit
7b0f6787
authored
5 years ago
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deposit-migrate' into deposit-coupons
# Conflicts: # src/components/coupons/myCoupons/index.js
parents
ecf63dbe
79670735
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
202 additions
and
188 deletions
+202
-188
src/components/coupons/Coupon/index.js
+195
-184
src/components/coupons/myCoupons/index.js
+3
-2
src/components/detail/index.scss
+1
-0
src/components/expand/share.js
+1
-2
src/components/expand/share.scss
+2
-0
No files found.
src/components/coupons/Coupon/index.js
View file @
7b0f6787
...
...
@@ -3,210 +3,221 @@ import './coupon.scss'
import
classnames
from
'classnames'
import
{
http
}
from
"@/utils"
import
showAlert
from
'@common/deposit/end-expansion-alert'
import
{
Toast
}
from
'antd-mobile'
import
{
Toast
}
from
'antd-mobile'
import
{
withRouter
}
from
"react-router-dom"
class
Coupon
extends
PureComponent
{
VOUCHER
=
1
//代金券
FREE
=
2
//免单券
EXPAND
=
4
//膨胀全
class
Coupon
extends
PureComponent
{
pick
=
()
=>
{
let
{
useCoupon
,
invalid
}
=
this
.
props
!
invalid
&&
useCoupon
&&
useCoupon
(
this
.
props
.
id
)
VOUCHER
=
1
//代金券
FREE
=
2
//免单券
EXPAND
=
4
//膨胀全
}
GoToUse
=
()
=>
{
this
.
props
.
useCoupon
(
this
.
props
.
id
)
pick
=
(
e
)
=>
{
let
{
useCoupon
,
invalid
,
start_amount
,
id
,
location
,
history
,
code
}
=
this
.
props
const
{
state
}
=
location
if
(
state
&&
state
.
from
&&
state
.
from
===
'/my'
){
history
.
push
(
`/expand/index?deposit_code=
${
code
}
`
)
return
}
ExchangeCourse
=
(
e
)
=>
{
this
.
props
.
toExchangeCourse
(
e
,
this
.
props
.
code
)
if
(
start_amount
)
{
this
.
stopExpanding
(
id
,
e
)
}
else
{
!
invalid
&&
useCoupon
&&
useCoupon
(
this
.
props
.
id
)
}
stopExpanding
=
(
id
,
e
)
=>
{
const
{
amount
,
limit_amount
}
=
this
.
props
e
.
stopPropagation
()
showAlert
({
amount
,
limit_amount
,
onConfirm
:
()
=>
{
http
.
post
(
`
${
API
.
home
}
/m/end_expansion`
,
{
id
})
.
then
(
res
=>
{
const
{
data
}
=
res
if
(
data
.
code
==
200
)
{
this
.
props
.
endExpansion
(
id
)
}
else
{
Toast
.
info
(
data
.
msg
)
}
})
}
}
GoToUse
=
()
=>
{
this
.
props
.
useCoupon
(
this
.
props
.
id
)
}
ExchangeCourse
=
(
e
)
=>
{
this
.
props
.
toExchangeCourse
(
e
,
this
.
props
.
code
)
}
stopExpanding
=
(
id
,
e
)
=>
{
const
{
amount
,
limit_amount
}
=
this
.
props
e
.
stopPropagation
()
showAlert
({
amount
,
limit_amount
,
onConfirm
:
()
=>
{
http
.
post
(
`
${
API
.
home
}
/m/end_expansion`
,
{
id
})
.
then
(
res
=>
{
const
{
data
}
=
res
if
(
data
.
code
==
200
)
{
this
.
props
.
endExpansion
(
id
,
data
.
data
.
coupon_id
)
}
else
{
Toast
.
info
(
data
.
msg
)
}
})
}
})
}
render
()
{
let
{
ctype
,
amount
,
course_title
,
showUseButton
,
id
,
format_expire_time
,
start_amount
,
limit_amount
}
=
this
.
props
let
top
,
bottom
switch
(
ctype
)
{
case
this
.
VOUCHER
:
top
=
(
<>
<
p
className
=
'denomination'
>
{
amount
}
<
span
>
元
<
/span></
p
>
<
p
className
=
'expire'
>
有效期至:
{
format_expire_time
}
<
/p
>
<
/
>
}
)
bottom
=
(
<>
<
span
className
=
{
'limit'
}
>
可用于大于代金券金额的课程
<
/span
>
{
showUseButton
&&
ctype
==
this
.
VOUCHER
&&
<
button
className
=
'use'
onClick
=
{
this
.
GoToUse
}
>
立即使用
<
/button
>
}
<
/
>
)
break
case
this
.
FREE
:
top
=
(
<>
<
p
className
=
'course-title'
>
{
course_title
}
<
/p
>
<
p
className
=
'expire'
>
有效期至:
{
format_expire_time
}
<
/p
>
<
/
>
)
bottom
=
(
<>
<
span
className
=
{
'limit'
}
>
{
`仅适用于《
${
course_title
}
》`
}
<
/span
>
{
showUseButton
&&
ctype
==
this
.
FREE
&&
<
button
className
=
'use'
onClick
=
{(
e
)
=>
this
.
ExchangeCourse
(
e
)}
>
立即兑换
<
/button
>
}
<
/
>
render
()
{
let
{
ctype
,
amount
,
course_title
,
showUseButton
,
id
,
format_expire_time
,
start_amount
,
limit_amount
}
=
this
.
props
let
top
,
bottom
switch
(
ctype
)
{
case
this
.
VOUCHER
:
top
=
(
<>
<
p
className
=
'denomination'
>
{
amount
}
<
span
>
元
<
/span></
p
>
<
p
className
=
'expire'
>
有效期至:
{
format_expire_time
}
<
/p
>
<
/
>
)
bottom
=
(
<>
<
span
className
=
{
'limit'
}
>
可用于大于代金券金额的课程
<
/span
>
{
showUseButton
&&
ctype
==
this
.
VOUCHER
&&
<
button
className
=
'use'
onClick
=
{
this
.
GoToUse
}
>
立即使用
<
/button
>
}
<
/
>
)
break
case
this
.
FREE
:
top
=
(
<>
<
p
className
=
'course-title'
>
{
course_title
}
<
/p
>
<
p
className
=
'expire'
>
有效期至:
{
format_expire_time
}
<
/p
>
<
/
>
)
bottom
=
(
<>
<
span
className
=
{
'limit'
}
>
{
`仅适用于《
${
course_title
}
》`
}
<
/span
>
{
showUseButton
&&
ctype
==
this
.
FREE
&&
<
button
className
=
'use'
onClick
=
{(
e
)
=>
this
.
ExchangeCourse
(
e
)}
>
立即兑换
<
/button
>
}
<
/
>
)
break
case
this
.
EXPAND
:
if
(
!
start_amount
)
{
top
=
(
<>
<
p
className
=
'denomination'
>
{
amount
}
<
span
>
元
<
/span></
p
>
<
p
className
=
'expire'
>
有效期至:
{
format_expire_time
}
<
/p
>
<
/
>
)
}
else
{
top
=
(
<>
<
div
className
=
"progress-container"
>
<
p
className
=
'denomination'
>
{
amount
}
<
span
>
元
<
/span></
p
>
<
div
className
=
{
'progress-bar-container'
}
>
)
break
case
this
.
EXPAND
:
if
(
!
start_amount
)
{
top
=
(
<>
<
p
className
=
'denomination'
>
{
amount
}
<
span
>
元
<
/span></
p
>
<
p
className
=
'expire'
>
有效期至:
{
format_expire_time
}
<
/p
>
<
/
>
)
}
else
{
top
=
(
<>
<
div
className
=
"progress-container"
>
<
p
className
=
'denomination'
>
{
amount
}
<
span
>
元
<
/span></
p
>
<
div
className
=
{
'progress-bar-container'
}
>
<
span
className
=
{
'progress-bar'
}
style
=
{{
width
:
`
${
Math
.
round
((
amount
-
start_amount
)
/
limit_amount
*
100
)}
%`
}}
><
/span
>
<
/div
>
<
div
className
=
{
'money'
}
>
<
span
>
{
start_amount
}
元
<
/span
>
<
span
>
{
limit_amount
}
元
<
/span
>
<
/div
>
<
/div
>
<
/
>
)
}
bottom
=
(
<>
<
span
className
=
{
'limit'
}
>
全场通用
<
/span
>
{
start_amount
&&
<
button
className
=
'stop-expanding'
onClick
=
{
this
.
stopExpanding
.
bind
(
this
,
id
)}
>
立即结束膨胀
<
/button
>
}
<
/
>
)
break
<
/div
>
<
div
className
=
{
'money'
}
>
<
span
>
{
start_amount
}
元
<
/span
>
<
span
>
{
limit_amount
}
元
<
/span
>
<
/div
>
<
/div
>
<
/
>
)
}
bottom
=
(
<>
<
span
className
=
{
'limit'
}
>
全场通用
<
/span
>
{
start_amount
&&
<
button
className
=
'stop-expanding'
onClick
=
{
this
.
stopExpanding
.
bind
(
this
,
id
)}
>
立即结束膨胀
<
/button
>
}
<
/
>
return
(
<
BaseCoupon
{...
this
.
props
}
top
=
{
top
}
VOUCHER
=
{
this
.
VOUCHER
}
FREE
=
{
this
.
FREE
}
EXPAND
=
{
this
.
EXPAND
}
pick
=
{
this
.
pick
}
bottom
=
{
bottom
}
/
>
)
break
}
}
function
BaseCoupon
(
{
pick
,
ctype
,
invalid
,
top
,
VOUCHER
,
FREE
,
EXPAND
,
selectedCouponId
,
id
,
bottom
})
{
let
couponTypes
=
{
[
VOUCHER
]:
'代金券'
,
[
FREE
]:
'课程券'
,
[
EXPAND
]:
'膨胀券'
}
return
(
<
li
className
=
'coupon'
onClick
=
{
pick
}
>
<
div
className
=
{
classnames
(
'coupon-info'
,
invalid
?
'invalid'
:
`coupon-type
${
ctype
}
`
)}
>
<
p
className
=
'type'
>
{
couponTypes
[
ctype
]}
<
/p
>
{
top
}
{
selectedCouponId
===
id
&&
<
i
className
=
{
classnames
(
'iconfont icondanseshixintubiao-5'
,
{
check
:
!
invalid
})}
/
>
}
<
ul
>
{
new
Array
(
19
).
fill
(
'a'
).
map
((
item
,
index
)
=>
{
return
<
li
key
=
{
index
}
/
>
})
}
<
/ul
>
<
/div
>
<
div
className
=
"coupon-des"
>
{
bottom
}
<
/div
>
<
/li
>
<
BaseCoupon
{...
this
.
props
}
top
=
{
top
}
VOUCHER
=
{
this
.
VOUCHER
}
FREE
=
{
this
.
FREE
}
EXPAND
=
{
this
.
EXPAND
}
pick
=
{
this
.
pick
}
bottom
=
{
bottom
}
/
>
)
}
}
function
BaseCoupon
(
{
pick
,
ctype
,
invalid
,
top
,
VOUCHER
,
FREE
,
EXPAND
,
selectedCouponId
,
id
,
bottom
})
{
let
couponTypes
=
{
[
VOUCHER
]:
'代金券'
,
[
FREE
]:
'课程券'
,
[
EXPAND
]:
'膨胀券'
}
return
(
<
li
className
=
'coupon'
onClick
=
{
pick
}
>
<
div
className
=
{
classnames
(
'coupon-info'
,
invalid
?
'invalid'
:
`coupon-type
${
ctype
}
`
)}
>
<
p
className
=
'type'
>
{
couponTypes
[
ctype
]}
<
/p
>
{
top
}
{
selectedCouponId
===
id
&&
<
i
className
=
{
classnames
(
'iconfont icondanseshixintubiao-5'
,
{
check
:
!
invalid
})}
/
>
}
<
ul
>
{
new
Array
(
19
).
fill
(
'a'
).
map
((
item
,
index
)
=>
{
return
<
li
key
=
{
index
}
/
>
})
}
<
/ul
>
<
/div
>
<
div
className
=
"coupon-des"
>
{
bottom
}
<
/div
>
<
/li
>
)
}
export
default
Coupon
export
default
withRouter
(
Coupon
)
This diff is collapsed.
Click to expand it.
src/components/coupons/myCoupons/index.js
View file @
7b0f6787
...
...
@@ -276,11 +276,12 @@ class UseCoupon extends PureComponent {
})
}
endExpansion
=
id
=>
{
endExpansion
=
(
id
,
validId
)
=>
{
this
.
setState
({
couponList
:
this
.
state
.
couponList
.
map
(
item
=>
{
valid_coupons
:
this
.
state
.
valid_coupons
.
map
(
item
=>
{
if
(
item
.
id
===
id
)
{
delete
item
.
start_amount
item
.
id
=
validId
}
return
item
})
...
...
This diff is collapsed.
Click to expand it.
src/components/detail/index.scss
View file @
7b0f6787
...
...
@@ -60,6 +60,7 @@
font-size
:
14px
;
color
:
$color_666
;
margin-top
:
10px
;
line-height
:
16px
;
}
.des
{
...
...
This diff is collapsed.
Click to expand it.
src/components/expand/share.js
View file @
7b0f6787
...
...
@@ -164,8 +164,7 @@ class ExpandShare extends Component {
step
:
2
,
helpData
:
data
})
console
.
log
(
data
)
this
.
getListorData
()
}
else
if
(
errno
===
17018
||
errno
===
17020
)
{
this
.
setState
({
isShow
:
true
,
...
...
This diff is collapsed.
Click to expand it.
src/components/expand/share.scss
View file @
7b0f6787
...
...
@@ -569,6 +569,7 @@
color
:
#fff
;
font-size
:
15px
;
margin-top
:
20px
;
border
:
none
;
}
}
...
...
@@ -596,6 +597,7 @@
border-radius
:
17px
;
color
:
#fff
;
font-size
:
15px
;
border
:
none
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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