index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="pageWrapper">
  3. <!-- <tabbar2 custom-class=" " :tabs="tabs" @change="clickTab" /> -->
  4. <view class="content" v-if="item">
  5. <view class="paddingT14 detailInfo">
  6. <image class="icon flex-shrink0" :src="item.spu.cover" mode="aspectFit" />
  7. <view><image class="icon-title" :src="LEVEL_MAP[item.level].titleText" /></view>
  8. <view class="flex1 marginL12">
  9. <view
  10. class="font4 bold paddingB13"
  11. style="-webkit-line-clamp: 2;word-break: break-all;text-overflow:ellipsis"
  12. >
  13. {{ item.spu.name }}
  14. </view>
  15. <view class="">
  16. <view class="font3 formBox" style="opacity: 0.8">
  17. <text v-if="item.fromRelationType === 'LUCK'">宝箱</text>
  18. <text v-else-if="item.fromRelationType === 'TRADE'">魔换</text>
  19. <text v-else-if="item.fromRelationType === 'LUCK_ROOM'">福利房</text>
  20. <text v-else-if="item.fromRelationType === 'LUCK_KING'">魔王战</text>
  21. <text v-else-if="item.fromRelationType === 'LUCK_WHEEL'">魔天轮</text>
  22. <text v-else-if="item.fromRelationType === 'SUBSTITUTE'">置换</text>
  23. <text v-else-if="item.fromRelationType === 'ACTIVITY'">活动</text>
  24. <text v-else-if="item.fromRelationType === 'DOLL_MACHINE'">娃娃机</text>
  25. <text v-else>其他</text>
  26. 获得
  27. </view>
  28. <view v-if="hide" class="flex-align-between"></view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view v-if="hide&&item" class="relative btnBox2" @click="showConvertConfirm">
  34. <view>兑换源石</view>
  35. <view class="text" style="font-size: 20rpx; color: #735200">
  36. <view class="font4 radius2" v-if="item.magicAmount > 0">
  37. 可兑换
  38. <text>
  39. {{ item.magicAmount }}
  40. </text>
  41. 源石
  42. </view>
  43. <view v-else class="font4 radius2">不可兑换</view>
  44. </view>
  45. </view>
  46. <convert-confirm ref="convertConfirmRef" @convert-success="onConvertSuccess" />
  47. </view>
  48. </template>
  49. <script>
  50. import pageMixin from './../../mixin/page'
  51. import { LEVEL_MAP } from '@/utils/config'
  52. import ossurl from '@/utils/ossurl'
  53. import convertConfirm from './convert_confirm'
  54. export default {
  55. mixins: [pageMixin],
  56. components: {
  57. convertConfirm
  58. },
  59. data() {
  60. return {
  61. ossurl,
  62. LEVEL_MAP,
  63. refreshing: false,
  64. checkMap: {},
  65. total: 0,
  66. id: '',
  67. item: null
  68. }
  69. },
  70. computed: {
  71. top() {
  72. let height = this.$store.state.systemInfo.statusBarHeight + 36 + 50 + 10 + 40
  73. return height
  74. },
  75. itemWidth() {
  76. let width = this.$store.state.systemInfo.screenWidth
  77. width = (width - 8 - 40) / 3
  78. let height = (165 / 109) * width
  79. return { width, height }
  80. },
  81. hide() {
  82. return !this.$store.state.hide
  83. }
  84. },
  85. onLoad(e) {
  86. if (e.id) {
  87. this.id = e.id
  88. this.getLuckDetail()
  89. }
  90. },
  91. methods: {
  92. pullRefresh() {
  93. this.refreshing = true
  94. this.refresh()
  95. },
  96. clickTab(item) {
  97. this.tab = item
  98. this.refresh(true)
  99. },
  100. async getLuckDetail() {
  101. const res = await this.$service.award.getLuckDetail(this.id)
  102. this.item = res
  103. },
  104. async showConvertConfirm() {
  105. if (this.item.magicAmount > 0) {
  106. this.$service.award.convertPreview([this.item.id]).then((res) => {
  107. if (res) {
  108. this.$refs.convertConfirmRef.show([this.item], res.totalMagicAmount)
  109. }
  110. })
  111. } else {
  112. this.$message.warn('不可兑换')
  113. }
  114. },
  115. onConvertSuccess() {
  116. let self = this
  117. this.$message.success('兑换成功')
  118. setTimeout(function () {
  119. self.$router.back()
  120. }, 1000)
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .pageWrapper {
  127. padding: 24rpx;
  128. }
  129. .icon {
  130. width: 180rpx;
  131. height: 180rpx;
  132. border-radius: 10rpx;
  133. }
  134. .icon-title {
  135. width: 90rpx;
  136. height: 32rpx;
  137. // margin-left: -18rpx;
  138. }
  139. .btn-bx {
  140. width: 180rpx;
  141. height: 40rpx;
  142. background: linear-gradient(90deg, #2affff 0%, #4d70f2 100%);
  143. border-radius: 20rpx;
  144. }
  145. .safe-flag {
  146. width: 192rpx;
  147. height: 120rpx;
  148. position: absolute;
  149. right: 32rpx;
  150. }
  151. .btnBox2 {
  152. padding-top: 8rpx;
  153. width: 326rpx;
  154. height: 80rpx;
  155. background: #fec433;
  156. border-radius: 40rpx;
  157. text-align: center;
  158. margin: auto;
  159. }
  160. .content {
  161. background-color: #fff;
  162. }
  163. .detailInfo {
  164. padding: 24rpx;
  165. margin-bottom: 20rpx;
  166. text-align: center;
  167. }
  168. .formBox {
  169. display: inline-block;
  170. background: #f8f8f8;
  171. border-radius: 884rpx 884rpx 884rpx 884rpx;
  172. font-family: Source Han Sans, Source Han Sans;
  173. font-weight: 350;
  174. font-size: 24rpx;
  175. color: #666666;
  176. line-height: 44rpx;
  177. padding: 4rpx 24rpx;
  178. }
  179. </style>