Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

yfh 1 dienu atpakaļ
vecāks
revīzija
b93155ca30

+ 28 - 1
src/api/course/userCourseCategory.js

@@ -52,6 +52,15 @@ export function exportUserCourseCategory(query) {
   })
 }
 
+// 导出重粉
+export function exportFans(query) {
+  return request({
+    url: '/course/userCourseCategory/exportFans',
+    method: 'post',
+    data: query
+  })
+}
+
 // 查询分类父列表
 export function getAllCourseCategoryList() {
   return request({
@@ -73,4 +82,22 @@ export function getCateListByPid(pid) {
     url: '/course/userCourseCategory/getCateListByPid/' + pid,
     method: 'get'
   })
-}
+}
+
+
+// 下载模板
+export function importTemplate() {
+  return request({
+    url: '/course/userCourseCategory/importTemplate',
+    method: 'get'
+  })
+}
+
+export function exportFail(data) {
+  return request({
+    url: '/course/userCourseCategory/exportFail',
+    method: 'post',
+    data: data
+  })
+}
+

+ 33 - 0
src/api/his/aiWorkflow.js

@@ -75,3 +75,36 @@ export function exportWorkflow(query) {
     params: query
   })
 }
+
+// 根据workflowId获取绑定的销售列表
+export function getBindCompanyUserByWorkflowId(workflowId) {
+  return request({
+    url: '/his/aiWorkflow/getBindCompanyUserByWorkflowId/' + workflowId,
+    method: 'get'
+  })
+}
+
+// 获取销售列表
+export function listCompanyUser() {
+  return request({
+    url: '/his/aiWorkflow/listCompanyUser',
+    method: 'get'
+  })
+}
+
+// 检查销售是否已被绑定
+export function checkCompanyUserBeUsed(companyUserId) {
+  return request({
+    url: '/his/aiWorkflow/checkCompanyUserBeUsed/' + companyUserId,
+    method: 'get'
+  })
+}
+
+// 更新工作流绑定销售
+export function updateWorkflowBindCompanyUser(data) {
+  return request({
+    url: '/his/aiWorkflow/updateWorkflowBindCompanyUser',
+    method: 'post',
+    data: data
+  })
+}

+ 7 - 0
src/views/company/companyUser/indexAll.vue

@@ -80,6 +80,7 @@
               size="mini"
               :disabled="multiple"
               @click="handerCompanyUserAreaList"
+              v-hasPermi="['company:user:updateCompanyUserAreaList']"
             >批量设置销售所属区域</el-button>
           </el-col>
           <el-col :span="1.5">
@@ -89,6 +90,7 @@
               size="mini"
               :disabled="multiple"
               @click="handleSetRegister"
+              v-hasPermi="['company:user:setRegister']"
             >设置单独注册会员</el-button>
           </el-col>
           <el-col :span="1.5">
@@ -98,6 +100,7 @@
               size="mini"
               :disabled="multiple"
               @click="handleAllowedAllRegister"
+              v-hasPermi="['company:user:allowedAllRegister']"
             >允许注册会员开关</el-button>
           </el-col>
           <el-col :span="1.5">
@@ -106,6 +109,7 @@
               plain
               size="mini"
               @click="handleBindCompanyUserCode"
+              v-hasPermi="['company:user:addCodeUrl']"
             >生成注册/绑定销售二维码</el-button>
           </el-col>
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -207,6 +211,7 @@
                 plain
                 v-if="scope.row.doctorId!=null"
                 @click="handleUpdateDoctor(scope.row)"
+                v-hasPermi="['qw:companyUser:unBindDoctorId']"
               >换绑医生</el-button>
               <el-button
                 size="mini"
@@ -215,6 +220,7 @@
                 icon="el-icon-link"
                 v-else
                 @click="handleUpdateDoctor(scope.row)"
+                v-hasPermi="['qw:companyUser:unBindDoctorId']"
               >绑定医生</el-button>
               <el-button
                 size="mini"
@@ -223,6 +229,7 @@
                 plain
                 v-if="scope.row.doctorId!=null"
                 @click="handleUnBindUserId(scope.row)"
+                v-hasPermi="['qw:companyUser:unBindDoctorId']"
               >解绑医生</el-button>
               <el-button
                 v-if="scope.row.qwStatus == 0"

+ 168 - 2
src/views/course/userCourseCategory/index.vue

@@ -70,6 +70,28 @@
           v-hasPermi="['course:userCourseCategory:export']"
         >导出</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          plain
+          type="info"
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['course:userCourseCategory:importData']"
+        >导入</el-button>
+      </el-col>
+
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleFansExport"
+          v-hasPermi="['course:userCourseCategory:fansExport']"
+        >重粉导出</el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -79,7 +101,9 @@
       :data="userCourseCategoryList"
       row-key="cateId"
       :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+    @selection-change="handleSelectionChange"
     >
+      <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="分类id" align="left" prop="cateId" />
       <el-table-column label="分类名称" align="left" prop="cateName" />
       <el-table-column  label="状态" align="center" prop="isShow">
@@ -145,13 +169,47 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+    <!-- 导入 -->
+    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+      <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div class="el-upload__tip" slot="tip">
+          <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
+        </div>
+        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" :loading="upload.isUploading" :disabled="upload.isUploading" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog title="导入结果" :close-on-press-escape="false" :close-on-click-modal="false" :visible.sync="importMsgOpen" width="500px" append-to-body>
+      <div class="import-msg" v-html="importMsg">
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="importMsgOpen = false">关 闭</el-button>
+        <el-button
+          v-if="failList && failList.length > 0"
+          type="primary"
+          v-hasPermi="['course:userCourseCategory:exportFail']"
+          @click="handleExportFailList(failList)"
+          :loading="exportFailLoading"
+        >导出失败信息</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listUserCourseCategory, getUserCourseCategory, delUserCourseCategory, addUserCourseCategory, updateUserCourseCategory, exportUserCourseCategory } from "@/api/course/userCourseCategory";
+import { listUserCourseCategory, getUserCourseCategory, delUserCourseCategory, addUserCourseCategory, updateUserCourseCategory, exportUserCourseCategory, exportFans,importTemplate, exportFail } from "@/api/course/userCourseCategory";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { getToken } from '@/utils/auth'
 export default {
   name: "UserCourseCategory",
   components: {
@@ -201,6 +259,23 @@ export default {
         cateName: [
           { required: true, message: "分类名称不能为空", trigger: "blur" }
         ],
+      },
+      // 导入
+      importMsgOpen:false,
+      exportFailLoading: false,
+      failList:[],
+      importMsg: '',
+      upload: {
+        // 是否显示弹出层(文件导入)
+        open: false,
+        // 弹出层标题(文件导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/course/userCourseCategory/importData",
       }
     };
   },
@@ -273,6 +348,8 @@ export default {
       this.ids = selection.map(item => item.cateId)
       this.single = selection.length!==1
       this.multiple = !selection.length
+
+      console.log("selection",  selection);
     },
     /** 新增按钮操作 */
     handleAdd() {
@@ -341,7 +418,96 @@ export default {
           this.download(response.msg);
           this.exportLoading = false;
         }).catch(() => {});
+    },
+    // 下载模板
+    importTemplate() {
+      importTemplate().then((response) => {
+        this.download(response.msg);
+      });
+    },
+    // 导入
+    handleImport() {
+      this.upload.title = "导入题目";
+      this.upload.open = true;
+    },
+    submitFileForm() {
+      this.$refs.upload.submit();
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.importMsgOpen=true;
+      this.importMsg = response.data.message
+      this.failList = response.data.failList
+      this.getList();
+    },
+    // 导出失败信息
+    handleExportFailList(failList) {
+      if (!failList || failList.length === 0) {
+        this.msgError("没有失败信息可导出");
+        return;
+      }
+      this.exportFailLoading = true;
+      this.$confirm('是否确认导出失败信息?', "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info"
+      }).then(() => {
+        // 调用导出失败信息的API
+        exportFail(failList).then(response => {
+          this.download(response.msg);
+          this.msgSuccess("失败信息导出成功");
+          this.exportFailLoading = false;
+        }).catch(() => {
+          this.msgError("失败信息导出失败");
+          this.exportFailLoading = false;
+        });
+      }).catch(() => {
+        this.exportFailLoading = false;
+      });
+    },
+    handleFansExport() {
+      if (!Array.isArray(this.ids) || this.ids.length === 0) {
+        this.$message.warning('请先选择至少一条数据');
+        return;
+      }
+
+      const params = { ids: this.ids };
+
+      this.$confirm('是否确认导出重粉?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        const loading = this.$loading({
+          lock: true,
+          text: '正在导出数据,请稍候...',
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.3)'
+        });
+
+        return exportFans(params)
+          .then(res => {
+            if (res.code !== 200){
+              this.$message.warning(res.msg);
+              return;
+            }
+
+            this.download(res.msg);
+          })
+
+          .finally(() => {
+            loading.close();
+          });
+      });
     }
-  }
+    },
+
 };
 </script>

+ 35 - 2
src/views/crm/externalContact/index.vue

@@ -20,6 +20,15 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="客户名称(准)" prop="preciseName">
+        <el-input
+          v-model="queryParams.preciseName"
+          placeholder="请输入客户名称精确查询"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
       <el-form-item label="活码id" prop="wayId">
         <el-input
           v-model="queryParams.wayId"
@@ -360,7 +369,7 @@
 <!--          </div>-->
 <!--        </template>-->
         <template slot-scope="scope">
-          <div class="tag-container">
+          <div class="table-tag-container">
             <div class="tag-list">
               <el-tag
                 v-for="name in scope.row.tagIdsName"
@@ -529,6 +538,8 @@
 
       <div>搜索标签:
         <el-input v-model="queryTagParams.name" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
+        搜索标签(精确):
+        <el-input v-model="queryTagParams.preciseName" placeholder="请输入精确标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(queryTagParams.name)">搜索</el-button>
         <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
       </div>
@@ -934,6 +945,7 @@ export default {
         pageSize: 5,
         total:0,
         name:null,
+        preciseName:null,
         corpId:null,
       },
 
@@ -947,6 +959,7 @@ export default {
         qwUserName:null,
         externalUserId: null,
         name: null,
+        preciseName: null,
         avatar: null,
         type: null,
         qwUserId:null,
@@ -1262,6 +1275,7 @@ export default {
       );
 
       this.queryTagParams.name=null;
+      this.queryTagParams.preciseName=null;
 
       this.getPageListTagGroup();
 
@@ -1501,7 +1515,7 @@ export default {
     },
     handleSearchTags(name){
 
-      if (!name){
+      if (!name && (this.queryTagParams.preciseName == null || this.queryTagParams.preciseName =="")){
         return this.$message.error("请输入要搜索的标签")
       }
 
@@ -2017,6 +2031,25 @@ export default {
   border-radius: 1px;
   background-color: #fafafa;
 }
+.table-tag-container {
+  max-height: 72px;
+  overflow-y: auto;
+  padding: 4px;
+}
+.table-tag-container::-webkit-scrollbar {
+  width: 6px;
+}
+.table-tag-container::-webkit-scrollbar-track {
+  background: #f1f1f1;
+  border-radius: 3px;
+}
+.table-tag-container::-webkit-scrollbar-thumb {
+  background: #c0c4cc;
+  border-radius: 3px;
+}
+.table-tag-container::-webkit-scrollbar-thumb:hover {
+  background: #909399;
+}
 .tag-list {
   display: flex;
   flex-wrap: wrap;

+ 6 - 20
src/views/his/aiWorkflow/design.scss

@@ -104,38 +104,24 @@
         .node-content {
           display: flex;
           align-items: center;
-          justify-content: center;
           height: 100%;
-          padding: 0 12px;
+          padding: 0 10px;
+          overflow: hidden;
 
           i {
-            font-size: 18px;
+            font-size: 16px;
             margin-right: 6px;
             flex-shrink: 0;
           }
 
-          .node-name-input {
-            border: none;
-            background: transparent;
-            outline: none;
-            font-size: 13px;
-            color: #333;
-            text-align: center;
-            min-width: 40px;
-            padding: 2px 4px;
-            
-            &:focus {
-              background: rgba(255, 255, 255, 0.8);
-              border-radius: 2px;
-            }
-          }
-
           .node-name {
-            font-size: 13px;
+            font-size: 12px;
             color: #333;
             white-space: nowrap;
             overflow: hidden;
             text-overflow: ellipsis;
+            flex: 1;
+            min-width: 0;
           }
         }
 

+ 23 - 44
src/views/his/aiWorkflow/design.vue

@@ -124,8 +124,8 @@
               @click.stop="selectNode(node)"
             >
               <rect
-                :width="getNodeWidth(node)"
-                :height="node.height || 40"
+                :width="nodeWidth"
+                :height="node.height || 36"
                 rx="6"
                 ry="6"
                 :fill="getNodeBgColor(node)"
@@ -133,27 +133,20 @@
                 stroke-width="2"
                 :class="{ selected: selectedNode === node }"
               />
-              <foreignObject :width="getNodeWidth(node)" :height="node.height || 40">
-                <div class="node-content" xmlns="http://www.w3.org/1999/xhtml">
+              <foreignObject :width="nodeWidth" :height="node.height || 36">
+                <div class="node-content" xmlns="http://www.w3.org/1999/xhtml" :title="node.nodeName">
                   <i :class="node.nodeIcon" :style="{ color: node.nodeColor }"></i>
-                  <input
-                    type="text"
-                    class="node-name-input"
-                    v-model="node.nodeName"
-                    @mousedown.stop
-                    @input="onNodeNameInput(node)"
-                    :style="{ width: getInputWidth(node) + 'px' }"
-                  />
+                  <span class="node-name">{{ node.nodeName }}</span>
                 </div>
               </foreignObject>
               <!-- 连接点 -->
-              <circle :cx="getNodeWidth(node) / 2" cy="0" r="6" fill="#fff" stroke="#1890ff" stroke-width="2"
+              <circle :cx="nodeWidth / 2" cy="0" r="5" fill="#fff" stroke="#1890ff" stroke-width="2"
                 class="anchor top" @mousedown.stop="startConnect($event, node, 'top')" />
-              <circle :cx="getNodeWidth(node) / 2" :cy="node.height || 40" r="6" fill="#fff" stroke="#1890ff" stroke-width="2"
+              <circle :cx="nodeWidth / 2" :cy="node.height || 36" r="5" fill="#fff" stroke="#1890ff" stroke-width="2"
                 class="anchor bottom" @mousedown.stop="startConnect($event, node, 'bottom')" />
-              <circle cx="0" :cy="(node.height || 40) / 2" r="6" fill="#fff" stroke="#1890ff" stroke-width="2"
+              <circle cx="0" :cy="(node.height || 36) / 2" r="5" fill="#fff" stroke="#1890ff" stroke-width="2"
                 class="anchor left" @mousedown.stop="startConnect($event, node, 'left')" />
-              <circle :cx="getNodeWidth(node)" :cy="(node.height || 40) / 2" r="6" fill="#fff" stroke="#1890ff" stroke-width="2"
+              <circle :cx="nodeWidth" :cy="(node.height || 36) / 2" r="5" fill="#fff" stroke="#1890ff" stroke-width="2"
                 class="anchor right" @mousedown.stop="startConnect($event, node, 'right')" />
             </g>
           </g>
@@ -170,7 +163,11 @@
         <!-- 节点属性 -->
         <el-form v-if="selectedNode" label-width="80px" size="small">
           <el-form-item label="节点内容">
-            <el-input v-model="selectedNode.nodeName" />
+            <el-input 
+              v-model="selectedNode.nodeName" 
+              type="textarea"
+              :autosize="{ minRows: 1, maxRows: 6 }"
+            />
           </el-form-item>
           <el-form-item label="节点类型">
             <el-input :value="getNodeTypeName(selectedNode.nodeType)" disabled />
@@ -253,6 +250,8 @@ export default {
       tempEdge: null,
       // 画布尺寸
       canvasSize: { width: 2000, height: 2000 },
+      // 节点固定宽度
+      nodeWidth: 120,
       // 是否正在拖动画布
       isDraggingCanvas: false,
       // 画布拖动起始点
@@ -551,12 +550,11 @@ export default {
     },
     /** 检测并扩展画布 */
     checkAndExpandCanvas(node) {
-      const nodeWidth = this.getNodeWidth(node)
-      const nodeHeight = node.height || 40
+      const nodeHeight = node.height || 36
       const padding = 200 // 边缘预留空间
       const expandStep = 500 // 每次扩展的大小
       
-      const nodeRight = node.posX + nodeWidth
+      const nodeRight = node.posX + this.nodeWidth
       const nodeBottom = node.posY + nodeHeight
       
       // 检测右边缘
@@ -603,8 +601,8 @@ export default {
     },
     /** 获取锚点位置 */
     getAnchorPos(node, anchor) {
-      const w = this.getNodeWidth(node)
-      const h = node.height || 40
+      const w = this.nodeWidth
+      const h = node.height || 36
       switch (anchor) {
         case 'top': return { x: node.posX + w / 2, y: node.posY }
         case 'bottom': return { x: node.posX + w / 2, y: node.posY + h }
@@ -621,8 +619,8 @@ export default {
       const x = (clientX - rect.left + scrollLeft - this.canvasOffset.x) / this.scale
       const y = (clientY - rect.top + scrollTop - this.canvasOffset.y) / this.scale
       return this.nodes.find(n => {
-        const w = this.getNodeWidth(n)
-        const h = n.height || 40
+        const w = this.nodeWidth
+        const h = n.height || 36
         return x >= n.posX && x <= n.posX + w && y >= n.posY && y <= n.posY + h
       })
     },
@@ -671,26 +669,7 @@ export default {
       const color = node.nodeColor || '#1890ff'
       return color + '15'
     },
-    /** 计算节点宽度 */
-    getNodeWidth(node) {
-      const minWidth = 80
-      const padding = 50 // 图标 + 左右padding
-      const charWidth = 14 // 每个字符大约宽度
-      const textWidth = (node.nodeName || '').length * charWidth
-      return Math.max(minWidth, textWidth + padding)
-    },
-    /** 计算输入框宽度 */
-    getInputWidth(node) {
-      const minWidth = 40
-      const charWidth = 14
-      const textWidth = (node.nodeName || '').length * charWidth
-      return Math.max(minWidth, textWidth + 10)
-    },
-    /** 节点名称输入事件 */
-    onNodeNameInput(node) {
-      // 触发视图更新
-      this.$forceUpdate()
-    },
+
     /** 获取节点类型名称 */
     getNodeTypeName(typeCode) {
       const t = this.nodeTypes.find(n => n.typeCode === typeCode)

+ 218 - 1
src/views/his/aiWorkflow/index.vue

@@ -107,6 +107,12 @@
             @click="handleEdit(scope.row)"
             v-hasPermi="['his:aiWorkflow:edit']"
           >设计</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-user"
+            @click="handleBindSales(scope.row)"
+          >绑定销售</el-button>
           <el-button
             size="mini"
             type="text"
@@ -132,11 +138,64 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
+
+    <!-- 绑定销售弹窗 -->
+    <el-dialog title="绑定销售" :visible.sync="bindSalesOpen" width="500px" append-to-body>
+      <!-- 当前绑定的销售 -->
+      <div class="current-sales">
+        <div class="section-title">当前绑定销售</div>
+        <div v-if="currentBindUserList && currentBindUserList.length > 0" class="bind-info">
+          <el-tag 
+            v-for="(user, index) in currentBindUserList" 
+            :key="index" 
+            type="success"
+            style="margin-right: 8px; margin-bottom: 8px;"
+          >
+            {{ user.userName || user.user_name }}({{ user.nickName || user.nick_name }})
+          </el-tag>
+        </div>
+        <div v-else class="no-bind">
+          <el-tag type="info">暂未绑定销售</el-tag>
+        </div>
+      </div>
+
+      <!-- 可选销售列表 -->
+      <div class="sales-list">
+        <div class="section-title">选择销售</div>
+        <el-input
+          v-model="salesSearchKey"
+          placeholder="搜索昵称"
+          size="small"
+          prefix-icon="el-icon-search"
+          clearable
+          style="margin-bottom: 10px"
+        />
+        <el-table
+          :data="filteredCompanyUserList"
+          v-loading="salesLoading"
+          border
+          height="300"
+          :row-key="getSalesRowKey"
+          :row-class-name="salesRowClassName"
+          @selection-change="handleSalesSelectionChange"
+          ref="salesTable"
+        >
+          <el-table-column type="selection" width="55" align="center" :selectable="checkSelectable" :reserve-selection="true" />
+          <el-table-column label="用户名" align="center" prop="userName" />
+          <el-table-column label="昵称" align="center" prop="nickName" />
+        </el-table>
+      </div>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="handleBindSalesCancel">取 消</el-button>
+        <el-button type="primary" :disabled="selectedSalesList.length === 0" @click="confirmBindSales">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listWorkflow, delWorkflow, updateWorkflowStatus, copyWorkflow, exportWorkflow } from '@/api/his/aiWorkflow'
+import { listWorkflow, delWorkflow, updateWorkflowStatus, copyWorkflow, exportWorkflow, getBindCompanyUserByWorkflowId, listCompanyUser, updateWorkflowBindCompanyUser } from '@/api/his/aiWorkflow'
 
 export default {
   name: 'AiWorkflow',
@@ -176,7 +235,33 @@ export default {
         workflowName: null,
         workflowType: null,
         status: null
+      },
+      // 绑定销售弹窗
+      bindSalesOpen: false,
+      // 销售列表加载
+      salesLoading: false,
+      // 当前操作的工作流
+      currentWorkflow: null,
+      // 当前绑定的用户列表
+      currentBindUserList: [],
+      // 销售列表
+      companyUserList: [],
+      // 选中的销售列表
+      selectedSalesList: [],
+      // 销售搜索关键字
+      salesSearchKey: ''
+    }
+  },
+  computed: {
+    // 过滤后的销售列表
+    filteredCompanyUserList() {
+      if (!this.salesSearchKey) {
+        return this.companyUserList
       }
+      const key = this.salesSearchKey.toLowerCase()
+      return this.companyUserList.filter(item => {
+        return (item.nickName && item.nickName.toLowerCase().includes(key))
+      })
     }
   },
   created() {
@@ -276,7 +361,139 @@ export default {
         this.download(response.msg)
         this.exportLoading = false
       }).catch(() => {})
+    },
+    /** 绑定销售按钮操作 */
+    handleBindSales(row) {
+      this.currentWorkflow = row
+      this.currentBindUserList = []
+      this.selectedSalesList = []
+      this.salesSearchKey = ''
+      this.bindSalesOpen = true
+      this.salesLoading = true
+      console.log(11111)
+      // 获取当前绑定的销售列表
+      getBindCompanyUserByWorkflowId(row.workflowId).then(res => {
+        this.currentBindUserList = res.data.data || []
+      }).catch(() => {})
+      console.log(this.currentBindUserList)
+      // 获取销售列表
+      listCompanyUser().then(res => {
+        this.companyUserList = res.data || res.rows || []
+        this.salesLoading = false
+      }).catch(() => {
+        this.salesLoading = false
+      })
+    },
+    /** 销售勾选变化 */
+    handleSalesSelectionChange(selection) {
+      this.selectedSalesList = selection
+    },
+    /** 获取销售行key */
+    getSalesRowKey(row) {
+      return row.userId || row.companyUserId || row.id
+    },
+    /** 取消绑定销售弹窗 */
+    handleBindSalesCancel() {
+      this.bindSalesOpen = false
+      this.selectedSalesList = []
+      this.$refs.salesTable && this.$refs.salesTable.clearSelection()
+    },
+    /** 销售行样式 */
+    salesRowClassName({ row }) {
+      if (this.isCurrentBindUser(row)) {
+        return 'disabled-row'
+      }
+      return ''
+    },
+    /** 判断是否为当前绑定用户 */
+    isCurrentBindUser(row) {
+      if (!this.currentBindUserList || this.currentBindUserList.length === 0) {
+        return false
+      }
+      const rowUserId = row.userId || row.companyUserId || row.user_id
+      return this.currentBindUserList.some(user => {
+        const bindUserId = user.userId || user.companyUserId || user.user_id
+        return bindUserId == rowUserId
+      })
+    },
+    /** 检查是否可选 */
+    checkSelectable(row) {
+      return !this.isCurrentBindUser(row)
+    },
+    /** 确认绑定销售 */
+    confirmBindSales() {
+      if (this.selectedSalesList.length === 0) {
+        this.msgWarning('请选择要绑定的销售')
+        return
+      }
+
+      const workflowId = this.currentWorkflow.workflowId
+      const companyUserIds = this.selectedSalesList.map(item => item.userId || item.companyUserId)
+      
+      this.doBindSales(workflowId, companyUserIds)
+    },
+    /** 执行绑定销售 */
+    doBindSales(workflowId, companyUserIds) {
+      updateWorkflowBindCompanyUser({
+        workflowId: workflowId,
+        companyUserIds: companyUserIds
+      }).then(() => {
+        this.msgSuccess('绑定成功')
+        this.bindSalesOpen = false
+        this.getList()
+      })
     }
   }
 }
 </script>
+
+<style lang="scss" scoped>
+.current-sales {
+  margin-bottom: 20px;
+  padding-bottom: 15px;
+  border-bottom: 1px solid #eee;
+
+  .section-title {
+    font-weight: 600;
+    margin-bottom: 10px;
+    color: #333;
+  }
+
+  .bind-info {
+    .el-tag {
+      font-size: 14px;
+      padding: 8px 15px;
+      height: auto;
+      line-height: 1.5;
+      white-space: normal;
+    }
+  }
+
+  .no-bind {
+    .el-tag {
+      font-size: 14px;
+      padding: 8px 15px;
+      height: auto;
+    }
+  }
+}
+
+.sales-list {
+  .section-title {
+    font-weight: 600;
+    margin-bottom: 10px;
+    color: #333;
+  }
+}
+</style>
+
+<style lang="scss">
+.el-table .disabled-row {
+  background-color: #f5f5f5;
+  color: #999;
+  
+  &:hover > td {
+    background-color: #f5f5f5 !important;
+  }
+}
+</style>

+ 8 - 1
src/views/hisStore/components/productAfterSalesOrder.vue

@@ -144,9 +144,16 @@
                 {{scope.row.num}}
             </template>
           </el-table-column>
+<!--          <el-table-column label="运费金额" width="180" align="center">
+            <template slot-scope="scope">
+              ¥{{ (order.payPostage || 0).toFixed(2) }}
+            </template>
+          </el-table-column>-->
           <el-table-column label="小计"  align="center">
             <template slot-scope="scope">
-              ¥{{scope.row.num*JSON.parse(scope.row.jsonInfo).price}}
+<!--              ¥{{scope.row.num*JSON.parse(scope.row.jsonInfo).price}}-->
+<!--              {{ (goodsTotal + (order.payPostage || 0)).toFixed(2) }}-->
+              ¥{{order.payPrice}}
             </template>
           </el-table-column>
         </el-table>

+ 25 - 6
src/views/live/components/productAfterSalesOrder.vue

@@ -39,13 +39,20 @@
                 </span>
           </el-descriptions-item>
           <el-descriptions-item label="退款金额"  >
-                <span v-if="afterSales!=null">
-                  {{afterSales.refundAmount}}
+                <span>
+<!--                  {{order.totalPrice}}-->
+                  ¥{{(order.totalPrice-order.discountMoney).toFixed(2)}}
+<!--                  ¥{{(order.totalPrice-order.payPostage+order.discountMoney).toFixed(2)}}-->
+                </span>
+          </el-descriptions-item>
+          <el-descriptions-item label="优惠券"  >
+                <span>
+                  ¥{{order.discountMoney}}
                 </span>
           </el-descriptions-item>
           <el-descriptions-item label="运费"  >
                 <span v-if="order!=null">
-                  {{order.payDelivery}}
+                  ¥{{order.payPostage}}
                 </span>
           </el-descriptions-item>
           <el-descriptions-item label="申请类型"  >
@@ -133,6 +140,16 @@
 
             </template>
           </el-table-column>
+          <el-table-column label="优惠券" width="300" align="center">
+            <template slot-scope="scope">
+              <p>¥{{order.discountMoney}}</p>
+            </template>
+          </el-table-column>
+          <el-table-column label="运费" width="300" align="center">
+            <template slot-scope="scope">
+              <p>¥{{order.payPostage}}</p>
+            </template>
+          </el-table-column>
           <el-table-column label="属性" width="240" align="center">
             <template slot-scope="scope">
               {{JSON.parse(scope.row.jsonInfo).sku}}
@@ -145,13 +162,15 @@
           </el-table-column>
           <el-table-column label="小计"  align="center">
             <template slot-scope="scope">
-              ¥{{JSON.parse(scope.row.jsonInfo).num*JSON.parse(scope.row.jsonInfo).price}}
+              ¥ {{(order.totalPrice-order.discountMoney).toFixed(2)}}
+<!--              ¥{{(order.totalPrice-order.payPostage+order.discountMoney).toFixed(2)}}--><!--{{JSON.parse(scope.row.jsonInfo).num*JSON.parse(scope.row.jsonInfo).price}}-->
             </template>
           </el-table-column>
         </el-table>
         <div style="margin-top: 12px; text-align: right;" v-if="order">
-          <div>订单金额:¥{{ goodsTotal.toFixed(2) }}</div>
-          <div>运费金额:¥{{ (order.payDelivery || 0).toFixed(2) }}</div>
+          <div>商品金额:¥{{ goodsTotal.toFixed(2) }}</div>
+          <div>运费金额:¥{{ (order.payPostage || 0).toFixed(2) }}</div>
+          <div>优惠券金额:¥{{ order.discountMoney }}</div>
         </div>
         <div style="margin-top: 20px">
           <span class="font-small">操作信息</span>

+ 1 - 0
src/views/qw/externalContact/index.vue

@@ -392,6 +392,7 @@
             size="mini"
             type="text"
             @click="handledetails(scope.row)"
+            v-hasPermi="['qw:externalContact:getUserInfo']"
         >AI获取用户信息
         </el-button>
       </template>