ll
liukangdong
2024-12-16 ebf7a029c270a728c7578870d6d60a5762f0d1f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<template>
    <view class="main_app">
        <image class="bg" src="@/static/wuliuche_bg@2x.png" mode="widthFix"></image>
        <view class="login_wrap">
            <view class="item">
                <view class="la">手机号</view>
              <input v-model="form.phone" type="tel" maxlength="18" placeholder-class="placeholder9" placeholder="请输入手机号" />
            </view>
            <view class="item">
                <view class="la">验证码</view>
              <view class="df_sb">
                  <input
                    v-model="form.code"
                    placeholder="请输入验证码"
                      placeholder-class="placeholder9"
                    type="number"
                  />
                  <text class="captcha" v-if="countDown == 0" @click="initCaptcha"
                    >获取验证码</text
                  >
                  <text class="placeholder9" v-else>{{ countDown }}</text>
              </view>
            </view>
            <view class="login_btn" @click="onSubmit">
                <view class="login_btn_n">查询</view>
            </view>
        </view>
    </view>
</template>
 
<script>
    import { sendSms, validPhoneCaptcha } from '@/api'
    export default {
        data() {
            return {
                form: {
                    code: '',
                    phone: ''
                },
                countDown: 0
            };
        },
        methods: {
            onSubmit() {
                const { code, phone } = this.form
                if (!phone) return this.showToast('手机号不能为空')
                if (!code) return this.showToast('验证码不能为空')
                validPhoneCaptcha({
                  phone, code
                }).then(res => {
                  if (res && res.code == 200) {
                    uni.navigateTo({
                      url: "/pages/waybill/list?phone=" + phone
                    })
                  }
                })
            },
            initCaptcha() {
              if (!this.form.phone) return uni.showToast({
                title: '手机号不能为空',
                icon: 'none'
              })
              sendSms({ phone: this.form.phone }).then(res => {
                this.countDown = 60
                setInterval(() => {
                  if (this.countDown == 0) return
                  this.countDown--
                }, 1000)
              })
            },
        }
    }
</script>
 
<style lang="scss">
.main_app{
    padding-top: 218rpx;
    .bg{
        width: 750rpx;
        position: absolute;
        left: 0;
        top: 0;
        z-index: -1;
    }
    .login_wrap {
      width: 690rpx;
      height: 490rpx;
      background: #FFFFFF;
      box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(39,155,170,0.16);
      border-radius: 16rpx;
      padding: 40rpx 30rpx;
      box-sizing: border-box;
        
      .item {
        width: 100%;
        height: 126rpx;
            padding-right: 10rpx;
        box-sizing: border-box;
        margin-bottom: 30rpx;
            border-bottom: 1px solid #E5E5E5;
        &:last-child {
          margin-bottom: 0 !important;
        }
            
        .la{
                font-weight: 400;
                font-size: 28rpx;
                color: #222222;
            }
        .captcha {
          color: $uni-color-primary;
        }
            .df_sb{
                display: flex;
                justify-content: space-between;
                align-items: center;
            }
        input {
          flex: 1;
          height: 86rpx;
          color: #666666;
          // margin-left: 24rpx;
                display: flex;
                align-items: center;
          border: none;
        }
      }
    }
    .login_btn {
     width: 630rpx;
     height: 88rpx;
      box-sizing: border-box;
      margin-top: 40rpx;
      .login_btn_n {
        width: 100%;
        height: 98rpx;
        background: $uni-color-primary;
        box-shadow: 0rpx 12rpx 24rpx 0rpx rgba(39, 155, 170, 0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 30rpx;
        color: #ffffff;
        border-radius: 50rpx;
      }
    }
}
</style>