shish 6 лет назад
Родитель
Сommit
ded41bf297
2 измененных файлов с 31 добавлено и 18 удалено
  1. 16 1
      mall/src/pages/home/components/login-popup.vue
  2. 15 17
      mall/src/pages/home/user.vue

+ 16 - 1
mall/src/pages/home/components/login-popup.vue

@@ -12,7 +12,7 @@
         <div class="popup-attr-wrap">
           <img :src="wxInfo.smallAvatarUrl | default_avatar" mode="widthFix" alt />
         </div>
-        <!-- #ifdef MP-WEIXIN -->
+        <!-- #ifdef H5 -->
         <div class="creat-account-btn">
           <button class="button-com red big" @click="registerFn">点击授权登录</button>
         </div>
@@ -102,6 +102,14 @@ export default {
     merchantInfo: {
       type: Object,
       default: () => {}
+    },
+    subscribe: {
+      type: Number,
+      default: 0
+    },
+    mobile: {
+      type: String,
+      default: ""
     }
   },
   data() {
@@ -160,6 +168,13 @@ export default {
             icon: "success"
           });
           this.wxPhoneInfo = res.data.mobile;
+
+          //只要授权了手机号就将父页面里的申请会员按钮去除 shish 2020.5.11
+          //注册了手机号默认他也会关注公众号,申请会员 暂时按钮隐藏
+          //这里的数据要更新到父页面的shopUser里去,因不会做未实现
+          this.$emit('update:subscribe', 1)
+          this.$emit('update:mobile', res.data.mobile)
+
           wxLoginFn(true);
 
           setTimeout(() => {

+ 15 - 17
mall/src/pages/home/user.vue

@@ -8,14 +8,10 @@
         </div>
         <div class="button-wrap">
           <!-- #ifdef H5 -->
-          <button class="button-com" @click="showPopup">申请会员</button>
+          <button class="button-com">申请会员</button>
           <!-- #endif -->
           <!-- #ifdef MP-WEIXIN -->
-          <button
-            class="button-com mini-btn"
-            open-type="getUserInfo"
-            @getuserinfo="getWxAvatar"
-          >申请会员</button>
+          <button class="button-com mini-btn">申请会员</button>
           <!-- #endif -->
         </div>
       </template>
@@ -29,7 +25,7 @@
                 <div class="user-level-img">
                   <block v-if="!$util.isEmpty(shopUser)">
                     <appVipModule
-                      v-if="shopUser.member > 0"
+                      v-if="shopUser.member > 0 && mobile != '' && subscribe == 1"
                       class="level-img"
                       :text="`VIP${shopUser.member}`"
                     />
@@ -71,13 +67,7 @@
           <div class="my-surplus">{{ shopUser.userAsset.balance || 0.00 }}</div>
         </div>
         <div class="surplus-right">
-          <button
-            class="button-com"
-            v-if="shopUser.subscribe == 0 || !shopUser.mobile"
-            @click="showPopup"
-          >申请会员</button>
-          <!-- <button class="button-com" v-if="shopUser.isFull != 1" @click="showPopup">申请会员</button> -->
-          <!-- <button class="button-com mini-btn" open-type="getUserInfo" v-if="loginInfo.isFull != 1" @getuserinfo="getWxAvatar">申请会员</button> -->
+          <button class="button-com" v-if="subscribe == 0 || mobile == ''" @click="showPopup">申请会员</button>
           <!--<button class="button-com" @click="pageToFn({url: '/pages/pay/index',query: {pageStatus: 'recharge'}})">充值</button>-->
           <button
             class="button-com red"
@@ -137,6 +127,8 @@
       :info="wxInfo"
       :merchantInfo="merchantInfo"
       :isPublic="isPublic"
+      :subscribe.sync="subscribe"
+      :mobile.sync="mobile"
       @hide="hidePopup"
     />
     <!-- 登录弹窗 -->
@@ -180,9 +172,15 @@ export default {
       stepIndex: 0,
       wxInfo: {},
       loginShow: false,
-      merchantInfo: {}
+      merchantInfo: {},
+      mobile: "",
+      subscribe: 0
     };
   },
+  watch: {
+    mobile(newVal, oldVal) {
+    }
+  },
   computed: {
     ...mapGetters({ shopUser: "getShopUser" }),
     // #ifdef MP-WEIXIN
@@ -208,10 +206,10 @@ export default {
   methods: {
     init() {
       getShopUser().then(res => {
-        console.log("aaaaaaa");
-        console.log(res.mobile, res.subscribe);
         if (this.option.scan == 1) {
           //没有注册手机号或关注公众号的
+          this.mobile = res.mobile;
+          this.subscribe = res.subscribe;
           if (this.$util.isEmpty(res.mobile) || res.subscribe == 0) {
             this.isPublic = true;
             this.popupShow = true;