perfect voucher

This commit is contained in:
enggar_ganteng 2019-01-06 18:45:24 +07:00
parent 21c56ad40f
commit aa2163eac5
3 changed files with 11 additions and 13 deletions

View File

@ -93,7 +93,7 @@ export default class CheckoutVouchers extends React.Component {
<h3>Point :</h3>
</div>
<div className="col s12 m6 6">
<h3 style={{color:'#FF6F00'}}>{this.vouchersStore.skuPrice} Points</h3>
<h3 style={{color:'#FF6F00'}}>{(+this.vouchersStore.skuPrice).toFixed(0)} Points</h3>
</div>
</Row>
</div>
@ -113,7 +113,7 @@ export default class CheckoutVouchers extends React.Component {
<div className="row">
<div style={{display:'flex',justifyContent:'space-between'}}>
<h3>Total Pembayaran Point</h3>
<h3 style={{color:'#FF6F00'}}>{this.vouchersStore.skuPrice} Points</h3>
<h3 style={{color:'#FF6F00'}}>{(+this.vouchersStore.skuPrice).toFixed(0)} Points</h3>
</div>
</div>
<div className="row">

View File

@ -18,7 +18,8 @@ export default class ModalVouchersComponent extends React.Component {
selectedOption: '',
hidden:'inline',
skuName:'',
skuPrice:'0'
skuPrice:'0',
buttonDisbaled:true
};
this.defaultState = Object.assign({}, this.state);
this.http = props.appstate.http;
@ -94,7 +95,8 @@ export default class ModalVouchersComponent extends React.Component {
console.log(points[0].price,'points',points[0].name);
this.setState({
skuName :points[0].name,
skuPrice : points[0].price
skuPrice : points[0].price,
buttonDisbaled:false
})
}
}
@ -103,7 +105,7 @@ export default class ModalVouchersComponent extends React.Component {
}}
>
{data.sku.map((item, index) => {
return <Option value={item.id}><div style={{display:'flex',justifyContent:'space-between', width:'100%'}}><span>{item.name}</span> <span style={{color:'#FF6F00', display:this.state.hidden}}><NumberFormat value={(item.price)} displayType={'text'} thousandSeparator={true}/> </span></div></Option>
return <Option value={item.id}><div style={{display:'flex',justifyContent:'space-between', width:'100%'}}><span>{item.name}</span> <span style={{color:'#FF6F00', display:this.state.hidden}}><NumberFormat value={(+item.price).toFixed(0)} displayType={'text'} thousandSeparator={true}/> </span></div></Option>
// return <Option value={item.id}>{item.price}</Option>
})}
</Select>
@ -111,7 +113,7 @@ export default class ModalVouchersComponent extends React.Component {
<div className={'costContainerModal'}>
<div className={'costLeftPaneModal'}>
<p className={'costTitleModal'}>Points</p>
<p className={'costValueModal'}><NumberFormat value={(this.state.skuPrice)} displayType={'text'} thousandSeparator={true}/> </p>
<p className={'costValueModal'}><NumberFormat value={(+this.state.skuPrice).toFixed(0)} displayType={'text'} thousandSeparator={true}/> </p>
</div>
<div className={'costRightPaneModal'}>
<Route render={({ history}) => (
@ -124,7 +126,7 @@ export default class ModalVouchersComponent extends React.Component {
history.push(LINKS.VERIFY_VOUCHERS);
}
}
type="primary" size={"large"} block>Buy</Button>
type="primary" disabled={this.state.buttonDisbaled} size={"large"} block>Buy</Button>
)} />
</div>
</div>

View File

@ -46,7 +46,7 @@ export default class PaymentVouchers extends React.Component {
});
};
const price = this.vouchersStore.skuPrice;
const price = (+this.vouchersStore.skuPrice).toFixed(0);
const qty = 1;
const total = price * qty;
@ -128,12 +128,8 @@ export default class PaymentVouchers extends React.Component {
this.vouchersStore.buyVoucher(this.vouchersStore.skuId)
.then(res => {
this.globalUI.hideDialogLoading();
this.props.history.push(LINKS.VOUCHERS)
this.props.history.push(LINKS.TRANSACTION)
openNotificationWithIcon('success')
// this.globalUI.openSnackbar("Success Added New Store");
// this.setState({
// stepIndex: 0
// })
})
.catch(err => {
this.globalUI.openSnackbar(err.message);