-import { userLongin,sendMsg,vadatnmsg } from "../../ajax/getData";
+import { userLongin,sendMsg,vadatnmsg,userregOrLogin,inserdiscount } from "../../ajax/getData";
import { mapMutations } from "vuex";
import Myheader from "~/components/header.vue"; //引用头部公共组件
export default {
@@ -152,6 +152,7 @@ export default {
layerMSg: "手机格式不对",
tel: "",
password: "",
+ userdata:{},
allcheck:false,
activeIndex: 0,
tamp:'',
@@ -171,9 +172,11 @@ export default {
loading: false,
usertitle: true,
ifpassword: false,
+ verification:'',//验证码数据
+ userislogin:[],//登录成功数据
checked: false,
- inRank: false,
- inRanka: false,
+ isRank: false,
+ isRanka: false,
usercheckbox:false,
swiperData: [
@@ -221,20 +224,45 @@ export default {
// console.log(this.inRank);
// },
methods: {
+ ...mapMutations(["changeClod","checkIsLogin"]),
//全选
checkBoxa(e,order){
- let checked=e.target.checked;
- console.log(checked)
-
+ let checked=e.target.checked;
+ console.log(e.target.checked);
+ // this.isRank=e.target.checked;
+ // this.isRanka=e.target.checked;
+ if(order==3){
+ this.allcheck=checked;
+ this.isRank=this.allcheck;
+ this.isRanka=this.allcheck;
+ }else if(order==2){
+ this.isRank=e.target.checked;
+ }
+ else if(order==1){
+ this.isRanka=e.target.checked;
+ }
+ console.log(this.isRank,this.isRanka);
+ if(this.isRanka==true && this.isRank==true){
+ this.allcheck=true;
+ }else{
+ this.allcheck=false;
+ }
+ // console.log(this.isRanka,this.isRank);
+ this.usercheckbox=this.allcheck;
},
-
- checkBox(e,order){
- console.log(e.target.checked)
- this.usercheckbox=e.target.checked;
- this.inRank= this.usercheckbox;
-
+ //获取用户领取的优惠券
+ async reglogin() {
+ let data = await getConfig(memberId, couponId);
+ let msg = '领取成功';
+ if (data) {
+ if(data.code!='0')
+ msg = data.msg;
+ this.$message({
+ type: "warning",
+ message: msg,
+ });
+ }
},
- ...mapMutations(["changeClod"]),
//获取验证码
async usermsg() {
//console.log("-----");
@@ -248,14 +276,35 @@ export default {
},
+ //添加优惠券
+ async serdiscount (mobile,couponId) {
+ let data = await inserdiscount(mobile,couponId);
+ if(data){
+ console.log(data);
+ }
+ //console.log(data);
+ },
+
//发送验证码数据
async vadmsg() {
//console.log("-----");
- let data = await vadatnmsg(this.sms,this.hash,this.tamp);
+ let data = await vadatnmsg(this.sms,this.hash,this.tamp);
if(data){
return data;
}
+
},
+ //登录成功数据
+ async userlogin() {
+ //console.log("-----");
+ let data= await userregOrLogin(this.tel);
+ if(data){
+ this.userislogin=data;
+ console.log(this.userislogin);
+ }
+ },
+
+
onClickHander(e) {
console.log(e);
},
@@ -293,11 +342,8 @@ export default {
return
} else{
-
-
let time = 60;
let timer;
-
timer = setInterval(() => {
time--;
if (time === 0) {
@@ -327,45 +373,75 @@ export default {
});
return
}
- if(this.usercheckbox==false){
- //console.log('----');
+ if(this.usercheckbox==false){
this.$message({
type: 'warning',
- message: '请先同意隐私声明和账号使用协议'
+ message: '请先勾选相关协议'
});
+ return
+ }
+ if(this.usercheckbox==false){
+ //console.log('----');
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
this.$message({
type: 'warning',
message: '手机号码输入有误'
});
+ this.$message({
+ type: 'warning',
+ message: '请先同意隐私声明和账号使用协议'
+ });
return
-
}
}
else{
- let data=await this.vadmsg();
+ console.log('===')
+ let data=await this.vadmsg();
if(data.code=="1")
{
- data = await userLongin(this.tel);
- if(data.msg=='SUCCESS'){
- this.$message({
+ data = await userregOrLogin(this.tel);
+ console.log(data);
+ let token=JSON.stringify(data);
+ this.changeClod({ cloud: token });
+ this.checkIsLogin();
+ if(data.type==1){
+ if(data.data.memberName===undefined){
+ this.$message({
type: 'warning',
- message: '登录成功'
+ message: '欢迎回来'
});
+ console.log('-----')
+ }
+ else{
+ this.$message({
+ type: 'warning',
+ message: '欢迎回来'+data.data.memberName
+ });
+ }
+ }else if(data.type==2){
+ this.$message({
+ type: 'warning',
+ message: '恭喜注册成功'
+ });
+ let couponId='0000000123';
+ this.serdiscount(this.tel,couponId);
+ setTimeout(() => {
+ this.serdiscount(this.tel,"0000000140");
+ }, 100);
+ setTimeout(() => {
+ this.serdiscount(this.tel,"0000000122");
+ }, 500);
+ }
this.$router.push({
path: "/",
});
- let token=JSON.stringify(data);
- this.changeClod({ cloud: token });
- return;
- }
- }
- this.$message({
+ }else{
+ this.$message({
type: 'warning',
- message: data.msg
+ message: data.msg,
});
-
return
+ }
}},
},
};