Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix(pay): (#583) 支付积分前先检查积分余额是否充足
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Oct 15, 2018
1 parent ff44e94 commit 53c95aa
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/components/applyForTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,14 @@ export default {
},
methods: {
showPasswordConfirm() {
if (this.currency < this.amount) {
this.$Message.error("积分不足,请充值");
this.cancel();
return this.$router.push({ name: "currencyRecharge" });
}
this.$refs.password.show();
},
applyTop(password) {
if (this.currency < this.amount) {
this.$router.push({ name: "currencyRecharge" });
return this.cancel();
}
if (this.loading || !this.applyType) return;
this.loading = true;
const params = {
Expand Down
12 changes: 11 additions & 1 deletion src/components/payfor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export default {
(((this.$store.state.CONFIG || {}).site || {}).currency_name || {})
.name || "积分"
);
},
currentCurrency() {
const user = this.$store.state.CURRENTUSER;
return user.currency.sum || 0;
}
},
created: function() {
Expand Down Expand Up @@ -104,6 +108,11 @@ export default {
onCancel() {},
onSuccess() {},
showPasswordConfirm() {
if (this.currentCurrency < this.amount) {
this.$Message.error("积分不足,请充值");
this.cancel();
return this.$router.push({ name: "currencyRecharge" });
}
if (this.node) this.$refs.password.show();
else this.handleOk();
},
Expand All @@ -116,7 +125,8 @@ export default {
this.onSuccess(data);
this.cancel();
})
.catch(() => {
.catch(({ response }) => {
this.$Message.error(response.data);
this.cancel();
})
: this.cancel();
Expand Down
9 changes: 9 additions & 0 deletions src/components/reward.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export default {
},
disabled() {
return !this.amount > 0;
},
currentCurrency() {
const user = this.$store.state.CURRENTUSER;
return user.currency.sum || 0;
}
},
watch: {
Expand Down Expand Up @@ -117,6 +121,11 @@ export default {
},
methods: {
showPasswordConfirm() {
if (this.currentCurrency < this.amount) {
this.$Message.error("积分不足,请充值");
this.cancel();
return this.$router.push({ name: "currencyRecharge" });
}
this.$refs.password.show();
},
reward(password) {
Expand Down
9 changes: 9 additions & 0 deletions src/page/post/PostNews.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ export default {
.name || "积分"
);
},
currentCurrency() {
const user = this.$store.state.CURRENTUSER;
return user.currency.sum || 0;
},
canPostNews() {
return !this.newsVerified || (this.newsVerified && this.verified);
},
Expand Down Expand Up @@ -357,6 +361,11 @@ export default {
});
},
showPasswordConfirm() {
if (this.currentCurrency < this.amount) {
this.$Message.error("积分不足,请充值");
this.cancel();
return this.$router.push({ name: "currencyRecharge" });
}
this.$refs.password.show();
},
handleOk() {
Expand Down

1 comment on commit 53c95aa

@mutoe
Copy link
Contributor Author

@mutoe mutoe commented on 53c95aa Oct 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer #584

Please sign in to comment.