winningRecord.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="lottery-list">
  3. <!-- 中奖记录列表 -->
  4. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  5. <view v-for="item in dataList" :key="item.roundId" class="record-card u-border-bottom">
  6. <view class="left">
  7. <view class="name">{{ item.content }}</view>
  8. <view class="time">{{ item.createTime }}</view>
  9. </view>
  10. <!-- 纯芳华币不显示按钮 -->
  11. <view v-if="item.goodsId" class="u-btn x-ac" @click="goDetail(item)">
  12. 详情
  13. </view>
  14. </view>
  15. </mescroll-body>
  16. </view>
  17. </template>
  18. <script>
  19. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  20. import {rewardList} from "@/api/courseAnswer.js"
  21. export default {
  22. mixins: [MescrollMixin], // 关键:混入 mescroll 生命周期
  23. data() {
  24. return {
  25. mescroll: null,
  26. downOption: { //下拉刷新
  27. use: true,
  28. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  29. },
  30. upOption: {
  31. onScroll: false,
  32. use: true, // 是否启用上拉加载; 默认true
  33. page: {
  34. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  35. size: 10 // 每页数据的数量,默认10
  36. },
  37. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  38. textNoMore: "已经到底了",
  39. empty: {
  40. icon: 'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  41. tip: '暂无数据'
  42. }
  43. },
  44. dataList: []
  45. }
  46. },
  47. methods: {
  48. mescrollInit(mescroll) {
  49. this.mescroll = mescroll;
  50. },
  51. /*下拉刷新的回调 */
  52. downCallback(mescroll) {
  53. mescroll.resetUpScroll()
  54. },
  55. upCallback(page) {
  56. //联网加载数据
  57. let that = this;
  58. let data = {
  59. pageNum: page.num,
  60. pageSize: page.size
  61. };
  62. rewardList(data).then(res => {
  63. if (res.code == 200) {
  64. //设置列表数据
  65. if (page.num == 1) {
  66. that.dataList = res.data.list;
  67. } else {
  68. that.dataList = that.dataList.concat(res.data.list);
  69. }
  70. that.mescroll.endBySize(res.data.list.length, res.data.total);
  71. } else {
  72. uni.showToast({
  73. icon: 'none',
  74. title: "请求失败",
  75. });
  76. that.dataList = null;
  77. that.mescroll.endErr();
  78. }
  79. });
  80. },
  81. /* 跳转详情 */
  82. goDetail(item) {
  83. //orderType,订单类型1企微2app
  84. if(item.orderId) {
  85. uni.navigateTo({
  86. url: `/pages/courseAnswer/orderDetail?orderId=${item.orderId}&orderType=${item.orderType}`
  87. })
  88. } else {
  89. uni.navigateTo({
  90. url: `/pages/courseAnswer/winningRecordDetail?goodsId=${item.goodsId}&roundId=${item.roundId}&orderType=${item.orderType}`
  91. })
  92. }
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .lottery-list {
  99. background-color: #f5f5f5;
  100. padding: 20rpx;
  101. box-sizing: border-box;
  102. }
  103. /* 单条卡片 */
  104. .record-card {
  105. display: flex;
  106. align-items: center;
  107. justify-content: space-between;
  108. padding: 28rpx 32rpx;
  109. margin-bottom: 20rpx;
  110. background: #ffffff;
  111. border-radius: 16rpx;
  112. box-shadow: 0 4rpx 16rpx 0 rgba(0, 0, 0, 0.05);
  113. transition: transform 0.15s ease;
  114. &:active {
  115. transform: scale(0.98);
  116. }
  117. .left {
  118. flex: 1;
  119. margin-right: 20rpx;
  120. .time {
  121. font-size: 24rpx;
  122. color: #999;
  123. line-height: 1.6;
  124. }
  125. .name {
  126. margin-top: 8rpx;
  127. font-size: 30rpx;
  128. color: #333;
  129. font-weight: 500;
  130. line-height: 1.4;
  131. /* 超长折行 */
  132. word-break: break-all;
  133. }
  134. }
  135. /* 详情按钮 */
  136. .u-btn {
  137. width: 132rpx;
  138. height: 64rpx;
  139. background: #FF5C03;
  140. border-radius: 32rpx 32rpx 32rpx 32rpx;
  141. font-family: PingFang SC, PingFang SC;
  142. font-weight: 500;
  143. font-size: 28rpx;
  144. color: #FFFFFF;
  145. }
  146. }
  147. /* 底线微调 */
  148. .u-border-bottom::after {
  149. display: none;
  150. }
  151. </style>