Commit eed0973c authored by Trisno's avatar Trisno

checkout order

parent 630880ee
import React from 'react'; import React from 'react';
import { View, Text, TextInput, StyleSheet, Button, ScrollView } from 'react-native'; import { View, Text, Alert, TextInput, StyleSheet, Button, ScrollView } from 'react-native';
import Axios from 'axios' import Axios from 'axios'
import { connect } from 'react-redux' import { connect } from 'react-redux'
class MenuConfirmation extends React.Component { class MenuConfirmation extends React.Component {
...@@ -16,8 +16,31 @@ class MenuConfirmation extends React.Component { ...@@ -16,8 +16,31 @@ class MenuConfirmation extends React.Component {
} }
} }
setOrder() {
let params = {
session_id : this.props.session_id,
outlet_id : this.props.outlet_id,
address_id : this.props.addressId,
trans_type: "Delivery",
order_item: this.props.order_item,
delivery_charge: this.state.ongkir,
voucher: [],
payment: {
balance: this.props.route.params.balanceUsed,
point: this.props.route.params.pointused
}
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/transaction/booking', params).then(res => {
console.log(res)
}).catch(error => {
let response = error.response.data;
Alert.alert(response.msg);
})
}
render() { render() {
console.log(this.props) // console.log(this.props)
let total = 0 let total = 0
return ( return (
<ScrollView style={styles.container}> <ScrollView style={styles.container}>
...@@ -96,7 +119,7 @@ class MenuConfirmation extends React.Component { ...@@ -96,7 +119,7 @@ class MenuConfirmation extends React.Component {
</View> </View>
</View> </View>
<View style={{ margin: 10 }}> <View style={{ margin: 10 }}>
<Button title='order'/> <Button title='order' onPress={this.setOrder()}/>
</View> </View>
</ScrollView> </ScrollView>
) )
...@@ -136,7 +159,8 @@ const mapStateToProps = (state) => { ...@@ -136,7 +159,8 @@ const mapStateToProps = (state) => {
order_total: state.order_total, order_total: state.order_total,
order_item: state.order_item, order_item: state.order_item,
quantity: state.quantity, quantity: state.quantity,
address: state.address address: state.address,
addressId: state.addressId
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment