Procházet zdrojové kódy

改版信息采集表

cgp před 2 týdny
rodič
revize
84655f7888

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

@@ -41,3 +41,21 @@ export function submitSalesInfo(addDto) {
     data: addDto
   })
 }
+
+// 销售绑定个微信息采集套餐包
+export function bindCollectionPackage(data) {
+  return request({
+    url: '/hisStore/collection/bindCollectionPackage',
+    method: 'post',
+    data: data
+  })
+}
+
+// 根据用户ID获取最新审核通过的处方信息
+export function getLastAuditPassPrescribeInfo(userId) {
+  return request({
+    url: '/hisStore/collection/getLastAuditPassPrescribeInfo',
+    method: 'get',
+    params: { userId }
+  })
+}

+ 192 - 0
src/views/qw/collectionFully/BindPackageDialog.vue

@@ -0,0 +1,192 @@
+<template>
+  <el-dialog
+    title="绑定套餐"
+    :visible.sync="dialogVisible"
+    width="500px"
+    append-to-body
+    @close="handleClose"
+  >
+    <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+      <el-form-item label="小程序" prop="appId">
+        <el-select v-model="form.appId" placeholder="请选择小程序" clearable>
+          <el-option
+            v-for="item in sourceList"
+            :key="item.dictValue1"
+            :label="item.dictLabel"
+            :value="item.dictValue1"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="套餐包" prop="packageId">
+        <el-select v-model="form.packageId" placeholder="请选择套餐包" clearable filterable>
+          <el-option
+            v-for="item in packageOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="parseInt(item.dictValue)"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item 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.payType === 2"
+        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 @click="dialogVisible = false">取 消</el-button>
+      <el-button type="primary" :loading="submitLoading" @click="submitForm">确 定</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { allPrivatePackage } from "@/api/store/package";
+import { options } from "@/api/course/coursePlaySourceConfig";
+import { bindCollectionPackage } from "@/api/qw/collectionPendingSales";
+
+export default {
+  name: "BindPackageDialog",
+  props: {
+    visible: {
+      type: Boolean,
+      default: false,
+    },
+    // 采集信息记录ID
+    collectionId: {
+      type: Number,
+      default: null,
+    },
+  },
+  data() {
+    return {
+      dialogVisible: false,
+      submitLoading: false,
+      sourceList: [],
+      packageOptions: [],
+      form: {
+        id: null,          // 采集信息主键
+        appId: null,
+        packageId: null,
+        payType: 1,        // 默认全款
+        amount: null,
+      },
+      rules: {
+        appId: [
+          { required: true, message: "请选择小程序", trigger: "change" },
+        ],
+        packageId: [
+          { required: true, message: "请选择套餐包", trigger: "change" },
+        ],
+        payType: [
+          { required: true, message: "请选择支付类型", trigger: "change" },
+        ],
+        amount: [
+          { required: true, message: "请填写物流代收金额", trigger: "blur" },
+        ],
+      },
+    };
+  },
+  watch: {
+    visible: {
+      handler(val) {
+        this.dialogVisible = val;
+        if (val) {
+          this.initData();
+        }
+      },
+      immediate: true,
+    },
+    "form.payType"(val) {
+      // 切换支付类型时,重置金额字段
+      if (val !== 2) {
+        this.form.amount = null;
+        this.$refs.form?.clearValidate("amount");
+      }
+    },
+  },
+  created() {
+    this.fetchSourceList();
+    this.fetchPackageList();
+  },
+  methods: {
+    fetchSourceList() {
+      options().then((res) => {
+        this.sourceList = res.data || [];
+      });
+    },
+    fetchPackageList() {
+      allPrivatePackage().then((res) => {
+        this.packageOptions = res.rows || [];
+      });
+    },
+    initData() {
+      this.form.id = this.collectionId;
+      this.form.appId = null;
+      this.form.packageId = null;
+      this.form.payType = 1;
+      this.form.amount = null;
+      this.$nextTick(() => {
+        if (this.$refs.form) {
+          this.$refs.form.clearValidate();
+        }
+      });
+    },
+    submitForm() {
+      this.$refs.form.validate((valid) => {
+        if (!valid) return;
+
+        // 构建提交参数,与后端 bindCollectionPackageParam 对应
+        const params = {
+          id: this.form.id,
+          packageId: this.form.packageId,
+          // 以下字段根据实际接口是否需要传递决定,若不需要可省略
+          // appId: this.form.appId,
+          // payType: this.form.payType,
+          // amount: this.form.amount,
+        };
+
+        this.submitLoading = true;
+        bindCollectionPackage(params)
+          .then((res) => {
+            this.$message.success("绑定套餐成功");
+            this.dialogVisible = false;
+            this.$emit("success", res.data);
+            this.$emit("update:visible", false);
+          })
+          .catch((error) => {
+            this.$message.error(error.msg || "绑定失败");
+          })
+          .finally(() => {
+            this.submitLoading = false;
+          });
+      });
+    },
+    handleClose() {
+      this.dialogVisible = false;
+      this.$emit("update:visible", false);
+      this.$refs.form?.resetFields();
+    },
+  },
+};
+</script>
+
+<style scoped>
+/* 可根据需要添加样式 */
+</style>

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

@@ -113,27 +113,11 @@ export default {
   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) {

+ 132 - 22
src/views/qw/collectionFully/index.vue

@@ -1,6 +1,6 @@
 <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
@@ -20,6 +20,17 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="客户类型" prop="qwTag">
+        <el-select
+          v-model="queryParams.qwTag"
+          placeholder="请选择客户类型"
+          clearable
+          size="small"
+        >
+          <el-option label="企微" :value="0" />
+          <el-option label="个微" :value="1" />
+        </el-select>
+      </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>
@@ -40,6 +51,13 @@
       <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" prop="qwTag">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.qwTag === 1 ? 'success' : ''">
+            {{ scope.row.qwTag === 1 ? '个微' : '企微' }}
+          </el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="创建时间" align="center" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@@ -50,10 +68,28 @@
           <el-button
             size="mini"
             type="text"
-            icon="el-icon-edit"
+            icon="el-icon-view"
             @click="handleComplete(scope.row)"
           >
-            查看采集信息
+            查看
+          </el-button>
+          <el-button
+            v-if="scope.row.qwTag === 1 && scope.row.personalCollectStatus === 4"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleBindPackage(scope.row)"
+          >
+            绑定套餐
+          </el-button>
+          <el-button
+            v-if="scope.row.qwTag === 1 && scope.row.personalCollectStatus === 5"
+            size="mini"
+            type="text"
+            icon="el-icon-share"
+            @click="handleShare(scope.row)"
+          >
+            分享
           </el-button>
         </template>
       </el-table-column>
@@ -70,57 +106,82 @@
 
     <!-- 完善采集信息弹窗 -->
     <fully-collection-info-dialog
-      v-if="selectedUserId != null && selectedQuestionId != null && selectedId !=null"
+      v-if="selectedUserId != null && selectedQuestionId != null && selectedId != null"
       :visible.sync="completeDialogVisible"
       :id="selectedId"
       :user-id="selectedUserId"
       :question-id="selectedQuestionId"
       @success="getList"
     />
+
+    <!-- 绑定套餐弹窗 -->
+    <bind-package-dialog
+      :visible.sync="bindPackageDialogVisible"
+      :collection-id="currentCollectionId"
+      @success="handleBindPackageSuccess"
+    />
+
+    <!-- 二维码弹窗 -->
+    <el-dialog
+      title="信息采集分享"
+      :visible.sync="qrCodeVisible"
+      width="450px"
+      append-to-body
+    >
+      <div style="padding-bottom:15px;">
+        <img :src="codeImage" style="width: 100%;" />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="downloadImage(codeImage, qrCodeName + '.png')">下载二维码</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { fullyCollectionInfoList } from "@/api/qw/collectionPendingSales";
+import { getWxaCodeCollectionUnLimit } from "@/api/hisStore/collection"; // 二维码API
 import FullyCollectionInfoDialog from "./fullyCollectionInfoDialog.vue";
+import BindPackageDialog from "./BindPackageDialog.vue";
 
 export default {
   name: "FullySalesInfo",
   components: {
-    FullyCollectionInfoDialog
+    FullyCollectionInfoDialog,
+    BindPackageDialog,
   },
   data() {
     return {
-      // 遮罩层
       loading: true,
-      // 显示搜索条件
       showSearch: true,
-      // 总条数
       total: 0,
-      // 表格数据
       collectionList: [],
-      // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
         userName: null,
         doctorName: null,
+        qwTag: undefined,
       },
-      // 完善信息弹窗可见性
       completeDialogVisible: false,
-      //数据行主键
       selectedId: null,
-      // 选中的用户ID
       selectedUserId: null,
-      // 选中的questionId
-      selectedQuestionId: null
+      selectedQuestionId: null,
+
+      // 绑定套餐相关
+      bindPackageDialogVisible: false,
+      currentCollectionId: null,
+
+      // 二维码相关
+      qrCodeVisible: false,
+      codeImage: null,
+      qrCodeName: null,
     };
   },
   created() {
     this.getList();
   },
   methods: {
-    /** 查询待销售完善信息采集列表 */
     getList() {
       this.loading = true;
       fullyCollectionInfoList(this.queryParams).then(response => {
@@ -129,30 +190,79 @@ export default {
         this.loading = false;
       });
     },
-    /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
       this.getList();
     },
-    /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
+      this.queryParams.qwTag = undefined;
       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;
-    }
-  }
+    },
+
+    // 打开绑定套餐弹窗
+    handleBindPackage(row) {
+      this.currentCollectionId = row.id;
+      this.bindPackageDialogVisible = true;
+    },
+
+    // 绑定套餐成功回调
+    handleBindPackageSuccess() {
+      this.getList(); // 刷新列表
+    },
+
+    // 分享(生成二维码)
+    handleShare(row) {
+      // 需要小程序 appId,假设采集记录中存储了 appId 字段,若无则需从其他地方获取
+      const appId = row.appId;
+      if (!appId) {
+        this.$message.warning("该记录缺少小程序信息,无法生成分享码");
+        return;
+      }
+
+      const loading = this.$loading({
+        lock: true,
+        text: "正在生成二维码...",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
+      getWxaCodeCollectionUnLimit(row.id, appId)
+        .then((response) => {
+          this.codeImage = response.url;
+          this.qrCodeVisible = true;
+          this.qrCodeName = row.id;
+        })
+        .catch((error) => {
+          this.$message.error(error.msg || "生成二维码失败");
+        })
+        .finally(() => {
+          loading.close();
+        });
+    },
+
+    // 下载二维码
+    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);
+    },
+  },
 };
 </script>
 
 <style scoped>
+/* 可根据需要添加样式 */
 </style>