Browse Source

fix(controller): 购买会员的时候 需要验证是否绑定手机号

xiansin 3 năm trước cách đây
mục cha
commit
0adcb1acc9
2 tập tin đã thay đổi với 70 bổ sung1 xóa
  1. 70 1
      pages/my/member.vue
  2. BIN
      static/images/member-bg.png

+ 70 - 1
pages/my/member.vue

xqd xqd xqd xqd xqd
@@ -33,6 +33,15 @@
 				</view>
 			</view>
 		</view>
+		<u-popup v-model="modal.show" mode="bottom" :mask-close-able="false" border-radius="15">
+			<view class="popup-content">
+				<view class="title">需要绑定您的手机号</view>
+				<view class="btn-popup main-between">
+					<button class="btn main-center cross-center" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">获取手机号</button>
+				</view>
+			</view>
+		</u-popup>
+
 	</app-layout>
 </template>
 
@@ -45,7 +54,10 @@
 		data() {
 			return {
 				setting: {},
-				interval: null
+				interval: null,
+				modal: {
+					show: false
+				},
 			}
 		},
 		methods: {
@@ -66,6 +78,11 @@
 					});
 					return false
 				}*/
+				if(!this.vuex_user_data.phone_num){
+					this.modal.show = true;
+					return;
+				}
+
 				uni.showLoading({title: '数据处理中...'})
 				this.$u.api.userBuy().then(data => {
 					uni.hideLoading();
@@ -113,6 +130,29 @@
 					this.$u.vuex(this.$const.USER_DATA, data)
 				})
 			},
+			getPhoneNumber(phoneNumber){
+				if(phoneNumber.detail.errMsg !== 'getPhoneNumber:ok'){
+					this.$u.toast('已取消');
+					return
+				}
+				uni.checkSession({
+					success: data => {
+						this.$u.api.userBindPhone(phoneNumber.detail).then(data => {
+							this.$u.vuex(this.$const.USER_DATA,data)
+							this.modal.show = false
+							this.handleBuy();
+						})
+					},
+					fail: err => {
+						this.sureClearCache()
+					}
+				})
+			},
+			sureClearCache(){
+				this.$u.vuex(this.$const.USER_TOKEN,null)
+				this.$u.vuex(this.$const.USER_DATA,null)
+				this.$jump({url:'/pages/login/login?redirect=pages/my/index',type:'redirect'})
+			},
 		},
 		computed:{
 			btnStyle() {
@@ -207,4 +247,33 @@
 			}
 		}
 	}
+	.popup-content{
+		height: 280rpx;
+		position: relative;
+		.title{
+			padding: 20rpx 30rpx;
+			font-weight: 600;
+			font-size: 42rpx;
+		}
+		.btn-popup{
+			position: absolute;
+			bottom: 0;
+			width: 100%;
+		}
+		.btn{
+			background: $main-color;
+			color: #fff;
+			border-radius: 0;
+			font-size: 28rpx;
+			height: 100rpx;
+			flex: 1;
+			&.cancel{
+				background: #f5f5f5;
+				color: #666;
+			}
+			&:after{
+				content: unset;
+			}
+		}
+	}
 </style>

BIN
static/images/member-bg.png