Преглед на файлове

销售端可以修改企微主体的小程序,和备用小程序

xw преди 2 седмици
родител
ревизия
8cc81731a3

+ 9 - 0
src/api/company/companyConfig.js

@@ -50,5 +50,14 @@ export function saveCompanyMiniApp(data) {
   })
   })
 }
 }
 
 
+// 保存主备小程序配置(仅当前登录公司)
+export function updateMiniAppMasterServer(data) {
+  return request({
+    url: '/company/companyConfig/miniAppMasterServer',
+    method: 'put',
+    data: data
+  })
+}
+
 
 
 
 

+ 9 - 0
src/api/course/coursePlaySourceConfig.js

@@ -8,6 +8,15 @@ export function list(query) {
   })
   })
 }
 }
 
 
+/** 查询全部播放源配置(不分页,用于下拉等) */
+export function listAll() {
+  return request({
+    url: '/course/playSourceConfig/list',
+    method: 'get',
+    params: { pageNum: 1, pageSize: 9999 }
+  })
+}
+
 export function get(id) {
 export function get(id) {
   return request({
   return request({
     url: '/course/playSourceConfig/' + id,
     url: '/course/playSourceConfig/' + id,

+ 19 - 0
src/api/hisStore/storeOrder.js

@@ -178,3 +178,22 @@ export function editPayDelivery(data) {
   })
   })
 }
 }
 
 
+
+
+
+export function importDeliveryNoteExpressTemplate() {
+  return request({
+    url: '/store/store/storeOrder/importDeliveryNoteExpressTemplate',
+    method: 'get'
+  })
+}
+
+
+// 导出发货单
+export function exportShippingOrder(query) {
+  return request({
+    url: '/store/store/storeOrder/exportShippingOrder',
+    method: 'get',
+    params: query
+  })
+}

+ 17 - 0
src/api/qw/qwCompany.js

@@ -55,4 +55,21 @@ export function exportQwCompany(query) {
     method: 'get',
     method: 'get',
     params: query
     params: query
   })
   })
+}
+
+// 批量更换小程序ID
+export function batchUpdateMiniAppId(data) {
+  return request({
+    url: '/qw/qwCompany/batchUpdateMiniAppId',
+    method: 'post',
+    data: data
+  })
+}
+
+// 获取小程序列表
+export function getMiniAppList() {
+  return request({
+    url: '/qw/qwCompany/getMiniAppList',
+    method: 'get'
+  })
 }
 }

+ 83 - 2
src/views/company/companyConfig/index.vue

@@ -211,6 +211,45 @@
             </div>
             </div>
           </el-form>
           </el-form>
         </el-tab-pane>
         </el-tab-pane>
+        <!-- 主备小程序:下拉仅选本公司配置的小程序,选项来自 getCompanyMiniAppList(后端已按登录公司过滤) -->
+        <el-tab-pane label="主备小程序" name="miniAppConfig">
+          <el-form ref="miniAppConfigForm" :model="miniAppConfigForm" label-width="120px">
+            <el-form-item label="主要小程序">
+              <el-select
+                v-model="miniAppConfigForm.mainMiniAppId"
+                placeholder="请选择主要小程序"
+                clearable
+                style="width:400px"
+              >
+                <el-option
+                  v-for="item in companyMiniAppList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.appid || item.appId"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="备用小程序">
+              <el-select
+                v-model="miniAppConfigForm.backupMiniAppId"
+                placeholder="请选择备用小程序"
+                clearable
+                style="width:400px"
+              >
+                <el-option
+                  v-for="item in companyMiniAppList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.appid || item.appId"
+                />
+              </el-select>
+            </el-form-item>
+            <div class="line"></div>
+            <div style="float:right;margin-right:20px">
+              <el-button type="primary" @click="onSubmitMiniApp">保存</el-button>
+            </div>
+          </el-form>
+        </el-tab-pane>
       </el-tabs>
       </el-tabs>
 
 
       <el-dialog :title="customerExt.title" :visible.sync="customerExt.open" width="500px" append-to-body>
       <el-dialog :title="customerExt.title" :visible.sync="customerExt.open" width="500px" append-to-body>
@@ -238,7 +277,7 @@
 
 
 <script>
 <script>
 import { getCompanyInfo } from "@/api/company/company";
 import { getCompanyInfo } from "@/api/company/company";
-import { getConfigKey,updateConfig,configUserCheck } from "@/api/company/companyConfig";
+import { getConfigKey, updateConfig, configUserCheck, updateMiniAppMasterServer, getCompanyMiniAppList } from "@/api/company/companyConfig";
 import { listCustomerExt, getCustomerExt, delCustomerExt, addCustomerExt, updateCustomerExt } from "@/api/crm/customerExt";
 import { listCustomerExt, getCustomerExt, delCustomerExt, addCustomerExt, updateCustomerExt } from "@/api/crm/customerExt";
 
 
 export default {
 export default {
@@ -307,7 +346,13 @@ export default {
       userIsDefaultBlack: null,
       userIsDefaultBlack: null,
       redPacketConfig:{},
       redPacketConfig:{},
 
 
-      redPacketConfigForm:{}
+      redPacketConfigForm:{},
+      // 主备小程序:选项仅来自 getCompanyMiniAppList 的 data(后端已按本公司过滤,不传 companyId)
+      companyMiniAppList: [],
+      miniAppConfigForm: {
+        mainMiniAppId: null,
+        backupMiniAppId: null
+      }
     };
     };
   },
   },
   created() {
   created() {
@@ -319,6 +364,7 @@ export default {
     this.getConfigKey("sys:AiKf:config");
     this.getConfigKey("sys:AiKf:config");
     this.getConfigKey("company:admin:show");
     this.getConfigKey("company:admin:show");
     this.getConfigKey("redPacket:config");
     this.getConfigKey("redPacket:config");
+    this.loadMiniAppMasterServer();
     this.getDicts("sys_company_status").then((response) => {
     this.getDicts("sys_company_status").then((response) => {
       this.statusOptions = response.data;
       this.statusOptions = response.data;
     });
     });
@@ -540,6 +586,41 @@ export default {
         }
         }
       })
       })
     },
     },
+    /** 主备小程序:拉取下拉选项 + 当前选中。接口已按登录公司过滤,仅本公司 fs_course_play_source_config 中的小程序 */
+    loadMiniAppMasterServer() {
+      getCompanyMiniAppList().then(res => {
+        this.companyMiniAppList = res.data || [];
+        const current = res.current;
+        if (current) {
+          this.miniAppConfigForm.mainMiniAppId = current.mainMiniAppId ?? null;
+          this.miniAppConfigForm.backupMiniAppId = current.backupMiniAppId ?? null;
+        } else {
+          this.miniAppConfigForm.mainMiniAppId = null;
+          this.miniAppConfigForm.backupMiniAppId = null;
+        }
+      }).catch(() => {
+        this.companyMiniAppList = [];
+        this.miniAppConfigForm.mainMiniAppId = null;
+        this.miniAppConfigForm.backupMiniAppId = null;
+      });
+    },
+    /** 保存主备小程序:提交 appId 数组,后端按登录态仅允许改本公司,不传 companyId */
+    onSubmitMiniApp() {
+      const miniAppMaster = this.miniAppConfigForm.mainMiniAppId
+        ? [this.miniAppConfigForm.mainMiniAppId]
+        : [];
+      const miniAppServer = this.miniAppConfigForm.backupMiniAppId
+        ? [this.miniAppConfigForm.backupMiniAppId]
+        : [];
+      updateMiniAppMasterServer({ miniAppMaster, miniAppServer }).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess("保存成功");
+          this.loadMiniAppMasterServer();
+        }
+      }).catch(() => {
+        this.msgError("保存失败");
+      });
+    },
   }
   }
 };
 };
 </script>
 </script>

+ 1 - 1
src/views/course/courseWatchLog/index.vue

@@ -123,7 +123,7 @@
           </el-option>
           </el-option>
         </el-select>
         </el-select>
       </el-form-item>
       </el-form-item>
-      <el-form-item label="所属企微" prop="qwUserName" v-if="queryParams.companyUserId">
+      <el-form-item label="所属企微" prop="qwUserName" v-if="queryParams.sendType == 2">
         <el-select v-model="queryParams.qwUserName"
         <el-select v-model="queryParams.qwUserName"
                    clearable filterable
                    clearable filterable
                    placeholder="请输入关键词"
                    placeholder="请输入关键词"

+ 3325 - 0
src/views/hisStore/storeOrder/storeList.vue

@@ -0,0 +1,3325 @@
+<template>
+  <div class="app-container">
+    <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px">
+
+      <!-- <el-form-item label="订单号" prop="orderCode">
+        <el-input
+          v-model="queryParams.orderCode"
+          clearable
+          placeholder="请输入订单号"
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item> -->
+
+      <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="deliveryId">
+        <el-input
+          v-model="queryParams.deliveryId"
+          clearable
+          placeholder="请输入运单号"
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="银行交易流水号" prop="bankTransactionId">
+        <el-input
+          v-model="queryParams.bankTransactionId"
+          placeholder="请输入银行交易流水号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="产品名称" prop="productName">
+        <el-input
+          v-model="queryParams.productName"
+          placeholder="请输入产品名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="手机号" prop="userPhone">
+        <el-input
+          v-model="queryParams.userPhone"
+          placeholder="请输入手机号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="收件人" prop="realName">
+        <el-input
+          v-model="queryParams.realName"
+          placeholder="请输入收件人姓名"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"/>
+      </el-form-item>
+
+      <el-form-item label="销售名称" prop="companyUserNickName">
+        <el-input
+          v-model="queryParams.companyUserNickName"
+          placeholder="请输入销售名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="订单类型" prop="orderType">
+         <el-select   v-model="queryParams.orderType" placeholder="请选择订单类型" clearable size="small" >
+         <el-option
+                v-for="item in orderTypeOptions"
+                :key="item.dictValue"
+                :label="item.dictLabel"
+                :value="item.dictValue"
+              />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="支付方式" prop="payType">
+         <el-select   v-model="queryParams.payType" placeholder="请选择支付方式" clearable size="small" >
+         <el-option
+                v-for="item in payTypeOptions"
+                :key="item.dictValue"
+                :label="item.dictLabel"
+                :value="item.dictValue"
+              />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="上传凭证" prop="isUpload">
+         <el-select   v-model="queryParams.isUpload" placeholder="请选择" clearable size="small" >
+          <el-option key="0"  label="未上传" value="0" />
+             <el-option key="1"  label="已上传" value="1" />
+        </el-select>
+      </el-form-item>
+
+
+
+      <el-form-item label="物流状态" prop="deliveryStatus">
+         <el-select   v-model="queryParams.deliveryStatus" placeholder="请选择物流状态" clearable size="small" >
+         <el-option
+                v-for="item in deliveryStatusOptions"
+                :key="item.dictValue"
+                :label="item.dictLabel"
+                :value="item.dictValue"
+              />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="结算状态" prop="deliveryPayStatus">
+         <el-select  v-model="queryParams.deliveryPayStatus" placeholder="请选择物流结算状态" clearable size="small" >
+         <el-option
+                v-for="item in deliveryPayStatusOptions"
+                :key="item.dictValue"
+                :label="item.dictLabel"
+                :value="item.dictValue"
+              />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="小程序" prop="appId">
+        <el-select v-model="queryParams.appId" placeholder="请选择所属小程序" clearable size="small">
+          <el-option
+            v-for="dict in appMallOptions"
+            :key="dict.appid"
+            :label="dict.name + '(' + dict.appid + ')'"
+            :value="dict.appid"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="下单时间" prop="createTimeRange">
+        <el-date-picker
+          v-model="createTimeRange"
+          clearable end-placeholder="结束日期"
+          size="small"
+          start-placeholder="开始日期"
+          style="width:205.4px"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+        >
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="支付时间" prop="payTimeRange">
+        <el-date-picker
+          v-model="payTimeRange"
+          clearable end-placeholder="结束日期"
+          size="small"
+          start-placeholder="开始日期"
+          style="width:205.4px"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+        >
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="发货时间" prop="deliverySendTimeRange">
+        <el-date-picker
+          v-model="deliverySendTimeRange"
+          clearable end-placeholder="结束日期"
+          size="small"
+          start-placeholder="开始日期"
+          style="width:205.4px"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+        >
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="回单时间" prop="deliveryImportTimeRange">
+        <el-date-picker
+          v-model="deliveryImportTimeRange"
+          clearable end-placeholder="结束日期"
+          size="small"
+          start-placeholder="开始日期"
+          style="width:205.4px"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+        >
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="档期归属" prop="scheduleId"  >
+            <el-select filterable style="width: 215px" v-model="queryParams.scheduleId" placeholder="请选择档期" clearable size="small" >
+              <el-option
+                      v-for="item in scheduleOptions"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    />
+            </el-select>
+        </el-form-item>
+        <el-form-item label="代服账户" prop="erpAccount" v-if="SFDFopen">
+          <el-select v-model="queryParams.erpAccount" style="width: 215px" placeholder="ERP账户" clearable size="small">
+            <el-option
+              v-for="dict in erpAccountQueryList"
+              :key="dict"
+              :label="dict"
+              :value="dict"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="代服电话" prop="erpPhoneNumber" v-if="SFDFopen">
+          <el-input
+            v-model="queryParams.erpPhoneNumber"
+            placeholder="ERP电话"
+            clearable
+            size="small"
+            @keyup.enter.native="handleQuery"
+          />
+        </el-form-item>
+      <el-form-item label="是否审核" prop="isAudit">
+        <el-select   v-model="queryParams.isAudit" placeholder="请选择" clearable size="small" >
+          <el-option key="1"  label="是" value="1" />
+          <el-option key="0"  label="否" value="0" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button icon="el-icon-search" size="mini" type="cyan" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <el-row :gutter="10" class="mb8">
+      <!-- <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['store:storeOrder:add']"
+        >创建订单</el-button>
+      </el-col> -->
+      <el-col :span="1.5">
+        <el-button
+          v-hasPermi="['store:storeOrder:exportShippingOrder']"
+          icon="el-icon-tickets"
+          size="mini"
+          type="success"
+          @click="handleExportShippingOrder"
+        >导出发货单
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          icon="el-icon-upload2"
+          plain
+          size="mini"
+          type="success"
+          :loading="orderUpload.isUploading"
+          :disabled="orderUpload.isUploading"
+          @click="openDeliveryNote"
+        >{{ orderUpload.isUploading ? '导入中...' : '导入发货单' }}
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
+      <el-tab-pane label="全部订单" name="00"></el-tab-pane>
+      <el-tab-pane label="待支付" name="0"></el-tab-pane>
+      <el-tab-pane label="待推送" name="6"></el-tab-pane>
+      <el-tab-pane label="待发货" name="1"></el-tab-pane>
+      <el-tab-pane label="待收货" name="2"></el-tab-pane>
+      <el-tab-pane label="交易完成" name="3"></el-tab-pane>
+      <el-tab-pane label="退款中" name="-1"></el-tab-pane>
+      <el-tab-pane label="已退款" name="-2"></el-tab-pane>
+      <el-tab-pane label="已取消" name="-3"></el-tab-pane>
+    </el-tabs>
+    <el-table  height="500" border v-loading="loading" :data="storeOrderList" @selection-change="handleSelectionChange" @sort-change="handleSortChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="订单号" align="center" prop="orderCode" width="200px" />
+      <el-table-column label="银行交易流水号" align="center" prop="bankTransactionId" width="180" />
+      <el-table-column label="ERP电话" align="center" prop="erpPhone" width="120px" v-if="SFDFopen "/>
+      <el-table-column label="ERP账号" align="center" prop="erpAccount" width="120px" v-if="SFDFopen"/>
+      <el-table-column label="所属公司" align="center" prop="companyName" />
+      <el-table-column label="小程序名称" width="120px" align="center" prop="miniProgramName"/>
+      <el-table-column label="手机号" align="center" prop="nickname" width="150px" >
+          <template slot-scope="scope">
+              <span>{{scope.row.nickname}} </span>
+          </template>
+      </el-table-column>
+      <el-table-column align="center" label="收件人" prop="realName" width="150px">
+        <template slot-scope="scope">
+          <span>{{ scope.row.realName }} </span>
+        </template>
+      </el-table-column>
+      <!-- <el-table-column label="商品" align="center" width="300px" >
+          <template slot-scope="scope">
+              <div  v-for="(item, index) in scope.row.items" class="items"  >
+                <img class="pic" :src="JSON.parse(item.jsonInfo).image" />
+                <div class="goods-content">
+                  <div class="goods-title">{{ JSON.parse(item.jsonInfo).productName}}</div>
+                  <div class="sku">{{ JSON.parse(item.jsonInfo).sku}}</div>
+                  <div class="price">¥{{JSON.parse(item.jsonInfo).price}}×{{item.num}}</div>
+                </div>
+              </div>
+          </template>
+      </el-table-column> -->
+      <el-table-column align="center" label="订单金额" prop="totalPrice">
+        <template slot-scope="scope">
+          <span v-if="scope.row.totalPrice!=null">{{ scope.row.totalPrice.toFixed(2) }}</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="成本价格" align="center" prop="cost" v-if="showFinanceTableField"/>
+      <el-table-column label="结算价格" align="center" prop="fprice"  v-if="showFinanceTableField"/>
+      <el-table-column label="额外运费" align="center" prop="payPostage" v-if="showFinanceTableField"/>
+      <el-table-column label="商品编码" align="center" prop="barCode"  v-if="showFinanceTableField"/>
+      <el-table-column label="商品分类" align="center" prop="cateName" v-if="showFinanceTableField"/>
+       <!-- <el-table-column label="应付金额" align="center" prop="payPrice" >
+          <template slot-scope="scope">
+              <span v-if="scope.row.payPrice!=null">{{scope.row.payPrice.toFixed(2)}}</span>
+          </template>
+      </el-table-column> -->
+      <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" >
+        <template slot="header" slot-scope="scope">
+          <span>实收金额</span>
+          <el-tooltip content="按实收金额排序" placement="top"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="物流代收金额" align="center" prop="payDelivery" >
+          <template slot-scope="scope">
+              <span v-if="scope.row.payPrice!=null">{{scope.row.payDelivery.toFixed(2)}}</span>
+          </template>
+      </el-table-column>
+      <el-table-column label="下单时间" align="center" prop="createTime" />
+      <el-table-column label="审核时间" align="center" prop="auditTime" />
+      <!-- <el-table-column label="支付状态" align="center" prop="paid" /> -->
+      <el-table-column align="center" label="支付时间" prop="payTime" width="180">
+      </el-table-column>
+      <el-table-column label="发货时间" align="center" prop="deliverySendTime" width="180"></el-table-column>
+      <el-table-column align="center" label="支付方式" prop="payType">
+        <template slot-scope="scope">
+          <el-tag v-for="(item, index) in payTypeOptions" v-if="scope.row.payType==item.dictValue" prop="payType">
+            {{ item.dictLabel }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="订单类型" prop="orderType">
+        <template slot-scope="scope">
+          <el-tag v-for="(item, index) in orderTypeOptions" v-if="scope.row.orderType==item.dictValue" prop="orderType">
+            {{ item.dictLabel }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="媒体来源" prop="orderMedium">
+        <template slot-scope="scope">
+          <el-tag v-for="(item, index) in orderMediumOptions" v-if="scope.row.orderMedium==item.dictValue"
+                  prop="orderMedium"
+          >{{ item.dictLabel }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="产品名称" align="center" width="200px">
+        <template slot-scope="scope">
+          <div v-if="scope.row.items && scope.row.items.length > 0">
+            <el-tag
+              v-for="(item, index) in scope.row.items"
+              :key="index"
+              size="mini"
+              class="product-tag"
+            >
+              {{ JSON.parse(item.jsonInfo).productName }} × {{ item.num }}
+            </el-tag>
+          </div>
+          <span v-else class="no-products">暂无商品</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="是否审核" align="center" prop="isAudit" width="100px">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.isAudit == 1 ? 'success' : 'info'" size="small">
+            {{ scope.row.isAudit == 1 ? '是' : '否' }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status" >
+          <template slot-scope="scope">
+              <el-tag prop="status" v-for="(item, index) in statusOptions"    v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
+          </template>
+      </el-table-column>
+      <el-table-column align="center" label="运单号" prop="deliveryId">
+      </el-table-column>
+      <el-table-column align="center" label="物流状态" prop="deliveryStatus">
+        <template slot-scope="scope">
+          <el-tag v-for="(item, index) in deliveryStatusOptions" v-if="scope.row.deliveryStatus==item.dictValue"
+                  prop="status"
+          >{{ item.dictLabel }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="物流结算状态" prop="deliveryPayStatus">
+        <template slot-scope="scope">
+          <el-tag v-for="(item, index) in deliveryPayStatusOptions" v-if="scope.row.deliveryPayStatus==item.dictValue"
+                  prop="status"
+          >{{ item.dictLabel }}
+          </el-tag>
+        </template>
+      </el-table-column>
+
+      <el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" width="80px">
+        <template slot-scope="scope">
+          <el-button
+            v-hasPermi="['store:storeOrder:query']"
+            size="mini"
+            type="text"
+            @click="handleDetails(scope.row)"
+          >查看</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleOrderAudit(scope.row)"
+            v-hasPermi="['store:storeOrder:batchAudit']"
+          >确认审核</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleOrderReamrk(scope.row)"
+            v-hasPermi="['store:storeOrder:remark']"
+          >订单备注</el-button>
+          <!-- <el-button
+            size="mini"
+            type="text"
+            @click="handleGenPayUrl(scope.row)"
+            v-hasPermi="['store:storeOrder:genPayUrl']"
+          >生成付款链接</el-button> -->
+        </template>
+      </el-table-column>
+    </el-table>
+<!--    <div>-->
+<!--        商品数量合计:{{ productInfo }}-->
+<!--    </div>-->
+    <!-- 排序状态显示 -->
+    <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>
+
+    <pagination
+      v-show="total>0"
+      :limit.sync="queryParams.pageSize"
+      :page.sync="queryParams.pageNum"
+      :total="total"
+      @pagination="getList"
+    />
+    <el-drawer :title="show.title" :visible.sync="show.open" size="75%">
+      <product-order ref="order"/>
+    </el-drawer>
+
+    <el-dialog v-if="open" :title="title" :visible.sync="open" append-to-body width="1000px">
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-form-item label="会员信息" prop="userId">
+          <el-row>
+            <el-col>
+              <el-input v-model="phone" placeholder="请输入会员手机号" style="width:240px;cursor:pointer">
+              </el-input>
+              <el-button plain style="margin-left:10px;" @click="searchUser()">查询</el-button>
+              <el-button icon="el-icon-plus" plain style="margin-left:10px;" type="primary" @click="handleAddUser()">
+                添加会员
+              </el-button>
+            </el-col>
+          </el-row>
+          <el-table v-loading="userloading" :data="users" border style="margin-top:5px;">
+            <el-table-column align="center" label="ID" prop="userId"/>
+            <el-table-column align="center" label="会员头像" width="80">
+              <template slot-scope="scope">
+                <el-popover
+                  placement="right"
+                  title=""
+                  trigger="hover"
+                >
+                  <img slot="reference" :src="scope.row.avatar" width="50">
+                  <img :src="scope.row.avatar" style="max-width: 120px;">
+                </el-popover>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="昵称" prop="nickname"/>
+            <el-table-column align="center" label="手机号" prop="phone"/>
+            <el-table-column align="center" label="状态" prop="status">
+              <template slot-scope="scope">
+                <el-tag v-for="(item, index) in userStatusOptions" v-if="scope.row.status==item.dictValue"
+                        prop="status"
+                >{{ item.dictLabel }}
+                </el-tag>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+        <el-form-item label="收货信息" prop="addressId">
+          <el-row>
+            <el-col>
+              <el-button icon="el-icon-plus" plain type="primary" @click="handleAddUserAddress()">添加收货地址
+              </el-button>
+            </el-col>
+          </el-row>
+          <el-radio-group v-model="form.addressId" style="width:100%">
+            <el-table v-loading="addressloading" :data="address" border style="margin-top:5px;">
+              <el-table-column align="center" label="ID">
+                <template slot-scope="scope">
+                  <el-radio :label="scope.row.id"></el-radio>
+                </template>
+              </el-table-column>
+              <el-table-column align="center" label="收货人姓名" prop="realName"/>
+              <el-table-column align="center" label="收货人电话" prop="phone"/>
+              <el-table-column align="center" label="地址" prop="detail">
+                <template slot-scope="scope">
+                  {{ scope.row.province }} {{ scope.row.city }} {{ scope.row.district }} {{ scope.row.detail }}
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="商品列表">
+          <el-row>
+            <el-col>
+              <el-button icon="el-icon-plus" plain type="primary" @click="handleAddProduct">添加商品</el-button>
+            </el-col>
+          </el-row>
+          <el-table :key="tablekey" :data="products" border style="margin-top:5px;" width="100%">
+            <el-table-column align="center" label="商品编号" prop="barCode"/>
+            <el-table-column align="center" label="商品图片" width="100">
+              <template slot-scope="scope">
+                <el-popover
+                  placement="right"
+                  title=""
+                  trigger="hover"
+                >
+                  <img slot="reference" :src="scope.row.image" width="50">
+                  <img :src="scope.row.image" style="max-width: 50px;">
+                </el-popover>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="商品名称" prop="productName" show-overflow-tooltip/>
+            <el-table-column align="center" label="商品规格" prop="sku"/>
+            <el-table-column align="center" label="库存" prop="stock"/>
+            <el-table-column align="center" label="单价" prop="price"/>
+            <el-table-column :key="tablekey" align="center" label="数量" prop="count" width="200px">
+              <template slot-scope="scope">
+                <div>
+                  <el-input-number v-model="scope.row.count" :max="scope.row.stock" :min="1"
+                                   size="mini" @change="handleProductCountChange(scope.row)"
+                  ></el-input-number>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="小计" prop="money"/>
+            <el-table-column align="center" label="操作" width="100px">
+              <template slot-scope="scope">
+                <el-button
+                  icon="el-icon-delete"
+                  size="mini"
+                  type="text"
+                  @click="handleDelete(scope.row)"
+                >删除
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-row>
+            <el-col>
+              <span>商品合计:{{ products.length }}</span><span style="margin-left:10px;"
+            >商品总价:{{ totalMoney.toFixed(2) }}</span>
+            </el-col>
+          </el-row>
+        </el-form-item>
+        <el-form-item label="订单备注" prop="mark">
+          <el-input v-model="form.mark" placeholder="" rows="2" type="textarea"/>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="product.title" v-if="product.open"  :visible.sync="product.open" width="1000px" append-to-body>
+        <product-select  @selectProduct="selectProduct" />
+    </el-dialog>
+    <el-dialog :title="user.title" v-if="user.open"  :visible.sync="user.open" width="500px" append-to-body>
+        <add-user @addUser="addUser" />
+    </el-dialog>
+    <el-dialog :title="userAddress.title" v-if="userAddress.open"  :visible.sync="userAddress.open" width="800px" append-to-body>
+        <add-user-address ref="addUserAddress"   @addUserAddress="addUserAddress" />
+    </el-dialog>
+    <el-dialog :title="payQr.title" v-if="payQr.open"  :visible.sync="payQr.open" width="240px" append-to-body>
+        <div style="padding-bottom:15px;" >
+            <div  class="qrcode" ref="qrCodeUrl"></div>
+        </div>
+    </el-dialog>
+
+    <el-dialog :title="upload.title" :visible.sync="upload.open" append-to-body width="400px">
+      <el-upload ref="upload" :action="upload.url + '?updateSupport=' + upload.updateSupport" :auto-upload="false" :disabled="upload.isUploading"
+                 :headers="upload.headers" :limit="1"
+                 :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" accept=".xlsx, .xls" drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div slot="tip" class="el-upload__tip">
+          <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的数据 -->
+          <el-link
+            style="font-size:12px"
+            type="info"
+            id="templateDownloadLink"
+          >
+          下载模板
+          </el-link>
+        </div>
+        <div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :visible.sync="importMsgOpen"
+      append-to-body
+      title="导入结果"
+      width="600px"
+      class="import-result-dialog"
+    >
+      <div class="import-result-content">
+        <div class="result-summary" v-if="importSummary">
+          <el-alert
+            :title="importSummary.title"
+            :type="importSummary.type"
+            :closable="false"
+            show-icon
+          >
+            <template slot="default">
+              <div class="summary-stats">
+                <div class="stat-item success" v-if="importSummary.successCount > 0">
+                  <i class="el-icon-success"></i>
+                  <span class="label">成功:</span>
+                  <span class="value">{{ importSummary.successCount }}条</span>
+                </div>
+                <div class="stat-item error" v-if="importSummary.failCount > 0">
+                  <i class="el-icon-error"></i>
+                  <span class="label">失败:</span>
+                  <span class="value">{{ importSummary.failCount }}条</span>
+                </div>
+              </div>
+            </template>
+          </el-alert>
+        </div>
+
+        <div class="result-details" v-if="importDetails && importDetails.length > 0">
+          <el-divider content-position="left">详细信息</el-divider>
+          <div class="detail-list">
+            <div
+              v-for="(item, index) in importDetails"
+              :key="index"
+              class="detail-item"
+              :class="item.type"
+            >
+              <div class="item-header">
+                <i :class="item.type === 'success' ? 'el-icon-success' : 'el-icon-error'"></i>
+                <span class="item-title">{{ item.title }}</span>
+              </div>
+              <div class="item-content" v-if="item.content">
+                {{ item.content }}
+              </div>
+            </div>
+          </div>
+        </div>
+
+        <!-- 原始消息(备用) -->
+        <div class="raw-message" v-if="!importSummary && importMsg">
+          <el-alert
+            title="导入结果"
+            type="info"
+            :closable="false"
+          >
+            <div style="white-space: pre-wrap; word-break: break-all; line-height: 1.8;">
+              {{ importMsg }}
+            </div>
+          </el-alert>
+        </div>
+      </div>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="closeImportDialog">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 批量发货 -->
+    <el-dialog
+      :before-close="handleClose"
+      :visible.sync="deliveryNoteOpen"
+      :close-on-click-modal="!orderUpload.isUploading"
+      :close-on-press-escape="!orderUpload.isUploading"
+      center
+      title="批量发货"
+      width="35%"
+    >
+      <span slot="footer" class="dialog-footer">
+        <!-- 小程序Appid选择 -->
+        <el-form ref="ruleForm" :model="ruleForm" :rules="rules" class="demo-ruleForm" label-width="120px">
+          <!-- <el-form-item label="小程序:" prop="miniAppId">
+            <el-select
+              v-model="ruleForm.miniAppId"
+              clearable
+              placeholder="请选择发货小程序"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in miniAppList"
+                :key="item.appId"
+                :label="item.appName"
+                :value="item.appId"
+              />
+            </el-select>
+          </el-form-item> -->
+          <el-form-item label="发货类型:" prop="shipmentType">
+            <el-radio-group v-model="ruleForm.shipmentType">
+              <el-radio :label="1">线上发货</el-radio>
+              <el-radio :label="4">用户自提(默认)</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-form>
+
+        <el-upload ref="upload" :action="uploadUrl" :auto-upload="false" :disabled="orderUpload.isUploading"
+                   :headers="orderUpload.headers"
+                   :limit="1" :on-progress="handleFileUploadProgress"
+                   :on-success="handleFileSuccess" accept=".xlsx, .xls" drag
+        >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div slot="tip" class="el-upload__tip">
+          <el-link
+            type="info"
+            id="templateDownloadLink"
+            @click.prevent="importDeliveryNoteTemplate"
+          >
+            下载模板
+          </el-link>
+        </div>
+        <div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+        <el-divider></el-divider>
+        <el-button
+          @click="cancelResetDeliveryNote"
+          :disabled="orderUpload.isUploading"
+        >取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitDeliveryNote('ruleForm')"
+          :loading="orderUpload.isUploading"
+          :disabled="orderUpload.isUploading"
+        >{{ orderUpload.isUploading ? '导入中...' : '确 定' }}</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 设置推送手机对话框 -->
+    <el-dialog :title="erpPhone.title" :visible.sync="erpPhone.open" width="600px" append-to-body>
+      <div style="margin-bottom: 20px;">
+        <el-button type="primary" size="small" @click="handleAddPhone">新增手机号</el-button>
+      </div>
+      <el-table :data="phoneList" border style="width: 100%">
+        <el-table-column prop="phone" label="手机号" align="center">
+          <template slot-scope="scope">
+            <el-input
+              v-if="scope.row.editing"
+              v-model="scope.row.phone"
+              placeholder="请输入手机号"
+              @blur="validatePhone(scope.row)"
+              @keyup.enter.native="handleSavePhone(scope.$index)"
+            />
+            <span v-else>{{ scope.row.phone }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" align="center" width="300">
+          <template slot-scope="scope">
+            <el-button
+              v-if="scope.row.editing"
+              type="success"
+              size="mini"
+              @click="handleSavePhone(scope.$index)"
+            >保存</el-button>
+            <el-button
+              v-if="scope.row.editing"
+              type="info"
+              size="mini"
+              @click="handleCancelEdit(scope.$index)"
+            >取消</el-button>
+            <el-button
+              v-if="!scope.row.editing"
+              type="primary"
+              size="mini"
+              @click="handleEditPhone(scope.$index)"
+            >修改</el-button>
+            <el-button
+              type="danger"
+              size="mini"
+              @click="handleDeletePhone(scope.$index)"
+            >删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleSavePhoneList">确 定</el-button>
+        <el-button @click="handleCancelPhoneDialog">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="erpPhone.title" :visible.sync="setPhoneOpen" width="600px" append-to-body>
+      <el-select v-model="erpPhoneValue" multiple placeholder="请选择">
+        <el-option
+          v-for="item in phoneList"
+          :key="item.phone"
+          :label="item.phone"
+          :value="item.phone">
+        </el-option>
+      </el-select>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitErpPhone">确 定</el-button>
+        <el-button @click="handleCancelErpPhone">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- ERP账户选择对话框 -->
+    <el-dialog :title="erpAccountDialog.title" :visible.sync="erpAccountDialog.open" width="600px" append-to-body>
+      <div v-loading="erpAccountDialog.loading">
+        <el-form :model="erpAccountForm" label-width="100px">
+          <el-form-item label="ERP账户" required>
+            <el-select
+              v-model="erpAccountForm.selectedAccount"
+              placeholder="请选择ERP账户"
+              style="width: 100%"
+              filterable
+            >
+              <el-option
+                v-for="account in erpAccountList"
+                :key="account"
+                :label="account"
+                :value="account"
+              >
+                <span style="float: left">{{ account}}</span>
+                <span style="float: right; color: #8492a6; font-size: 13px">{{ account.accountCode }}</span>
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+
+        <!-- 订单统计信息 -->
+        <div class="order-summary" v-if="orderSummary">
+          <el-divider content-position="left">订单统计</el-divider>
+          <el-row :gutter="20">
+            <el-col :span="8">
+              <div class="summary-item">
+                <span class="label">选中订单数:</span>
+                <span class="value">{{ orderSummary.selectedCount }}</span>
+              </div>
+            </el-col>
+            <el-col :span="8">
+              <div class="summary-item">
+                <span class="label">总金额:</span>
+                <span class="value">¥{{ orderSummary.totalAmount }}</span>
+              </div>
+            </el-col>
+            <el-col :span="8">
+              <div class="summary-item">
+                <span class="label">查询条件订单:</span>
+                <span class="value">{{ orderSummary.queryCount }}</span>
+              </div>
+            </el-col>
+          </el-row>
+        </div>
+      </div>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelErpAccountDialog">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="confirmCreateErpOrder"
+          :disabled="!erpAccountForm.selectedAccount"
+          :loading="erpAccountDialog.submitting"
+        >确认</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 导出字段选择对话框 -->
+    <el-dialog :title="exportFieldDialog.title" :visible.sync="exportFieldDialog.open" width="800px" append-to-body>
+      <div v-loading="exportFieldDialog.loading">
+        <div style="margin-bottom: 20px;">
+          <el-button type="primary" size="small" @click="selectAllFields">全选</el-button>
+          <el-button type="default" size="small" @click="unselectAllFields">全不选</el-button>
+          <el-button type="success" size="small" @click="selectDefaultFields">选择常用</el-button>
+        </div>
+
+        <div class="field-selection-container">
+          <el-row :gutter="20">
+            <el-col :span="8" v-for="field in exportFieldOptions" :key="field.key">
+              <el-checkbox
+                v-model="field.checked"
+                :label="field.label"
+                style="margin-bottom: 12px; width: 100%;"
+              >
+                {{ field.label }}
+              </el-checkbox>
+            </el-col>
+          </el-row>
+        </div>
+
+        <div class="field-count-info" style="margin-top: 20px; padding: 10px; background: #f5f7fa; border-radius: 4px;">
+          <i class="el-icon-info"></i>
+          <span v-if="getSelectedFieldsCount() > 0">
+            已选择 <span style="color: #409EFF; font-weight: bold;">{{ getSelectedFieldsCount() }}</span> 个字段
+          </span>
+          <span v-else style="color: #E6A23C; font-weight: bold;">
+            <i class="el-icon-warning"></i>
+            未选择任何字段,将导出所有字段
+          </span>
+        </div>
+      </div>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelExportFieldDialog">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="confirmExportFields"
+        >确认导出</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 导出发货单对话框 -->
+    <el-dialog
+      :title="exportShippingDialog.title"
+      :visible.sync="exportShippingDialog.open"
+      width="500px"
+      append-to-body
+      :close-on-click-modal="false"
+    >
+      <el-form label-width="120px">
+        <el-form-item label="订单状态" required>
+          <el-radio-group v-model="exportShippingDialog.status">
+            <el-radio label="1">导出待发货订单</el-radio>
+            <el-radio label="2">导出待收货(已发货)订单</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item label="发货时间范围">
+          <el-date-picker
+            v-model="exportShippingDialog.deliverySendTimeRange"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="yyyy-MM-dd"
+            :clearable="true"
+            style="width: 100%"
+            :picker-options="{
+              shortcuts: [
+                {
+                  text: '今天',
+                  onClick(picker) {
+                    const end = new Date();
+                    const start = new Date();
+                    picker.$emit('pick', [start, end]);
+                  }
+                },
+                {
+                  text: '昨天',
+                  onClick(picker) {
+                    const end = new Date();
+                    const start = new Date();
+                    start.setTime(start.getTime() - 3600 * 1000 * 24);
+                    end.setTime(end.getTime() - 3600 * 1000 * 24);
+                    picker.$emit('pick', [start, end]);
+                  }
+                },
+                {
+                  text: '最近7天',
+                  onClick(picker) {
+                    const end = new Date();
+                    const start = new Date();
+                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+                    picker.$emit('pick', [start, end]);
+                  }
+                },
+                {
+                  text: '最近30天',
+                  onClick(picker) {
+                    const end = new Date();
+                    const start = new Date();
+                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+                    picker.$emit('pick', [start, end]);
+                  }
+                }
+              ]
+            }"
+          />
+        </el-form-item>
+
+        <el-alert
+          title="提示"
+          type="info"
+          :closable="false"
+          show-icon
+          style="margin-bottom: 15px;"
+        >
+          <div style="line-height: 1.6;">
+            <p style="margin: 5px 0;">• 可以选择快捷时间范围:今天、昨天、最近7天等</p>
+
+          </div>
+        </el-alert>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelExportShippingDialog">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="confirmExportShippingOrder"
+          :loading="exportShippingDialog.loading"
+          icon="el-icon-download"
+        >导出发货单</el-button>
+      </div>
+    </el-dialog>
+
+
+    <!-- 订单备注 -->
+    <el-dialog :title="remark.title" v-if="remark.open"  :visible.sync="remark.open" width="800px" append-to-body>
+      <el-form :model="remarkForm" label-width="100px">
+        <el-input
+          type="textarea"
+          :autosize="{ minRows: 5, maxRows: 50}"
+          placeholder="备注"
+          v-model="remarkForm.orderRemark">
+        </el-input>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelRemark">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="confirmRemark"
+        >确认</el-button>
+      </div>
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+import {
+  importTemplate,
+  exportStoreOrderItems,
+  createUserOrder,
+  listStoreOrder,
+  getStoreOrder,
+  delStoreOrder,
+  exportStoreOrder,
+  getOrderItemsNum,
+  importDeliveryNoteExpressTemplate, exportStoreOrderDetails, exportStoreOrderItemsDetails, exportShippingOrder,
+  getErpAccount,
+  queryErpPhone,
+  saveErpPhone,editErpPhone,batchCreateErpOrder,batchSetErpOrder,auditStoreOrder,orderRemark,
+  importShippingOrderTemplate,
+  getMiniProgramList,
+  batchDeliveryAllPendingOrders
+} from '@/api/hisStore/storeOrder'
+import { getUserList } from "@/api/hisStore/user";
+import { getAddressList } from "@/api/hisStore/userAddress";
+import productOrder from "../components/productOrder";
+import productSelect from "../components/productSelect";
+import addUser from "../components/addUser";
+import addUserAddress from "../components/addUserAddress";
+import { getToken } from "@/utils/auth";
+import QRCode from 'qrcodejs2'
+import { getCompanyList } from "@/api/company/company";
+import { getTcmScheduleList } from "@/api/company/schedule";
+import { treeselect } from "@/api/company/companyDept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { getConfigByKey } from '@/api/system/config'
+import { listStoreProduct } from "@/api/hisStore/storeProduct";
+import {list as getAppMallOptions} from '@/api/course/coursePlaySourceConfig';
+import {checkPermi} from "@/utils/permission";
+
+export default {
+  components: { productOrder,productSelect,addUser,addUserAddress,Treeselect },
+  name: "HisStoreOrder",
+  watch: {
+    // 监听deptId
+    'deptId': 'currDeptChange'
+  },
+  data() {
+    return {
+
+      remark: {
+        title: '订单备注',
+        open:false
+      },
+      remarkForm: {
+        id: null,
+        orderRemark: null,
+      },
+
+      orderStatus:null,
+      productInfo:"",
+      payPriceTotal:"0",
+      payMoneyTotal:"0",
+      payRemainTotal:"0",
+      // 新增排序相关数据
+      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,
+        title: "选择ERP账户",
+        loading: false,
+        submitting: false
+      },
+      erpAccountList: [], // ERP账户列表
+      erpAccountQueryList:[], // ERP账户查询条件列表
+      erpAccountForm: {
+        selectedAccount: [] // 选中的账户ID
+      },
+      orderSummary: null, // 订单统计信息
+      erpPhoneValue:[],
+      setPhoneOpen:false,
+      erpPhone:{
+        open:false,
+        title:"设置推送手机号"
+      },
+      phoneList: [], // 手机号列表
+      originalPhoneList: [], // 原始手机号列表,用于取消时恢复
+      exportFieldDialog: {
+        open: false,
+        title: "选择导出字段",
+        loading: false,
+        type:null
+      },
+      // 可选择的导出字段列表
+      exportFieldOptions: [
+
+        { key: 'erpPhone', label: 'ERP电话', checked: false },
+        { key: 'erpAccount', label: 'ERP账号', checked: false },
+        { key: 'orderCode', label: '订单号', checked: true },
+        { key: 'userId', label: '会员ID', checked: true },
+        { key: 'orderType', label: '订单类型', checked: true },
+        { key: 'companyName', label: '公司名称', checked: true },
+        { key: 'companyUserNickName', label: '所属销售', checked: true },
+        { key: 'realName', label: '收货人姓名', checked: true },
+        { key: 'userPhone', label: '收货人电话', checked: true },
+        { key: 'userAddress', label: '详细地址', checked: true },
+        { key: 'payMoney', label: '实收金额', checked: true },
+        { key: 'payRemain', label: '物流代收金额', checked: false },
+        { key: 'createTime', label: '下单时间', checked: true },
+        { key: 'payTime', label: '支付时间', checked: true },
+        { key: 'deliverySendTime', label: '发货时间', checked: false },
+        { key: 'payType', label: '支付方式', checked: true },
+        { key: 'status', label: '订单状态', checked: true },
+        { key: 'barCode', label: '商品编码', checked: false },
+
+
+        { key: 'deliverySn', label: '快递公司编号', checked: false },
+        { key: 'deliveryName', label: '快递公司', checked: false },
+        { key: 'deliveryId', label: '快递单号', checked: false },
+        { key: 'remark', label: '备注', checked: false },
+        { key: 'isAudit', label: '是否审核', checked: false },
+        { key: 'orderRemark', label: '订单备注', checked: false },
+      ],
+      appMallOptions:[],
+      itemlist: [],
+      importMsgOpen: false,
+      importMsg: '',
+      importSummary: null, // 导入统计信息
+      importDetails: [], // 导入详细信息
+      scheduleOptions: [],
+      deliveryPayStatusOptions: [],
+      deliveryStatusOptions: [],
+      companys: [],
+      deptOptions: [],
+      companyId: undefined,
+      deptId: undefined,
+      orderMediumOptions: [],
+      orderTypeOptions: [],
+      payTypeOptions: [],
+      payQr: {
+        open: false,
+        title: '付款二维码'
+      },
+      user:{
+        open:false,
+        title:"创建会员"
+      },
+      userAddress:{
+        open:false,
+        title:"创建收货地址"
+      },
+      tablekey:false,
+      totalMoney:0.00,
+      products:[],
+      product:{
+        open:false,
+        title:"商品选择"
+      },
+      userStatusOptions:[],
+      phone:null,
+      address:[],
+      addressloading: false,
+      userloading: false,
+      users:[],
+      show:{
+        open:false,
+        title:"订单详情"
+      },
+      activeName:"00",
+      statusOptions:[],
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 订单表格数据
+      storeOrderList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      createTimeRange:[],
+      payTimeRange:[],
+      deliveryImportTimeRange:[],
+      deliverySendTimeRange:[],
+      orderItemNum:"",
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        orderCode: null,
+        orderCodes:[],
+        bankTransactionId: null,
+        extendOrderId: null,
+        userId: null,
+        realName: null,
+        userPhone: null,
+        userAddress: null,
+        cartId: null,
+        freightPrice: null,
+        totalNum: null,
+        totalPrice: null,
+        totalPostage: null,
+        payPrice: null,
+        payPostage: null,
+        deductionPrice: null,
+        couponId: null,
+        couponPrice: null,
+        paid: null,
+        payTime: null,
+        payType: null,
+        status: null,
+        refundStatus: null,
+        refundReasonWapImg: null,
+        refundReasonWapExplain: null,
+        refundReasonTime: null,
+        refundReasonWap: null,
+        refundReason: null,
+        refundPrice: null,
+        deliverySn: null,
+        deliveryName: null,
+        deliveryType: null,
+        deliveryId: null,
+        gainIntegral: null,
+        useIntegral: null,
+        payIntegral: null,
+        backIntegral: null,
+        mark: null,
+        isDel: null,
+        cost: null,
+        verifyCode: null,
+        storeId: null,
+        shippingType: null,
+        isChannel: null,
+        isRemind: null,
+        isSysDel: null,
+        deptId: null,
+        isUpload: null,
+        productId:null,
+        productName:null,
+        isAudit:null,
+      },
+      // 表单参数
+      form: {
+        addressId:null,
+        userId:null,
+      },
+      // 表单校验
+      rules: {
+        userId: [
+          { required: true, message: '会员信息不能为空' }
+        ],
+        addressId: [
+          { required: true, message: '收货信息不能为空' }
+        ],
+        miniAppId: [
+          { required: true, message: '发货小程序不能为空' }
+        ],
+        shipmentType: [
+          { required: true, message: '发货类型不能为空' }
+        ],
+      },
+      upload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: 'Bearer ' + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + '/store/storeOrder/importExpress'
+      },
+      orderUpload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: '',
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: 'Bearer ' + getToken() },
+      },
+      deliveryNoteOpen: false,
+      miniAppList: [],
+      ruleForm: {
+        miniAppId: null,
+        shipmentType: 4
+      },
+      batchDeliveryForm: {
+        shipmentType: 2
+      },
+      productQuery: {
+        pageNum:1,
+        pageSize:10,
+        productName:null,
+      },
+      options:[],
+      showFinanceTableField: false,
+      // 导出发货单对话框
+      exportShippingDialog: {
+        open: false,
+        title: '导出发货单',
+        loading: false,
+        deliverySendTimeRange: [], // 发货时间范围
+        status: '2' // 订单状态,默认为2(待收货/已发货)
+      },
+    }
+  },
+  computed: {
+    uploadUrl() {
+      return process.env.VUE_APP_BASE_API +
+        '/store/store/storeOrder/importDeliveryNoteExpress?miniAppId=' +
+        this.ruleForm.miniAppId +
+        '&shipmentType=' +
+        this.ruleForm.shipmentType;
+    }
+  },
+  created() {
+    getCompanyList().then(response => {
+        this.companys = response.data;
+         if(this.companys!=null&&this.companys.length>0){
+          this.companyId=this.companys[0].companyId;
+          this.getTreeselect();
+        }
+    });
+    if(process.env.NODE_ENV === "prod-hst"){
+      this.getDicts("store_order_medium").then((response) => {
+        this.orderMediumOptions = response.data;
+      });
+    } else {
+      this.getDicts("crm_customer_source").then((response) => {
+        this.orderMediumOptions = response.data;
+      });
+    }
+    this.getDicts("store_order_type").then((response) => {
+      this.orderTypeOptions = response.data;
+    });
+    this.getDicts("user_status").then((response) => {
+      this.userStatusOptions = response.data;
+    });
+    this.getDicts("store_pay_type").then((response) => {
+      this.payTypeOptions = response.data;
+    });
+    this.getDicts("store_order_status").then((response) => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("store_order_delivery_status").then((response) => {
+      this.deliveryStatusOptions = response.data;
+    });
+    this.getDicts("store_delivery_pay_status").then((response) => {
+      this.deliveryPayStatusOptions = response.data;
+    });
+    getTcmScheduleList().then(response => {
+      this.scheduleOptions = response.data;
+    });
+    if (checkPermi(['his:storeAfterSales:finance'])) {
+      this.showFinanceTableField = true;
+    }
+    this.getList();
+    this.getItemsNum();
+    this.getProduct()
+    this.getErpAccountList();
+    this.getAppMallOptions();
+  },
+  methods: {
+    handleOrderReamrk(row){
+      this.remarkForm.id = row.id;
+      this.remark.open = true;
+    },
+    cancelRemark(){
+      this.remarkForm = {
+        id: null,
+        orderRemark: null,
+      }
+      this.remark.open = false;
+
+    },
+    confirmRemark(){
+      orderRemark(this.remarkForm).then(res => {
+        this.$message.success("备注成功");
+        this.remark.open = false;
+        this.getList();
+      })
+    },
+    // 新增排序处理方法
+    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('已清除排序');
+    },
+     // 处理键盘按下事件
+     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)
+
+    },
+
+    // 清空所有标签
+    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.erpSettingType = 'set'
+      this.calculateOrderSummary();
+    },
+    //显示ERP账户选择对话框
+    showErpAccountDialog() {
+      this.erpAccountDialog.open = true;
+      this.erpSettingType = 'push'
+      this.calculateOrderSummary();
+    },
+
+    //获取ERP账户列表
+    async getErpAccountList() {
+      try {
+        const response = await getErpAccount();
+        if (response.code === 200) {
+          const list = response.data || [];
+          this.erpAccountList = [...list];
+          this.erpAccountQueryList = [...list, '未分拣'];
+          // 设置默认值:第一条真实账户
+          if (list.length && !this.queryParams.erpAccount) {
+              this.$set(this.queryParams, 'erpAccount', list[0]);
+              this.getList();
+          }
+        } else {
+          this.$message.error(response.msg || '获取ERP账户列表失败');
+          this.erpAccountList = [];
+        }
+
+      } catch (error) {
+        console.error('获取ERP账户列表失败:', error);
+        this.$message.error('获取ERP账户列表失败');
+        this.erpAccountList = [];
+      } finally {
+        this.erpAccountDialog.loading = false;
+      }
+    },
+
+    // 新增:计算订单统计信息
+    calculateOrderSummary() {
+      let selectedCount = 0;
+      let totalAmount = 0;
+      let queryCount = this.total || 0;
+
+      if (this.ids.length > 0) {
+        // 如果有选中的订单,统计选中的订单
+        selectedCount = this.ids.length;
+        this.storeOrderList.forEach(order => {
+          if (this.ids.includes(order.orderId)) {
+            totalAmount += parseFloat(order.payMoney || 0);
+          }
+        });
+      } else {
+        // 如果没有选中订单,统计当前查询条件下的所有订单
+        selectedCount = queryCount;
+        this.storeOrderList.forEach(order => {
+          totalAmount += parseFloat(order.payMoney || 0);
+        });
+      }
+
+      this.orderSummary = {
+        selectedCount,
+        totalAmount: totalAmount.toFixed(2),
+        queryCount
+      };
+    },
+
+    //确认创建ERP订单
+    confirmCreateErpOrder() {
+      if (!this.erpAccountForm.selectedAccount) {
+        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();
+        });
+      }
+    },
+
+    async executSetErpOrder() {
+      this.erpAccountDialog.submitting = true;
+
+      try {
+        let param = {
+          loginAccount: this.erpAccountForm.selectedAccount
+        };
+
+        if (this.ids.length > 0) {
+          // 如果有选中的订单,只推送选中的
+          param.orderIds = this.ids;
+        } else {
+          // 如果没有选中订单,推送查询条件下的所有订单
+          // 合并查询参数
+          param = { ...param, ...this.queryParams };
+        }
+
+        const response = await batchSetErpOrder(param);
+        if (response.code === 200) {
+          this.$message.success('订单ERP账号设置成功');
+          this.cancelErpAccountDialog();
+          this.getErpAccountList(); // 刷新列表
+          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订单
+    async executeCreateErpOrder() {
+      this.erpAccountDialog.submitting = true;
+
+      try {
+        let param = {
+          loginAccount: this.erpAccountForm.selectedAccount
+        };
+
+        if (this.ids.length > 0) {
+          // 如果有选中的订单,只推送选中的
+          param.orderIds = this.ids;
+        } else {
+          // 如果没有选中订单,推送查询条件下的所有订单
+          // 合并查询参数
+          param = { ...param, ...this.queryParams };
+        }
+
+        const response = await batchCreateErpOrder(param);
+        if (response.code === 200) {
+          this.$message.success('ERP订单创建成功');
+          this.cancelErpAccountDialog();
+          this.getErpAccountList(); // 刷新列表
+          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账户选择对话框
+    cancelErpAccountDialog() {
+      this.erpAccountDialog.open = false;
+      this.erpAccountForm.selectedAccount = null;
+      this.orderSummary = null;
+      this.erpAccountList = [];
+    },
+    handleCancelErpPhone(){
+      this.erpPhoneValue = [];
+      this.setPhoneOpen = false;
+    },
+    submitErpPhone(){
+      let param = {};
+      if(this.ids.length>0){
+        param = {orderIds:this.ids,erpPhone:this.erpPhoneValue};
+      } else {
+        param = this.queryParams;
+        param.erpPhone=this.erpPhoneValue;
+      }
+
+      editErpPhone(param).then(response=>{
+        this.msgSuccess("修改成功");
+        this.setPhoneOpen = false;
+        this.getList();
+      })
+    },
+    setErpPhone(){
+      this.getErpPhoneList();
+      this.setPhoneOpen = true;
+    },
+    // 设置推送手机相关方法
+    handleErpPhone(){
+      //查询配置手机号
+      this.getErpPhoneList();
+      this.erpPhone.open = true
+    },
+    getErpPhoneList(){
+      queryErpPhone().then(response =>{
+        if(response.data && response.data != null && response.data.length >0){
+          const phones = response.data.filter(phone => phone.trim());
+          this.phoneList = phones.map(phone => ({
+            phone: phone.trim(),
+            editing: false,
+            originalPhone: phone.trim()
+          }));
+        }
+
+        // 保存原始数据用于取消操作
+        this.originalPhoneList = this.phoneList;
+      });
+    },
+    // 新增手机号
+    handleAddPhone() {
+      this.phoneList.push({
+        phone: '',
+        editing: true,
+        originalPhone: '',
+        isNew: true
+      });
+    },
+    // 编辑手机号
+    handleEditPhone(index) {
+      this.$set(this.phoneList[index], 'editing', true);
+      this.$set(this.phoneList[index], 'originalPhone', this.phoneList[index].phone);
+    },
+    // 保存手机号
+    handleSavePhone(index) {
+      const phone = this.phoneList[index].phone.trim();
+      if (!phone) {
+        this.$message.error('手机号不能为空');
+        return;
+      }
+      if (!this.validatePhoneFormat(phone)) {
+        this.$message.error('请输入正确的手机号格式');
+        return;
+      }
+      // 检查是否重复
+      const duplicateIndex = this.phoneList.findIndex((item, idx) =>
+        idx !== index && item.phone === phone
+      );
+      if (duplicateIndex !== -1) {
+        this.$message.error('手机号已存在');
+        return;
+      }
+      this.$set(this.phoneList[index], 'editing', false);
+      this.$set(this.phoneList[index], 'isNew', false);
+    },
+    // 取消编辑
+    handleCancelEdit(index) {
+      if (this.phoneList[index].isNew) {
+        // 如果是新增的,直接删除
+        this.phoneList.splice(index, 1);
+      } else {
+        // 如果是编辑的,恢复原值
+        this.$set(this.phoneList[index], 'phone', this.phoneList[index].originalPhone);
+        this.$set(this.phoneList[index], 'editing', false);
+      }
+    },
+    // 删除手机号
+    handleDeletePhone(index) {
+      this.$confirm('确认删除该手机号?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.phoneList.splice(index, 1);
+        this.$message.success('删除成功');
+      });
+    },
+    // 验证手机号格式
+    validatePhoneFormat(phone) {
+      const phoneRegex = /^1[3-9]\d{9}$/;
+      return phoneRegex.test(phone);
+    },
+    // 验证手机号
+    validatePhone(row) {
+      if (row.phone && !this.validatePhoneFormat(row.phone)) {
+        this.$message.error('请输入正确的手机号格式');
+      }
+    },
+    // 保存手机号列表
+    handleSavePhoneList() {
+      // 检查是否有正在编辑的项
+      const editingItem = this.phoneList.find(item => item.editing);
+      if (editingItem) {
+        this.$message.error('请先保存正在编辑的手机号');
+        return;
+      }
+
+      // 检查是否有空的手机号
+      const emptyPhone = this.phoneList.find(item => !item.phone.trim());
+      if (emptyPhone) {
+        this.$message.error('存在空的手机号,请删除或填写完整');
+        return;
+      }
+
+      // 构造手机号列表
+      const phoneList = this.phoneList.map(item => item.phone);
+
+      // 调用保存接口
+      saveErpPhone(phoneList).then(response => {
+        if (response.code === 200) {
+          this.$message.success('保存成功');
+          this.erpPhone.open = false;
+        } else {
+          this.$message.error(response.msg || '保存失败');
+        }
+        this.getList();
+      }).catch(() => {
+        this.$message.error('保存失败');
+      });
+    },
+    // 取消手机号对话框
+    handleCancelPhoneDialog() {
+      // 恢复原始数据
+      this.phoneList = JSON.parse(JSON.stringify(this.originalPhoneList));
+      this.erpPhone.open = false;
+    },
+
+    // 获取小程序选项列表
+    getAppMallOptions() {
+      getAppMallOptions({pageNum:1,pageSize:100,isMall:1}).then(response => {
+        this.appMallOptions = response.rows;
+      })
+    },
+    // 获取已选择字段数量
+    getSelectedFieldsCount() {
+      return this.exportFieldOptions.filter(field => field.checked).length;
+    },
+
+    // 取消导出字段选择
+    cancelExportFieldDialog() {
+      this.exportFieldDialog.open = false;
+      this.exportFieldDialog.type = null;
+    },
+       // 选择常用字段
+       selectDefaultFields() {
+      // 先全不选
+      this.unselectAllFields();
+      // 然后选择常用字段
+      const defaultFields = ['orderCode', 'prescribeCode', 'companyName', 'companyUserNickName',
+                           'storeName', 'miniProgramName', 'userName', 'userPhone', 'userAddress', 'totalPrice',
+                           'totalNum', 'payPrice', 'payMoney', 'createTime', 'payTime',
+                           'payType', 'status', 'packageName', 'patientName'];
+      this.exportFieldOptions.forEach(field => {
+        if (defaultFields.includes(field.key)) {
+          field.checked = true;
+        }
+      });
+    },
+
+    // 确认导出字段
+    confirmExportFields() {
+      // 获取已选择的字段
+      const selectedFieldsArray = this.exportFieldOptions.filter(field => field.checked);
+
+      let selectedFields = '';
+      if (selectedFieldsArray.length === 0) {
+        // 如果没有选择任何字段,则导出全部字段(不传filter参数)
+        selectedFields = null;
+      } else {
+        // 如果选择了字段,则只导出选中的字段
+        selectedFields = selectedFieldsArray.map(field => field.key).join(',');
+      }
+
+      // 关闭弹窗
+      this.exportFieldDialog.open = false;
+
+      // 执行导出操作
+      this.doExportOrder(selectedFields);
+    },
+
+    // 执行导出操作
+    doExportOrder(selectedFields) {
+
+      if(this.queryParams.status=='00'){
+        this.queryParams.status=null;
+      }
+      if(this.createTimeRange!=null&&this.createTimeRange.length==2){
+        this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
+      }
+      else{
+        this.queryParams.createTimeRange=null;
+      }
+      if(this.payTimeRange!=null&&this.payTimeRange.length==2){
+        this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
+      }
+      else{
+        this.queryParams.payTimeRange=null;
+      }
+      if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
+        this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
+      }
+      else{
+        this.queryParams.deliveryImportTimeRange=null;
+      }
+      if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
+        this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
+      }
+      else{
+        this.queryParams.deliverySendTimeRange=null;
+      }
+      const queryParams = this.addDateRange(this.queryParams, this.dateRange);
+
+      // 根据是否选择字段显示不同的确认消息
+      let confirmMessage = '';
+      if (selectedFields === null) {
+        confirmMessage = '没有选择字段,将导出所有字段的订单数据,确认继续?';
+      } else {
+        const fieldCount = selectedFields.split(',').length;
+        confirmMessage = `确认导出选中的 ${fieldCount} 个字段的订单数据?`;
+      }
+
+      this.$confirm('是否确认导出所有订单数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(()=> {
+          this.exportLoading = true;
+          // 构建请求参数
+          const requestParams = {...queryParams};
+          // 只有当selectedFields不为null时才添加filter参数
+          if (selectedFields !== null) {
+            requestParams.filter = selectedFields;
+          }
+          console.log(requestParams)
+          if(this.exportFieldDialog.type == 1){
+            return exportStoreOrder(requestParams);
+          } else if (this.exportFieldDialog.type == 2){
+            return exportStoreOrderDetails(requestParams);
+          }
+
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    },
+
+    // 导出字段选择相关方法
+    // 全选字段
+    selectAllFields() {
+      this.exportFieldOptions.forEach(field => {
+        field.checked = true;
+      });
+    },
+    // 全不选字段
+    unselectAllFields() {
+      this.exportFieldOptions.forEach(field => {
+        field.checked = false;
+      });
+    },
+    handleGenPayUrl(row){
+      this.payQr.open=true;
+      setTimeout(() => {
+        var qrcode = new QRCode(this.$refs.qrCodeUrl, {
+          text: config.payQRUrl + row.id, // 需要转换为二维码的内容
+          width: 200,
+          height: 200,
+          colorDark: '#000000',
+          colorLight: '#ffffff',
+          correctLevel: QRCode.CorrectLevel.H
+        })
+      }, 200)
+    },
+    handleAddUser() {
+      this.user.open = true
+    },
+    handleAddUserAddress() {
+      if (this.form.userId == null) {
+        this.msgError('请选择会员')
+        return
+      }
+      this.userAddress.open = true
+      setTimeout(() => {
+        this.$refs.addUserAddress.init(this.form.userId)
+      }, 500)
+    },
+    addUser() {
+      this.user.open = false
+    },
+    addUserAddress() {
+      this.userAddress.open = false
+      //获取地址
+      this.getAddressList(this.form.userId)
+    },
+    compute() {
+      this.totalMoney = 0
+      var that = this
+      this.products.forEach(function(value) {
+        that.totalMoney += value.money
+      })
+      console.log(that.totalMoney)
+    },
+    handleProductCountChange(row) {
+      this.tablekey = !this.tablekey
+      console.log(row)
+      row.money = row.count * row.price
+      this.$forceUpdate()
+      this.compute()
+    },
+    selectProduct(row) {
+      console.log(row)
+      for (var i = 0; i < this.products.length; i++) {
+        if (this.products[i].id == row.id) {
+          return
+        }
+      }
+      row.count=1;
+      row.money=row.count*row.price;
+      this.products.push(row);
+      this.compute();
+    },
+    handleAddProduct(){
+      this.product.open=true;
+    },
+    searchUser(){
+      if(this.phone==null||this.phone==""){
+        return;
+      }
+      var data={phone:this.phone}
+      this.userloading = true;
+      this.users=[];
+      this.address=[];
+      getUserList(data).then(response => {
+        this.users = response.data;
+        this.userloading = false;
+        if(this.users!=null&&this.users.length==1){
+          this.form.userId=this.users[0].userId;
+          this.getAddressList(this.form.userId)
+        }
+      });
+    },
+    getAddressList(userId){
+      var data={userId:userId}
+      this.addressloading = true;
+      this.address=[];
+      getAddressList(data).then(response => {
+        this.address = response.data;
+        this.addressloading = false;
+      });
+    },
+    handleDetails(row){
+      this.show.open=true;
+      const orderId = row.id ;
+      setTimeout(() => {
+        this.$refs.order.getOrder(orderId);
+      }, 500);
+    },
+    handleClick(tab, event) {
+      this.orderStatus = tab.name;
+      this.activeName=tab.name;
+      this.queryParams.status=tab.name
+      console.log(this.queryParams.status)
+      this.getList();
+    },
+    /** 查询订单列表 */
+    getList() {
+      this.loading = true;
+      if(this.queryParams.status=='00'){
+        this.queryParams.status=null;
+      }
+
+      if(this.createTimeRange!=null&&this.createTimeRange.length==2){
+        this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
+      }
+      else{
+        this.queryParams.createTimeRange=null;
+      }
+
+      if(this.payTimeRange!=null&&this.payTimeRange.length==2){
+        this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
+      }
+      else{
+        this.queryParams.payTimeRange=null;
+      }
+      if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
+        this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
+      }
+      else{
+        this.queryParams.deliveryImportTimeRange=null;
+      }
+      if (this.deliverySendTimeRange != null && this.deliverySendTimeRange.length == 2) {
+        this.queryParams.deliverySendTimeRange = this.deliverySendTimeRange[0] + '--' + this.deliverySendTimeRange[1]
+      } else {
+        this.queryParams.deliverySendTimeRange = null
+      }
+
+      // 处理订单号数组
+      if (this.queryParams.orderCodes && this.queryParams.orderCodes.length > 0) {
+        this.queryParams.orderCodeList = this.queryParams.orderCodes.join(',');
+      } else {
+        this.queryParams.orderCodeList = null;
+      }
+
+      listStoreOrder(this.queryParams).then(response => {
+        this.storeOrderList = response.rows;
+        this.total = response.total;
+        if(this.total>0){
+          this.payPriceTotal = response.payPriceTotal;
+          this.payMoneyTotal = response.payMoneyTotal;
+          this.payRemainTotal = response.payRemainTotal;
+          this.productInfo = response.productInfo;
+        } else {
+          this.payPriceTotal = "0"
+          this.payMoneyTotal = "0"
+          this.payRemainTotal = "0"
+          this.productInfo = response.productInfo;
+        }
+        this.loading = false;
+        if(response.msg == 'knt'){
+          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('查询数据失败');
+      });
+    },
+    getItemsNum() {
+      this.loading = true;
+      if(this.queryParams.status=='00'){
+        this.queryParams.status=null;
+      }
+
+      if(this.createTimeRange!=null&&this.createTimeRange.length==2){
+        this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
+      }
+      else{
+        this.queryParams.createTimeRange=null;
+      }
+
+      if(this.payTimeRange!=null&&this.payTimeRange.length==2){
+        this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
+      }
+      else{
+        this.queryParams.payTimeRange=null;
+      }
+      if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
+        this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
+      }
+      else{
+        this.queryParams.deliveryImportTimeRange=null;
+      }
+      if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
+        this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
+      }
+      else{
+        this.queryParams.deliverySendTimeRange=null;
+      }
+
+      getOrderItemsNum(this.queryParams).then(response => {
+        this.orderItemNum = response.orderItemsNum;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        addressId:null,
+        userId:null,
+
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+      this.getItemsNum();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.payTimeRange = []
+      this.createTimeRange = []
+      this.deliverySendTimeRange = []
+      this.deliveryImportTimeRange = []
+      this.resetForm("queryForm");
+      // 清除排序
+      this.currentSort = {
+        prop: null,
+        order: null
+      };
+      this.queryParams.sortField = null;
+      this.queryParams.productId=null;
+      this.queryParams.sortOrder = null;
+      // 重置表格排序状态 - 关键代码
+      this.$nextTick(() => {
+        if (this.$refs.orderTable) {
+          this.$refs.orderTable.clearSort();
+        }
+      });
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.title = '创建订单'
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      const id = row.id || this.ids
+      getStoreOrder(id).then(response => {
+        this.form = response.data
+        this.open = true
+        this.title = '修改订单'
+      })
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs['form'].validate(valid => {
+        this.form.products = this.products
+        if (valid) {
+          console.log(this.form)
+          createUserOrder(this.form).then(response => {
+            if (response.code === 200) {
+              this.msgSuccess('创建成功')
+              this.open = false
+              this.getList()
+            }
+          })
+
+        }
+      })
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      this.products.splice(this.products.findIndex(item => item.id === row.id), 1)
+      this.compute()
+
+    },
+    /** 删除按钮操作 */
+    handleOrderDelete(row) {
+      const ids = row.id || this.ids
+      this.$confirm('是否确认删除当前选择的订单数据项?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(function() {
+        return delStoreOrder(ids)
+      }).then(() => {
+        this.getList()
+        this.msgSuccess('删除成功')
+      }).catch(() => {
+      })
+    },
+
+    /** 订单确认审核 */
+    handleOrderAudit(row){
+      // if (this.ids.length === 0 && row) {
+      //   this.$message.warning('请至少勾选一条订单进行审核');
+      //   return;
+      // }
+      const ids = [row.id];
+      //const ids = row.id || this.ids;
+      this.$confirm('是否确认审核订单号:'+row.orderCode+'?', "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        return auditStoreOrder({ orderIds: ids, isAudit: 1 });
+      }).then((response) => {
+        this.getList();
+        this.msgSuccess(response.msg || "审核成功");
+      }).catch(() => {
+      });
+    },
+
+    /** 导出按钮操作 */
+    handleExport() {
+      if (this.queryParams.status == '00') {
+        this.queryParams.status = null
+      }
+      if (this.createTimeRange != null && this.createTimeRange.length == 2) {
+        this.queryParams.createTimeRange = this.createTimeRange[0] + '--' + this.createTimeRange[1]
+      } else {
+        this.queryParams.createTimeRange = null
+      }
+      if (this.payTimeRange != null && this.payTimeRange.length == 2) {
+        this.queryParams.payTimeRange = this.payTimeRange[0] + '--' + this.payTimeRange[1]
+      } else {
+        this.queryParams.payTimeRange = null
+      }
+      if (this.deliveryImportTimeRange != null && this.deliveryImportTimeRange.length == 2) {
+        this.queryParams.deliveryImportTimeRange = this.deliveryImportTimeRange[0] + '--' + this.deliveryImportTimeRange[1]
+      } else {
+        this.queryParams.deliveryImportTimeRange = null
+      }
+      if (this.deliverySendTimeRange != null && this.deliverySendTimeRange.length == 2) {
+        this.queryParams.deliverySendTimeRange = this.deliverySendTimeRange[0] + '--' + this.deliverySendTimeRange[1]
+      } else {
+        this.queryParams.deliverySendTimeRange = null
+      }
+      const queryParams = this.addDateRange(this.queryParams, this.dateRange)
+      this.$confirm('是否确认导出所有订单数据项?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(function() {
+        return exportStoreOrder(queryParams)
+      }).then(response => {
+        this.download(response.msg)
+      }).catch(function() {
+      })
+    },
+
+    handleExportItemsDetails() {
+      if (this.queryParams.status == '00') {
+        this.queryParams.status = null
+      }
+      if (this.createTimeRange != null && this.createTimeRange.length == 2) {
+        this.queryParams.createTimeRange = this.createTimeRange[0] + '--' + this.createTimeRange[1]
+      } else {
+        this.queryParams.createTimeRange = null
+      }
+      if (this.payTimeRange != null && this.payTimeRange.length == 2) {
+        this.queryParams.payTimeRange = this.payTimeRange[0] + '--' + this.payTimeRange[1]
+      } else {
+        this.queryParams.payTimeRange = null
+      }
+      if (this.deliveryImportTimeRange != null && this.deliveryImportTimeRange.length == 2) {
+        this.queryParams.deliveryImportTimeRange = this.deliveryImportTimeRange[0] + '--' + this.deliveryImportTimeRange[1]
+      } else {
+        this.queryParams.deliveryImportTimeRange = null
+      }
+      if (this.deliverySendTimeRange != null && this.deliverySendTimeRange.length == 2) {
+        this.queryParams.deliverySendTimeRange = this.deliverySendTimeRange[0] + '--' + this.deliverySendTimeRange[1]
+      } else {
+        this.queryParams.deliverySendTimeRange = null
+      }
+      const queryParams = this.addDateRange(this.queryParams, this.dateRange)
+      this.$confirm('是否确认导出所有订单明细数据项?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(function() {
+        return exportStoreOrderItemsDetails(queryParams)
+      }).then(response => {
+        this.download(response.msg)
+      }).catch(function() {
+      })
+    },
+    /** 导出按钮操作 */
+    handleExportDetails() {
+
+      this.exportFieldDialog.open = true;
+      this.exportFieldDialog.type = 2;
+    },
+    handleExportItems() {
+      if (this.queryParams.status == '00') {
+        this.queryParams.status = null
+      }
+      if (this.createTimeRange != null && this.createTimeRange.length == 2) {
+        this.queryParams.createTimeRange = this.createTimeRange[0] + '--' + this.createTimeRange[1]
+      } else {
+        this.queryParams.createTimeRange = null
+      }
+      if (this.payTimeRange != null && this.payTimeRange.length == 2) {
+        this.queryParams.payTimeRange = this.payTimeRange[0] + '--' + this.payTimeRange[1]
+      } else {
+        this.queryParams.payTimeRange = null
+      }
+      if (this.deliveryImportTimeRange != null && this.deliveryImportTimeRange.length == 2) {
+        this.queryParams.deliveryImportTimeRange = this.deliveryImportTimeRange[0] + '--' + this.deliveryImportTimeRange[1]
+      } else {
+        this.queryParams.deliveryImportTimeRange = null
+      }
+      if (this.deliverySendTimeRange != null && this.deliverySendTimeRange.length == 2) {
+        this.queryParams.deliverySendTimeRange = this.deliverySendTimeRange[0] + '--' + this.deliverySendTimeRange[1]
+      } else {
+        this.queryParams.deliverySendTimeRange = null
+      }
+      const queryParams = this.addDateRange(this.queryParams, this.dateRange)
+      this.$confirm('是否确认导出所有订单明细数据项?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(function() {
+        return exportStoreOrderItems(queryParams)
+      }).then(response => {
+        this.download(response.msg)
+      }).catch(function() {
+      })
+    },
+    handleExportShippingOrder() {
+      console.log('=== 点击导出发货单按钮 ===')
+      console.log('exportShippingDialog:', this.exportShippingDialog)
+      // 打开导出发货单对话框
+      this.exportShippingDialog.open = true
+      console.log('exportShippingDialog.open 设置为:', this.exportShippingDialog.open)
+      // 默认使用筛选表单中的发货时间
+      this.exportShippingDialog.deliverySendTimeRange = this.deliverySendTimeRange ? [...this.deliverySendTimeRange] : []
+      // 默认订单状态为2(待收货/已发货)
+      this.exportShippingDialog.status = '2'
+      console.log('deliverySendTimeRange:', this.exportShippingDialog.deliverySendTimeRange)
+      console.log('status:', this.exportShippingDialog.status)
+    },
+
+    // 确认导出发货单
+    confirmExportShippingOrder() {
+      // 构建导出参数
+      const params = { ...this.queryParams }
+
+      // 处理状态参数:使用对话框中选择的状态
+      params.status = this.exportShippingDialog.status
+
+      // 处理下单时间范围
+      if (this.createTimeRange != null && this.createTimeRange.length == 2) {
+        params.createTimeRange = this.createTimeRange[0] + '--' + this.createTimeRange[1]
+      } else {
+        params.createTimeRange = null
+      }
+
+      // 处理支付时间范围
+      if (this.payTimeRange != null && this.payTimeRange.length == 2) {
+        params.payTimeRange = this.payTimeRange[0] + '--' + this.payTimeRange[1]
+      } else {
+        params.payTimeRange = null
+      }
+
+      // 处理导入时间范围(回单时间)
+      if (this.deliveryImportTimeRange != null && this.deliveryImportTimeRange.length == 2) {
+        params.deliveryImportTimeRange = this.deliveryImportTimeRange[0] + '--' + this.deliveryImportTimeRange[1]
+      } else {
+        params.deliveryImportTimeRange = null
+      }
+
+      // 处理发货时间范围 - 使用对话框中输入的时间,转换为后端需要的格式 yyyyMMdd--yyyyMMdd
+      if (this.exportShippingDialog.deliverySendTimeRange != null && this.exportShippingDialog.deliverySendTimeRange.length == 2) {
+        // 将 yyyy-MM-dd 格式转换为 yyyyMMdd 格式
+        const startDate = this.exportShippingDialog.deliverySendTimeRange[0].replace(/-/g, '')
+        const endDate = this.exportShippingDialog.deliverySendTimeRange[1].replace(/-/g, '')
+        params.deliverySendTimeRange = startDate + '--' + endDate
+      } else {
+        params.deliverySendTimeRange = null
+      }
+
+      // 移除空值参数
+      Object.keys(params).forEach(key => {
+        if (params[key] === '' || params[key] === undefined || params[key] === null) {
+          delete params[key]
+        }
+      })
+
+      // 构建确认消息
+      const statusText = this.exportShippingDialog.status === '1' ? '待发货' : '待收货(已发货)'
+      let confirmMessage = `是否确认导出${statusText}状态的发货单数据?`
+
+      if (params.deliverySendTimeRange) {
+        const dateRange = this.exportShippingDialog.deliverySendTimeRange[0] + ' 至 ' + this.exportShippingDialog.deliverySendTimeRange[1]
+        confirmMessage = `是否确认导出 ${dateRange} 期间${statusText}状态的发货单数据?`
+      }
+
+      this.$confirm(confirmMessage, '导出发货单', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.exportShippingDialog.loading = true
+        return exportShippingOrder(params)
+      }).then(response => {
+        this.download(response.msg)
+        this.$modal.msgSuccess('发货单导出成功')
+        // 关闭对话框
+        this.exportShippingDialog.open = false
+      }).catch(error => {
+        if (error !== 'cancel') {
+          console.error('导出发货单失败:', error)
+          this.$modal.msgError('导出发货单失败')
+        }
+      }).finally(() => {
+        this.exportShippingDialog.loading = false
+      })
+    },
+
+    // 取消导出发货单
+    cancelExportShippingDialog() {
+      this.exportShippingDialog.open = false
+      this.exportShippingDialog.deliverySendTimeRange = []
+      this.exportShippingDialog.status = '2' // 重置为默认值
+    },
+    handleImport() {
+      this.upload.title = '导入银行回单'
+      this.upload.open = true
+    },
+    submitFileForm() {
+      this.$refs.upload.submit()
+    },
+    handleDownloadTemplate() {
+      console.log('===== 点击了下载模板,进入 importTemplate 方法 =====') // 新增这行
+      importTemplate().then((response) => {
+        console.log('接口返回的下载链接:', response.msg)
+        this.download(response.msg)
+      }).catch((error) => {
+        console.error('下载模板接口调用失败:', error) // 新增失败回调日志
+      })
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true
+      this.orderUpload.isUploading = true
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      try {
+        this.upload.open = false
+        this.deliveryNoteOpen = false
+        this.$refs.upload.clearFiles()
+
+        // 解析导入结果消息
+        this.parseImportMessage(response.msg)
+
+        // 显示导入结果对话框
+        this.importMsgOpen = true
+
+        // 成功提示
+        this.$message.success('发货单导入完成')
+
+        // 刷新列表
+        this.getList()
+      } catch (error) {
+        console.error('处理上传结果失败:', error)
+        this.$message.error('处理上传结果失败')
+      } finally {
+        // 使用延迟重置,确保动画完成和防止快速重复点击
+        setTimeout(() => {
+          this.upload.isUploading = false
+          this.orderUpload.isUploading = false
+        }, 500)
+      }
+    },
+
+    // 解析导入结果消息
+    parseImportMessage(message) {
+      this.importMsg = message
+      this.importDetails = []
+      this.importSummary = null
+
+      if (!message) return
+
+      try {
+        // 提取成功和失败数量
+        const successMatch = message.match(/成功\s*(\d+)\s*条/)
+        const failMatch = message.match(/失败\s*(\d+)\s*条/)
+
+        const successCount = successMatch ? parseInt(successMatch[1]) : 0
+        const failCount = failMatch ? parseInt(failMatch[1]) : 0
+
+        // 设置统计信息
+        this.importSummary = {
+          successCount,
+          failCount,
+          title: `导入完成:成功 ${successCount} 条,失败 ${failCount} 条`,
+          type: failCount === 0 ? 'success' : (successCount === 0 ? 'error' : 'warning')
+        }
+
+        // 解析详细信息
+        const lines = message.split(/[;;]|第\d+行/)
+
+        lines.forEach((line, index) => {
+          line = line.trim()
+          if (!line || line.match(/^(导入完成|成功|失败)/)) return
+
+          // 提取订单号
+          const orderMatch = line.match(/订单号[::](\S+)/)
+          // 提取失败原因
+          const reasonMatch = line.match(/失败原因[::](.+?)(?:;|;|$)/)
+          // 提取错误信息
+          const errorMatch = line.match(/微信错误信息[::](.+?)(?:;|;|$)/)
+
+          if (orderMatch || reasonMatch || errorMatch) {
+            const detail = {
+              type: reasonMatch || errorMatch ? 'error' : 'success',
+              title: orderMatch ? `订单号: ${orderMatch[1]}` : `第 ${index + 1} 条`,
+              content: ''
+            }
+
+            if (reasonMatch) {
+              detail.content = `失败原因: ${reasonMatch[1]}`
+            }
+
+            if (errorMatch) {
+              detail.content += (detail.content ? ' | ' : '') + `错误: ${errorMatch[1]}`
+            }
+
+            this.importDetails.push(detail)
+          }
+        })
+
+        // 如果没有解析出详细信息,尝试按行分割
+        if (this.importDetails.length === 0) {
+          const detailLines = message.split(/\n|;|;/).filter(l => {
+            const trimmed = l.trim()
+            return trimmed && !trimmed.match(/^(导入完成|成功|失败)/)
+          })
+
+          detailLines.forEach((line, index) => {
+            if (line.trim()) {
+              this.importDetails.push({
+                type: line.includes('失败') ? 'error' : 'info',
+                title: `记录 ${index + 1}`,
+                content: line.trim()
+              })
+            }
+          })
+        }
+      } catch (error) {
+        console.error('解析导入消息失败:', error)
+      }
+    },
+
+    // 关闭导入结果对话框
+    closeImportDialog() {
+      this.importMsgOpen = false
+      this.importMsg = ''
+      this.importSummary = null
+      this.importDetails = []
+    },
+    /** 查询部门下拉树结构 */
+    getTreeselect() {
+      var that = this
+      var param = { companyId: this.companyId }
+      treeselect(param).then((response) => {
+        this.deptOptions = response.data
+        console.log(this.deptOptions)
+        if (response.data != null && response.data.length > 0) {
+          //this.queryParams.deptId=response.data[0].id;
+        }
+      })
+    },
+    companyChange(val) {
+      console.log(val)
+      this.companyId = val
+      this.getTreeselect()
+    },
+    currDeptChange(val) {
+      console.log(val)
+      this.queryParams.deptId = val
+      this.getList()
+    },
+    //打开发货单
+    openDeliveryNote() {
+      this.deliveryNoteOpen = true
+      this.ruleForm.shipmentType = 4
+      this.getAppList()
+    },
+    handleClose(done) {
+      // 如果正在上传中,阻止关闭
+      if (this.orderUpload.isUploading) {
+        this.$message.warning('发货单正在导入中,请等待完成后再关闭')
+        return
+      }
+
+      this.$confirm('确认关闭?')
+        .then(_ => {
+          done()
+        })
+        .catch(_ => {
+        })
+    },
+    //发货单模板下载
+    importDeliveryNoteTemplate() {
+      importDeliveryNoteExpressTemplate().then((response) => {
+        this.download(response.msg)
+      })
+    },
+    getAppList() {
+      this.miniAppList = []
+      // 使用订单模块的小程序列表接口,排除公众号,数据更全面
+      getMiniProgramList().then(response => {
+        if (response.code === 200 && response.data) {
+          this.miniAppList = response.data.map(v => {
+            return { appId: v.appid, appName: v.name }
+          })
+          console.log('获取小程序列表成功,数量:', this.miniAppList.length)
+        }
+      }).catch(error => {
+        console.error('获取小程序列表失败:', error)
+        this.$message.error('获取小程序列表失败')
+        this.miniAppList = []
+      })
+    },
+    // 提交发货单
+    submitDeliveryNote(formName) {
+      // 防止重复提交
+      if (this.orderUpload.isUploading) {
+        this.$message.warning('发货单正在导入中,请勿重复提交')
+        return
+      }
+
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          const uploadFiles = this.$refs.upload.uploadFiles
+          if (uploadFiles.length === 0) {
+            this.$message.error('请选择要上传的文件')
+            return
+          }
+
+          // 立即设置上传状态,防止用户快速多次点击
+          this.orderUpload.isUploading = true
+
+          this.$refs.upload.submit()
+        } else {
+          return false
+        }
+      })
+    },
+    //取消重置
+    cancelResetDeliveryNote(){
+      // 如果正在上传中,阻止取消
+      if (this.orderUpload.isUploading) {
+        this.$message.warning('发货单正在导入中,请等待完成后再取消')
+        return
+      }
+
+      this.deliveryNoteOpen = false;
+      this.ruleForm.miniAppId = null;
+      this.ruleForm.shipmentType = 4;
+      this.resetForm('ruleForm')
+
+      // 清空上传文件列表
+      if (this.$refs.upload) {
+        this.$refs.upload.clearFiles()
+      }
+    },
+    // 一键发货功能
+    async handleBatchDelivery() {
+      this.$confirm(
+        '此操作将把所有待发货订单标记为已发货并同步到微信物流,操作不可逆,是否继续?',
+        '确认一键发货',
+        {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+          dangerouslyUseHTMLString: true,
+          customClass: 'batch-delivery-confirm'
+        }
+      ).then(async () => {
+        try {
+          this.loading = true;
+          const response = await batchDeliveryAllPendingOrders(this.batchDeliveryForm.shipmentType);
+
+          if (response.code === 200) {
+            this.$message.success(`一键发货成功:${response.msg || '已成功处理待发货订单'}`);
+            // 刷新数据
+            this.getList();
+          } else {
+            this.$message.error(`一键发货失败:${response.msg || '服务器返回错误'}`);
+          }
+        } catch (error) {
+          console.error('一键发货失败:', error);
+          let errorMessage = '一键发货失败,请稍后重试';
+          if (error.response && error.response.data && error.response.data.msg) {
+            errorMessage = error.response.data.msg;
+          } else if (error.message) {
+            errorMessage = error.message;
+          }
+          this.$message.error(errorMessage);
+        } finally {
+          this.loading = false;
+        }
+      }).catch(() => {
+        // 用户取消操作
+        this.$message.info('已取消一键发货');
+      });
+    },
+    getProduct(value){
+      //获取商品列表
+      this.productQuery.productName = value;
+      listStoreProduct(this.productQuery).then(response => {
+        if(response.code === 200){
+          this.options=response.rows;
+        }
+      })
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.items {
+  margin: 5px 0px;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: flex-start;
+
+  .pic {
+    width: 60px;
+    height: 60px;
+  }
+
+  .goods-content {
+    margin-left: 10px;
+    max-width: 200px;
+    text-align: left;
+
+    .goods-title {
+
+      overflow: hidden;
+      white-space: nowrap;
+      text-overflow: ellipsis;
+      -o-text-overflow: ellipsis;
+    }
+  }
+}
+
+.el-message-box__message p {
+  max-height: 400px;
+  overflow: scroll;
+}
+
+.import-msg {
+  height: 500px;
+  overflow: auto;
+}
+/* 导入结果对话框样式 */
+.import-result-dialog {
+  .import-result-content {
+    max-height: 500px;
+    overflow-y: auto;
+  }
+
+  .result-summary {
+    margin-bottom: 20px;
+
+    .summary-stats {
+      display: flex;
+      gap: 20px;
+      margin-top: 10px;
+
+      .stat-item {
+        display: flex;
+        align-items: center;
+        gap: 8px;
+        font-size: 14px;
+        font-weight: bold;
+
+        i {
+          font-size: 18px;
+        }
+
+        .label {
+          color: #606266;
+        }
+
+        .value {
+          font-size: 16px;
+        }
+
+        &.success {
+          .value {
+            color: #67c23a;
+          }
+          i {
+            color: #67c23a;
+          }
+        }
+
+        &.error {
+          .value {
+            color: #f56c6c;
+          }
+          i {
+            color: #f56c6c;
+          }
+        }
+      }
+    }
+  }
+
+  .result-details {
+    .detail-list {
+      max-height: 300px;
+      overflow-y: auto;
+
+      .detail-item {
+        padding: 12px;
+        margin-bottom: 8px;
+        border-radius: 4px;
+        background-color: #f5f7fa;
+        border-left: 3px solid #909399;
+
+        &.success {
+          background-color: #f0f9ff;
+          border-left-color: #67c23a;
+
+          .item-header i {
+            color: #67c23a;
+          }
+        }
+
+        &.error {
+          background-color: #fef0f0;
+          border-left-color: #f56c6c;
+
+          .item-header i {
+            color: #f56c6c;
+          }
+        }
+
+        &.info {
+          background-color: #f4f4f5;
+          border-left-color: #909399;
+
+          .item-header i {
+            color: #909399;
+          }
+        }
+
+        .item-header {
+          display: flex;
+          align-items: center;
+          gap: 8px;
+          margin-bottom: 6px;
+          font-weight: bold;
+          font-size: 14px;
+
+          i {
+            font-size: 16px;
+          }
+        }
+
+        .item-content {
+          padding-left: 24px;
+          font-size: 13px;
+          color: #606266;
+          line-height: 1.6;
+          word-break: break-all;
+        }
+      }
+    }
+  }
+
+  .raw-message {
+    .el-alert {
+      margin-top: 10px;
+    }
+  }
+}
+
+/* 响应式设计 */
+@media (max-width: 768px) {
+  .import-result-dialog {
+    .result-summary .summary-stats {
+      flex-direction: column;
+      gap: 10px;
+    }
+  }
+}
+</style>
+<style>
+.el-descriptions-item__label.is-bordered-label {
+  font-weight: normal;
+}
+
+</style>
+<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;
+}
+
+/* 表格布局优化 */
+.el-table {
+  min-width: 100%;
+  table-layout: fixed;
+}
+
+.el-table .el-table__body-wrapper {
+  overflow-x: auto;
+}
+
+.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>
+

+ 594 - 0
src/views/qw/qwcompany/index.vue

@@ -0,0 +1,594 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
+      <el-form-item label="企业CorpID" prop="corpId">
+        <el-input
+          v-model="queryParams.corpId"
+          placeholder="请输入企业CorpID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="企业名称" prop="corpName">
+        <el-input
+          v-model="queryParams.corpName"
+          placeholder="请输入企业名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="关联公司" prop="companyIds">
+        <el-select
+          v-model="queryParams.companyIds"
+          placeholder="请选择公司"
+          clearable
+          filterable
+          size="small"
+        >
+          <el-option
+            v-for="item in companys"
+            :key="item.companyId"
+            :label="item.companyName"
+            :value="String(item.companyId)"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option
+            v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="小程序" prop="miniName">
+        <el-input
+          v-model="queryParams.miniName"
+          placeholder="请输入小程序名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['qw:qwCompany:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5" v-if="ids.length > 0">
+        <span style="color: #909399; font-size: 14px; line-height: 32px;">已选中: {{ ids.length }}项</span>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="qwCompanyList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="id" align="center" prop="id" />
+      <el-table-column label="企业CorpID" align="center" prop="corpId" />
+      <el-table-column label="企业名称" align="center" prop="corpName" />
+      <el-table-column label="关联公司" align="center" prop="companyIds" >
+        <template slot-scope="scope">
+          <div v-for="company in (scope.row.companyIds).split(',') ">
+            <span v-for="com in companys" v-if="com.companyId==company">{{com.companyName }} </span>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
+        </template>
+      </el-table-column>
+      <el-table-column label=绑定小程序 align="center" prop="miniName" width="180"/>
+      <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
+      <el-table-column label="更改时间" align="center" prop="updateTime" width="180"/>
+      <el-table-column label="创建人" align="center" prop="createBy" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['qw:qwCompany:edit']"
+          >修改</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改企微主体对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="200px">
+        <el-form-item label="企业CorpID" prop="corpId">
+          <el-input v-model="form.corpId" placeholder="请输入企业CorpID" :disabled="isEditForm" />
+        </el-form-item>
+        <el-form-item label="企业名称" prop="corpName">
+          <el-input v-model="form.corpName" placeholder="请输入企业名称" :disabled="isEditForm" />
+        </el-form-item>
+        <el-form-item label="服通讯录Secret" prop="serverBookSecret">
+          <el-input v-model="form.serverBookSecret" placeholder="请输入服务商的通讯录Secret" :disabled="isEditForm" />
+        </el-form-item>
+       <el-form-item label="应用Secret" prop="openSecret">
+          <el-input v-model="form.openSecret" placeholder="请输入服务商应用的Secret" :disabled="isEditForm" />
+        </el-form-item>
+        <!-- <el-form-item label="服务商应用的企业id" prop="openCorpId">
+          <el-input v-model="form.openCorpId" placeholder="请输入服务商应用的企业id" />
+        </el-form-item>
+        <el-form-item label="服务商应用serverAgentId" prop="serverAgentId">
+          <el-input v-model="form.serverAgentId" placeholder="请输入服务商应用serverAgentId" />
+        </el-form-item>
+        <el-form-item label="服务商通讯录企业id" prop="serverBookCorpId">
+          <el-input v-model="form.serverBookCorpId" placeholder="请输入服务商通讯录企业id" />
+        </el-form-item>
+
+        <el-form-item label="通用开发参数" prop="providerSecret">
+          <el-input v-model="form.providerSecret" placeholder="请输入通用开发参数" />
+        </el-form-item> -->
+        <el-form-item label="Token" prop="token" >
+          <el-input v-model="form.token" placeholder="请输入Token" :readonly="true" :disabled="isEditForm"/>
+        </el-form-item>
+        <el-form-item label="EncodingAESKey" prop="encodingAesKey" >
+          <el-input v-model="form.encodingAesKey" placeholder="请输入EncodingAESKey" :readonly="true" :disabled="isEditForm"/>
+        </el-form-item>
+
+        <el-form-item label="域名地址" prop="realmNameUrl">
+          <el-input v-model="form.realmNameUrl" placeholder="请输入域名地址" :disabled="isEditForm" />
+        </el-form-item>
+
+        <el-form-item label="应用回调地接" prop="notifyUrl" >
+          <el-input v-model="form.notifyUrl" placeholder="请输入应用回调地接" :readonly="true" :disabled="isEditForm"/>
+        </el-form-item>
+        <el-form-item label="应用id" prop="serverAgentId" >
+          <el-input v-model="form.serverAgentId" placeholder="请输入serverAgentId" :disabled="isEditForm" />
+        </el-form-item>
+        <el-form-item label="小程序id" prop="miniAppId" >
+          <el-select
+            v-model="form.miniAppId"
+            filterable
+            clearable
+            placeholder="请选择"
+            size="small"
+          >
+            <el-option
+              v-for="item in miniAppList"
+              :key="item.appId"
+              :label="item.appName"
+              :value="item.appId"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="企业可信IP" >
+          <div>42.194.245.189;119.29.195.254;129.204.130.233;43.138.187.210;129.204.76.229;159.75.239.132119.29.249.66;122.152.230.82</div>
+        </el-form-item>
+        <el-form-item label="聊天工具栏跳转地址" prop="chatToolbar">
+          <el-input v-model="form.chatToolbar" placeholder="请输入聊天工具栏跳转地址" :disabled="isEditForm" />
+        </el-form-item>
+        <el-form-item label="聊天工具栏实际运用地址" prop="chatToolbarOauth">
+          <el-input v-model="form.chatToolbarOauth" placeholder="请输入聊天工具栏实际运用地址" :disabled="isEditForm" />
+        </el-form-item>
+        <el-form-item label="app分享小程序原始id" prop="shareAppId">
+          <el-input v-model="form.shareAppId" placeholder="app分享小程序原始id" :disabled="isEditForm" />
+        </el-form-item>
+        <el-form-item label="app分享小程序应用id" prop="shareAgentId">
+          <el-input v-model="form.shareAgentId" placeholder="app分享小程序应用id" :disabled="isEditForm" />
+        </el-form-item>
+        <el-form-item label="app分享小程序schma" prop="shareSchema">
+          <el-input v-model="form.shareSchema" placeholder="app分享小程序schema" :disabled="isEditForm" />
+        </el-form-item>
+        <el-form-item label="关联公司" prop="companyIds">
+
+          <el-select filterable  v-model="form.companyIds" remote multiple placeholder="请选择公司名"  clearable style="width: 50%;" :disabled="isEditForm">
+                <el-option
+                  v-for="item in companys"
+                  :key="item.companyId"
+                  :label="item.companyName"
+                  :value="item.companyId"
+                />
+          </el-select>
+
+
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status" :disabled="isEditForm">
+            <el-radio
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="parseInt(dict.dictValue)"
+            >{{dict.dictLabel}}</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 批量更换小程序对话框 -->
+    <el-dialog title="批量更换小程序" :visible.sync="batchMiniAppDialogVisible" width="400px" append-to-body>
+      <el-form ref="batchMiniAppForm" :model="batchMiniAppForm" :rules="batchMiniAppRules" label-width="100px">
+        <el-form-item label="选择小程序" prop="miniAppId">
+          <el-select
+            v-model="batchMiniAppForm.miniAppId"
+            placeholder="请选择小程序"
+            clearable
+            filterable
+            style="width: 100%;"
+          >
+            <el-option
+              v-for="item in batchMiniAppOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+        <el-alert
+          :title="`此操作将更新已选中的 ${ids.length} 个企微主体的小程序配置`"
+          type="warning"
+          :closable="false"
+        />
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitBatchMiniAppForm" :loading="batchUpdateLoading">确 定</el-button>
+        <el-button @click="cancelBatchMiniApp">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listQwCompany, getQwCompany, delQwCompany, addQwCompany, updateQwCompany, exportQwCompany, batchUpdateMiniAppId, getMiniAppList } from "@/api/qw/qwCompany";
+import { getCompanyList } from "@/api/company/company";
+import { listAll } from '@/api/course/coursePlaySourceConfig'
+export default {
+  name: "QwCompany",
+  watch: {
+      'form.realmNameUrl': function(newVal) {
+        if(newVal==null){
+          this.form.notifyUrl="输入域名地址生成";
+        }else{
+           this.form.notifyUrl = "http://"+newVal+"/qw/data/"+this.form.corpId;
+        }
+
+      },
+      'form.corpId': function(newVal) {
+          if (this.form.realmNameUrl !== null) {
+            this.form.notifyUrl = this.form.realmNameUrl + "/qw/data/" + newVal;
+          }
+        }
+    },
+  computed: {
+    /** 是否为修改模式(仅允许改小程序id) */
+    isEditForm() {
+      return !!this.form.id
+    }
+  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 批量更新加载状态
+      batchUpdateLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 企微主体表格数据
+      qwCompanyList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 批量更换小程序对话框显示状态
+      batchMiniAppDialogVisible: false,
+      // 状态字典
+      statusOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        corpId: null,
+        corpName: null,
+        openSecret: null,
+        openCorpId: null,
+        serverAgentId: null,
+        serverBookCorpId: null,
+        serverBookSecret: null,
+        token: null,
+        encodingAesKey: null,
+        providerSecret: null,
+        realmNameUrl: null,
+        notifyUrl: null,
+        chatToolbar: null,
+        chatToolbarOauth: null,
+        companyIds: null,
+        status: null,
+        miniName:null,
+      },
+      // 表单参数
+      form: {},
+      // 批量更换小程序表单参数
+      batchMiniAppForm: {
+        miniAppId: ''
+      },
+      // 批量更换小程序选项列表
+      batchMiniAppOptions: [],
+      companys:[],
+      maAppList:[],
+      miniAppList:[],
+      customAppList:[],
+      // 表单校验
+      rules: {
+        corpId: [{ required: true, message: '请输入企业CorpID', trigger: 'blur' }],
+        realmNameUrl: [{ required: true, message: '请输入域名地址', trigger: 'blur' }],
+        corpName: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+
+      },
+      // 批量更换小程序表单校验
+      batchMiniAppRules: {
+        miniAppId: [
+          { required: true, message: '请选择小程序', trigger: 'change' }
+        ]
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getDicts("sys_company_status").then(response => {
+      this.statusOptions = response.data;
+    });
+    getCompanyList().then(response => {
+        this.companys = response.data;
+
+    });
+  },
+  methods: {
+    /** 查询企微主体列表 */
+    getList() {
+      this.loading = true;
+      listQwCompany(this.queryParams).then(response => {
+        this.qwCompanyList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        corpId: null,
+        corpName: null,
+        openSecret: null,
+        openCorpId: null,
+        serverAgentId: null,
+        serverBookCorpId: null,
+        serverBookSecret: null,
+        token: null,
+        encodingAesKey: null,
+        providerSecret: null,
+        realmNameUrl: null,
+        notifyUrl: null,
+        chatToolbar: null,
+        chatToolbarOauth: null,
+        companyIds: null,
+        status: 0,
+        createTime: null,
+        updateTime: null,
+        createBy: null,
+        shareAppId: null,
+        shareAgentId: null,
+        shareSchema: null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    getAppList() {
+      this.maAppList = []
+      this.miniAppList = []
+      this.customAppList = []
+      listAll().then(response => {
+        const code = response.code
+        const list = response.rows || response.data || []
+        if (code === 200 && list.length) {
+          this.maAppList = list.filter(v => v.type == 2).map(v => {
+            return { appId: v.appid, appName: v.name }
+          })
+          this.miniAppList = list.filter(v => v.type == 1).map(v => {
+            return { appId: v.appid, appName: v.name }
+          })
+          this.customAppList = list.filter(v => v.type == 3).map(v => {
+            return { appId: v.appid, appName: v.name }
+          })
+        }
+      })
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.getAppList()
+      this.open = true;
+      this.form.token="1o62d3YxvdHd4LEUiltnu7sK";
+      this.form.encodingAesKey="UJfTQ5qKTKlegjkXtp1YuzJzxeHlUKvq5GyFbERN1iU";
+      this.title = "添加企微主体";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      this.getAppList()
+      const id = row.id || this.ids
+      getQwCompany(id).then(response => {
+        this.form = response.data;
+        this.form.companyIds=((this.form.companyIds).split(",")).map(Number)
+        this.open = true;
+        this.title = "修改企微主体";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          console.log(this.form.companyIds)
+           this.form.companyIds = (this.form.companyIds).join(',');
+          if (this.form.id != null) {
+            updateQwCompany(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addQwCompany(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除企微主体编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delQwCompany(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有企微主体数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportQwCompany(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    },
+    /** 打开批量更换小程序对话框 */
+    handleBatchUpdateMiniAppId() {
+      // 校验是否勾选了主体
+      if (!this.ids || this.ids.length === 0) {
+        this.$message.warning('请先勾选需要更换的主体');
+        return;
+      }
+      // 获取小程序列表
+      getMiniAppList().then(response => {
+        if (response.code === 200 && response.data) {
+          this.batchMiniAppOptions = response.data;
+          this.batchMiniAppForm = {
+            miniAppId: ''
+          };
+          this.batchMiniAppDialogVisible = true;
+          this.$nextTick(() => {
+            this.$refs.batchMiniAppForm.clearValidate();
+          });
+        }
+      }).catch(() => {
+        this.msgError("获取小程序列表失败");
+      });
+    },
+    /** 取消批量更换小程序 */
+    cancelBatchMiniApp() {
+      this.batchMiniAppDialogVisible = false;
+      this.batchMiniAppForm = {
+        miniAppId: ''
+      };
+      this.$refs.batchMiniAppForm.resetFields();
+    },
+    /** 提交批量更换小程序 */
+    submitBatchMiniAppForm() {
+      this.$refs.batchMiniAppForm.validate(valid => {
+        if (valid) {
+          this.$confirm(`确定要将已选中的 ${this.ids.length} 个企微主体的小程序更换为所选小程序吗?`, '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }).then(() => {
+            this.batchUpdateLoading = true;
+            const data = {
+              miniAppId: this.batchMiniAppForm.miniAppId,
+              ids: this.ids
+            };
+            batchUpdateMiniAppId(data).then(response => {
+              this.msgSuccess(response.msg || "批量更新完成");
+              this.batchMiniAppDialogVisible = false;
+              this.batchUpdateLoading = false;
+              // 清空选中状态
+              this.ids = [];
+              // 刷新列表
+              this.getList();
+            }).catch(() => {
+              this.batchUpdateLoading = false;
+            });
+          }).catch(() => {});
+        }
+      });
+    }
+  }
+};
+</script>