123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511 |
- <template>
- <view class="content">
- <view class="top">
- <view class="avater">
- <image :src="userInfo.avatar" class="avater-img" mode="" v-if="userInfo.avatar"></image>
- <image src="../../static/img/002.png" mode="" v-else class="avater-img"></image>
- </view>
- <view class="name-box">
- <view class="name-top">
- {{userInfo.nickname}}<text v-if="userInfo && userInfo.level_name && userInfo.level > 1">{{'('+ userInfo.level_name +')'}}</text>
- </view>
- <view class="" v-if="userInfo && userInfo.level_name && userInfo.level > 1" style="color: #fff;font-size: 32rpx;">
- <text v-if="vip_endtime < newTime">已到期,立即续费</text><text>{{userInfo.vip_endtime | time}} 到期<text @click="xuFei()">(续费)</text></text>
- </view>
- </view>
- </view>
- <view class="nav-wrapper">
- <view class="nav-item flex" @click="tohelp">
- <view class="item-left flex">
- <image src="../../static/icon/u-1.png" mode="" class="img1"></image>
- <view class="title">求救记录</view>
- </view>
- <view class="item-right">
- >
- </view>
- </view>
- <view class="nav-item flex" @click="torreco">
- <view class="item-left flex">
- <image src="../../static/icon/u-2.png" mode="" class="img2"></image>
- <view class="title">救援记录</view>
- </view>
- <view class="item-right">
- >
- </view>
- </view>
- <view class="nav-item flex" @click="navTo('/pages/form/myDonate')">
- <view class="item-left flex">
- <image src="../../static/icon/u-3.png" mode="" class="img1"></image>
- <view class="title">捐款记录</view>
- </view>
- <view class="item-right">
- >
- </view>
- </view>
- <view class="nav-item flex" @click="tocertificates" >
- <view class="item-left flex">
- <image src="../../static/icon/u-4.png" mode="" class="img4"></image>
- <view class="title">我的证书</view>
- </view>
- <view class="item-right">
- >
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- import { detail_training } from '@/api/train.js';
- import {
- userinfo,
- logout
- } from '@/api/user.js';
- // #ifdef H5
- import {
- weixindata
- } from '@/utils/wxAuthorized';
- // #endif
- import { getVipmoney, createOrder } from '@/api/index.js'
- export default {
- data() {
- return {
- common_address:'',
- name:'',
- signDate:'',
- id:0,
- is_over:0,
- newTime: 0,
- money: '',
- mid: '',
- }
- },
- filters: {
- time(val) {
- let str = '';
- // console.log(val)
- if (val) {
- let date = new Date(val * 1000);
- let Y = date.getFullYear();
- let M = date.getMonth() + 1 > 9 ? (date.getMonth()+1) : '0' + (date.getMonth()+1);
- let D = date.getDate() > 9 ? date.getDate() : '0' + date.getDate();
- str = Y + '年' + M + '月' + D + '日';
- }
- return str;
- },
- },
- onShow() {
- console.log(this);
- let obj = this
- // 判断是否已经登录
- if (this.hasLogin) {
- this.loadBaseData();
- getVipmoney().then(({
- data
- }) => {
- console.log(data, 'getVipmoney');
- data.forEach(e => {
- if (e.name == obj.userInfo.level_name) {
- obj.money = e.pay_price;
- obj.mid = e.id;
- console.log(obj.money, obj.mid)
- }
- });
- });
- } else {
- saveUrl();
- uni.showModal({
- title: '登录',
- content: '您未登录,是否马上登陆?',
- success: e => {
- if (e.confirm) {
- interceptor();
- }
- },
- fail: e => {
- console.log(e);
- }
- });
- }
- this.type = this.userInfo.type;
- this.common_address = this.userInfo.common_address
- let str = new Date()
- this.newTime = str.getTime()
- console.log('点前保存的地址',this.common_address)
- // 保存当前页面
- },
- onReady() {
- console.log(99999)
- // detail_training({
- // id:this.id,
- // }).then(({data}) => {
- // console.log(999,data)
- // this.name = data.name
- // this.signDate = data.add_time
- // this.is_over = data.is_over
- // })
- },
- computed: {
- ...mapState('user', ['hasLogin', 'userInfo']),
- ...mapState(['weichatObj']),
- },
- methods: {
- ...mapMutations('user', ['setUserInfo','logout']),
- // 续费
- xuFei() {
- let obj = this
- uni.showModal({
- title: '提示',
- content: '续费' + obj.userInfo.level_name + '需要缴纳' + obj.money + '元年费,是否续费',
- success: function(res) {
- if (res.confirm) {
- console.log('用户点击确定');
- createOrder({
- level_id: obj.mid,
- body: '红会年费',
- pay_type: 0,
- // name: obj.name,
- pay_price: obj.money,
- from: 'weixin'
- }).then(({data}) =>{
- let res = data.jsConfig;
- obj.weichatObj.chooseWXPay({
- timestamp: res.timestamp,
- nonceStr: res.nonceStr,
- package: res.package,
- signType: res.signType,
- paySign: res.paySign,
- success: function(res) {
- // uni.navigateTo({
- // url: '../joinSuc/joinNow'
- // });
- obj.loadBaseData()
- uni.showModal({
- title:'提示',
- content: '续费成功'
- })
- },
- fail: function(res) {
- console.log(res, "失败")
- console.log(res.errMsg)
- }
- });
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- // 登出
- loginout() {
- let obj = this;
- uni.showModal({
- content: '确定要退出登录么',
- success: e => {
- if (e.confirm) {
- logout({}).then(e => {
- obj.logout();
- uni.switchTab({
- url: '/pages/index/index'
- })
- })
- .catch(e => {
- console.log(e);
- });
- }
- }
- });
- },
- tojkjl() {
- uni.navigateTo({
- url: '/pages/user/jkjl'
- })
- },
- loadBaseData() {
- userinfo({}).then(({
- data
- }) => {
- this.setUserInfo(data);
- });
- // #ifdef H5
- weixindata();
- // #endif
- // detail_training({
- // id:this.id,
- // }).then(({data}) => {
- // console.log(9,data)
- // this.name = data.name
- // this.signDate = data.add_time
- // this.is_over = data.is_over
- // })
- },
- toMyfu() {
- uni.navigateTo({
- url: '/pages/user/myFu'
- })
- },
- torreco() {
- uni.navigateTo({
- url: '/pages/applic/rescuerecords'
- })
- },
- tohelp() {
- uni.navigateTo({
- url: '/pages/applic/helprecords'
- })
- },
- commonaddress() {
- uni.navigateTo({
- url: '/pages/applic/commonaddress?add=' + this.common_address
- })
- },
- tocertificates() {
- uni.navigateTo({
- // pages/form/certificatesList
- // url: '/pages/form/certificates?name=' + this.name + '&signDate=' + this.signDate
- url: '/pages/form/certificatesList'
- })
- },
- navTo(url) {
- console.log(url)
- uni.navigateTo({
- url: url
- })
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- min-height: 100%;
- height: auto;
- background: #fff;
- }
- .content {
- line-height: 1.5;
- background-color: #fff;
- height: 100%;
- .top {
- width: 750rpx;
- height: 432rpx;
- // background-color: #fa7e67;
- display: flex;
- flex-direction: column;
- align-items: center;
- // padding-left: 55rpx;
- align-items: center;
- justify-content: center;
- background-image: url(../../static/img/userbg.png);
- background-size: 100% 100%;
- .avater {
- width: 150rpx;
- height: 150rpx;
- // margin-right: 28rpx;
- .avater-img {
- width: 100%;
- height: 100%;
- border-radius: 50%;
- }
- }
- .name-box {
- // flex: 1;
- padding-top: 25rpx;
- .name-top {
- font-size: 42rpx;
- font-weight: 400;
- margin-bottom: 15rpx;
- font-size: 32rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- text-align: center;
- }
- .name-bottom{
- margin-top: 16rpx;
- display: flex;
- align-items: center;
- // justify-content: center;
-
- .nameInfo{
- color: #FFFFFF;
- padding: 6rpx 16rpx;
- border: 1rpx solid #FFFFFF;
- border-radius: 12rpx;
- // background-color: pink;
- }
- }
- .name-footbox {
- .name-foot {
- text-align: center;
- font-size: 22rpx;
- font-weight: 400;
- color: #FFFFFF;
- background: rgba(255, 255, 255, 0.2);
- border: 1px solid #FFFFFF;
- border-radius: 20rpx;
- padding: 3rpx 13rpx;
- }
- }
- }
- }
- .center-box {
- width: 687rpx;
- // height: 235px;
- background: #FFE8E8;
- border-radius: 16rpx;
- margin: -90rpx auto 0;
- .center-top {
- width: 687rpx;
- height: 80rpx;
- background: #FFFFFF;
- border-radius: 16rpx 16rpx 0 0;
- display: flex;
- align-items: center;
- padding-left: 30rpx;
- .top-left {
- width: 126rpx;
- line-height: 32rpx;
- text-align: center;
- background: linear-gradient(0deg, #C90F1B, #F14D33);
- font-size: 22rpx;
- font-weight: 400;
- color: #FFFFFF;
- border-radius: 20rpx;
- margin-right: 10rpx;
- }
- .top-right {
- font-size: 22rpx;
- font-weight: 400;
- color: #CB151D;
- }
- }
- .center-foot {
- height: 155rpx;
- display: flex;
- .foot-list {
- flex: 1;
- text-align: center;
- padding-top: 20rpx;
- .list-top {
- font-size: 39rpx;
- font-weight: 400;
- color: #CB141D;
- line-height: 58rpx;
- }
- .list-foot {
- font-size: 39rpx;
- font-weight: 400;
- color: #666666;
- line-height: 58rpx;
- }
- }
- }
- }
- .tt {
- display: flex;
- flex-wrap: wrap;
- padding-left:32rpx;
- .tt-box {
- width: 206rpx;
- height: 206rpx;
- border-radius: 10rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- margin-right: 35rpx;
- margin-bottom: 30rpx;
- image {
- width: 64rpx;
- height: 64rpx;
- }
- .tt-txt {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #5A5A74;
- padding-top: 35rpx;
- }
- }
- }
- }
- .nav-wrapper {
- width: 678rpx;
- // height: 560rpx;
- background: #FFFFFF;
- box-shadow: 0px 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.06);
- border-radius: 20rpx;
- margin: 32rpx auto 0;
- color: #555555;
- .nav-item {
- height: 115rpx;
- border-bottom: 1rpx #F6F6F6 solid;
- &:last-of-type {
- border-bottom: none;
- }
- justify-content: space-between;
- align-items: center;
- padding: 0 36rpx 0 40rpx;
- .item-left {
-
- align-items: center;
- image {
- // background-color: red;
- }
- .img1 {
- width: 34rpx;
- height: 34rpx;
- margin-right: 21rpx;
- }
- .img2 {
- width: 36rpx;
- height: 32rpx;
- margin-right: 19rpx;
- }
- .img3 {
- width: 28rpx;
- height: 36rpx;
- margin-right: 25rpx;
- }
- .img4 {
- width: 36rpx;
- height: 28rpx;
- margin-right: 19rpx;
- }
- .title {
- font-size: 32rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #555555;
- }
- }
- .item-right {
- line-height: 115rpx;
- }
- }
- }
- </style>
|