فهرست منبع

add:信息收集

ct 5 روز پیش
والد
کامیت
6a8bf56bcc

+ 76 - 0
src/api/store/collectionSchedule.js

@@ -0,0 +1,76 @@
+import request from '@/utils/request'
+
+// 查询用户信息采集进度列表
+export function listCollectionSchedule(query) {
+  return request({
+    url: '/store/collectionSchedule/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询用户信息采集进度详细
+export function getCollectionSchedule(id) {
+  return request({
+    url: '/store/collectionSchedule/' + id,
+    method: 'get'
+  })
+}
+
+// 新增用户信息采集进度
+export function addCollectionSchedule(data) {
+  return request({
+    url: '/store/collectionSchedule',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改用户信息采集进度
+export function updateCollectionSchedule(data) {
+  return request({
+    url: '/store/collectionSchedule',
+    method: 'put',
+    data: data
+  })
+}
+// 终止用户信息采集进度(暂时弃用)
+export function endProcess(data) {
+  return request({
+    url: '/store/collectionSchedule/endProcess',
+    method: 'put',
+    data: data
+  })
+}  // 终止用户信息采集进度
+export function stop(data) {
+  return request({
+    url: '/hisStore/collection/stop',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除用户信息采集进度
+export function delCollectionSchedule(id) {
+  return request({
+    url: '/store/collectionSchedule/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出用户信息采集进度
+export function exportCollectionSchedule(query) {
+  return request({
+    url: '/store/collectionSchedule/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 获取流程步骤枚举
+export function getCollectionScheduleSteps() {
+  return request({
+    url: '/store/collectionSchedule/steps',
+    method: 'get'
+  });
+}

+ 243 - 0
src/views/store/collectionSchedule/collection.vue

@@ -0,0 +1,243 @@
+<template>
+    <div class="app-container">
+        <el-form validate-on-rule-change :rules="rules" ref="form" :model="form" label-width="140px">
+            <!-- <el-button v-if="form.id" size="mini" type="text" @click="handleShare" icon="el-icon-coin"
+                v-hasPermi="['hisStore:collection:WxaCodeCollectionUnLimit']">分享
+            </el-button> -->
+            <el-form-item label="信息模板" prop="questionId">
+                <el-select @change="selectQuestion" v-model="form.questionId" placeholder="请选择问答">
+                    <el-option v-for="dict in questionOptions" :key="dict.dictValue" :label="dict.dictLabel"
+                        :value="parseInt(dict.dictValue)" />
+                </el-select>
+            </el-form-item>
+            <div style="margin-bottom: 20px;margin-top: 20px;" v-for="(answer, index) in form.answers">
+                <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;">
+                    <el-checkbox-group v-model="form.answers[index].value" size="mini">
+                        <el-checkbox v-for="dict in answer.options" :label="dict.value">{{ dict.name }}</el-checkbox>
+                    </el-checkbox-group>
+                    <!-- <el-radio-group :disabled="form.answers[index].flag" v-model="form.answers[index].value">
+                        <el-radio v-for="dict in answer.options" :label="dict.value">{{ dict.name }}</el-radio>
+                    </el-radio-group> -->
+                </div>
+
+            </div>
+            <el-form-item label="用户姓名" prop="userName">
+                <el-input v-model="form.userName" placeholder="请输入用户姓名"></el-input>
+            </el-form-item>
+            <el-form-item label="用户手机号后四位" prop="userPhoneFour">
+                <el-input v-model="form.userPhoneFour" placeholder="请输入手机号后四位"></el-input>
+            </el-form-item>
+            <el-form-item label="用户性别" prop="sex">
+                <el-select v-model="form.sex" placeholder="请选择用户性别">
+                    <el-option label="男" :value="1" />
+                    <el-option label="女" :value="0" />
+                </el-select>
+            </el-form-item>
+            
+            <el-form-item label="过敏情况" prop="allergy">
+                <el-input type="textarea" :rows="2" placeholder="请输入过敏情况" v-model="form.allergy">
+                </el-input>
+            </el-form-item>
+            <el-form-item label="备注" prop="remark">
+                <el-input type="textarea" :rows="2" placeholder="请输入备注" v-model="form.remark">
+                </el-input>
+            </el-form-item>
+            <el-form-item v-if="form.questionId" label="是否关联产品疗法" prop="isPackage">
+                <el-radio-group v-model="form.isPackage">
+                    <el-radio :label="0">否</el-radio>
+                    <el-radio :label="1">是</el-radio>
+                </el-radio-group>
+            </el-form-item>
+            <el-form-item v-if="form.isPackage == 1" label="产品疗法" prop="packageId">
+                <el-select filterable v-model="form.packageId" placeholder="请选择产品疗法">
+                    <el-option v-for="dict in privatePackageOptions" :key="dict.dictValue" :label="dict.dictLabel"
+                        :value="parseInt(dict.dictValue)" />
+                </el-select>
+            </el-form-item>
+            <el-form-item v-if="form.packageId && form.isPackage && form.isPackage == 1" label="支付类型" prop="payType">
+                <el-radio-group v-model="form.payType">
+                    <el-radio :label="1">全款</el-radio>
+                    <el-radio :label="2">物流代收</el-radio>
+                </el-radio-group>
+            </el-form-item>
+            <el-form-item v-if="form.packageId && form.payType == 2 && form.isPackage && form.isPackage == 1"
+                label="预付金额" prop="amount">
+                <el-input v-model="form.amount" placeholder="请输入物流代收金额" type="number" />
+            </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+            <el-button type="primary" @click="submitForm">确 定</el-button>
+            <!-- <el-button @click="cancel">取 消</el-button> -->
+        </div>
+
+
+        <el-dialog :title="collectionForm.title" v-if="collectionForm.open" :visible.sync="collectionForm.open"
+            width="450px" append-to-body>
+            <div style="padding-bottom:15px;">
+                <img :src="codeImage" width="400px">
+            </div>
+            <div slot="footer" class="dialog-footer">
+                <el-button @click="downloadImage(codeImage, collectionForm.name + '.png')">下载二维码</el-button>
+            </div>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { questionOptions, getAnswer } from "@/api/hisStore/answer";
+import { allPrivatePackage } from "@/api/store/package";
+import { getInfo, addCollection, updateCollection, getWxaCodeCollectionUnLimit } from "@/api/hisStore/collection";
+export default {
+    name: "collection",
+    components: {},
+    data() {
+        return {
+            form: {
+                answers: []
+            },
+            userId: null,
+            questionOptions: [],
+            privatePackageOptions: [],
+            collectionForm: {
+                open: false,
+                title: "用户信息采集分享",
+                name: null,
+            },
+            codeImage: null,
+
+            rules: {
+                questionId: [
+                    { required: true, message: '请选择信息模板', trigger: 'change' }
+                ],
+                packageId: [
+                    { required: true, message: '请选择套餐包', trigger: 'change' }
+                ],
+                isPackage: [
+                    { required: true, message: '请选择是否关联套餐包', trigger: 'change' }
+                ],
+                payType: [
+                    { required: true, message: '请选择支付类型', trigger: 'change' }
+                ],
+                amount: [
+                    { required: true, message: '请填写物流代收金额', trigger: 'blur' }
+                ]
+            }
+        };
+    },
+    created() {
+        this.getQuestionOptions();
+        this.getAllPrivatePackge();
+    },
+    methods: {
+        downloadImage(imageSrc, fileName) {
+            const link = document.createElement('a');
+            link.href = imageSrc;
+            link.download = fileName || '付款二维码.png';
+            document.body.appendChild(link);
+            link.click();
+            document.body.removeChild(link);
+        },
+        handleShare(id) {
+            let loadingRock = this.$loading({
+                lock: true,
+                text: '生成二维码中~~请不要刷新页面!!',
+                spinner: 'el-icon-loading',
+                background: 'rgba(0, 0, 0, 0.7)'
+            });
+
+            getWxaCodeCollectionUnLimit(id).then(response => {
+                this.codeImage = response.url
+                this.collectionForm.open = true;
+                this.collectionForm.name = id;
+                loadingRock.close();
+            }).finally(res => {
+                loadingRock.close();
+            })
+        },
+        //获取问答模板
+        getQuestionOptions() {
+            console.log("this.userId", this.userId)
+            questionOptions().then(response => {
+                this.questionOptions = response.rows;
+            })
+        },
+        getAllPrivatePackge() {
+            allPrivatePackage().then(res => {
+                this.privatePackageOptions = res.rows;
+            })
+        },
+        getCollectionInfo(userId) {
+            const queryParams = {
+                userId: userId,
+            }
+            this.userId = userId;
+            getInfo(queryParams).then(res => {
+                if (res.data.id) {
+                    this.form = res.data;
+                } else {
+                    this.form = {
+                        answers: []
+                    }
+                }
+            })
+        },
+        //选择问答模板
+        selectQuestion(val) {
+            console.log(val)
+            this.form = {
+                answers: []
+            };
+            const queryParams = {
+                userId: this.userId,
+                questionId: val
+            }
+            getInfo(queryParams).then(res => {
+                this.form = res.data;
+            })
+            // getAnswer(val).then(response =>{
+
+            //     this.form.answers = response.data.answers;
+            //     console.log(this.form)
+            // })
+        },
+
+        submitForm() {
+            console.log(this.form)
+            this.form.userId = this.userId;
+            this.$refs["form"].validate(valid => {
+                if (valid) {
+                    if (this.form.id != null) {
+                        updateCollection(this.form).then(res => {
+                            this.msgSuccess("修改成功");
+                            this.open = false;
+                            this.$parent.$parent.closeCollection();
+                            this.$refs['form'].resetFields();
+                            this.handleShare(res.data);
+                        })
+
+                    } else {
+                        addCollection(this.form).then(res => {
+                            this.msgSuccess("添加成功");
+                            this.open = false;
+                            this.$parent.$parent.closeCollection();
+                            this.$refs['form'].resetFields();
+                            this.handleShare(res.data);
+                        })
+                    }
+                    // this.resetForm("form");
+                }
+            });
+
+        },
+        cancel() {
+
+        },
+    },
+};
+
+
+
+</script>

+ 357 - 0
src/views/store/collectionSchedule/index.vue

@@ -0,0 +1,357 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <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 label="商品名称" prop="packageName">
+        <el-input
+          v-model="queryParams.packageName"
+          placeholder="请输入挂载商品名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="订单号" prop="orderCode">
+        <el-input
+          v-model="queryParams.orderCode"
+          placeholder="请输入订单号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="当前状态" prop="currentStep">
+        <el-select v-model="queryParams.currentStep" placeholder="当前状态" clearable size="small">
+          <el-option
+            v-for="dict in currentStepOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="完成时间" prop="completedTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.completedTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择完成时间">
+        </el-date-picker>
+      </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="collectionScheduleList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="客户姓名" align="center" prop="userName" />
+      <el-table-column label="约诊医生" align="center" prop="doctorName" />
+      <el-table-column label="订单号" align="center" prop="orderCode" />
+      <el-table-column label="挂载商品" align="center" prop="packageName" />
+      <el-table-column label="当前状态" align="center" prop="currentStep">
+        <template slot-scope="scope">
+          <el-tag
+            v-if="scope.row.currentStep != null"
+            :type="stepColorMap[scope.row.currentStep] || 'info'"
+            size="small"
+          >
+            {{ getStepLabel(scope.row.currentStep) }}
+          </el-tag>
+          <span v-else>—</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="完成时间" align="center" prop="completedTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.completedTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="中止时间" align="center" prop="terminatedTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.terminatedTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="备注" align="center" prop="remark" />
+      <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-delete"
+            @click="endProcess(scope.row)"
+            v-hasPermi="['his:collectionSchedule:stop']"
+            :disabled="scope.row.status !== 1"
+            :style="{ color: scope.row.status === 1 ? '#f56c6c' : '#999' }"
+          >终止</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"
+    />
+
+    <!-- 终止原因弹窗 -->
+    <el-dialog title="终止进度" :visible.sync="endProcessVisible" width="400px" @close="resetEndForm">
+      <el-form :model="endForm" ref="endFormRef" label-width="80px">
+        <el-form-item label="终止原因" prop="remark" :rules="[{ required: true, message: '请输入终止原因', trigger: 'blur' }]">
+          <el-input
+            v-model="endForm.remark"
+            type="textarea"
+            :rows="4"
+            placeholder="请输入终止原因"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="endProcessVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitEndProcess">确 定</el-button>
+      </div>
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+import { listCollectionSchedule, addCollectionSchedule, updateCollectionSchedule, exportCollectionSchedule,getCollectionScheduleSteps,stop } from "@/api/store/collectionSchedule";
+
+export default {
+  name: "CollectionSchedule",
+  data() {
+    // 定义状态颜色映射(若依常用色系)
+    const stepColorMap = {
+      1: 'primary',   // 待用户第一次确认 —— 蓝色
+      2: 'warning',   // 待开方 —— 橙色
+      3: 'danger',    // 待药师审核 —— 红色
+      4: 'success',   // 待建议 —— 绿色
+      5: 'info',      // 待用户二次确认 —— 灰蓝
+      6: 'success'    // 完成 —— 蓝色
+    };
+    return {
+      // === 新增:终止弹窗相关 ===
+      endProcessVisible: false,
+      endForm: {
+        id: null,
+        collectionId: null,
+        remark: ''
+      },
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 用户信息采集进度表格数据
+      collectionScheduleList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 当前流程节点字典:(1:待用户第一次确认、2:待开方、3:待药师审核、4:待建议、5:待用户二次确认、6:完成);其中带疗法模式有1,2,3,5,6;无疗法模式只有1,4,5,6
+      currentStepOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        collectionId: null,
+        userId: null,
+        userName: null,
+        doctorId: null,
+        doctorName: null,
+        orderCode: null,
+        packageId: null,
+        packageName: null,
+        currentStep: null,
+        status: null,
+        completedTime: null,
+        terminatedTime: null,
+        terminatedBy: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      },
+      stepColorMap, // 暴露给模板使用
+    };
+  },
+  created() {
+    this.getList();
+    getCollectionScheduleSteps().then(response => {
+      this.currentStepOptions = response.data;
+    });
+  },
+  methods: {
+    /** 查询用户信息采集进度列表 */
+    getList() {
+      this.loading = true;
+      listCollectionSchedule(this.queryParams).then(response => {
+        this.collectionScheduleList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        collectionId: null,
+        userId: null,
+        userName: null,
+        doctorId: null,
+        doctorName: null,
+        orderCode: null,
+        packageId: null,
+        packageName: null,
+        currentStep: null,
+        status: 0,
+        createTime: null,
+        completedTime: null,
+        terminatedTime: null,
+        terminatedBy: null,
+        remark: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+
+    /** 终止按钮操作 - 打开弹窗 */
+    endProcess(row) {
+      this.endForm.id = row.id;
+      this.endForm.collectionId = row.collectionId;
+      this.endForm.remark = '';
+      this.endProcessVisible = true;
+    },
+    /** 提交终止操作 */
+    /** 提交终止操作 */
+    submitEndProcess() {
+      this.$refs["endFormRef"].validate(valid => {
+        if (valid) {
+          const { id, collectionId, remark } = this.endForm
+          this.$confirm('确认终止该采集进度?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }).then(() => {
+            stop({ id, collectionId, remark }).then(response => {
+              this.msgSuccess("终止成功");
+              this.endProcessVisible = false;
+              this.getList();
+            }).catch(() => {
+              // 可选:错误提示
+            });
+          }).catch(() => {
+            // 取消
+          });
+        }
+      });
+    },
+    /** 重置终止表单 */
+    resetEndForm() {
+      this.$refs["endFormRef"] && this.$refs["endFormRef"].resetFields();
+      this.endForm.id = null;
+      this.endForm.collectionId = null;
+      this.endForm.remark = '';
+    },
+
+
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加用户信息采集进度";
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateCollectionSchedule(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addCollectionSchedule(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有用户信息采集进度数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportCollectionSchedule(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    },
+    getStepLabel(currentStep) {
+      if (currentStep == null) return '—';
+      const option = this.currentStepOptions.find(opt => opt.dictValue === currentStep);
+      return option ? option.dictLabel : '未知状态';
+    }
+  }
+};
+</script>