123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- <template>
- <view class="main">
- <view class="pageTop">
- <navbar ref="navbar" :config="config"></navbar>
- <view class="dataCls">
- <view class="dataCls_l">
- <view class="dataCls_l_num">{{userData.integral_able}}</view>
- <view>公益积分</view>
- </view>
- <view class="dataCls_r" @click="goPublicWelfare()">
- <view>做公益</view>
- </view>
- </view>
- <view class="shadeBox"></view>
- </view>
- <view class="listBox">
- <view class="listBox_tab">
- <view :class="{active:activeTab===0}" @click="switchTab(0)">公益积分明细</view>
- <view :class="{active:activeTab===1}" @click="switchTab(1)">捐赠明细</view>
- </view>
-
- <view class="list_item" v-for="(v,i) in list" :key="i" v-if="activeTab===0">
- <view class="list_item_l">
- <view class="list_item_l_text">{{v.mode}}</view>
- <view class="list_item_l_time">{{v.create_time.substr(0,10)}}</view>
- </view>
- <!-- <view class="list_item_r">
- <view @click="goShare()">查看证书</view>
- </view> -->
- <view class="list_item_r c_green" :class="{c_red:!v.bill_type}">{{v.bill_type?'+':'-'}} {{v.value}}
- </view>
- </view>
- <view class="list_item" v-for="(v,i) in donateList" :key="i" v-if="activeTab===1">
- <view class="list_item_l">
- <view class="list_item_l_text">{{v.content}}</view>
- <view class="list_item_l_time">{{v.create_time.substr(0,10)}}</view>
- </view>
- <view class="list_item_r">
- <view @click="goShare(v)">查看证书</view>
- </view>
- </view>
- <view class="loadmoreBox">
- <u-loadmore :status="status" />
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- config: {
- back: true, //false是tolbar页面 是则不写
- title: '我的公益积分',
- color: '#ffffff',
- //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
- backgroundColor: [0, 'transparent'],
- statusBarFontColor: '#ffffff',
- rightSlot: true,
- },
- activeTab:0,
- list:[],
- donateList:[],
- status: "nomore",
- totalPage: 0,
- param:{
- page:1,
- limit:10
- },
- userData:{}
- }
- },
- onLoad() {
- this.getLoveList();
- this.getData()
- },
- onPullDownRefresh() {
- this.activeTab=0
- this.param.page=1;
- this.list=[];
- this.getLoveList();
- this.getData()
- },
- onReachBottom() {
- if (this.status == "loadmore") {
- this.param.page++
- if(this.activeTab==0){
- this.getLoveList()
- }else{
- this.getDonateList()
- }
- }
- },
- methods:{
- switchTab(index){
- this.donateList=[];
- this.list=[];
- this.activeTab=index
- this.param.page=1;
- this.status = "loading"
- if(this.activeTab==0){
- this.getLoveList()
- }else{
- this.getDonateList()
- }
- },
- getData() {
- this.$http.get('/account/app-account-info').then(res => {
- if (res && res.code == 200) {
- this.userData=res.data
- }
- })
- },
- // 做公益
- goPublicWelfare(){
- uni.navigateTo({
- url:"/pages/publicWelfare/index"
- })
- },
- // 跳转 分享
- goShare(item){
- uni.navigateTo({
- url:"/pages/research/myPublicWelfare/share?title="+item.content+'&time='+item.create_time.substr(0,10)+'&code='+item.certificate_number
- })
- },
- // 爱心明细
- getLoveList() {
- this.status = "loading"
- this.$http.get('/integral/record/my-list',this.param).then(res => {
- if (res && res.code == 200) {
- this.list.push(...res.page.list);
- this.totalPage = res.page.totalCount;
- if (this.totalPage > this.list.length) {
- this.status = "loadmore"
- } else {
- this.status = "nomore"
- }
- uni.stopPullDownRefresh()
- }
- })
- },
- // 捐赠记录
- getDonateList(){
- this.$http.get('/donate/record/page',this.param).then(res => {
- if (res && res.code == 200) {
- this.donateList.push(...res.page.list);
- this.totalPage = res.page.totalCount;
- if (this.totalPage > this.donateList.length) {
- this.status = "loadmore"
- } else {
- this.status = "nomore"
- }
- uni.stopPullDownRefresh()
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .pageTop {
- width: 100%;
- height: 450rpx;
- background: url('/static/convenienceService/detailsBg.png')0 0 no-repeat;
- background-size: 752rpx 510rpx;
- position: relative;
- /deep/ .hx-navbar__fixed {
- background: url('/static/convenienceService/detailsBg.png')0 0 no-repeat;
- background-size: 752rpx 510rpx;
- }
- .dataCls {
- display: flex;
- justify-content: space-between;
- padding: 0 60rpx;
- margin-top: 80rpx;
- .dataCls_l {
- font-size: 28rpx;
- color: #F5F5F5;
- line-height: 40rpx;
- .dataCls_l_num {
- font-size: 38rpx;
- }
- }
- .dataCls_r {
- display: flex;
- align-items: center;
- view {
- font-size: 28rpx;
- color: #0B844A;
- padding: 20rpx 46rpx;
- border-radius: 40rpx;
- background: #ffffff;
- margin-bottom: 20rpx;
- }
- }
- }
- .shadeBox {
- width: 100%;
- height: 40rpx;
- background: #ffffff;
- border-radius: 40rpx 40rpx 0 0;
- position: absolute;
- bottom: 0;
- left: 0;
- }
- }
- .listBox {
- padding: 0 60rpx;
- .listBox_tab{
- display: flex;
- justify-content: space-around;
- view{
- font-size: 30rpx;
- color: #1A1A1A;
- padding-bottom: 22rpx;
- }
- .active{
- color: #22A834;
- position: relative;
- font-weight: 700;
- &::after{
- display: block;
- content: "";
- position: absolute;
- width: 100%;
- height: 4rpx;
- background: #22A834;
- left: 0;
- bottom: 0;
- }
- }
- }
- .list_item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1rpx solid #E6E6E6;
- padding: 30rpx 0;
- .list_item_l {
- .list_item_l_text {
- font-size: 28rpx;
- color: #1A1A1A;
- }
- .list_item_l_time {
- font-size: 24rpx;
- color: #999999;
- margin-top: 10rpx;
- }
- }
- .list_item_r {
- flex-shrink: 0;
- view{
- width: 157rpx;
- height: 63rpx;
- background: #2eb82a;
- border-radius: 32rpx;
- line-height: 63rpx;
- text-align: center;
- color: #ffffff;
- }
- }
- }
- .loadmoreBox {
- display: flex;
- justify-content: center;
- padding: 30rpx;
- }
- }
- .c_red {
- color: #FF3B3B;
- }
- .c_green {
- color: #118D44;
- }
- </style>
|