Pārlūkot izejas kodu

绑定销售员完善手机号

xhj 2 gadi atpakaļ
vecāks
revīzija
56605e174e

+ 55 - 11
card/cardDetail/cardDetail.vue

@@ -56,6 +56,8 @@
 				</view>
 			</block>
 		</view>
+		
+		<update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" :is-update="true" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateMobile="updateMobileInfo" @updateInfo="updateInfo"></update-userinfo>
 	</view>
 </template>
 
@@ -76,7 +78,11 @@
 				evaluateInfo:{},
 				code:'',
 				loading:true,
-				noBind:false
+				noBind:false,
+				
+				isShowUpdate: false, //是否显示更新信息弹窗
+				isUpdateInfo: false, //更新用户信息
+				isUpdateMobile: false, //绑定手机号
 			}
 		},
 		onLoad(options) {
@@ -136,18 +142,56 @@
 				return util.monthDayDiff(date)
 			},
 			submit(){
-				req.postRequest('/api/visiting/card/bindManageSaleNo',{manageSaleNo:this.cardInfo.jobNumber},res=>{
-					req.msg('已切换专属顾问')
-					let userInfo = req.getStorage('userInfo')
-					userInfo.manageSaleNo = this.cardInfo.jobNumber
-					req.setStorage('userInfo',userInfo)
-					setTimeout(()=>{
-						uni.switchTab({
-							url:'/pages/index/index'
-						})
-					},1000)
+				let userInfo = req.getStorage('userInfo');
+				console.log('updateInfo userInfo.avatar',userInfo.avatar)
+				if (!userInfo.avatar || userInfo.nickName == '微信用户') {
+					this.isShowUpdate = true
+					this.isUpdateInfo = true
+					return false
+				}
+				if(userInfo.avatar&&!userInfo.mobile){
+					this.isShowUpdate = true
+					this.isUpdateMobile = true
+					return false
+				}
+				uni.showModal({
+					title:'提示',
+					content:'是否绑定该顾问?',
+					success: (con) => {
+						if(con.confirm){
+							req.postRequest('/api/visiting/card/bindManageSaleNo',{manageSaleNo:this.cardInfo.jobNumber},res=>{
+								req.msg('已切换专属顾问')
+								let userInfo = req.getStorage('userInfo')
+								userInfo.manageSaleNo = this.cardInfo.jobNumber
+								req.setStorage('userInfo',userInfo)
+								setTimeout(()=>{
+									uni.switchTab({
+										url:'/pages/index/index'
+									})
+								},1000)
+							})
+						}
+					}
 				})
 			},
+			showUpdate(){
+				this.isShowUpdate = true;
+				this.isUpdateInfo = true;
+			},
+			closeUpdate(){
+				this.isShowUpdate = false
+				this.isUpdateInfo = false;
+			},
+			updateInfo(e){
+				setTimeout(()=>{
+					this.submit()
+				},500)
+			},
+			updateMobileInfo(e){
+				setTimeout(()=>{
+					this.submit()
+				},500)
+			},
 			// 解绑
 			bindCancal(){
 				uni.showModal({

+ 2 - 2
card/cardList/cardList.vue

@@ -70,9 +70,9 @@
 				<view class="register-title ddflex fflex">
 					<image class="register-title-icon" :src="item.avatar?item.avatar:'/static/images/userimg.png'" mode="aspectFill"></image>
 					<view class="flex" style="min-width: 0;">
-						<view class="ddflex" @click.stop="jumpSingleChatRoom(item)">
+						<view class="ddflex">
 							<view class="card-name fflex tover">{{item.realName?item.realName:''}}</view>
-							<image style="width: 64rpx;height: 64rpx;margin-left: 10rpx;" src="/card/static/images/wxChat.png"></image>
+							<image style="width: 64rpx;height: 64rpx;margin-left: 10rpx;" src="/card/static/images/wxChat.png" @click.stop="jumpSingleChatRoom(item)"></image>
 						</view>
 						<view class="ddflex" style="margin-top: 4rpx;">
 							<view class="card-tag">{{ item.jobName }}</view>

+ 30 - 3
card/index/index.vue

@@ -402,7 +402,8 @@
 		
 		<serviceContact :userId="cardInfo.userId" v-if="cardInfo.userId"></serviceContact>
 		
-		<to-userinfo v-if="isShowUpdate" @closeUpdate="()=>{isShowUpdate=false}"></to-userinfo>
+		<!-- <to-userinfo v-if="isShowUpdate" @closeUpdate="()=>{isShowUpdate=false}"></to-userinfo> -->
+		<update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" :is-update="true" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateMobile="updateMobileInfo" @updateInfo="updateInfo"></update-userinfo>
 		
 	</view>
 </template>
@@ -458,6 +459,8 @@ import util from '../../utils/util.js';
 				
 				
 				isShowUpdate: false, //是否显示更新信息弹窗
+				isUpdateInfo: false, //更新用户信息
+				isUpdateMobile: false, //绑定手机号
 
 			};
 		},
@@ -1005,8 +1008,14 @@ import util from '../../utils/util.js';
 			bindSale(){
 				let userInfo = req.getStorage('userInfo');
 				console.log('updateInfo userInfo.avatar',userInfo.avatar)
-				if (!userInfo.avatar || userInfo.nickName == '微信用户' || !userInfo.nickName||!userInfo.mobile) {
+				if (!userInfo.avatar || userInfo.nickName == '微信用户') {
 					this.isShowUpdate = true
+					this.isUpdateInfo = true
+					return false
+				}
+				if(userInfo.avatar&&!userInfo.mobile){
+					this.isShowUpdate = true
+					this.isUpdateMobile = true
 					return false
 				}
 				uni.showModal({
@@ -1024,7 +1033,25 @@ import util from '../../utils/util.js';
 						}
 					}
 				})
-			}
+			},
+			showUpdate(){
+				this.isShowUpdate = true;
+				this.isUpdateInfo = true;
+			},
+			closeUpdate(){
+				this.isShowUpdate = false
+				this.isUpdateInfo = false;
+			},
+			updateInfo(e){
+				setTimeout(()=>{
+					this.bindSale()
+				},500)
+			},
+			updateMobileInfo(e){
+				setTimeout(()=>{
+					this.bindSale()
+				},500)
+			},
 		},
 		mounted() {
 			const systemInfo = uni.getSystemInfoSync();

+ 25 - 24
components/update-userinfo/index.vue

@@ -34,7 +34,8 @@
 			return {
 				picUrlss: req.public.picUrls,
 				avatar: '',
-				nickName: ''
+				nickName: '',
+				sessionKey:''
 			};
 		},
 
@@ -55,6 +56,9 @@
 			// console.log('ready');
 			// console.log('isUpdateInfo==',this.updateInfo)
 			// console.log('isUpdateMobile==',this.updateMobile)
+			app.globalData.getCheckSessoin(json => {
+				this.sessionKey = json.session_key;
+			});
 		},
 
 		methods: {
@@ -108,29 +112,26 @@
 			},
 			getPhoneNumber(e) {
 				let that = this;
-				let sessionKey = '';
-				app.globalData.getCheckSessoin(json => {
-					sessionKey = json.session_key;
-					let _params = {
-						sessionKey: sessionKey,
-						iv: e.detail.iv,
-						encryptedData: e.detail.encryptedData
-					};
-					if (req.getStorage('pidCode')) {
-						_params.parentId = req.getStorage('pidCode');
-					}
-					if (e.detail.errMsg == 'getPhoneNumber:ok') {
-						req.postRequest('/api/weixin/mobile', _params, json => {
-							if (json.mobile) {
-								var userInfo = req.getStorage('userInfo');
-								userInfo.mobile = json.mobile;
-								req.setStorage('userInfo', userInfo);
-								this.$emit('updateMobile', true);
-								this.closeUpdate();
-							}
-						});
-					} else {}
-				});
+				let sessionKey = this.sessionKey;
+				let _params = {
+					sessionKey: sessionKey,
+					iv: e.detail.iv,
+					encryptedData: e.detail.encryptedData
+				};
+				if (req.getStorage('pidCode')) {
+					_params.parentId = req.getStorage('pidCode');
+				}
+				if (e.detail.errMsg == 'getPhoneNumber:ok') {
+					req.postRequest('/api/weixin/mobile', _params, json => {
+						if (json.mobile) {
+							var userInfo = req.getStorage('userInfo');
+							userInfo.mobile = json.mobile;
+							req.setStorage('userInfo', userInfo);
+							this.$emit('updateMobile', true);
+							this.closeUpdate();
+						}
+					});
+				} else {}
 			},
 			closeUpdate(){
 				this.$emit('closeUpdate');