record.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="record" v-if="lotteryList.length">
  4. <view class="record-list" v-for="item in lotteryList" :key="item.id">
  5. <image class="goods-img" :src="item.prize.image" mode=""></image>
  6. <view class="right-data">
  7. <view class="title line1">
  8. {{item.prize.name}}
  9. </view>
  10. <view class="goods-msg">
  11. 奖品类型:
  12. <text class="num">
  13. {{item.prize.type | typeName}}
  14. </text>
  15. </view>
  16. <view class="goods-msg">
  17. 兑换时间:
  18. {{item.receive_time || '--'}}
  19. </view>
  20. <view class="goods-msg" v-if="item.deliver_info.deliver_name">
  21. 物流公司:
  22. {{item.deliver_info.deliver_name || '--'}}
  23. </view>
  24. <view class="goods-msg" v-if="item.deliver_info.deliver_number">
  25. 物流单号:
  26. {{item.deliver_info.deliver_number || '--'}}
  27. <!-- #ifndef H5 -->
  28. <view v-if="item.deliver_info.deliver_number" class='copy' @tap='copyOrderId(item.deliver_info.deliver_number)'>复制</view>
  29. <!-- #endif -->
  30. <!-- #ifdef H5 -->
  31. <view v-if="item.deliver_info.deliver_number" class='copy copy-data' :data-clipboard-text="item.deliver_info.deliver_number">复制</view>
  32. <!-- #endif -->
  33. <!-- <view v-if="item.deliver_info.deliver_number" class='copy' @tap='copyOrderId(item.deliver_info.deliver_number)'>复制</view> -->
  34. </view>
  35. </view>
  36. </view>
  37. <view class='loadingicon acea-row row-center-wrapper' v-if='lotteryList.length > 0'>
  38. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  39. </view>
  40. </view>
  41. <block v-if="lotteryList.length === 0 && !loading">
  42. <emptyPage title="暂无中奖记录~"></emptyPage>
  43. </block>
  44. </view>
  45. </template>
  46. <script>
  47. import ClipboardJS from "@/plugin/clipboard/clipboard.js";
  48. import {
  49. getLotteryList
  50. } from '@/api/lottery.js'
  51. import emptyPage from '@/components/emptyPage.vue'
  52. import colors from '@/mixins/color.js';
  53. export default {
  54. components: {
  55. emptyPage
  56. },
  57. mixins:[colors],
  58. data() {
  59. return {
  60. loading: false,
  61. where: {
  62. page: 1,
  63. limit: 20,
  64. },
  65. lotteryList: [],
  66. loadTitle: ''
  67. }
  68. },
  69. onLoad() {
  70. this.getLotteryList()
  71. },
  72. filters: {
  73. typeName(type) {
  74. if (type == 2) {
  75. return '积分'
  76. } else if (type == 3) {
  77. return '余额'
  78. } else if (type == 4) {
  79. return '红包'
  80. } else if (type == 5) {
  81. return '优惠券'
  82. } else if (type == 6) {
  83. return '商品'
  84. }
  85. }
  86. },
  87. onReady: function() {
  88. // #ifdef H5 || APP-PLUS
  89. this.$nextTick(function() {
  90. const clipboard = new ClipboardJS(".copy-data");
  91. clipboard.on("success", () => {
  92. this.$util.Tips({
  93. title: '复制成功'
  94. });
  95. });
  96. });
  97. // #endif
  98. },
  99. onShow(){
  100. uni.removeStorageSync('form_type_cart');
  101. },
  102. methods: {
  103. // #ifndef H5
  104. copyOrderId: function(data) {
  105. let that = this;
  106. uni.setClipboardData({
  107. data: data
  108. });
  109. },
  110. // #endif
  111. getLotteryList() {
  112. if (this.loadend) return;
  113. if (this.loading) return;
  114. this.loading = true;
  115. this.loadTitle = '';
  116. getLotteryList(this.where).then(res => {
  117. let list = res.data;
  118. let lotteryList = this.$util.SplitArray(list, this.lotteryList);
  119. let loadend = list.length < this.where.limit;
  120. this.loadend = loadend;
  121. this.loading = false;
  122. this.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  123. this.$set(this, 'lotteryList', lotteryList);
  124. this.$set(this.where, 'page', this.where.page + 1);
  125. }).catch(err => {
  126. that.loading = false;
  127. that.loadTitle = '加载更多';
  128. });
  129. }
  130. },
  131. onReachBottom() {
  132. if (this.lotteryList.length > 0) {
  133. this.getLotteryList();
  134. } else {
  135. this.getLotteryList();
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .record {
  142. background-color: #eee;
  143. }
  144. .record-list {
  145. display: flex;
  146. align-items: center;
  147. background-color: #fff;
  148. padding: 30rpx;
  149. border-bottom: 1px solid #EEEEEE;
  150. height: 100%;
  151. .goods-img {
  152. width: 170rpx;
  153. height: 170rpx;
  154. border-radius: 6rpx;
  155. margin-right: 15rpx;
  156. }
  157. .right-data {
  158. display: flex;
  159. flex-direction: column;
  160. justify-content: space-between;
  161. min-height: 170rpx;
  162. .title {
  163. font-size: 28rpx;
  164. }
  165. .goods-msg {
  166. font-size: 24rpx;
  167. color: #999;
  168. .num {
  169. color: var(--view-theme);
  170. }
  171. .copy{
  172. display: -webkit-inline-box;
  173. display: -webkit-inline-flex;
  174. width: 60rpx;
  175. margin-left: 10rpx;
  176. padding: 0rpx 4rpx;
  177. border: 2rpx solid;
  178. }
  179. }
  180. }
  181. }
  182. </style>