Bladeren bron

添加关注组件

yerong 4 jaren geleden
bovenliggende
commit
3dc21683a4

+ 1 - 1
dist/wx

@@ -1 +1 @@
-Subproject commit 02d0600755ab81b4c155e7d9db96634948ff4d0c
+Subproject commit c73bc3933903aef88e14c50792c48beff80a5131

+ 3 - 0
src/App.vue

@@ -39,6 +39,9 @@ export default {
 <style>
 @import "../static/colorui/main.wxss";
 @import "../static/colorui/icon.wxss";
+.not_show{
+  visibility: hidden;
+}
 
 .full_img {
   width: 100%;

+ 29 - 4
src/components/index/login.vue

@@ -20,7 +20,11 @@
     </view>
     <van-toast id="van-toast"/>
     <van-dialog id="van-dialog"/>
-    <!--      <official-account @load="official_success"></official-account>-->
+    <van-overlay :show="official_show" @click="onClickHide">
+      <div class="official_container">
+        <official-account @load="official_success"></official-account>
+      </div>
+    </van-overlay>
 
   </div>
 </template>
@@ -28,14 +32,15 @@
 import Toast from '../../../static/vant/toast/toast';
 import Dialog from '../../../static/vant/dialog/dialog';
 import user_store from '@/store/index'
-import {userCheckInvite} from "../../requests/user";
+import {userCheckInvite, userCheckUnionid} from "../../requests/user";
 
 var $this
 export default {
   name: "login_container",
   data() {
     return {
-      is_scan: false
+      is_scan: false,
+      official_show: false
     }
   },
   methods: {
@@ -77,10 +82,24 @@ export default {
     },
     official_success($e) {
       console.log('关注组件加载成功', $e)
+    },
+    onClickHide() {
+      $this.official_show = false
     }
   },
   mounted() {
-    console.log(1)
+    mpvue.login({
+      success($res) {
+        let $js_code = $res.code
+        user_store.setters.setJsCode($js_code)
+        //检验js_code
+        userCheckUnionid($js_code).then((res) => {
+          let $res = res.data;
+          let $data = $res.data;
+          $this.official_show = $data['have_unionid'] == 2
+        })
+      }
+    })
   },
   onLoad(options) {
     let $this = this
@@ -134,4 +153,10 @@ export default {
   font-size: 11px;
   padding: 8px 0px;
 }
+
+.official_container {
+  width: 300px;
+  margin: auto;
+  margin-top: 300px;
+}
 </style>

+ 4 - 7
src/components/index/regist.vue

@@ -61,7 +61,7 @@
             style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">您在同意本应用服务使用协议之时,即视为您已经同意本隐私权政策全部内容。本隐私权政策属于本应用服务使用协议不可分割的一部分。</span><br/><br/>
             <view style="width: 100%;height: 10px;"></view>
             <span
-            style="font-family:宋体; font-size:12px;">1.</span><span
+              style="font-family:宋体; font-size:12px;">1.</span><span
             style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">适用范围</span><br/><span
             style="font-family:宋体; font-size:12px">(a)</span><span
             style="font-family:宋体; font-size:12px">&#xa0;</span><span style="font-family:宋体; font-size:12px">在您注册本应用帐号时,您根据本应用要求提供的个人注册信息;</span><br/><span
@@ -438,11 +438,7 @@ export default {
     $this.invite = user_store.getters.get_invite_code()
     // $this.invite = 1000000000
     console.log('regist-invite', $this.invite)
-    mpvue.login({
-      success($res) {
-        $this.js_code = $res.code
-      }
-    })
+    $this.js_code = user_store.getters.getJsCode()
   },
   created() {
     $this = this
@@ -498,7 +494,8 @@ export default {
   width: 100%;
   height: 500px;
 }
-.protocol_text{
+
+.protocol_text {
   font-size: 11px;
   padding-top: 4px;
 }

+ 4 - 2
src/pages/agent/customer/index.vue

@@ -50,7 +50,7 @@
           <view>
             <text class="text-sm">{{ user.user_name }}</text>
           </view>
-          <view>
+          <view :class="{not_show:user.create_time == ''}">
             <text class="text-normal">最后下单时间&emsp;</text>
             <text class="text-gray text-sm">{{user.create_time}}</text>
 
@@ -215,7 +215,9 @@ export default {
         let $data = res.data;
         $this.user_list = $data.data
         $this.user_list.forEach(($val, $index) => {
-          $val['create_time'] = formatTimeForSeconds($val['create_time'])
+          if ($val['create_time']){
+            $val['create_time'] = formatTimeForSeconds($val['create_time'])
+          }
         })
         $this.customer_count = $this.user_list.length
       })

+ 2 - 2
src/pages/user_center/recharge/index.vue

@@ -24,7 +24,7 @@
 
     <!--    黄金会员-->
     <div v-for="(item,index) in time_cards" :key="index">
-      <div class="vip" :class="item.bg">
+      <div class="vip" :class="item.bg" @click="changeCardShow(item.goods_id)">
         <van-row>
           <van-col span="10" offset="6">
             <div class="card_body" style="padding-top:14px;">
@@ -84,7 +84,7 @@
     <!--  体验次卡-->
     <div v-for="(item,index) in frequency_card" :key="index">
 
-      <div class="normal vip">
+      <div class="normal vip" @click="changeCardShow(item.goods_id)">
         <van-row>
           <van-col span="10" offset="6">
             <div class="card_body" style="padding-top:14px;">

+ 11 - 0
src/requests/user.js

@@ -99,3 +99,14 @@ export function userUpdateAddress($params) {
   $params['access_token'] = wx.getStorageSync('token')
   return fly.post('user/update-address', $params)
 }
+
+
+//检查有没有关注公众号
+export function userCheckUnionid($js_code) {
+  let $params = {
+    js_code: $js_code,
+    access_token:11
+  }
+  return fly.post('user/check-unionid', $params)
+}
+

+ 7 - 0
src/store/index.js

@@ -10,6 +10,10 @@ const setters = {
   },
   set_userinfo(userinfo) {
     wx.setStorageSync('userinfo', userinfo)
+  },
+  //设置微信code值
+  setJsCode($param) {
+    wx.setStorageSync('js_code', $param)
   }
 }
 const getters = {
@@ -26,6 +30,9 @@ const getters = {
   },
   get_invite_code() {
     return wx.getStorageSync('code')
+  },
+  getJsCode() {
+    return wx.getStorageSync('js_code')
   }
 }
 export default {