convert_confirm.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="cu-modal" :class="{ show: visible }">
  3. <view class="mask" @click="close"></view>
  4. <view class="cu-dialog wrapper" v-if="visible">
  5. <view class="content">
  6. <view class="marginT15 title">确定要全部兑换吗?</view>
  7. <view style="margin: 0 5px 0 20px">
  8. <scroll-view scroll-y style="height: 440rpx">
  9. <view class="flex-wrap flex-align-around">
  10. <view v-for="item in goods2" :key="item.data.id" class="item">
  11. <image
  12. class="super-image"
  13. :src="item.data.cover"
  14. mode="aspectFit"
  15. />
  16. <view
  17. class="bg-title bold"
  18. :style="
  19. 'background-image:url(' + ossurl.welfare.detail.numBg + ')'
  20. "
  21. >
  22. <text class="font0">x</text>
  23. {{ item.total }}
  24. </view>
  25. </view>
  26. </view>
  27. </scroll-view>
  28. </view>
  29. <view class="marginY12 flex-align-center" style="color: #c49300">
  30. 总可兑换:
  31. <view style="color: #644b00; font-size: 32rpx" class="bold">{{ total }}</view>
  32. 源石
  33. </view>
  34. <view class="flex-align-center paddingB15">
  35. <view class="applyBtn" @click="apply">确认兑换</view>
  36. </view>
  37. </view>
  38. <view class="flex-align-center marginT30">
  39. <image
  40. :src="resource.icon_close"
  41. @click="close"
  42. style="width: 60rpx; height: 60rpx"
  43. />
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import { LEVEL_MAP } from '@/utils/config'
  50. import { throttle } from '@/utils/utils'
  51. import resource from '@/utils/resource'
  52. import ossurl from '@/utils/ossurl'
  53. export default {
  54. data() {
  55. return {
  56. ossurl,
  57. resource,
  58. LEVEL_MAP,
  59. visible: false,
  60. goods2: [],
  61. goods: [],
  62. total: 0
  63. }
  64. },
  65. computed: {
  66. itemSize() {
  67. let width = (this.$store.state.systemInfo.screenWidth - 80 - 30 - 8) / 3
  68. let height = (132 / 88) * width
  69. return { width, height }
  70. }
  71. },
  72. methods: {
  73. show(goods, total) {
  74. this.goods = goods
  75. let goodsMap = {}
  76. goods.forEach((item) => {
  77. let key = item.spuId + '_' + item.level
  78. let obj = goodsMap[key]
  79. if (obj) {
  80. goodsMap[key] = {
  81. total: obj.total + 1,
  82. data: obj.data
  83. }
  84. } else {
  85. goodsMap[key] = {
  86. total: 1,
  87. data: item
  88. }
  89. }
  90. })
  91. this.total = total
  92. this.goods2 = Object.values(goodsMap)
  93. this.visible = true
  94. },
  95. async apply() {
  96. this.realApply()
  97. },
  98. async realApply() {
  99. const res = await this.$service.award.convertApply(
  100. this.goods.map((item) => item.id)
  101. )
  102. if (res) {
  103. this.$emit('convert-success')
  104. this.close()
  105. }
  106. },
  107. close() {
  108. this.visible = false
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .mask {
  115. position: absolute;
  116. left: 0;
  117. right: 0;
  118. top: 0;
  119. bottom: 0;
  120. }
  121. .wrapper {
  122. width: 100%;
  123. background: transparent;
  124. .content {
  125. margin: 0 20px;
  126. background: #ffffff;
  127. border-radius: 26rpx;
  128. .title {
  129. font-size: 48rpx;
  130. font-family: Alimama ShuHeiTi, Alimama ShuHeiTi;
  131. font-weight: 700;
  132. color: #000000;
  133. text-align: center;
  134. padding-top: 50rpx;
  135. padding-bottom: 30rpx;
  136. }
  137. .item {
  138. margin: 0 13px 13px 0;
  139. position: relative;
  140. width: 158rpx;
  141. height: 206rpx;
  142. background: #ffffff;
  143. border-radius: 12rpx 12rpx 12rpx 12rpx;
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. border: 2rpx solid #eaeaea;
  148. .super {
  149. position: absolute;
  150. z-index: 0;
  151. left: 0;
  152. top: 0;
  153. }
  154. .super-image {
  155. width: 146rpx;
  156. height: 170rpx;
  157. }
  158. .super-text {
  159. width: 125rpx;
  160. height: 48rpx;
  161. position: absolute;
  162. bottom: 10rpx;
  163. }
  164. .bg-title {
  165. width: 36rpx;
  166. height: 32rpx;
  167. background-size: 100% 100%;
  168. font-size: 20rpx;
  169. font-family: Arial, Arial;
  170. font-weight: 400;
  171. color: #ffffff;
  172. line-height: 32rpx;
  173. text-align: center;
  174. position: absolute;
  175. right: 0;
  176. top: 0;
  177. }
  178. }
  179. }
  180. }
  181. .applyBtn {
  182. width: 426rpx;
  183. height: 64rpx;
  184. background: #fec433;
  185. border-radius: 178rpx 178rpx 178rpx 178rpx;
  186. font-size: 28rpx;
  187. font-family: Source Han Sans, Source Han Sans;
  188. font-weight: 400;
  189. color: #000000;
  190. text-align: center;
  191. line-height: 64rpx;
  192. }
  193. </style>