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

Commit

Permalink
feat(pay): (#540) 全局打赏密码确认
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Oct 12, 2018
1 parent 7e6f936 commit 028bbf7
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/components/reward.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,26 @@
<button
:disabled="disabled || loading"
class="m-long-btn m-signin-btn"
@click="handleOk">
@click="showPasswordConfirm">
<circle-loading v-if="loading"/>
<span v-else>确定</span>
</button>
</div>
</main>

<password-confirm ref="password" @submit="reward" />

</div>
</transition>
</template>

<script>
import { noop } from "@/util";
import PasswordConfirm from "@/components/common/PasswordConfirm.vue";
export default {
name: "Reward",
components: { PasswordConfirm },
data() {
return {
show: false,
Expand Down Expand Up @@ -108,27 +113,28 @@ export default {
});
},
methods: {
reward() {
showPasswordConfirm() {
this.$refs.password.show();
},
reward(password) {
if (this.loding || !this.type) return;
this.loading = true;
const params = {
amount: ~~this.amount
const data = {
amount: ~~this.amount,
password
};
this.api(this.payload, params)
this.api(this.payload, data)
.then(() => {
this.loading = false;
this.$Message.success("打赏成功");
this.callback(params.amount);
this.callback(data.amount);
this.$nextTick(this.cancel);
})
.catch(({ response: { data: message } }) => {
message && this.$Message.error(message);
this.loading = false;
});
},
handleOk() {
this.reward();
},
chooseDefaultAmount(amount) {
this.customAmount && (this.customAmount = null);
this.amount = amount;
Expand Down

0 comments on commit 028bbf7

Please sign in to comment.