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
d4e680ee
Commit
d4e680ee
authored
Jun 12, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Plain Diff
合并dev分支
parents
99d545a8
5aef9c96
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
241 additions
and
80 deletions
+241
-80
src/common/OrderList/index.js
+2
-2
src/components/order/index.js
+120
-31
src/components/order/order.scss
+38
-13
src/components/order/orderinfo.js
+81
-34
No files found.
src/common/OrderList/index.js
View file @
d4e680ee
...
@@ -13,13 +13,13 @@ import './orderlist.scss';
...
@@ -13,13 +13,13 @@ import './orderlist.scss';
*/
*/
const
OrderItem
=
({
info
,
tab
,
children
,
src
,
...
restProps
})
=>
{
const
OrderItem
=
({
info
,
tab
,
children
,
...
restProps
})
=>
{
return
(
return
(
<
div
className
=
'public-list-item'
>
<
div
className
=
'public-list-item'
>
<
div
className
=
"public-content"
>
<
div
className
=
"public-content"
>
{
tab
}
{
tab
}
<
div
className
=
"public-cover"
>
<
div
className
=
"public-cover"
>
<
img
src
=
{
src
}
alt
=
""
/>
<
img
src
=
{
restProps
.
image_name
}
alt
=
""
/>
<
/div
>
<
/div
>
{
info
}
{
info
}
<
/div
>
<
/div
>
...
...
src/components/order/index.js
View file @
d4e680ee
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Flex
,
NavBar
,
List
}
from
'antd-mobile'
;
import
{
Flex
,
NavBar
,
List
,
WingBlank
,
Toast
}
from
'antd-mobile'
;
import
{
OrderItem
}
from
'@/common/index'
import
{
OrderItem
}
from
'@/common/index'
;
import
{
Link
}
from
'react-router-dom'
import
{
Link
}
from
'react-router-dom'
;
import
{
http
,
api
}
from
"@/utils"
;
import
"./order.scss"
import
"./order.scss"
...
@@ -11,7 +12,7 @@ const mockData = [
...
@@ -11,7 +12,7 @@ const mockData = [
{
{
title
:
'三月面试求职班'
,
title
:
'三月面试求职班'
,
imgUrl
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
imgUrl
:
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/4c5ccac604.jpg'
,
content
:
'涵盖ML主流算法及其应用-文字超过一行换行'
,
content
:
'涵盖ML主流算法及其应用-文字超过一行换行
然后呢再多呢是不是就出省略号了
'
,
newprice
:
'980'
,
newprice
:
'980'
,
price
:
'1280'
,
price
:
'1280'
,
id
:
'110'
id
:
'110'
...
@@ -43,11 +44,11 @@ function OrderList(props) {
...
@@ -43,11 +44,11 @@ function OrderList(props) {
listData
.
map
((
item
,
index
)
=>
{
listData
.
map
((
item
,
index
)
=>
{
const
Info
=
(
const
Info
=
(
<
div
className
=
"order-info"
>
<
div
className
=
"order-info"
>
<
p
className
=
'order-title'
>
{
item
.
title
}
<
/p
>
<
p
className
=
'order-title'
style
=
{{
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
,
whiteSpace
:
'nowrap'
}}
>
{
item
.
course_
title
}
<
/p
>
<
p
className
=
'order-content'
>
{
item
.
content
}
<
/p
>
<
p
className
=
'order-content'
style
=
{{
WebkitBoxOrient
:
'vertical'
,
WebkitLineClamp
:
'2'
,
wordBreak
:
'break-all'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
,
display
:
'-webkit-box'
}}
>
{
item
.
simpledescription
}
<
/p
>
<
p
className
=
'order-des'
>
<
p
className
=
'order-des'
>
<
span
className
=
'order-newprice'
>
¥
{
item
.
newprice
}
<
/span
>
<
span
className
=
'order-newprice'
>
¥
{
item
.
price0
}
<
/span
>
<
span
className
=
'order-price'
>
¥
{
item
.
price
}
<
/span
>
<
span
className
=
'order-price'
>
¥
{
item
.
price
1
}
<
/span
>
<
/p
>
<
/p
>
<
/div
>
<
/div
>
)
)
...
@@ -60,7 +61,12 @@ function OrderList(props) {
...
@@ -60,7 +61,12 @@ function OrderList(props) {
arrow
=
"horizontal"
arrow
=
"horizontal"
onClick
=
{()
=>
{
}}
onClick
=
{()
=>
{
}}
>
>
优惠券
<
Link
to
=
'/coupons'
>
<
Flex
justify
=
'between'
>
<
span
>
优惠券
<
/span
>
<
span
>
无
<
/span
>
<
/Flex
>
<
/Link
>
<
/Item
>
<
/Item
>
<
/List
>
<
/List
>
<
/div
>
<
/div
>
...
@@ -76,19 +82,74 @@ class Order extends Component {
...
@@ -76,19 +82,74 @@ class Order extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
perfect
:
true
perfect
:
this
.
props
.
location
.
state
,
user_account
:
0.00
,
total_sale
:
0.00
,
discount
:
0.00
,
useBalance
:
false
,
orderList
:
[],
}
}
// 提交订单
submitOrder
=
()
=>
{
const
{
perfect
,
total
,
discount
}
=
this
.
state
;
if
(
!
perfect
)
{
Toast
.
info
(
'请完善报名信息!'
);
}
}
}
}
handleClick
=
()
=>
{
// 使用余额
console
.
log
(
1
);
useBalance
=
()
=>
{
this
.
setState
((
prevState
)
=>
({
useBalance
:
!
prevState
.
useBalance
}));
this
.
computedMoney
();
}
}
// 计算金额、优惠金额、优惠券等
computedMoney
=
()
=>
{
};
// 展示余额抵扣规则
showInfo
=
()
=>
{
};
componentDidMount
()
{
http
.
get
(
`
${
api
.
home
}
/m/order/preorder`
).
then
((
res
)
=>
{
if
(
res
.
code
!==
200
)
{
return
;
}
const
{
course
,
total_sale
,
user_account
,
user_info
}
=
res
.
data
.
data
;
console
.
log
(
course
);
this
.
setState
({
perfect
:
user_info
,
orderList
:
course
});
})
// // 获取报名信息 获取课程列表 获取用户账户余额
// Promise.race([http.get(), http.get(), http.get()]).then(res=>{
// });
};
render
()
{
render
()
{
const
{
perfect
,
user_account
,
total_sale
,
discount
,
useBalance
,
orderList
,
}
=
this
.
state
;
return
(
return
(
<
div
className
=
"order-wrapper"
>
<
div
className
=
"order-wrapper"
>
<
Flex
>
<
Flex
>
<
Flex
.
Item
>
<
Flex
.
Item
>
<
NavBar
<
NavBar
style
=
{{
"height"
:
"44px"
}}
style
=
{{
"height"
:
"44px"
}}
className
=
"order-tab"
className
=
"order-tab"
mode
=
"light"
mode
=
"light"
icon
=
{
<
i
className
=
"iconfont iconiconfront-68"
><
/i>
}
icon
=
{
<
i
className
=
"iconfont iconiconfront-68"
><
/i>
}
...
@@ -106,50 +167,78 @@ class Order extends Component {
...
@@ -106,50 +167,78 @@ class Order extends Component {
{
{
this
.
state
.
perfect
&&
this
.
state
.
perfect
&&
<
div
className
=
"order-information2"
>
<
div
className
=
"order-information2"
>
<
i
className
=
"iconfont iconiconfront-20"
><
/i
>
<
WingBlank
>
<
div
className
=
"order-cell"
>
<
Flex
align
=
'center'
justify
=
'between'
style
=
{{
height
:
'80px'
}}
>
<
div
className
=
"name"
>
姓名
:
张三
<
/div
>
<
i
className
=
"iconfont iconiconfront-20 user-icon"
><
/i
>
<
div
>
电话
:
13266532323
<
/div
>
<
/div
>
<
Flex
direction
=
'column'
justify
=
'between'
align
=
'start'
className
=
"order-cell"
>
<
div
className
=
"order-cell"
>
<
div
className
=
"name"
>
{
`姓名:
${
perfect
.
real_name
}
`
}
<
/div
>
<
div
>
QQ
:
1084251364
<
/div
>
<
div
>
{
`电话:
${
perfect
.
cellphone
}
`
}
<
/div
>
<
/div
>
<
/Flex
>
<
Flex
align
=
'start'
className
=
"order-cell"
>
<
div
>
{
`QQ:
${
perfect
.
qq
}
`
}
<
/div
>
<
/Flex
>
<
/Flex
>
<
/WingBlank
>
<
/div
>
<
/div
>
}
}
<
div
className
=
"order-list"
>
<
div
className
=
"order-list"
>
<
OrderList
list
=
{
mockData
}
/
>
<
OrderList
list
=
{
orderList
}
/
>
<
/div
>
<
/div
>
<
div
className
=
"order-balance"
>
<
div
className
=
"order-balance"
>
<
List
>
<
List
>
<
Item
<
Item
onClick
=
{()
=>
{
}}
className
=
"order-prefer-text"
className
=
"order-prefer-text"
extra
=
{
<
i
className
=
"iconfont icondanseshixintubiao-5"
><
/i>
}
>
>
余额抵扣
<
Flex
justify
=
'between'
>
<
span
className
=
"order-balanceprice"
>
(
账户余额
:
<
i
className
=
"order-money"
>
1
元
<
/i>
)
</
span
>
<
Flex
align
=
'center'
>
<
i
className
=
"iconfont iconiconfront-22"
><
/i
>
<
span
>
余额抵扣
<
/span
>
<
span
className
=
"order-balanceprice"
>
(
账户余额
:
<
i
className
=
"order-money"
>
{
`
${
user_account
}
元`
}
<
/i>
)
</
span
>
<
i
className
=
"iconfont iconiconfront-22"
onClick
=
{
this
.
showInfo
}
><
/i
>
<
/Flex
>
{
useBalance
?
(
<
div
>
<
span
style
=
{{
color
:
'#FF2121'
,
fontSize
:
'15px'
,
marginRight
:
"6px"
}}
>
{
`-
${
user_account
}
`
}
<
/span
>
<
i
className
=
"iconfont icondanseshixintubiao-5"
onClick
=
{
this
.
useBalance
}
><
/i
>
<
/div
>
)
:
(
<
i
className
=
"iconfont iconiconfront-3"
onClick
=
{
this
.
useBalance
}
><
/i
>
)
}
<
/Flex
>
<
/Item
>
<
/Item
>
<
/List
>
<
/List
>
<
/div
>
<
/div
>
<
div
className
=
"order-bar"
>
<
div
className
=
"order-bar"
>
<
div
className
=
"order-course"
>
<
div
className
=
"order-course"
>
<
span
className
=
"order-course-text"
>
2
门课程
<
/span
>
<
span
className
=
"order-course-text"
>
{
`
${
orderList
.
length
}
门课程`
}
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"order-bar-text"
>
<
div
className
=
"order-bar-text"
>
<
div
className
=
"order-amount"
>
<
div
className
=
"order-amount"
>
<
span
className
=
"order-amount-title"
>
合计
:
<
/span
>
<
span
className
=
"order-amount-title"
>
合计
:
<
/span
>
<
span
className
=
"order-amount-price"
>
¥
30.50
<
/span
>
<
span
className
=
"order-amount-price"
>
{
`¥
${
total_sale
}
`
}
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"order-preprice"
>
<
div
className
=
"order-preprice"
>
<
span
className
=
"order-preprice-title"
>
已优惠
:
<
/span
>
<
span
className
=
"order-preprice-title"
>
已优惠
:
<
/span
>
<
span
className
=
"order-preprice-price"
>
¥
200.50
<
/span
>
<
span
className
=
"order-preprice-price"
>
{
`¥
${
discount
}
`
}
<
/span
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
{
perfect
?
(
<
button
type
=
"button"
className
=
"order-button has-info"
>
<
span
className
=
"order-button-text"
onClick
=
{
this
.
submitOrder
}
>
提交订单
<
/span
>
<
/button
>
)
:
(
<
button
type
=
"button"
className
=
"order-button"
>
<
button
type
=
"button"
className
=
"order-button"
>
<
span
className
=
"order-button-text"
>
提交订单
<
/span
>
<
span
className
=
"order-button-text"
onClick
=
{
this
.
submitOrder
}
>
提交订单
<
/span
>
<
/button
>
<
/button
>
)
}
<
/div
>
<
/div
>
<
/Flex.Item
>
<
/Flex.Item
>
<
/Flex
>
<
/Flex
>
...
...
src/components/order/order.scss
View file @
d4e680ee
...
@@ -31,20 +31,39 @@
...
@@ -31,20 +31,39 @@
background-size
:
80px
;
background-size
:
80px
;
}
}
.order-information2
{
height
:
80px
;
background-color
:
#FFF
;
margin-top
:
8px
;
position
:
relative
;
.user-icon
{
font-size
:
28px
;
}
.order-cell
{
.order-cell
{
width
:
50%
;
height
:
50px
;
height
:
45px
;
font-size
:
13px
;
font-size
:
$font_14
;
color
:
$color_333
;
color
:
$color_333
;
margin-left
:
20px
;
line-height
:
20px
;
line-height
:
20px
;
display
:
inline-block
;
vertical-align
:
middle
;
.name
{
.name
{
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
}
}
}
.
order-information2
:
:
before
{
content
:
''
;
left
:
0
;
right
:
0
;
bottom
:
0
;
height
:
2px
;
position
:
absolute
;
background
:
-webkit-repeating-linear-gradient
(
135deg
,
#ff6c6c
0
,
#ff6c6c
20%
,
transparent
0
,
transparent
25%
,
#1989fa
0
,
#1989fa
45%
,
transparent
0
,
transparent
50%
);
background
:
repeating-linear-gradient
(
-45deg
,
#ff6c6c
0
,
#ff6c6c
20%
,
transparent
0
,
transparent
25%
,
#1989fa
0
,
#1989fa
45%
,
transparent
0
,
transparent
50%
);
background-size
:
80px
;
}
.order-addsize
{
.order-addsize
{
font-size
:
22px
!
important
;
font-size
:
22px
!
important
;
...
@@ -61,7 +80,7 @@
...
@@ -61,7 +80,7 @@
.order-list
{
.order-list
{
margin-top
:
8px
;
margin-top
:
8px
;
background-color
:
$white
;
background-color
:
#F5F5F5
;
.public-content
{
.public-content
{
padding
:
10px
15px
;
padding
:
10px
15px
;
}
}
...
@@ -72,13 +91,18 @@
...
@@ -72,13 +91,18 @@
height
:
22px
;
height
:
22px
;
line-height
:
22px
;
line-height
:
22px
;
margin-left
:
10px
;
margin-left
:
10px
;
font-size
:
$font_1
6
;
font-size
:
$font_1
4
;
color
:
$color_555
;
color
:
$color_555
;
}
}
.order-info
{
.order-info
{
color
:
$color_666
;
color
:
$color_666
;
font-size
:
$font_14
;
font-size
:
$font_14
;
min-width
:
160px
;
flex
:
1
1
auto
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
space-around
;
.order-title
{
.order-title
{
height
:
16px
;
height
:
16px
;
...
@@ -88,16 +112,11 @@
...
@@ -88,16 +112,11 @@
}
}
.order-content
{
.order-content
{
margin-top
:
10px
;
color
:
$color_666
;
color
:
$color_666
;
font-size
:
$font_14
;
font-size
:
$font_14
;
line-height
:
18px
;
line-height
:
18px
;
}
}
.order-des
{
margin-top
:
10px
;
}
.order-newprice
{
.order-newprice
{
color
:
$redprice
;
color
:
$redprice
;
font-size
:
$font_16
;
font-size
:
$font_16
;
...
@@ -170,6 +189,9 @@
...
@@ -170,6 +189,9 @@
-webkit-text-size-adjust
:
100%
;
-webkit-text-size-adjust
:
100%
;
border
:
1px
solid
transparent
;
border
:
1px
solid
transparent
;
}
}
.has-info
{
background-color
:
#FF3131
;
}
.v-list-item
{
.v-list-item
{
margin-top
:
8px
;
margin-top
:
8px
;
...
@@ -181,6 +203,9 @@
...
@@ -181,6 +203,9 @@
}
}
.order-prefer
{
.order-prefer
{
.am-list-content
{
font-size
:
15px
!
important
;
}
.am-list-line
{
.am-list-line
{
padding
:
0
15px
;
padding
:
0
15px
;
}
}
...
...
src/components/order/orderinfo.js
View file @
d4e680ee
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Flex
,
NavBar
,
List
,
InputItem
,
Button
,
WhiteSpace
,
WingBlank
}
from
'antd-mobile'
;
import
{
Flex
,
NavBar
,
List
,
InputItem
,
Button
,
WhiteSpace
,
WingBlank
,
Toast
}
from
'antd-mobile'
;
import
{
Formik
,
Field
,
Form
,
withFormik
}
from
'formik'
;
class
orderinfo
extends
Component
{
const
InnerForm
=
({
render
()
{
values
,
const
{
getFieldProps
}
=
this
.
props
.
form
;
errors
,
return
(
touched
,
<
Flex
>
setFieldValue
,
<
Flex
.
Item
>
handleBlur
,
<
NavBar
handleSubmit
,
style
=
{{
"height"
:
"44px"
}}
isSubmitting
,
className
=
"order-tab"
})
=>
(
mode
=
"light"
<
form
>
icon
=
{
<
i
className
=
"iconfont iconiconfront-68"
><
/i>
}
>
报名信息
<
/NavBar
>
<
div
>
<
List
>
<
InputItem
<
InputItem
{...
getFieldProps
(
'autofocus'
)}
clear
clear
name
=
"real_name"
onChange
=
{(
value
)
=>
setFieldValue
(
'real_name'
,
value
)}
placeholder
=
"请输入您的真实姓名"
placeholder
=
"请输入您的真实姓名"
ref
=
{
el
=>
this
.
autoFocusInst
=
el
}
>
姓名
<
/InputItem
>
>
电话
<
/InputItem
>
<
InputItem
<
InputItem
{...
getFieldProps
(
'focus'
)}
clear
clear
type
=
'phone'
name
=
'cellphone'
placeholder
=
"请输入您的手机号码"
placeholder
=
"请输入您的手机号码"
ref
=
{
el
=>
this
.
inputRef
=
el
}
onChange
=
{(
value
)
=>
setFieldValue
(
'cellphone'
,
value
)
}
>
姓名
<
/InputItem
>
>
电话
<
/InputItem
>
<
InputItem
<
InputItem
{...
getFieldProps
(
'focus'
)}
clear
clear
name
=
'qq'
placeholder
=
"请输入您的QQ号码"
placeholder
=
"请输入您的QQ号码"
ref
=
{
el
=>
this
.
inputRef
=
el
}
maxLength
=
'15'
onChange
=
{(
value
)
=>
setFieldValue
(
'qq'
,
value
)}
>
QQ
<
/InputItem
>
>
QQ
<
/InputItem
>
<
/List
>
<
WhiteSpace
/>
<
div
style
=
{{
marginTop
:
'21px'
}}
>
<
div
style
=
{{
marginTop
:
'21px'
}}
>
<
WingBlank
>
<
WingBlank
>
<
Button
type
=
"primary"
>
确认
<
/Button
>
<
Button
type
=
'primary'
onClick
=
{
handleSubmit
}
>
确认
<
/Button
>
<
/WingBlank
>
<
/WingBlank
>
<
/div
>
<
/div
>
<
/form
>
);
const
MyForm
=
withFormik
({
mapPropsToValues
:
props
=>
({
real_name
:
''
,
cellphone
:
''
,
qq
:
''
}),
validate
:
(
values
,
props
)
=>
{
const
errors
=
{};
return
errors
;
},
handleSubmit
:
(
values
,
FormBag
)
=>
{
if
(
!
values
.
real_name
)
{
Toast
.
info
(
'请输入姓名!'
,
undefined
,
undefined
,
false
);
return
;
}
if
(
!
values
.
cellphone
)
{
Toast
.
info
(
'请输入手机号!'
,
undefined
,
undefined
,
false
);
return
;
}
else
if
(
!
/1
\d{10}
/g
.
test
(
values
.
cellphone
.
replace
(
/
\s
+/g
,
''
)))
{
Toast
.
info
(
'请输入正确的手机号!'
,
undefined
,
undefined
,
false
);
return
;
}
if
(
!
values
.
qq
)
{
Toast
.
info
(
'请输入QQ号!'
,
undefined
,
undefined
,
false
);
return
;
}
else
if
(
!
/
\d{5,}
/g
.
test
(
values
.
qq
))
{
Toast
.
info
(
'请输入正确QQ号!'
,
undefined
,
undefined
,
false
);
return
;
}
FormBag
.
props
.
history
.
push
({
pathname
:
'/order'
,
state
:
values
});
},
})(
InnerForm
);
class
Orderinfo
extends
Component
{
constructor
(
props
)
{
super
(
props
);
}
render
()
{
return
(
<
div
>
<
NavBar
style
=
{{
"height"
:
"44px"
,
backgroundColor
:
'#F7F9FC'
}}
className
=
"order-tab"
mode
=
"light"
icon
=
{
<
i
className
=
"iconfont iconiconfront-68"
><
/i>
}
>
报名信息
<
/NavBar
>
<
MyForm
history
=
{
this
.
props
.
history
}
/
>
<
/div
>
<
/div
>
<
/Flex.Item
>
<
/Flex
>
)
)
}
}
}
};
export
default
orderinfo
;
export
default
Orderinfo
;
\ No newline at end of file
\ 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