Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
clone_excelso
Project
Project
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
Prasetya Saputra
clone_excelso
Commits
68fc5794
Commit
68fc5794
authored
May 12, 2020
by
Trisno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sampe order
parent
3055a794
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
47 deletions
+58
-47
MenuConfirmation.js
view/MenuConfirmation.js
+26
-12
RewardDetail.js
view/RewardDetail.js
+1
-1
RewardSelect.js
view/RewardSelect.js
+1
-1
ShoppingCart.js
view/ShoppingCart.js
+30
-33
No files found.
view/MenuConfirmation.js
View file @
68fc5794
...
...
@@ -16,6 +16,7 @@ class MenuConfirmation extends React.Component {
ongkir
:
0
,
diskon
:
0
,
totalOrder
:
0
,
type
:
''
,
spinner
:
false
,
}
}
...
...
@@ -33,30 +34,38 @@ class MenuConfirmation extends React.Component {
}
setOrder
(
is_pickup
)
{
this
.
setState
({
spinner
:
true
,
})
//
this.setState({
//
spinner: true,
//
})
if
(
is_pickup
)
{
type
=
'Pick Up'
this
.
setState
({
type
:
'Pick Up'
})
}
else
{
type
=
'Delivery'
this
.
setState
({
type
:
'Delivery'
})
}
// console.log(is_pickup)
let
params
=
{
session_id
:
this
.
props
.
session_id
,
outlet_id
:
this
.
props
.
outlet_id
,
address_id
:
this
.
props
.
addressId
,
trans_type
:
type
,
trans_type
:
t
his
.
state
.
t
ype
,
order_item
:
this
.
props
.
order_item
,
delivery_charge
:
this
.
props
.
grabamount
,
voucher
:
[],
voucher
:
[{
value
:
this
.
props
.
voucher
.
reward
.
value
,
verification_number
:
this
.
props
.
voucher
.
verification_number
}],
payment
:
{
balance
:
this
.
props
.
route
.
params
.
balanceUsed
,
point
:
this
.
props
.
route
.
params
.
pointused
}
}
console
.
log
(
'BOOK : '
+
JSON
.
stringify
(
params
)
)
console
.
log
(
params
)
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/transaction/booking'
,
params
).
then
(
res
=>
{
let
data_order
=
res
.
data
.
data
.
id
...
...
@@ -68,6 +77,9 @@ class MenuConfirmation extends React.Component {
trans_id
:
data_order
}
this
.
props
.
setTransId
(
transIdProps
);
// add API use voucher here
Alert
.
alert
(
"Berhasil"
,
"Transaksi sudah berhasil, terimakasih sudah menggunakan excelso untuk ngopi"
,
...
...
@@ -98,7 +110,7 @@ class MenuConfirmation extends React.Component {
render
()
{
console
.
log
(
this
.
props
)
//
console.log(this.props)
let
total
=
0
return
(
<
ScrollView
style
=
{
styles
.
container
}
>
...
...
@@ -138,7 +150,7 @@ class MenuConfirmation extends React.Component {
<
Text
>
Voucher
Discount
<
/Text
>
<
/View
>
<
View
style
=
{{
margin
:
10
}}
>
<
Text
>
0
<
/Text
>
<
Text
>
{
this
.
props
.
voucher
.
reward
.
value
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
margin
:
10
,
justifyContent
:
'space-between'
}}
>
...
...
@@ -164,7 +176,7 @@ class MenuConfirmation extends React.Component {
<
/View
>
{
this
.
props
.
type_pickup
==
true
?
(
<
View
style
=
{{
margin
:
10
}}
>
<
Text
>
{
this
.
props
.
order_total
+
this
.
state
.
diskon
}
<
/Text
>
<
Text
>
{
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
)
}
<
/Text
>
<
/View
>
):(
<
View
style
=
{{
margin
:
10
}}
>
...
...
@@ -249,9 +261,11 @@ const mapDispatchToProps = (dispacth) => {
}
const
mapStateToProps
=
(
state
)
=>
{
console
.
log
(
state
)
//
console.log(state)
return
{
session_id
:
state
.
session_id
,
value_voucher
:
state
.
value_voucher
,
voucher
:
state
.
voucher
,
type_pickup
:
state
.
type_pickup
,
outlet_id
:
state
.
outlet_id
,
order_quantity
:
state
.
order_quantity
,
...
...
view/RewardDetail.js
View file @
68fc5794
...
...
@@ -61,7 +61,7 @@ class RewardDetail extends React.Component {
expire
:
expire_date
,
code
:
res
.
data
.
reward
.
verification_number
,
used
:
res
.
data
.
reward
.
used
,
value
:
res
.
data
.
reward
.
reward
,
value
:
res
.
data
.
reward
,
cur_time
:
cur_time
,
exp_time
:
exp_time
...
...
view/RewardSelect.js
View file @
68fc5794
...
...
@@ -45,7 +45,7 @@ class RewardSelect extends React.Component {
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/get_detail'
,
params
).
then
(
res
=>
{
// console.log(res.data.reward)
let
detail
=
res
.
data
.
reward
.
reward
let
detail
=
res
.
data
.
reward
let
voucherProps
=
{
value_voucher
:
detail
,
voucher
:
detail
...
...
view/ShoppingCart.js
View file @
68fc5794
...
...
@@ -43,7 +43,7 @@ class ShoppingCart extends React.Component {
componentDidMount
()
{
console
.
log
(
this
.
props
.
voucher
)
console
.
log
(
this
.
props
.
voucher
.
reward
.
value
)
console
.
log
(
'INI VALUE : '
+
this
.
props
.
value_voucher
)
if
(
!
this
.
props
.
type_pickup
)
{
this
.
getRate
()
...
...
@@ -114,6 +114,17 @@ class ShoppingCart extends React.Component {
console
.
log
(
params
);
}
handleChangeVoucher
()
{
this
.
setState
({
checkedBalance
:
false
,
checkedPoint
:
false
,
checkedBalancePoint
:
false
,
pointsused
:
0
,
balanceused
:
0
})
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)
}
handleMin
(
item
,
index
)
{
this
.
setState
({
checkedBalance
:
false
,
...
...
@@ -220,7 +231,7 @@ class ShoppingCart extends React.Component {
checkedBalance
:
true
,
checkedPoint
:
false
,
checkedBalancePoint
:
false
,
balanceused
:
this
.
props
.
order_total
,
balanceused
:
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
)
,
pointsused
:
0
})
}
else
{
...
...
@@ -228,7 +239,7 @@ class ShoppingCart extends React.Component {
checkedBalance
:
true
,
checkedPoint
:
false
,
checkedBalancePoint
:
false
,
balanceused
:
this
.
props
.
order_total
+
this
.
props
.
grabamount
,
balanceused
:
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
+
this
.
props
.
grabamount
)
,
pointsused
:
0
})
}
...
...
@@ -426,38 +437,24 @@ class ShoppingCart extends React.Component {
/
>
<
/View
>
<
View
style
=
{
styles
.
voucher
}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)}
>
<
Text
style
=
{{
color
:
'#ccb46c'
}}
>+
ADD
VOUCHER
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
{
this
.
props
.
voucher
===
[]
?
(
<>
<
/
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)}
>
<
Text
style
=
{{
color
:
'#ccb46c'
}}
>+
ADD
VOUCHER
<
/Text
>
<
/TouchableOpacity
>
)
:
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)}
>
<
Card
style
=
{{
padding
:
5
,
margin
:
10
}}
>
<
View
>
<
Image
source
=
{{
uri
:
this
.
props
.
voucher
.
title_image
}}
resizeMethod
=
"resize"
resizeMode
=
'cover'
style
=
{{
height
:
150
,
width
:
'100%'
}}
/
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
padding
:
10
}}
>
<
View
>
<
Text
style
=
{{
fontWeight
:
'bold'
,
textAlign
:
'left'
}}
>
{
this
.
props
.
voucher
.
title
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'left'
}}
>
{
this
.
props
.
voucher
.
subtitle
}
<
/Text
>
<
/View
>
<
View
>
<
Text
style
=
{{
textAlign
:
'right'
}}
>
Diskon
<
/Text
>
<
Text
style
=
{{
textAlign
:
'right'
}}
>
{
this
.
props
.
voucher
.
value
}
<
/Text
>
<
/View
>
<
/View
>
<
/Card
>
<
/TouchableOpacity
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
View
>
<
Text
style
=
{{
fontWeight
:
'bold'
}}
>
{
this
.
props
.
voucher
.
reward
.
title
}
<
/Text
>
<
/View
>
<
View
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
handleChangeVoucher
()}
>
<
Text
style
=
{{
color
:
'#ccb46c'
}}
>
Change
Voucher
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
)
}
<
/View
>
<
View
style
=
{
styles
.
payment
}
>
<
Text
>
PAYMENT
METHODS
<
/Text
>
...
...
@@ -640,7 +637,7 @@ class ShoppingCart extends React.Component {
<
Text
style
=
{{
paddingLeft
:
20
,
paddingTop
:
10
,
color
:
'gray'
}}
>
Diskon
<
/Text
>
<
/View
>
<
View
style
=
{{
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
Text
style
=
{{
color
:
'gray'
}}
>
{
this
.
props
.
voucher
.
value
}
<
/Text
>
<
Text
style
=
{{
color
:
'gray'
}}
>
{
this
.
props
.
voucher
.
reward
.
value
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
marginTop
:
10
,
justifyContent
:
'space-between'
}}
>
...
...
@@ -649,12 +646,12 @@ class ShoppingCart extends React.Component {
<
/View
>
{
this
.
props
.
type_pickup
==
true
?
(
<
View
style
=
{{
marginTop
:
15
,
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
this
.
props
.
order_total
-
this
.
props
.
voucher
.
value
}
<
/Text
>
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
)
}
<
/Text
>
<
/View
>
)
:
(
<
View
style
=
{{
marginTop
:
15
,
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
{
this
.
props
.
order_item
.
length
?
(
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
this
.
props
.
order_total
+
this
.
props
.
grabamount
+
this
.
state
.
diskon
}
<
/Text
>
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
+
this
.
props
.
grabamount
)
}
<
/Text
>
)
:
(
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
this
.
props
.
order_total
+
this
.
state
.
diskon
}
<
/Text
>
)}
...
...
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