123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- <template>
- <div id="personal">
- <!-- 用户信息-->
- <div :class="{userinfoYellow:userinfo.isActive, userinfoGrey:userinfo.isntActive}" >
- <van-row class="padding">
- <van-col span="3" offset="2">
- <view class="cu-avatar radius lg" :style="'background-image:url('+userinfo.portrait+');'"></view>
- </van-col>
- <van-col span="12" offset="1">
- <div class="flex flex-direction align-start justify-start">
- <div>
- <text class="text-black text-bold">{{ userinfo.user_name }}</text>
- </div>
- <div class="flex justify-between align-center">
- <button class="cu-btn sm round" :class="{level_btn_yellow:userinfo.isActive, level_btn_grey:userinfo.isntActive}">
- {{ userinfo.level_name }}
- </button>
- <view class="text-xs padding-left" v-if="userinfo.level != 1">有效期至 {{ userinfo['validity_time'] }}</view>
- </div>
- </div>
- </van-col>
- <van-col span="5">
- <view class="text" @click="to_user_center">
- <text class="cuIcon-people"></text>
- <text class="under_line">会员中心</text>
- </view>
- </van-col>
- </van-row>
- <van-row class="padding">
- <view style="opacity: 1;">
- <van-col span="4" class="lg" offset="2">
- <text class="cuIcon-selection"></text>
- 卡号:
- </van-col>
- <van-col span="8">
- <text class="text-white text-bold text-lg">{{ invite_code }}</text>
- </van-col>
- </view>
- </van-row>
- <van-row>
- <van-col span="6" offset="1">
- <div class="flex flex-direction align-center">
- <text class="text-xxl">{{ userinfo.play_time }}</text>
- <text class="font-sm">可用时长(分钟)</text>
- </div>
- </van-col>
- <van-col span="7" offset="2" @click="to_coupons">
- <div class="flex flex-direction align-center">
- <text class="text-xxl">{{ userinfo.coupon }}</text>
- <text class="font-sm">已领券数量</text>
- </div>
- </van-col>
- <van-col span="6" offset="2">
- <div class="flex flex-direction align-center">
- <text class="text-xxl">{{ userinfo.experience }}</text>
- <text class="font-sm">次卡</text>
- </div>
- </van-col>
- </van-row>
- </div>
- <view class="text-center font-sm" v-if="userinfo.level >= 3 && userinfo.level <= 7">
- <text class="text-gray">今日专注力免费训练时长还有:
- <text class="text-yellow">{{ userinfo.free_time }}</text>
- </text>
- </view>
- <!-- 领券弹窗-->
- <van-popup
- :show="twenty&first"
- :close-on-click-overlay="false"
- custom-class="pop"
- overlay
- z-index="99"
- >
- <div class="quan_container">
- <van-row gutter="10">
- <van-col span="14" offset="1">
- <div class="padding-top-sm margin-bottom-sm">
- <text class="title">
- 水母会员次卡体验券1张
- </text>
- <text class="text-xs ">
- {{userinfo.certainTime}} 当天领取有效
- </text>
- </div>
-
- <view class="padding-tb">
- <text class="time">
- 10
- </text>
- <text class="time_text">
- 分钟
- </text>
- </view>
- </van-col>
- <van-col span="5" offset="4" class="" @click="get_ticket">
- <view class="get_ticket_text">领取</view>
- </van-col>
- </van-row>
- </div>
- </van-popup>
- <!-- 窗口弹出-->
- <van-popup :show="pop_show" @close="close_pop" round>
- <div class="err_container flex flex-direction align-center justify-around">
- <view>
- <text class="title">
- 您当前剩余时间不足
- </text>
- </view>
- <view>
- <text class="sub-title">
- 请充值后进行游戏
- </text>
- </view>
- <img src="https://img.shuimuai.com/web/sign_notimeJfish.png" class="err_img" alt="">
- <button class="cu-btn lg bg-primary text-white" @click="to_recharge">立即充值</button>
- </div>
- </van-popup>
- <van-toast id="van-toast"/>
- </div>
- </template>
- <script>
- import { userUpdateLoginTime } from "../../requests/user";
- import { couponReceiveFirst } from "../../requests/coupons";
- import Toast from "../../../static/vant/toast/toast";
- import { reload_userinfo } from "../../utils/user";
- import user_store from "@/store/index";
- var $this;
- export default {
- name: "personal",
- data() {
- return {
- userinfo: {
- //判断是否第一次进入小程序 1为是第一次 0为非第一次
- },
- first: false,
- pop_show: false,
- receive: 0,
- invite_code: false,
- twenty: false,
- };
- },
- methods: {
- get_ticket() {
- if ($this.receive == 0) {
- $this.receive += 1;
- console.log($this.receive);
- $this.first = false;
- couponReceiveFirst().then((res) => {
- let $res = res.data;
- if ($res.code == 0) {
- $this.first = false;
- userUpdateLoginTime().then((res) => {
- let $res = res.data;
- $this.userinfo["login_time"] = $res.data;
- $this.$store = user_store.setters.set_userinfo($this.userinfo);
- wx.setStorageSync("is_first", false);
- reload_userinfo($this);
- });
- Toast.success($res.errmsg);
- } else {
- Toast.fail($res.errmsg);
- }
- });
- }
- },
- //修改第一次登录状态
- close_pop() {
- this.pop_show = false;
- },
- //跳转充值中心
- to_recharge() {
- mpvue.navigateTo({
- url: "/pages/user_center/recharge/main",
- });
- },
- //跳转用户中心
- to_user_center() {
- mpvue.navigateTo({
- url: "/pages/user_center/main",
- });
- },
- to_coupons() {
- mpvue.navigateTo({
- url: "/pages/coupons/main",
- });
- },
- change_login_status() {
- $this.$emit("change_login_status");
- },
- },
- mounted() {
- $this.first = wx.getStorageSync("is_first");
- $this.invite_code = wx.getStorageSync("code");
- reload_userinfo($this);
- //判断是否每月20号
- let day = new Date().getDate();
- if (day == 20) {
- wx.setStorageSync("is_twenty", true);
- } else {
- wx.setStorageSync("is_twenty", false);
- }
- $this.twenty = wx.getStorageSync("is_twenty");
- console.log("状态", $this.first & $this.twenty);
- },
- onShow() {
- reload_userinfo($this);
- },
- created() {
- $this = this;
- },
- onPullDownRefresh() {
- reload_userinfo($this);
- },
- };
- </script>
- <style scoped>
- .userinfoYellow {
- background-image: url("https://img.shuimuai.com/huiyuankadiban.png");
- background-position: center;
- background-size: 100% 100%;
- width: 99%;
- height: 173px;
- margin: 0px auto;
- }
- .userinfoGrey {
- background-image: url("https://img.shuimuai.com/pic_grey.png");
- /* background-image: url("https://img.shuimuai.com/huiyuankadiban.png"); */
- background-position: center;
- background-size: 100% 100%;
- width: 99%;
- height: 173px;
- margin: 0px auto;
- }
- #personal {
- width: 100%;
- position: relative;
- top: -95px;
- z-index: 3;
- }
- .level_btn_yellow {
- background-color: #e3a000;
- }
- .level_btn_grey {
- background-color: #909090;
- }
- .jifen {
- position: absolute;
- top: 73px;
- }
- .font-sm {
- font-size: 10px;
- }
- .quan_container {
- background-image: url("https://img.shuimuai.com/web/index_item_quan.png");
- background-position: center;
- background-size: 100% 100%;
- width: 340px;
- height: 115px;
- }
- /*标题*/
- .quan_container .title {
- font-size: 15px;
- font-weight: 400;
- color: #030000;
- line-height: 24px;
- }
- /*子标题*/
- .quan_container .sub-title {
- font-size: 10px;
- font-weight: 400;
- color: #030000;
- line-height: 24px;
- }
- /*分钟数*/
- .quan_container .time {
- font-size: 36px;
- font-weight: 400;
- color: #030000;
- line-height: 24px;
- }
- /*分钟二字*/
- .quan_container .time_text {
- font-size: 12px;
- font-weight: 400;
- color: #030000;
- line-height: 24px;
- margin-left: -5px;
- }
- /*领取二字*/
- .quan_container .get_ticket_text {
- font-size: 18px;
- font-weight: 400;
- color: #ffffff;
- line-height: 24px;
- margin: 45px 0px;
- }
- /*弹窗模块*/
- .err_container {
- width: 260px;
- height: 300px;
- border-radius: 5px;
- }
- /*标题*/
- .err_container .title {
- font-size: 20px;
- font-weight: bold;
- color: #4c4c4c;
- line-height: 24px;
- }
- /*子标题*/
- .err_container .sub-title {
- font-size: 12px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #4b4b4b;
- line-height: 24px;
- }
- .err_img {
- width: 73px;
- height: 83px;
- }
- </style>
- <style>
- .pop {
- background-color: rgba(255, 255, 255, 0) !important;
- }
- </style>
|