wangguoyu 2 日 前
コミット
1190a9fe3d

+ 1 - 1
components/bindPhone/bindPhone.vue

@@ -187,7 +187,7 @@
 				//	cacheManager.set('auth', res.data)
 				// 返回重新支付
 				handleBack();
-				emits('success', res.data)
+				emits('success', res.data,loginData.phoneNumber)
 			}
 		})
 	}

+ 57 - 26
pages/chanpinMy/my.vue

@@ -27,20 +27,26 @@
 					<icon class="list-icon yysz-icon"></icon>
 					<text>应用设置</text>
 				</view>
-        <view class="list-item" @click="shangcheng">
-          <icon class="list-icon yysz-icon"></icon>
-          <text>商城</text>
-        </view>
-			<!-- <view v-if="appleCode=='true'&&currentPlatform=='ios' || currentPlatform=='android'" class="list-item" -->
-			<view class="list-item"
-					@click="duihuamaDuihuan">
+				<view class="list-item" @click="shangcheng">
+					<icon class="list-icon yysz-icon"></icon>
+					<text>商城</text>
+				</view>
+				<!-- <view v-if="appleCode=='true'&&currentPlatform=='ios' || currentPlatform=='android'" class="list-item" -->
+				<view class="list-item" @click="duihuamaDuihuan">
 					<icon class="list-icon yysz-icon"></icon>
 					<text>兑换码</text>
 				</view>
+				<view v-if="isShowBindPhone" class="list-item" @click="bangPhone">
+					<icon class="list-icon yysz-icon"></icon>
+					<text>绑定手机号</text>
+				</view>
 			</view>
+
+
 		</view>
 
 		<goLogin ref="loginRef" @success="handleSuccess"></goLogin>
+		<bindPhone ref="bindPhoneRef" @success="bingPhoneSuccess"></bindPhone>
 		<!-- 底部 -->
 		<custom-tab-bar :show="true" :current-index="currentTabIndex" />
 	</view>
@@ -58,6 +64,7 @@
 	} from '@/api/my.js'
 	import CustomTabBar from '@/components/custom-tabbar/index.vue';
 	import goLogin from "@/components/goLogin/goLogin.vue"
+	import bindPhone from "@/components/bindPhone/bindPhone.vue"
 	import {
 		onLoad,
 		onShow
@@ -66,12 +73,16 @@
 		reactive,
 		ref
 	} from "vue";
-  import {getUserIsYouke} from "../../utils/common";
+	import {
+		getUserIsYouke,
+		toast
+	} from "../../utils/common";
 
-	let appleCode =ref(null)
+	let appleCode = ref(null)
 	let currentPlatform = ref(null);
 	let authInfo = ref(null);
 	let loginRef = ref(null);
+	let isShowBindPhone = ref(false);
 	let currentTabIndex = ref(3)
 	let myInfoData = reactive({
 		userImg: '',
@@ -85,9 +96,14 @@
 
 	onShow(() => {
 		currentTabIndex.value = 3
-		if(pageFrom.value ==='myInfo'){
+		if (pageFrom.value === 'myInfo') {
 			getMyInfo();
 		}
+		if (getUserIsYouke()) {
+			isShowBindPhone.value = true
+		} else {
+			isShowBindPhone.value = false
+		}
 	})
 	/***************** 测试 ******************/
 	const testRef = ref(null)
@@ -97,6 +113,14 @@
 	}
 	/***************** 测试 ******************/
 
+
+	function bingPhoneSuccess(flag, tel) {
+		toast("绑定成功")
+		cacheManager.updateObject('auth', {
+			userName: tel,
+		})
+		isShowBindPhone.value = false
+	}
 	// 获取用户数据
 	function getMyInfo() {
 		myInfo({}).then(res => {
@@ -146,12 +170,19 @@
 		})
 	}
 
-	function ddBtn(){
+	function ddBtn() {
 		uni.navigateTo({
 			url: '/pages/chanpinMy/order'
 		})
 	}
 
+	function bangPhone() {
+
+
+		//	authInfo.value = cacheManager.get('auth');
+
+	}
+
 	function duihuamaDuihuan() {
 		// 兑换码兑换策略
 		if (getUserIsYouke()) {
@@ -160,19 +191,19 @@
 		} else {
 			// 已登录
 			uni.navigateTo({
-				url:'/pages/chanpinMy/duihuanma'
+				url: '/pages/chanpinMy/duihuanma'
 			})
 		}
 	}
 
-  function handleSuccess(authInfo) {
-    // 登录成功更改用户名
-    myInfoData.userName = authInfo.userName;
-    // 前往兑换码
-    uni.navigateTo({
-      url:'/pages/chanpinMy/duihuanma'
-    })
-  }
+	function handleSuccess(authInfo) {
+		// 登录成功更改用户名
+		myInfoData.userName = authInfo.userName;
+		// 前往兑换码
+		uni.navigateTo({
+			url: '/pages/chanpinMy/duihuanma'
+		})
+	}
 
 	onLoad((options) => {
 		uni.hideTabBar()
@@ -195,10 +226,10 @@
 		authInfo.value = cacheManager.get('auth');
 	}
 
-  // 商城
-  function shangcheng() {
-    uni.navigateTo({
-      url: '/pages/chanpinShop/index'
-    })
-  }
+	// 商城
+	function shangcheng() {
+		uni.navigateTo({
+			url: '/pages/chanpinShop/index'
+		})
+	}
 </script>

+ 6 - 6
unpackage/dist/cache/.vite/deps/_metadata.json

@@ -1,19 +1,19 @@
 {
-  "hash": "78e2cbc4",
-  "configHash": "cf70751b",
-  "lockfileHash": "7b43968b",
-  "browserHash": "4a933061",
+  "hash": "64b32842",
+  "configHash": "4326db84",
+  "lockfileHash": "e3b0c442",
+  "browserHash": "969e594e",
   "optimized": {
     "ts-md5/dist/md5": {
       "src": "../../../../../node_modules/ts-md5/dist/md5.js",
       "file": "ts-md5_dist_md5.js",
-      "fileHash": "6abade9f",
+      "fileHash": "98549e39",
       "needsInterop": true
     },
     "uview-plus": {
       "src": "../../../../../node_modules/uview-plus/index.js",
       "file": "uview-plus.js",
-      "fileHash": "adbef8d1",
+      "fileHash": "52be40fe",
       "needsInterop": false
     }
   },