Bläddra i källkod

优化搭销会员历史订单、处理记录所在位置

cgp 2 veckor sedan
förälder
incheckning
7e186654de
2 ändrade filer med 392 tillägg och 334 borttagningar
  1. 384 34
      src/views/memberSales/index.vue
  2. 8 300
      src/views/task/unprocessed.vue

+ 384 - 34
src/views/memberSales/index.vue

@@ -31,6 +31,20 @@
             icon="el-icon-edit"
             @click="selectUnprocessed(scope.row)"
           >未处理</el-button>
+          <!-- 新增:处理记录按钮 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-finished"
+            @click="getHandleRecordsList(scope.row)"
+          >处理记录</el-button>
+          <!-- 新增:历史订单按钮 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-more"
+            @click="handleViewHistoryOrders(scope.row)"
+          >历史订单</el-button>
           <el-button
             size="mini"
             type="text"
@@ -73,11 +87,134 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+    <!-- 处理记录弹窗 -->
+    <el-dialog
+      title="处理记录"
+      :visible.sync="recordsDialogVisible"
+      width="45%"
+      append-to-body
+    >
+      <div class="records-dialog">
+        <!-- 搜索区域 -->
+        <el-form :inline="true" :model="recordsQueryParams" class="demo-form-inline">
+          <el-form-item label="处理方式">
+            <el-select v-model="recordsQueryParams.handleType" placeholder="请选择处理方式" clearable>
+              <el-option label="签收" :value="1" />
+              <el-option label="设置提醒时间" :value="2" />
+            </el-select>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="loadHandleRecords">搜索</el-button>
+            <el-button @click="resetRecordsQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <!-- 处理记录表格 -->
+        <el-table
+          v-loading="recordsLoading"
+          :data="recordsList"
+          border
+          style="width: 100%; margin-top: 15px"
+        >
+          <el-table-column label="处理方式" align="center" prop="handleType" width="120">
+            <template slot-scope="scope">
+              <span>{{ formatHandleType(scope.row.handleType) }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="订单号" align="center" prop="orderCode" width="180">
+            <template slot-scope="scope">
+              <span>{{ scope.row.orderCode || '--' }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="提醒天数" align="center" prop="sendDays" width="100">
+            <template slot-scope="scope">
+              <span>{{ scope.row.sendDays ? scope.row.sendDays + '天' : '--' }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="处理结果" align="center" prop="remark" />
+          <el-table-column label="处理时间" align="center" prop="createTime" width="180" />
+        </el-table>
+
+        <!-- 分页组件 -->
+        <pagination
+          v-show="recordsTotal>0"
+          :total="recordsTotal"
+          :page.sync="recordsQueryParams.pageNum"
+          :limit.sync="recordsQueryParams.pageSize"
+          @pagination="handleRecordsPagination"
+        />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="recordsDialogVisible = false">关 闭</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 历史订单弹窗 -->
+    <el-dialog
+      title="历史订单"
+      :visible.sync="historyDialogVisible"
+      width="45%"
+      append-to-body
+    >
+      <div class="history-dialog">
+        <!-- 搜索区域 -->
+        <el-form :inline="true" :model="historyQueryParams" class="demo-form-inline">
+          <el-form-item label="订单号">
+            <el-input
+              v-model="historyQueryParams.orderCode"
+              placeholder="请输入订单号"
+              clearable
+              style="width: 200px;"
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="loadHistoryOrders">搜索</el-button>
+            <el-button @click="resetHistoryQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <!-- 历史订单表格 -->
+        <el-table
+          v-loading="historyLoading"
+          :data="historyList"
+          border
+          style="width: 100%; margin-top: 15px"
+        >
+          <el-table-column label="订单号" align="center" prop="orderCode" width="180" />
+          <el-table-column label="商品名称" align="center" prop="packageName" width="200" />
+          <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
+          <el-table-column label="状态" align="center" prop="status" width="180" >
+            <template slot-scope="scope">
+              <span>{{ formatOrderStatus(scope.row.status) }}</span>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <!-- 分页组件 -->
+        <pagination
+          v-show="historyTotal>0"
+          :total="historyTotal"
+          :page.sync="historyQueryParams.pageNum"
+          :limit.sync="historyQueryParams.pageSize"
+          @pagination="handleHistoryPagination"
+        />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="historyDialogVisible = false">关 闭</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import { listMemberSales,} from "@/api/memberSales";
+import { listMemberSales } from "@/api/memberSales";
+// --- 引入需要的 API 函数 ---
+import {
+  selectFsSopDoctorTaskVoListHandleRecords,
+  userHistoryOrderList
+} from "@/api/his/doctorTask";
 
 export default {
   name: "MemberSales",
@@ -116,8 +253,32 @@ export default {
       // 表单参数
       form: {},
       // 表单校验
-      rules: {
-      }
+      rules: {},
+
+      // --- 新增:处理记录相关数据 ---
+      recordsDialogVisible: false,
+      recordsLoading: false,
+      recordsList: [],
+      recordsTotal: 0,
+      recordsQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        doctorMemberSalesId: null, // 用于查询,由打开弹窗时注入
+        handleType: null
+      },
+
+      // --- 新增:历史订单相关数据 ---
+      historyDialogVisible: false,
+      historyLoading: false,
+      historyList: [],
+      historyTotal: 0,
+      historyQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        userId: null, // 用于查询,由打开弹窗时注入
+        orderCode: null
+      },
+
     };
   },
   created() {
@@ -135,7 +296,7 @@ export default {
       // 使用 params 传递参数
       this.$router.push({
         path: `/task/unprocessed`,
-        query// 如果需要传递更多参数,可以使用 query
+        query
       });
     },
     /** 查询医生会员搭销列表 */
@@ -188,17 +349,19 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
-            updateMemberSales(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+            // 假设 updateMemberSales 函数存在
+            // updateMemberSales(this.form).then(response => {
+            //   this.msgSuccess("修改成功");
+            //   this.open = false;
+            //   this.getList();
+            // });
           } else {
-            addMemberSales(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+            // 假设 addMemberSales 函数存在
+            // addMemberSales(this.form).then(response => {
+            //   this.msgSuccess("新增成功");
+            //   this.open = false;
+            //   this.getList();
+            // });
           }
         }
       });
@@ -207,31 +370,218 @@ export default {
     handleDelete(row) {
       const ids = row.id || this.ids;
       this.$confirm('是否确认删除医生会员搭销编号为"' + ids + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delMemberSales(ids);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        // 假设 delMemberSales 函数存在
+        // return delMemberSales(ids);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;
       this.$confirm('是否确认导出所有医生会员搭销数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(() => {
-          this.exportLoading = true;
-          return exportMemberSales(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-          this.exportLoading = false;
-        }).catch(() => {});
-    }
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        // 假设 exportMemberSales 函数存在
+        // return exportMemberSales(queryParams);
+      }).then(response => {
+        // this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    },
+
+    // --- 新增:处理记录相关方法 ---
+
+    /**
+     * 查询搭销会员任务处理记录 - 打开弹窗入口点
+     */
+    getHandleRecordsList(row) {
+      // 初始化查询参数,注入必要的ID
+      this.recordsQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        doctorMemberSalesId: row.id, // 使用当前行的 id 作为 doctorMemberSalesId
+        handleType: null
+      };
+      // 打开弹窗
+      this.recordsDialogVisible = true;
+      // 加载数据
+      this.loadHandleRecords();
+    },
+
+    /**
+     * 加载处理记录数据
+     */
+    loadHandleRecords() {
+      this.recordsLoading = true;
+      selectFsSopDoctorTaskVoListHandleRecords(this.recordsQueryParams)
+        .then(response => {
+          this.recordsList = response.rows || [];
+          this.recordsTotal = response.total || 0;
+        })
+        .catch(error => {
+          console.error('获取处理记录失败:', error);
+          this.$message.error('获取处理记录失败');
+          this.recordsList = [];
+          this.recordsTotal = 0;
+        })
+        .finally(() => {
+          this.recordsLoading = false;
+        });
+    },
+
+    /**
+     * 处理记录分页
+     */
+    handleRecordsPagination() {
+      this.loadHandleRecords();
+    },
+
+    /**
+     * 重置处理记录查询条件
+     */
+    resetRecordsQuery() {
+      const doctorMemberSalesId = this.recordsQueryParams.doctorMemberSalesId;
+      this.recordsQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        doctorMemberSalesId: doctorMemberSalesId,
+        handleType: null
+      };
+      // 重置后重新查询
+      this.loadHandleRecords();
+    },
+
+    // --- 新增:历史订单相关方法 ---
+
+    /**
+     * 查看历史订单 - 打开弹窗入口点
+     */
+    handleViewHistoryOrders(row) {
+      // 初始化查询参数
+      this.historyQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        userId: row.fsUserId, // 使用当前行的 fsUserId
+        orderCode: null
+      };
+      // 打开弹窗
+      this.historyDialogVisible = true;
+      // 加载数据
+      this.loadHistoryOrders();
+    },
+
+    /**
+     * 加载历史订单数据
+     */
+    loadHistoryOrders() {
+      this.historyLoading = true;
+      userHistoryOrderList(this.historyQueryParams)
+        .then(response => {
+          this.historyList = response.rows || [];
+          this.historyTotal = response.total || 0;
+        })
+        .catch(error => {
+          console.error('获取历史订单失败:', error);
+          this.$message.error('获取历史订单失败');
+          this.historyList = [];
+          this.historyTotal = 0;
+        })
+        .finally(() => {
+          this.historyLoading = false;
+        });
+    },
+
+    /**
+     * 历史订单分页
+     */
+    handleHistoryPagination() {
+      this.loadHistoryOrders();
+    },
+
+    /**
+     * 重置历史订单查询条件
+     */
+    resetHistoryQuery() {
+      const userId = this.historyQueryParams.userId;
+      this.historyQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        userId: userId,
+        orderCode: null
+      };
+      // 重置后重新查询
+      this.loadHistoryOrders();
+    },
+
+    /**
+     * 格式化订单状态数字为文本
+     */
+    formatOrderStatus(status) {
+      switch (status) {
+        case -3:
+          return '已取消';
+        case -2:
+          return '退货成功';
+        case -1:
+          return '申请退款';
+        case 1:
+          return '待支付';
+        case 2:
+          return '待发货';
+        case 3:
+          return '待收货';
+        case 4:
+          return '待评价';
+        default:
+          return '未知状态';
+      }
+    },
+
+    /**
+     * 格式化处理方式
+     */
+    formatHandleType(handleType) {
+      switch (handleType) {
+        case 1:
+          return '签收';
+        case 2:
+          return '设置提醒时间';
+        default:
+          return '未知';
+      }
+    },
+
   }
 };
 </script>
+
+<style scoped>
+/*隐藏单选框的文本 */
+.custom-radio ::v-deep .el-radio__label {
+  display: none;
+}
+
+/* 处理记录弹窗样式 */
+.records-dialog {
+  min-height: 300px;
+}
+
+/* 历史订单弹窗样式 */
+.history-dialog {
+  min-height: 300px;
+}
+
+/* 表单内联样式 */
+.demo-form-inline {
+  margin-bottom: 0;
+}
+</style>

+ 8 - 300
src/views/task/unprocessed.vue

@@ -18,20 +18,8 @@
             @click="handleUpdate(scope.row)"
           >处理
           </el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-finished"
-            @click="getHandleRecordsList(scope.row)"
-          >处理记录
-          </el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-more"
-            @click="handleViewHistoryOrders(scope.row)"
-          >历史订单
-          </el-button>
+          <!-- 已移除:处理记录按钮 -->
+          <!-- 已移除:历史订单按钮 -->
         </template>
       </el-table-column>
     </el-table>
@@ -150,122 +138,9 @@
       </div>
     </el-dialog>
 
-    <!-- 处理记录弹窗 -->
-    <el-dialog
-      title="处理记录"
-      :visible.sync="recordsDialogVisible"
-      width="45%"
-      append-to-body
-    >
-      <div class="records-dialog">
-        <!-- 搜索区域 -->
-        <el-form :inline="true" :model="recordsQueryParams" class="demo-form-inline">
-          <el-form-item label="处理方式">
-            <el-select v-model="recordsQueryParams.handleType" placeholder="请选择处理方式" clearable>
-              <el-option label="签收" :value="1" />
-              <el-option label="设置提醒时间" :value="2" />
-            </el-select>
-          </el-form-item>
-          <el-form-item>
-            <el-button type="primary" @click="loadHandleRecords">搜索</el-button>
-            <el-button @click="resetRecordsQuery">重置</el-button>
-          </el-form-item>
-        </el-form>
+    <!-- 处理记录弹窗 - 已移除 -->
+    <!-- 历史订单弹窗 - 已移除 -->
 
-        <!-- 处理记录表格 -->
-        <el-table
-          v-loading="recordsLoading"
-          :data="recordsList"
-          border
-          style="width: 100%; margin-top: 15px"
-        >
-          <el-table-column label="处理方式" align="center" prop="handleType" width="120">
-            <template slot-scope="scope">
-              <span>{{ formatHandleType(scope.row.handleType) }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="订单号" align="center" prop="orderCode" width="180">
-            <template slot-scope="scope">
-              <span>{{ scope.row.orderCode || '--' }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="提醒天数" align="center" prop="sendDays" width="100">
-            <template slot-scope="scope">
-              <span>{{ scope.row.sendDays ? scope.row.sendDays + '天' : '--' }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="处理结果" align="center" prop="remark" />
-          <el-table-column label="处理时间" align="center" prop="createTime" width="180" />
-        </el-table>
-
-        <!-- 分页组件 -->
-        <pagination
-          v-show="recordsTotal>0"
-          :total="recordsTotal"
-          :page.sync="recordsQueryParams.pageNum"
-          :limit.sync="recordsQueryParams.pageSize"
-          @pagination="handleRecordsPagination"
-        />
-      </div>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="recordsDialogVisible = false">关 闭</el-button>
-      </div>
-    </el-dialog>
-
-    <!-- 历史订单弹窗 -->
-    <el-dialog
-      title="历史订单"
-      :visible.sync="historyDialogVisible"
-      width="45%"
-      append-to-body
-    >
-      <div class="history-dialog">
-        <!-- 搜索区域 -->
-        <el-form :inline="true" :model="historyQueryParams" class="demo-form-inline">
-          <el-form-item label="订单号">
-            <el-input
-              v-model="historyQueryParams.orderCode"
-              placeholder="请输入订单号"
-              clearable
-              style="width: 200px;"
-            />
-          </el-form-item>
-          <el-form-item>
-            <el-button type="primary" @click="loadHistoryOrders">搜索</el-button>
-            <el-button @click="resetHistoryQuery">重置</el-button>
-          </el-form-item>
-        </el-form>
-
-        <!-- 历史订单表格 -->
-        <el-table
-          v-loading="historyLoading"
-          :data="historyList"
-          border
-          style="width: 100%; margin-top: 15px"
-        >
-          <el-table-column label="订单号" align="center" prop="orderCode" width="180" />
-          <el-table-column label="商品名称" align="center" prop="packageName" width="200" />
-          <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
-          <el-table-column label="状态" align="center" prop="status" width="180" >
-            <template slot-scope="scope">
-              <span>{{ formatOrderStatus(scope.row.status) }}</span>
-            </template>
-          </el-table-column>
-        </el-table>
-
-        <!-- 分页组件 -->
-        <pagination
-          v-show="historyTotal>0"
-          :total="historyTotal"
-          :page.sync="historyQueryParams.pageNum"
-          :limit.sync="historyQueryParams.pageSize"
-          @pagination="handleHistoryPagination"
-        />
-      </div>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="historyDialogVisible = false">关 闭</el-button>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
@@ -274,8 +149,8 @@ import {
   taskList,
   submitDoctorTask,
   getNoReceiveOrderList,
-  selectFsSopDoctorTaskVoListHandleRecords,
-  userHistoryOrderList
+  // selectFsSopDoctorTaskVoListHandleRecords, // 已移除导入
+  // userHistoryOrderList // 已移除导入
 } from "@/api/his/doctorTask";
 
 export default {
@@ -330,29 +205,8 @@ export default {
       orderSearched: false,
       orderLoading: false,
 
-      // 处理记录相关数据
-      recordsDialogVisible: false,
-      recordsLoading: false,
-      recordsList: [],
-      recordsTotal: 0,
-      recordsQueryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        doctorMemberSalesId: null, // 用于查询,由打开弹窗时注入
-        handleType: null
-      },
-
-      // 历史订单相关数据
-      historyDialogVisible: false,
-      historyLoading: false,
-      historyList: [],
-      historyTotal: 0,
-      historyQueryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        userId: null, // 用于查询,由打开弹窗时注入
-        orderCode: null
-      },
+      // --- 移除:处理记录相关数据 ---
+      // --- 移除:历史订单相关数据 ---
 
       // 表单校验规则
       rules: {
@@ -535,142 +389,6 @@ export default {
           return '未知状态';
       }
     },
-    /**
-     * 格式化处理方式
-     */
-    formatHandleType(handleType) {
-      switch (handleType) {
-        case 1:
-          return '签收';
-        case 2:
-          return '设置提醒时间';
-        default:
-          return '未知';
-      }
-    },
-
-    /**
-     * 查询搭销会员任务处理记录 - 打开弹窗入口点
-     */
-    getHandleRecordsList(row) {
-      // 初始化查询参数,注入必要的ID
-      this.recordsQueryParams = {
-        pageNum: 1,
-        pageSize: 10,
-        doctorMemberSalesId: this.globalVarDoctorMemberSalesId, // 注入关键ID
-        handleType: null
-      };
-      // 打开弹窗
-      this.recordsDialogVisible = true;
-      // 加载数据
-      this.loadHandleRecords();
-    },
-
-    /**
-     * 加载处理记录数据
-     */
-    loadHandleRecords() {
-      this.recordsLoading = true;
-      selectFsSopDoctorTaskVoListHandleRecords(this.recordsQueryParams)
-        .then(response => {
-          this.recordsList = response.rows || [];
-          this.recordsTotal = response.total || 0;
-        })
-        .catch(error => {
-          console.error('获取处理记录失败:', error);
-          this.$message.error('获取处理记录失败');
-          this.recordsList = [];
-          this.recordsTotal = 0;
-        })
-        .finally(() => {
-          this.recordsLoading = false;
-        });
-    },
-
-    /**
-     * 处理记录分页
-     */
-    handleRecordsPagination() {
-      this.loadHandleRecords();
-    },
-
-    /**
-     * 重置处理记录查询条件
-     */
-    resetRecordsQuery() {
-      const doctorMemberSalesId = this.recordsQueryParams.doctorMemberSalesId;
-      this.recordsQueryParams = {
-        pageNum: 1,
-        pageSize: 10,
-        doctorMemberSalesId: doctorMemberSalesId,
-        handleType: null
-      };
-      // 重置后重新查询
-      this.loadHandleRecords();
-    },
-
-
-    /**
-     * 查看历史订单 - 打开弹窗入口点
-     */
-    handleViewHistoryOrders(row) {
-      // 初始化查询参数
-      this.historyQueryParams = {
-        pageNum: 1,
-        pageSize: 10,
-        userId: this.fsUserId,
-        orderCode: null
-      };
-      // 打开弹窗
-      this.historyDialogVisible = true;
-      // 加载数据
-      this.loadHistoryOrders();
-    },
-
-    /**
-     * 加载历史订单数据
-     */
-    loadHistoryOrders() {
-      this.historyLoading = true;
-      userHistoryOrderList(this.historyQueryParams)
-        .then(response => {
-          this.historyList = response.rows || [];
-          this.historyTotal = response.total || 0;
-        })
-        .catch(error => {
-          console.error('获取历史订单失败:', error);
-          this.$message.error('获取历史订单失败');
-          this.historyList = [];
-          this.historyTotal = 0;
-        })
-        .finally(() => {
-          this.historyLoading = false;
-        });
-    },
-
-    /**
-     * 历史订单分页
-     */
-    handleHistoryPagination() {
-      this.loadHistoryOrders();
-    },
-
-    /**
-     * 重置历史订单查询条件
-     */
-    resetHistoryQuery() {
-      const userId = this.historyQueryParams.userId;
-      this.historyQueryParams = {
-        pageNum: 1,
-        pageSize: 10,
-        userId: userId,
-        orderCode: null
-      };
-      // 重置后重新查询
-      this.loadHistoryOrders();
-    },
-
-
     /** 提交处理 */
     submitForm() {
       this.$refs.form.validate(valid => {
@@ -716,16 +434,6 @@ export default {
   display: none;
 }
 
-/* 处理记录弹窗样式 */
-.records-dialog {
-  min-height: 300px;
-}
-
-/* 历史订单弹窗样式 */
-.history-dialog {
-  min-height: 300px;
-}
-
 /* 表单内联样式 */
 .demo-form-inline {
   margin-bottom: 0;