<template>
  <div class="modify-remark">
    <div class="form-item">
      <div class="form-label">
        内部备注:
      </div>
      <div>
        <Input
          v-model="value"
          type="textarea"
          style="width: 300px;"
          :rows="4"
        />
      </div>
    </div>
    <DialogFooter
      :on-confirm="onConfirm"
      :on-cancel="onCancel"
    />
  </div>
</template>

<script>
  import DialogFooter from '../commonModal/dialog-footer.vue';

  const R3 = window.R3;
  const { network, urlSearchParams } = R3;

  export default {
    name: 'ModifyRemarkModal',

    components: {
      DialogFooter
    },

    props: {
      selectRowData: {// 获取ID用于多选,获取勾选的明细对应的row内的数据
        type: [Array, Object],
        default: () => {}
      }
    },

    data() {
      return {
        value: ''
      };
    },

    mounted() {

    },

    methods: {
      close() {
        this.$emit('closeActionDialog', false);
      },

      onCancel() {
        this.close();
      },

      onConfirm() {
        const ids = this.selectRowData.map(item => item.ID.val)
        const params = {
          type: 1,
          text: this.value,
          ids
        };
        network.post('/p/cs/order/insideremark/batch', params).then(res => {
          if (res.data.code == 0) {
            this.$Message.success('修改成功!');
            this.$emit('closeActionDialog', true);
          }
        });
      }
    },
  };
</script>

<style lang="less" scoped>
.modify-remark {
  .form-item {
    display: flex;
    padding: 10px 10px 0;
  }
  .form-label {
    margin-right: 12px;
  }
}
</style>
