Commit b165c5d6 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo
parents 253af2af c5f58433
...@@ -228,21 +228,41 @@ class ShoppingCart extends React.Component { ...@@ -228,21 +228,41 @@ class ShoppingCart extends React.Component {
// console.log(val) // console.log(val)
if (val == 'balance') { if (val == 'balance') {
if (this.props.type_pickup == true) { if (this.props.type_pickup == true) {
this.setState({ if (this.props.value_voucher == '') {
checkedBalance: true, this.setState({
checkedPoint: false, checkedBalance: true,
checkedBalancePoint: false, checkedPoint: false,
balanceused: Math.max(0, this.props.order_total - this.props.voucher.reward.value), checkedBalancePoint: false,
pointsused: 0 balanceused: this.props.order_total,
}) pointsused: 0
})
} else {
this.setState({
checkedBalance: true,
checkedPoint: false,
checkedBalancePoint: false,
balanceused: Math.max(0, this.props.order_total - this.props.voucher.reward.value),
pointsused: 0
})
}
} else { } else {
this.setState({ if (this.props.value_voucher == '') {
checkedBalance: true, this.setState({
checkedPoint: false, checkedBalance: true,
checkedBalancePoint: false, checkedPoint: false,
balanceused: Math.max(0, this.props.order_total - this.props.voucher.reward.value + this.props.grabamount), checkedBalancePoint: false,
pointsused: 0 balanceused: Math.max(0, this.props.order_total + this.props.grabamount),
}) pointsused: 0
})
} else {
this.setState({
checkedBalance: true,
checkedPoint: false,
checkedBalancePoint: false,
balanceused: Math.max(0, this.props.order_total - this.props.voucher.reward.value + this.props.grabamount),
pointsused: 0
})
}
} }
} else if (val == 'point') { } else if (val == 'point') {
if (this.props.type_pickup == true) { if (this.props.type_pickup == true) {
...@@ -666,10 +686,15 @@ class ShoppingCart extends React.Component { ...@@ -666,10 +686,15 @@ class ShoppingCart extends React.Component {
</View> </View>
) : ( ) : (
<View style={{ marginTop: 15, paddingRight: 30, paddingTop: 10, alignItems: 'flex-end' }}> <View style={{ marginTop: 15, paddingRight: 30, paddingTop: 10, alignItems: 'flex-end' }}>
{this.props.order_item.length ? ( {/* {this.props.order_item.length ? (
<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' }}>{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> <Text style={{ fontSize: 35, color: '#ccb46c' }}>{this.props.order_total + this.state.diskon}</Text>
)} */}
{this.props.value_voucher == '' ? (
<Text style={{ fontSize: 35, color: '#ccb46c' }}>{this.props.order_total + this.props.grabamount}</Text>
) : (
<Text style={{ fontSize: 35, color: '#ccb46c' }}>{Math.max(0, this.props.order_total - this.props.voucher.reward.value + this.props.grabamount)}</Text>
)} )}
</View> </View>
......
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