record.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="px-20 mt-32">
  4. <view class="bg--w111-fff rd-24rpx p-24 flex-between-center item"
  5. v-for="item in lotteryList" :key="item.id">
  6. <easy-loadimage
  7. :image-src="item.prize.image"
  8. width="136rpx"
  9. height="136rpx"
  10. borderRadius="16rpx"></easy-loadimage>
  11. <view class="flex-1 pl-24 h-136 flex-between-center">
  12. <view class="w-328 h-136 flex-col justify-between">
  13. <view class="w-full h-80 line2">
  14. <text class="label" :class="'label' + item.prize.type">{{item.prize.type | typeName}}</text>
  15. <text class="name">{{item.prize.name}}</text>
  16. </view>
  17. <view class="fs-22 text--w111-999">兑换时间:{{item.receive_time || '--'}}</view>
  18. </view>
  19. <view class="w-120 h-56 rd-30rpx flex-center fs-24 bg-gradient text--w111-fff"
  20. @tap="goDetail(item)">去查看</view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="px-20 mt-20" v-if="lotteryList.length === 0 && !loading">
  25. <emptyPage title="暂无中奖记录~" src="/statics/images/noOrder.gif"></emptyPage>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {getLotteryList} from '@/api/lottery.js';
  31. import { postCartAdd } from '@/api/store.js';
  32. import emptyPage from '@/components/emptyPage.vue'
  33. import colors from '@/mixins/color.js';
  34. export default {
  35. components: {
  36. emptyPage
  37. },
  38. mixins:[colors],
  39. data() {
  40. return {
  41. loading: false,
  42. where: {
  43. page: 1,
  44. limit: 20,
  45. },
  46. lotteryList: [],
  47. loadTitle: ''
  48. }
  49. },
  50. onLoad() {
  51. this.getLotteryList()
  52. },
  53. filters: {
  54. typeName(type) {
  55. if (type == 2) {
  56. return '积分'
  57. } else if (type == 3) {
  58. return '余额'
  59. } else if (type == 4) {
  60. return '红包'
  61. } else if (type == 5) {
  62. return '优惠券'
  63. } else if (type == 6) {
  64. return '商品'
  65. }
  66. }
  67. },
  68. onPageScroll(object) {
  69. uni.$emit('scroll');
  70. },
  71. methods: {
  72. getLotteryList() {
  73. if (this.loadend) return;
  74. if (this.loading) return;
  75. this.loading = true;
  76. this.loadTitle = '';
  77. getLotteryList(this.where).then(res => {
  78. let list = res.data;
  79. let lotteryList = this.$util.SplitArray(list, this.lotteryList);
  80. let loadend = list.length < this.where.limit;
  81. this.loadend = loadend;
  82. this.loading = false;
  83. this.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  84. this.$set(this, 'lotteryList', lotteryList);
  85. this.$set(this.where, 'page', this.where.page + 1);
  86. }).catch(err => {
  87. that.loading = false;
  88. that.loadTitle = '加载更多';
  89. });
  90. },
  91. goDetail(item){
  92. let type = item.type;
  93. if (type == 2) {
  94. uni.navigateTo({
  95. url: '/pages/users/user_integral/index'
  96. })
  97. } else if (type == 3) {
  98. uni.navigateTo({
  99. url: '/pages/users/user_money/index'
  100. })
  101. } else if (type == 4) {
  102. uni.switchTab({
  103. url: '/pages/index/index'
  104. })
  105. } else if (type == 5) {
  106. uni.navigateTo({
  107. url: '/pages/users/user_coupon/index'
  108. })
  109. } else if (type == 6) {
  110. if(item.oid > 0){
  111. uni.navigateTo({
  112. url: `/pages/goods/order_details/index?order_id=${item.oid}`
  113. })
  114. }else{
  115. postCartAdd({
  116. cartNum: 1,
  117. new: 1,
  118. is_new: 1,
  119. productId: item.prize.product_id,
  120. uniqueId: item.prize.unique,
  121. luckRecordId: item.id,
  122. }).then(res => {
  123. uni.navigateTo({
  124. url: `/pages/goods/order_confirm/index?new=1&luckRecordId=${item.id}&cartId=${res.data.cartId}`
  125. });
  126. }).catch(err => {
  127. this.$util.Tips({
  128. title: `${err},请联系客服`
  129. });
  130. });;
  131. }
  132. }
  133. }
  134. },
  135. onReachBottom() {
  136. this.getLotteryList();
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .item ~ .item{
  142. margin-top: 20rpx;
  143. }
  144. .item{
  145. .name {
  146. width: 328rpx;
  147. height: 80rpx;
  148. line-height: 40rpx;
  149. color: #333;
  150. font-weight: 500;
  151. font-size: 28rpx;
  152. }
  153. .label {
  154. padding: 0 6rpx;
  155. font-size: 20rpx;
  156. margin-right: 16rpx;
  157. border-radius: 6rpx;
  158. vertical-align: middle;
  159. }
  160. .label2, .label3, .label5{
  161. border: 1rpx solid #FF7D00;
  162. color: #FF7D00;
  163. }
  164. .label4, .label6{
  165. border: 1rpx solid var(--view-theme);
  166. color: var(--view-theme);
  167. }
  168. }
  169. </style>