convert.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view>
  3. <scroll-view
  4. class="wrapper"
  5. :style="{ top: top + 'px' }"
  6. scroll-y
  7. refresher-enabled
  8. refresher-default-style="white"
  9. @refresherrefresh="pullRefresh"
  10. :refresher-triggered="refreshing"
  11. @scrolltolower="loadMore"
  12. >
  13. <view class="paddingX14">
  14. <view class="cell" v-for="item in tableData" :key="item.tradeNo">
  15. <view class="flex-align-between time">
  16. <view>兑换时间:{{ item.createTime }}</view>
  17. <text class="color-green" v-if="item.status === 99">已完成</text>
  18. <text class="color-money" v-else-if="item.status === 12">系统取消</text>
  19. </view>
  20. <view class="font2 paddingT18 text-center" style="color: #999">兑换源石:</view>
  21. <view class="bold paddingT2 text-center" style="color: #000; font-size: 64rpx">
  22. {{ item.totalMagicAmount }}
  23. </view>
  24. <view class="itemListBox">
  25. <scroll-view
  26. scroll-x
  27. class="scroll-wrapper itemList"
  28. v-if="item.list.length > 4"
  29. >
  30. <view class="item" v-for="(goods, index) in item.list" :key="index">
  31. <image
  32. class="super-image translateX"
  33. mode="aspectFit"
  34. :src="goods.data.cover"
  35. />
  36. <view
  37. class="bg-title bold"
  38. :style="
  39. 'background-image:url(' + ossurl.welfare.detail.numBg + ')'
  40. "
  41. >
  42. x{{ goods.total }}
  43. </view>
  44. </view>
  45. </scroll-view>
  46. <view v-else class="flex-align-around padding15 itemList">
  47. <view class="item" v-for="(goods, index) in item.list" :key="index">
  48. <image
  49. class="super-image translateX"
  50. mode="aspectFit"
  51. :src="goods.data.cover"
  52. />
  53. <view
  54. class="bg-title bold"
  55. :style="
  56. 'background-image:url(' + ossurl.welfare.detail.numBg + ')'
  57. "
  58. >
  59. x{{ goods.total }}
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="flex-align top-line">
  65. <view class="order-no">订单号:{{ item.tradeNo }}</view>
  66. <button
  67. class="btn-clear copy flex-shrink0"
  68. @click.stop="$common.copy(item.tradeNo)"
  69. >
  70. 复制
  71. </button>
  72. </view>
  73. </view>
  74. </view>
  75. <empty v-if="isEmpty" :top="200" light />
  76. </scroll-view>
  77. </view>
  78. </template>
  79. <script>
  80. import pageMixin from './../../mixin/page'
  81. import empty from '@/components/empty'
  82. import { LEVEL_MAP } from '@/utils/config'
  83. import ossurl from '@/utils/ossurl'
  84. export default {
  85. mixins: [pageMixin],
  86. components: { empty },
  87. data() {
  88. return {
  89. LEVEL_MAP,
  90. refreshing: false,
  91. ossurl
  92. }
  93. },
  94. computed: {
  95. top() {
  96. let height = this.$store.state.systemInfo.statusBarHeight + 36 + 50 + 10
  97. return height
  98. },
  99. itemWidth() {
  100. let width = this.$store.state.systemInfo.screenWidth
  101. width = (width - 8 - 40) / 3
  102. let height = (165 / 109) * width
  103. return { width, height }
  104. }
  105. },
  106. mounted() {
  107. this.refresh(true)
  108. },
  109. methods: {
  110. pullRefresh() {
  111. this.refreshing = true
  112. this.refresh()
  113. },
  114. async loadData(loading = false) {
  115. const res = await this.$service.award.convertList(
  116. this.pageNum,
  117. this.pageSize,
  118. loading
  119. )
  120. setTimeout(() => {
  121. this.refreshing = false
  122. }, 1000)
  123. return this.changeData(res)
  124. },
  125. changeData(res) {
  126. if (!res) return false
  127. res.forEach((item) => {
  128. let goods = item.itemList
  129. let goodsMap = {}
  130. goods.forEach((item) => {
  131. let key = item.spuId + '_' + item.level
  132. let obj = goodsMap[key]
  133. if (obj) {
  134. goodsMap[key] = {
  135. total: obj.total + 1,
  136. data: obj.data
  137. }
  138. } else {
  139. goodsMap[key] = {
  140. total: 1,
  141. data: item
  142. }
  143. }
  144. })
  145. item.list = Object.values(goodsMap)
  146. })
  147. return res
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .bg {
  154. position: fixed;
  155. z-index: -1;
  156. left: 0;
  157. right: 0;
  158. top: 0;
  159. width: 100%;
  160. height: 100%;
  161. opacity: 0.3;
  162. }
  163. .wrapper {
  164. position: fixed;
  165. left: 0;
  166. right: 0;
  167. bottom: 0;
  168. }
  169. .cell {
  170. border-radius: 12rpx;
  171. padding: 2rpx 30rpx;
  172. margin-bottom: 20rpx;
  173. position: relative;
  174. overflow: hidden;
  175. color: #999999;
  176. background-color: #fff;
  177. .time,
  178. .order-no {
  179. font-size: 24rpx;
  180. line-height: 44rpx;
  181. color: #999999;
  182. }
  183. .time {
  184. border-bottom: 2rpx solid rgba(0, 0, 0, 0.05);
  185. padding: 22rpx 0;
  186. }
  187. .top-line {
  188. padding: 22rpx 0;
  189. width: 100%;
  190. display: flex;
  191. justify-content: space-between;
  192. }
  193. .item-wrapper {
  194. margin: 40rpx 0 30rpx 0;
  195. height: 182rpx;
  196. width: 100%;
  197. }
  198. .scroll-wrapper {
  199. margin: 40rpx 0 30rpx 30rpx;
  200. overflow: hidden;
  201. height: 182rpx;
  202. white-space: nowrap;
  203. width: 100%;
  204. .item {
  205. display: inline-block;
  206. margin-right: 8rpx;
  207. }
  208. }
  209. .copy {
  210. padding: 2rpx 10rpx;
  211. height: 32rpx;
  212. line-height: 32rpx;
  213. border-radius: 8rpx;
  214. text-align: center;
  215. font-size: 24rpx;
  216. background: #fec433;
  217. color: #000000;
  218. margin: 0;
  219. }
  220. .item {
  221. width: 158rpx;
  222. height: 206rpx;
  223. background: #ffffff;
  224. border-radius: 12rpx 12rpx 12rpx 12rpx;
  225. opacity: 1;
  226. position: relative;
  227. .super {
  228. position: absolute;
  229. z-index: 0;
  230. left: 0;
  231. top: 0;
  232. width: 120rpx;
  233. height: 182rpx;
  234. }
  235. .super-image {
  236. width: 146rpx;
  237. height: 170rpx;
  238. }
  239. .bg-title {
  240. width: 36rpx;
  241. height: 32rpx;
  242. background-size: 100% 100%;
  243. font-size: 20rpx;
  244. font-family: Arial, Arial;
  245. font-weight: 400;
  246. color: #ffffff;
  247. line-height: 32rpx;
  248. text-align: center;
  249. position: absolute;
  250. right: 0;
  251. top: 0;
  252. }
  253. }
  254. }
  255. .itemList {
  256. background: #f8f8f8;
  257. border-radius: 12rpx;
  258. }
  259. .itemListBox {
  260. padding: 20rpx 28rpx;
  261. }
  262. </style>