|
|
|
@ -5,19 +5,20 @@
|
|
|
|
<!-- <block wx:for='{{couponList}}' wx:key=''> -->
|
|
|
|
<!-- <block wx:for='{{couponList}}' wx:key=''> -->
|
|
|
|
<view class="item">
|
|
|
|
<view class="item">
|
|
|
|
<text class="item-tip">手机号码:</text>
|
|
|
|
<text class="item-tip">手机号码:</text>
|
|
|
|
<input placeholder="输入手机号码" type="number" maxlength="11" :value="phonenum" @input="onPhoneInput"></input>
|
|
|
|
<input placeholder="输入手机号码" type="number" maxlength="11" :value="phonenum" @input="onPhoneInput" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="item ">
|
|
|
|
<view class="item ">
|
|
|
|
<text class="item-tip">验证码:</text>
|
|
|
|
<text class="item-tip">验证码:</text>
|
|
|
|
<input placeholder="输入验证码" type="number" :value="code" @input="onCodeInput"></input>
|
|
|
|
<input placeholder="输入验证码" type="number" :value="code" @input="onCodeInput" />
|
|
|
|
<text class="get-code gray" @tap="getCodeNumber">获取验证码</text>
|
|
|
|
<text v-if="show" class="get-code gray" @tap="getCodeNumber">获取验证码</text>
|
|
|
|
|
|
|
|
<text v-if="!show" class="get-code gray">{{count}} s</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- </block> -->
|
|
|
|
<!-- </block> -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="btn-box">
|
|
|
|
<view class="btn-box">
|
|
|
|
<text class="sure-btn gray">确定</text>
|
|
|
|
<text v-if="phonenum && code" class="sure-btn" @click="bindMobile">确定</text>
|
|
|
|
<text class="sure-btn ">确定</text>
|
|
|
|
<text v-else class="sure-btn gray">确定</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
@ -26,12 +27,17 @@
|
|
|
|
// pages/binding-phone/binding-phone.js
|
|
|
|
// pages/binding-phone/binding-phone.js
|
|
|
|
var http = require("../../utils/http.js");
|
|
|
|
var http = require("../../utils/http.js");
|
|
|
|
var config = require("../../utils/config.js");
|
|
|
|
var config = require("../../utils/config.js");
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
|
|
AppType
|
|
|
|
|
|
|
|
} from "../../utils/constant.js";
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
phonenum: '',
|
|
|
|
phonenum: '',
|
|
|
|
code: ''
|
|
|
|
code: '',
|
|
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
|
|
count: '',
|
|
|
|
|
|
|
|
timer: null
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
@ -79,25 +85,35 @@ export default {
|
|
|
|
onShareAppMessage: function () {},
|
|
|
|
onShareAppMessage: function () {},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
getCodeNumber: function () {
|
|
|
|
getCodeNumber: function () {
|
|
|
|
if (this.phoneNumber == "") {
|
|
|
|
if (!this.phonenum) {
|
|
|
|
uni.showToast({
|
|
|
|
uni.showToast({
|
|
|
|
title: '请输入手机号',
|
|
|
|
title: '请输入手机号',
|
|
|
|
icon: "none"
|
|
|
|
icon: "none"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var params = {
|
|
|
|
var params = {
|
|
|
|
url: "/p/sms/send",
|
|
|
|
url: "/p/sms/send",
|
|
|
|
method: "POST",
|
|
|
|
method: "POST",
|
|
|
|
data: {// phonenum: this.data.phonenum,
|
|
|
|
data: {// phonenum: this.data.phonenum,
|
|
|
|
// code: this.data.code
|
|
|
|
// code: this.data.code
|
|
|
|
|
|
|
|
mobile: this.phonenum
|
|
|
|
},
|
|
|
|
},
|
|
|
|
callBack: res => {
|
|
|
|
callBack: res => {
|
|
|
|
this.setData({
|
|
|
|
const timeCount = 60;
|
|
|
|
phonenum: this.phonenum,
|
|
|
|
if (!this.timer) {
|
|
|
|
code: this.code
|
|
|
|
this.count = timeCount
|
|
|
|
});
|
|
|
|
this.show = false;
|
|
|
|
|
|
|
|
this.timer = setInterval(() => {
|
|
|
|
|
|
|
|
if (this.count > 0 && this.count <= timeCount) {
|
|
|
|
|
|
|
|
this.count--;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
clearInterval(this.timer);
|
|
|
|
|
|
|
|
this.timer = null,
|
|
|
|
|
|
|
|
this.show = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
http.request(params);
|
|
|
|
http.request(params);
|
|
|
|
@ -111,6 +127,30 @@ export default {
|
|
|
|
this.setData({
|
|
|
|
this.setData({
|
|
|
|
code: e.detail.value
|
|
|
|
code: e.detail.value
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 绑定
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
bindMobile() {
|
|
|
|
|
|
|
|
var params = {
|
|
|
|
|
|
|
|
url: '/user/registerOrBindUser',
|
|
|
|
|
|
|
|
method: 'PUT',
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
appType: AppType.MP,
|
|
|
|
|
|
|
|
mobile: this.phonenum,
|
|
|
|
|
|
|
|
validCode: this.code,
|
|
|
|
|
|
|
|
validateType: 1, // 验证类型:1验证码验证 ,
|
|
|
|
|
|
|
|
registerOrBind: 2 // 验证类型 1注册 2绑定
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
callBack: res => {
|
|
|
|
|
|
|
|
http.loginSuccess(res)
|
|
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
|
|
url: '/pages/index/index'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
http.request(params)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|