member.vue 6.09 KB
<template>
  <el-row>
    <el-col :lg="18" :sm="24">
      <div class="wPanel">
        <img class="forWei poimg" src="@/assets/h5/cx@2x.png">
        <h2>单位会员查询</h2>
        <el-form ref="queryRef" :model="queryParams" :rules="rules" label-width="120">
          <el-form-item label="单位会员编号" prop="queryCode">
            <el-input
              v-model.trim="queryParams.queryCode"
              placeholder="请输入单位会员编号"
              size="large"
              clearable
              prefix-icon="Postcard"
              @keyup.enter="handleQuery"
            />
          </el-form-item>
          <el-form-item label="图形验证码" prop="code">
            <captcha
              ref="codeRef" v-model="queryParams.code" v-model:uuid="queryParams.uuid" :auto-load="false"
              @keyup.enter="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button class="search-btn" round type="default" plain @click="handleQuery">
              <el-icon class="el-icon--left">
                <Search />
              </el-icon>
              查询
            </el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-divider class="forPc" />
      <div class="wPanel mt20">
        <img class="forWei poimg" src="@/assets/h5/jg@2x.png">
        <h2>单位会员查询结果</h2>
        <el-form label-width="120">
          <el-form-item label="会员名称">
            <el-input v-model="resultForm.name" readonly />
          </el-form-item>
          <el-form-item label="会员编号">
            <el-input v-model="resultForm.code" readonly />
          </el-form-item>
          <el-form-item label="有效期开始">
            <el-input v-model="resultForm.startTime" readonly />
          </el-form-item>
          <el-form-item label="有效期结束">
            <el-input v-model="resultForm.endTime" readonly />
          </el-form-item>
        </el-form>
      </div>
    </el-col>
  </el-row>
  
  <div v-if="showCert" class="cert">
    <div class="bg_certificate bg_c1">
      <button type="button" class="close" @click="closeCert">
        <span aria-hidden="true">×</span>
      </button>
      <input readonly type="text" class="input_certificate c2_01" :value="resultForm.name">
      <input readonly type="text" class="input_certificate c2_02" :value="resultForm.code">
      <input readonly type="text" class="input_certificate c2_03" style="color: black;" :value="resultForm.status">
      <input readonly type="text" class="input_certificate c2_04" :value="resultForm.startTime">
      <input readonly type="text" class="input_certificate c2_05" :value="resultForm.endTime">
    </div>
  </div>
</template>

<script setup>
import { getCurrentInstance, reactive } from '@vue/runtime-core'
import { toRefs } from 'vue'
import Captcha from '@/views/login/components/captcha'
import * as authentic from '@/apiPc/authentic'
import { customMessageBox } from '@/utils/ruoyi'

const { proxy } = getCurrentInstance()

const data = reactive({
  queryParams: {
    type: '1',
    queryCode: undefined,
    code: undefined,
    uuid: undefined
  },
  rules: {
    queryCode: [{ required: true, trigger: 'blur', message: '请输入单位会员编号' }],
    code: [{ required: true, trigger: 'blur', message: '请输入图形验证码' }]
  },
  resultForm: {},
  showCert: false
})
const { queryParams, rules, resultForm, showCert } = toRefs(data)

function handleQuery() {
  proxy.$refs['queryRef'].validate((valid) => {
    if (valid) {
      resultForm.value = {}
      authentic.accurateQuery(queryParams.value).then(res => {
        if (res.data) {
          resultForm.value = res.data
          showCert.value = true
        } else {
          customMessageBox('没有查询到相应的数据')
          // proxy.$modal.msgError('没有查询到相应的数据')
        }
      }).finally(getCode)
    }
  })
}

function getCode() {
  proxy.$refs['codeRef'].getCode()
}

function init() {
  getCode()
}

function closeCert() {
  showCert.value = false
}

defineExpose({
  init
})
</script>

<style scoped lang="scss">
h2 {
  color: var(--el-color-primary);
  font-size: 18px;
  text-align: center;
  margin: 0 0 30px;
}

:deep(.el-input__wrapper) {
  background: #FBFCFD;
}

.forWei {
  display: none;
}

@media (max-width: 500px) {
  h2 {
    color: #000;
  }
  .forWei {
    display: block;
  }
  .forPc {
    display: none
  }
  .wPanel {
    position: relative;
  }
  .poimg {
    width: 110px;
    position: absolute;
    right: 10px;
    top: 0;
  }
  .search-btn {
    background: var(--el-color-primary);
    color: #fff;
    border: none;
    display: block;
    width: calc(100vw - 260px);
  }
}

.bg_c1 {
  background: url("@/assets/v1/cert/group.png") no-repeat;
}

.bg_certificate {
  position: relative;
  padding: 10px;
  width: 800px;
  height: 565px;
  
  .close {
    -webkit-appearance: none;
    padding: 0;
    float: right;
    cursor: pointer;
    border: 0;
    margin-top: 10px;
    margin-right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background-color: #900;
    color: #fff;
    font-size: 16px;
    opacity: 1;
  }
  
  .input_certificate {
    position: absolute;
    font-size: 16px;
    font-weight: bold;
    font-family: "宋体";
    border: none;
    background: none;
  }
  
  .c1_01 {
    top: 220px;
    left: 250px;
  }
  
  .c1_02 {
    top: 280px;
    left: 250px;
  }
  
  .c1_03 {
    top: 340px;
    left: 250px;
  }
  
  .c1_04 {
    top: 400px;
    left: 250px;
  }
  
  .c1_05 {
    top: 220px;
    left: 520px;
  }
  
  .c1_06 {
    top: 280px;
    left: 520px;
  }
  
  .c1_07 {
    top: 340px;
    left: 520px;
  }
  
  .c2_01 {
    top: 220px;
    left: 250px;
    width: 400px;
  }
  
  .c2_02 {
    top: 280px;
    left: 250px;
  }
  
  .c2_03 {
    top: 340px;
    left: 250px;
  }
  
  .c2_04 {
    top: 280px;
    left: 520px;
  }
  
  .c2_05 {
    top: 340px;
    left: 520px;
  }
}

.cert {
  position: fixed;
  height: 100vh;
  width: 100vw;
  overflow: auto;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.6);
}
</style>