123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- <template>
- <view>
- <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="我的盲票"></u-navbar>
- <!-- 状态 -->
- <view class="state">
- <u-tabs @change="changeTab" :scrollable="false" :list="stateArr" lineWidth="60" lineHeight="3"
- lineColor="#F9822C" :activeStyle="{
- color: '#F9822C',
- transform: 'scale(1.1)',
- width: '100px'
- }" :inactiveStyle="{
- color: '#999',
- transform: 'scale(1)',
- width: '100px'
- }" itemStyle="padding-left: 25px; padding-right: 25px; height: 44px; text-align: center;">
- </u-tabs>
- </view>
- <!-- 列表 -->
- <view class="list">
- <view class="list-item" v-for="(item, index) in list" :key="index">
- <image :src="item.picUrl" mode="aspectFit"></image>
- <view class="list-item-content flex">
- <view class="top">
- <view class="top-title">{{ item.title }}</view>
- <view class="top-num">序列号:{{ item.serialNo }}</view>
- <view class="top-price" v-if="item.status != '2'">面值:¥{{ $numberFormat(item.facePrice) }}</view>
- </view>
- <view class="bottom flex" v-if="item.status == '2'">
- <view class="bottom-price">面值:<text>¥{{ $numberFormat(item.facePrice) }}</text></view>
- <view class="bottom-btn" @click="toChoice(item)">立即兑奖</view>
- </view>
- <view class="bottom" v-else>
- <view class="bottom-price ells-one">奖品:<text>{{ item.prizeInfo || '-' }}</text></view>
- </view>
- </view>
- </view>
- </view>
- <view class="flex empty" v-if="!list.length">
- <view class="center">
- <image class="center-img" src="https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/v2/nodata_3.png" mode="scaleToFill"></image>
- <view class="center-font">暂无盲票</view>
- </view>
- <!-- <u-empty text="数据为空" mode="order" /> -->
- </view>
- </view>
- </view>
- </template>
- <script>
- import env from '../../config/env.js'
- import $http from '@/utils/request.js'
- export default {
- data() {
- return {
- stateArr: [{
- name: ' 待兑奖',
- }, {
- name: ' 已兑奖',
- }],
- state: 2,
- pageNum: 1,
- total: 0,
- list: [],
- };
- },
- onShow() {
- this.pageList()
- },
- onLoad(){
- this.rewardNum()
- },
- methods: {
- getList() {
- uni.showLoading({
- title: '加载中'
- });
- $http.post(`/api/v1/mp/user/mine/ticket/list?pageNum=${this.pageNum}&pageSize=20`, {
- status: this.state
- }).then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- res.rows.forEach(item => {
- item.picUrl = env.filePublic + item.picUrl.split(',')[0] + '?imageView2/2/w/170'
- })
- this.total = res.total
- this.list = this.list.concat(res.rows)
- }
- }).catch(() => {
- uni.hideLoading();
- })
- },
- pageList() {
- this.pageNum = 1
- this.list = []
- this.getList()
- },
- toChoice(item) {
- console.log(item);
- let type = item.type && JSON.parse(item.type).value
-
- if(type == 'offline') {
- uni.navigateTo({
- url: `/packagePrize/choice/index?id=${ item.ticketId }&type=offLine`
- })
- } else if (type == 'online') {
- uni.navigateTo({
- url: `/packagePrize/rolling/index?ticketId=${ item.ticketId }&isTry=0`
- })
- } else {
- uni.$u.toast('请联系客服')
- }
- },
- changeTab(e) {
- if (e.index == 0) {
- this.state = 2
- } else if (e.index == 1) {
- this.state = 3
- }
- this.pageList()
- },
- rewardNum() {
- $http.post(`/api/v1/mp/user/mine/ticket/list?pageNum=${this.pageNum}&pageSize=20`, {
- status: 2
- }).then(res => {
- $http.post(`/api/v1/mp/user/mine/ticket/list?pageNum=${this.pageNum}&pageSize=20`, {
- status: 3
- }).then(data => {
- if (res.code == 0) {
- this.stateArr = [{
- name: ' 待兑奖 (' + res.total + ') '
- },
- {
- name: ' 已兑奖 (' + data.total + ') '
- },
- ]
- } else {
- this.stateArr = [{
- name: ' 待兑奖 (0)',
- }, {
- name: ' 已兑奖 (0)',
- }, ]
- }
- })
- })
- }
- },
- onReachBottom() {
- // 判断是否有数据
- if (this.total > this.pageNum * 20) {
- setTimeout(() => {
- ++this.pageNum
- this.getList()
- }, 500)
- } else {
- uni.$u.toast('已经到底了')
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- // 状态
- .state {
- display: flex;
- position: fixed;
- background-color: #FFFFFF;
- width: 100%;
- z-index: 10;
- box-shadow: 0 5rpx 5rpx #ececec;
- }
-
- // 列表
- .list {
- padding: 120rpx 0 100rpx;
- margin: 0 20rpx 0;
-
- &-item {
- display: flex;
- background: #FFFFFF;
- border-radius: 11px;
- padding: 34rpx 10rpx;
- margin-bottom: 34rpx;
-
- image {
- width: 200rpx;
- height: 270rpx;
- border-radius: 22rpx;
- margin-right: 15rpx;
- }
-
- &-content {
- flex: 1;
- flex-direction: column;
- justify-content: space-between;
- padding: 16rpx 0;
-
- .top {
- width: 100%;
- display: flex;
- flex-direction: column;
-
- &-title {
- font-size: 36rpx;
- line-height: 36rpx;
- font-weight: bold;
- margin-bottom: 46rpx;
- }
-
- &-num {
- font-size: 26rpx;
- line-height: 26rpx;
- }
-
- &-price {
- margin-top: 30rpx;
- font-size: 26rpx;
- line-height: 26rpx;
- }
- }
-
- .bottom {
- width: 100%;
- justify-content: space-between;
-
- &-price {
- height: 26rpx;
- overflow: hidden;
- font-size: 26rpx;
- line-height: 26rpx;
-
- text {
- color: #F9822C ;
- }
- }
-
- &-btn {
- width: 220rpx;
- height: 72rpx;
- line-height: 72rpx;
- text-align: center;
- background: #F9822C;
- border-radius: 36rpx;
- color: #FFFFFF;
- font-size: 30rpx;
- }
- }
- }
- }
- }
- .empty {
- height: 60vh;
-
- .center {
- text-align: center;
-
- &-img {
- width: 228rpx;
- height: 320rpx;
- }
-
- &-font {
- font-size: 30rpx;
- font-weight: 400;
- color: #999999;
- margin-bottom: 250rpx;
- }
- }
- }
- </style>
|