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
88b6ccb8
Commit
88b6ccb8
authored
Jul 27, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
15cb4e61
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 @
88b6ccb8
...
...
@@ -10,6 +10,8 @@ import BaseText from '../Components/BaseText'
import
Ionicons
from
'react-native-vector-icons/Ionicons'
import
firebase
from
'@react-native-firebase/app'
import
messaging
from
'@react-native-firebase/messaging'
;
import
moment
from
'moment'
;
import
momentId
from
'moment/locale/id'
;
// create our store
const
store
=
createStore
()
...
...
@@ -81,6 +83,7 @@ class App extends Component {
componentDidMount
()
{
this
.
checkPermission
()
this
.
fetchToken
()
moment
.
updateLocale
(
'id'
,
momentId
)
}
checkPermission
=
async
()
=>
{
...
...
App/Containers/CartScreen.js
View file @
88b6ccb8
...
...
@@ -18,6 +18,7 @@ import Constant from '../Lib/Constant';
import
Toast
from
'react-native-toast-message'
;
import
{
BarIndicator
}
from
'react-native-indicators'
;
import
FontAwesome
from
'react-native-vector-icons/FontAwesome'
import
{
NavigationEvents
}
from
'react-navigation'
;
class
CartScreen
extends
Component
{
constructor
(
props
)
{
...
...
@@ -252,6 +253,10 @@ class CartScreen extends Component {
render
()
{
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#4cc9f0'
}}
>
<
NavigationEvents
onDidFocus
=
{()
=>
{
this
.
getCurrency
()
this
.
getCart
()
}}
/
>
<
BaseHeader
onBackPress
=
{()
=>
this
.
props
.
navigation
.
goBack
()}
leftText
=
{
'Keranjang'
}
/
>
{
this
.
state
.
loading
?
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'white'
,
borderTopLeftRadius
:
32
,
borderTopRightRadius
:
32
}}
>
<
BarIndicator
count
=
{
5
}
color
=
'#4cc9f0'
size
=
{
25
}
/
>
...
...
App/Containers/CheckOutScreen.js
View file @
88b6ccb8
...
...
@@ -28,6 +28,7 @@ class CheckOutScreen extends Component {
dataCheckout
:
[],
totalCheckout
:
0
,
delivery
:
null
,
diskon
:
0
,
paymentMethod
:
null
}
}
...
...
@@ -74,6 +75,7 @@ class CheckOutScreen extends Component {
refreshScreen
()
{
this
.
getAddress
()
this
.
getCurrency
()
console
.
log
(
'ini data delivery'
,
this
.
state
.
delivery
)
}
async
getCurrency
()
{
...
...
@@ -95,6 +97,7 @@ class CheckOutScreen extends Component {
createOrder
()
{
let
payloadCart
=
[]
let
diskon
=
0
this
.
state
.
dataCheckout
.
map
((
item
,
index
)
=>
{
payloadCart
.
push
({
"cart_id"
:
item
.
cart_id
,
...
...
@@ -105,20 +108,31 @@ class CheckOutScreen extends Component {
"total_price"
:
item
.
total_price
,
"cart_date"
:
null
})
diskon
+=
item
.
discount_price
})
let
payload
=
{
"address_id"
:
this
.
state
.
address
.
address_id
,
"payment_method"
:
1
,
"delivery_charge"
:
"1000"
,
"is_wallet"
:
0
,
"payment_method"
:
this
.
state
.
paymentMethod
.
payment_method_id
,
"delivery_charge"
:
this
.
state
.
delivery
.
rate_value
,
"is_wallet"
:
this
.
state
.
paymentMethod
.
payment_method_name
==
'Wallet'
?
1
:
0
,
"coupon_id"
:
null
,
"coupon_discount"
:
null
,
"discount"
:
1000
,
"discount"
:
diskon
,
"lat"
:
this
.
state
.
address
.
lat
,
"long"
:
this
.
state
.
address
.
l
o
ng
,
"long"
:
this
.
state
.
address
.
lng
,
"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
()
{
...
...
@@ -270,11 +284,11 @@ class CheckOutScreen extends Component {
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
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
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
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
>
...
...
@@ -286,10 +300,10 @@ class CheckOutScreen extends Component {
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
}}
>
<
View
style
=
{{
width
:
'60%'
}}
>
<
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
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
>
...
...
App/Containers/DetailOrderScreen.js
View file @
88b6ccb8
...
...
@@ -10,17 +10,25 @@ import BaseHeader from '../Components/BaseHeader'
import
BaseText
from
'../Components/BaseText'
import
{
Images
}
from
'../Themes'
import
BaseButton
from
'../Components/BaseButton'
import
Api
from
'../Services/Api'
import
moment
from
'moment'
;
class
DetailOrderScreen
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
orderId
:
this
.
props
.
navigation
.
state
.
params
.
orderId
,
dataOrder
:
null
}
}
backAction
=
()
=>
{
this
.
props
.
navigation
.
goBack
()
return
true
;
};
componentDidMount
()
{
// alert('sadap')
// alert(JSON.stringify(this.props.navigation))
this
.
getDetailOrder
()
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
}
...
...
@@ -28,16 +36,25 @@ class DetailOrderScreen extends Component {
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
()
{
return
(
<
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
]}
>
{
/* Tanggal */
}
<
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
=
{
"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'
}}
/
>
<
BaseText
text
=
{
"Status Pesanan"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
10
,
color
:
'#4b4b4b'
,
opacity
:
.
7
}}
/
>
<
BaseText
text
=
{
"MENUNGGU KONFIRMASI"
}
type
=
{
"regular"
}
style
=
{{
fontSize
:
12
,
opacity
:
.
9
}}
/
>
...
...
App/Containers/ListAddressScreen.js
View file @
88b6ccb8
...
...
@@ -45,6 +45,7 @@ class ListAddressScreen extends Component {
this
.
setState
({
data
:
response
.
data
.
data
})
console
.
log
(
response
.
data
.
data
)
}
else
{
this
.
setState
({
data
:
[]
})
}
...
...
App/Containers/MyOrderScreen.js
View file @
88b6ccb8
This diff is collapsed.
Click to expand it.
App/Services/Api.js
View file @
88b6ccb8
...
...
@@ -76,7 +76,14 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
const
topUpWallet
=
(
body
)
=>
api
.
post
(
'topup_wallet'
,
body
)
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
const
getCategoryCourier
=
()
=>
api
.
get
(
'get_category_courier'
)
const
getEstimateCourier
=
(
rateId
)
=>
api
.
get
(
`get_estimate_courier/
${
rateId
}
`
)
...
...
@@ -197,6 +204,12 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
readAllNotification
,
getEstimateCourier
,
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