search.vue 4.62 KB
<template>
  <div class="qulification_search_container">
    <NafmHeader navClass="nafmii-head-bg3" title="资质查询" />
    <main class="qulification_content">
      <section class="logo">
      </section>
      <h3 class="search_title">{{$t('qulification.title')}}</h3>
      <section class="search_box">
        <span class="select" @click="showSheet = true">
          <van-icon name="search" />
          <span class="qulification_type">{{qulificationType}}</span>
          <van-icon name="play" />
        </span>
        <div class="visual_input" @click="toListSearch">
          <span>{{placeholdTxt}}</span>
        </div>
      </section>
      <section class="search_history">
        <div class="history_header">
          <span>{{$t('qulification.history')}}</span>
          <span class="delete_circle">
            <van-icon name="delete" />
          </span>
        </div>
        <div>
          <span class="history_item" v-for=" item in historyItems" :key="item.id" @click="toDetail">{{item.name}}</span>
        </div>
      </section>
    </main>
    <van-action-sheet v-model="showSheet" :actions="actions" :cancel-text="$t('button.cancel')" close-on-click-action @select="onSelect" />
  </div>
</template>
<script>
export default {
  name: 'QulificationSearch',
  computed: {
    actions() {
      return [this.$t('qulification.searchAction').org, this.$t('qulification.searchAction').product ]
    }
  },
  data() {
    return {
      // actions: [
      //   {name:'机构', type: 'org' },
      //   {name:'非法人产品', type: 'pro'}
      // ],
      qulificationType: '',
      placeholdTxt: '',
      showSheet: false,
      historyItems: [{
        name: 'jdnskjfnjkds',
        id:11111
      }, {
        name: 'dksjnjkfdskjnkf',
        id: 2222
      }, {name: 'jdnskjfnjkds',
        id:111112
      }, {
        name: 'dksjnjkfdskjnkf',
        id: 22222
      }]
    }
  },
  created() {
    this.defaultInput()
  },
  methods: {
    defaultInput() {
      this.qulificationType = this.$t('qulification.searchAction').org.name
      this.placeholdTxt = this.$t('qulification.searchAction').org.placeholder
    },
    onSelect(item) {
      this.show = false;
      this.qulificationType = item.name;
      this.placeholdTxt = this.$t('qulification.searchAction')[item.key].placeholder
    },
    toListSearch() {
      this.$router.push({name: 'QulificationList'})
    },
    toDetail() {
      this.$router.push({name: 'QulificationDetail'})
    }
  }
}
</script>
<style lang="less" scoped>
.qulification_search_container {
  width: 384px;
  margin: 0 auto;
  .logo {
    display: block;
    width: 100px;
    height: 100px;
    margin: 15px auto;
    background: url(../../assets/icon/logo.png) no-repeat;
    background-size: contain;
  }
  .search_title {
    font-size: 16px;
    font-family: PingFangSC-Semibold;
    color: #333333;
    text-align: center;
  }
  .search_box {
    width: 384px;
    margin: 30px auto 25px;
    border-radius: 16px;
    background-color: rgba(246, 246, 246, 1);
    display: flex;
    font-size: 12px;
    .select {
      color: #999999;
      display: flex;
      align-items: center;
      padding: 10px 10px 10px 5px;
      .van-icon-search {
        margin: 0 11px;
        font-size: 12px;
      }
      .qulification_type {
        color: #333333;
        margin-right: 5px;
      }
      .van-icon-play {
        transform: rotate(90deg);
        -ms-transform: rotate(90deg); /* IE 9 */
        -moz-transform: rotate(90deg); /* Firefox */
        -webkit-transform: rotate(90deg); /* Safari 和 Chrome */
        -o-transform: rotate(90deg);
      }
    }
    .visual_input {
      // width: 285px;
      color: #999999;
      padding: 10px 0;
      overflow: hidden; /*超出部分隐藏*/
      white-space: nowrap; /*不换行*/
      text-overflow: ellipsis; /*超出部分文字以...显示*/
      span {
        padding-left: 15px;
        border-left: 0.5px solid #999999;
      }
    }
  }
  .search_history {
    .history_header {
      line-height: 25px;
      margin-bottom: 5px;
      font-size: 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .delete_circle {
        display: inline-block;
        width: 25px;
        height: 25px;
        border-radius: 50%;
        background-color: #f6f6f6;
        text-align: center;
        line-height: 25px;
        // .van-icon-delete {
        //   align-self: middle;
        // }
      }
    }
    .history_item {
      display: inline-block;
      font-size: 12px;
      color: #666666;
      padding: 6px 20px;
      border-radius: 50px;
      background-color: #f6f6f6;
      margin: 10px 10px 0 0;
    }
  }
}
</style>