فهرست منبع

12/23 vip开始游戏不显示弹窗 & 购买vip提示弹窗

Foystor 3 سال پیش
والد
کامیت
f18656ba87

+ 2 - 2
project.config.json

@@ -32,9 +32,9 @@
     "packNpmRelationList": [],
     "minifyWXSS": true,
     "disableUseStrict": false,
+    "minifyWXML": true,
     "showES6CompileOption": false,
-    "useCompilerPlugins": false,
-    "minifyWXML": true
+    "useCompilerPlugins": false
   },
   "miniprogramRoot": "dist/wx/",
   "compileType": "miniprogram",

+ 0 - 6
project.private.config.json

@@ -13,12 +13,6 @@
     "miniprogram": {
       "list": [
         {
-          "name": "pages/index/main",
-          "pathName": "pages/index/main",
-          "query": "other=0",
-          "scene": 1065
-        },
-        {
           "name": "pages/coupons/main",
           "pathName": "pages/coupons/main",
           "query": "",

+ 7 - 1
src/components/device/toy/connecting.vue

@@ -282,6 +282,7 @@
 </template>
 
 <script>
+import { timestamp } from "@/requests/user";
 import { gameStart } from "@/requests/game";
 import Toast from "../../../../static/vant/toast/toast";
 import game_store from "../../../store/game";
@@ -317,7 +318,12 @@ export default {
         Toast.fail("请佩戴好脑环开始训练");
         return false;
       }
-      $this.pay_window = true;
+
+      if(wx.getStorageSync("userinfo").level == 11){
+        $this.choose_pay(2)
+      }else{
+        $this.pay_window = true;
+      }
     },
     //选择消费的时间或者次数
     choose_pay($event) {

+ 1 - 1
src/components/index/personal.vue

@@ -16,7 +16,7 @@
                 {{ userinfo.level_name }}
 
               </button>
-              <view class="text-xs padding-left" v-if="userinfo.level == 11">有效期至 {{ userinfo['validity_time'] }}</view>
+              <view class="text-xs padding-left" v-if="userinfo.level == 11">有效期至 {{ userinfo['validity_time_formatted'] }}</view>
             </div>
           </div>
         </van-col>

+ 9 - 12
src/pages/report/index.vue

@@ -56,7 +56,7 @@
           </view>
           <view class="left_content">
             <view class="left_num">{{ record.height_absorbed }}<text class="textLil text-gray">%</text></view>
-            <view class="left_text">高专注力<br/>&emsp;占比</view>
+            <view class="left_text">高专注<br/>&nbsp;占比</view>
           </view>
         </view>
         <!-- 数据详情 -->
@@ -82,7 +82,7 @@
         <!-- 平均专注力 -->
         <view class="margin_right ">
           <view class="right_num">{{ record.att_average_big }}<text class="text-sm">{{ record.att_average_lil }}</text></view>
-          <view class="right_text">平均专注力</view>
+          <view class="right_text">专注力平均值</view>
         </view>
 
       </view>
@@ -501,9 +501,9 @@
 
         <!-- 占比 -->
         <cover-view class="flex justify-center radar_explain_view grid padding-lg" v-if="radar_indication_type==2">
-          <cover-view class="text-black text-bold">高专注指数</cover-view>
+          <cover-view class="text-black text-bold">高专注占比</cover-view>
           <cover-view class="text_explain_center">
-            <cover-view class="text_explain_wrap">大于65分的高专注值在本次训练中的占比,高专注比越高越好</cover-view>
+            <cover-view class="text_explain_wrap">大于65分的高专注值在本次训练中的占比,高专注比越高越好</cover-view>
           </cover-view>
         </cover-view>
 
@@ -616,7 +616,7 @@ function initHightPieChart(canvas, width, height) {
   });
   canvas.setChart(hight_att_pie_charts);
 
-  var option = getHightPieChartOption(0, 0); // ECharts 配置项
+  var option = getHightPieChartOption(0); // ECharts 配置项
 
   hight_att_pie_charts.setOption(option);
 
@@ -640,7 +640,7 @@ function initRadarChart(canvas, width, height) {
     if(params.name.indexOf("专注力平均值") != -1) {
       $this.radar_indication_type = 1
 
-    } else if (params.name.indexOf("高专注指数") != -1) {
+    } else if (params.name.indexOf("高专注占比") != -1) {
       $this.radar_indication_type = 2
 
     } else if (params.name.indexOf("专注唤醒效率") != -1) {
@@ -760,14 +760,13 @@ export default {
           setTimeout(() => {
             $this.record = $res.data;
             let $options = getHightPieChartOption(
-              $this.record.height,
-              $this.record.total
+              $this.record.heightValue,
             );
             hight_att_pie_charts.setOption($options);
 
             //设置雷达图
             $options = getRadarChartOption([
-              $this.record.average, //平均
+              $this.record.att_average, //平均
               $this.record.heightValue, //高专注占比
               $this.record.awakenLast, //唤醒
               $this.record.lineMedValue, //和谐度
@@ -791,9 +790,7 @@ export default {
 
             $this.record.play_time = formatSeconds($this.record.play_time);
             $this.record.start_time = timestampToTimeS($this.record.start_time);
-            $this.record.height_absorbed = Math.ceil(
-              $this.record.height / $this.record.total * 100
-            );
+            $this.record.height_absorbed = parseInt($this.record.heightValue)
 
 
             let $pie_data = $this.record.level;

+ 3 - 4
src/pages/user_center/confirmPay/index.vue

@@ -33,9 +33,9 @@
           <text class="text-lg text-red" style="font-weight: bold;">{{data.represent}}&emsp;{{ data.discount * 10 }}折</text>
           <br>
         </view> -->
-        <view v-if="data.goods_id < 4" class="padding-tb">
+        
+        <!-- <view v-if="data.goods_id < 4" class="padding-tb">
            <label class="radio" @click='radiocon'>
-                <!-- <checkbox  :checked="data.check" id="radios"></checkbox> -->
                 <van-checkbox :value="checked" @click="onChange" checked-color="#FF720E">
                    <text class="text-lg text-orange">加购{{ data.add_price }}元,获得有效期增加{{ data.add_month }}个月</text>
                 </van-checkbox>
@@ -43,8 +43,7 @@
            </label>
 
             <br>
-            
-        </view>
+        </view> -->
       </view>
         
       <view>  

+ 82 - 61
src/pages/user_center/recharge/index.vue

@@ -235,15 +235,37 @@
     <button class="text-white cu-btn round scan_btn" @click="to_scan">扫描</button>
   </div>
 
-<!-- 不能购买弹窗 -->
+  <!-- 购买vip提示弹窗 -->
+  <van-popup
+      :show="vip_err_show"
+      @close="close_err_pop"
+      round
+    >
+      <div class="err_container flex flex-direction align-center justify-around padding-top-xl padding-lr-sm">
+        <div v-text="cant_buy_vip" class="padding-lr-lg text-lg text-black" style="line-height:28px"></div>
+
+        <div class="button_group flex justify-around">
+          <button
+            class="cu-btn bg-gray text-white lg margin-right-lg btnFail"
+            @click="close_err_pop"
+          >取消</button>
+          <button
+            class="cu-btn  bg-primary text-white lg btnFail"
+            @click="to_confirm(buy_vip_item)"
+          >确认</button>
+        </div>
+      </div>
+    </van-popup>
+  
+<!-- 不能购买时间弹窗 -->
   <van-popup
     :custom-style='cant_buy_popup'
-    :show="is_can_buy"
+    :show="is_cant_buy"
     :round="true" 
     @close="onClosePopup">
 
-      <span class="margin-bottom-sm">您是家庭VIP会员</span>
-      <span>无需购买时间包</span>
+      <div v-text="cant_buy_time"></div>
+
   </van-popup>
   <van-toast id="van-toast"/>
   </div>
@@ -271,11 +293,17 @@ export default {
       userinfo: {},
       //  选中的充值卡
       selection_card: {},
-      // 不可购买弹窗
-      is_can_buy: false,
+      // vip购买提示弹窗
+      vip_err_show:false,
+      cant_buy_vip:"",
+      buy_vip_item:{},
+      // 不可购买时间弹窗
+      is_cant_buy: false,
+      cant_buy_time:"",
       cant_buy_popup: `height:120px;
             width:70%;
             display:flex;
+            padding:10px;
             flex-direction:column;
             justify-content:center;
             align-items:center
@@ -285,6 +313,38 @@ export default {
   watch: {},
   methods: {
     to_confirm_vip($item) {
+      check_vip(1).then((res) => {
+        console.log("vip", res);
+
+        let $res = res.data
+        if ($res.code == 0) {
+          $this.to_confirm($item)
+
+        }else {
+          $this.cant_buy_vip = $res.errmsg
+          $this.buy_vip_item = $item
+          $this.vip_err_show = true;
+        }
+      });
+    },
+    //确认订单
+    to_confirm_time($item) {
+      // 判断家庭VIP是否过期
+      check_vip(2).then((res) => {
+        console.log("vip", res);
+        
+        let $res = res.data
+        if ($res.code == 0) {
+          $this.to_confirm($item)
+
+        } else {
+          $this.cant_buy_time = $res.errmsg
+          $this.is_cant_buy = true;
+        }
+      });
+    },
+    // 支付通用
+    to_confirm($item){
       console.log("data", $item);
       //实付
       if ($item.coupon.type == 3) {
@@ -328,62 +388,11 @@ export default {
         url: "/pages/user_center/confirmPay/main?data=" + data,
       });
     },
-    //确认订单
-    to_confirm_time($item) {
-      // 判断家庭VIP是否过期
-      check_vip().then((res) => {
-        console.log("vip", res);
-
-        if (res.code == 0) {
-          console.log("data", $item);
-          //实付
-          if ($item.coupon.type == 3) {
-            $item["total_price"] =
-              Math.round($item.price * $item.coupon.discount * 100) / 100;
-          } else if ($item.coupon.type == 2) {
-            $item["total_price"] =
-              Math.round(($item.price - $item.coupon.reduce) * 100) / 100;
-          } else if ($item.coupon.type == 4) {
-            $item["total_price"] =
-              Math.round(($item.price - $item.coupon.random) * 100) / 100;
-          } else {
-            $item["total_price"] =
-              Math.round($item.price * $item.discount * 100) / 100;
-          }
-          //减多少
-          if ($item.coupon.type == 3) {
-            $item["reduce"] =
-              Math.round(
-                ($item.price - $item.price * $item.coupon.discount) * 100
-              ) / 100;
-          } else if ($item.coupon.type == 2) {
-            $item["reduce"] = $item.coupon.reduce;
-          } else if ($item.coupon.type == 4) {
-            $item["reduce"] = $item.coupon.random;
-          }
-          // $item["total_price"] = ($item.price * $item.discount).toFixed(2);
-          if ($item.goods_id == 1) {
-            $item["add_price"] = 20;
-            $item["add_month"] = "一";
-          } else if ($item.goods_id == 2) {
-            $item["add_price"] = 30;
-            $item["add_month"] = "三";
-          } else if ($item.goods_id == 3) {
-            $item["add_price"] = 30;
-            $item["add_month"] = "三";
-          }
-          $this.selection_card = $item;
-          var data = JSON.stringify($item);
-          mpvue.navigateTo({
-            url: "/pages/user_center/confirmPay/main?data=" + data,
-          });
-        } else {
-          $this.is_can_buy = true;
-        }
-      });
-    },
     onClosePopup() {
-      $this.is_can_buy = false;
+      $this.is_cant_buy = false;
+    },
+    close_err_pop(){
+      $this.vip_err_show = false;
     },
     //跳转填写地址
     to_write_address() {
@@ -460,6 +469,8 @@ export default {
   },
   onShow() {
     $this.get_card_list();
+    $this.is_cant_buy = false
+    $this.vip_err_show = false;
   },
   created() {
     $this = this;
@@ -571,6 +582,16 @@ export default {
   background: #5959f8;
 }
 
+.btnFail{
+  width: 146px;
+  height: 44px;
+}
+
+.err_container {
+  width: 344px;
+  height: 312px;
+}
+
 /* 专注时间包颜色 */
 .relax_text {
   color: #eb7d07;

+ 2 - 1
src/requests/vip.js

@@ -15,8 +15,9 @@ export function vipCode($vip_code) {
 }
 
 // 是否可以购买
-export function check_vip() {
+export function check_vip($type) {
   let $params = {}
   $params['access_token'] = wx.getStorageSync('token')
+  $params['type'] = $type
   return fly.post('user/check-user', $params)
 }

+ 3 - 3
src/utils/index.js

@@ -609,7 +609,7 @@ export function cal_down_time($final_time) {
   };
 }
 
-export function getHightPieChartOption($params, $total) {
+export function getHightPieChartOption($params) {
   let $option = {
     tooltip: {
       // trigger: 'item'
@@ -636,7 +636,7 @@ export function getHightPieChartOption($params, $total) {
           },
         },
         {
-          value: Math.abs($total - $params),
+          value: Math.abs(100 - $params),
           name: '',
           itemStyle: {
             normal: {
@@ -663,7 +663,7 @@ export function getRadarChartOption($params) {
           max: 100
         },
         {
-          name: "高专注指数",
+          name: "高专注占比",
           max: 100
         },
         {

+ 5 - 18
src/utils/user.js

@@ -17,7 +17,6 @@ export function reload_userinfo($this) {
     1001, 1002, 1011, 1012, 1021, 1031
   ]
   userDetail().then((res) => {
-    // console.log("数据:",  $this.userinfo['validity_unformattedTime']);
     let _data = res.data.data.validity_time;
     console.log("有效时间:" + _data);
 
@@ -32,12 +31,13 @@ export function reload_userinfo($this) {
     // 联名活动要用
     wx.setStorageSync("phone", $this.userinfo.phone);
     $this.userinfo.birthday = formatBirthday($this.userinfo.birthday)
-    $this.userinfo['validity_unformattedTime'] = $this.userinfo['validity_time']
+    // $this.userinfo['validity_unformattedTime'] = $this.userinfo['validity_time']
+    $this.userinfo['validity_time_formatted'] = formatTime($this.userinfo['validity_time'])
 
     let nowTime = timestamp()
     //判断是否过期
     if ($this.userinfo['level'] == 11) {
-      if (nowTime > $this.userinfo['validity_unformattedTime']) {
+      if (nowTime > $this.userinfo['validity_time']) {
         $this.userinfo.isActive = false
         $this.userinfo.isntActive = true
       } else {
@@ -49,21 +49,8 @@ export function reload_userinfo($this) {
       $this.userinfo.isActive = true
       $this.userinfo.isntActive = false
     }
-    
-
-    //当天具体日期
-    // let date = new Date();
-    // let day = date.getDate();
-    // let Y = date.getFullYear() + "."
-    // let M = (date.getMonth() + 1 < 10 ?
-    //   "0" + (date.getMonth() + 1) :
-    //   date.getMonth() + 1) + ".";
-    // let D = (day < 10 ? "0" + day : day);
-    // $this.userinfo.certainTime = Y + M + D;
-
-    $this.userinfo['validity_time'] = formatTime($this.userinfo['validity_time'])
-    // console.log("数据:", $this.userinfo['validity_unformattedTime']);
-    // $this.userinfo['level_name'] = utils.get_level_name($this.userinfo['level'])
+ 
+    // $this.userinfo['validity_time'] = formatTime($this.userinfo['validity_time'])
     $this.userinfo['free_time'] = formatSeconds($this.userinfo['free_time'])
     //设置邀请码
     user_store.setters.set_invite_code($this.userinfo['invite_id'])