فهرست منبع

销售端新增已完善采集信息菜单

cgp 2 هفته پیش
والد
کامیت
fb876483a3

+ 11 - 0
src/api/qw/collectionPendingSales.js

@@ -11,6 +11,17 @@ export function pendingSalesInfoList(queryDto) {
   })
 }
 
+/*
+*查询销售已完善信息采集列表
+* */
+export function fullyCollectionInfoList(queryDto) {
+  return request({
+    url: '/hisStore/collection/fullyCollectionInfoList',
+    method: 'post',
+    data: queryDto
+  })
+}
+
 // 查询用户信息采集详细
 export function getInfo(query) {
   return request({

+ 254 - 0
src/views/qw/collectionFully/fullyCollectionInfoDialog.vue

@@ -0,0 +1,254 @@
+<template>
+  <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="800px" @close="handleClose" append-to-body>
+    <el-form validate-on-rule-change :rules="rules" ref="form" :model="form" label-width="140px">
+      <!-- 动态渲染问题区域 -->
+      <div v-if="form.answers && form.answers.length > 0">
+        <div style="margin-bottom: 20px;margin-top: 20px;" v-for="(answer, index) in form.answers" :key="index">
+          <div style="margin-bottom: 20px;margin-top: 20px;">
+            <span style="font-size: 15px;font-weight: bold; margin-left: 31px">{{ answer.title }}</span>
+          </div>
+          <div style="margin-left: 31px;">
+            <!-- 修改:移除 @change 事件,添加 disabled 属性 -->
+            <el-checkbox-group
+              v-model="answer.value"
+              size="mini"
+              disabled>
+              <div v-for="(option, optionIndex) in answer.options" :key="`${index}-${optionIndex}`" style="display: flex; align-items: center; margin-bottom: 10px;">
+                <!-- 修改:添加 disabled 属性 -->
+                <el-checkbox :label="option.value" style="margin-right: 10px; flex-shrink: 0;" disabled>
+                  {{ option.name }}
+                </el-checkbox>
+
+                <!-- 备注输入区域(只读模式) -->
+                <div v-if="option.open && isOptionSelected(answer, option)" style="display: inline-block;">
+                  <!-- 修改:添加 readonly 属性,并移除 @blur 事件 -->
+                  <el-input
+                    v-model="option.remarkText"
+                    placeholder="请输入备注信息"
+                    size="mini"
+                    maxlength="20"
+                    show-word-limit
+                    style="width: 200px; margin-left: 5px;"
+                    readonly
+                    :class="{ 'remark-required': !option.remarkText || option.remarkText.trim() === '' }"/>
+                  <!-- 修改:只显示必填标识,但不显示错误提示文字 -->
+                  <div v-if="!option.remarkText || option.remarkText.trim() === ''" class="remark-error-tip">此项为必填</div>
+                </div>
+              </div>
+            </el-checkbox-group>
+          </div>
+        </div>
+      </div>
+
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="dialogVisible = false">关 闭</el-button>
+      <!-- 修改:移除确定按钮,因为不允许编辑 -->
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { getInfo, submitSalesInfo } from "@/api/qw/collectionPendingSales";
+
+export default {
+  name: "FullyCollectionInfoDialog",
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
+    },
+    id: {
+      type: Number,
+      required: true
+    },
+    userId: {
+      type: Number,
+      required: true
+    },
+    questionId: {
+      type: Number,
+      required: true
+    }
+  },
+  data() {
+    return {
+      dialogVisible: false,
+      form: {
+        id: null,
+        questionId: null,
+        packageId: null,
+        payType: null,
+        amount: null,
+        isPackage: null,
+        answers: [],
+        userName: '',
+        userPhoneFour: '',
+        sex: null,
+        age: null,
+        allergy: '',
+        remark: ''
+      },
+      privatePackageOptions: [],
+      loading: false,
+      rules: {}
+    };
+  },
+  computed: {
+    dialogTitle() {
+      return "查看采集信息";
+    }
+  },
+  watch: {
+    visible: {
+      handler(val) {
+        this.dialogVisible = val;
+        if (val) {
+          this.initDialog();
+        }
+      },
+      immediate: true
+    }
+  },
+  created() {
+  },
+  methods: {
+    // 验证需要备注的选项是否填写了备注 - 不需要了,因为只读模式
+    validateRequiredRemarks() {
+      // 只读模式下不需要验证
+      return true;
+    },
+
+    // 监听复选框组的变化 - 不需要了
+    onCheckboxGroupChange(answer) {
+      // 只读模式下不需要处理变化
+    },
+
+    // 检查选项是否被选中
+    isOptionSelected(answer, option) {
+      return answer.value && answer.value.includes(option.value);
+    },
+
+    // 备注输入框失去焦点时的处理 - 不需要了
+    onRemarkBlur(option) {
+      // 只读模式下不需要处理
+    },
+
+    initDialog() {
+      this.resetFormData();
+      if (this.userId) {
+        this.loadUserData();
+      }
+      this.$nextTick(() => {
+        if (this.$refs.form) {
+          this.$refs.form.clearValidate();
+        }
+      });
+    },
+
+    loadUserData() {
+      this.loading = true;
+      getInfo({userId: this.userId, questionId: this.questionId}).then(response => {
+        const data = response.data;
+        this.form = {
+          id: data.id,
+          questionId: data.questionId,
+          packageId: data.packageId,
+          payType: data.payType,
+          amount: data.amount,
+          isPackage: data.isPackage,
+          answers: this.processAnswers(data.answers),
+          userName: data.userName,
+          userPhoneFour: data.userPhoneFour,
+          sex: data.sex,
+          age: data.age,
+          allergy: data.allergy,
+          remark: data.remark
+        };
+      }).catch(error => {
+        this.$message.error('加载用户信息失败');
+        console.error('加载用户信息失败:', error);
+      }).finally(() => {
+        this.loading = false;
+      });
+    },
+
+    // 处理答案数据,确保选项有备注相关的字段
+    processAnswers(answers) {
+      if (!answers || !Array.isArray(answers)) {
+        return [];
+      }
+
+      return answers.map(answer => {
+        // 建立 value -> text 的映射,用于快速回填备注
+        const remarksMap = {};
+        if (answer.remarksList && Array.isArray(answer.remarksList)) {
+          answer.remarksList.forEach(item => {
+            remarksMap[item.value] = item.text;
+          });
+        }
+
+        const processedOptions = (answer.options || []).map(option => ({
+          ...option,
+          remarkText: remarksMap[option.value] || ''  // 有备注则填充,否则为空
+        }));
+
+        return {
+          ...answer,
+          value: answer.value || [], // 确保 value 存在
+          options: processedOptions
+        };
+      });
+    },
+
+    resetFormData() {
+      this.form = {
+        id: null,
+        questionId: null,
+        packageId: null,
+        payType: null,
+        amount: null,
+        isPackage: null,
+        answers: [],
+        userName: '',
+        userPhoneFour: '',
+        sex: null,
+        age: null,
+        allergy: '',
+        remark: ''
+      };
+    },
+
+    // 提交表单 - 不需要了,因为只读模式
+    submitForm() {
+      // 只读模式下不需要提交功能
+    },
+
+    handleClose() {
+      this.dialogVisible = false;
+      this.$emit('update:visible', false);
+      this.resetFormData();
+    }
+  }
+};
+</script>
+
+<style scoped>
+/* 修改样式,使只读状态更明显 */
+.remark-required >>> .el-input__inner {
+  border-color: #e4e7ed !important; /* 默认边框颜色 */
+  background-color: #f5f7fa; /* 浅灰色背景 */
+}
+
+.remark-error-tip {
+  color: #909399; /* 灰色字体,表示只读状态 */
+  font-size: 12px;
+  line-height: 1.5;
+  margin-left: 5px;
+}
+
+/* 为只读复选框添加样式 */
+.el-checkbox__input.is-disabled + .el-checkbox__label {
+  color: #c0c4cc !important; /* 灰色文字 */
+}
+</style>

+ 158 - 0
src/views/qw/collectionFully/index.vue

@@ -0,0 +1,158 @@
+<template>
+  <div class="app-container">
+    <!-- 查询表单 -->
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
+      <el-form-item label="用户姓名" prop="userName">
+        <el-input
+          v-model="queryParams.userName"
+          placeholder="请输入用户姓名"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="医生姓名" prop="doctorName">
+        <el-input
+          v-model="queryParams.doctorName"
+          placeholder="请输入医生姓名"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <!-- 数据表格 -->
+    <el-table border v-loading="loading" :data="collectionList">
+      <el-table-column label="用户姓名" align="center" prop="userName" />
+      <el-table-column label="用户性别" align="center" prop="sex">
+        <template slot-scope="scope">
+          <span>{{ sexFormat(scope.row.sex) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="用户年龄" align="center" prop="age" />
+      <el-table-column label="电话尾号" align="center" prop="userPhoneFour" />
+      <el-table-column label="是否过敏" align="center" prop="allergy" />
+      <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
+      <el-table-column label="医生姓名" align="center" prop="doctorName" />
+      <el-table-column label="销售人员" align="center" prop="companyUserName" />
+      <el-table-column label="创建时间" align="center" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleComplete(scope.row)"
+          >
+            查看采集信息
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页组件 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 完善采集信息弹窗 -->
+    <fully-collection-info-dialog
+      v-if="selectedUserId != null && selectedQuestionId != null && selectedId !=null"
+      :visible.sync="completeDialogVisible"
+      :id="selectedId"
+      :user-id="selectedUserId"
+      :question-id="selectedQuestionId"
+      @success="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { fullyCollectionInfoList } from "@/api/qw/collectionPendingSales";
+import FullyCollectionInfoDialog from "./fullyCollectionInfoDialog.vue";
+
+export default {
+  name: "FullySalesInfo",
+  components: {
+    FullyCollectionInfoDialog
+  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 表格数据
+      collectionList: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        userName: null,
+        doctorName: null,
+      },
+      // 完善信息弹窗可见性
+      completeDialogVisible: false,
+      //数据行主键
+      selectedId: null,
+      // 选中的用户ID
+      selectedUserId: null,
+      // 选中的questionId
+      selectedQuestionId: null
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询待销售完善信息采集列表 */
+    getList() {
+      this.loading = true;
+      fullyCollectionInfoList(this.queryParams).then(response => {
+        this.collectionList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    /** 性别格式化 */
+    sexFormat(sex) {
+      return sex === 1 ? "男" : sex === 0 ? "女" : "";
+    },
+    /** 完善采集信息按钮操作 */
+    handleComplete(row) {
+      this.selectedId = row.id;
+      this.selectedUserId = row.userId;
+      this.selectedQuestionId = row.questionId;
+      this.completeDialogVisible = true;
+    }
+  }
+};
+</script>
+
+<style scoped>
+</style>