diff --git a/dist.zip b/dist.zip
deleted file mode 100644
index b6177ac..0000000
Binary files a/dist.zip and /dev/null differ
diff --git a/package.json b/package.json
index 4162cd6..8f9f1bb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ant-design-pro",
- "version": "4.5.144",
+ "version": "4.5.146",
"private": true,
"description": "An out-of-box UI solution for enterprise applications",
"scripts": {
diff --git a/src/pages/travelMember/BookingMealOrder/components/orderDetailModal.tsx b/src/pages/travelMember/BookingMealOrder/components/orderDetailModal.tsx
index 3e60110..00b0445 100644
--- a/src/pages/travelMember/BookingMealOrder/components/orderDetailModal.tsx
+++ b/src/pages/travelMember/BookingMealOrder/components/orderDetailModal.tsx
@@ -1023,6 +1023,7 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
|
{orderDetail?.ORDER_AMOUNT?.toFixed(2) || '0.00'} |
|
+ |
)
}}
diff --git a/src/pages/travelMember/OrderAfterSalesManage/components/PartialRefundModal.tsx b/src/pages/travelMember/OrderAfterSalesManage/components/PartialRefundModal.tsx
new file mode 100644
index 0000000..14ee969
--- /dev/null
+++ b/src/pages/travelMember/OrderAfterSalesManage/components/PartialRefundModal.tsx
@@ -0,0 +1,423 @@
+import { connect } from "umi";
+import type { ConnectState } from "@/models/connect";
+import ProTable, { ActionType } from "@ant-design/pro-table";
+import { useRef, useState } from "react";
+import { Button, FormInstance, message, Modal } from "antd";
+import moment from 'moment'
+import { handeGetSaleBillWholeList, handeGetSALEDETAILList, handeSynchroMemberOrderBill } from "../../service";
+
+type DetailProps = {
+ currentUser: any
+ parentRef: any
+ setPartialRefundModalVisible: any
+}
+const PartialRefundModal = ({ currentUser, parentRef, setPartialRefundModalVisible }: DetailProps) => {
+ const actionRef = useRef();
+ const formRef = useRef();
+ const actionModalRef = useRef();
+ const formModalRef = useRef();
+
+ // 行数据
+ const [currentRow, setCurrentRow] = useState()
+ // 显示现在要实际退款的订单的modal
+ const [showModal, setShowModal] = useState(false)
+ // 当前勾选的退款商品
+ const [selectedShopDetail, setSelectShopDetail] = useState([])
+ // 勾选后的退款loading
+ const [refundLoading, setRefundLoading] = useState(false)
+
+ const columns: any = [
+ {
+ dataIndex: 'searchText',
+ title: '查询内容',
+ hideInTable: true,
+ fieldProps: {
+ placeholder: "请输入供货商/购买的商品/订单编号"
+ }
+ },
+ {
+ title: '查询时间',
+ dataIndex: 'search_date',
+ valueType: 'dateRange',
+ hideInTable: true,
+ hideInDescriptions: true,
+ search: {
+ transform: (value) => {
+ return {
+ ORDER_DATE_Start: value[0],
+ ORDER_DATE_End: value[1],
+ };
+ },
+ },
+ fieldProps: {
+ ranges: {
+ "本月": [moment().startOf('M'), moment()],
+ "上月": [moment().subtract(1, 'M').startOf('M'), moment().subtract(1, 'M').endOf('M')],
+ "近三月": [moment().subtract(3, 'M').startOf('M'), moment().endOf('M')],
+ "近半年": [moment().subtract(6, 'M').startOf('M'), moment().endOf('M')],
+ }
+ },
+ // initialValue: [moment().add(-1, 'M').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')],
+ // 2026-01-26 朱老师说的 上个月底前一天
+ initialValue: [moment().subtract(1, 'M').endOf('M').subtract(1, 'd'), moment().endOf('M')],
+ },
+ {
+ title: "序号",
+ dataIndex: "index",
+ valueType: "index",
+ hideInSearch: true,
+ align: "center",
+ width: 60,
+ },
+ {
+ title: "供货商",
+ dataIndex: "MERCHANTS_NAME",
+ width: 200,
+ hideInSearch: true,
+ ellipsis: true,
+ align: "center",
+ },
+ {
+ title: "会员姓名",
+ dataIndex: "ORDERPERSON",
+ width: 200,
+ hideInSearch: true,
+ ellipsis: true,
+ align: "center",
+ render: (_, record) => {
+ return `${record?.ORDER_PERSON || ""}${record?.ORDER_PERSONTEL ? `【${record?.ORDER_PERSONTEL}】` : ""}`
+ }
+ },
+ {
+ title: "收货人员",
+ dataIndex: "AddressInfoPerson",
+ width: 150,
+ hideInSearch: true,
+ ellipsis: true,
+ align: "center",
+ render: (_, record) => {
+ return record?.AddressInfo ? record?.AddressInfo.USER_NAME || "" : ""
+ }
+ },
+ {
+ title: "联系电话",
+ dataIndex: "AddressInfoPersonMOBILEPHONE",
+ width: 150,
+ hideInSearch: true,
+ ellipsis: true,
+ align: "center",
+ render: (_, record) => {
+ return record?.AddressInfo ? record?.AddressInfo.MOBILEPHONE || "" : ""
+ }
+ },
+ {
+ title: "购买的商品",
+ dataIndex: "COMMODITY_NAME",
+ width: 300,
+ hideInSearch: true,
+ ellipsis: true,
+ align: "center",
+ },
+ {
+ title: "订单金额",
+ dataIndex: "ORDER_AMOUNT",
+ width: 120,
+ hideInSearch: true,
+ ellipsis: true,
+ align: "center",
+ sorter: (a, b) => a.ORDER_AMOUNT - b.ORDER_AMOUNT
+ },
+ {
+ title: "订单时间",
+ dataIndex: "ORDER_DATE",
+ width: 180,
+ hideInSearch: true,
+ ellipsis: true,
+ align: "center",
+ render: (_, record) => {
+ return record?.ORDER_DATE ? moment(record?.ORDER_DATE).format('YYYY-MM-DD HH:mm:ss') : "-"
+ },
+ sorter: (a, b) => new Date(a.ORDER_DATE).getTime() - new Date(b.ORDER_DATE).getTime(),
+ defaultSortOrder: 'descend',
+ },
+ {
+ title: "操作",
+ dataIndex: "action",
+ width: 120,
+ hideInSearch: true,
+ align: "center",
+ fixed: "right",
+ render: (_, record) => {
+ return (
+
+ )
+ }
+ }
+ ]
+
+ const columnsModal: any = [
+ {
+ dataIndex: "index",
+ title: "序号",
+ align: 'center',
+ hideInSearch: true,
+ valueType: "index",
+ width: 70,
+ ellipsis: true,
+ },
+ {
+ dataIndex: 'COMMODITY_NAME',
+ title: '商品名称',
+ align: 'center',
+ hideInSearch: true,
+ width: 150,
+ ellipsis: true,
+ },
+ {
+ dataIndex: 'COMMODITY_BARCODE',
+ title: '商品条码',
+ align: 'center',
+ hideInSearch: true,
+ width: 150,
+ ellipsis: true,
+ },
+ {
+ dataIndex: 'COMMODITY_UNIT',
+ title: '商品单位',
+ align: 'center',
+ hideInSearch: true,
+ width: 120,
+ ellipsis: true,
+ },
+ {
+ dataIndex: 'COMMODITY_RULE',
+ title: '商品规格',
+ align: 'center',
+ hideInSearch: true,
+ width: 120,
+ ellipsis: true,
+ },
+ {
+ dataIndex: 'ORDER_COUNT',
+ title: '数量',
+ align: 'center',
+ hideInSearch: true,
+ width: 120,
+ ellipsis: true,
+ },
+ {
+ dataIndex: 'AVERAGE_PRICE',
+ title: '单价',
+ align: 'center',
+ hideInSearch: true,
+ width: 120,
+ ellipsis: true,
+ },
+ {
+ dataIndex: 'ORDER_AMOUNT',
+ title: '金额',
+ align: 'center',
+ hideInSearch: true,
+ width: 120,
+ ellipsis: true,
+ },
+ {
+ dataIndex: 'SALEDETAIL_DESC',
+ title: '备注',
+ align: 'center',
+ hideInSearch: true,
+ width: 150,
+ }
+ ]
+
+ // 部分退款的方法
+ const handleRefund = async () => {
+ // 要退款的商品列表
+ let list: any = []
+ console.log('selectedShopDetailselectedShopDetail', selectedShopDetail);
+
+ // 商品数量
+ let ORDER_COUNTSUM: number = 0
+ // 订单金额合计
+ let OrderAmountSUM: number = 0
+
+ selectedShopDetail.forEach((item: any) => {
+ list.push({
+ SupplierId: item.MERCHANTS_ID, // 供应商内码
+ SupplierName: item.MERCHANTS_NAME, // 供应商名称
+ OriBillDetailId: item.SALEDETAIL_ID,
+ GoodsId: item.COMMODITY_ID, // 商品内码
+ GoodsName: item.COMMODITY_NAME, // 商品名称
+ GoodsBarcode: item.COMMODITY_BARCODE, // 商品条码
+ GoodsUnit: item.COMMODITY_UNIT, // 商品单位
+ GoodsRule: item.COMMODITY_RULE, // 商品规格
+ OrderCount: item.ORDER_COUNT, // 商品数量
+ AveragePrice: item.AVERAGE_PRICE, // 商品单价
+ OrderAmount: item.ORDER_AMOUNT, // 商品金额
+ CostPrice: item.AVERAGE_COST, // 商品成本
+ CostAmount: item.COST_AMOUNT, // 成本金额
+ ConsumePoint: "", // 消耗积分
+ DeliverState: item.SALEBILL_STATE || "", // 发货状态
+ Dutyparagraph: item.DUTY_PARAGRAPH
+ })
+ ORDER_COUNTSUM += item.ORDER_COUNT
+ OrderAmountSUM += item.ORDER_AMOUNT
+ })
+
+ let req: any = {
+ Province_Code: "530000",
+ Serverpart_Id: currentRow?.SERVERPART_ID,
+ ServerpartShop_Id: currentRow?.SERVERPARTSHOP_ID,
+ OrderType: 3999,// 订单类型
+ OriBillCode: currentRow?.PAYMENT_CODE,
+ OrderPerson: currentRow?.ORDER_PERSON,
+ PhoneNumber: currentRow?.ORDER_PERSONTEL,
+ OrderDate: moment().format('YYYY-MM-DD HH:mm:ss'),
+ GoodsCount: list && list.length > 0 ? list.length : "",
+ OrderCount: ORDER_COUNTSUM,
+ OrderAmount: OrderAmountSUM,
+ OrderState: 8000,
+
+ PayMethod: currentRow?.CHANNEL_TYPE,
+ PayAmount: OrderAmountSUM,
+
+ PayDate: "",
+ PayState: 0,
+ MixPay: false,
+ BalanceAmount: currentRow?.BALANCE_PAYMENT,
+ WechatAppSignAppId: "wxee018fb96955552a",
+ DetailList: list
+ }
+ console.log('reqreq', req);
+
+ setRefundLoading(true)
+ const data = await handeSynchroMemberOrderBill(req)
+
+ setRefundLoading(false)
+ if (data.Result_Code === 100) {
+ message.success("退款订单创建成功")
+ setShowModal(false)
+ setSelectShopDetail([])
+ actionRef.current?.reload()
+ if (setPartialRefundModalVisible) {
+ setPartialRefundModalVisible(false)
+ }
+
+ if (parentRef) {
+ parentRef.current?.reload()
+ }
+
+ } else {
+ message.error(data.Result_Msg)
+ }
+ }
+
+
+ return (
+
+
{
+ const req: any = {
+ SearchParameter: {
+ OWNERUNIT_ID: currentUser?.OwnerUnitId,
+ PROVINCE_CODE: currentUser?.ProvinceCode,
+ SALEBILL_TYPES: '3000,3001,3002,3010',
+ ORDER_DATE_Start: params?.ORDER_DATE_Start || "",
+ ORDER_DATE_End: params?.ORDER_DATE_End || "",
+ SALEBILL_STATES: "1010,2010,3000",
+ CHANNEL_TYPE: "",
+ SearchKeyValue: params?.searchText || "",
+ MERCHANTS_IDS: currentUser?.UserPattern === 4000 ? currentUser?.SupplierID : params?.MERCHANTS_IDS || "",
+ },
+ PageIndex: 1,
+ PageSize: 999999,
+ SortStr: "ORDER_DATE desc",
+ }
+
+ const data = await handeGetSaleBillWholeList(req);
+ console.log('可部分退款的订单321312', data);
+ if (data.List && data.List.length > 0) {
+ return { data: data.List, success: true }
+ }
+ return { data: [], success: true }
+ }}
+ />
+ {/* currentRow
+
+ setCurrentRow(record) */}
+ {
+ if (selectedShopDetail && selectedShopDetail.length > 0) {
+ handleRefund()
+ } else {
+ message.error("请选择要退款的商品")
+ }
+ }}
+ onCancel={() => {
+ setCurrentRow(undefined)
+ setShowModal(false)
+ setSelectShopDetail([])
+ }}
+
+ >
+ {
+ console.log('currentRow', currentRow);
+
+ const req: any = {
+ searchParameter: {
+ SALEBILL_ID: currentRow?.SALEBILL_ID,
+ SALEBILL_CHILD_ID: currentRow?.SALEBILL_CHILD_ID
+ },
+ PageIndex: 1,
+ PageSize: 999999,
+ }
+ const data = await handeGetSALEDETAILList(req)
+ console.log('datadatadata', data);
+ if (data.List && data.List.length > 0) {
+ return { data: data.List, success: true }
+ }
+ return { data: [], success: true }
+ }}
+ rowSelection={{
+ type: 'checkbox',
+ onChange: (selectedRowKeys, selectedRows) => {
+ console.log('selectedRowKeys', selectedRowKeys);
+ console.log('selectedRows', selectedRows);
+ setSelectShopDetail(selectedRows)
+ },
+ }}
+ />
+
+
+ )
+}
+
+export default connect(({ user, }: ConnectState) => ({
+ currentUser: user.currentUser,
+}))(PartialRefundModal);
diff --git a/src/pages/travelMember/OrderAfterSalesManage/index.tsx b/src/pages/travelMember/OrderAfterSalesManage/index.tsx
index b86587a..53fce6f 100644
--- a/src/pages/travelMember/OrderAfterSalesManage/index.tsx
+++ b/src/pages/travelMember/OrderAfterSalesManage/index.tsx
@@ -16,6 +16,7 @@ import closeIcon from '@/assets/detail/closeIcon.png'
import './style.less'
import { handleSetlogSave } from "@/utils/format";
import { highlightText } from "@/utils/highlightText";
+import PartialRefundModal from "./components/PartialRefundModal";
const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
@@ -32,6 +33,8 @@ const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) =>
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState() // 是否拖动
+ // 部分退款的悬浮框
+ const [partialRefundModalVisible, setPartialRefundModalVisible] = useState(false)
const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement;
const targetRect = draggleRef.current?.getBoundingClientRect();
@@ -405,12 +408,31 @@ const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) =>
return { data: [], success: true }
}}
toolbar={{
+ actions: [
+
+ ]
}}
/>
-
+ {
+ setPartialRefundModalVisible(false)
+ }}
+ onCancel={() => {
+ setPartialRefundModalVisible(false)
+ }}
+ footer={false}
+ >
+ {/* 部分退款的组件 */}
+
+
+ /// 订单明细相关类
+ ///
+ public class OrderDetailModel
+ {
+ ///
+ /// 供应商名称
+ ///
+ public string SupplierName { get; set; }
+ ///
+ /// 商品内码
+ ///
+ public int? GoodsId { get; set; }
+ ///
+ /// 商品名称
+ ///
+ public string GoodsName { get; set; }
+ ///
+ /// 商品条码
+ ///
+ public string GoodsBarcode { get; set; }
+ ///
+ /// 商品单位
+ ///
+ public string GoodsUnit { get; set; }
+ ///
+ /// 商品规格
+ ///
+ public string GoodsRule { get; set; }
+ ///
+ /// 商品数量
+ ///
+ public decimal OrderCount { get; set; }
+ ///
+ /// 商品单价
+ ///
+ public decimal AveragePrice { get; set; }
+ ///
+ /// 商品金额
+ ///
+ public decimal? OrderAmount { get; set; }
+ ///
+ /// 商品成本
+ ///
+ public decimal CostPrice { get; set; }
+ ///
+ /// 成本金额
+ ///
+ public decimal? CostAmount { get; set; }
+ ///
+ /// 消耗积分
+ ///
+ public decimal? ConsumePoint { get; set; }
+ ///
+ /// 发货状态
+ ///
+ public int DeliverState { get; set; }
+ ///
+ /// 商品图片地址
+ ///
+ public string ImageUrl { get; set; }
+ }
+}
diff --git a/src/pages/travelMember/TradingLedger/OrderModel.cs b/src/pages/travelMember/TradingLedger/OrderModel.cs
new file mode 100644
index 0000000..6a60dc6
--- /dev/null
+++ b/src/pages/travelMember/TradingLedger/OrderModel.cs
@@ -0,0 +1,171 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EShang.Common.Model.WeChatMall
+{
+ ///
+ /// 订单相关类
+ ///
+ public class OrderModel
+ {
+ ///
+ /// 省份编码
+ ///
+ public int? Province_Code { get; set; }
+ ///
+ /// 服务区内码
+ ///
+ public int? Serverpart_Id { get; set; }
+ ///
+ /// 门店内码
+ ///
+ public int? ServerpartShop_Id { get; set; }
+ ///
+ /// 订单内码
+ ///
+ public int? OrderId { get; set; }
+ ///
+ /// 订单类型
+ ///
+ public int? OrderType { get; set; }
+ ///
+ /// 子订单内码
+ ///
+ public int? OrderChildId { get; set; }
+ ///
+ /// 订单编码
+ ///
+ public string OrderCode { get; set; }
+ ///
+ /// 取餐方式(1000:堂食;2000:预约)
+ ///
+ public int? TakeType { get; set; }
+ ///
+ /// 就餐方式(1000:堂食;2000:打包)
+ ///
+ public int? PackType { get; set; }
+ ///
+ /// 客户单位
+ ///
+ public string CompanyName { get; set; }
+ ///
+ /// 下单人员
+ ///
+ public string OrderPerson { get; set; }
+ ///
+ /// 手机号码
+ ///
+ public string PhoneNumber { get; set; }
+ ///
+ /// 下单时间
+ ///
+ public string OrderDate { get; set; }
+ ///
+ /// 预约时间
+ ///
+ public string ReservationDate { get; set; }
+ ///
+ /// 商品种类
+ ///
+ public int GoodsCount { get; set; }
+ ///
+ /// 下单数量
+ ///
+ public decimal OrderCount { get; set; }
+ ///
+ /// 订单金额
+ ///
+ public decimal? OrderAmount { get; set; }
+ ///
+ /// 消耗积分
+ ///
+ public decimal? ConsumePoint { get; set; }
+ ///
+ /// 优惠金额
+ ///
+ public decimal? DiscountAmount { get; set; }
+ ///
+ /// 打包金额
+ ///
+ public decimal? PackAmount { get; set; }
+ ///
+ /// 订单状态
+ ///
+ public int OrderState { get; set; }
+ ///
+ /// 收货人员
+ ///
+ public string ReceivePerson { get; set; }
+ ///
+ /// 收货人手机
+ ///
+ public string ReceivePersonTel { get; set; }
+ ///
+ /// 收货地址
+ ///
+ public string ReceiveAddress { get; set; }
+ ///
+ /// 门牌号码
+ ///
+ public string ReceiveDoorPlate { get; set; }
+ ///
+ /// 取餐码
+ ///
+ public string TakeNumber { get; set; }
+ ///
+ /// 支付方式
+ ///
+ public string PayMethod { get; set; }
+ ///
+ /// 支付金额
+ ///
+ public decimal? PayAmount { get; set; }
+ ///
+ /// 支付时间
+ ///
+ public string PayDate { get; set; }
+ ///
+ /// 支付状态
+ ///
+ public int PayState { get; set; }
+ ///
+ /// 组合支付
+ ///
+ public bool MixPay { get; set; }
+ ///
+ /// 工会积分支付
+ ///
+ public decimal? BalanceAmount { get; set; }
+ ///
+ /// 微信小程序APPID
+ ///
+ public string WechatAppSignAppId { get; set; }
+ ///
+ /// 订单明细列表
+ ///
+ public List DetailList { get; set; }
+ }
+
+ ///
+ /// 订单数据导入相关类
+ ///
+ public class OrderBillImportModel
+ {
+ ///
+ /// 业主单位内码
+ ///
+ public int OwnerUnitId { get; set; }
+ ///
+ /// 微信小程序APPID
+ ///
+ public string WechatAppSignAppId { get; set; }
+
+ ///
+ /// 订单数据
+ ///
+ public List orderList { get; set; }
+ }
+}
diff --git a/src/pages/travelMember/TradingLedger/index.tsx b/src/pages/travelMember/TradingLedger/index.tsx
index 7579723..9e4bd4d 100644
--- a/src/pages/travelMember/TradingLedger/index.tsx
+++ b/src/pages/travelMember/TradingLedger/index.tsx
@@ -2,11 +2,12 @@
import { connect } from "umi";
import type { CurrentUser } from "umi";
import type { ConnectState } from "@/models/connect";
-import React, { useRef, useState } from "react";
+import React, { useRef, useState, useEffect } from "react";
import ProCard from "@ant-design/pro-card";
import { MenuFoldOutlined } from "@ant-design/icons";
import type { FormInstance } from "antd";
-import { Button, message, Space, Spin, Tree } from "antd";
+import { Button, message, Space, Spin, Tree, Modal, Upload, Popconfirm } from "antd";
+import { InboxOutlined } from "@ant-design/icons";
import useRequest from "@ahooksjs/use-request";
import { getServerpartTree } from "@/services/options";
import type { ActionType } from "@ant-design/pro-table";
@@ -14,11 +15,12 @@ import ProTable from "@ant-design/pro-table";
import ReactHTMLTableToExcel from "react-html-table-to-excel";
import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree";
import PageTitleBox from "@/components/PageTitleBox";
-import { handeGetCOMPANYList, handeGetMERCHANTSList, handeGetOnlineBillAccountList, handeGetSalebillAccountList, handeGetSupplierSaleBillList } from "../service";
+import { handeGetCOMPANYList, handeGetMERCHANTSList, handeGetOnlineBillAccountList, handeGetSalebillAccountList, handeGetSupplierSaleBillList, handeImportOrderBill } from "../service";
import moment from 'moment'
import OrderDetailModal from "../BookingMealOrder/components/orderDetailModal";
import { exportXlsxFromProColumnsExcelJS, formatTreeData, handleSetlogSave } from "@/utils/format";
import { highlightText } from "@/utils/highlightText";
+import * as XLSX from 'xlsx';
const TradingLedger: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { currentUser } = props
@@ -46,6 +48,20 @@ const TradingLedger: React.FC<{ currentUser: CurrentUser }> = (props) => {
const [currentSearchText, setCurrentSearchText] = useState('')
// 获取导出数据的loading
const [getExportDataLoading, setGetExportDataLoading] = useState(false);
+ // 导入订单相关状态
+ const [importModalVisible, setImportModalVisible] = useState(false);
+ // 当前导入的订单数据
+ const [parsedOrders, setParsedOrders] = useState([]);
+ // 导入的loading
+ const [importLoading, setImportLoading] = useState(false);
+ const isMounted = useRef(true);
+
+ useEffect(() => {
+ isMounted.current = true;
+ return () => {
+ isMounted.current = false;
+ };
+ }, []);
// 获取所属单位
const { loading: companyLoading, data: companyList = [] } = useRequest(async () => {
@@ -732,6 +748,130 @@ const TradingLedger: React.FC<{ currentUser: CurrentUser }> = (props) => {
}
}
+ // 处理导入 Excel 并识别内容
+ const handleImportExcel = async (fileObj: any) => {
+ // 确保传入的是 Blob/File 对象
+ const file = fileObj.originFileObj || fileObj;
+ if (!(file instanceof Blob)) {
+ console.error('传入的文件对象无效:', fileObj);
+ message.error('文件上传有误,请重试');
+ return;
+ }
+
+ try {
+ const reader = new FileReader();
+ reader.onload = (e: any) => {
+ try {
+ const data = e.target.result;
+ const workbook = XLSX.read(data, { type: "binary" });
+
+ const firstSheetName = workbook.SheetNames[0];
+ const worksheet = workbook.Sheets[firstSheetName];
+ const rawData: any = XLSX.utils.sheet_to_json(worksheet);
+
+ processExcelData(rawData);
+ } catch (err) {
+ console.error('读取 Excel 失败:', err);
+ message.error('Excel 内容读取失败');
+ }
+ };
+ reader.readAsBinaryString(file);
+ } catch (error) {
+ console.error('FileReader 错误:', error);
+ message.error('文件解析遇到错误');
+ }
+ };
+
+ const processExcelData = (rawData: any[]) => {
+ console.log('Excel 原始识别条数:', rawData?.length);
+
+ if (rawData && rawData.length > 0) {
+ const phoneRegex = /^1[3-9]\d{9}$/;
+ const errorMessages: string[] = [];
+
+ const formattedList = rawData.map((item: any, index: number) => {
+ const orderPerson = item['下单人'] || `第 ${index + 1} 行客户`;
+ const phoneNumber = String(item['微信授权手机号码'] || '').trim();
+ const receivePersonTel = String(item['收货手机号码'] || '').trim();
+
+ // 手机号有效性检查
+ if (phoneNumber && !phoneRegex.test(phoneNumber)) {
+ errorMessages.push(`下单人[${orderPerson}]的“微信授权手机号码”格式不正确`);
+ }
+ if (receivePersonTel && !phoneRegex.test(receivePersonTel)) {
+ errorMessages.push(`下单人[${orderPerson}]的“收货手机号码”格式不正确`);
+ }
+
+ const orderItem: any = {
+ OrderType: "", // 订单类型 空着
+ CompanyName: item['单位名称'],
+ OrderPerson: orderPerson,
+ PhoneNumber: phoneNumber,
+ OrderDate: item['下单时间'],
+ ReceivePerson: item['收货人名称'] || item['收货人'],
+ ReceivePersonTel: receivePersonTel,
+ ReceiveAddress: item['收货地址'],
+ DetailList: []
+ };
+
+ const alphabet = 'ABCDEFGHIJ';
+ for (let char of alphabet) {
+ const nameKey = `套餐商品${char}`;
+ if (item[nameKey]) {
+ orderItem.DetailList.push({
+ GoodsName: item[nameKey],
+ GoodsBarcode: item[`套餐商品${char}条码`],
+ OrderCount: item[`套餐商品${char}数量`],
+ OrderAmount: item[`套餐商品${char}金额`],
+ });
+ }
+ }
+ return orderItem;
+ });
+
+ // 提示所有校验错误
+ if (errorMessages.length > 0) {
+ // 如果错误太多,只显示前5条
+ const showErrors = errorMessages.length > 5 ? errorMessages.slice(0, 5).concat(`...等共计 ${errorMessages.length} 处错误`) : errorMessages;
+ Modal.error({
+ title: '数据校验失败',
+ content: (
+
+ {showErrors.map((err, i) =>
· {err}
)}
+
+ ),
+ });
+ return; // 校验失败不进行后续预览
+ }
+
+ if (isMounted.current) {
+ setParsedOrders(formattedList);
+ message.success(`成功识别 ${formattedList.length} 条订单数据`);
+ }
+ }
+ };
+
+ // 提示询问 是否确认导入
+ const handleConfirmImport = async () => {
+ if (parsedOrders && parsedOrders.length > 0) {
+ const req: any = {
+ OwnerUnitId: "911", // 业主单位内码
+ WechatAppSignAppId: "wxee018fb96955552a", // 小程序APPID
+ orderList: parsedOrders // 订单数据
+ }
+ setImportLoading(true)
+ const data = await handeImportOrderBill(req)
+ setImportLoading(false)
+ message.success('导入成功!')
+ console.log('导入结果:', data);
+ setImportModalVisible(false);
+ setParsedOrders([]);
+ actionRef.current?.reload();
+ } else {
+ message.error(`请先导入数据!`);
+ }
+ }
+
return (
{
// 打印报表
@@ -836,7 +976,7 @@ const TradingLedger: React.FC<{ currentUser: CurrentUser }> = (props) => {
导出财务结算Excel
,
,
)
}
diff --git a/src/pages/travelMember/service.ts b/src/pages/travelMember/service.ts
index 0ddb228..ece8d2f 100644
--- a/src/pages/travelMember/service.ts
+++ b/src/pages/travelMember/service.ts
@@ -1457,3 +1457,31 @@ export async function handeSetGoodsDutyParagraph(params: any) {
}
return data
}
+
+
+// 导入订单的接口
+export async function handeImportOrderBill(params: any) {
+ const data = await requestEncryption(`/OnlineOrder/ImportOrderBill`, {
+ method: 'POST',
+ data: { ...params, requestEncryption: true }
+ })
+ if (data.Result_Code !== 100) {
+ return data
+ }
+ return data
+}
+
+
+// 部分退款的同步订单
+export async function handeSynchroMemberOrderBill(params: any) {
+ const data = await requestEncryption(`/OnlineOrder/SynchroMemberOrderBill`, {
+ method: 'POST',
+ data: { ...params, requestEncryption: true }
+ })
+ if (data.Result_Code !== 100) {
+ return data
+ }
+ return data
+}
+
+
diff --git a/src/versionEnv.ts b/src/versionEnv.ts
index 983e1e7..97b6917 100644
--- a/src/versionEnv.ts
+++ b/src/versionEnv.ts
@@ -1,4 +1,4 @@
// 由 scripts/writeVersion.js 自动生成
-export const VERSION = "4.5.144";
-export const GIT_HASH = "94b60d1";
-export const BUILD_TIME = "2026-02-06T01:29:10.945Z";
+export const VERSION = "4.5.146";
+export const GIT_HASH = "7427b81";
+export const BUILD_TIME = "2026-02-12T01:43:51.073Z";