<template>
    <div>
            <el-form ref="form" :model="form" :rules="rules" label-width="100px">
                <el-form-item label="跟进阶段" prop="visitStatus">
                    <el-select v-model="form.visitStatus" placeholder="请选择跟进阶段" clearable size="small">
                        <el-option
                                v-for="item in statusOptions"
                                :key="item.dictValue"
                                :label="item.dictLabel"
                                :value="item.dictValue"
                            />
                    </el-select>
                </el-form-item>
            </el-form>
            <div class="footer">
                <el-button type="primary" @click="submitForm">确 定</el-button>
            </div>
    </div>
</template>
  
<script>
    import { updateCustomer  } from "@/api/crm/customer";
    export default {
        name: "visit",
        data() {
            return {
                statusOptions:[],
                form: {
                    customerId:null,
                    visitStatus:null,
                },
                // 表单校验
                rules: {
                  
                    visitStatus: [
                        { required: true, message: "跟进阶段不能为空", trigger: "change" }
                    ],
                }
                 
            };
        },
        created() {
            this.getDicts("crm_customer_user_status").then((response) => {
                this.statusOptions = response.data;
            });
        },
        methods: {
            reset(row) {
                this.form.customerId=row.customerId;
                this.form.content=null;
                this.form.visitStatus=row.status.toString();
            },
            /** 提交按钮 */
            submitForm() {
                this.$refs["form"].validate(valid => {
                if (valid) {
                    updateCustomer(this.form).then(response => {
                        if (response.code === 200) {
                            this.msgSuccess("提交成功");
                            this.$emit('close');
                        }
                    });
                }
                });
            },
        }
    };
</script>
<style lang="scss" scoped>
.contents{
    height: 100%;
    background-color: #fff;
    padding: 20px;
        
}
.footer{
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
</style>


<style scoped>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
</style>




 