123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <template>
- <view class="page-school-index" v-if="donateInfo">
- <uni-nav-bar :fixed="true" height="160rpx" left-icon="home" color="white" backgroundColor="rgb(0,0,0,0)" :border="false" @clickLeft="onHome"/>
- <!-- <view class="user-header">
- <SchoolUserHeader :info="donateInfo.user"></SchoolUserHeader>
- </view> -->
- <view class="school-item">
- <view class="process">
- <view class="heart">{{heart}}</view>
- <view class="process-txt">
- <view class="bg"></view>
- <view class="bar">
- <view class="p" :style="{width:heart+'%'}"></view>
- </view>
- </view>
- </view>
- <view class="content">
- <view class="bg"></view>
- <view class="user">
- <view class="left">
- <view class="header">
- <image :src="donateInfo.user.avatar" class="img"></image>
- </view>
- <view class="info">
- <view class="text">已拥有:{{donateInfo.user.integral}}爱心币</view>
- <view class="text">已捐赠:{{donateInfo.user.integral_donate}}爱心币</view>
- </view>
- </view>
- <view class="right">
- <button class="btn active" @click="onOpenKey">
- <uni-icons type="heart-filled" color="#FFF" size="12"></uni-icons> 我要损赠
- </button>
- </view>
- </view>
-
-
- <view class="item-list">
- <view class="items">
- <view class="heart_total" >总共已添加了:{{donateInfo.info.current_num}}块砖块,还需要:{{donateInfo.info.total_num-donateInfo.info.current_num}}块砖</view>
- <block v-for="(it,index) in donateInfo.list ">
- <view class="item">
- <view class="date">{{it.createTime}}</view>
- <view class="name">{{it.content}}</view>
- <view class="qty">+{{it.num}}</view>
- </view>
- </block>
-
- </view>
-
- </view>
- <view class="donate" v-if="donateInfo.list.length<=0">
- <view class="mid">还没有捐赠记录哦!!!</view>
-
- </view>
-
- </view>
- </view>
-
- <uni-popup ref="popKey">
- <DonateKeyForm :info="donateInfo" :storeId="store_id" @onSuccess="onSuccess"></DonateKeyForm>
- </uni-popup>
- <!-- <page-btm-bar :active="4" /> -->
- </view>
- </template>
- <script>
- import {
- mapState,
- mapGetters,
- mapMutations
- } from 'vuex'
- const app = getApp();
- let hideLoading = true;
- import DonateKeyForm from '@/components/DonateKeyForm/DonateKeyForm.vue'
- import SchoolUserHeader from '@/components/SchoolUserHeader/SchoolUserHeader.vue'
- export default {
- components:{
- DonateKeyForm,
- SchoolUserHeader
- },
- computed: {
- ...mapState(['store_id','systemInfo','userInfo'])
- },
- data() {
- return {
- dataList:[{
- id:1,
- }],
- donateInfo:null,
- heart:0,
- };
- },
- onShow(){
- this.$store.dispatch('getOpenid', this.store_id);
- this.initDonate();
- },
- methods:{
-
- onHome(e){
- uni.switchTab({
- url:'/pages/theater/index/index'
- })
- },
-
- onSuccess(e){
- this.$refs.popKey.close();
- this.initDonate();
- },
-
- initDonate(){
- let _this=this;
- this.$http.request('donate/getInfo', {
- type:1,
- userId: this.userInfo.id,
- }, "", "", hideLoading).then(res => {
- _this.donateInfo=res.data;
- _this.initHeart();
- }).catch(err => {})
- },
- //初始化百分比
- initHeart(){
- let _this=this;
- let percent=0;
- if(_this.donateInfo.info.total_num>0){
- percent=_this.donateInfo.info.current_num/_this.donateInfo.info.total_num;
- }
- _this.heart=parseFloat(percent*100).toFixed(2);
- },
-
- onOpenKey(e){
- this.$refs.popKey.open("bottom");
- },
- }
- }
- </script>
- <style lang="scss">
- @import "./index.scss"
- </style>
|