<style lang="less">

</style>

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

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