<template>
  <view class="container">
    <view class="card">
      <view class="card">
        <u-form
          ref="formRef"
          label-position="top"
          :model="form"
          :rules="rules"
          label-width="auto"
        >
          <u-form-item label="打回原因" prop="REJECTOPINION" required>
            <u-textarea
              v-model="form.REJECTOPINION"
              placeholder="请输入打回原因"
              border="none"
              auto-height
            />
          </u-form-item>
          <u-line />
          <view class="mt-10">
            <u-button
              type="primary"
              shape="circle"
              text="提交"
              :throttle-time="1000"
              @click="fnSubmit"
            />
          </view>
        </u-form>
      </view>
    </view>
  </view>
</template>

<script>
import dayjs from "dayjs";

export default {
  props: {
    label: {
      type: String,
      default: "时间",
    },
    prop: {
      type: String,
      default: "",
    },
    mode: {
      type: String,
      default: "datetime",
    },
    labelPosition: {
      type: String,
      default: "left",
    },
    required: {
      type: Boolean,
      default: true,
    },
    maxDate: {
      type: Number,
      default: dayjs().add(10, "year").valueOf(),
    },
    minDate: {
      type: Number,
      default: dayjs().subtract(10, "year").valueOf(),
    },
  },
  data() {
    return {
      modelValue: "",
      visible: false,
      value: new Date().getTime(),
    };
  },
  methods: {
    fnShowPicker() {
      this.visible = true;
    },
    fnConfirm({ mode, value }) {
      if (mode === "datetime")
        this.modelValue = dayjs(value).format("YYYY-MM-DD HH:mm");
      else if (mode === "date")
        this.modelValue = dayjs(value).format("YYYY-MM-DD");
      else if (mode === "year-month")
        this.modelValue = dayjs(value).format("YYYY-MM");
      this.visible = false;
    },
  },
};
</script>