activePay.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div class="activepay">
  3. <div class="coupon-section">
  4. <img v-if="activePrice == 777 || priceList.activePrice" src="../assets/coupon.png" alt="">
  5. <img v-else src="../assets/coupon2.png" alt="">
  6. </div>
  7. <p class="tip">活动详情:充值{{ showPrice }}元抵扣{{ activePrice }}元。20节课原价{{markAmount}}元,抵扣后立减{{ activePrice - showPrice }}元~仅需{{ amount }}元!
  8. <br/>重点:课程不设有效期,最多可购买两期课程;
  9. 名额有限,仅限77席,先到先得,错过一次等一年!</p>
  10. <!-- <p class="tip">活动详情:缴费{{ showPrice }}元立刻享有 {{ activePrice }} 元现金券,仅限购买20次vip课,总价值{{ markAmount }}元;即日起至2019年11月11日 ,名额仅限77名,先到先得。</p> -->
  11. <div style="padding: 0 .25rem">
  12. <div class="btn-group">
  13. <div class="btn" @click="onPromotionPay">
  14. <del>原价:{{ markAmount }}</del>
  15. <p>现仅需:{{ amount }}</p>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. /* eslint-disable */
  23. import branchRule from '@/assets/front_active'
  24. import qs from 'qs'
  25. export default {
  26. name: 'activepay',
  27. data() {
  28. return {
  29. userId: this.$route.query.userId,
  30. branchId: this.$route.query.branchId,
  31. priceList: {},
  32. activePrice: 777,
  33. showPrice: 11.11,
  34. amount: 0,
  35. markAmount: 0
  36. }
  37. },
  38. mounted() {
  39. // 匹配对应的规则
  40. branchRule.forEach(item => {
  41. if(item.branchId == this.branchId) {
  42. this.priceList = item
  43. if(item.branchPrice == 180) {
  44. this.activePrice = 777
  45. this.showPrice = item.activePrice ? item.activePrice : 11.11
  46. }else if(item.branchPrice == 220 || item.branchPrice == 280) {
  47. this.activePrice = 1111
  48. this.showPrice = item.activePrice ? item.activePrice : 111
  49. }
  50. this.markAmount = 20 * item.branchPrice
  51. this.amount = this.markAmount - this.activePrice + parseFloat(this.showPrice)
  52. }
  53. })
  54. if(!this.priceList.branchPrice) {
  55. this.priceList = {
  56. branchId: 1030,
  57. branchName: '武汉分部',
  58. branchType: '一类',
  59. branchPrice: 180
  60. }
  61. this.activePrice = 777
  62. this.showPrice = 11.11
  63. this.markAmount = 20 * this.priceList.branchPrice
  64. this.amount = this.markAmount - this.activePrice + parseFloat(this.showPrice)
  65. }
  66. },
  67. methods: {
  68. onPromotionPay() {
  69. this.$axios.post('/yqpay/promotionPay',
  70. qs.stringify({
  71. userId: this.userId,
  72. branchId: this.branchId,
  73. amount: this.amount
  74. }) ).then(res => {
  75. let result = res.data
  76. if(result.code == 200) {
  77. let f = result.data
  78. document.querySelector('#onSubmit').action = f.host
  79. document.querySelector('#apiContent').value = f.apiContent
  80. document.querySelector('#merNo').value = f.merNo
  81. document.querySelector('#notifyUrl').value = f.notifyUrl
  82. document.querySelector('#sign').value = f.sign
  83. document.querySelector('#signType').value = f.signType
  84. document.querySelector('#timestamp').value = f.timestamp
  85. document.querySelector('#version').value = f.version
  86. document.querySelector('#onSubmit').submit()
  87. } else {
  88. this.$toast(result.msg)
  89. }
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="less" scoped>
  96. .activepay {
  97. width: 100vw;
  98. height: 100vh;
  99. background: url('../assets/bg2.png') no-repeat center;
  100. background-size: cover;
  101. overflow: hidden;
  102. }
  103. .coupon-section {
  104. margin-top: 2.8rem;
  105. padding: 0 .35rem;
  106. img {
  107. width: 100%;
  108. }
  109. }
  110. .tip {
  111. padding: .22rem .35rem;
  112. font-size: .14rem;
  113. color: #FFFFFF;
  114. }
  115. .btn {
  116. padding: .05rem 0 .08rem;
  117. border-radius: 1rem;
  118. background:linear-gradient(270deg,rgba(242,209,163,1) 0%,rgba(188,130,76,1) 100%);
  119. border: 0;
  120. color: #fff;
  121. font-size: .14rem;
  122. margin-bottom: .2rem;
  123. text-align: center;
  124. del {
  125. font-size: .12rem;
  126. }
  127. }
  128. input, textarea {
  129. -webkit-user-select: auto!important;
  130. -khtml-user-select: auto!important;
  131. -moz-user-select: auto!important;
  132. -ms-user-select: auto!important;
  133. -o-user-select: auto!important;
  134. user-select: auto!important;
  135. }
  136. </style>