123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- <template>
- <view class="container">
- <view class="container_text" >
- <image class="banner-img" src="/static/img/logo.png" mode="scaleToFill"></image>
- </view>
- <view class="loginTitle"><text>注册</text></view>
- <view class="login_text">
- <view class="login_input flex">
- <view class="login_img"><image src="/static/icon/phone.png"></image></view>
- <view class="login_name"><input class="uni-input" type="text" v-model="phone" focus placeholder="请输入账号" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="/static/icon/pread.png"></image></view>
- <view class="login_name"><input class="uni-input" type="text" v-model="invitation" focus placeholder="请输入接点人id" :disabled="isinvitation" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="/static/icon/psw.png"></image></view>
- <view class="login_name"><input class="uni-input" type="password" v-model="password" focus placeholder="请输入密码" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="/static/icon/psw.png"></image></view>
- <view class="login_name"><input class="uni-input" type="password" v-model="repassword" focus placeholder="请重复输入密码" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="/static/icon/code.png"></image></view>
- <view class="login_name flex">
- <input class="uni-input width" v-model="code" focus placeholder="请输入验证码" />
- <view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
- </view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="/static/icon/dw.png"></image></view>
- <picker v-if="!isparent_area" @change="bindParentArea" :value="parent_area" :range="parent_areas" class="uni-input">
- <view class="placeholder" v-if="parent_area === ''">请选择区域</view>
- <text>{{ parent_area }}</text>
- </picker>
- <view class="login_name" v-else><input class="uni-input" type="text" v-model="parent_area" focus disabled /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="/static/icon/dw.png"></image></view>
- <picker @change="bindPayType" :value="pay_type" :range="pay_types" class="uni-input">
- <view class="placeholder" v-if="pay_type === ''">请选择支付方式</view>
- <text>{{ pay_type }}</text>
- </picker>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="/static/icon/jft.png"></image></view>
- <view class="uni-input" style="color: #999;">
- 是否使用积分抵扣
- <image src="../../static/icon/noselect.png" mode="" v-if="!isSelsect" @click="jfdk(1)"></image>
- <image src="../../static/icon/select.png" mode="" v-if="isSelsect" @click="jfdk(0)"></image>
- </view>
- </view>
- <view><button type="green" @click="register" class="uni-button uni-button-green">注册账号</button></view>
- </view>
- </view>
- </template>
- <script>
- import { register, verify } from '@/api/login.js';
- export default {
- data() {
- return {
- phone: '', //用户
- password: '', //密码
- repassword: '',
- invitation: '', //接点人id
- code: '', //验证码
- time: '', //保存倒计时对象
- countDown: 0 ,//倒计时
- parent_area: '',//区域
- parent_areas: ['A','B','C'],//区域列表
- pay_type: '',
- pay_types: ['余额','佣金'],
- isSelsect: false,
- isinvitation: false,
- isparent_area: false,
- };
- },
- onLoad(option) {
- if(option.id){
- this.invitation = option.id
- console.log(this.invitation)
- this.isinvitation = true;
- }
- if(option.area){
- this.parent_area = option.area
- this.isparent_area = true
- }
- // 获取扫码邀请人id
- // this.invitation = uni.getStorageSync('spread')||'';
- },
- watch: {
- // 监听倒计时
- countDown(i) {
- if (i == 0) {
- clearInterval(this.time);
- }
- }
- },
- methods: {
- //选择是否积分抵扣
- jfdk(index) {
- if(index == 1) {
- this.isSelsect = true
- }else {
- this.isSelsect = false
- }
- },
- //选择区域
- bindParentArea(e) {
- console.log(e.detail.value)
- this.parent_area = this.parent_areas[e.detail.value]
- },
- //选择值支付方式
- bindPayType(e) {
- console.log(e)
- if(e.detail.value) {
- this.pay_type = this.pay_types[e.detail.value]
- }else if(e.detail.value == 0){
- this.pay_type = this.pay_types[e.detail.value]
- }
-
- },
- // 注册
- register() {
- let obj = this;
- if (obj.phone == '') {
- obj.$api.msg('请输入账号');
- return;
- }
- if (obj.password == '') {
- obj.$api.msg('请输入密码');
- return;
- }
- if (obj.repassword == '') {
- obj.$api.msg('请再次输入密码');
- return;
- }
- if (obj.repassword != obj.password) {
- obj.$api.msg('两次密码不正确');
- return;
- }
- if(obj.code == '') {
- obj.$api.msg('请输入验证吗');
- return;
- }
- if(obj.parent_area == '') {
- obj.$api.msg('请选择区域');
- return;
- }
- if(obj.pay_type == '') {
- obj.$api.msg('请选择支付方式');
- return;
- }
- let paytype = ''
- if(obj.pay_type == '微信') {
- paytype = 'weixin'
- }else if(obj.pay_type == '余额') {
- paytype = 'yue'
- }else if(obj.pay_type == '佣金') {
- paytype = 'brokerage'
- }
- register({
- account: obj.phone, //账号
- captcha: obj.code, //验证码
- password: obj.password ,//密码
- parent: obj.invitation,//接点人uid
- parent_area: obj.parent_area,//区域
- pay_type: paytype,
- use_integral: obj.isSelsect ? '1':'0',
- from: 'APP'
- }).then(function(e) {
- uni.showToast({
- title:'注册成功',
- duration:2000,
- position:'top'
- });
- setTimeout(function () {
- uni.navigateTo({
- url: '/pages/user/jiedian'
- });
- },1000)
- }).catch( err => {
- console.log(err)
- })
- },
- //发送验证码
- verification() {
- let obj = this;
- if (this.phone == '') {
- this.$api.msg('请输入电话号码');
- return;
- }
- if (this.phone.length < 11) {
- this.$api.msg('请输入正确的手机号');
- return;
- }
- // 判断是否在倒计时
- if (obj.countDown > 0) {
- return false;
- } else {
- obj.countDown = 60;
- obj.time = setInterval(() => {
- obj.countDown--;
- }, 1000);
- //调用验证码接口
- verify({
- phone: obj.phone,
- type: 'register'
- })
- .then(({ data }) => {})
- .catch(err => {
- console.log(err);
- });
- }
- },
- login() {
- //返回登录
- uni.navigateTo({
- url: '/pages/public/login'
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100%;
- }
- .container {
- width: 100%;
- height: 100%;
- background-size: 100%;
- background-color: #fff;
- }
- .container_text {
- width: 100%;
- height: 500rpx;
- top: 0rpx;
- // background-color: #FF4343;
- .banner-img {
- width: 100%;
- height: 100%;
- }
- }
- .login_text {
- margin: auto 30rpx;
- position: relative;
- padding: 100rpx 102rpx;
- background-color: #ffffff;
- // margin-top: -180rpx;
- border-radius: 20rpx;
- .login_input {
- border-bottom: 1px solid #f0f0f0;
- margin-bottom: 65rpx;
- .login_img image {
- height: 35rpx;
- width: 29rpx;
- margin-right: 20rpx;
- }
- .uni-input {
- text-align: left;
- width: 470rpx;
- font-size: 28rpx !important;
- position: relative;
- image {
- width: 30rpx;
- height: 30rpx;
- position: absolute;
- right: 0;
- }
- }
- .login_name {
- color: #333333;
- }
- }
- .other {
- margin-top: 60rpx;
- .fenge {
- width: 30%;
- height: 2rpx;
- background-color: #eeeeee;
- }
- .qita {
- font-size: 28rpx;
- color: #999999;
- }
- }
- .weixin {
- width: 75rpx;
- height: 75rpx;
- margin: 25rpx auto;
- }
- .weixin image {
- width: 100%;
- height: 100%;
- }
- .weixin_text {
- text-align: center;
- font-size: 28rpx;
- color: #999999;
- }
- .forget {
- font-size: 28rpx;
- width: 100%;
- text-align: right;
- color: #999999;
- }
- .uni-button-green {
- color: #ffffff;
- background-color: $base-color;
- margin: 40rpx 10rpx;
- border-radius: 10rpx;
- }
- .uni-button-green-plain {
- border: 1px solid $base-color;
- margin: 40rpx 10rpx;
- border-radius: 50rpx;
- color: $base-color;
- background-color: #ffffff;
- }
- .uni-button {
- height: 85rpx;
- line-height: 85rpx;
- }
- }
- .loginTitle {
- position: absolute;
- top: 250rpx;
- width: 100%;
- text-align: center;
- color: white;
- font-size: 40rpx;
- }
- .forget {
- width: 100rpx;
- font-size: 24rpx;
- color: #ffffff;
- margin: 0px auto;
- border-bottom: 1px solid #ffffff;
- }
- .width {
- width: 325rpx !important;
- }
- .code {
- color: $base-color;
- font-size: 23rpx;
- border-left: 1px solid #eeeeee;
- width: 150rpx;
- flex-shrink: 0;
- text-align: center;
- }
- uni-button {
- height: 80rpx !important;
- line-height: 80rpx !important;
- }
- </style>
|