recharge.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="re-body pd16_15">
  3. <p class="ft14">账户余额<span class="ft14 kb-txt">{{user_info.total_coin}}</span>K币</p>
  4. <view class="box options-box">
  5. <block v-for="(item,key) in list" :key="key">
  6. <view @click="selectItem(item)" class="box mt16 options-item"
  7. :class="item.id == select.id ?'select' :'' " v-if="item.type =='COIN'">
  8. <p><text v-if="item.is_first_pay" class="ft14 top-lab">首冲</text></p>
  9. <text class="ft18 pirice-txt txt-other" :style="item.is_first_pay ==1 ? '': 'padding-top: 25px;'">
  10. {{item.price}}元</text>
  11. <p class="ft14 cz-desc-txt txt-other">{{item.price_text}} <text
  12. class="ft14 pirice-txt">+{{item.given}}币</text></p>
  13. <p class="ft14 cz-desc-txt txt-other" :class="item.id == select.id ?'select_text' :'given-txt' ">
  14. {{item.given_amount}} <text v-if="item.id == select.id" class="ft14 xz-hh">&#10003;️</text> </p>
  15. </view>
  16. <view @click="selectItem(item)" class="box mt16 options-item vip"
  17. :class="item.id == select.id ?'select' :'' " v-else>
  18. <text class="ft18 pirice-txt txt-other"> {{item.price}}元</text>
  19. <p class="ft14 cz-desc-txt txt-other">{{item.price_text}}</text></p>
  20. <p class="ft14 cz-desc-txt txt-other " :class="item.id == select.id ?'select_text' :'' ">
  21. {{item.given_amount}} <text v-if="item.id == select.id" class="ft14 xz-hh">&#10003;️</text> </p>
  22. </view>
  23. </block>
  24. </view>
  25. <view v-if="is_player == false" @click="toPay" class="ft16 btn-cz box mt16 " >
  26. 确认充值{{select.price}}
  27. </view>
  28. <p class="ft14" style="margin: 10px 0;">付费须知</p>
  29. <view class="ft14 textdesc">
  30. <text class="ft12">1、虚拟商品,一经购买不得退换</text>
  31. <text class="ft12">2、充值后K币可能有延迟,1小时未到账请在“我的”页面联系客服</text>
  32. <text class="ft12">3、未满18岁的未成年需要在监护人陪同下购买并观看短剧剧</text>
  33. <text class="ft12">4、购买成功后,“K币”仅在本小程序中使用</text>
  34. <text class="ft12">5、购买成功后可在”我的”页面订单中心进行查看</text>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. getOptions,
  41. getPayInfo
  42. } from "@/common/apis/recharge.js"
  43. export default {
  44. props: {
  45. user_info:{}, // 用户信息
  46. video_info: {}, // 视屏信息
  47. is_player: {
  48. type:Boolean,
  49. default: false
  50. }
  51. },
  52. data() {
  53. return {
  54. list: [],
  55. select: {},
  56. }
  57. },
  58. watch: {
  59. user_info: {
  60. // 此处监听variable变量,当期有变化时执行
  61. handler(item1, item2) {
  62. this.user_info = item1;
  63. // console.log('111111111111','item1',item1,'item2',item2,'this.user_info',this.user_info)
  64. // item1为新值,item2为旧值
  65. }
  66. }
  67. },
  68. created() {
  69. // props 会暴露到 `this` 上
  70. this.get_options();
  71. console.log(this.user_info, 'getOptions', this.list)
  72. },
  73. methods: {
  74. loginAct() {
  75. this.$emit('loginAct');
  76. },
  77. showQrcodeAct() {
  78. this.$emit('qrcode');
  79. },
  80. async get_options() {
  81. this.list = await getOptions();
  82. this.list.forEach((item, index) => {
  83. if (item.is_default == 1) {
  84. this.select = item;
  85. }
  86. })
  87. },
  88. selectItem(item) {
  89. this.select = item;
  90. },async toPay(){
  91. if(this.select.lenght < 1){
  92. uni.showToast({ title: '请选择要充值的项',icon:"none" });
  93. return false;
  94. }
  95. let params = {
  96. pay_proudct_id:this.select.id,
  97. video_id:this.video_info && this.video_info.video_id ? this.video_info.video_id :1,
  98. video_series_sequence:this.video_info && this.video_info.video_series_sequence ? this.video_info.video_series_sequence :1,
  99. };
  100. let res = await getPayInfo(params);
  101. console.log('getPayInfo',res);
  102. }
  103. }
  104. }
  105. </script>
  106. <style>
  107. @import url("style/recharge.css");
  108. </style>