|
@@ -174,6 +174,94 @@
|
|
|
>
|
|
|
<ContractDetails :contractId="currentContractId"></ContractDetails>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ :title="`售后记录`"
|
|
|
+ v-if="openRecords"
|
|
|
+ v-model="openRecords"
|
|
|
+ width="600"
|
|
|
+ >
|
|
|
+ <div style="padding-left: 50px; margin-bottom: 20px">
|
|
|
+ <el-button type="primary" plain @click="handleClickAddRecord()"
|
|
|
+ >添加记录</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <el-timeline>
|
|
|
+ <el-timeline-item v-for="(activity, index) in recordsData" :key="index">
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ color: #bfb9b9;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <div>售后时间:{{ activity.documentaryTime }}</div>
|
|
|
+ <div>{{ activity.userName }}</div>
|
|
|
+ </div>
|
|
|
+ <div style="width: 100%; margin-top: 8px">
|
|
|
+ 售后记录:{{ activity.documentaryRemark }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="width: 100%; margin-top: 8px"
|
|
|
+ v-if="activity.fileList && activity.fileList.length > 0"
|
|
|
+ >
|
|
|
+ <div v-for="(item, index) in activity.fileList" :key="index">
|
|
|
+ <div
|
|
|
+ style="cursor: pointer; color: #409eff"
|
|
|
+ @click="openFile(item)"
|
|
|
+ >
|
|
|
+ {{ item.fileName }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-timeline-item>
|
|
|
+ </el-timeline>
|
|
|
+
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openRecords = false" size="large">关 闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ :title="`添加售后记录`"
|
|
|
+ v-if="openAddRecords"
|
|
|
+ v-model="openAddRecords"
|
|
|
+ width="600"
|
|
|
+ >
|
|
|
+ <byForm
|
|
|
+ :formConfig="recordsFormConfig"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.recordsFormData"
|
|
|
+ :rules="recordsRules"
|
|
|
+ ref="recordsForm"
|
|
|
+ v-loading="formLoading"
|
|
|
+ >
|
|
|
+ <template #file>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-upload
|
|
|
+ v-model:fileList="formData.recordsFormData.fileList"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadData"
|
|
|
+ multiple
|
|
|
+ :before-upload="uploadFile"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ :on-preview="onPreviewFile"
|
|
|
+ >
|
|
|
+ <el-button type="primary" plain>选择</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openAddRecords = false" size="large"
|
|
|
+ >关 闭</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="submitRecords()" size="large"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -457,6 +545,18 @@ const config = computed(() => {
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "售后",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ openRecords.value = true;
|
|
|
+ getRecordsData(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
];
|
|
|
},
|
|
|
},
|
|
@@ -838,6 +938,121 @@ const PdfDom = ref(null);
|
|
|
const exportExcel = () => {
|
|
|
PdfDom.value.exportExcel();
|
|
|
};
|
|
|
+
|
|
|
+const formData = reactive({
|
|
|
+ recordsFormData: {},
|
|
|
+});
|
|
|
+const formLoading = ref(false);
|
|
|
+const openRecords = ref(false);
|
|
|
+const openAddRecords = ref(false);
|
|
|
+const recordsLoading = ref(false);
|
|
|
+const recordsData = ref([]);
|
|
|
+const recordsForm = ref(null);
|
|
|
+const rowContractData = ref({});
|
|
|
+const recordsFormConfig = computed(() => [
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ itemType: "datetime",
|
|
|
+ prop: "documentaryTime",
|
|
|
+ label: "售后时间",
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "documentaryRemark",
|
|
|
+ label: "售后记录",
|
|
|
+ itemType: "textarea",
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "file",
|
|
|
+ label: "上传附件",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const recordsRules = ref({
|
|
|
+ documentaryTime: [
|
|
|
+ { required: true, message: "请选择售后时间", trigger: "change" },
|
|
|
+ ],
|
|
|
+ documentaryRemark: [
|
|
|
+ { required: true, message: "请输入售后记录", trigger: "blur" },
|
|
|
+ ],
|
|
|
+});
|
|
|
+const getRecordsData = (row) => {
|
|
|
+ if (row && row.id) {
|
|
|
+ rowContractData.value = row;
|
|
|
+ }
|
|
|
+ proxy
|
|
|
+ .post("/contractDocumentary/page", {
|
|
|
+ businessId: rowContractData.value.id,
|
|
|
+ documentaryType: "-2",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ recordsData.value = res.rows;
|
|
|
+ const idList = recordsData.value.map((x) => x.id);
|
|
|
+ // 请求文件数据并回显
|
|
|
+ if (idList.length > 0) {
|
|
|
+ proxy
|
|
|
+ .post("/fileInfo/getList", {
|
|
|
+ businessIdList: idList,
|
|
|
+ })
|
|
|
+ .then((fileObj) => {
|
|
|
+ if (fileObj) {
|
|
|
+ for (let i = 0; i < recordsData.value.length; i++) {
|
|
|
+ const e = recordsData.value[i];
|
|
|
+ for (const key in fileObj) {
|
|
|
+ if (e.id === key) {
|
|
|
+ e.fileList = fileObj[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+const handleClickAddRecord = () => {
|
|
|
+ formData.recordsFormData = {
|
|
|
+ businessId: rowContractData.value.id,
|
|
|
+ businessType: "0",
|
|
|
+ documentaryType: "-2",
|
|
|
+ documentaryTime: proxy.parseTime(new Date()),
|
|
|
+ documentaryRemark: "",
|
|
|
+ fileList: [],
|
|
|
+ };
|
|
|
+ openAddRecords.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+const submitRecords = () => {
|
|
|
+ recordsForm.value.handleSubmit(() => {
|
|
|
+ formLoading.value = true;
|
|
|
+ formData.recordsFormData.fileList = formData.recordsFormData.fileList.map(
|
|
|
+ (item) => {
|
|
|
+ return {
|
|
|
+ id: item.raw.id,
|
|
|
+ fileName: item.raw.fileName,
|
|
|
+ fileUrl: item.raw.fileUrl,
|
|
|
+ uploadState: item.raw.uploadState,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ );
|
|
|
+ proxy
|
|
|
+ .post("/contractDocumentary/add", formData.recordsFormData)
|
|
|
+ .then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ formLoading.value = false;
|
|
|
+ openAddRecords.value = false;
|
|
|
+ getRecordsData();
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+const openFile = (item) => {
|
|
|
+ window.open(item.fileUrl, "_blank");
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|