<template>
  <div class="app-container">
    <el-form v-loading="loading">
      <el-form-item label="跟踪号" label-width="100px">
        <el-input v-model="trackingNo" />
      </el-form-item>
      <el-form-item label="IOSS" label-width="100px">
        <el-input v-model="ioss" />
      </el-form-item>
      <el-form-item label="加密结果" label-width="100px">
        <el-input v-model="encryptedIoss" readonly />
      </el-form-item>
    </el-form>
    <div class="text-center">
      <el-button type="success" @click="submit">提交</el-button>
    </div>
  </div>
</template>

<script>
import { _encryFltIoss } from '@/api/ioss'
export default {
  name: 'FltIoss',
  data: function() {
    return {
      loading: false,
      trackingNo: null,
      ioss: null,
      encryptedIoss: null
    }
  },
  methods: {
    submit() {
      const trackingNumber = this.trackingNo
      const ioss = this.ioss
      if (!trackingNumber) {
        this.$message({ message: '请填写跟踪号', type: 'error' })
        return
      }
      this.encryptedIoss = null
      const data = { trackingNumber, ioss }
      this.loading = true

      _encryFltIoss(data)
        .then((res) => {
          this.encryptedIoss = res
        })
        .finally(() => {
          this.loading = false
        })
    }
  }
}
</script>

<style></style>
