Browse Source

订单查询及金牛需求

ct 2 ngày trước cách đây
mục cha
commit
5452a7e38b
2 tập tin đã thay đổi với 683 bổ sung121 xóa
  1. 12 3
      src/api/his/storeOrder.js
  2. 671 118
      src/views/his/storeOrder/order1.vue

+ 12 - 3
src/api/his/storeOrder.js

@@ -1,11 +1,11 @@
 import request from '@/utils/request'
 
 // 查询订单列表
-export function listOrder(query) {
+export function listOrder(data) {
   return request({
     url: '/his/storeOrder/list',
-    method: 'get',
-    params: query
+    method: 'post',
+    data: data
   })
 }
 // 下载导入模板
@@ -266,6 +266,15 @@ export function batchCreateErpOrder(data) {
   })
 }
 
+export function batchSetErpOrder(data) {
+  return request({
+    url: '/his/storeOrder/batchSetErpOrder',
+    method: 'post',
+    data: data
+  })
+}
+
+
 export function getErpAccount() {
   return request({
     url: '/his/storeOrder/getErpAccount',

+ 671 - 118
src/views/his/storeOrder/order1.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
       <el-form-item label="公司名" prop="companyId">
-          <el-select filterable  v-model="queryParams.companyId" placeholder="请选择公司名"  @change="companyChange" clearable size="small">
+          <el-select filterable  v-model="companyIds" placeholder="请选择公司名" multiple @change="companyChange" clearable size="small">
               <el-option
                 v-for="item in companys"
                 :key="item.companyId"
@@ -12,7 +12,7 @@
         </el-select>
       </el-form-item>
 
-     <el-form-item>
+     <el-form-item v-if="deptOpen">
         <treeselect style="width: 220px" :clearable="false"  v-model="queryParams.deptId"  :options="deptOptions" clearable :show-count="true" placeholder="请选择归属部门"  />
      </el-form-item>
      <el-form-item label="会员ID" prop="userId">
@@ -34,14 +34,60 @@
           />
         </el-select>
       </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 label="订单号" prop="orderCodes">
+        <div class="tag-input-container">
+          <!-- 标签显示区域 -->
+          <div class="tags-wrapper" @click="focusInput">
+            <!-- 已添加的订单号标签 -->
+            <el-tag
+              v-for="(code, index) in queryParams.orderCodes"
+              :key="index"
+              closable
+              size="small"
+              @close="removeOrderCode(index)"
+              class="order-tag"
+              :class="{ 'tag-error': false }"
+            >
+              {{ code }}
+            </el-tag>
+            
+            <!-- 输入框 -->
+            <el-input
+              ref="tagInput"
+              v-model="currentInput"
+              v-show="inputVisible || queryParams.orderCodes.length === 0"
+              :placeholder="queryParams.orderCodes.length === 0 ? '请输入订单号,按回车或逗号分隔' : '继续输入...'"
+              size="small"
+              class="tag-input"
+              @keydown.native="handleKeyDown"
+              @keyup.native="handleKeyUp"
+              @blur="handleInputConfirm"
+              @focus="inputVisible = true"
+              clearable
+            />
+            
+            <!-- 添加按钮(当没有输入时显示) -->
+            <el-button
+              v-if="!inputVisible && queryParams.orderCodes.length > 0"
+              class="button-new-tag"
+              size="small"
+              @click="showInput"
+              icon="el-icon-plus"
+              type="text"
+            >
+              添加订单号
+            </el-button>
+          </div>
+          
+          <!-- 输入提示 -->
+          <div class="input-tips">
+            <span class="tip-text">
+              支持:回车、逗号、空格分隔 | 
+              已添加 {{ queryParams.orderCodes.length }} 个订单号
+              <span v-if="maxOrderCodes > 0"> (最多{{ maxOrderCodes }}个)</span>
+            </span>
+          </div>
+        </div>
       </el-form-item>
       <el-form-item label="快递单号" prop="deliverySn">
         <el-input
@@ -309,7 +355,7 @@
             v-hasPermi="['store:storeOrder:importExpress']"
           >导入银行回单</el-button>
         </el-col>
-        <el-col :span="1.5" v-if="orderStatus == 5"> <!--待推送erp-->
+        <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6"> <!--待推送erp-->
           <el-tooltip content="默认erp推送手机号" placement="top">
             <el-button
               type="warning"
@@ -321,7 +367,7 @@
             >推送手机号码</el-button>
           </el-tooltip>
         </el-col>
-        <el-col :span="1.5" v-if="orderStatus == 5">
+        <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
           <el-tooltip content="批量设置erp推送手机号" placement="top">
             <el-button
               type="warning"
@@ -334,19 +380,19 @@
             >设置推送手机</el-button>
           </el-tooltip>
         </el-col>
-        <!-- <el-col :span="1.5" v-if="orderStatus == 5">
-          <el-tooltip content="批量推送erp" placement="top">
+        <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
+          <el-tooltip content="批量设置erp账户" placement="top">
             <el-button
               type="warning"
               plain
               icon="el-icon-s-cooperation"
               size="mini"
-              @click="createErpOrder"
+              @click="showErpAccountSetDialog"
               v-hasPermi="['his:storeOrder:createErpOrder']"
-            >创建erp</el-button>
+            >数据分捡</el-button>
           </el-tooltip>
-        </el-col> -->
-        <el-col :span="1.5" v-if="orderStatus == 5">
+        </el-col>
+        <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
           <el-tooltip content="批量推送erp" placement="top">
             <el-button
               type="warning"
@@ -364,31 +410,54 @@
         <el-tab-pane label="全部订单" name="10"></el-tab-pane>
         <el-tab-pane v-for="(item,index) in orderOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
       </el-tabs>
-      <el-table height="500" v-loading="loading" border :data="orderList" @selection-change="handleSelectionChange" >
+      <el-table ref="orderTable" height="500" v-loading="loading" border :data="orderList" @selection-change="handleSelectionChange"
+        @sort-change="handleSortChange" :default-sort="{prop: 'createTime', order: 'descending'}">
         <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="ERP电话" align="center" prop="erpPhone" v-if="SFDFopen && orderStatus!=null && orderStatus != 1"/>
+        <el-table-column label="ERP账号" align="center" prop="erpAccount" v-if="SFDFopen && orderStatus!=null && orderStatus != 1"/>
         <el-table-column label="处方单编号" align="center" prop="prescribeCode" width="180px"/>
         <el-table-column label="药品订单号" align="center" prop="orderCode" width="180px"/>
         <el-table-column label="所属公司" align="center" prop="companyName" />
-        <el-table-column label="员工" align="center" prop="companyUserName" />
+        <el-table-column label="员工" align="center" prop="companyUserName" sortable="custom" :sort-orders="['ascending', 'descending']">
+          <template slot="header" slot-scope="scope">
+            <span>员工</span>
+            <el-tooltip content="按员工姓名排序" placement="top"/>
+          </template>
+        </el-table-column>
         <el-table-column label="店铺名称" align="center" prop="storeName" />
         <el-table-column label="就诊人" align="center" prop="patientName" />
         <el-table-column label="收货人" align="center" prop="userName" />
-        <el-table-column label="套餐名称" align="center" prop="packageName" />
+        <el-table-column label="套餐名称" align="center" prop="packageName" width="100px" sortable="custom" :sort-orders="['ascending', 'descending']">
+          <template slot="header" slot-scope="scope">
+            <span>套餐名称</span>
+            <el-tooltip content="按套餐名称排序" placement="top"/>
+          </template>
+        </el-table-column>
         <el-table-column label="套餐别名" align="center" prop="packageSecondName" width="100px"/>
-        <el-table-column label="应收金额" align="center" prop="payPrice" />
-        <el-table-column label="实收金额" align="center" prop="payMoney" />
+        <el-table-column label="应收金额" align="center" prop="payPrice" width="100px" sortable="custom" :sort-orders="['ascending', 'descending']">
+          <template slot="header" slot-scope="scope">
+            <span>应收金额</span>
+            <el-tooltip content="按应收金额排序" placement="top"/>
+          </template>
+        </el-table-column>
+        <el-table-column label="实收金额" align="center" prop="payMoney" width="100px" sortable="custom" :sort-orders="['ascending', 'descending']">
+          <template slot="header" slot-scope="scope">
+            <span>实收金额</span>
+            <el-tooltip content="按实收金额排序" placement="top"/>
+          </template>
+        </el-table-column>
         <el-table-column label="支付方式" align="center" prop="payType" >
         <template slot-scope="scope">
                 <dict-tag :options="PayOptions" :value="scope.row.payType"/>
           </template>
         </el-table-column>
           <el-table-column label="下单时间" align="center" prop="createTime" width="180" />
-          <el-table-column label="支付时间" align="center" prop="payTime" width="180" />
-          <el-table-column label="订单状态" align="center" prop="status" >
-            <template slot-scope="scope">
-                  <dict-tag :options="orderOptions" :value="scope.row.status"/>
-            </template>
-          </el-table-column>
+        <el-table-column label="支付时间" align="center" prop="payTime" width="180" />
+        <el-table-column label="订单状态" align="center" prop="status" >
+          <template slot-scope="scope">
+                <dict-tag :options="orderOptions" :value="scope.row.status"/>
+          </template>
+        </el-table-column>
         <el-table-column label="订单来源" align="center" prop="source" >
           <template slot-scope="scope">
             <dict-tag :options="sourceOptions" :value="scope.row.source"/>
@@ -404,7 +473,6 @@
                 <dict-tag :options="deliveryPayStatusOptions" :value="scope.row.deliveryPayStatus"/>
           </template>
         </el-table-column>
-        <el-table-column label="ERP电话" align="center" prop="erpPhone" v-if="orderStatus == 5"/>
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
           <template slot-scope="scope">
               <el-button
@@ -423,6 +491,21 @@
         :limit.sync="queryParams.pageSize"
         @pagination="getList"
       />
+      <!-- 排序状态显示 -->
+      <div v-if="currentSort.prop" class="sort-info">
+        <el-tag size="small" type="info" closable @close="clearSort">
+          <i class="el-icon-sort"></i>
+          当前排序:{{ getSortLabel(currentSort.prop) }} 
+          {{ currentSort.order === 'ascending' ? '升序' : '降序' }}
+        </el-tag>
+          <el-button 
+            type="text" 
+            size="mini" 
+            @click="clearSort"
+            style="margin-left: 8px; color: #909399;"
+          >
+        </el-button>
+      </div>
       <el-drawer
             :with-header="false"
             size="75%"
@@ -576,18 +659,6 @@
               </el-option>
             </el-select>
           </el-form-item>
-          <!-- <el-form-item label="账户信息" v-if="selectedAccountInfo">
-            <div class="account-info">
-              <p><strong>账户名称:</strong>{{ selectedAccountInfo.accountName }}</p>
-              <p><strong>账户编码:</strong>{{ selectedAccountInfo.accountCode }}</p>
-              <p><strong>账户状态:</strong>
-                <el-tag :type="selectedAccountInfo.status === 1 ? 'success' : 'danger'">
-                  {{ selectedAccountInfo.status === 1 ? '正常' : '禁用' }}
-                </el-tag>
-              </p>
-              <p v-if="selectedAccountInfo.description"><strong>描述:</strong>{{ selectedAccountInfo.description }}</p>
-            </div>
-          </el-form-item> -->
         </el-form>
         
         <!-- 订单统计信息 -->
@@ -623,7 +694,7 @@
           @click="confirmCreateErpOrder"
           :disabled="!erpAccountForm.selectedAccount"
           :loading="erpAccountDialog.submitting"
-        >确认推送</el-button>
+        >确认</el-button>
       </div>
     </el-dialog>
   </div>
@@ -631,7 +702,7 @@
 
 <script>
 import { listOrder, getOrder, delOrder, addOrder,importExpressTemplate, updateOrder, exportOrder,importTemplate,exportOrder2,queryErpPhone,
-  saveErpPhone,editErpPhone,batchCreateErpOrder,getErpAccount } from "@/api/his/storeOrder";
+  saveErpPhone,editErpPhone,batchCreateErpOrder,getErpAccount,batchSetErpOrder } from "@/api/his/storeOrder";
 import storeOrderDetails from '../../components/his/storeOrderDetails.vue';
 import { getToken } from "@/utils/auth";
 import {listStore} from "@/api/his/storeProduct";
@@ -657,6 +728,35 @@ export default {
   // },
   data() {
     return {
+      // 新增排序相关数据
+      currentSort: {
+        prop: null,
+        order: null
+      },
+      
+      // 排序字段映射
+      sortFieldMap: {
+        'companyUserName': '员工',
+        'packageName': '套餐名称', 
+        'payPrice': '应收金额',
+        'payMoney': '实收金额',
+        'createTime': '下单时间'
+      },
+      erpSettingType:'set',
+      SFDFopen:false,
+      // 最大订单号数量限制
+      maxOrderCodes: {
+        type: Number,
+        default: 50
+      },
+      // 输入框是否可见
+      inputVisible: false,
+      
+      // 无效订单号对话框
+      showInvalidDialog: false,
+      // 当前输入值
+      currentInput: '',
+      deptOpen:true,
       // ERP账户相关数据
       erpAccountDialog: {
         open: false,
@@ -682,6 +782,7 @@ export default {
       companys:[],
       deptOptions:[],
       companyId:undefined,
+      companyIds:[],
       deptId:undefined,
       actName:"10",
       show:{
@@ -753,6 +854,7 @@ export default {
         pageSize: 10,
         storeId: null,
         orderCode: null,
+        orderCodes: [],
         userId: null,
         userName: null,
         userPhone: null,
@@ -801,7 +903,9 @@ export default {
         companyName:null,
         packageSecondName:null,
         isFirst:null,
-		source:null,
+		    source:null,
+        companyId:null,
+        companyIds:null
       },
       // 表单参数
       form: {},
@@ -827,7 +931,7 @@ export default {
     getCompanyList().then(response => {
         this.companys = response.data;
          if(this.companys!=null&&this.companys.length>0){
-          this.companyId=this.companys[0].companyId;
+          // this.companyId=this.companys[0].companyId;
           this.getTreeselect();
         }
         this.companys.push({companyId:"-1",companyName:"无"})
@@ -888,10 +992,248 @@ export default {
 
   },
   methods: {
+    // 新增排序处理方法
+    handleSortChange({ column, prop, order }) {
+      console.log('排序变化:', { column, prop, order });
+      
+      // 更新当前排序状态
+      this.currentSort = {
+        prop: prop,
+        order: order
+      };
+      
+      // 更新查询参数
+      if (order) {
+        this.queryParams.sortField = prop;
+        this.queryParams.sortOrder = order === 'ascending' ? 'asc' : 'desc';
+      } else {
+        this.queryParams.sortField = null;
+        this.queryParams.sortOrder = null;
+      }
+      
+      // 重新查询数据
+      this.queryParams.pageNum = 1; // 重置到第一页
+      this.getList();
+      
+      // 显示排序提示
+      if (order) {
+        const fieldLabel = this.getSortLabel(prop);
+        const orderLabel = order === 'ascending' ? '升序' : '降序';
+        this.$message.success(`已按${fieldLabel}${orderLabel}排序`);
+      }
+    },
+    
+    // 获取排序字段的中文标签
+    getSortLabel(prop) {
+      return this.sortFieldMap[prop] || prop;
+    },
+    
+    // 清除排序
+    clearSort() {
+      this.currentSort = {
+        prop: null,
+        order: null
+      };
+      this.queryParams.sortField = null;
+      this.queryParams.sortOrder = null;
+      this.queryParams.pageNum = 1;
+      // 重置表格排序状态 - 关键代码
+      this.$nextTick(() => {
+        if (this.$refs.orderTable) {
+          this.$refs.orderTable.clearSort();
+        }
+      });
+      this.getList();
+      this.$message.success('已清除排序');
+    },
+
+    // 修改查询列表方法,添加排序参数
+    getList() {
+      this.loading = true;
+      
+      // 处理多选参数
+      if(this.payTypeArr.length>0){
+        this.queryParams.payType=this.payTypeArr.toString();
+      } else {
+        this.queryParams.payType=null
+      }
+      
+      if(this.scheduleIdArr.length>0){
+        this.queryParams.scheduleId=this.scheduleIdArr.toString();
+      } else {
+        this.queryParams.scheduleId=null
+      }
+      
+      if(this.buyTypeArr.length>0){
+        this.queryParams.orderBuyType=this.buyTypeArr.toString();
+      } else {
+        this.queryParams.orderbuyType=null
+      }
+      
+      if(this.channelArr.length>0){
+        this.queryParams.orderChannel=this.channelArr.toString();
+      } else {
+        this.queryParams.orderChannel=null
+      }
+      
+      if(this.qwSubjectArr.length>0){
+        this.queryParams.qwSubject=this.qwSubjectArr.toString();
+      } else {
+        this.queryParams.qwSubject=null
+      }
+      
+      // 处理公司参数
+      if(this.companyIds && this.companyIds.length>1){
+        this.queryParams.companyIds = this.companyIds
+        this.queryParams.companyId = null;
+        this.queryParams.deptId = null;
+      } else {
+        this.queryParams.companyId = this.companyId
+        this.queryParams.companyIds = null;
+      }
+      
+      // 处理订单号数组
+      if (this.queryParams.orderCodes && this.queryParams.orderCodes.length > 0) {
+        this.queryParams.orderCodeList = this.queryParams.orderCodes.join(',');
+      } else {
+        this.queryParams.orderCodeList = null;
+      }
+      
+      console.log('查询参数:', this.queryParams);
+      
+      listOrder(this.queryParams).then(response => {
+        this.orderList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+        
+        if(response.msg == 'jnmy'){
+          this.SFDFopen = true;
+        } else{
+          this.SFDFopen = false;
+        }
+        
+        // 如果有排序,显示排序结果提示
+        if (this.currentSort.prop) {
+          const fieldLabel = this.getSortLabel(this.currentSort.prop);
+          const orderLabel = this.currentSort.order === 'ascending' ? '升序' : '降序';
+          console.log(`数据已按${fieldLabel}${orderLabel}加载`);
+        }
+      }).catch(error => {
+        console.error('查询失败:', error);
+        this.loading = false;
+        this.$message.error('查询数据失败');
+      });
+    },
+    // 处理键盘按下事件
+    handleKeyDown(event) {
+      const { key, target } = event
+      
+      // 处理退格键删除标签
+      if (key === 'Backspace' && !target.value && this.queryParams.orderCodes.length > 0) {
+        event.preventDefault()
+        this.removeOrderCode(this.queryParams.orderCodes.length - 1)
+      }
+      
+      // 处理分隔符
+      if ([',', ',', ' ', 'Enter'].includes(key)) {
+        event.preventDefault()
+        this.handleInputConfirm()
+      }
+    },
+    
+    // 处理键盘抬起事件(实时分割输入)
+    handleKeyUp(event) {
+      const value = event.target.value
+      
+      // 检查是否包含分隔符
+      if (/[,,\s]/.test(value)) {
+        this.handleInputConfirm()
+      }
+    },
+    
+    // 确认输入
+    handleInputConfirm() {
+      const inputValue = this.currentInput.trim()
+      
+      if (inputValue) {
+        // 分割多个订单号
+        const codes = inputValue.split(/[,,\s]+/).filter(code => code.trim())
+        
+        codes.forEach(code => {
+          this.addOrderCode(code.trim())
+        })
+      }
+      
+      this.currentInput = ''
+    },
+    
+    // 添加订单号
+    addOrderCode(code) {
+      if (!code) return
+      
+      // 检查数量限制
+      if (this.maxOrderCodes > 0 && this.queryParams.orderCodes.length >= this.maxOrderCodes) {
+        this.$message.warning(`最多只能添加 ${this.maxOrderCodes} 个订单号`)
+        return
+      }
+      
+      // 检查重复
+      if (this.queryParams.orderCodes.includes(code)) {
+        this.$message.warning(`订单号 "${code}" 已存在`)
+        return
+      }
+      
+      // 添加到列表
+      this.queryParams.orderCodes.push(code)
+      
+    },
+    
+    // 删除订单号
+    removeOrderCode(index) {
+      this.queryParams.orderCodes.splice(index, 1)
+    },
+    
+    // 清空所有标签
+    clearAllTags() {
+      this.$confirm('确认清空所有订单号吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.queryParams.orderCodes = []
+        this.$message.success('已清空所有订单号')
+      })
+    },
+    // 显示输入框
+    showInput() {
+      this.inputVisible = true
+      this.$nextTick(() => {
+        this.$refs.tagInput.focus()
+      })
+    },
+    // 删除订单号
+    removeOrderCode(index) {
+      this.queryParams.orderCodes.splice(index, 1)
+    },
+    // 聚焦输入框
+    focusInput() {
+      if (!this.inputVisible) {
+        this.showInput()
+      }
+    },
+    // 设置erp账户
+    showErpAccountSetDialog() {
+      this.erpAccountDialog.open = true;
+      this.erpAccountDialog.loading = true;
+      this.erpSettingType = 'set'
+      this.getErpAccountList();
+      this.calculateOrderSummary();
+    },
     // 修改:显示ERP账户选择对话框
     showErpAccountDialog() {
       this.erpAccountDialog.open = true;
       this.erpAccountDialog.loading = true;
+      this.erpSettingType = 'push'
       this.getErpAccountList();
       this.calculateOrderSummary();
     },
@@ -950,24 +1292,92 @@ export default {
         this.$message.warning('请选择ERP账户');
         return;
       }
+      console.log("-----------------",this.erpSettingType)
+      if(this.erpSettingType == 'set'){
+        this.$confirm(
+          `确认将订单设置ERP账户为"${this.erpAccountForm.selectedAccount}"吗?`, 
+          '确认', 
+          {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }
+        ).then(() => {
+          this.executSetErpOrder();
+        });
+      } else if(this.erpSettingType == 'push'){
+        this.$confirm(
+          `确认将订单推送到ERP账户"${this.erpAccountForm.selectedAccount}"吗?`, 
+          '确认推送', 
+          {
+            confirmButtonText: '确定推送',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }
+        ).then(() => {
+          this.executeCreateErpOrder();
+        });
+      }
       
-      // const selectedAccount = this.selectedAccountInfo;
-      // if (selectedAccount.status !== 1) {
-      //   this.$message.error('选中的ERP账户状态异常,无法推送');
-      //   return;
-      // }
+    },
+
+    async executSetErpOrder() {
+      this.erpAccountDialog.submitting = true;
       
-      this.$confirm(
-        `确认将订单推送到ERP账户"${this.erpAccountForm.selectedAccount}"吗?`, 
-        '确认推送', 
-        {
-          confirmButtonText: '确定推送',
-          cancelButtonText: '取消',
-          type: 'warning'
+      try {
+        let param = {
+          loginAccount: this.erpAccountForm.selectedAccount
+        };
+        
+        if (this.ids.length > 0) {
+          // 如果有选中的订单,只推送选中的
+          param.orderIds = this.ids;
+        } else {
+          // 如果没有选中订单,推送查询条件下的所有订单
+          if (this.payTypeArr.length > 0) {
+            this.queryParams.payType = this.payTypeArr.toString();
+          } else {
+            this.queryParams.payType = null;
+          }
+          if (this.scheduleIdArr.length > 0) {
+            this.queryParams.scheduleId = this.scheduleIdArr.toString();
+          } else {
+            this.queryParams.scheduleId = null;
+          }
+          if (this.buyTypeArr.length > 0) {
+            this.queryParams.orderBuyType = this.buyTypeArr.toString();
+          } else {
+            this.queryParams.orderBuyType = null;
+          }
+          if (this.channelArr.length > 0) {
+            this.queryParams.orderChannel = this.channelArr.toString();
+          } else {
+            this.queryParams.orderChannel = null;
+          }
+          if (this.qwSubjectArr.length > 0) {
+            this.queryParams.qwSubject = this.qwSubjectArr.toString();
+          } else {
+            this.queryParams.qwSubject = null;
+          }
+          
+          // 合并查询参数
+          param = { ...param, ...this.queryParams };
         }
-      ).then(() => {
-        this.executeCreateErpOrder();
-      });
+        
+        const response = await batchSetErpOrder(param);
+        if (response.code === 200) {
+          this.$message.success('订单ERP账号设置成功');
+          this.cancelErpAccountDialog();
+          this.getList(); // 刷新列表
+        } else {
+          this.$message.error(response.msg || 'ERP账号设置失败');
+        }
+      } catch (error) {
+        console.error('ERP账号设置失败:', error);
+        this.$message.error('ERP账号设置失败');
+      } finally {
+        this.erpAccountDialog.submitting = false;
+      }
     },
     
     //执行创建ERP订单
@@ -1037,57 +1447,6 @@ export default {
       this.orderSummary = null;
       this.erpAccountList = [];
     },
-    createErpOrder(){
-      this.$confirm('确认创建erp?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        let param = {};
-        if(this.ids.length>0){
-          param = {orderIds:this.ids};
-        } else {
-          if(this.payTypeArr.length>0){
-            this.queryParams.payType=this.payTypeArr.toString();
-          }
-          else{
-            this.queryParams.payType=null
-          }
-          if(this.scheduleIdArr.length>0){
-            this.queryParams.scheduleId=this.scheduleIdArr.toString();
-          }
-          else{
-            this.queryParams.scheduleId=null
-          }
-          if(this.buyTypeArr.length>0){
-            this.queryParams.orderBuyType=this.buyTypeArr.toString();
-          }
-          else{
-            this.queryParams.orderbuyType=null
-          }
-          if(this.channelArr.length>0){
-            this.queryParams.orderChannel=this.channelArr.toString();
-          }
-          else{
-            this.queryParams.orderChannel=null
-          }
-          if(this.qwSubjectArr.length>0){
-            this.queryParams.qwSubject=this.qwSubjectArr.toString();
-          }
-          else{
-            this.queryParams.qwSubject=null
-          }
-          param = this.queryParams;
-        }
-        batchCreateErpOrder(param).then(response=>{
-          if(response.code == 200){
-            this.$message.success('创建成功');
-            this.getList();
-          }
-        })
-        
-      });
-    },
     handleCancelErpPhone(){
       this.erpPhoneValue = [];
       this.setPhoneOpen = false;
@@ -1369,10 +1728,23 @@ export default {
       else{
         this.queryParams.qwSubject=null
       }
+      if(this.companyIds && this.companyIds.length>1){
+        this.queryParams.companyIds = this.companyIds
+        this.queryParams.companyId = null;
+        this.queryParams.deptId = null;
+      } else {
+        this.queryParams.companyId = this.companyId
+        this.queryParams.companyIds = null;
+      }
       listOrder(this.queryParams).then(response => {
         this.orderList = response.rows;
         this.total = response.total;
         this.loading = false;
+        if(response.msg == 'jnmy'){
+          this.SFDFopen = true;
+        } else{
+          this.SFDFopen = false;
+        }
       });
 
     },
@@ -1493,10 +1865,10 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
-       this.createTime=null;
+      this.createTime=null;
       this.queryParams.sTime=null;
       this.queryParams.eTime=null;
-       this.payTime=null;
+      this.payTime=null;
       this.queryParams.paysTime=null;
       this.queryParams.payeTime=null;
       this.queryParams.deliveryImportTime = null;
@@ -1507,6 +1879,28 @@ export default {
       this.queryParams.deliverySendeTime = null;
       this.queryParams.tuisTIme = null;
       this.queryParams.tuieTIme = null;
+      this.companyIds = null;
+      this.companyId = null;
+       // 清除排序
+       this.currentSort = {
+        prop: null,
+        order: null
+      };
+      this.queryParams.sortField = null;
+      this.queryParams.sortOrder = null;
+      
+      // 清除订单号标签
+      this.queryParams.orderCodes = [];
+      this.currentInput = '';
+      this.inputVisible = false;
+
+       // 重置表格排序状态 - 关键代码
+       this.$nextTick(() => {
+        if (this.$refs.orderTable) {
+          this.$refs.orderTable.clearSort();
+        }
+      });
+      
       this.handleQuery();
     },
     // 多选框选中数据
@@ -1700,10 +2094,23 @@ export default {
       });
     },
      companyChange(val){
-      console.log(val);
-      this.companyId=val;
-      this.getTreeselect();
+      console.log(this.companyIds);
+      if(this.companyIds.length>1){
+        this.deptOpen = false;
+      } else {
+        this.deptOpen = true
+        if(this.companyIds.length=1){
+          this.companyId=this.companyIds[0];
+          this.getTreeselect();
+        }
+      }
+      
     },
+    // companyChange(val){
+    //   console.log(val);
+    //   this.companyId=val;
+    //   this.getTreeselect();
+    // },
      currDeptChange(val){
           console.log(val)
           this.queryParams.deptId=val;
@@ -1711,4 +2118,150 @@ export default {
     },
   }
 };
-</script>
+</script>
+<style scoped>
+.tag-input-order-search {
+  padding: 20px;
+  background: #fff;
+  border-radius: 4px;
+}
+
+.tag-input-container {
+  min-width: 445px;
+}
+
+.tags-wrapper {
+  min-height: 32px;
+  padding: 4px 8px;
+  border: 1px solid #dcdfe6;
+  border-radius: 4px;
+  cursor: text;
+  display: flex;
+  flex-wrap: wrap;
+  align-items: center;
+  gap: 4px;
+  transition: border-color 0.2s;
+}
+
+.tags-wrapper:hover {
+  border-color: #c0c4cc;
+}
+
+.tags-wrapper:focus-within {
+  border-color: #409eff;
+  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
+}
+
+.order-tag {
+  margin: 2px;
+  flex-shrink: 0;
+}
+
+.tag-error {
+  background-color: #fef0f0;
+  border-color: #fbc4c4;
+  color: #f56c6c;
+}
+
+.tag-input {
+  border: none;
+  outline: none;
+  flex: 1;
+  min-width: 120px;
+}
+
+.tag-input >>> .el-input__inner {
+  border: none;
+  padding: 0;
+  height: 24px;
+  line-height: 24px;
+}
+
+.button-new-tag {
+  height: 24px;
+  line-height: 22px;
+  padding: 0 8px;
+  margin: 2px;
+}
+
+.input-tips {
+  margin-top: 4px;
+  font-size: 12px;
+  color: #909399;
+}
+
+/* 新增排序相关样式 */
+.sort-info {
+  margin-top: 10px;
+  padding: 8px 0;
+}
+
+
+.tip-text {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+}
+
+.quick-actions {
+  margin-top: 12px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 8px 0;
+  border-top: 1px solid #ebeef5;
+}
+
+.stats-info {
+  font-size: 12px;
+  color: #909399;
+  display: flex;
+  align-items: center;
+  gap: 4px;
+}
+
+.invalid-codes-list {
+  margin: 16px 0;
+  max-height: 200px;
+  overflow-y: auto;
+}
+
+.invalid-tag {
+  margin: 4px;
+}
+
+.debug-preview {
+  margin-top: 20px;
+}
+
+.debug-content {
+  font-size: 12px;
+}
+
+.debug-content code {
+  display: block;
+  background: #f5f5f5;
+  padding: 8px;
+  border-radius: 4px;
+  margin: 4px 0 12px 0;
+  white-space: pre-wrap;
+}
+
+/* 响应式设计 */
+@media (max-width: 768px) {
+  .tag-input-container {
+    min-width: auto;
+    width: 100%;
+  }
+  
+  .tags-wrapper {
+    min-height: 40px;
+  }
+  
+  .quick-actions {
+    flex-direction: column;
+    align-items: flex-start;
+    gap: 8px;
+  }
+}
+</style>