<template>
  <div>
    <el-card class="box-card">
      <div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%)">
        <el-form :model="formData.data" label-width="100px" :rules="rules" ref="submit">
          <el-form-item label="万里牛单号:" prop="wlnCode">
            <el-input v-model="formData.data.wlnCode" placeholder="请输入万里牛单号" />
          </el-form-item>
        </el-form>
        <div style="width: 100%; padding-top: 16px; text-align: center">
          <el-button type="primary" @click="submitForm()" size="large" v-preReClick>保 存</el-button>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script setup>
import { ElMessage } from "element-plus";

const { proxy } = getCurrentInstance();
const formData = reactive({
  data: {
    wlnCode: "",
  },
});
const rules = ref({
  wlnCode: [{ required: true, message: "请输入万里牛单号", trigger: "blur" }],
});
const submitForm = () => {
  proxy.$refs.submit.validate((valid) => {
    if (valid) {
      proxy.post("/orderHandle/resynchronization", formData.data).then(() => {
        ElMessage({ message: "万里牛订单同步完成", type: "success" });
        formData.data = {
          wlnCode: "",
        };
      });
    }
  });
};
</script>

<style lang="scss" scoped></style>
