Procházet zdrojové kódy

个人中心卡券跳转

kk.shi před 3 roky
rodič
revize
6b3df31052

+ 41 - 1
pages/welfareMall/personal/personal.js

@@ -14,6 +14,7 @@ Page({
     countNum: 0,
     grayTheme:false,
     navigationList:[],
+    couponPath: false,
   },
 
   /**
@@ -58,10 +59,25 @@ Page({
     })
   },
 
+  // 授权手机号--跳转导航栏
+  getPathCoupon(e) {
+    console.log(e)
+    getPhoneNumberSync(e, async () => {
+        let nums = await this.getCountNum();
+        console.log(nums)
+        this.setData({
+            isLogin: true,
+            mobileTop: getMobileCache(),
+            countNum: nums,
+        });
+        this.getCouponPath(e);  
+    })
+  },
+
   // 动态获取导航栏
   async getIndexList(){
     let res =  await WelfareMall.getPersonalData();
-
+    await this.getPath(res.data.navigationList);
     this.setData({
       navigationList:res.data.navigationList,
     })
@@ -91,6 +107,23 @@ Page({
   },
 
   /**
+   * 活动列表我的券包路径
+   * @param {*} nums 
+   */
+  getPath: async function(res){
+    if(res != null && res.length > 0){
+      for(var i = 0;i<res.length;i++){
+        if("/pages/welfareMall/coupon/coupon" == res[i].path){
+         this.setData({
+           couponPath: true,
+         })    
+         return;
+        }
+      }
+   }
+  },
+
+  /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {
@@ -123,6 +156,13 @@ Page({
 
   },
 
+  getCouponPath(e) {
+    const url = "/pages/welfareMall/coupon/coupon"
+    wx.navigateTo({
+        url
+    })
+  },
+
   /**
    * 生命周期函数--监听页面隐藏
    */

+ 35 - 33
pages/welfareMall/personal/personal.wxml

@@ -1,46 +1,48 @@
 <!--pages/welfareMall/personal/personal.wxml-->
 <page-wrap id="Page" class="{{grayTheme?'page':''}}">
-<custom-page head-bg-color="#fff2f3">  
-  <view slot="body" class="personal flex-column">
-    <!-- 首部个人信息 -->
-    <view class="head flex-column">
-      <view class="head-personal flex-row">
-        <image wx:if="{{!isLogin}}" class="head-personal-logo" src="/images/welfareMall/head-portrait.png" />
-        <!-- 获取用户头像 -->
-        <open-data wx:if="{{isLogin}}" class="head-personal-logo" type="userAvatarUrl"></open-data>
-        <view class="head-personal-nl flex-column" wx:if="{{isLogin}}">
-          <!-- 获取用户微信昵称 -->
-          <open-data class="head-personal-name" type="userNickName" lang="zh_CN"></open-data>
-          <view class="head-personal-login">{{phone.toHide(mobileTop)}}</view>
+  <custom-page head-bg-color="#fff2f3">
+    <view slot="body" class="personal flex-column">
+      <!-- 首部个人信息 -->
+      <view class="head flex-column">
+        <view class="head-personal flex-row">
+          <image wx:if="{{!isLogin}}" class="head-personal-logo" src="/images/welfareMall/head-portrait.png" />
+          <!-- 获取用户头像 -->
+          <open-data wx:if="{{isLogin}}" class="head-personal-logo" type="userAvatarUrl"></open-data>
+          <view class="head-personal-nl flex-column" wx:if="{{isLogin}}">
+            <!-- 获取用户微信昵称 -->
+            <open-data class="head-personal-name" type="userNickName" lang="zh_CN"></open-data>
+            <view class="head-personal-login">{{phone.toHide(mobileTop)}}</view>
+          </view>
+          <button class="personal-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录/注册</button>
         </view>
-        <button class="personal-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录/注册</button>
-      </view>
-      <view class="head-card flex-row">
-        <view class="head-card-coupon">我的优惠券</view>
-        <view class="head-card-nt flex-row">
-          <view class="head-card-num">{{countNum}}</view>
-          <view class="head-card-text">张</view>
+        <view><button class="wx-isLogin-card" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPathCoupon"></button>
+          <view class="head-card flex-row" catchtap="{{couponPath?'getCouponPath':''}}">
+            <view class="head-card-coupon">我的优惠券</view>
+            <view class="head-card-nt flex-row">
+              <view class="head-card-num">{{countNum}}</view>
+              <view class="head-card-text">张</view>
+            </view>
+          </view>
         </view>
       </view>
-    </view>
-    <!-- 中部详细信息 -->
+      <!-- 中部详细信息 -->
       <!-- 内容 -->
       <view class="content flex-column">
-      <!-- 导航栏遍历 -->
-          <view class="sign-in content-style" wx:for="{{navigationList}}" data-appid="{{item.appId}}"  wx:key="unique">
-            <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNav" data-path="{{item.path}}"></button>
-            <view class="grant flex-row" bindtap="goToCoupon" data-path="{{item.path}}">
-              <view class="content-img-text flex-row">
-                <image class="content-img" src="{{item.figure}}"></image>
-                <view class="content-text">{{item.title}}</view>
-              </view>
-              <image class="content-jump" src="/images/welfareMall/jump.png" />
+        <!-- 导航栏遍历 -->
+        <view class="sign-in content-style" wx:for="{{navigationList}}" data-appid="{{item.appId}}" wx:key="unique">
+          <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNav" data-path="{{item.path}}"></button>
+          <view class="grant flex-row" bindtap="goToCoupon" data-path="{{item.path}}">
+            <view class="content-img-text flex-row">
+              <image class="content-img" src="{{item.figure}}"></image>
+              <view class="content-text">{{item.title}}</view>
             </view>
-            <view class="content-lower"></view>
+            <image class="content-jump" src="/images/welfareMall/jump.png" />
           </view>
+          <view class="content-lower"></view>
+        </view>
       </view>
-  </view>
-</custom-page>  
+    </view>
+  </custom-page>
 </page-wrap>
 
 <!-- 使用wxs 手机号码中间四位显示为*号 -->

+ 13 - 0
pages/welfareMall/personal/personal.wxss

@@ -136,6 +136,19 @@
   border-style: none;
 }
 
+.wx-isLogin-card{
+  position: absolute;
+  z-index: 2;
+  width: 666rpx !important;
+  height: 286rpx !important;
+  padding: 0 !important;
+  padding-left: 0 !important;
+  margin-left: 0rpx !important;
+  margin-right: 0rpx !important;
+  background-color: transparent;
+  border-style: none;
+}
+
 .content-lower{
   width: 668rpx;
   height: 2rpx;