<style lang="less">

</style>

<template>
    <Modal v-model="remarkModal" :loading="loading">
        <p slot="header">
            <Icon type="information-circled"></Icon>
            <span>修改</span>
        </p>
        <div>
            <Form ref="form" :label-width="80">
                <FormItem label="备注">
                    <Input type="textarea" v-model="remark" />
                </FormItem>
            </Form>
        </div>
        <div slot="footer">
            <Button type="primary" @click="submit">确定</Button>
        </div>
    </Modal>
</template>

<script>
export default {
    name: 'remark',
    data() {
        return {
            loading: true,
            id: this.row.id,
            remark: this.row.remark,
            remarkModal: false
        }
    },
    watch: {
        row() {
            this.remark = this.row.remark;
            this.id = this.row.id;
        },
        remarkShow() {
            this.remarkModal = this.remarkShow;
        },
        remarkModal() {
            if (!this.remarkModal) {
                this.$emit("close");
            }
        }
    },
    props: {
        remarkShow: Boolean,
        row: Object
    },
    methods: {
        submit() {
            this.axios.post("/option_order/remark", {
                id: this.id,
                remark: this.remark
            }).then((res) => {
                this.$emit("close", {id: this.id, remark: this.remark});
                this.loading = false;
            });
        }
    }
};
</script>
