// 卡券领取统计 import { connect } from "umi"; import type { CurrentUser } from "umi"; import type { ConnectState } from "@/models/connect"; import React, { useRef, useState } from "react"; import { Drawer, Modal, type FormInstance } from "antd"; import type { ActionType } from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table"; import PageTitleBox from "@/components/PageTitleBox"; import { handeGetCouponStockList } from "@/pages/travelMember/service"; import moment from 'moment' import CardVoucherSearch from "../CardVoucherSearch"; import { highlightText } from "@/utils/highlightText"; import CardInfo from "../CardInformationManager/components/CardInfo"; const CardHaveCollection: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const actionRef = useRef(); const formRef = useRef(); const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 const [printOut, setPrintOut] = useState(); // 打印数据的内容 const [collapsible, setCollapsible] = useState(false) const [treeView, setTreeView] = useState() const [printIndex, setPrintIndex] = useState(new Date().getTime()) // 树相关的属性和方法 const [selectedId, setSelectedId] = useState() // 导出的加载效果 const [showLoading, setShowLoading] = useState(false) // 是否显示打印的表格 const [showExportTable, setShowExportTable] = useState(false) // 查询的条件 const [searchParams, setSearchParams] = useState() // 点击行的数据 const [currentRow, setCurrentRow] = useState() // 显示详情 const [showDetial, setShowDetail] = useState() // 显示详情 const [showCouponDetial, setShowCouponDetail] = useState() // 当前查询的文字 const [currentSearchText, setCurrentSearchText] = useState('') const columns: any = [ { title: '查询内容', hideInTable: true, dataIndex: 'searchValue', fieldProps: { placeholder: '请输入卡券名称' } }, { title: "卡券类型", dataIndex: "COUPON_TYPE", width: 120, align: 'center', ellipsis: true, valueType: 'select', valueEnum: { "1000": "满减券", "2000": "折扣券", "3000": "抵扣券", "4000": "兑换券", "5000": "代金券", "9000": "实物券" } }, { title: '领取时间', dataIndex: 'search_date', valueType: 'dateRange', hideInTable: true, hideInDescriptions: true, search: { transform: (value) => { return { STARTDATE: value[0], ENDDATE: value[1], }; }, }, initialValue: [moment().startOf('M').format('YYYY-MM-DD'), moment().add(-1, 'day').format('YYYY-MM-DD')], }, { title: "卡券名称", width: 250, dataIndex: "COUPON_NAME", align: 'center', hideInSearch: true, ellipsis: true, render: (_, record) => { return record?.COUPON_NAME ? { setCurrentRow(record) setShowCouponDetail(true) }}> {highlightText(record?.COUPON_NAME, currentSearchText)} : "" } }, { title: "发放数量", dataIndex: "COUPON_QUOTA", width: 120, align: 'center', sorter: (a, b) => a.COUPON_QUOTA - b.COUPON_QUOTA, hideInSearch: true, ellipsis: true, }, { title: "领取数量", dataIndex: "TAKE_COUNT", width: 120, align: 'center', hideInSearch: true, ellipsis: true, sorter: (a, b) => a.TAKE_COUNT - b.TAKE_COUNT, render: (_, record) => { return record?.TAKE_COUNT ? { setCurrentRow(record) setShowDetail(true) }}>{record?.TAKE_COUNT} : "-" } }, { title: "剩余数量", dataIndex: "LAST_COUNT", width: 120, align: 'center', hideInSearch: true, ellipsis: true, sorter: (a, b) => a.LAST_COUNT - b.LAST_COUNT, }, { title: "发放金额", dataIndex: "QUOTA_AMOUNT", width: 120, align: 'center', hideInSearch: true, ellipsis: true, sorter: (a, b) => a.QUOTA_AMOUNT - b.QUOTA_AMOUNT, }, { title: "领取金额", dataIndex: "TAKE_AMOUNT", width: 120, align: 'center', hideInSearch: true, ellipsis: true, sorter: (a, b) => a.TAKE_AMOUNT - b.TAKE_AMOUNT, }, { title: "活动开始时间", dataIndex: "START_TIME", width: 180, align: 'center', hideInSearch: true, ellipsis: true, render: (_, record) => { return record?.START_TIME ? moment(record?.START_TIME).format('YYYY-MM-DD') : "-" } }, { title: "活动结束时间", dataIndex: "END_TIME", width: 180, align: 'center', hideInSearch: true, ellipsis: true, render: (_, record) => { return record?.END_TIME ? moment(record?.END_TIME).format('YYYY-MM-DD') : "-" } }, ] return (
{ // 打印报表 if (!reqDetailList || reqDetailList.length === 0) return; setPrintOut(el); }} >
单品销售排行统计} headerTitle={} search={{ span: 6 }} request={async (params) => { const req: any = { SearchParameter: { COUPON_TYPES: params?.COUPON_TYPE || "", TAKE_TIME_Start: params?.STARTDATE || "",// 开始时间 TAKE_TIME_End: params?.ENDDATE || "",// 结束时间 COUPON_ISVALID: 1 }, PageIndex: 1, PageSize: 999999, keyWord: { key: "COUPON_NAME", value: params?.searchValue || "" }, sortStr: "END_TIME desc" } setSearchParams(params) const data = await handeGetCouponStockList(req) setCurrentSearchText(params?.searchValue || "") console.log('datadatadatadatadata', data); if (data.List && data.List.length > 0) { return { data: data.List, success: true } } return { data: [], success: true } }} toolbar={{ actions: [ ] }} />
{ setCurrentRow(null) setShowDetail(false) }} > {/* 卡券的编辑 还是 新增 组件 */}
) } export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser }))(CardHaveCollection);