166 lines
3.1 KiB
Vue
166 lines
3.1 KiB
Vue
<template>
|
|
<view class="app">
|
|
<view class="contents" v-if="list&&list.length>0">
|
|
<view class="content" v-for="item in list">
|
|
<image :src="item.attachment" mode=""></image>
|
|
<view class="servename">
|
|
{{item.prizeName?item.prizeName:''}}
|
|
</view>
|
|
<view class="PointsRecord">
|
|
{{item.score?item.score:''}}积分
|
|
</view>
|
|
<view class="button" @tap="goexchange(item)">
|
|
兑换
|
|
</view>
|
|
</view>
|
|
<view style="width: 48%;" v-if="list.length%2!=0">
|
|
</view>
|
|
</view>
|
|
<u-empty v-else mode="list" icon-size='220' text='暂无可兑换商品'></u-empty>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
prizelist,
|
|
prizeExchangesave
|
|
} from '@/api/pagesB/PointsMall/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
query: {
|
|
identity: uni.getStorageSync('userinfo').cardNo,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
},
|
|
list: null,
|
|
total: 0,
|
|
};
|
|
},
|
|
onReady() { //更改导航栏文字
|
|
if (uni.getStorageSync('region') == 2) {
|
|
uni.setNavigationBarTitle({
|
|
title: '东营市健康银行'
|
|
});
|
|
} else {
|
|
uni.setNavigationBarTitle({
|
|
title: '积分兑换'
|
|
});
|
|
}
|
|
},
|
|
methods: {
|
|
goexchange(item) {
|
|
var obj = {
|
|
identity: this.query.identity,
|
|
prizeId: item.prizeId
|
|
}
|
|
prizeExchangesave(obj).then(res => {
|
|
if (res.code == 200) {
|
|
this.$refs.uToast.show({
|
|
title: '兑换成功',
|
|
type: 'success',
|
|
})
|
|
} else {
|
|
this.$refs.uToast.show({
|
|
title: res.msg,
|
|
type: 'error',
|
|
})
|
|
}
|
|
})
|
|
},
|
|
info() {
|
|
prizelist(this.query).then(res => {
|
|
this.list = res.rows
|
|
this.total = res.total
|
|
})
|
|
},
|
|
},
|
|
onLoad() {
|
|
this.info();
|
|
},
|
|
onReachBottom() { //下滑加载
|
|
if (this.list.length >= this.total) {} else {
|
|
this.query.pageNum++
|
|
prizelist(this.query).then(res => {
|
|
if (res.rows) {
|
|
res.rows.forEach(e => {
|
|
this.list.push(e)
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
onPullDownRefresh() { //下拉刷新
|
|
this.query.pageNum = 1;
|
|
this.info();
|
|
setTimeout(function() {
|
|
uni.stopPullDownRefresh();
|
|
}, 1000);
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.app {
|
|
::v-deep .u-empty {
|
|
margin-top: 25vh !important;
|
|
}
|
|
|
|
.contents {
|
|
padding-top: 10rpx;
|
|
display: flex;
|
|
width: 100%;
|
|
flex-wrap: wrap;
|
|
justify-content: space-evenly;
|
|
}
|
|
|
|
.content {
|
|
height: 514rpx;
|
|
background: #fff;
|
|
width: 48%;
|
|
position: relative;
|
|
border-radius: 5rpx;
|
|
margin: 0 0 20rpx 0;
|
|
|
|
.button {
|
|
width: 100rpx;
|
|
height: 44rpx;
|
|
line-height: 44rpx;
|
|
position: absolute;
|
|
text-align: center;
|
|
font-size: 22rpx;
|
|
font-weight: 400;
|
|
color: #fff;
|
|
right: 3%;
|
|
bottom: 5%;
|
|
background: #26A888;
|
|
border-radius: 5rpx;
|
|
}
|
|
|
|
.PointsRecord {
|
|
padding-top: 20rpx;
|
|
font-size: 22rpx;
|
|
font-weight: 400;
|
|
color: #26A888;
|
|
padding-left: 3%;
|
|
}
|
|
|
|
.servename {
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
font-size: 28rpx;
|
|
font-weight: 400;
|
|
color: #000000;
|
|
padding-left: 3%;
|
|
}
|
|
|
|
image {
|
|
width: 100%;
|
|
height: 355rpx;
|
|
border-radius: 5rpx;
|
|
}
|
|
}
|
|
}
|
|
</style> |