index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="index">
  3. <image mode="center" :src="form.pic" />
  4. <view class="buy">
  5. <button type="buy" circle @click="getSubmit">立即购买</button>
  6. <span>
  7. <radio-group @change="getChange">
  8. <radio :value="value" />
  9. </radio-group>
  10. <text>购买即视为同意</text>
  11. <navigator url="/pages/imusic/agreement">《场景歌单付费协议》</navigator>
  12. <navigator url="/pages/imusic/service">《音乐服务许可协议》</navigator>
  13. </span>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import { detail } from '@/api/imusic.js'
  19. export default {
  20. data() {
  21. return {
  22. form: {},
  23. // 是否同意
  24. value: '0',
  25. id: ''
  26. }
  27. },
  28. onLoad(e) {
  29. if (e.id) {
  30. this.getDetail(e.id)
  31. this.id = e.id
  32. }
  33. },
  34. methods: {
  35. getDetail(e) {
  36. detail({ id: e }).then(res => {
  37. if (res.data.code === 0) {
  38. this.form = res.data.data
  39. }
  40. })
  41. },
  42. getChange() {
  43. this.value = '1'
  44. },
  45. // 立即购买
  46. getSubmit() {
  47. if (this.value === '1') {
  48. clickPay.postMessage(`{\"id\":\"${this.id}\", \"type\":15}`)
  49. } else {
  50. uni.showToast({
  51. title: '请先阅读并勾选协议',
  52. icon: 'none'
  53. })
  54. }
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .index {
  61. width: 100%;
  62. height: 100%;
  63. overflow-y: hidden;
  64. }
  65. uni-image {
  66. width: 100%;
  67. height: 100%;
  68. }
  69. .buy {
  70. position: fixed;
  71. bottom: 0;
  72. width: 100%;
  73. height: 232rpx;
  74. overflow: hidden;
  75. }
  76. .buy::before {
  77. content: '';
  78. display: block;
  79. height: 232rpx;
  80. background: rgba(18, 18, 18, 0.4);
  81. backdrop-filter: blur(16rpx);
  82. }
  83. button {
  84. width: 92%;
  85. font-weight: bold;
  86. position: absolute;
  87. top: 24rpx;
  88. left: 50%;
  89. transform: translate(-50%);
  90. }
  91. navigator {
  92. display: inline;
  93. color: #FFF;
  94. }
  95. span {
  96. display: flex;
  97. justify-content: center;
  98. align-items: center;
  99. position: absolute;
  100. bottom: 60rpx;
  101. width: 100%;
  102. text-align: center;
  103. font-size: 24rpx;
  104. color: #d5d5d5;
  105. }
  106. ::v-deep uni-radio .uni-radio-input {
  107. width: 24rpx;
  108. height: 24rpx;
  109. background: none;
  110. }
  111. </style>