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
6102760c
Commit
6102760c
authored
Apr 27, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ini rdux grab dan order
parent
630880ee
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
190 additions
and
94 deletions
+190
-94
globalActionType.js
redux/globalActionType.js
+3
-1
globalReducer.js
redux/globalReducer.js
+28
-1
MenuConfirmation.js
view/MenuConfirmation.js
+18
-1
ShoppingCart.js
view/ShoppingCart.js
+141
-91
No files found.
redux/globalActionType.js
View file @
6102760c
...
...
@@ -25,7 +25,9 @@ const ActionType = {
ADD_TO_CHART
:
'ADD_TO_CHART'
,
REMOVE_FROM_CHART
:
'REMOVE_FROM_CHART'
,
REDUCE_QUANTITY_ITEM
:
'REDUCE_QUANTITY_ITEM'
,
SET_ADDRESS
:
'SET_ADDRESS'
SET_ADDRESS
:
'SET_ADDRESS'
,
SET_GRAB
:
'SET_GRAB'
,
SET_ORDERS
:
'SET_ORDERS'
}
...
...
redux/globalReducer.js
View file @
6102760c
...
...
@@ -60,7 +60,16 @@ const globalState = {
address
:
''
,
addressId
:
''
addressId
:
''
,
grabtype
:
''
,
grabamount
:
''
,
grabpickup
:
''
,
grabdropoff
:
''
,
grabdestination
:
''
,
balanceUsed
:
''
,
pointused
:
''
,
}
const
rootReducer
=
(
state
=
globalState
,
action
)
=>
{
...
...
@@ -79,6 +88,24 @@ const rootReducer = (state = globalState, action) => {
isEmailverif
:
action
.
data
.
isEmailverif
,
}
}
case
ActionType
.
SET_GRAB
:
{
return
{
...
state
,
grabtype
:
action
.
data
.
grabtype
,
grabamount
:
action
.
data
.
grabamount
,
grabpickup
:
action
.
data
.
grabpickup
,
grabdropoff
:
action
.
data
.
grabdropoff
,
grabdestination
:
action
.
data
.
grabdestination
,
}
}
case
ActionType
.
SET_ORDERS
:
{
return
{
...
state
,
balanceUsed
:
action
.
data
.
balanceUsed
,
pointused
:
action
.
data
.
pointused
,
}
}
case
ActionType
.
SET_PAGE
:
{
return
{
...
state
,
...
...
view/MenuConfirmation.js
View file @
6102760c
...
...
@@ -16,6 +16,16 @@ class MenuConfirmation extends React.Component {
}
}
componentDidMount
(){
console
.
log
(
" DESTINASI : "
+
this
.
props
.
grabdestination
)
console
.
log
(
"ONGKIR"
+
this
.
props
.
grabamount
)
console
.
log
(
"drop off"
+
this
.
props
.
grabdropoff
)
console
.
log
(
"pickup"
+
this
.
props
.
grabpickup
)
console
.
log
(
"type"
+
this
.
props
.
grabtype
)
console
.
log
(
"BALANCED"
+
this
.
props
.
balanceUsed
)
console
.
log
(
"POINT"
+
this
.
props
.
pointsused
)
}
render
()
{
console
.
log
(
this
.
props
)
let
total
=
0
...
...
@@ -136,7 +146,14 @@ const mapStateToProps = (state) => {
order_total
:
state
.
order_total
,
order_item
:
state
.
order_item
,
quantity
:
state
.
quantity
,
address
:
state
.
address
address
:
state
.
address
,
grabtype
:
state
.
grabtype
,
grabamount
:
state
.
grabamount
,
grabpickup
:
state
.
grabpickup
,
grabdropoff
:
state
.
grabdropoff
,
grabdestination
:
state
.
grabdestination
,
balanceUsed
:
state
.
balanceUsed
,
pointused
:
state
.
pointsused
,
}
}
...
...
view/ShoppingCart.js
View file @
6102760c
...
...
@@ -28,7 +28,12 @@ class ShoppingCart extends React.Component {
diskon
:
0
,
isDelivery
:
false
,
isPickUp
:
false
,
order_item
:
this
.
props
.
order_item
order_item
:
this
.
props
.
order_item
,
grabtype
:
''
,
grabamount
:
''
,
grabpickup
:
''
,
grabdropoff
:
''
,
grabdestination
:
''
,
// dummyBalance : 155000,
// dummyPoint : 20000
}
...
...
@@ -96,10 +101,10 @@ class ShoppingCart extends React.Component {
const
order_item
=
{
id
:
item
.
id
,
code
:
item
.
code
,
code
:
item
.
code
,
name
:
item
.
name
,
description
:
item
.
description
,
note
:
'jangan garing'
,
note
:
'jangan garing'
,
price
:
parseInt
(
item
.
price
),
}
...
...
@@ -167,7 +172,7 @@ class ShoppingCart extends React.Component {
this
.
getMenuList
()
this
.
getBalance
()
//
this.getRate()
this
.
getRate
()
}
getMenuList
()
{
...
...
@@ -229,10 +234,37 @@ class ShoppingCart extends React.Component {
order_item
:
this
.
props
.
order_item
}
console
.
log
(
"INI PARAMETER : "
+
JSON
.
stringify
(
params
)
);
console
.
log
(
"INI PARAMETER : "
+
JSON
.
stringify
(
params
));
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate'
,
params
).
then
(
res
=>
{
console
.
log
(
"INI : "
+
JSON
.
stringify
(
res
.
data
))
console
.
log
(
"INI LHO CUY : "
+
JSON
.
stringify
(
res
.
data
.
data
.
destination
.
address
))
this
.
setState
({
grabtype
:
res
.
data
.
data
.
quotes
[
0
].
service
.
type
,
grabamount
:
res
.
data
.
data
.
quotes
[
0
].
amount
,
grabpickup
:
res
.
data
.
data
.
quotes
[
0
].
estimatedTimeline
.
pickup
,
grabdropoff
:
res
.
data
.
data
.
quotes
[
0
].
estimatedTimeline
.
dropoff
,
grabdestination
:
res
.
data
.
data
.
destination
.
address
,
})
let
setGrabProps
=
{
grabtype
:
this
.
state
.
grabtype
,
grabamount
:
this
.
state
.
grabamount
,
grabpickup
:
this
.
state
.
grabpickup
,
grabdropoff
:
this
.
state
.
grabdropoff
,
grabdestination
:
this
.
state
.
grabdestination
,
}
this
.
props
.
setGrab
(
setGrabProps
);
let
setOrdersProps
=
{
balanceUsed
:
this
.
state
.
balanceused
,
pointused
:
this
.
state
.
pointsused
,
}
this
.
props
.
setOrder
(
setOrdersProps
);
}).
catch
(
error
=>
{
console
.
log
(
'ini error '
+
error
)
})
...
...
@@ -499,7 +531,7 @@ class ShoppingCart extends React.Component {
<
/View
>
<
/View
>
<
View
style
=
{{
margin
:
20
,
}}
>
<
Button
title
=
'Checkout'
color
=
'#ccb46c'
onPress
=
{()
=>
this
.
getRate
(
)}
/
>
<
Button
title
=
'Checkout'
color
=
'#ccb46c'
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Confirm Your Order'
,
{
balanceUsed
:
this
.
state
.
balanceused
,
pointused
:
this
.
state
.
pointsused
}
)}
/
>
<
/View
>
<
/View
>
<
/ScrollView
>
...
...
@@ -661,6 +693,24 @@ const mapDispatchToProps = (dispacth) => {
item
:
item
}
}),
setGrab
:
(
setGrabProps
)
=>
dispacth
({
type
:
ActionType
.
SET_GRAB
,
data
:
{
grabtype
:
setGrabProps
.
grabtype
,
grabamount
:
setGrabProps
.
grabamount
,
grabpickup
:
setGrabProps
.
grabpickup
,
grabdropoff
:
setGrabProps
.
grabdropoff
,
grabdestination
:
setGrabProps
.
grabdestination
,
}
}),
setOrder
:
(
setOrdersProps
)
=>
dispacth
({
type
:
ActionType
.
SET_ORDERS
,
data
:
{
balanceUsed
:
setOrdersProps
.
balanceUsed
,
pointused
:
setOrdersProps
.
pointsused
,
}
}),
}
}
...
...
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