浏览代码

增加搭销会员历史订单、处理记录页面

cgp 2 周之前
父节点
当前提交
fe6823cd28
共有 2 个文件被更改,包括 366 次插入11 次删除
  1. 18 0
      src/api/his/doctorTask.js
  2. 348 11
      src/views/task/unprocessed.vue

+ 18 - 0
src/api/his/doctorTask.js

@@ -87,3 +87,21 @@ export function getNoReceiveOrderList(id) {
     method: 'get'
   })
 }
+
+// 查询搭销会员任务处理记录
+export function selectFsSopDoctorTaskVoListHandleRecords(query) {
+  return request({
+    url: '/his/doctorTask/selectFsSopDoctorTaskVoListHandleRecords',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询用户历史订单列表
+export function userHistoryOrderList(query) {
+  return request({
+    url: '/his/doctorTask/storeOrder/userHistoryOrderList',
+    method: 'get',
+    params: query
+  })
+}

+ 348 - 11
src/views/task/unprocessed.vue

@@ -22,14 +22,14 @@
             size="mini"
             type="text"
             icon="el-icon-finished"
-            @click=""
+            @click="handleViewHistoryOrders(scope.row)"
           >历史订单
           </el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-more"
-            @click=""
+            @click="getHandleRecordsList(scope.row)"
           >处理记录
           </el-button>
         </template>
@@ -149,16 +149,140 @@
         <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="handleRecordsQuery">搜索</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="handleHistoryQuery">搜索</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 { taskList, submitDoctorTask, getNoReceiveOrderList } from "@/api/his/doctorTask";
+import {
+  taskList,
+  submitDoctorTask,
+  getNoReceiveOrderList,
+  selectFsSopDoctorTaskVoListHandleRecords,
+  userHistoryOrderList
+} from "@/api/his/doctorTask";
 
 export default {
   name: "unprocessed",
   data() {
     return {
+      globalVarDoctorMemberSalesId:null,//全局搭销会员变量名
       userName: null,
       phone: null,
       fsUserId: null, // 保存用户ID
@@ -195,7 +319,8 @@ export default {
         sendDays: null,
         remark: '',
         selectedOrderNo: '',
-        doctorMemberSalesId: null
+        doctorMemberSalesId: null,
+        companyUserId: null
       },
 
       // 订单相关
@@ -203,7 +328,31 @@ export default {
       orderList: [],
       selectedOrder: null,
       orderSearched: false,
-      orderLoading: 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: {
@@ -219,6 +368,7 @@ export default {
   created() {
     this.queryParams.status = this.$route.query.status;
     this.queryParams.doctorMemberSalesId = this.$route.query.id;
+    this.globalVarDoctorMemberSalesId = this.$route.query.id;
     this.userName = this.$route.query.userName;
     this.phone = this.$route.query.phone;
     this.fsUserId = this.$route.query.fsUserId;
@@ -247,7 +397,8 @@ export default {
         sendDays: null,
         remark: '',
         selectedOrderNo: '',
-        doctorMemberSalesId: null
+        doctorMemberSalesId: null,
+        companyUserId: null
       };
       this.orderSearchKeyword = '';
       this.orderList = [];
@@ -303,11 +454,12 @@ export default {
     handleUpdate(row) {
       this.form = {
         id: row.id,
-        handleType: 1, // 设置为数字1
+        handleType: 1,
         sendDays: null,
         remark: '',
         selectedOrderNo: '',
-        doctorMemberSalesId: row.doctorMemberSalesId
+        doctorMemberSalesId: row.doctorMemberSalesId,
+        companyUserId: row.companyUserId
       };
 
       this.orderSearchKeyword = '';
@@ -365,6 +517,16 @@ export default {
      */
     formatOrderStatus(status) {
       switch (status) {
+        case -3:
+          return '已取消';
+        case -2:
+          return '退货成功';
+        case -1:
+          return '申请退款';
+        case 1:
+          return '待支付';
+        case 2:
+          return '待发货';
         case 3:
           return '待收货';
         case 4:
@@ -373,6 +535,166 @@ export default {
           return '未知状态';
       }
     },
+    /**
+     * 格式化处理方式
+     */
+    formatHandleType(handleType) {
+      switch (handleType) {
+        case 1:
+          return '签收';
+        case 2:
+          return '设置提醒时间';
+        default:
+          return '未知';
+      }
+    },
+
+    /**
+     * 查询搭销会员任务处理记录
+     */
+    getHandleRecordsList(row) {
+      // 重置查询参数
+      this.recordsQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        doctorMemberSalesId: this.globalVarDoctorMemberSalesId,
+        handleType: null
+      };
+
+      // 打开弹窗
+      this.recordsDialogVisible = true;
+      this.recordsLoading = true;
+
+      // 调用内部加载方法
+      this.loadHandleRecords();
+    },
+
+    /**
+     * 处理记录搜索
+     */
+    handleRecordsQuery() {
+      this.recordsQueryParams.pageNum = 1;
+      this.getHandleRecordsList();
+    },
+
+    /**
+     * 重置处理记录查询条件
+     */
+    resetRecordsQuery() {
+      this.recordsQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        doctorMemberSalesId: this.recordsQueryParams.doctorMemberSalesId,
+        handleType: null
+      };
+      // 调用内部加载方法
+      this.loadHandleRecords();
+    },
+
+    /**
+     * 处理记录分页
+     */
+    handleRecordsPagination(pagination) {
+      this.recordsQueryParams.pageNum = pagination.page;
+      this.recordsQueryParams.pageSize = pagination.limit;
+      this.loadHandleRecords();
+    },
+
+    /**
+     * 加载处理记录数据(内部方法)
+     */
+    loadHandleRecords() {
+      this.recordsLoading = true;
+
+      // 调用API获取处理记录
+      selectFsSopDoctorTaskVoListHandleRecords(this.recordsQueryParams)
+        .then(response => {
+          // 根据接口返回的数据结构调整
+          this.recordsList = response.rows || [];
+          this.recordsTotal = response.total || 0;
+          this.recordsLoading = false;
+        })
+        .catch(error => {
+          console.error('获取处理记录失败:', error);
+          this.$message.error('获取处理记录失败');
+          this.recordsLoading = false;
+          this.recordsList = [];
+          this.recordsTotal = 0;
+        });
+    },
+
+    /**
+     * 查看历史订单
+     */
+    handleViewHistoryOrders(row) {
+      // 重置查询参数,并设置userId
+      this.historyQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        userId: this.fsUserId, // 使用页面初始化时获取的fsUserId
+        orderCode: null // 清空搜索条件
+      };
+
+      // 打开弹窗
+      this.historyDialogVisible = true;
+      this.historyLoading = true;
+
+      // 调用内部加载方法
+      this.loadHistoryOrders();
+    },
+
+    /**
+     * 历史订单搜索
+     */
+    handleHistoryQuery() {
+      this.historyQueryParams.pageNum = 1;
+      this.loadHistoryOrders();
+    },
+
+    /**
+     * 重置历史订单查询条件
+     */
+    resetHistoryQuery() {
+      this.historyQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        userId: this.historyQueryParams.userId, // 保持userId不变
+        orderCode: null
+      };
+      this.loadHistoryOrders();
+    },
+
+    /**
+     * 历史订单分页
+     */
+    handleHistoryPagination(pagination) {
+      this.historyQueryParams.pageNum = pagination.page;
+      this.historyQueryParams.pageSize = pagination.limit;
+      this.loadHistoryOrders();
+    },
+
+    /**
+     * 加载历史订单数据(内部方法)
+     */
+    loadHistoryOrders() {
+      this.historyLoading = true;
+
+      // 调用API获取历史订单
+      userHistoryOrderList(this.historyQueryParams)
+        .then(response => {
+          // 根据接口返回的数据结构调整
+          this.historyList = response.rows || [];
+          this.historyTotal = response.total || 0;
+          this.historyLoading = false;
+        })
+        .catch(error => {
+          console.error('获取历史订单失败:', error);
+          this.$message.error('获取历史订单失败');
+          this.historyLoading = false;
+          this.historyList = [];
+          this.historyTotal = 0;
+        });
+    },
 
     /** 提交处理 */
     submitForm() {
@@ -384,6 +706,7 @@ export default {
           handleType: Number(this.form.handleType),
           remark: this.form.remark,
           doctorMemberSalesId: this.form.doctorMemberSalesId,
+          companyUserId: this.form.companyUserId
         };
 
         if (submitData.handleType === 1) {
@@ -401,12 +724,11 @@ export default {
         }
         submitDoctorTask(submitData).then(() => {
           this.$message.success('提交成功');
+          this.open = false;
+          this.getList();
         }).catch(() => {
           this.$message.error('提交失败');
         });
-
-        this.open = false;
-        this.getList();
       });
     },
   }
@@ -418,4 +740,19 @@ export default {
 .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>