Compare commits

..

No commits in common. "e8553ea12fde66a624ac582111a1d2173221ab67" and "4a7dfe6d52efe43748445311e3c39967186e4ccb" have entirely different histories.

2 changed files with 19 additions and 67 deletions

View File

@ -199,7 +199,7 @@ class DashboardComponent extends React.Component {
Voucher Voucher
</Typography> </Typography>
<Typography component="p"> <Typography component="p">
<NumberFormat value={(this.props.appstate.wallet.data.wallet).toFixed(2)} displayType={'text'} thousandSeparator={true} prefix={'Rp '} /> <NumberFormat value={(0).toFixed(2)} displayType={'text'} thousandSeparator={true} prefix={'Rp '} />
</Typography> </Typography>
</MuiCardContent> </MuiCardContent>
<MuiCardActions> <MuiCardActions>
@ -330,8 +330,7 @@ class DashboardComponent extends React.Component {
style={{ marginTop: 15 }}> style={{ marginTop: 15 }}>
{(this.vouchersStore.list.length > 0) ? {(this.vouchersStore.list.length > 0) ?
this.vouchersStore.list.map((item, index) => { this.vouchersStore.list.map((item, index) => {
console.log("itemm", item) let image = get(item, 'images.logo', '');
let image = get(item, 'images.main', '');
if (!image.includes('http')) { if (!image.includes('http')) {
image = this.http.appendImagePath(image); image = this.http.appendImagePath(image);

View File

@ -19,56 +19,13 @@ export default class ModalTopupComponent extends React.Component {
inputCode2: '', inputCode2: '',
inputCode3: '', inputCode3: '',
inputCode4: '', inputCode4: '',
confirmLoading: false, confirmLoading: false
onOk: {}
}; };
this.defaultState = Object.assign({}, this.state); this.defaultState = Object.assign({}, this.state);
} }
componentDidMount() {} componentDidMount() {}
redeemCode (code) {
const codeList = [
{
code: 'MLXNAPNU18nd0871',
amount: 10000
},
{
code: 'ABAKO1239KLKHASD',
amount: 20000
},
{
code: 'W54VCZJN23FGSDAG',
amount: 50000
},
{
code: '123456789ABCEFGH',
amount: 100000
}
]
var rightCode = {}
codeList.map((cl) => {
if (cl.code === code){
rightCode = cl
this.props.appstate.wallet.data.wallet = this.props.appstate.wallet.data.wallet + cl.amount
message.success("Voucher redeem success");
this.setState({
confirmLoading: false
});
this.state.onOk()
}else{
this.setState({
confirmLoading: false
});
message.warning("Voucher redeem failed")
}
})
}
render() { render() {
const {data, isVisible = false, onOk = () => {}, onCancel = () => {}, title='Redeem your code'} = this.props; const {data, isVisible = false, onOk = () => {}, onCancel = () => {}, title='Redeem your code'} = this.props;
@ -78,29 +35,25 @@ export default class ModalTopupComponent extends React.Component {
visible={isVisible} visible={isVisible}
onOk={async () => { onOk={async () => {
this.setState({ this.setState({
confirmLoading: true, confirmLoading: true
onOk: onOk()
}); });
let voucherCode = this.state.inputCode1 + this.state.inputCode2 + this.state.inputCode3 + this.state.inputCode4; let voucherCode = this.state.inputCode1 + this.state.inputCode2 + this.state.inputCode3 + this.state.inputCode4;
console.log("voucherCode", voucherCode)
this.redeemCode(voucherCode) try {
await this.props.appstate.wallet.redeemVoucherCode(voucherCode);
// try { this.props.onOk();
// await this.props.appstate.wallet.redeemVoucherCode(voucherCode); message.info("Voucher redeem success");
// this.props.onOk(); } catch (e) {
// message.info("Voucher redeem success"); message.error(e.message);
// } catch (e) { } finally {
// message.error(e.message); this.setState({
// } finally { inputCode1: '',
// this.setState({ inputCode2: '',
// inputCode1: '', inputCode3: '',
// inputCode2: '', inputCode4: '',
// inputCode3: '', confirmLoading: false
// inputCode4: '', });
// confirmLoading: false }
// });
// }
}} }}
onCancel={() => { onCancel={() => {