
<template>
    <div class="detail-popup">
        <popup ref="popupRef" title="售后工单详情" :async="true" width="80%" @confirm="handleSubmit" @close="handleClose">
            <el-form ref="formRef" :model="formData" label-width="auto">
                <el-card class="mb-2">
                    <el-row>
                        <el-col :span="8">
                            <el-form-item label="项目名称">

                                {{ formData.name }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="项目编码">

                                {{ formData.name }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="客户名称">
                                {{ formData.custom_name }}

                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="合同号">
                                {{ formData.contract_code }}

                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="联系人">
                                {{ formData.custom_master_name }}

                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="联系电话">
                                {{ formData.custom_master_phone
                                }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="分类">

                                {{ formData.classification_text
                                }}

                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="紧急程度">
                                {{ formData.urgency_text
                                }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="处理结果">
                                {{ formData.processing_result_text
                                }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="接待人">
                                {{ formData.receiver }}
                            </el-form-item>

                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="投诉人">
                                {{ formData.custom_master_name }}
                            </el-form-item>

                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="指定处理人" prop="notes">
                                {{ formData.processed_user_name
                                }}
                            </el-form-item>
                        </el-col>

                        <el-col :span="8">
                            <el-form-item label="花费工时" prop="notes">
                                {{ formData.processing_hours }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="完成日期" prop="notes">
                                {{ formData.done_date
                                }}
                            </el-form-item>
                        </el-col>

                        <el-col :span="8">
                            <el-form-item label="投诉主题" prop="notes">
                                {{ formData.name }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="问题描述" prop="description">
                                {{ formData.description }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="处理过程" prop="description">
                                {{ formData.processing_process }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="回访确认" prop="description">
                                {{ formData.description }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="备注" prop="notes
">
                                {{ formData.notes }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="附件">
                                <div v-if="formData.annex && formData.annex.length > 0">
                                    <div v-for="(item, index) in formData.annex" style="margin-left: 5px;display: block;">
                                        <a style="margin-left: 10px; color: #4a5dff; align-self: flex-start" :href="item.uri" target="_blank">文件{{ index + 1 }}查看</a>

                                    </div>
                                </div>
                                <div v-else>暂无附件</div>
                            </el-form-item>
                        </el-col>

                    </el-row>

                    <el-row>
                        <div style="margin-bottom: 20px;">客户评价</div>
                        <el-col :span="24">
                            <el-form-item label="整体评价" prop="score">
                                <el-rate v-model="formData.score" disabled size="large" style="margin-top: 5px ;" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="24" style="margin-top: -15px ;">
                            <el-form-item label="问题是否解决" prop="is_solve_text">
                                {{ formData.is_solve_text }}

                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="反馈意见" prop="feedback">
                                {{ formData.feedback }}
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>
            </el-form>
        </popup>
    </div>
</template>

<script lang="ts" setup name="customdetail">

import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCustomDetail } from '@/api/custom'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
    dictData: {
        type: Object as PropType<Record<string, any[]>>,
        default: () => ({})
    }
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()

const datas = reactive({
    provinceOptions: [],
    cityOptions: [],
    areaOptions: [],
});


// 表单数据
const formData = reactive({

})



// 获取详情
const setFormData = async (data: Record<any, any>) => {
    Object.assign(formData, data)


}

const getDetail = async (row: Record<string, any>) => {
    const data = await apiCustomDetail({
        id: row.id
    })
    setFormData(data)
}


// 提交按钮
const handleSubmit = async () => {
    popupRef.value?.close()

}

//打开弹窗
const open = () => {
    console.log('1111111')
    popupRef.value?.open()
}

// 关闭回调
const handleClose = () => {
    emit('close')
}








defineExpose({
    open,
    setFormData,
    getDetail
})
</script>
<style lang="scss">
.tit {
    font-size: 1.2em;
    margin-bottom: 10px;
}
</style>
