|  | @@ -334,7 +334,7 @@
 | 
	
		
			
				|  |  |              >设置推送手机</el-button>
 | 
	
		
			
				|  |  |            </el-tooltip>
 | 
	
		
			
				|  |  |          </el-col>
 | 
	
		
			
				|  |  | -        <el-col :span="1.5" v-if="orderStatus == 5">
 | 
	
		
			
				|  |  | +        <!-- <el-col :span="1.5" v-if="orderStatus == 5">
 | 
	
		
			
				|  |  |            <el-tooltip content="批量推送erp" placement="top">
 | 
	
		
			
				|  |  |              <el-button
 | 
	
		
			
				|  |  |                type="warning"
 | 
	
	
		
			
				|  | @@ -345,6 +345,18 @@
 | 
	
		
			
				|  |  |                v-hasPermi="['his:storeOrder:createErpOrder']"
 | 
	
		
			
				|  |  |              >创建erp</el-button>
 | 
	
		
			
				|  |  |            </el-tooltip>
 | 
	
		
			
				|  |  | +        </el-col> -->
 | 
	
		
			
				|  |  | +        <el-col :span="1.5" v-if="orderStatus == 5">
 | 
	
		
			
				|  |  | +          <el-tooltip content="批量推送erp" placement="top">
 | 
	
		
			
				|  |  | +            <el-button
 | 
	
		
			
				|  |  | +              type="warning"
 | 
	
		
			
				|  |  | +              plain
 | 
	
		
			
				|  |  | +              icon="el-icon-s-cooperation"
 | 
	
		
			
				|  |  | +              size="mini"
 | 
	
		
			
				|  |  | +              @click="showErpAccountDialog"
 | 
	
		
			
				|  |  | +              v-hasPermi="['his:storeOrder:createErpOrder']"
 | 
	
		
			
				|  |  | +            >创建erp</el-button>
 | 
	
		
			
				|  |  | +          </el-tooltip>
 | 
	
		
			
				|  |  |          </el-col>
 | 
	
		
			
				|  |  |          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
 | 
	
		
			
				|  |  |        </el-row>
 | 
	
	
		
			
				|  | @@ -541,11 +553,85 @@
 | 
	
		
			
				|  |  |          <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-item label="账户信息" v-if="selectedAccountInfo">
 | 
	
		
			
				|  |  | +            <div class="account-info">
 | 
	
		
			
				|  |  | +              <p><strong>账户名称:</strong>{{ selectedAccountInfo.accountName }}</p>
 | 
	
		
			
				|  |  | +              <p><strong>账户编码:</strong>{{ selectedAccountInfo.accountCode }}</p>
 | 
	
		
			
				|  |  | +              <p><strong>账户状态:</strong>
 | 
	
		
			
				|  |  | +                <el-tag :type="selectedAccountInfo.status === 1 ? 'success' : 'danger'">
 | 
	
		
			
				|  |  | +                  {{ selectedAccountInfo.status === 1 ? '正常' : '禁用' }}
 | 
	
		
			
				|  |  | +                </el-tag>
 | 
	
		
			
				|  |  | +              </p>
 | 
	
		
			
				|  |  | +              <p v-if="selectedAccountInfo.description"><strong>描述:</strong>{{ selectedAccountInfo.description }}</p>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +          </el-form-item> -->
 | 
	
		
			
				|  |  | +        </el-form>
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        <!-- 订单统计信息 -->
 | 
	
		
			
				|  |  | +        <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>
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import { listOrder, getOrder, delOrder, addOrder,importExpressTemplate, updateOrder, exportOrder,importTemplate,exportOrder2,queryErpPhone,saveErpPhone,editErpPhone,batchCreateErpOrder } from "@/api/his/storeOrder";
 | 
	
		
			
				|  |  | +import { listOrder, getOrder, delOrder, addOrder,importExpressTemplate, updateOrder, exportOrder,importTemplate,exportOrder2,queryErpPhone,
 | 
	
		
			
				|  |  | +  saveErpPhone,editErpPhone,batchCreateErpOrder,getErpAccount } from "@/api/his/storeOrder";
 | 
	
		
			
				|  |  |  import storeOrderDetails from '../../components/his/storeOrderDetails.vue';
 | 
	
		
			
				|  |  |  import { getToken } from "@/utils/auth";
 | 
	
		
			
				|  |  |  import {listStore} from "@/api/his/storeProduct";
 | 
	
	
		
			
				|  | @@ -562,8 +648,27 @@ export default {
 | 
	
		
			
				|  |  |      // 监听deptId
 | 
	
		
			
				|  |  |      'deptId': 'currDeptChange'
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  // computed: {
 | 
	
		
			
				|  |  | +  //   // 计算选中账户的详细信息
 | 
	
		
			
				|  |  | +  //   selectedAccountInfo() {
 | 
	
		
			
				|  |  | +  //     if (!this.erpAccountForm.selectedAccount) return null;
 | 
	
		
			
				|  |  | +  //     return this.erpAccountList.find(account => account.id === this.erpAccountForm.selectedAccount);
 | 
	
		
			
				|  |  | +  //   }
 | 
	
		
			
				|  |  | +  // },
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  | +      // ERP账户相关数据
 | 
	
		
			
				|  |  | +      erpAccountDialog: {
 | 
	
		
			
				|  |  | +        open: false,
 | 
	
		
			
				|  |  | +        title: "选择ERP账户",
 | 
	
		
			
				|  |  | +        loading: false,
 | 
	
		
			
				|  |  | +        submitting: false
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      erpAccountList: [], // ERP账户列表
 | 
	
		
			
				|  |  | +      erpAccountForm: {
 | 
	
		
			
				|  |  | +        selectedAccount: null // 选中的账户ID
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      orderSummary: null, // 订单统计信息
 | 
	
		
			
				|  |  |        erpPhoneValue:[],
 | 
	
		
			
				|  |  |        setPhoneOpen:false,
 | 
	
		
			
				|  |  |        erpPhone:{
 | 
	
	
		
			
				|  | @@ -783,6 +888,155 @@ export default {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  | +    // 修改:显示ERP账户选择对话框
 | 
	
		
			
				|  |  | +    showErpAccountDialog() {
 | 
	
		
			
				|  |  | +      this.erpAccountDialog.open = true;
 | 
	
		
			
				|  |  | +      this.erpAccountDialog.loading = true;
 | 
	
		
			
				|  |  | +      this.getErpAccountList();
 | 
	
		
			
				|  |  | +      this.calculateOrderSummary();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    // 新增:获取ERP账户列表
 | 
	
		
			
				|  |  | +    async getErpAccountList() {
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        const response = await getErpAccount();
 | 
	
		
			
				|  |  | +        if (response.code === 200) {
 | 
	
		
			
				|  |  | +          this.erpAccountList = response.data || [];
 | 
	
		
			
				|  |  | +        } 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.orderList.forEach(order => {
 | 
	
		
			
				|  |  | +          if (this.ids.includes(order.orderId)) {
 | 
	
		
			
				|  |  | +            totalAmount += parseFloat(order.payMoney || 0);
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        // 如果没有选中订单,统计当前查询条件下的所有订单
 | 
	
		
			
				|  |  | +        selectedCount = queryCount;
 | 
	
		
			
				|  |  | +        this.orderList.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;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  | +      // const selectedAccount = this.selectedAccountInfo;
 | 
	
		
			
				|  |  | +      // if (selectedAccount.status !== 1) {
 | 
	
		
			
				|  |  | +      //   this.$message.error('选中的ERP账户状态异常,无法推送');
 | 
	
		
			
				|  |  | +      //   return;
 | 
	
		
			
				|  |  | +      // }
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  | +      this.$confirm(
 | 
	
		
			
				|  |  | +        `确认将订单推送到ERP账户"${this.erpAccountForm.selectedAccount}"吗?`, 
 | 
	
		
			
				|  |  | +        '确认推送', 
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +          confirmButtonText: '确定推送',
 | 
	
		
			
				|  |  | +          cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +          type: 'warning'
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      ).then(() => {
 | 
	
		
			
				|  |  | +        this.executeCreateErpOrder();
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    //执行创建ERP订单
 | 
	
		
			
				|  |  | +    async executeCreateErpOrder() {
 | 
	
		
			
				|  |  | +      this.erpAccountDialog.submitting = true;
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        let param = {
 | 
	
		
			
				|  |  | +          loginAccount: this.erpAccountForm.selectedAccount
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        if (this.ids.length > 0) {
 | 
	
		
			
				|  |  | +          // 如果有选中的订单,只推送选中的
 | 
	
		
			
				|  |  | +          param.orderIds = this.ids;
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          // 如果没有选中订单,推送查询条件下的所有订单
 | 
	
		
			
				|  |  | +          if (this.payTypeArr.length > 0) {
 | 
	
		
			
				|  |  | +            this.queryParams.payType = this.payTypeArr.toString();
 | 
	
		
			
				|  |  | +          } else {
 | 
	
		
			
				|  |  | +            this.queryParams.payType = null;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          if (this.scheduleIdArr.length > 0) {
 | 
	
		
			
				|  |  | +            this.queryParams.scheduleId = this.scheduleIdArr.toString();
 | 
	
		
			
				|  |  | +          } else {
 | 
	
		
			
				|  |  | +            this.queryParams.scheduleId = null;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          if (this.buyTypeArr.length > 0) {
 | 
	
		
			
				|  |  | +            this.queryParams.orderBuyType = this.buyTypeArr.toString();
 | 
	
		
			
				|  |  | +          } else {
 | 
	
		
			
				|  |  | +            this.queryParams.orderBuyType = null;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          if (this.channelArr.length > 0) {
 | 
	
		
			
				|  |  | +            this.queryParams.orderChannel = this.channelArr.toString();
 | 
	
		
			
				|  |  | +          } else {
 | 
	
		
			
				|  |  | +            this.queryParams.orderChannel = null;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          if (this.qwSubjectArr.length > 0) {
 | 
	
		
			
				|  |  | +            this.queryParams.qwSubject = this.qwSubjectArr.toString();
 | 
	
		
			
				|  |  | +          } else {
 | 
	
		
			
				|  |  | +            this.queryParams.qwSubject = null;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          
 | 
	
		
			
				|  |  | +          // 合并查询参数
 | 
	
		
			
				|  |  | +          param = { ...param, ...this.queryParams };
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        const response = await batchCreateErpOrder(param);
 | 
	
		
			
				|  |  | +        if (response.code === 200) {
 | 
	
		
			
				|  |  | +          this.$message.success('ERP订单创建成功');
 | 
	
		
			
				|  |  | +          this.cancelErpAccountDialog();
 | 
	
		
			
				|  |  | +          this.getList(); // 刷新列表
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          this.$message.error(response.msg || 'ERP订单创建失败');
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      } catch (error) {
 | 
	
		
			
				|  |  | +        console.error('创建ERP订单失败:', error);
 | 
	
		
			
				|  |  | +        this.$message.error('创建ERP订单失败');
 | 
	
		
			
				|  |  | +      } finally {
 | 
	
		
			
				|  |  | +        this.erpAccountDialog.submitting = false;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    // 新增:取消ERP账户选择对话框
 | 
	
		
			
				|  |  | +    cancelErpAccountDialog() {
 | 
	
		
			
				|  |  | +      this.erpAccountDialog.open = false;
 | 
	
		
			
				|  |  | +      this.erpAccountForm.selectedAccount = null;
 | 
	
		
			
				|  |  | +      this.orderSummary = null;
 | 
	
		
			
				|  |  | +      this.erpAccountList = [];
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      createErpOrder(){
 | 
	
		
			
				|  |  |        this.$confirm('确认创建erp?', '提示', {
 | 
	
		
			
				|  |  |          confirmButtonText: '确定',
 |