| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <template>
- <u-popup
- :show="show"
- @close="handleClose"
- round="20rpx"
- bgColor="#f3f5f9"
- zIndex="10076"
- >
- <view class="winning_record">
- <image class="head_bg" src="/static/images/red_head.png" mode="widthFix"></image>
- <image class="bg" src="/static/images/red_bg.png"></image>
-
- <view class="winning_content">
- <view class="title">我的中奖记录</view>
-
- <view class="row mb40 fs34">
- <view class="start">时间</view>
- <view class="center">状态</view>
- <view class="end">奖品</view>
- </view>
-
- <scroll-view
- enable-flex
- scroll-y
- v-if="prizeList && prizeList.length > 0"
- :style="{ height: scrollHeight + 'px' }"
- >
- <view
- class="row mb20 fs34"
- v-for="(item, index) in prizeList"
- :key="index"
- >
- <view class="start fs30">{{ formatTime(item.createTime) }}</view>
-
- <view
- class="center button"
- v-if="item.orderStatus === -9 || !item.orderStatus"
- @click="handleFillAddress(item)"
- >
- <text>填地址</text>
- </view>
-
- <view class="center" v-else>
- <text v-if="item.orderStatus === 1">待支付</text>
- <text v-if="item.orderStatus === 2">待发货</text>
- <text v-if="item.orderStatus === 3">待收货</text>
- <text v-if="item.orderStatus === 4">已完成</text>
- <text v-if="item.orderStatus === -3">已取消</text>
- </view>
-
- <view class="end">
- {{ truncateString(item.productName, 6) }}
- </view>
- </view>
- </scroll-view>
-
- <view v-else class="f36 mt150" style="text-align: center">
- 暂无中奖信息
- </view>
- </view>
- </view>
- </u-popup>
- </template>
- <script>
- export default {
- name: 'WinningRecordPopup',
-
- props: {
- // 控制显示/隐藏
- show: {
- type: Boolean,
- default: false
- },
- // 中奖记录列表
- prizeList: {
- type: Array,
- default: () => []
- },
- // 直播间ID
- liveId: {
- type: [String, Number],
- default: ''
- },
- // 滚动区域高度
- scrollHeight: {
- type: Number,
- default: 500
- }
- },
-
- data() {
- return {};
- },
-
- methods: {
- /**
- * 关闭弹窗
- */
- handleClose() {
- this.$emit('close');
- },
-
- /**
- * 处理填写地址
- */
- handleFillAddress(item) {
- this.$emit('fill-address', {
- productId: item.productId,
- recordId: item.id,
- liveId: this.liveId,
- item: item
- });
- },
-
- /**
- * 格式化时间显示
- */
- formatTime(timeStr) {
- if (!timeStr) return '';
- // 简单的格式化,可以根据需要调整
- return timeStr.length > 10 ? timeStr.substring(5, 16) : timeStr;
- },
-
- /**
- * 截断字符串
- */
- truncateString(str, maxLength) {
- if (typeof str !== 'string' || str.length <= maxLength) {
- return str || '';
- }
- return str.slice(0, maxLength) + '...';
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .winning_record {
- position: relative;
- height: 800rpx;
-
- .head_bg {
- position: absolute;
- top: -125rpx;
- left: 50%;
- width: 311rpx;
- transform: translateX(-50%);
- }
-
- .bg {
- width: 100%;
- height: 100%;
- }
-
- .winning_content {
- position: absolute;
- top: 50rpx;
- color: #fff;
- width: 100%;
- padding: 0 36rpx;
- box-sizing: border-box;
-
- .title {
- text-align: center;
- font-size: 40rpx;
- font-weight: 500;
- margin-bottom: 40rpx;
- }
-
- .row {
- display: flex;
- justify-content: space-between;
- text-align: center;
-
- .start {
- width: 40%;
- }
-
- .center {
- width: 20%;
-
-
- }
- .button {
- background-color: #fff;
- border-radius: 20rpx;
- color: #f4410b;
- padding: 4rpx 8rpx;
- }
- .end {
- width: 40%;
- }
- }
- }
- }
- </style>
|