convert_all.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="cu-modal" :class="{ show: visible }">
  3. <view class="cu-dialog wrapper">
  4. <view class="content">
  5. <view class="marginT15 title">确定要全部兑换吗?</view>
  6. <view class="marginT27 marginB20 flex-column-align-center" v-if="nums">
  7. <view
  8. v-if="nums.D"
  9. class="item flex-align paddingL25"
  10. @click="DCheck = !DCheck"
  11. >
  12. <view class="checkBox" v-if="DCheck">
  13. <view class="cuIcon-check"></view>
  14. </view>
  15. <view class="">
  16. <image class="icon-title" :src="LEVEL_MAP.D.titleText" />
  17. <view class="font2 paddingY3">
  18. 共{{ nums.D.count }}件,可兑换{{ nums.D.amount }}源石
  19. </view>
  20. </view>
  21. </view>
  22. <view
  23. v-if="nums.C"
  24. class="item flex-align paddingL25 marginT30"
  25. @click="CCheck = !CCheck"
  26. >
  27. <view class="checkBox" v-if="CCheck">
  28. <view class="cuIcon-check"></view>
  29. </view>
  30. <view class="">
  31. <image class="icon-title" :src="LEVEL_MAP.C.titleText" />
  32. <view class="font2 paddingY3">
  33. 共{{ nums.C.count }}件,可兑换{{ nums.C.amount }}源石
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="flex-align-center paddingB15">
  39. <view class="applyBtn" @click="apply">确认兑换</view>
  40. </view>
  41. </view>
  42. <view class="flex-align-center marginT30">
  43. <image
  44. :src="resource.icon_close"
  45. @click="close"
  46. style="width: 60rpx; height: 60rpx"
  47. />
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import { LEVEL_MAP } from '@/utils/config'
  54. import { throttle } from '@/utils'
  55. import resource from '@/utils/resource'
  56. export default {
  57. data() {
  58. return {
  59. nums: null,
  60. LEVEL_MAP,
  61. resource,
  62. visible: false,
  63. CCheck: false,
  64. DCheck: false
  65. }
  66. },
  67. methods: {
  68. show(res) {
  69. let nums = {}
  70. res.forEach((item) => {
  71. if (item.level === 'C') {
  72. nums.C = item.statistic
  73. }
  74. if (item.level === 'D') {
  75. nums.D = item.statistic
  76. }
  77. })
  78. this.DCheck = !!nums.D
  79. this.CCheck = !nums.D && nums.C
  80. this.nums = nums
  81. this.visible = true
  82. },
  83. async apply() {
  84. if (!this.CCheck && !this.DCheck) return
  85. throttle.call(this.realApply)
  86. },
  87. async realApply() {
  88. let levels = []
  89. this.CCheck && levels.push('C')
  90. this.DCheck && levels.push('D')
  91. const res = await this.$service.award.convertAll(levels)
  92. if (res) {
  93. this.$emit('convertSuccess')
  94. this.close()
  95. }
  96. },
  97. close() {
  98. this.nums = null
  99. this.visible = false
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .mask {
  106. position: absolute;
  107. left: 0;
  108. right: 0;
  109. top: 0;
  110. bottom: 0;
  111. }
  112. .wrapper {
  113. width: 100%;
  114. background: transparent;
  115. .content {
  116. margin: 0 20px;
  117. background: #ffffff;
  118. border-radius: 26rpx;
  119. border: 4rpx solid;
  120. .title {
  121. font-size: 48rpx;
  122. font-family: Alimama ShuHeiTi, Alimama ShuHeiTi;
  123. font-weight: 700;
  124. color: #000000;
  125. text-align: center;
  126. padding-top: 50rpx;
  127. padding-bottom: 30rpx;
  128. }
  129. .item {
  130. width: 520rpx;
  131. height: 120rpx;
  132. background: #fff7e3;
  133. position: relative;
  134. border-radius: 4rpx;
  135. overflow: hidden;
  136. .icon-title {
  137. width: 110rpx;
  138. height: 32rpx;
  139. }
  140. .un-check {
  141. width: 32rpx;
  142. height: 32rpx;
  143. background: rgba(99, 108, 255, 0.4);
  144. border: 1rpx solid rgba(99, 108, 255, 1);
  145. }
  146. .check {
  147. width: 32rpx;
  148. height: 32rpx;
  149. }
  150. .checkBox {
  151. width: 32rpx;
  152. height: 28rpx;
  153. background: #000;
  154. color: #fec433;
  155. font-weight: bold;
  156. font-size: 24rpx;
  157. text-align: center;
  158. line-height: 28rpx;
  159. border-radius: 12rpx 0 0 0;
  160. position: absolute;
  161. right: 0;
  162. bottom: 0;
  163. }
  164. }
  165. }
  166. }
  167. .applyBtn {
  168. width: 426rpx;
  169. height: 64rpx;
  170. background: #fec433;
  171. border-radius: 178rpx 178rpx 178rpx 178rpx;
  172. font-size: 28rpx;
  173. font-family: Source Han Sans, Source Han Sans;
  174. font-weight: 400;
  175. color: #000000;
  176. text-align: center;
  177. line-height: 64rpx;
  178. }
  179. </style>