BuyTicket.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!--
  2. * @Description:
  3. * @Author: 欧阳承珺
  4. * @LastEditors: 欧阳承珺
  5. * @Date: 2022-11-01 14:10:22
  6. * @LastEditTime: 2022-11-02 16:33:02
  7. -->
  8. <template>
  9. <div>
  10. <p class="text-18px text-[#666] text-center font-400">购买券</p>
  11. <div class="py-27px">
  12. <div class="flex justify-between">
  13. <div v-for="(item,idx) in list" :key="idx" class="w-116px h-130px relative cursor-pointer" @click="chooseTicket(item)">
  14. <div :class="`ticket${idx}`" class="w-full h-79px text-14px text-[#fff] leading-79px text-center font-200"><span class="text-36px mr-6px">{{getTickets(item)}}</span>券</div>
  15. <div :style="{'border': choosedTicket.productCode === item.productCode ? border[`border${idx}`] : '1px solid #f0f0f0'}" class="w-full mx-auto h-49px text-20px text-black leading-49px text-center font-200">¥{{item.price}}</div>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="py-27px">
  20. <p class="text-16px text-[#999] mb-14px">选择支付方式</p>
  21. <div class="pay-method" :style="{'border': paymethod === 'alipay' ? '2px solid #3fa9e7' : '1px solid #f0f0f0'}" @click="choosePayMethod('alipay',0)">
  22. <img class="inline-block" src="http://cn-file.17pdf.com/website/pricings/alipay_logo.png"> 支付宝
  23. </div>
  24. <div class="pay-method" :style="{'border': paymethod === 'wechat' ? '2px solid #4bcb70' : '1px solid #f0f0f0'}" @click="choosePayMethod('wechat',1)">
  25. <img class="inline-block" src="http://cn-file.17pdf.com/website/pricings/wechat_logo.png"> 微信
  26. </div>
  27. </div>
  28. <button class="play-now" style="margin-left: 68px" @click="handlePlayNow">立即支付</button>
  29. </div>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. list: [],
  36. choosedTicket: {},
  37. paymethod: '',
  38. border: {
  39. border0: '2px solid #9688ff',
  40. border1: '2px solid #27d6c5',
  41. border2: '2px solid #e1b973',
  42. border3: '2px solid #ff6a98'
  43. }
  44. }
  45. },
  46. created() {
  47. this.getVipList()
  48. },
  49. methods: {
  50. resetInterfaceStatus() {
  51. },
  52. chooseTicket(item) {
  53. this.choosedTicket = item
  54. },
  55. getTickets(item) {
  56. return item.productCode.split('.')[1]
  57. },
  58. getVipList() {
  59. this.$axios.post('pricing/getPricingList',{client: 'web',language: 'zh'}).then((res)=> {
  60. if(res.code === 200) {
  61. this.list = res.result.pricingList.filter(item => item.mode !== 1) // 加云的不展示
  62. this.choosedTicket = this.list[this.list.length - 1]
  63. this.paymethod = 'alipay'
  64. }
  65. })
  66. },
  67. choosePayMethod(type,payment) {
  68. this.paymethod = type
  69. const params = {
  70. client: 'web',
  71. payment,
  72. targetType: 'pricing',
  73. targetId: this.choosedTicket.id
  74. }
  75. this.$axios.post('subscription/create',params)
  76. },
  77. handlePlayNow() {
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss">
  83. .ticket0 {
  84. background: linear-gradient(#b98dff, #7384ff);
  85. }
  86. .ticket1 {
  87. background: linear-gradient(#60b8ff, #27d6c5);
  88. }
  89. .ticket2 {
  90. background: linear-gradient(#ff8e4a, #e1b973);
  91. }
  92. .ticket3 {
  93. background: linear-gradient(#ff8279, #ff6a98);
  94. }
  95. </style>