searchUser.vue 4.18 KB
<template>
  <v-layout id="SearchUser" column justify-center align-center>
    <v-flex>
      <v-card id="InfoBlock" flat class="infoList">
        <v-list>
          <v-list-tile>
            <v-list-tile-content>
              <v-list-tile-title >姓名</v-list-tile-title>
            </v-list-tile-content>
            <v-list-tile-action>
             <input type="text" placeholder="请输入查询对象姓名" v-model="form.name">
            </v-list-tile-action>
          </v-list-tile>
          <v-divider></v-divider>
          <v-list-tile >
            <v-list-tile-content>
              <v-list-tile-title >手机号码</v-list-tile-title>
            </v-list-tile-content>
            <v-list-tile-action>
             <input type="text" placeholder="请输入查询对象手机号" v-model="form.number">
            </v-list-tile-action>
          </v-list-tile>
        </v-list>
      </v-card>
      <div class="ConfirmButtonBlock">
        <v-btn depressed id="ConfirmButton" :disabled="disabled" :loading="isLoading" @click="submit">查询信用记录</v-btn>
        <div id="FuckIphoneX"></div>
      </div>
    </v-flex>
    <v-dialog  v-model="dialogDisplay" persistent max-width="290">
      <v-card class="hintDialog">
        <v-card-title class="headline">提示</v-card-title>
        <v-card-text class='dialogContent'>未找到符合的用户</v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="black" flat @click.native="dialogDisplay = false">知道了</v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>
  </v-layout>
</template>

<script>
import {wechatShareSetting} from '@/helper'

export default {
  layout: 'lightColor',
  data:() => ({
    form: {
      name: '',
      number: ''
    },
    isLoading: false,
    dialogDisplay: false,
    dialogInfo: ''
  }),
  head:() => ({
    title: '信用查询'
  }),
  computed: {
    disabled() {
      return !(this.form.name && this.form.number)
    }
  },
  mounted() {
    wechatShareSetting(this.$axios, this.$store)
    
  },
  methods: {
    async submit() {
      if (this.disabled) return
      this.isLoading = true
      const {data} = await this.$axios.get(`/user/find?name=${this.form.name}&mobile=${this.form.number}`)
      if (data.success) {
        if (data.notFound) {
          this.isLoading = false
          this.dialogDisplay = true
        } else {
          this.$router.push(`/userRecord?id=${data.id}`)
        }
      } else {
        this.isLoading = false
        this.$store.dispatch('displayMessage', data.msg)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
  #SearchUser {

    .infoList {
      width: 100vw;
      background: #FFFFFF;
      padding: 0;
      .list {
        padding: 0;
      }

      input {
        outline: none;
        text-align: right;
      }

      .subheader {
        height: 2rem;
        line-height: 2rem;
        display: block;
        background-image: linear-gradient(-229deg, #DAB269 37%, #E7C78C 87%);
      }

    }

  
    .ConfirmButtonBlock {
      width: 100vw;
      margin: 1rem auto;
      position: absolute;
      bottom: 0;
      text-align: center;


      #ConfirmButton {
        color: #484646;
        width: 90vw;
        background-image: linear-gradient(-213deg, #DAB269 0%, #E7C78C 92%);
        border-radius: 2px;
        height: 2.8rem;
        font-size: 18px;
        margin: auto;
        transition: 0.2s all ease-in-out;

        &:disabled {
          background-image: none;
        }
      }
    }
    
  }
  .hintDialog {
    background-color: #fff;
    color: #000;
    .headline {
      justify-content: center;
      font-weight: bold;
      padding-bottom: 0;
    }
    .dialogContent {
      justify-content: center;  
      text-align: center;

      .warningIcon {
        margin-bottom: 0.5rem;
        color: red;
        font-size: 5rem;
      }
      .bold {
        font-weight: bold;
      }

      p {
        margin-bottom: 0;
      }
    }
    .btn {
      width: 100%;
    }
    #FuckIphoneX {
      position: fixed;
      bottom: 0;
      width: 100%;
      height: constant(safe-area-inset-bottom);
      height: env(safe-area-inset-bottom);
      background-color:transparent;
    }
  }
</style>