winningPopup.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <u-popup
  3. :show="show"
  4. @close="handleClose"
  5. round="20rpx"
  6. bgColor="#f3f5f9"
  7. zIndex="10076"
  8. >
  9. <view class="winning_record">
  10. <image class="head_bg" src="/static/images/red_head.png" mode="widthFix"></image>
  11. <image class="bg" src="/static/images/red_bg.png"></image>
  12. <view class="winning_content">
  13. <view class="title">我的中奖记录</view>
  14. <view class="row mb40 fs34">
  15. <view class="start">时间</view>
  16. <view class="center">状态</view>
  17. <view class="end">奖品</view>
  18. </view>
  19. <scroll-view
  20. enable-flex
  21. scroll-y
  22. v-if="prizeList && prizeList.length > 0"
  23. :style="{ height: scrollHeight + 'px' }"
  24. >
  25. <view
  26. class="row mb20 fs34"
  27. v-for="(item, index) in prizeList"
  28. :key="index"
  29. >
  30. <view class="start fs30">{{ formatTime(item.createTime) }}</view>
  31. <view
  32. class="center button"
  33. v-if="item.orderStatus === -9 || !item.orderStatus"
  34. @click="handleFillAddress(item)"
  35. >
  36. <text>填地址</text>
  37. </view>
  38. <view class="center" v-else>
  39. <text v-if="item.orderStatus === 1">待支付</text>
  40. <text v-if="item.orderStatus === 2">待发货</text>
  41. <text v-if="item.orderStatus === 3">待收货</text>
  42. <text v-if="item.orderStatus === 4">已完成</text>
  43. <text v-if="item.orderStatus === -3">已取消</text>
  44. </view>
  45. <view class="end">
  46. {{ truncateString(item.productName, 6) }}
  47. </view>
  48. </view>
  49. </scroll-view>
  50. <view v-else class="f36 mt150" style="text-align: center">
  51. 暂无中奖信息
  52. </view>
  53. </view>
  54. </view>
  55. </u-popup>
  56. </template>
  57. <script>
  58. export default {
  59. name: 'WinningRecordPopup',
  60. props: {
  61. // 控制显示/隐藏
  62. show: {
  63. type: Boolean,
  64. default: false
  65. },
  66. // 中奖记录列表
  67. prizeList: {
  68. type: Array,
  69. default: () => []
  70. },
  71. // 直播间ID
  72. liveId: {
  73. type: [String, Number],
  74. default: ''
  75. },
  76. // 滚动区域高度
  77. scrollHeight: {
  78. type: Number,
  79. default: 500
  80. }
  81. },
  82. data() {
  83. return {};
  84. },
  85. methods: {
  86. /**
  87. * 关闭弹窗
  88. */
  89. handleClose() {
  90. this.$emit('close');
  91. },
  92. /**
  93. * 处理填写地址
  94. */
  95. handleFillAddress(item) {
  96. this.$emit('fill-address', {
  97. productId: item.productId,
  98. recordId: item.id,
  99. liveId: this.liveId,
  100. item: item
  101. });
  102. },
  103. /**
  104. * 格式化时间显示
  105. */
  106. formatTime(timeStr) {
  107. if (!timeStr) return '';
  108. // 简单的格式化,可以根据需要调整
  109. return timeStr.length > 10 ? timeStr.substring(5, 16) : timeStr;
  110. },
  111. /**
  112. * 截断字符串
  113. */
  114. truncateString(str, maxLength) {
  115. if (typeof str !== 'string' || str.length <= maxLength) {
  116. return str || '';
  117. }
  118. return str.slice(0, maxLength) + '...';
  119. }
  120. }
  121. };
  122. </script>
  123. <style scoped lang="scss">
  124. .winning_record {
  125. position: relative;
  126. height: 800rpx;
  127. .head_bg {
  128. position: absolute;
  129. top: -125rpx;
  130. left: 50%;
  131. width: 311rpx;
  132. transform: translateX(-50%);
  133. }
  134. .bg {
  135. width: 100%;
  136. height: 100%;
  137. }
  138. .winning_content {
  139. position: absolute;
  140. top: 50rpx;
  141. color: #fff;
  142. width: 100%;
  143. padding: 0 36rpx;
  144. box-sizing: border-box;
  145. .title {
  146. text-align: center;
  147. font-size: 40rpx;
  148. font-weight: 500;
  149. margin-bottom: 40rpx;
  150. }
  151. .row {
  152. display: flex;
  153. justify-content: space-between;
  154. text-align: center;
  155. .start {
  156. width: 40%;
  157. }
  158. .center {
  159. width: 20%;
  160. }
  161. .button {
  162. background-color: #fff;
  163. border-radius: 20rpx;
  164. color: #f4410b;
  165. padding: 4rpx 8rpx;
  166. }
  167. .end {
  168. width: 40%;
  169. }
  170. }
  171. }
  172. }
  173. </style>