<template>
  <el-row>
    <el-col :span="10" :offset="2">
      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()">
        <el-form-item>
          <p>淘客订单查询：一次最多查询一条订单号</p>
        </el-form-item>
        <el-form-item prop="orderNo">
          <el-input
            type="textarea"
            :rows="5"
            placeholder="请输入订单号"
            v-model="dataForm.orderNo">
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="dataFormSubmit()">淘客检测</el-button>
        </el-form-item>
        <el-form-item>
          <p>检测结果：</p>
          <el-input
            type="textarea"
            :rows="5"
            placeholder=""
            v-model="ordersearch">
          </el-input>
        </el-form-item>
      </el-form>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: 'tools-ordersearch',
  data () {
    return {
      dataForm: {
        orderNo: ''
      },
      ordersearch: '', // 1454509298597998128
      dataRule: {
        orderNo: [
          { required: true, message: '订单号不能为空', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    dataFormSubmit () {
      this.$refs['dataForm'].validate((valid) => {
        console.log(valid)
        if (!valid) {
          return
        }
        this.$http({
          url: this.$http.adornUrl('/tb/getOrderMsg'),
          method: 'post',
          data: this.$http.adornData({
            'orderNo': this.dataForm.orderNo
          })
        }).then(({ data }) => {
          if (data.status) {
            this.ordersearch = data.data
          } else {
            this.$message.error(data.msg)
          }
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
