From 50ed4183554fc38090a93d87015e60e613003356 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Fri, 12 Jan 2024 14:38:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.js | 16 +- src/app.jsx | 12 + src/pages/order/orderflow/index.jsx | 301 ++++++++++++++++++ src/pages/order/orderflow/orderflowDetail.jsx | 228 +++++++++++++ src/pages/order/orderflow/service.js | 99 ++++++ 5 files changed, 654 insertions(+), 2 deletions(-) create mode 100644 src/pages/order/orderflow/index.jsx create mode 100644 src/pages/order/orderflow/orderflowDetail.jsx create mode 100644 src/pages/order/orderflow/service.js diff --git a/config/routes.js b/config/routes.js index 73fd0e0..477f327 100644 --- a/config/routes.js +++ b/config/routes.js @@ -61,7 +61,7 @@ export default [ // component: './sys/log', // access: 'k3', // }, - + ], }, { @@ -118,7 +118,7 @@ export default [ component: './database/basic/batching', access: 'k7', }, - + { name: '商品管理', icon: 'smile', @@ -293,6 +293,18 @@ export default [ }, ], }, + { + name: '订单管理', + icon: 'BankFilled', + path: '/order', + routes: [ + { + name: '订单流水', + icon: 'smile', + path: '/order/orderflow', + component: './order/orderflow', + },] + }, { path: '/', redirect: '/welcome', diff --git a/src/app.jsx b/src/app.jsx index 6de236c..5051afc 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -342,6 +342,18 @@ export async function getInitialState() { }, ], }, + { + name: '订单管理', + icon: 'BankFilled', + path: '/order', + routes: [ + { + name: '订单流水', + icon: 'smile', + path: '/order/orderflow', + component: './order/orderflow', + },] + }, ]; // api.queryMenus(); return data; diff --git a/src/pages/order/orderflow/index.jsx b/src/pages/order/orderflow/index.jsx new file mode 100644 index 0000000..c6e95a7 --- /dev/null +++ b/src/pages/order/orderflow/index.jsx @@ -0,0 +1,301 @@ +import { DropboxOutlined, PlusOutlined, DownloadOutlined } from '@ant-design/icons'; +import { Button, message, Select, Input, Drawer, Popconfirm } from 'antd'; +import React, { useState, useRef, useEffect } from 'react'; +import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ExportJsonExcel from 'js-export-excel'; +import api from './service'; +import OrderflowDetail from './orderflowDetail'; + +const handlerefund = async (value) => { + var data = { number: value }; + const hide = message.loading('正在发起退款'); + try { + api.StartRefund(data); + hide(); + message.success('发起退款成功,即将刷新'); + return true; + } catch (error) { + hide(); + message.error('发起退款失败,请重试'); + return false; + } +}; +const Manage = () => { + const [row, setRow] = useState(); + const [createModalVisible, handleModalVisible] = useState(false); + //获取店铺(店铺信息) + const [srdList, setsrdList] = useState([]); + const [dataList, setdataList] = useState([]); + //绑定 + const actionRef = useRef(); + const [Selectparams, setparams] = useState([]); + // 获取店铺分类、商品名称信息 + useEffect(() => { + //店铺名称(店铺信息) + function initsrdList() { + api.srdList().then((r) => { + var arr = r.data; + arr?.forEach((element) => { + element.value = element.id; + element.label = element.name; + }); + setsrdList(arr); + }); + } + + initsrdList(); + }, []); + /**导出 */ + function handleExport() { + api.GetFlowExport(Selectparams).then((res) => { + let url = URL.createObjectURL(new Blob([res])); + let filename = '订单流水.xlsx'; + let a = document.createElement('a'); + a.href = url; + a.download = filename; + a.click(); + URL.revokeObjectURL(url); + }); + } + /** 国际化配置 */ + + const columns = [ + { + title: '主键', + dataIndex: 'id', + tip: '规则名称是唯一的 key', + hideInSearch: true, + hideInTable: true, + }, + { + title: '订单时间', + dataIndex: 'order_CreateTime', + valueType: 'dateRange', + hideInTable: true, + search: { + transform: (value) => { + return { + order_CreateTime: value[0], + order_EndTime: value[1], + }; + }, + }, + }, + { + title: '手机号', + dataIndex: 'Customer_Tel', + hideInTable: true, + }, + { + title: '店铺名称', + dataIndex: 'storeId', + hideInTable: true, + valueType: 'select', + renderFormItem: () => ( + ; + } + + return defaultRender(item); + }, + }, + { + title: '操作', + dataIndex: 'option', + valueType: 'option', + render: (_, record) => [ + { + setRow(record), handleModalVisible(true); + }} + > + 查看详情 + , + { + api.printsmallticket({ "orderId": record.id }) + .then(re => { + if (re.data) { + message.success('打印成功'); + } else { + message.error('打印失败'); + } + + }) + + }} > + 打印小票 + , + ], + }, + ]; + + //下载Excel + const onDownloadExcel = async () => { + const response = await api.GetFlowExport(Selectparams) + if (response.isSuccess) { + let option = {}; //option代表的就是excel文件 + const date = new Date(); + const excelName = "订单流水" + date.toLocaleString().replaceAll('\/', '-'); + option.fileName = excelName; //excel文件名称 + const sheetHeader = ['storeTypeName','storeName','order_Number','order_OriginalMoney','order_RealMoney','refundOriginalMoney','refundRealMoney','order_Count','order_CreateTime'];; + // Object.keys(response.data[0]).forEach(item => { + // sheetHeader.push(item); + // }); + option.datas = [ + { + sheetData: response.data, //excel文件中的数据源 + sheetName: excelName, //excel文件中sheet页名称 + sheetFilter: sheetHeader, //excel文件中需显示的列数据 + sheetHeader: ['店铺分类', '店铺名称', '交易单号', '应付金额', '实付金额', + '应付金额(退)', '实付金额(退)', '子订单数量', '创建时间', + ] //excel文件中每列的表头名称 + } + ] + let toExcel = new ExportJsonExcel(option); //生成excel文件 + toExcel.saveExcel(); + } else { + message.error(response.errors || '导出失败'); + } +} + + return ( + + [ + , + ]} + columns={columns} + //数据绑定 + request={async (params, sorter, filter) => { + if (params.storeTypeId != undefined) { + //店铺分类 + params.storeTypeId = srdTypeList[params.storeTypeId].storeTypeId; + } + const msg = await api.orderList(params); + setparams(params); + setdataList(msg.data.data); + return { + data: msg.data.data, + success: true, + total: msg.data.total, + }; + }} + > + + {!!row && ( + { + // var success = false; + + // }} + onCancel={() => { + setRow(undefined); + handleModalVisible(false); + }} + createModalVisible={createModalVisible} + values={row || {}} + /> + )} + + ); +}; + +export default Manage; diff --git a/src/pages/order/orderflow/orderflowDetail.jsx b/src/pages/order/orderflow/orderflowDetail.jsx new file mode 100644 index 0000000..ca531c0 --- /dev/null +++ b/src/pages/order/orderflow/orderflowDetail.jsx @@ -0,0 +1,228 @@ +import React, { useState, useEffect } from 'react'; +import { message, Modal, Descriptions } from 'antd'; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import api from './service'; +import { FrownTwoTone } from '@ant-design/icons'; + +let defaultData = {}; +const OrderflowDetail = (props) => { + const { createModalVisible, onCancel } = props; + const [orderInfo, setOrderInfo] = useState([]); + return ( + onCancel()} + maskClosable={false} + > + { + defaultData = await api.GetOrderDetails({ id: props.values.id }); + setOrderInfo(defaultData); + return Promise.resolve({ + success: true, + data: defaultData, + }); + }} + columns={[ + { + title: '会员姓名', + key: 'customer_Name', + dataIndex: 'customer_Name', + }, + { + title: '手机号', + key: 'customer_Tel', + dataIndex: 'customer_Tel', + }, + { + title: '订单流水', + key: 'order_Number', + dataIndex: 'order_Number', + }, + { + title: '订单号', + key: 'transaction_ID', + dataIndex: 'transaction_ID', + }, + { + title: '交易单号', + key: 'trade_no', + dataIndex: 'trade_no', + }, + { + title: '排队号', + key: 'order_SortID', + dataIndex: 'order_SortID', + }, + { + title: '折扣', + key: 'discount', + dataIndex: 'discount', + }, + { + title: '实付金额', + dataIndex: 'order_RealMoney', + valueType: 'money', + fieldProps: { + moneySymbol: '¥', + }, + }, + { + title: '应付金额', + dataIndex: 'order_OriginalMoney', + valueType: 'money', + fieldProps: { + moneySymbol: '¥', + }, + }, + { + title: '实付金额(退)', + dataIndex: 'refundRealMoney', + valueType: 'money', + fieldProps: { + moneySymbol: '¥', + }, + }, + { + title: '应付金额(退)', + dataIndex: 'refundOriginalMoney', + valueType: 'money', + fieldProps: { + moneySymbol: '¥', + }, + }, + + { + title: '数量', + dataIndex: 'order_Count', + hideInSearch: true, + }, + { + title: '支付方式', + dataIndex: 'payMode', + key: 'payMode', + }, + + { + title: '订单状态', + dataIndex: 'order_Status', + key: 'order_Status', + }, + { + title: '消费金额', + dataIndex: 'recharge', + key: 'recharge', + }, + { + title: '消费赠送金额', + dataIndex: 'rechargeBalance', + key: 'rechargeBalance', + }, + ]} + > +

商品列表

+ { + defaultData = await api.GetOrderDetails({ id: props.values.id }); + return { + data: defaultData.detailList, + success: true, + }; + }} + columns={[ + { + title: '商品分类', + key: 'goodsTypeName', + dataIndex: 'goodsTypeName', + }, + { + title: '商品名称', + key: 'goodsName', + dataIndex: 'goodsName', + }, + { + title: '应付金额', + key: 'originalMoney', + dataIndex: 'originalMoney', + valueType: 'money', + fieldProps: { + moneySymbol: '¥', + }, + }, + { + title: '实付金额', + dataIndex: 'realMoney', + valueType: 'money', + fieldProps: { + moneySymbol: '¥', + }, + }, + { + title: '操作', + dataIndex: 'option', + valueType: 'option', + render: (_, record) => [ + { + api.printsmallticket({ "orderId": props.values.id, "subOrderId": record.id }) + .then(re => { + debugger + if (re.data) { + message.success('打印成功'); + } else { + message.error('打印失败'); + } + + }) + + }} > + 打印小票 + , + ], + }, + + ]} + toolBarRender={false} + search={false} + /> + + {defaultData?.paperCoupons?.map(item => { + return ( + <> + {item.platformName } + {item.name} + {item.amount} + + ); + })} + + + + {defaultData?.goodsCoupons?.map(item => { + return ( + <> + {item.platformName } + {item.name} + {item.goodsName} + {item.goodsAmount} + {item.platformAmount} + + ); + })} + + +
+ ); +}; + +export default OrderflowDetail; diff --git a/src/pages/order/orderflow/service.js b/src/pages/order/orderflow/service.js new file mode 100644 index 0000000..4a92239 --- /dev/null +++ b/src/pages/order/orderflow/service.js @@ -0,0 +1,99 @@ +// @ts-ignore + +/* eslint-disable */ +import { request } from 'umi'; + +export default { + /** 获取订单流水信息*/ + orderList(data) { + data.isreport = true; + return request(`/kitchen/api/order/order-detail-flow`, { + method: 'Post', + data: data, + // params: { ...params }, + // ...(options || {}), + }); + }, + /** + * 查询店铺分类(设备类型)信息 + */ + srdTypeList(data) { + return request(`/kitchen/api/storetype/list`, { + method: 'Post', + data: data, + // params: { ...params }, + // ...(options || {}), + }); + }, + /** + * 查询店铺信息(设备信息) + */ + srdList(data) { + return request(`/kitchen/api/store/list`, { + method: 'Post', + data: data, + // params: { ...params }, + // ...(options || {}), + }); + }, + + /** + * 查询商品信息 + */ + goodsList(data) { + return request(`/kitchen/api/goodes/list`, { + method: 'Post', + data: data, + // params: { ...params }, + // ...(options || {}), + }); + }, + /** + * 查询商品类型 + */ + goodsTypeList(data) { + return request(`/kitchen/api/goodstype/list`, { + method: 'Post', + data: data, + // params: { ...params }, + // ...(options || {}), + }); + }, + StartRefund(data) { + return request(`/kitchen/api/refund/StartOrderRefund`, { + method: 'Post', + params: data, + // params: { ...params }, + // ...(options || {}), + }); + }, + GetOrderDetails(data) { + return request(`/kitchen/api/Order/GetOrderDetails`, { + method: 'Post', + params: data, + // params: { ...params }, + // ...(options || {}), + }); + }, + GetFlowExport(data) { + return request(`/kitchen/api/Order/GetFlowExport`, { + method: 'Post', + data: data + + // params: { ...params }, + // ...(options || {}), + }); + }, + + // 打印小票 + printsmallticket(data) { + return request(`/kitchen/api/printer/print-small-ticket`, { + method: 'Post', + data: data, + // params: { ...params }, + // ...(options || {}), + }); + }, +}; + +