You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
205 lines
4.4 KiB
205 lines
4.4 KiB
<template>
|
|
<view class="app-container">
|
|
<view class="login-content">
|
|
<view class="login-font">
|
|
<image style="width: 364rpx;height: 200rpx;" src="/static/login/merchant-copy.png" alt="" />
|
|
</view>
|
|
<view class="login-main">
|
|
<view class="login-item">
|
|
<input type="tel" class="log-phone" placeholder="请输入手机号" v-model="phone" />
|
|
</view>
|
|
<view class="login-item">
|
|
<input type="number" class="log-phone log-code" placeholder="请输入验证码" v-model="sms_code" />
|
|
<view class="getCode" @click="getCode" v-if="countdown==0">
|
|
获取验证码
|
|
</view>
|
|
<view class="getCode" v-else>
|
|
剩余{{countdown}}秒
|
|
</view>
|
|
</view>
|
|
<view class="login-btn">
|
|
<button size="default" type="default" @click="btnLogin"
|
|
style="color:#ffffff;backgroundColor:#F52F3E;borderColor:#F52F3EF;border-radius: 50rpx;height: 88rpx;line-height: 88rpx;">登录</button>
|
|
</view>
|
|
<view class="login-sign">
|
|
<u-checkbox-group @change="handleCheck">
|
|
<u-checkbox labelSize="13" size="20" shape="circle" name="agree" label="我同意"></u-checkbox>
|
|
</u-checkbox-group>
|
|
<view class="log-link" @click="handlerApply">
|
|
《排队支付商户用户服务协议》
|
|
</view>
|
|
<view class="log-link" @click="handlerProtect">
|
|
《隐私保护协议》
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-modal :show="show" @confirm="confirm" :title="title" :content='content'></u-modal>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
publicSendSms,
|
|
merchantSmsLogin
|
|
} from '../../common/api.js'
|
|
import md5 from 'js-md5'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
phone: '',
|
|
sms_code: '',
|
|
bgColor: '#bgColor',
|
|
checked: false,
|
|
show: false,
|
|
title: '',
|
|
content: '',
|
|
countdown: 0
|
|
};
|
|
},
|
|
methods: {
|
|
getCode() {
|
|
if (!this.phone) {
|
|
uni.$u.toast('请填写手机号')
|
|
return
|
|
}
|
|
|
|
if (!this.checked) {
|
|
uni.$u.toast('需同意协议')
|
|
return
|
|
}
|
|
|
|
let phone = this.phone
|
|
let nonce_str = md5(Math.random() + '');
|
|
let sign = md5(md5(phone) + md5(nonce_str) + nonce_str)
|
|
publicSendSms({
|
|
phone,
|
|
nonce_str,
|
|
sign,
|
|
type: 1
|
|
}).then(() => {
|
|
uni.$u.toast('短信已发送')
|
|
this.startCountdown()
|
|
})
|
|
},
|
|
startCountdown() {
|
|
this.countdown = 60;
|
|
let h = setInterval(() => {
|
|
this.countdown--
|
|
if (this.countdown == 0) {
|
|
clearInterval(h)
|
|
}
|
|
}, 1000)
|
|
},
|
|
handleCheck(detail) {
|
|
console.log(detail)
|
|
if (detail.indexOf('agree') != -1) {
|
|
this.checked = true
|
|
} else {
|
|
this.checked = false
|
|
}
|
|
},
|
|
handlerApply() {
|
|
this.show = true;
|
|
this.title = '排队支付商户用户服务协议';
|
|
this.content = '排队支付商户用户服务协议';
|
|
},
|
|
handlerProtect() {
|
|
this.show = true;
|
|
this.title = '隐私保护协议';
|
|
this.content = '隐私保护协议';
|
|
},
|
|
confirm() {
|
|
this.show = false;
|
|
},
|
|
btnLogin() {
|
|
if (!this.checked) {
|
|
uni.$u.toast('需同意协议')
|
|
return
|
|
}
|
|
|
|
merchantSmsLogin({
|
|
phone: this.phone,
|
|
sms_code: this.sms_code
|
|
}).then(data => {
|
|
uni.setStorageSync('merchant_token', data.token)
|
|
uni.navigateTo({
|
|
url: '/pages/merchant-index/index'
|
|
});
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.login-content {
|
|
width: 100%;
|
|
height: 1600rpx;
|
|
padding-left: 30rpx;
|
|
padding-right: 30rpx;
|
|
background: url(../../static/login/merchant-bg.png) no-repeat center center;
|
|
background-size: cover;
|
|
box-sizing: border-box;
|
|
|
|
.login-font {
|
|
width: 364rpx;
|
|
height: 200rpx;
|
|
padding-top: 80rpx;
|
|
}
|
|
|
|
.login-main {
|
|
margin-top: 120rpx;
|
|
|
|
.login-item {
|
|
position: relative;
|
|
margin-top: 40rpx;
|
|
|
|
.log-phone {
|
|
width: 100%;
|
|
height: 88rpx;
|
|
line-height: 88rpx;
|
|
padding-left: 50rpx;
|
|
border-radius: 44rpx;
|
|
border: none;
|
|
box-sizing: border-box;
|
|
background-color: #fff;
|
|
font-size: 16px;
|
|
color: #454545;
|
|
}
|
|
|
|
.getCode {
|
|
position: absolute;
|
|
right: 50rpx;
|
|
top: 30rpx;
|
|
font-size: 12px;
|
|
color: #454545;
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
|
|
.login-btn {
|
|
margin-top: 80rpx;
|
|
}
|
|
|
|
.login-sign {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
margin-top: 30rpx;
|
|
padding-left: 20rpx;
|
|
|
|
.u-radio-group {
|
|
flex-grow: 0;
|
|
margin-right: 60rpx;
|
|
}
|
|
|
|
.log-link {
|
|
height: 40rpx;
|
|
line-height: 40rpx;
|
|
font-size: 12px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|