Commit e7b35166 by wangjian

1

parent 33b716c4
......@@ -8,6 +8,9 @@
<validCode ref="code" :maxlength="4" @finish="getPwd" @inputChange="inputChange"></validCode>
</view>
<view @click="submit()" class="buy-bottom" :style="{'background-color':btnActive?'#FF0520':''}">确认</view>
<view @click="sendCode()" class="re-send" :style="{'color':isSendCode?'#999999':'#FF0520'}">
{{btnText}}
</view>
</view>
</view>
</template>
......@@ -20,7 +23,10 @@
data() {
return {
phone: this.$store.state.userInfo.mobile,
code: ''
code: '',
btnText: '重新发送',
isSendCode: false,
time: 60
};
},
props: {
......@@ -55,7 +61,43 @@
this.code = ''
this.$refs.code.clear()
this.$parent[this.closeName] = false
},
sendCode() {
if (this.time != 60) {
return
}
let params = {'codeType': '120', 'mobile': this.phone, 'resetToken':'not'}
this.$net.post('/staff/sms', params).then(res => {
if (res.code === 200) {
uni.showToast({
title: '验证码发送成功'
})
this.startTime()
} else {
uni.showToast({
title: res.message
})
}
})
},
startTime () {
if (this.time != 60) {
return
}
this.isSendCode = true
this.btnText = '重新发送('+this.time+'s)'
var timer = setInterval(()=>{
this.time--
if (this.time>0) {
this.btnText = '重新发送('+this.time+'s)'
} else {
this.btnText = '重新发送'
this.time = 60
this.isSendCode = false
clearInterval(timer)
}
}, 1000)
},
},
watch: {
firstOpen(newVal, oldVal) {
......@@ -122,6 +164,11 @@
z-index: 99999;
margin-bottom: 32rpx;
}
.re-send {
text-align: center;
font-size: 28rpx;
color: #999999;
}
}
}
</style>
......@@ -10,14 +10,6 @@ isPwd:是否是密码模式
<template>
<view class="code-area">
<view class="flex-box">
<input
:value="val"
type="number"
focus="true"
:maxlength="maxlength"
class="hide-input"
@input="getVal"
/>
<view v-bind:class="['item', { active: codeIndex == 1, 'code-item': !isPwd}]">
<view class="line"></view>
<block v-if="isPwd && codeArr.length >= 1">
......@@ -62,8 +54,15 @@ isPwd:是否是密码模式
<block v-else> {{ codeArr[5] ? codeArr[5] : ''}}</block>
</view>
</block>
<input
:value="val"
type="number"
focus
auto-focus="true"
:maxlength="maxlength"
class="hide-input"
@input="getVal"
/>
</view>
</view>
</template>
......@@ -172,8 +171,9 @@ export default {
width: 200%;
height: 100%;
text-align: left;
z-index: 9;
z-index: 99999999;
opacity: 1;
color: #333333;
}
@keyframes twinkling {
......
......@@ -50,26 +50,34 @@
statusText:{
100:'待兑换',200:'兑换成功',300:'兑换失败'
},
page: 1
page: 1,
isLogin: true
};
},
onLoad() {
},
onPullDownRefresh () {
console.log('下拉刷新');
},
onReachBottom () {
this.getList()
},
onShow() {
this.isLogin = this.$store.state.isLogin
},
onTabItemTap () {
if (!this.$store.state.isLogin) {
this.$router.push('Login')
return
}
this.orderLists = []
this.page = 1
this.loadingType = 'more'
this.loadingType = 'loading'
this.getList()
},
methods: {
getList() {
if (this.loadingType == 'noMore' || this.loadingType === 'loading') {
if (this.loadingType == 'noMore') {
return
}
this.loadingType = 'loading';
......@@ -85,6 +93,7 @@
this.page++
}
} else {
this.loadingType = 'noMore'
this.toast(res.message)
}
})
......@@ -95,6 +104,17 @@
goCoupon(item) {
this.$router.push('Coupon', {'orderId':item.orderSn})
}
},
watch: {
isLogin(newVal, oldVal) {
console.log(newVal, oldVal);
if (!oldVal && newVal) {
this.orderLists = []
this.page = 1
this.loadingType = 'loading'
this.getList()
}
}
}
}
</script>
......
......@@ -59,7 +59,7 @@
if (this.time != 300) {
return
}
let params = {'codeType': '10', 'codeType': this.phone, 'resetToken':'not'}
let params = {'codeType': '10', 'mobile': this.phone, 'resetToken':'not'}
this.$net.post('/meta/sms', params).then(res => {
if (res.code === 200) {
uni.showToast({
......
......@@ -26,8 +26,8 @@
立即兑换
</view>
</view>
<pwdCodeAlert closeName="showPwdAlert" v-show="showPwdAlert" :integral="payIntegral" @pwdSubmit="pwdSubmit"></pwdCodeAlert>
<smsCodeAlert closeName="showSmsCodeAlert" v-show="showSmsCodeAlert" @smsCodeSubmit="smsCodeSubmit"></smsCodeAlert>
<pwdCodeAlert closeName="showPwdAlert" v-if="showPwdAlert" :integral="payIntegral" @pwdSubmit="pwdSubmit"></pwdCodeAlert>
<smsCodeAlert ref="sms" closeName="showSmsCodeAlert" v-if="showSmsCodeAlert" @smsCodeSubmit="smsCodeSubmit"></smsCodeAlert>
<Alert v-show="errorAlert" :text="errorAlertText" @clickCertain="clickAlert" @clickCancel="clickAlert"/>
</view>
</template>
......@@ -86,6 +86,10 @@
this.orderId = res.data.orderId
if (res.data.isSendSms === 1) {
this.showSmsCodeAlert = true
let that = this
setTimeout(function() {
that.$refs.sms.startTime()
}, 500);
} else {
this.showPwdAlert = true
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment