ach.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <div class="ach">
  3. <div class="loading">
  4. <img src="../../static/img/icon_refresh.svg" />
  5. </div>
  6. <form ref="formDom" :action="formData.actionUrl" method="post" id="submitForm">
  7. <input type="hidden" name="callbackUrl" :value="formData.callbackUrl">
  8. <input type="hidden" name="currency" :value="formData.currency">
  9. <input type="hidden" name="merType" :value="formData.merType">
  10. <input type="hidden" name="merchantNo" :value="formData.merchantNo">
  11. <input type="hidden" name="merchantOrderNo" :value="formData.merchantOrderNo">
  12. <input type="hidden" name="noticeUrl" :value="formData.noticeUrl">
  13. <input type="hidden" name="orderAmount" :value="formData.orderAmount">
  14. <input type="hidden" name="productDetail" :value="formData.productDetail">
  15. <input type="hidden" name="sign" :value="formData.sign">
  16. <input type="hidden" name="timeStamp" :value="formData.timeStamp">
  17. <input type="hidden" name="version" :value="formData.version">
  18. </form>
  19. </div>
  20. </template>
  21. <script>
  22. import { postRequest } from '../../http/index';
  23. import Api from '../../http/api';
  24. import { getStorage, storageKey } from '../../utils/help';
  25. export default {
  26. name: 'ach',
  27. data() {
  28. return {
  29. formData: {},
  30. isFirstEnter: true,
  31. }
  32. },
  33. mounted() {
  34. this.getPayInfo()
  35. let url = getStorage(storageKey.paymentUrl);
  36. if (this.isFirstEnter === false && url) {
  37. window.location.href = url;
  38. }
  39. },
  40. methods: {
  41. getPayInfo() {
  42. let amountValue = this.$route.params.amount;
  43. if (amountValue) {
  44. postRequest(Api.usdRechargeRequestByAchpay, {
  45. params: {
  46. amountValue: amountValue
  47. }
  48. }).then(res => {
  49. if(res.code == 0) {
  50. this.formData = res.data;
  51. this.isFirstEnter = false;
  52. this.$nextTick(() => {
  53. this.$refs.formDom.submit();
  54. })
  55. }
  56. })
  57. }
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. html,
  64. body,
  65. #__nuxt,
  66. #__layout {
  67. width: 100%;
  68. height: 100%;
  69. padding: 0;
  70. margin: 0;
  71. overflow: hidden;
  72. }
  73. .ach {
  74. display: flex;
  75. align-items: center;
  76. justify-content: center;
  77. width: 100%;
  78. height: 100%;
  79. }
  80. .loading {
  81. width: 50px;
  82. height: 50px;
  83. img {
  84. width: 100%;
  85. height: 100%;
  86. animation: rotate 1s infinite linear;
  87. }
  88. }
  89. @keyframes rotate {
  90. 0% {
  91. transform: rotate(0);
  92. }
  93. 100% {
  94. transform: rotate(360deg);
  95. }
  96. }
  97. </style>