Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 708a1f8

Browse files
authored
Merge pull request #186 from FlowzPlatform/Feature-implement-chargebee-subscription
Update UI and other issue solved
2 parents 0904c7e + 269bd5b commit 708a1f8

File tree

3 files changed

+357
-306
lines changed

3 files changed

+357
-306
lines changed

src/components/checkout.vue

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@
22
<Row class="setMiddle" type="flex" justify="center" align="middle">
33
<Col span="16" push="2">
44
<div class="third " v-for="(item, index) in mainData">
5-
<h3 class="type-header" v-if="item.object == 'plan' && basicPlan != undefined">Basic</h3>
6-
<h3 class="type-header" v-if="item.object == 'addon'">Add-on</h3>
7-
<section class="plan-tier lift">
5+
<h3 class="type-header" v-if="item.object == 'plan' && basicPlan != undefined">Basic</h3>
6+
<h3 class="type-header" v-if="item.object == 'addon'">Add-on</h3>
7+
<section class="plan-tier lift">
88
<h4>{{item.name.toUpperCase()}}</h4>
9-
<h5><sup class="superscript">US$</sup><span class="plan-price">{{item.price}}</span>
9+
<h5>
10+
<sup class="superscript">US$</sup><span class="plan-price">{{item.price}}</span>
1011
<sub><div v-if="item.validity > 1">
11-
<p>{{item.validity}} months</p>
12-
</div>
13-
<div v-else="item.validity > 1">
14-
<p>/mo</p>
15-
</div>
12+
<p>{{item.validity}} months</p>
13+
</div>
14+
<div v-else="item.validity > 1">
15+
<p>/mo</p>
16+
</div>
1617
</sub>
1718
</h5>
1819
<ul>
1920
<li v-for="itemDec in item.description"><strong>{{itemDec}}</strong></li>
2021
</ul>
21-
</section>
22-
<div class="plus" v-if="mainData.length > 0 && index !== (mainData.length -1)">
23-
<i class="fa fa-plus-circle"></i>
22+
</section>
23+
<div class="plus" v-if="mainData.length > 0 && index !== (mainData.length -1)">
24+
<i class="fa fa-plus-circle"></i>
25+
</div>
2426
</div>
25-
</div>
2627
</Col>
2728
<Col span="8" pull="6">
2829
<div class="panel panel-custom">
@@ -101,7 +102,10 @@
101102
<div class="panel-footer">
102103
<Row type="flex" justify="space-around">
103104
<Col span="5">
104-
<p v-if="mainData[1]" class="sv-card">PAY {{ mainData[1].price }} USD</p>
105+
<p v-if="mainData[1]" class="pay-info">PAY {{ mainData[1].price * mainData[0].period }} USD
106+
<Poptip slot="append" trigger="hover" title="Pay Info" placement="bottom" :content="'Basic Plan Validity Multiply By Addon Price( ' + mainData[0].period + ' * ' + mainData[1].price + ' = ' + mainData[1].price * mainData[0].period + ' )'">
107+
<Icon type="help-circled"></Icon>
108+
</Poptip></p>
105109
</Col>
106110
<Col span="6">
107111
<!-- set attribute to Col span="16" offset="4"
@@ -284,7 +288,8 @@ export default {
284288
],
285289
expiryYear: [],
286290
userDetails: null,
287-
savedCard: false
291+
savedCard: false,
292+
loadingPlans: true
288293
}
289294
},
290295
async mounted () {
@@ -293,7 +298,22 @@ export default {
293298
let arry = [];
294299
295300
this.sub_id = this.$route.params.id;
296-
301+
this.$Spin.show({
302+
render: (h) => {
303+
return h('div', [
304+
h('Icon', {
305+
style: {
306+
animation: 'ani-demo-spin 1s linear infinite'
307+
},
308+
props: {
309+
type: 'load-c',
310+
size: 24
311+
}
312+
}),
313+
h('div','Processing Your Request.')
314+
])
315+
}
316+
});
297317
self.userDetails = await this.getUserDetails()
298318
if (this.basicPlan != undefined) {
299319
data.push(await this.getPlanDetails(this.basicSubId));
@@ -309,10 +329,12 @@ export default {
309329
self.payDetail.expiryMM = res.data.card.expiry_month;
310330
self.payDetail.expiryYY = res.data.card.expiry_year;
311331
self.payDetail.cardType = res.data.card.card_type;
332+
self.$Spin.hide();
312333
} else {
313334
if (res.data.api_error_code == 'resource_not_found') {
314335
self.savedCard = false
315336
}
337+
self.$Spin.hide();
316338
}
317339
// console.log('Res of customer details', res)
318340
}).catch(err => {
@@ -594,15 +616,15 @@ export default {
594616
self.payloading = false;
595617
}).catch(err => {
596618
self.updatePayMessage('alert alert-danger', 'Error..! ', null);
597-
console.log('Error while sub for customer:: ', err);
619+
console.log('Error while subscribeCbAddon() ', err);
598620
self.payloading = false;
599621
});
600622
},
601623
getUserDetails() {
602624
return userDetails.get().then(res => {
603625
return res.data.data;
604626
}).catch(err => {
605-
console.log('>>>>Error in user details', err);
627+
console.log('Error while getUserDetails() ', err);
606628
return err;
607629
});
608630
},
@@ -629,7 +651,7 @@ export default {
629651
},
630652
subscriptionDone(res) {
631653
let self = this;
632-
console.log('FINAL RES>>', res)
654+
// console.log('FINAL RES>>', res)
633655
self.updatePayMessage('alert alert-success', 'Success..! ', 'Successfully purchased.');
634656
Cookies.set('welcomeMsg', 'Thanks You For Subscribing...!');
635657
self.$Notice.success({
@@ -678,6 +700,10 @@ export default {
678700
font-size: 16px;
679701
font-weight: bold;
680702
}
703+
.pay-info {
704+
font-size: 14px;
705+
font-weight: bold;
706+
}
681707
.pay-icon {
682708
width: 55px;
683709
padding: 5px;

src/components/create-plan.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ export default {
395395
self.addonData = res;
396396
});
397397
}).catch(err => {
398-
console.log('Error Addon : ', err)
398+
console.log('Error Addon : ', err);
399399
});
400400
this.showOverlay = false;
401401
}).catch(err => {
@@ -548,13 +548,13 @@ export default {
548548
})
549549
self.defaultPlan.details = data5
550550
}).catch(function (error) {
551-
console.log('ERROR:::', error)
551+
console.log('Error while getting register resource', error);
552552
self.$Notice.error({
553553
duration: 5,
554554
title: 'Trying to create subscription plan',
555555
desc: 'Please try again ' + err
556556
})
557-
})
557+
});
558558
let convertedPrice = self.defaultPlan.price * 100
559559
let id = uuidv1();
560560
let planDefinition = {
@@ -576,7 +576,8 @@ export default {
576576
this.createCbAddon(planDefinition)
577577
}
578578
// console.log('>>>>>>>>>>>>>...', planDefinition)
579-
// OLD CODE FOR SUBSCRIPTION
579+
580+
// OLD CODE FOR SUBSCRIPTION
580581
/* subscriptionPlans.post(self.defaultPlan).then(res => {
581582
self.$Notice.success({
582583
title: '<b>New Plan</b>',
@@ -644,7 +645,7 @@ export default {
644645
this.process.cursor = 'progress!important'
645646
let self = this
646647
let dataObj = this.plans[index]
647-
console.log('Addon Data::', dataObj.price);
648+
console.log('Updating Addon Data: ', dataObj.price);
648649
if (dataObj.name == '') {
649650
this.$Notice.error({
650651
duration: 5,

0 commit comments

Comments
 (0)