giveMemberPayment.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div class="chioseWrap">
  3. <p>您将为<span>{{tableList.length}}</span>位学员激活团练宝<br />共需支付<span>{{ selectStudentMoney | moneyFormat }}</span>元</p>
  4. <p>请扫描二维码支付,支付功能后学员团练宝即刻激活</p>
  5. <vue-qr :text="codeUrl" style="width: 250px" :margin="0"></vue-qr>
  6. </div>
  7. </template>
  8. <script>
  9. import VueQr from 'vue-qr'
  10. import { cloudPayCheck } from '../api'
  11. export default {
  12. props: {
  13. tableList: {
  14. type: Array,
  15. default: []
  16. },
  17. orderNo: {
  18. type: String
  19. },
  20. codeUrl: {
  21. type: String
  22. },
  23. },
  24. components: { VueQr },
  25. data() {
  26. return {
  27. payForm: {
  28. payType: null,
  29. },
  30. selectStudentMoney: 0, // 选中学生金额
  31. orderTimer: null
  32. };
  33. },
  34. async mounted() {
  35. let tableList = this.tableList || []
  36. for(let i of tableList) {
  37. this.selectStudentMoney += parseFloat(i.amount)
  38. }
  39. this.initTimer = setTimeout(() => {
  40. this.getPaymentStatus()
  41. }, 3000)
  42. },
  43. methods: {
  44. async getPaymentStatus() {
  45. this.orderTimer = setInterval(async () => {
  46. try {
  47. const res = await cloudPayCheck({ orderNo: this.orderNo })
  48. if(res.data) {
  49. clearInterval(this.orderTimer)
  50. clearTimeout(this.initTimer)
  51. this.$message.success('您已成功缴费')
  52. this.$listeners.getList()
  53. this.$emit('close', true)
  54. }
  55. } catch(e) {
  56. clearInterval(this.orderTimer)
  57. }
  58. }, 5000);
  59. }
  60. },
  61. beforeDestroy() {
  62. clearTimeout(this.initTimer)
  63. clearInterval(this.orderTimer)
  64. }
  65. };
  66. </script>
  67. <style lang="less" scoped>
  68. .chioseWrap {
  69. text-align: center;
  70. font-size: 16px;
  71. > p {
  72. font-weight: 600;
  73. padding-bottom: 15px;
  74. line-height: 1.5;
  75. span {
  76. color: red;
  77. padding: 0 3px;
  78. }
  79. }
  80. }
  81. .dialog-footer {
  82. text-align: right;
  83. display: block;
  84. padding-top: 15px;
  85. }
  86. </style>