<template>
  <div class="batchChangeSendoutDate">
    <Form
      ref="formModel"
      :model="formModel"
      :label-width="90"
    >
      <FormItem
        label="提前发货日期"
        prop="PRESALEADVANCEDELIVERYDATE"
      >
        <DatePicker
          v-model="formModel.PRESALEADVANCEDELIVERYDATE"
          :v-model-format="vModelFormat"
          format="yyyy-MM-dd HH:mm:ss"
          type="datetime"
          :options="dateOptions"
          placeholder=""
          style="width: 100%"
          :vModelFormat="true"
        />
      </FormItem>
    </Form>
    <footer style="display: flex; justify-content: flex-end; margin-top: 16px">
      <Button
        type="fcdefault"
        @click="cancel()"
      >
        取消
      </Button>
      <Button
        type="posdefault"
        style="margin-left: 8px;"
        @click="submit()"
      >
        确定
      </Button>
    </footer>
  </div>
</template>

<script>
  const R3 = window.R3;
  const { network, urlSearchParams, store } = R3;
  export default {
    name: 'batchChangeWMS',
    props: {
      selectRowData: { // 获取选择行的数据
        type: Array,
        default: () => []
      },
      idArray: {// 获取ID用于多选
        type: [Array, Object],
        default: () => {
        }
      },
    },
    data() {
      return {
        WarehousesList: [],
        formModel: {
          PRESALEADVANCEDELIVERYDATE: '',
        },
        vModelFormat: true,
        dateOptions: {
          disabledDate(date) {
            return date && date.valueOf() < Date.now() - 86400000;
          }
        },
      };
    },
    methods: {
      submit() {
        let params = {
          advanceDate: this.formModel.PRESALEADVANCEDELIVERYDATE,
          orderIds: this.idArray
        };
        network.post('/p/cs/advancedelivery/modify', params).then(res => {
          if (res.data.code == 0) {
            this.$Modal.fcSuccess({
              title: '提示',
              mask: true,
              content: res.data.message,
            });
            document.querySelector('#refresh').click(); // 标准列表刷新按钮
            this.$emit('cancel');
          }
        });
      },

      cancel() {
        this.closeDialog();
      },
      closeDialog() { // 关闭弹窗
        this.$emit('closeActionDialog', true);
      },
    }
  };
</script>
<style>
  .batchChangeSendoutDate .ark-select-single .ark-select-selection {
    height: 34px;
  }
</style>
<style scoped>
  /* .batchChangeSendoutDate form {
    margin-right: 30px;
  } */
</style>
