Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
eCartPro-Customer
Project
Project
Details
Activity
Releases
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
Dida Adams Arizona
eCartPro-Customer
Commits
d54cf77d
Commit
d54cf77d
authored
Jul 27, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'didam' into 'master'
update See merge request
!50
parents
416a101b
88b6ccb8
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
172 additions
and
61 deletions
+172
-61
App.js
App/Containers/App.js
+3
-0
CartScreen.js
App/Containers/CartScreen.js
+5
-0
CheckOutScreen.js
App/Containers/CheckOutScreen.js
+24
-10
DetailOrderScreen.js
App/Containers/DetailOrderScreen.js
+22
-5
ListAddressScreen.js
App/Containers/ListAddressScreen.js
+1
-0
MyOrderScreen.js
App/Containers/MyOrderScreen.js
+103
-45
Api.js
App/Services/Api.js
+14
-1
No files found.
App/Containers/App.js
View file @
d54cf77d
...
@@ -10,6 +10,8 @@ import BaseText from '../Components/BaseText'
...
@@ -10,6 +10,8 @@ import BaseText from '../Components/BaseText'
import
Ionicons
from
'react-native-vector-icons/Ionicons'
import
Ionicons
from
'react-native-vector-icons/Ionicons'
import
firebase
from
'@react-native-firebase/app'
import
firebase
from
'@react-native-firebase/app'
import
messaging
from
'@react-native-firebase/messaging'
;
import
messaging
from
'@react-native-firebase/messaging'
;
import
moment
from
'moment'
;
import
momentId
from
'moment/locale/id'
;
// create our store
// create our store
const
store
=
createStore
()
const
store
=
createStore
()
...
@@ -81,6 +83,7 @@ class App extends Component {
...
@@ -81,6 +83,7 @@ class App extends Component {
componentDidMount
()
{
componentDidMount
()
{
this
.
checkPermission
()
this
.
checkPermission
()
this
.
fetchToken
()
this
.
fetchToken
()
moment
.
updateLocale
(
'id'
,
momentId
)
}
}
checkPermission
=
async
()
=>
{
checkPermission
=
async
()
=>
{
...
...
App/Containers/CartScreen.js
View file @
d54cf77d
...
@@ -18,6 +18,7 @@ import Constant from '../Lib/Constant';
...
@@ -18,6 +18,7 @@ import Constant from '../Lib/Constant';
import
Toast
from
'react-native-toast-message'
;
import
Toast
from
'react-native-toast-message'
;
import
{
BarIndicator
}
from
'react-native-indicators'
;
import
{
BarIndicator
}
from
'react-native-indicators'
;
import
FontAwesome
from
'react-native-vector-icons/FontAwesome'
import
FontAwesome
from
'react-native-vector-icons/FontAwesome'
import
{
NavigationEvents
}
from
'react-navigation'
;
class
CartScreen
extends
Component
{
class
CartScreen
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -252,6 +253,10 @@ class CartScreen extends Component {
...
@@ -252,6 +253,10 @@ class CartScreen extends Component {
render
()
{
render
()
{
return
(
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#4cc9f0'
}}
>
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#4cc9f0'
}}
>
<
NavigationEvents
onDidFocus
=
{()
=>
{
this
.
getCurrency
()
this
.
getCart
()
}}
/
>
<
BaseHeader
onBackPress
=
{()
=>
this
.
props
.
navigation
.
goBack
()}
leftText
=
{
'Keranjang'
}
/
>
<
BaseHeader
onBackPress
=
{()
=>
this
.
props
.
navigation
.
goBack
()}
leftText
=
{
'Keranjang'
}
/
>
{
this
.
state
.
loading
?
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'white'
,
borderTopLeftRadius
:
32
,
borderTopRightRadius
:
32
}}
>
{
this
.
state
.
loading
?
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'white'
,
borderTopLeftRadius
:
32
,
borderTopRightRadius
:
32
}}
>
<
BarIndicator
count
=
{
5
}
color
=
'#4cc9f0'
size
=
{
25
}
/
>
<
BarIndicator
count
=
{
5
}
color
=
'#4cc9f0'
size
=
{
25
}
/
>
...
...
App/Containers/CheckOutScreen.js
View file @
d54cf77d
...
@@ -28,6 +28,7 @@ class CheckOutScreen extends Component {
...
@@ -28,6 +28,7 @@ class CheckOutScreen extends Component {
dataCheckout
:
[],
dataCheckout
:
[],
totalCheckout
:
0
,
totalCheckout
:
0
,
delivery
:
null
,
delivery
:
null
,
diskon
:
0
,
paymentMethod
:
null
paymentMethod
:
null
}
}
}
}
...
@@ -74,6 +75,7 @@ class CheckOutScreen extends Component {
...
@@ -74,6 +75,7 @@ class CheckOutScreen extends Component {
refreshScreen
()
{
refreshScreen
()
{
this
.
getAddress
()
this
.
getAddress
()
this
.
getCurrency
()
this
.
getCurrency
()
console
.
log
(
'ini data delivery'
,
this
.
state
.
delivery
)
}
}
async
getCurrency
()
{
async
getCurrency
()
{
...
@@ -95,6 +97,7 @@ class CheckOutScreen extends Component {
...
@@ -95,6 +97,7 @@ class CheckOutScreen extends Component {
createOrder
()
{
createOrder
()
{
let
payloadCart
=
[]
let
payloadCart
=
[]
let
diskon
=
0
this
.
state
.
dataCheckout
.
map
((
item
,
index
)
=>
{
this
.
state
.
dataCheckout
.
map
((
item
,
index
)
=>
{
payloadCart
.
push
({
payloadCart
.
push
({
"cart_id"
:
item
.
cart_id
,
"cart_id"
:
item
.
cart_id
,
...
@@ -105,20 +108,31 @@ class CheckOutScreen extends Component {
...
@@ -105,20 +108,31 @@ class CheckOutScreen extends Component {
"total_price"
:
item
.
total_price
,
"total_price"
:
item
.
total_price
,
"cart_date"
:
null
"cart_date"
:
null
})
})
diskon
+=
item
.
discount_price
})
})
let
payload
=
{
let
payload
=
{
"address_id"
:
this
.
state
.
address
.
address_id
,
"address_id"
:
this
.
state
.
address
.
address_id
,
"payment_method"
:
1
,
"payment_method"
:
this
.
state
.
paymentMethod
.
payment_method_id
,
"delivery_charge"
:
"1000"
,
"delivery_charge"
:
this
.
state
.
delivery
.
rate_value
,
"is_wallet"
:
0
,
"is_wallet"
:
this
.
state
.
paymentMethod
.
payment_method_name
==
'Wallet'
?
1
:
0
,
"coupon_id"
:
null
,
"coupon_id"
:
null
,
"coupon_discount"
:
null
,
"coupon_discount"
:
null
,
"discount"
:
1000
,
"discount"
:
diskon
,
"lat"
:
this
.
state
.
address
.
lat
,
"lat"
:
this
.
state
.
address
.
lat
,
"long"
:
this
.
state
.
address
.
l
o
ng
,
"long"
:
this
.
state
.
address
.
lng
,
"cart"
:
payloadCart
,
"cart"
:
payloadCart
,
"courier_rate_id"
:
1
"courier_rate_id"
:
this
.
state
.
delivery
.
courier_rate_id
}
}
Api
.
create
().
createOrder
(
payload
).
then
((
response
)
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
backAction
()
}
console
.
log
(
'tes respon'
,
response
.
data
)
})
// console.log('ini payload', payload)
}
}
render
()
{
render
()
{
...
@@ -270,11 +284,11 @@ class CheckOutScreen extends Component {
...
@@ -270,11 +284,11 @@ class CheckOutScreen extends Component {
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
BaseText
text
=
{
'Subtotal Pengiriman'
}
type
=
{
'regular'
}
style
=
{{
opacity
:
.
5
,
fontSize
:
12
}}
/
>
<
BaseText
text
=
{
'Subtotal Pengiriman'
}
type
=
{
'regular'
}
style
=
{{
opacity
:
.
5
,
fontSize
:
12
}}
/
>
<
BaseText
text
=
{
formatRp
(
this
.
state
.
currency
,
0
)}
type
=
{
'bold'
}
style
=
{{
opacity
:
.
5
,
fontSize
:
12
}}
/
>
<
BaseText
text
=
{
formatRp
(
this
.
state
.
currency
,
this
.
state
.
delivery
==
null
?
0
:
this
.
state
.
delivery
.
rate_value
)}
type
=
{
'bold'
}
style
=
{{
opacity
:
.
5
,
fontSize
:
12
}}
/
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
BaseText
text
=
{
'Total Pembayaran'
}
type
=
{
'regular'
}
style
=
{{
opacity
:
.
9
}}
/
>
<
BaseText
text
=
{
'Total Pembayaran'
}
type
=
{
'regular'
}
style
=
{{
opacity
:
.
9
}}
/
>
<
BaseText
text
=
{
formatRp
(
this
.
state
.
currency
,
this
.
state
.
totalCheckout
)}
type
=
{
'bold'
}
style
=
{{
color
:
'#4cc9f0'
}}
/
>
<
BaseText
text
=
{
formatRp
(
this
.
state
.
currency
,
this
.
state
.
totalCheckout
+
(
this
.
state
.
delivery
==
null
?
0
:
this
.
state
.
delivery
.
rate_value
)
)}
type
=
{
'bold'
}
style
=
{{
color
:
'#4cc9f0'
}}
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
@@ -286,10 +300,10 @@ class CheckOutScreen extends Component {
...
@@ -286,10 +300,10 @@ class CheckOutScreen extends Component {
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
}}
>
<
View
style
=
{{
width
:
'60%'
}}
>
<
View
style
=
{{
width
:
'60%'
}}
>
<
BaseText
text
=
{
"Total"
}
type
=
{
"bold"
}
style
=
{{
opacity
:
.
5
,
fontSize
:
12
}}
/
>
<
BaseText
text
=
{
"Total"
}
type
=
{
"bold"
}
style
=
{{
opacity
:
.
5
,
fontSize
:
12
}}
/
>
<
BaseText
text
=
{
formatRp
(
this
.
state
.
currency
,
this
.
state
.
totalCheckout
)}
type
=
{
"bold"
}
style
=
{{
opacity
:
.
8
,
color
:
'#4cc9f0'
}}
/
>
<
BaseText
text
=
{
formatRp
(
this
.
state
.
currency
,
this
.
state
.
totalCheckout
+
(
this
.
state
.
delivery
==
null
?
0
:
this
.
state
.
delivery
.
rate_value
)
)}
type
=
{
"bold"
}
style
=
{{
opacity
:
.
8
,
color
:
'#4cc9f0'
}}
/
>
<
/View
>
<
/View
>
<
View
style
=
{{
width
:
'40%'
}}
>
<
View
style
=
{{
width
:
'40%'
}}
>
<
BaseButton
text
=
{
'Buat Pesanan'
}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'CheckOutScreen'
)}
fontSizeText
=
{
14
}
/
>
<
BaseButton
text
=
{
'Buat Pesanan'
}
onPress
=
{()
=>
this
.
createOrder
(
)}
fontSizeText
=
{
14
}
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
...
App/Containers/DetailOrderScreen.js
View file @
d54cf77d
...
@@ -10,17 +10,25 @@ import BaseHeader from '../Components/BaseHeader'
...
@@ -10,17 +10,25 @@ import BaseHeader from '../Components/BaseHeader'
import
BaseText
from
'../Components/BaseText'
import
BaseText
from
'../Components/BaseText'
import
{
Images
}
from
'../Themes'
import
{
Images
}
from
'../Themes'
import
BaseButton
from
'../Components/BaseButton'
import
BaseButton
from
'../Components/BaseButton'
import
Api
from
'../Services/Api'
import
moment
from
'moment'
;
class
DetailOrderScreen
extends
Component
{
class
DetailOrderScreen
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
orderId
:
this
.
props
.
navigation
.
state
.
params
.
orderId
,
dataOrder
:
null
}
}
backAction
=
()
=>
{
backAction
=
()
=>
{
this
.
props
.
navigation
.
goBack
()
this
.
props
.
navigation
.
goBack
()
return
true
;
return
true
;
};
};
componentDidMount
()
{
componentDidMount
()
{
// alert('sadap')
this
.
getDetailOrder
()
// alert(JSON.stringify(this.props.navigation))
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
}
}
...
@@ -28,16 +36,25 @@ class DetailOrderScreen extends Component {
...
@@ -28,16 +36,25 @@ class DetailOrderScreen extends Component {
BackHandler
.
removeEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
BackHandler
.
removeEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
}
}
getDetailOrder
()
{
Api
.
create
().
getDetailOrder
(
this
.
state
.
orderId
).
then
((
response
)
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
dataOrder
:
response
.
data
.
data
})
}
console
.
log
(
'ini data nya'
,
moment
(
response
.
data
.
data
.
order_date
).
format
(
'LLL'
))
})
}
render
()
{
render
()
{
return
(
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#4cc9f0'
}}
>
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#4cc9f0'
}}
>
<
BaseHeader
leftText
=
{
'No. Order 123456'
}
onBackPress
=
{
this
.
backAction
}
/
>
<
BaseHeader
leftText
=
{
`No. Order {}`
}
onBackPress
=
{
this
.
backAction
}
/
>
<
ScrollView
style
=
{[
styles
.
scrollContent
]}
>
<
ScrollView
style
=
{[
styles
.
scrollContent
]}
>
{
/* Tanggal */
}
{
/* Tanggal */
}
<
View
style
=
{{
padding
:
15
,
borderRadius
:
10
,
elevation
:
5
,
backgroundColor
:
'white'
,
marginVertical
:
20
,
marginHorizontal
:
5
}}
>
<
View
style
=
{{
padding
:
15
,
borderRadius
:
10
,
elevation
:
5
,
backgroundColor
:
'white'
,
marginVertical
:
20
,
marginHorizontal
:
5
}}
>
<
BaseText
text
=
{
"Tanggal"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
10
,
color
:
'#4b4b4b'
,
opacity
:
.
7
}}
/
>
<
BaseText
text
=
{
"Tanggal"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
10
,
color
:
'#4b4b4b'
,
opacity
:
.
7
}}
/
>
<
BaseText
text
=
{
"18 Juli 2020, 10:38 AM"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
12
,
opacity
:
.
9
}}
/
>
<
BaseText
text
=
{
this
.
state
.
dataOrder
==
null
?
''
:
`
${
moment
(
String
(
this
.
state
.
dataOrder
.
order_date
).
substr
(
0
,
10
)).
format
(
'DD MMMM YYYY'
)}
,
${
moment
(
String
(
this
.
state
.
dataOrder
.
order_date
).
substr
(
11
,
19
)).
format
(
'LT'
)}
`
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
12
,
opacity
:
.
9
}}
/
>
<
View
style
=
{{
marginVertical
:
10
,
height
:
1
,
width
:
'100%'
,
backgroundColor
:
'#d8d8d8'
}}
/
>
<
View
style
=
{{
marginVertical
:
10
,
height
:
1
,
width
:
'100%'
,
backgroundColor
:
'#d8d8d8'
}}
/
>
<
BaseText
text
=
{
"Status Pesanan"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
10
,
color
:
'#4b4b4b'
,
opacity
:
.
7
}}
/
>
<
BaseText
text
=
{
"Status Pesanan"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
10
,
color
:
'#4b4b4b'
,
opacity
:
.
7
}}
/
>
<
BaseText
text
=
{
"MENUNGGU KONFIRMASI"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
12
,
opacity
:
.
9
}}
/
>
<
BaseText
text
=
{
"MENUNGGU KONFIRMASI"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
12
,
opacity
:
.
9
}}
/
>
...
...
App/Containers/ListAddressScreen.js
View file @
d54cf77d
...
@@ -45,6 +45,7 @@ class ListAddressScreen extends Component {
...
@@ -45,6 +45,7 @@ class ListAddressScreen extends Component {
this
.
setState
({
this
.
setState
({
data
:
response
.
data
.
data
data
:
response
.
data
.
data
})
})
console
.
log
(
response
.
data
.
data
)
}
else
{
}
else
{
this
.
setState
({
data
:
[]
})
this
.
setState
({
data
:
[]
})
}
}
...
...
App/Containers/MyOrderScreen.js
View file @
d54cf77d
This diff is collapsed.
Click to expand it.
App/Services/Api.js
View file @
d54cf77d
...
@@ -76,7 +76,14 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
...
@@ -76,7 +76,14 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
const
topUpWallet
=
(
body
)
=>
api
.
post
(
'topup_wallet'
,
body
)
const
topUpWallet
=
(
body
)
=>
api
.
post
(
'topup_wallet'
,
body
)
const
getPaymentMethod
=
()
=>
api
.
get
(
'get_payment_method'
)
const
getPaymentMethod
=
()
=>
api
.
get
(
'get_payment_method'
)
// Order
const
createOrder
=
(
body
)
=>
api
.
post
(
'create_order'
,
body
)
const
getOrder
=
(
body
)
=>
api
.
post
(
'get_order'
,
body
)
const
getDetailOrder
=
(
orderId
)
=>
api
.
get
(
`detail_order/
${
orderId
}
`
)
const
cancelOrder
=
(
body
)
=>
api
.
post
(
'cancel_order'
,
body
)
const
getCancelReasonOrder
=
()
=>
api
.
get
(
'get_cancelling_reason'
)
const
getOrderStatus
=
()
=>
api
.
get
(
'get_order_status'
)
// Courier
// Courier
const
getCategoryCourier
=
()
=>
api
.
get
(
'get_category_courier'
)
const
getCategoryCourier
=
()
=>
api
.
get
(
'get_category_courier'
)
const
getEstimateCourier
=
(
rateId
)
=>
api
.
get
(
`get_estimate_courier/
${
rateId
}
`
)
const
getEstimateCourier
=
(
rateId
)
=>
api
.
get
(
`get_estimate_courier/
${
rateId
}
`
)
...
@@ -197,6 +204,12 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
...
@@ -197,6 +204,12 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
readAllNotification
,
readAllNotification
,
getEstimateCourier
,
getEstimateCourier
,
getEstimateDelivery
,
getEstimateDelivery
,
createOrder
,
getOrder
,
getDetailOrder
,
cancelOrder
,
getCancelReasonOrder
,
getOrderStatus
,
}
}
}
}
...
...
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