Commit e7b35166 by wangjian

1

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