提交 a38d7f4f 作者: ZhangLingKun

功能:eslint --fix

上级 cde9a40b
import { PointManageAPI } from './modules/pointManageAPI'; import { PointManageAPI } from './modules/pointManageAPI';
import { ActivityManageAPI } from './modules/activityManage'; import { ActivityManageAPI } from './modules/activityManage';
import { CouponManageAPI } from './modules/couponManage' import { CouponManageAPI } from './modules/couponManage';
import { CommonAPI } from "./modules/common"; import { CommonAPI } from './modules/common';
import { MakeManageAPI } from './modules/makeManage' import { MakeManageAPI } from './modules/makeManage';
export { export { PointManageAPI, ActivityManageAPI, CommonAPI, CouponManageAPI, MakeManageAPI };
PointManageAPI,
ActivityManageAPI,
CommonAPI,
CouponManageAPI,
MakeManageAPI
};
// 活动-裂变优惠券下拉类型 // 活动-裂变优惠券下拉类型
import { InterFunction, InterItemFunction } from "~/api/interface"; import { InterFunction, InterItemFunction } from '~/api/interface';
import { SplitCouponItemType } from "~/api/interface/couponManage"; import { SplitCouponItemType } from '~/api/interface/couponManage';
// 裂变优惠券-下拉 // 裂变优惠券-下拉
export type splitCouponDownType = InterFunction< export type splitCouponDownType = InterFunction<{ type: number }, SplitCouponItemType[]>;
{ type: number },
SplitCouponItemType[]
>;
// 活动新增-type // 活动新增-type
export type addActivityItemType = { export type addActivityItemType = {
...@@ -21,7 +18,7 @@ export type addActivityItemType = { ...@@ -21,7 +18,7 @@ export type addActivityItemType = {
show: number; show: number;
startTime: string; startTime: string;
time?: any[]; time?: any[];
redirectPath?: ""; redirectPath?: '';
}; };
export type addActivityType = InterFunction<addActivityItemType, null>; export type addActivityType = InterFunction<addActivityItemType, null>;
// 活动-列表 // 活动-列表
...@@ -41,7 +38,4 @@ export type activityDataType = InterFunction< ...@@ -41,7 +38,4 @@ export type activityDataType = InterFunction<
{ countFinishParticipate: number; countParticipate: number } { countFinishParticipate: number; countParticipate: number }
>; >;
// 活动-编辑 // 活动-编辑
export type activityEditType = InterFunction< export type activityEditType = InterFunction<addActivityItemType & { id: number }, null>;
addActivityItemType & { id: number },
null
>;
import { import { InterFunction, InterItemFunction, InterListFunction } from '~/api/interface';
InterFunction, import { PaginationEntity } from '~/common/interface/PaginationEntity';
InterItemFunction,
InterListFunction,
} from "~/api/interface";
import { PaginationEntity } from "~/common/interface/PaginationEntity";
// 裂变优惠券-表格数据类型 // 裂变优惠券-表格数据类型
export type SplitCouponItemType = { export type SplitCouponItemType = {
...@@ -25,10 +21,7 @@ export type SplitCouponSearchType = { ...@@ -25,10 +21,7 @@ export type SplitCouponSearchType = {
useType?: number; useType?: number;
state?: boolean; state?: boolean;
}; };
export type SplitCouponListType = InterItemFunction< export type SplitCouponListType = InterItemFunction<SplitCouponSearchType, SplitCouponItemType[]>;
SplitCouponSearchType,
SplitCouponItemType[]
>;
// 裂变优惠券-新建-数据类型 // 裂变优惠券-新建-数据类型
// 基本信息 // 基本信息
export type baseInfoType = { export type baseInfoType = {
...@@ -137,13 +130,10 @@ export type couponDetailItemType = { ...@@ -137,13 +130,10 @@ export type couponDetailItemType = {
transferorTime: string; transferorTime: string;
}; };
export type couponDetailType = InterItemFunction< export type couponDetailType = InterItemFunction<couponDetailSearchType, couponDetailItemType[]>;
couponDetailSearchType,
couponDetailItemType[]
>;
export type couponDetailExportType = InterFunction< export type couponDetailExportType = InterFunction<
couponDetailSearchType & Pick<PaginationEntity, "pageNo" | "pageSize">, couponDetailSearchType & Pick<PaginationEntity, 'pageNo' | 'pageSize'>,
any any
>; >;
...@@ -157,10 +147,7 @@ export type ListBrandInfoType = InterListFunction< ...@@ -157,10 +147,7 @@ export type ListBrandInfoType = InterListFunction<
export type CouponSaveType = InterFunction<any, any>; export type CouponSaveType = InterFunction<any, any>;
// 增发优惠券 // 增发优惠券
export type CouponIncreaseType = InterFunction< export type CouponIncreaseType = InterFunction<{ id: number; count: number }, {}>;
{ id: number; count: number },
{}
>;
// 获取优惠券使用数据 // 获取优惠券使用数据
export type CouponGetDataType = InterFunction< export type CouponGetDataType = InterFunction<
......
import { InterFunction, InterItemFunction } from "~/api/interface"; import { InterFunction, InterItemFunction } from '~/api/interface';
// 品牌管理-新增 // 品牌管理-新增
export type MakeAddType = InterFunction<{ brandName: string }, null>; export type MakeAddType = InterFunction<{ brandName: string }, null>;
......
...@@ -5,41 +5,39 @@ import { ...@@ -5,41 +5,39 @@ import {
addActivityType, addActivityType,
endActivityType, endActivityType,
splitCouponDownType, splitCouponDownType,
} from "../interface/activityManage"; } from '../interface/activityManage';
import axios from "../request"; import axios from '../request';
export class ActivityManageAPI { export class ActivityManageAPI {
// 活动-裂变优惠券-下拉 // 活动-裂变优惠券-下拉
static getActivityCouponPullDown: splitCouponDownType = (params) => { static getActivityCouponPullDown: splitCouponDownType = (params) => {
return axios.get("userpay/coupon/back/getActivityCouponPullDown", { return axios.get('userpay/coupon/back/getActivityCouponPullDown', {
params, params,
}); });
}; };
// 活动-新增 // 活动-新增
static createActivity: addActivityType = (data) => { static createActivity: addActivityType = (data) => {
return axios.post("malluser/activity/create", data); return axios.post('malluser/activity/create', data);
}; };
// 活动-编辑 // 活动-编辑
static editActivity: activityEditType = (data) => { static editActivity: activityEditType = (data) => {
return axios.post("malluser/activity/update", data); return axios.post('malluser/activity/update', data);
}; };
// 活动-列表 // 活动-列表
static getActivityList: activeTableItemType = (params) => { static getActivityList: activeTableItemType = (params) => {
return axios.get("malluser/activity/list", { params }); return axios.get('malluser/activity/list', { params });
}; };
// 活动-结束 // 活动-结束
static endActivity: endActivityType = (params) => { static endActivity: endActivityType = (params) => {
return axios.get("malluser/activity/stop", { params }); return axios.get('malluser/activity/stop', { params });
}; };
// 活动-数据 // 活动-数据
static getActivityData: activityDataType = (params) => { static getActivityData: activityDataType = (params) => {
return axios.get("malluser/activity/dataInfo", { params }); return axios.get('malluser/activity/dataInfo', { params });
}; };
} }
import axios from "../request"; import axios from '../request';
// 运营人员 // 运营人员
export interface operateEntity { export interface operateEntity {
...@@ -14,8 +14,8 @@ export interface loginEntity { ...@@ -14,8 +14,8 @@ export interface loginEntity {
} }
export class CommonAPI { export class CommonAPI {
static Login = (data: Pick<loginEntity, "accountNo" | "passWord">): any => { static Login = (data: Pick<loginEntity, 'accountNo' | 'passWord'>): any => {
return axios.post("userservlet/auth/platformLogin", { return axios.post('userservlet/auth/platformLogin', {
...data, ...data,
portType: 1, portType: 1,
}); });
...@@ -23,21 +23,21 @@ export class CommonAPI { ...@@ -23,21 +23,21 @@ export class CommonAPI {
// 上传图片 // 上传图片
static commonUpload = (data: FormData) => { static commonUpload = (data: FormData) => {
return axios.post("ossservlet/upload/osses", data); return axios.post('ossservlet/upload/osses', data);
}; };
// 上传图片 // 上传图片
static fileUpload = (data: FormData) => { static fileUpload = (data: FormData) => {
return axios.post("ossservlet/upload/oss", data); return axios.post('ossservlet/upload/oss', data);
}; };
// 运营人员列表 // 运营人员列表
static operateList(operateName: string) { static operateList(operateName: string) {
return axios.post("orderservlet/ordertask/listOperate", { operateName }); return axios.post('orderservlet/ordertask/listOperate', { operateName });
} }
// 销售人员列表 // 销售人员列表
static getSaleList() { static getSaleList() {
return axios.get("userservlet/useraccount/getSaleList"); return axios.get('userservlet/useraccount/getSaleList');
} }
} }
import axios from "../request"; import axios from '../request';
import { import {
couponDetailExportType, couponDetailExportType,
couponDetailType, couponDetailType,
...@@ -10,55 +10,55 @@ import { ...@@ -10,55 +10,55 @@ import {
ListBrandInfoType, ListBrandInfoType,
SplitCouponAddType, SplitCouponAddType,
SplitCouponListType, SplitCouponListType,
} from "~/api/interface/couponManage"; } from '~/api/interface/couponManage';
export class CouponManageAPI { export class CouponManageAPI {
// 优惠券管理-裂变优惠券列表 // 优惠券管理-裂变优惠券列表
static getPageActivityList: SplitCouponListType = (data) => { static getPageActivityList: SplitCouponListType = (data) => {
return axios.post("userpay/coupon/back/pageActivityList", data); return axios.post('userpay/coupon/back/pageActivityList', data);
}; };
// 优惠券管理-裂变优惠券新建 // 优惠券管理-裂变优惠券新建
static saveActivity: SplitCouponAddType = (data) => { static saveActivity: SplitCouponAddType = (data) => {
return axios.post("userpay/coupon/back/saveActivity", data); return axios.post('userpay/coupon/back/saveActivity', data);
}; };
// 优惠券管理-裂变优惠券新建 // 优惠券管理-裂变优惠券新建
static CouponPageList: CouponPageListType = (data) => { static CouponPageList: CouponPageListType = (data) => {
return axios.post("userpay/coupon/back/pageList", data); return axios.post('userpay/coupon/back/pageList', data);
}; };
// 优惠券明细 // 优惠券明细
static getCouponDetail: couponDetailType = (data) => { static getCouponDetail: couponDetailType = (data) => {
return axios.post("userpay/coupon/back/getUserCouponList", data); return axios.post('userpay/coupon/back/getUserCouponList', data);
}; };
// 优惠券明细-导出 // 优惠券明细-导出
static downloadCouponUserList: couponDetailExportType = (data) => { static downloadCouponUserList: couponDetailExportType = (data) => {
return axios.post("userpay/coupon/back/downloadCouponUserList", data, { return axios.post('userpay/coupon/back/downloadCouponUserList', data, {
responseType: "blob", responseType: 'blob',
}); });
}; };
// 新增优惠券 // 新增优惠券
static CouponSave: CouponSaveType = (data) => { static CouponSave: CouponSaveType = (data) => {
return axios.post("/userpay/coupon/back/save", data, { return axios.post('/userpay/coupon/back/save', data, {
headers: { "Content-Type": "multipart/form-data" }, headers: { 'Content-Type': 'multipart/form-data' },
}); });
}; };
// 增发优惠券 // 增发优惠券
static CouponIncrease: CouponIncreaseType = (params) => { static CouponIncrease: CouponIncreaseType = (params) => {
return axios.post("/userpay/coupon/back/increase", {}, { params }); return axios.post('/userpay/coupon/back/increase', {}, { params });
}; };
// 获取优惠券详情 // 获取优惠券详情
static CouponGetData: CouponGetDataType = (params) => { static CouponGetData: CouponGetDataType = (params) => {
return axios.get("/userpay/coupon/back/getData", { params }); return axios.get('/userpay/coupon/back/getData', { params });
}; };
// 关闭优惠券 // 关闭优惠券
static CouponShutDown: CouponShutDownType = (params) => { static CouponShutDown: CouponShutDownType = (params) => {
return axios.post("/userpay/coupon/back/shutDown", {}, { params }); return axios.post('/userpay/coupon/back/shutDown', {}, { params });
}; };
} }
...@@ -3,27 +3,27 @@ import { ...@@ -3,27 +3,27 @@ import {
MakeDeleteType, MakeDeleteType,
MakeEditType, MakeEditType,
MakeListType, MakeListType,
} from "~/api/interface/makeManage"; } from '~/api/interface/makeManage';
import axios from "../request"; import axios from '../request';
export class MakeManageAPI { export class MakeManageAPI {
// 品牌-新增 // 品牌-新增
static addBrandInfo: MakeAddType = (params) => { static addBrandInfo: MakeAddType = (params) => {
return axios.get("uavgoods/brand/addBrandInfo", { params }); return axios.get('uavgoods/brand/addBrandInfo', { params });
}; };
// 品牌-编辑 // 品牌-编辑
static editBrandInfo: MakeEditType = (params) => { static editBrandInfo: MakeEditType = (params) => {
return axios.get("uavgoods/brand/editBrandInfo", { params }); return axios.get('uavgoods/brand/editBrandInfo', { params });
}; };
// 品牌-列表 // 品牌-列表
static getListBrandInfo: MakeListType = (params) => { static getListBrandInfo: MakeListType = (params) => {
return axios.get("uavgoods/brand/listBrandInfo", { params }); return axios.get('uavgoods/brand/listBrandInfo', { params });
}; };
// 品牌刪除 // 品牌刪除
static deleteBrandInfo: MakeDeleteType = (params) => { static deleteBrandInfo: MakeDeleteType = (params) => {
return axios.get("uavgoods/brand/deleteBrandInfo", { params }); return axios.get('uavgoods/brand/deleteBrandInfo', { params });
}; };
} }
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
} }
.ant-table-row:nth-child(odd) { .ant-table-row:nth-child(odd) {
background: #FCFCFC; background: #fcfcfc;
} }
.ant-table-row:nth-child(odd) > td { .ant-table-row:nth-child(odd) > td {
background: #FCFCFC; background: #fcfcfc;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
......
import { useEffect, useState } from "react"; import { useEffect, useState } from 'react';
import { RoleAPI } from "@/api"; import { RoleAPI } from '@/api';
import { limitEntity } from "@/api/modules/role"; import { limitEntity } from '@/api/modules/role';
function useOptionShow(id: number) { function useOptionShow(id: number) {
// const [show, setShow] = useState<boolean>(false); // const [show, setShow] = useState<boolean>(false);
return JSON.parse(localStorage.getItem("routeList") as string)?.some( return JSON.parse(localStorage.getItem('routeList') as string)?.some(
(v: limitEntity) => v.id === id (v: limitEntity) => v.id === id,
); );
// useEffect(() => { // useEffect(() => {
// RoleAPI.getListCuserMenuInfo().then((res: any) => { // RoleAPI.getListCuserMenuInfo().then((res: any) => {
......
import React from "react"; import React from 'react';
import "./index.scss"; import './index.scss';
interface PropsType { interface PropsType {
children: React.ReactNode; children: React.ReactNode;
} }
const Box: React.FC<PropsType> = ({ children }) => { const Box: React.FC<PropsType> = ({ children }) => {
return <div className="box-wrap">{children}</div>; return <div className='box-wrap'>{children}</div>;
}; };
export default Box; export default Box;
//$page-background: #F6F7FB; //$page-background: #F6F7FB;
$page-background: #F3F6FF ; $page-background: #f3f6ff;
.layout-view { .layout-view {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
.layout-bg{ .layout-bg {
background: $page-background; background: $page-background;
} }
...@@ -47,7 +47,7 @@ $page-background: #F3F6FF ; ...@@ -47,7 +47,7 @@ $page-background: #F3F6FF ;
.ant-menu-dark { .ant-menu-dark {
background: transparent; background: transparent;
} }
.ant-layout-sider-children{ .ant-layout-sider-children {
border-radius: 10px; border-radius: 10px;
overflow: hidden; overflow: hidden;
} }
...@@ -76,7 +76,7 @@ $page-background: #F3F6FF ; ...@@ -76,7 +76,7 @@ $page-background: #F3F6FF ;
background-color: #fff; background-color: #fff;
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
color: #556DA7; color: #556da7;
} }
.sider-collapsed { .sider-collapsed {
...@@ -98,11 +98,11 @@ $page-background: #F3F6FF ; ...@@ -98,11 +98,11 @@ $page-background: #F3F6FF ;
} }
} }
:where(.css-dev-only-do-not-override-rvhhh3).ant-menu-light.ant-menu-inline .ant-menu-sub.ant-menu-inline { :where(.css-dev-only-do-not-override-rvhhh3).ant-menu-light.ant-menu-inline
.ant-menu-sub.ant-menu-inline {
background: none; background: none;
} }
.layout-logo { .layout-logo {
height: 100%; height: 100%;
//width: 170px; //width: 170px;
...@@ -162,7 +162,7 @@ $page-background: #F3F6FF ; ...@@ -162,7 +162,7 @@ $page-background: #F3F6FF ;
.user-name { .user-name {
font-size: 12px; font-size: 12px;
font-weight: normal; font-weight: normal;
color: #556DA7 ; color: #556da7;
//color: #F6F7FB; //color: #F6F7FB;
} }
} }
...@@ -171,7 +171,7 @@ $page-background: #F3F6FF ; ...@@ -171,7 +171,7 @@ $page-background: #F3F6FF ;
margin-right: 10px; margin-right: 10px;
width: 24px; width: 24px;
height: 24px; height: 24px;
border:1px solid #ffffff; border: 1px solid #ffffff;
//border:1px solid #1677ff; //border:1px solid #1677ff;
border-radius: 2px; border-radius: 2px;
padding: 0; padding: 0;
......
...@@ -11,16 +11,15 @@ ...@@ -11,16 +11,15 @@
.hamburger.is-active { .hamburger.is-active {
transform: rotate(180deg) translateY(3px); transform: rotate(180deg) translateY(3px);
} }
.effective{ .effective {
.ant-btn-default{ .ant-btn-default {
// display: none; // display: none;
background-color: #1677ff !important; background-color: #1677ff !important;
&:hover { &:hover {
background-color: #4893fd !important; background-color: #4893fd !important;
} }
} }
.ant-btn-primary{ .ant-btn-primary {
display: none; display: none;
} }
} }
...@@ -27,23 +27,26 @@ ...@@ -27,23 +27,26 @@
margin-bottom: 15px; margin-bottom: 15px;
padding-right: 15px; padding-right: 15px;
div, .ant-btn { div,
.ant-btn {
margin-right: 10px; margin-right: 10px;
} }
div:last-child, .ant-btn:last-child { div:last-child,
.ant-btn:last-child {
margin-right: 0 !important; margin-right: 0 !important;
} }
.backButton{ .backButton {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
} }
} }
.search-sufFixBtn{ .search-sufFixBtn {
margin-bottom: 10px; margin-bottom: 10px;
div, .ant-btn { div,
.ant-btn {
margin-right: 10px; margin-right: 10px;
} }
} }
......
import { Form, Input, Button, Select, DatePicker } from "antd"; import { Form, Input, Button, Select, DatePicker } from 'antd';
import moment from "dayjs"; import moment from 'dayjs';
import { import { SearchOutlined, ReloadOutlined, ExportOutlined } from '@ant-design/icons';
SearchOutlined, import React, { useImperativeHandle } from 'react';
ReloadOutlined, import './index.scss';
ExportOutlined,
} from "@ant-design/icons";
import React, { useImperativeHandle } from "react";
import "./index.scss";
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
// 搜索列表的类型 // 搜索列表的类型
export interface searchColumns { export interface searchColumns {
type: "input" | "select" | "rangePicker" | "DatePicker" | "Select"; type: 'input' | 'select' | 'rangePicker' | 'DatePicker' | 'Select';
label?: string; label?: string;
name: string; name: string;
placeholder: string; placeholder: string;
...@@ -27,7 +23,7 @@ export interface searchColumns { ...@@ -27,7 +23,7 @@ export interface searchColumns {
onSelect?: (value: any) => void; onSelect?: (value: any) => void;
disable?: boolean; disable?: boolean;
onChange?: any; onChange?: any;
showTime?: { format: "HH:mm:ss" }; showTime?: { format: 'HH:mm:ss' };
} }
// 组件的类型 // 组件的类型
...@@ -69,18 +65,17 @@ const Index: React.FC<propsType> = (props) => { ...@@ -69,18 +65,17 @@ const Index: React.FC<propsType> = (props) => {
const handleSubmit = (data: any) => { const handleSubmit = (data: any) => {
// console.log("提交数据 --->", data); // console.log("提交数据 --->", data);
if (data.startTime) { if (data.startTime) {
data.startTime = moment(data.startTime).format("YYYY-MM-DD"); data.startTime = moment(data.startTime).format('YYYY-MM-DD');
} else { } else {
data.startTime = undefined; data.startTime = undefined;
} }
Object.keys(data).forEach((k) => { Object.keys(data).forEach((k) => {
const isRangPicker: boolean | undefined = const isRangPicker: boolean | undefined =
props.search && props.search && props.search.some((v) => v.name === k && v.type === 'rangePicker');
props.search.some((v) => v.name === k && v.type === "rangePicker");
if (Array.isArray(data[k]) && isRangPicker) { if (Array.isArray(data[k]) && isRangPicker) {
data[k] = [ data[k] = [
`${moment(data[k][0]).format("YYYY-MM-DD")} 00:00:00`, `${moment(data[k][0]).format('YYYY-MM-DD')} 00:00:00`,
`${moment(data[k][1]).format("YYYY-MM-DD")} 23:59:59`, `${moment(data[k][1]).format('YYYY-MM-DD')} 23:59:59`,
]; ];
} }
}); });
...@@ -94,38 +89,34 @@ const Index: React.FC<propsType> = (props) => { ...@@ -94,38 +89,34 @@ const Index: React.FC<propsType> = (props) => {
props.exportEvent(); props.exportEvent();
}; };
return ( return (
<div className="header"> <div className='header'>
{props?.preFixBtn && ( {props?.preFixBtn && <div className='search-children'>{props?.preFixBtn}</div>}
<div className="search-children">{props?.preFixBtn}</div>
)}
<Form <Form
layout="inline" layout='inline'
form={form} form={form}
initialValues={{ layout: "inline" }} initialValues={{ layout: 'inline' }}
onFinish={handleSubmit} onFinish={handleSubmit}
> >
{props?.child && <div className="search-children">{props?.child}</div>} {props?.child && <div className='search-children'>{props?.child}</div>}
{props?.children && ( {props?.children && <div className='search-children'>{props?.children}</div>}
<div className="search-children">{props?.children}</div>
)}
{props?.search?.map((item: any) => { {props?.search?.map((item: any) => {
return ( return (
<Form.Item <Form.Item
name={item.name} name={item.name}
label={item.label} label={item.label}
key={item.name} key={item.name}
style={{ marginBottom: "10px" }} style={{ marginBottom: '10px' }}
> >
{item.type === "input" ? ( {item.type === 'input' ? (
<Input <Input
placeholder={item.placeholder} placeholder={item.placeholder}
allowClear allowClear
style={{ width: item.width ? `${item.width}px` : "150px" }} style={{ width: item.width ? `${item.width}px` : '150px' }}
maxLength={50} maxLength={50}
/> />
) : item.type === "select" ? ( ) : item.type === 'select' ? (
<Select <Select
style={{ width: item.width ? `${item.width}px` : "200px" }} style={{ width: item.width ? `${item.width}px` : '200px' }}
placeholder={item.placeholder} placeholder={item.placeholder}
allowClear allowClear
> >
...@@ -137,14 +128,14 @@ const Index: React.FC<propsType> = (props) => { ...@@ -137,14 +128,14 @@ const Index: React.FC<propsType> = (props) => {
); );
})} })}
</Select> </Select>
) : item.type === "Select" ? ( ) : item.type === 'Select' ? (
<Select <Select
style={{ width: item.width ? `${item.width}px` : "200px" }} style={{ width: item.width ? `${item.width}px` : '200px' }}
placeholder={item.placeholder} placeholder={item.placeholder}
allowClear allowClear
options={item.options} options={item.options}
/> />
) : item.type === "rangePicker" ? ( ) : item.type === 'rangePicker' ? (
<RangePicker <RangePicker
// showTime={{ // showTime={{
// // hideDisabledOptions: true, // // hideDisabledOptions: true,
...@@ -153,64 +144,48 @@ const Index: React.FC<propsType> = (props) => { ...@@ -153,64 +144,48 @@ const Index: React.FC<propsType> = (props) => {
// moment("23:59:59", "HH:mm:ss"), // moment("23:59:59", "HH:mm:ss"),
// ], // ],
// }} // }}
format="YYYY-MM-DD" format='YYYY-MM-DD'
style={{ width: item.width ? `${item.width}px` : "220px" }} style={{ width: item.width ? `${item.width}px` : '220px' }}
/> />
) : item.type === "DatePicker" ? ( ) : item.type === 'DatePicker' ? (
<DatePicker <DatePicker
showTime={item.showTime} showTime={item.showTime}
style={{ width: item.width ? `${item.width}px` : "180px" }} style={{ width: item.width ? `${item.width}px` : '180px' }}
/> />
) : ( ) : (
"" ''
)} )}
</Form.Item> </Form.Item>
); );
})} })}
{props?.search && props?.search?.length > 0 && ( {props?.search && props?.search?.length > 0 && (
<> <>
<Form.Item style={{ marginBottom: "10px" }}> <Form.Item style={{ marginBottom: '10px' }}>
<Button <Button type='primary' htmlType='submit' icon={<SearchOutlined />}>
type="primary"
htmlType="submit"
icon={<SearchOutlined />}
>
搜索 搜索
</Button> </Button>
</Form.Item> </Form.Item>
<Form.Item style={{ marginBottom: "10px" }}> <Form.Item style={{ marginBottom: '10px' }}>
<Button <Button type='primary' onClick={handleRest} icon={<ReloadOutlined />}>
type="primary"
onClick={handleRest}
icon={<ReloadOutlined />}
>
重置 重置
</Button> </Button>
</Form.Item> </Form.Item>
{!!props.otherChild && ( {!!props.otherChild && (
<Form.Item style={{ marginBottom: "10px" }}> <Form.Item style={{ marginBottom: '10px' }}>{props.otherChild}</Form.Item>
{props.otherChild}
</Form.Item>
)} )}
</> </>
)} )}
{props.isExport ? ( {props.isExport ? (
<Form.Item style={{ marginBottom: "10px" }}> <Form.Item style={{ marginBottom: '10px' }}>
<Button <Button type='primary' onClick={exportClick} icon={<ExportOutlined />}>
type="primary"
onClick={exportClick}
icon={<ExportOutlined />}
>
导出 导出
</Button> </Button>
</Form.Item> </Form.Item>
) : ( ) : (
"" ''
)} )}
</Form> </Form>
{!!props?.sufFixBtn && ( {!!props?.sufFixBtn && <div className='search-sufFixBtn'>{props?.sufFixBtn}</div>}
<div className="search-sufFixBtn">{props?.sufFixBtn}</div>
)}
</div> </div>
); );
}; };
......
import React from "react"; import React from 'react';
interface PropsType { interface PropsType {
children: React.ReactNode; children: React.ReactNode;
...@@ -6,5 +6,5 @@ interface PropsType { ...@@ -6,5 +6,5 @@ interface PropsType {
export const TableBox: React.FC<PropsType> = (props) => { export const TableBox: React.FC<PropsType> = (props) => {
const { children } = props; const { children } = props;
return <div className="table-body-box">{children}</div>; return <div className='table-body-box'>{children}</div>;
}; };
import { Modal, Table } from "antd"; import { Modal, Table } from 'antd';
import { FC } from "react"; import { FC } from 'react';
import { ColumnsType } from "antd/es/table"; import { ColumnsType } from 'antd/es/table';
import { PropsType } from "~/common/interface/modal"; import { PropsType } from '~/common/interface/modal';
import { activityDataType } from "~/api/interface/activityManage"; import { activityDataType } from '~/api/interface/activityManage';
// 活动数据-类型 // 活动数据-类型
type dataType = (ReturnType<activityDataType> extends Promise<infer T> type dataType = (ReturnType<activityDataType> extends Promise<infer T> ? T : never)['result'];
? T
: never)["result"];
interface selfProps { interface selfProps {
activityData: dataType | undefined; activityData: dataType | undefined;
} }
const ActivityDataModal: FC< const ActivityDataModal: FC<Pick<PropsType, 'isModalVisible' | 'handleCancel'> & selfProps> = ({
Pick<PropsType, "isModalVisible" | "handleCancel"> & selfProps isModalVisible,
> = ({ isModalVisible, handleCancel, activityData }) => { handleCancel,
activityData,
}) => {
const columns: ColumnsType<dataType> = [ const columns: ColumnsType<dataType> = [
{ {
title: "参与总人数", title: '参与总人数',
dataIndex: "countFinishParticipate", dataIndex: 'countFinishParticipate',
align: "center", align: 'center',
}, },
{ {
title: "参与成功人数", title: '参与成功人数',
dataIndex: "countParticipate", dataIndex: 'countParticipate',
align: "center", align: 'center',
}, },
]; ];
return ( return (
<Modal <Modal open={isModalVisible} title='活动数据' onCancel={() => handleCancel()} footer={null}>
open={isModalVisible}
title="活动数据"
onCancel={() => handleCancel()}
footer={null}
>
{activityData && ( {activityData && (
<Table <Table
columns={columns} columns={columns}
pagination={false} pagination={false}
dataSource={[activityData]} dataSource={[activityData]}
bordered bordered
rowKey="countFinishParticipate" rowKey='countFinishParticipate'
/> />
)} )}
</Modal> </Modal>
......
body{ body {
background-color:rgb(245,246,250); background-color: rgb(245, 246, 250);
position: relative; position: relative;
.login-warp{ .login-warp {
width:100%; width: 100%;
height:100%; height: 100%;
padding-top:calc(((100vh - (576px / 5 * 4)) / 2) - 20px); padding-top: calc(((100vh - (576px / 5 * 4)) / 2) - 20px);
}
.login-view {
margin: 0 auto;
width: calc(1200px / 5 * 4);
height: calc(600px / 5 * 4);
background-image: url(../../../assets/image/login.jpg);
background-size: 100% 100%;
border-radius: 16px;
overflow: hidden;
box-shadow: 0px 20px 30px rgba(112, 158, 254, 0.45);
display: flex;
flex-wrap: wrap;
.login-flex {
flex: 1;
} }
.login-view{ .login-content {
margin:0 auto; text-align: center;
width:calc(1200px / 5 * 4); color: #000;
height:calc(600px / 5 * 4); .login-title {
background-image:url(../../../assets/image/login.jpg); margin-top: 158px;
background-size:100% 100%; font-size: 24px;
border-radius:16px; }
overflow:hidden; .login-text {
box-shadow:0px 20px 30px rgba(112,158,254,0.45); margin-top: 26px;
display:flex; font-size: 20px;
flex-wrap: wrap; }
.login-flex{ .login-detail {
flex:1; margin-top: 44px;
font-size: 13px;
color: rgba(0, 0, 0, 0.5);
}
}
.login-form {
.login-image {
margin: 62px auto 46px;
width: 84px;
height: 84px;
background-image: url(../../../assets/image/logo.png);
background-size: 100%;
border: 4px #fff solid;
border-radius: 50%;
box-shadow: 3px 3px 30px #dddddd;
}
.login-input {
.ant-form-item {
line-height: 54px;
} }
.login-content{ .ant-input-affix-wrapper {
text-align:center; background-color: #fff;
color: #000; border-radius: 22px;
.login-title{ line-height: 30px;
margin-top: 158px; border: none;
font-size: 24px; box-shadow: 3px 3px 30px #dddddd;
}
.login-text{
margin-top: 26px;
font-size: 20px;
}
.login-detail{
margin-top: 44px;
font-size: 13px;
color: rgba(0,0,0,.5);
}
} }
.login-form{ }
.login-image{ .login-password {
margin: 62px auto 46px; margin-bottom: -8px;
width: 84px; }
height: 84px; .login-remember {
background-image:url(../../../assets/image/logo.png); margin-bottom: 0;
background-size:100%; transform: scale(0.8);
border: 4px #fff solid; .ant-checkbox-checked .ant-checkbox-inner {
border-radius:50%; background-color: rgb(102, 122, 255);
box-shadow:3px 3px 30px #dddddd; border-color: rgb(102, 122, 255);
}
.login-input{
.ant-form-item{
line-height: 54px;
}
.ant-input-affix-wrapper{
background-color:#fff;
border-radius:22px;
line-height: 30px;
border: none;
box-shadow:3px 3px 30px #dddddd;
}
}
.login-password{
margin-bottom:-8px;
}
.login-remember{
margin-bottom: 0;
transform: scale(0.8);
.ant-checkbox-checked .ant-checkbox-inner {
background-color: rgb(102,122,255);
border-color: rgb(102,122,255);
}
}
.login-submit{
width:210px;
font-size:13px;
background:rgb(102,122,255);
border:rgb(102,122,255);
box-shadow:3px 3px 30px #dddddd;
}
} }
}
.login-submit {
width: 210px;
font-size: 13px;
background: rgb(102, 122, 255);
border: rgb(102, 122, 255);
box-shadow: 3px 3px 30px #dddddd;
}
} }
}
} }
import { FC } from "react"; import { FC } from 'react';
import { Modal, Descriptions } from "antd"; import { Modal, Descriptions } from 'antd';
import { PropsType } from "~/common/interface/modal"; import { PropsType } from '~/common/interface/modal';
import { couponDetailItemType } from "~/api/interface/couponManage"; import { couponDetailItemType } from '~/api/interface/couponManage';
const contentStyle = { width: "100px" }; const contentStyle = { width: '100px' };
const DataModal: FC< const DataModal: FC<
Pick<PropsType, "isModalVisible" | "handleCancel"> & { Pick<PropsType, 'isModalVisible' | 'handleCancel'> & {
couponDetailItem: couponDetailItemType | undefined; couponDetailItem: couponDetailItemType | undefined;
} }
> = ({ isModalVisible, handleCancel, couponDetailItem }) => { > = ({ isModalVisible, handleCancel, couponDetailItem }) => {
return ( return (
<Modal <Modal
open={isModalVisible} open={isModalVisible}
title="查看详情" title='查看详情'
footer={null} footer={null}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}
width={650} width={650}
> >
<Descriptions bordered size="small"> <Descriptions bordered size='small'>
<Descriptions.Item label="兑换时间" contentStyle={contentStyle}> <Descriptions.Item label='兑换时间' contentStyle={contentStyle}>
{couponDetailItem?.createTime} {couponDetailItem?.createTime}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="兑换比例" contentStyle={contentStyle}> <Descriptions.Item label='兑换比例' contentStyle={contentStyle}>
{couponDetailItem?.conversionRatio} {couponDetailItem?.conversionRatio}
</Descriptions.Item> </Descriptions.Item>
{(couponDetailItem?.gainType === "presented" || {(couponDetailItem?.gainType === 'presented' ||
couponDetailItem?.gainType === "acquire") && ( couponDetailItem?.gainType === 'acquire') && (
<> <>
<Descriptions.Item label="转赠人UID" contentStyle={contentStyle}> <Descriptions.Item label='转赠人UID' contentStyle={contentStyle}>
{couponDetailItem?.transferorUid} {couponDetailItem?.transferorUid}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="获赠人UID" contentStyle={contentStyle}> <Descriptions.Item label='获赠人UID' contentStyle={contentStyle}>
{couponDetailItem?.receiveUid} {couponDetailItem?.receiveUid}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="转赠时间" contentStyle={contentStyle}> <Descriptions.Item label='转赠时间' contentStyle={contentStyle}>
{couponDetailItem?.transferorTime} {couponDetailItem?.transferorTime}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="获赠时间" contentStyle={contentStyle}> <Descriptions.Item label='获赠时间' contentStyle={contentStyle}>
{couponDetailItem?.createTime} {couponDetailItem?.createTime}
</Descriptions.Item> </Descriptions.Item>
</> </>
......
import React, { useState } from "react"; import React, { useState } from 'react';
import { DatePicker, Form, Input, message, Modal, Radio } from "antd"; import { DatePicker, Form, Input, message, Modal, Radio } from 'antd';
import moment from "moment"; import moment from 'moment';
// 传参类型 // 传参类型
interface propType { interface propType {
...@@ -30,7 +30,7 @@ export const AddEditModal: React.FC<propType> = (props: propType) => { ...@@ -30,7 +30,7 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
form form
.validateFields() .validateFields()
.then((values) => { .then((values) => {
console.log("handleOk -->", values); console.log('handleOk -->', values);
}) })
.catch((err) => { .catch((err) => {
message message
...@@ -41,59 +41,53 @@ export const AddEditModal: React.FC<propType> = (props: propType) => { ...@@ -41,59 +41,53 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
}); });
}; };
return ( return (
<Modal <Modal open={open} title={title} onCancel={handleCancel} onOk={handleOk} destroyOnClose>
open={open}
title={title}
onCancel={handleCancel}
onOk={handleOk}
destroyOnClose
>
<Form <Form
name="addForm" name='addForm'
form={form} form={form}
labelAlign="right" labelAlign='right'
// layout="inline" // layout="inline"
> >
<Form.Item <Form.Item
label="规则名称" label='规则名称'
name="ruleName" name='ruleName'
rules={[{ required: true, message: "请输入规则名称" }]} rules={[{ required: true, message: '请输入规则名称' }]}
> >
<Input placeholder="请输入规则名称" maxLength={20} allowClear /> <Input placeholder='请输入规则名称' maxLength={20} allowClear />
</Form.Item> </Form.Item>
<Form.Item label="兑换比例(积分:券额)" required> <Form.Item label='兑换比例(积分:券额)' required>
<Form.Item <Form.Item
name="year" name='year'
rules={[{ required: true, message: "请输入积分比例" }]} rules={[{ required: true, message: '请输入积分比例' }]}
style={{ display: "inline-block", width: "calc(50% - 8px)" }} style={{ display: 'inline-block', width: 'calc(50% - 8px)' }}
> >
<Input placeholder="请输入积分比例" /> <Input placeholder='请输入积分比例' />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="month" name='month'
rules={[{ required: true, message: "请输入券额比例" }]} rules={[{ required: true, message: '请输入券额比例' }]}
style={{ style={{
display: "inline-block", display: 'inline-block',
width: "calc(50% - 8px)", width: 'calc(50% - 8px)',
margin: "0 8px", margin: '0 8px',
}} }}
> >
<Input placeholder="请输入券额比例" /> <Input placeholder='请输入券额比例' />
</Form.Item> </Form.Item>
</Form.Item> </Form.Item>
<div style={{ transform: "translateY(-10px)" }}> <div style={{ transform: 'translateY(-10px)' }}>
说明:若兑换比例为1:20,则1积分可兑20元VIP优惠券,且为无门槛优惠券 说明:若兑换比例为1:20,则1积分可兑20元VIP优惠券,且为无门槛优惠券
</div> </div>
<Form.Item <Form.Item
label="生效时间" label='生效时间'
name="ruleSetting" name='ruleSetting'
rules={[{ required: true, message: "请选择生效时间" }]} rules={[{ required: true, message: '请选择生效时间' }]}
initialValue={0} initialValue={0}
> >
<Radio.Group <Radio.Group
options={[ options={[
{ label: "立即生效", value: 0 }, { label: '立即生效', value: 0 },
{ label: "手动设置", value: 1 }, { label: '手动设置', value: 1 },
]} ]}
value={radioValue} value={radioValue}
onChange={({ target: { value } }) => { onChange={({ target: { value } }) => {
...@@ -103,16 +97,16 @@ export const AddEditModal: React.FC<propType> = (props: propType) => { ...@@ -103,16 +97,16 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
</Form.Item> </Form.Item>
{radioValue === 1 && ( {radioValue === 1 && (
<Form.Item <Form.Item
label="手动设置" label='手动设置'
name="ruleTime" name='ruleTime'
rules={[{ required: radioValue === 1, message: "请设置生效时间" }]} rules={[{ required: radioValue === 1, message: '请设置生效时间' }]}
> >
<DatePicker <DatePicker
placeholder="请输入账号有效期" placeholder='请输入账号有效期'
allowClear allowClear
showTime={{ format: "HH:mm:ss" }} showTime={{ format: 'HH:mm:ss' }}
format="YYYY-MM-DD HH:mm:ss" format='YYYY-MM-DD HH:mm:ss'
style={{ width: "100%" }} style={{ width: '100%' }}
disabledDate={(current) => { disabledDate={(current) => {
// 限制时间不可早于当日 // 限制时间不可早于当日
return current && current <= moment(); return current && current <= moment();
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { Descriptions, message, Modal } from "antd"; import { Descriptions, message, Modal } from 'antd';
import { CouponManageAPI } from "~/api"; import { CouponManageAPI } from '~/api';
import { CouponGetDataType } from "~/api/interface/couponManage"; import { CouponGetDataType } from '~/api/interface/couponManage';
// 传参类型 // 传参类型
interface propType { interface propType {
...@@ -12,11 +12,9 @@ interface propType { ...@@ -12,11 +12,9 @@ interface propType {
} }
// 列表的类型 // 列表的类型
type DetailType = (ReturnType<CouponGetDataType> extends Promise<infer T> type DetailType = (ReturnType<CouponGetDataType> extends Promise<infer T> ? T : never)['result'];
? T
: never)["result"];
const contentStyle = { width: "100px" }; const contentStyle = { width: '100px' };
export const DataModal: React.FC<propType> = (props: propType) => { export const DataModal: React.FC<propType> = (props: propType) => {
// 组件默认值 // 组件默认值
...@@ -36,7 +34,7 @@ export const DataModal: React.FC<propType> = (props: propType) => { ...@@ -36,7 +34,7 @@ export const DataModal: React.FC<propType> = (props: propType) => {
const res = await CouponManageAPI.CouponGetData({ const res = await CouponManageAPI.CouponGetData({
id: data.id, id: data.id,
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
setCouponDetail(res.result); setCouponDetail(res.result);
} }
}; };
...@@ -54,23 +52,23 @@ export const DataModal: React.FC<propType> = (props: propType) => { ...@@ -54,23 +52,23 @@ export const DataModal: React.FC<propType> = (props: propType) => {
destroyOnClose destroyOnClose
width={650} width={650}
> >
<Descriptions column={3} bordered size="small"> <Descriptions column={3} bordered size='small'>
<Descriptions.Item contentStyle={contentStyle} label="总发行量"> <Descriptions.Item contentStyle={contentStyle} label='总发行量'>
{couponDetail?.couponTotal} {couponDetail?.couponTotal}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="领取量"> <Descriptions.Item contentStyle={contentStyle} label='领取量'>
{couponDetail?.receiveQuantity} {couponDetail?.receiveQuantity}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="领取率"> <Descriptions.Item contentStyle={contentStyle} label='领取率'>
{couponDetail?.claimRate} {couponDetail?.claimRate}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="使用量"> <Descriptions.Item contentStyle={contentStyle} label='使用量'>
{couponDetail?.usageAmount} {couponDetail?.usageAmount}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="有效使用量"> <Descriptions.Item contentStyle={contentStyle} label='有效使用量'>
{couponDetail?.accountPaid} {couponDetail?.accountPaid}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="有效使用率"> <Descriptions.Item contentStyle={contentStyle} label='有效使用率'>
{couponDetail?.availability} {couponDetail?.availability}
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
......
import React, { useEffect } from "react"; import React, { useEffect } from 'react';
import { Form, Input, message, Modal } from "antd"; import { Form, Input, message, Modal } from 'antd';
import { maxLength } from "~/utils/validateUtils"; import { maxLength } from '~/utils/validateUtils';
import { CouponManageAPI } from "~/api"; import { CouponManageAPI } from '~/api';
// 传参类型 // 传参类型
interface propType { interface propType {
...@@ -59,8 +59,8 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => { ...@@ -59,8 +59,8 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => {
id: data.id, id: data.id,
count: Number(values.count), count: Number(values.count),
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
message.success("操作成功").then(); message.success('操作成功').then();
handleCancel(); handleCancel();
} }
}; };
...@@ -82,31 +82,25 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => { ...@@ -82,31 +82,25 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => {
width={400} width={400}
> >
<Form <Form
name="addForm" name='addForm'
form={form} form={form}
labelAlign="right" labelAlign='right'
labelCol={{ span: 8 }} labelCol={{ span: 8 }}
// layout="inline" // layout="inline"
> >
<Form.Item label="当前发行总量" name="lastTotal"> <Form.Item label='当前发行总量' name='lastTotal'>
<Input <Input placeholder='请输入当前发行总量' maxLength={20} allowClear disabled suffix='张' />
placeholder="请输入当前发行总量"
maxLength={20}
allowClear
disabled
suffix="张"
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="新增发行量" label='新增发行量'
name="count" name='count'
rules={[ rules={[
{ required: true, message: "请输入新增发行量" }, { required: true, message: '请输入新增发行量' },
// 增发合计不能超过100000 // 增发合计不能超过100000
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (Number(data.lastTotal) + Number(value) > 100000) { if (Number(data.lastTotal) + Number(value) > 100000) {
return Promise.reject("增发合计不能超过100000"); return Promise.reject('增发合计不能超过100000');
} }
return Promise.resolve(); return Promise.resolve();
}, },
...@@ -114,23 +108,23 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => { ...@@ -114,23 +108,23 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => {
]} ]}
> >
<Input <Input
placeholder="请输入新增发行量" placeholder='请输入新增发行量'
maxLength={20} maxLength={20}
allowClear allowClear
prefix="+" prefix='+'
suffix="张" suffix='张'
type="number" type='number'
onChange={handleIncrease} onChange={handleIncrease}
onInput={maxLength} onInput={maxLength}
/> />
</Form.Item> </Form.Item>
<Form.Item label="更新后总发行量" name="lastTotalBefore"> <Form.Item label='更新后总发行量' name='lastTotalBefore'>
<Input <Input
placeholder="请输入更新后总发行量" placeholder='请输入更新后总发行量'
maxLength={20} maxLength={20}
allowClear allowClear
disabled disabled
suffix="张" suffix='张'
/> />
</Form.Item> </Form.Item>
</Form> </Form>
......
import { FC, forwardRef, useImperativeHandle } from "react"; import { FC, forwardRef, useImperativeHandle } from 'react';
import "./index.scss"; import './index.scss';
import { Form, Input } from "antd"; import { Form, Input } from 'antd';
import { baseInfoType } from "~/api/interface/couponManage"; import { baseInfoType } from '~/api/interface/couponManage';
interface selfPops { interface selfPops {
ref: any; ref: any;
...@@ -16,9 +16,9 @@ const BaseInfo: FC<selfPops> = forwardRef(({ isDetail }, ref) => { ...@@ -16,9 +16,9 @@ const BaseInfo: FC<selfPops> = forwardRef(({ isDetail }, ref) => {
})); }));
return ( return (
<div className="split-coupon-base-info"> <div className='split-coupon-base-info'>
<div className="title">基本信息</div> <div className='title'>基本信息</div>
<div className="base-info-form"> <div className='base-info-form'>
<Form <Form
labelCol={{ span: 2 }} labelCol={{ span: 2 }}
wrapperCol={{ span: 5 }} wrapperCol={{ span: 5 }}
...@@ -26,11 +26,11 @@ const BaseInfo: FC<selfPops> = forwardRef(({ isDetail }, ref) => { ...@@ -26,11 +26,11 @@ const BaseInfo: FC<selfPops> = forwardRef(({ isDetail }, ref) => {
disabled={isDetail} disabled={isDetail}
> >
<Form.Item <Form.Item
label="优惠券名称" label='优惠券名称'
name="couponName" name='couponName'
rules={[{ required: true, message: "请输入优惠券名称" }]} rules={[{ required: true, message: '请输入优惠券名称' }]}
> >
<Input placeholder="请输入优惠券名称" maxLength={10} /> <Input placeholder='请输入优惠券名称' maxLength={10} />
</Form.Item> </Form.Item>
</Form> </Form>
</div> </div>
......
.add-or-edit-or-detail-wrap{ .add-or-edit-or-detail-wrap {
min-width: 1200px; min-width: 1200px;
height: 100%; height: 100%;
position: relative; position: relative;
.add-or-edit-or-detail{ .add-or-edit-or-detail {
height: calc(100% - 50px); height: calc(100% - 50px);
overflow-y: auto; overflow-y: auto;
.split-coupon-base-info,.share-coupon-info,.shared-coupon-info{ .split-coupon-base-info,
padding: 10px; .share-coupon-info,
.shared-coupon-info {
padding: 10px;
background-color: #fff; background-color: #fff;
margin-bottom: 20px; margin-bottom: 20px;
.title{ .title {
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
color: #000; color: #000;
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.ant-form-item{ .ant-form-item {
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.footer-operate{ .footer-operate {
position: absolute; position: absolute;
bottom: -15px; bottom: -15px;
left: -10px; left: -10px;
height: 80px; height: 80px;
width: calc(100% + 20px) ; width: calc(100% + 20px);
background-color: #fff; background-color: #fff;
box-shadow: 0 -1px 2px 0 rgba(0,0,0,0.1); box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.1);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
button{ button {
width: 100px; width: 100px;
} }
button:first-child{ button:first-child {
margin-right: 150px; margin-right: 150px;
} }
} }
} }
import { FC, useEffect, useRef, useState } from "react"; import { FC, useEffect, useRef, useState } from 'react';
import "./index.scss"; import './index.scss';
import { Button, message } from "antd"; import { Button, message } from 'antd';
import { useNavigate } from "react-router-dom"; import { useNavigate } from 'react-router-dom';
import dayJs from "dayjs"; import dayJs from 'dayjs';
import qs from "query-string"; import qs from 'query-string';
import BaseInfo from "./components/baseInfo"; import BaseInfo from './components/baseInfo';
import ShareCouponInfo from "./components/shareCouponInfo"; import ShareCouponInfo from './components/shareCouponInfo';
import SharedCouponInfo from "./components/sharedCouponInfo"; import SharedCouponInfo from './components/sharedCouponInfo';
import { MakeManageAPI } from "~/api/modules/makeManage"; import { MakeManageAPI } from '~/api/modules/makeManage';
import { MakeItemEntity } from "~/api/interface/makeManage"; import { MakeItemEntity } from '~/api/interface/makeManage';
import { CouponManageAPI } from "~/api"; import { CouponManageAPI } from '~/api';
const SplitCouponOperate: FC<any> = (props) => { const SplitCouponOperate: FC<any> = (props) => {
const history = useNavigate(); const history = useNavigate();
...@@ -21,13 +21,11 @@ const SplitCouponOperate: FC<any> = (props) => { ...@@ -21,13 +21,11 @@ const SplitCouponOperate: FC<any> = (props) => {
const [makeList, setMakeList] = useState<MakeItemEntity[]>([]); const [makeList, setMakeList] = useState<MakeItemEntity[]>([]);
// 品牌-列表 // 品牌-列表
const getMakeList = () => { const getMakeList = () => {
MakeManageAPI.getListBrandInfo({ pageNo: 1, pageSize: 999999 }).then( MakeManageAPI.getListBrandInfo({ pageNo: 1, pageSize: 999999 }).then(({ result }) => {
({ result }) => { setMakeList(result.list || []);
setMakeList(result.list || []); });
}
);
}; };
const [splitCouponId, setSplitCouponId] = useState<string>(""); const [splitCouponId, setSplitCouponId] = useState<string>('');
// 详情 // 详情
const getSplitCouponDetail = (couponId: string) => { const getSplitCouponDetail = (couponId: string) => {
CouponManageAPI.getPageActivityList({ CouponManageAPI.getPageActivityList({
...@@ -37,22 +35,15 @@ const SplitCouponOperate: FC<any> = (props) => { ...@@ -37,22 +35,15 @@ const SplitCouponOperate: FC<any> = (props) => {
useType: 2, useType: 2,
}).then(({ result }) => { }).then(({ result }) => {
if (result.list[0]) { if (result.list[0]) {
(shareCouponRef.current as any).setCouponType( (shareCouponRef.current as any).setCouponType(result.list[0].couponType);
result.list[0].couponType
);
const { beSharedCoupon } = result.list[0]; const { beSharedCoupon } = result.list[0];
(sharedCouponRef.current as any).setCouponType( (sharedCouponRef.current as any).setCouponType(beSharedCoupon.couponType);
beSharedCoupon.couponType
);
(baseInfoRef.current as any).getForm().setFieldsValue({ (baseInfoRef.current as any).getForm().setFieldsValue({
couponName: result.list[0].couponName, couponName: result.list[0].couponName,
}); });
(shareCouponRef.current as any).getForm().setFieldsValue({ (shareCouponRef.current as any).getForm().setFieldsValue({
primaryKey: (result.list[0].primaryKey as any).split(",").map(Number), primaryKey: (result.list[0].primaryKey as any).split(',').map(Number),
time: [ time: [dayJs(result.list[0].useStartTime), dayJs(result.list[0].useEndTime)],
dayJs(result.list[0].useStartTime),
dayJs(result.list[0].useEndTime),
],
couponMoney: result.list[0].couponMoney, couponMoney: result.list[0].couponMoney,
couponType: result.list[0].couponType, couponType: result.list[0].couponType,
minPrice: result.list[0].minPrice || undefined, minPrice: result.list[0].minPrice || undefined,
...@@ -64,9 +55,7 @@ const SplitCouponOperate: FC<any> = (props) => { ...@@ -64,9 +55,7 @@ const SplitCouponOperate: FC<any> = (props) => {
userTag: beSharedCoupon.userTag || undefined, userTag: beSharedCoupon.userTag || undefined,
}); });
(sharedCouponRef.current as any).getForm().setFieldsValue({ (sharedCouponRef.current as any).getForm().setFieldsValue({
beSharedPrimaryKey: (beSharedCoupon.primaryKey as any) beSharedPrimaryKey: (beSharedCoupon.primaryKey as any).split(',').map(Number),
.split(",")
.map(Number),
beSharedCouponMoney: beSharedCoupon.couponMoney, beSharedCouponMoney: beSharedCoupon.couponMoney,
beSharedCouponType: beSharedCoupon.couponType, beSharedCouponType: beSharedCoupon.couponType,
beSharedMinPrice: beSharedCoupon.minPrice || undefined, beSharedMinPrice: beSharedCoupon.minPrice || undefined,
...@@ -87,22 +76,18 @@ const SplitCouponOperate: FC<any> = (props) => { ...@@ -87,22 +76,18 @@ const SplitCouponOperate: FC<any> = (props) => {
getSharedCouponForm().validateFields(), getSharedCouponForm().validateFields(),
]) ])
.then((values) => { .then((values) => {
values[1].useStartTime = `${dayJs(values[1].time[0]).format( values[1].useStartTime = `${dayJs(values[1].time[0]).format('YYYY-MM-DD')} 00:00:00`;
"YYYY-MM-DD" values[1].useEndTime = `${dayJs(values[1].time[1]).format('YYYY-MM-DD')} 23:59:59`;
)} 00:00:00`; values[1].primaryKey = values[1].primaryKey.join(',');
values[1].useEndTime = `${dayJs(values[1].time[1]).format( values[2].beSharedPrimaryKey = values[2].beSharedPrimaryKey.join(',');
"YYYY-MM-DD"
)} 23:59:59`;
values[1].primaryKey = values[1].primaryKey.join(",");
values[2].beSharedPrimaryKey = values[2].beSharedPrimaryKey.join(",");
delete values[1].time; delete values[1].time;
CouponManageAPI.saveActivity({ CouponManageAPI.saveActivity({
...values[0], ...values[0],
...values[1], ...values[1],
...values[2], ...values[2],
}).then(({ code, message: msg }) => { }).then(({ code, message: msg }) => {
if (code === "200") { if (code === '200') {
message.success("新增成功"); message.success('新增成功');
getBaseInfoForm().resetFields(); getBaseInfoForm().resetFields();
getShareCouponForm().resetFields(); getShareCouponForm().resetFields();
getSharedCouponForm().resetFields(); getSharedCouponForm().resetFields();
...@@ -124,7 +109,7 @@ const SplitCouponOperate: FC<any> = (props) => { ...@@ -124,7 +109,7 @@ const SplitCouponOperate: FC<any> = (props) => {
useEffect(() => { useEffect(() => {
getMakeList(); getMakeList();
if (props.location) { if (props.location) {
const { id: splitCouponId }: any = qs.parse(props.location.search); const { id: splitCouponId }: any = qs.parse(props.location.search);
setSplitCouponId(splitCouponId); setSplitCouponId(splitCouponId);
if (splitCouponId) { if (splitCouponId) {
getSplitCouponDetail(splitCouponId); getSplitCouponDetail(splitCouponId);
...@@ -133,16 +118,12 @@ const SplitCouponOperate: FC<any> = (props) => { ...@@ -133,16 +118,12 @@ const SplitCouponOperate: FC<any> = (props) => {
}, []); }, []);
return ( return (
<div className="add-or-edit-or-detail-wrap"> <div className='add-or-edit-or-detail-wrap'>
<div className="add-or-edit-or-detail"> <div className='add-or-edit-or-detail'>
{/* 基本信息 */} {/* 基本信息 */}
<BaseInfo ref={baseInfoRef} isDetail={!!splitCouponId} /> <BaseInfo ref={baseInfoRef} isDetail={!!splitCouponId} />
{/* 分享者优惠券 */} {/* 分享者优惠券 */}
<ShareCouponInfo <ShareCouponInfo ref={shareCouponRef} makeList={makeList} isDetail={!!splitCouponId} />
ref={shareCouponRef}
makeList={makeList}
isDetail={!!splitCouponId}
/>
{/* 被分享者优惠券 */} {/* 被分享者优惠券 */}
<SharedCouponInfo <SharedCouponInfo
ref={sharedCouponRef} ref={sharedCouponRef}
...@@ -151,10 +132,10 @@ const SplitCouponOperate: FC<any> = (props) => { ...@@ -151,10 +132,10 @@ const SplitCouponOperate: FC<any> = (props) => {
isDetail={!!splitCouponId} isDetail={!!splitCouponId}
/> />
</div> </div>
<div className="footer-operate"> <div className='footer-operate'>
<Button onClick={backRoute}>返回</Button> <Button onClick={backRoute}>返回</Button>
{!splitCouponId && ( {!splitCouponId && (
<Button type="primary" onClick={addSplitCouponSubmit}> <Button type='primary' onClick={addSplitCouponSubmit}>
确定 确定
</Button> </Button>
)} )}
......
.split-coupon-list{ .split-coupon-list {
.ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before{ .ant-table-thead
> tr
> th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not(
[colspan]
)::before {
width: 0; width: 0;
} }
.ant-table-tbody > tr{ .ant-table-tbody > tr {
border-bottom: 1px solid #999; border-bottom: 1px solid #999;
} }
} }
import React from 'react';
import { Image } from 'antd';
function DetailDelivery() {
return (
<div className={'detail-delivery detail-half'}>
<div className={'detail-title'}>收货信息</div>
<div className={'detail-text'}>收货人:测试</div>
<div className={'detail-text'}>手机号:15889328503</div>
<div className={'detail-text'}>
收货地址:广东省深圳市南山区仙鼓路(南山区万科云城(仙鼓路西50米))
</div>
<div className={'detail-title'}>物流信息</div>
<div className={'detail-text'}>物流单号:YT6732436785799</div>
<div className={'detail-text'}>物流进度:--</div>
<div className={'detail-title'}>验收信息</div>
<div className={'detail-text'}>验收状态:已验收</div>
<div className={'detail-text'}>验收凭证:</div>
<div className={'detail-image'}>
{[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
].map((i, j) => (
<Image key={j} className={'image'} src={i} alt='付款凭证' />
))}
</div>
</div>
);
}
export default DetailDelivery;
import { useState } from 'react';
import { Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
// 表格数据类型
type TableType = any;
function DetailInformation() {
// 表格数据
const [tableData] = useState<TableType>([{ id: 1 }]);
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title: '商品',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '单价(元)',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '数量',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '订单状态',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '实收款',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
];
return (
<div className={'detail-information'}>
<div className={'detail-title'}>订单明细</div>
<div className={'detail-text'}>
<span className={'item'}>订单编号:UD202302181041156087</span>
<span className={'item'}>创建时间:2023-02-18 10:41:16</span>
<span className={'item'}>合同编号:UAV202334741131</span>
</div>
<Table
style={{ margin: '20px auto', width: '90%' }}
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
bordered
pagination={false}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/>
</div>
);
}
export default DetailInformation;
import React from 'react';
import { Button, Image } from 'antd';
function DetailPurchaser() {
return (
<div className={'detail-purchaser detail-half'}>
<div className={'detail-title'}>买家信息</div>
<div className={'detail-text'}>UID: UID4460817</div>
<div className={'detail-text'}>企业: 浙江科比特创新科技有限公司</div>
<div className={'detail-text'}>备注: 测试单,不用管</div>
<div className={'detail-title'}>合同信息</div>
<div className={'detail-text'}>合同编号: UAV202334741131</div>
<div className={'detail-text'}>合同状态: 已归档</div>
<div className={'detail-text'}>
合同操作:
<Button type={'link'}>平台签署</Button>
<Button type={'link'}>查看</Button>
<Button type={'link'}>下载</Button>
</div>
<div className={'detail-title'}>付款凭证</div>
<div className={'detail-text'}>预付款:</div>
<div className={'detail-image'}>
{[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
].map((i, j) => (
<Image key={j} className={'image'} src={i} alt='付款凭证' />
))}
</div>
<div className={'detail-text'}>尾款:</div>
<div className={'detail-image'}>
{[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
].map((i, j) => (
<Image key={j} className={'image'} src={i} alt='付款凭证' />
))}
</div>
<div className={'detail-text'}>全款:</div>
<div className={'detail-image'}>
{[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
].map((i, j) => (
<Image key={j} className={'image'} src={i} alt='付款凭证' />
))}
</div>
</div>
);
}
export default DetailPurchaser;
.order-detail {
position: relative;
box-sizing: border-box;
.order-head {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.head-text {
font-size: 13px;
font-weight: 600;
color: #000000;
div {
margin-bottom: 10px;
span {
margin-right: 20px;
}
}
}
}
.detail-wrap {
position: relative;
width: 100%;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
margin-top: 15px;
padding-bottom: 100px;
.detail-information {
margin-top: 10px;
width: 100%;
}
.detail-half {
width: 50%;
}
.detail-title {
font-size: 13px;
font-weight: 600;
color: #000000;
margin-bottom: 15px;
margin-top: 20px;
}
.detail-title:first-child {
margin-top: 0;
}
.detail-text {
margin-bottom: 10px;
.item {
margin-right: 20px;
}
}
.detail-image {
display: flex;
justify-content: flex-start;
margin-left: 56px;
margin-top: -20px;
margin-bottom: 10px;
.image {
width: 68px;
height: 68px;
//margin-right: 10px;
}
.ant-image {
margin-right: 10px;
}
}
}
}
import { useEffect } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { Button } from 'antd';
import './index.scss';
import DetailDelivery from '~/pages/orderManage/productOrder/comp/detailDelivery';
import DetailPurchaser from '~/pages/orderManage/productOrder/comp/detailPurchaser';
import DetailInformation from '~/pages/orderManage/productOrder/comp/detailInformation';
function EquipmentOrderDetail() {
// 路由钩子
const navigate = useNavigate();
// 参数钩子
const [searchParams] = useSearchParams();
// 接收到的参数
const id = searchParams.get('id');
// 返回上一页
const handleBack = () => {
navigate(-1);
};
// componentDidMount
useEffect(() => {
console.log('拿到的id是 --->', id);
}, [id]);
return (
<div className={'order-detail'}>
<div className={'order-head'}>
<div className='head-text'>
<div>
<span>订单编号:R2023051916330461</span>
<span>合同编号:UAV202334741131</span>
</div>
<div>
<span>当前状态:交易完成</span>
<span>创建时间:2023-02-18 10:41:16</span>
</div>
</div>
<Button type={'primary'} onClick={() => handleBack()}>
返回
</Button>
</div>
<div className={'detail-wrap'}>
<DetailPurchaser />
<DetailDelivery />
<DetailInformation />
</div>
</div>
);
}
export default EquipmentOrderDetail;
import React from 'react'; import { useState } from 'react';
import SearchBox from '~/components/search-box';
import { Button, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import { useNavigate } from 'react-router-dom';
import qs from 'query-string';
// 表格数据类型
type TableType = any;
// 订单状态搜索列表
const statusCodeButtonList = [
{ value: -1, label: '全部订单' },
{ value: 0, label: '沟通意向' },
{ value: 1, label: '签约付款' },
{ value: 2, label: '待发货' },
{ value: 3, label: '待收货' },
{ value: 4, label: '已完成' },
{ value: 5, label: '已关闭' },
];
function EquipmentOrderView() { function EquipmentOrderView() {
return <div>EquipmentOrderView</div>; // 路由钩子
const navigate = useNavigate();
// 当前选择的是第几个按钮
const [statusCodeButtonIndex, setStatusCodeButtonIndex] = useState<number>(0);
// 表格分页配置
const [pagination] = useState({
total: 0,
pageSize: 10,
current: 1,
totalPage: 0,
});
// 表格数据
const [tableData] = useState<TableType>([{ id: 1 }]);
// 订单状态筛选
const statusChangeEvent = (i: number) => {
console.log('订单状态筛选 --->', i);
setStatusCodeButtonIndex(i);
};
// 跳转订单详情
const handleDetail = (record: TableType[0]) => {
console.log('跳转订单详情 --->', record.id);
navigate(`/orderManage/equipmentOrder/detail?${qs.stringify({ id: record.id })}`);
};
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title: '商品',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '单价(元)',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '数量',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '买家',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '订单状态',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '实收款',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '相关运营',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '推荐人',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '订单交期',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '备注',
dataIndex: 'remark',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
render: (_text, record) => (
<>
<Button type={'link'} onClick={() => handleDetail(record)}>
详情
</Button>
</>
),
},
];
return (
<>
<SearchBox
search={[
{
label: '订单编号',
name: 'keyword',
type: 'input',
placeholder: '请输入订单编号',
},
{
label: '买家账号',
name: 'keyword2',
type: 'input',
placeholder: '请输入用户账号',
},
{
label: '相关销售',
name: 'saleId',
type: 'Select',
placeholder: '请选择相关销售',
options: [],
},
{
label: '时间',
name: 'time',
type: 'rangePicker',
placeholder: '请选择创建时间',
},
]}
searchData={(e: any) => console.log('提交数据 --->', e)}
sufFixBtn={
<>
{statusCodeButtonList?.map((i, j) => {
return (
<Button
key={j}
type={j === statusCodeButtonIndex ? 'primary' : 'default'}
onClick={() => statusChangeEvent(j)}
style={{ marginTop: '5px' }}
>
{i.label}
</Button>
);
})}
</>
}
/>
<Table
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
scroll={{ x: 1200 }}
pagination={{
total: pagination.total,
pageSize: pagination.pageSize,
current: pagination.current,
showSizeChanger: true,
showQuickJumper: true,
// onChange: (page: number, pageSize: number) =>
// paginationChange(page, pageSize),
showTotal: (total, range) => `当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`,
}}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/>
</>
);
} }
export default EquipmentOrderView; export default EquipmentOrderView;
import React from 'react';
import { Image } from 'antd';
function DetailDelivery() {
return (
<div className={'detail-delivery detail-half'}>
<div className={'detail-title'}>收货信息</div>
<div className={'detail-text'}>收货人:测试</div>
<div className={'detail-text'}>手机号:15889328503</div>
<div className={'detail-text'}>
收货地址:广东省深圳市南山区仙鼓路(南山区万科云城(仙鼓路西50米))
</div>
<div className={'detail-title'}>物流信息</div>
<div className={'detail-text'}>物流单号:YT6732436785799</div>
<div className={'detail-text'}>物流进度:--</div>
<div className={'detail-title'}>验收信息</div>
<div className={'detail-text'}>验收状态:已验收</div>
<div className={'detail-text'}>验收凭证:</div>
<div className={'detail-image'}>
{[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
].map((i, j) => (
<Image key={j} className={'image'} src={i} alt='付款凭证' />
))}
</div>
</div>
);
}
export default DetailDelivery;
import { useState } from 'react';
import { Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
// 表格数据类型
type TableType = any;
function DetailInformation() {
// 表格数据
const [tableData] = useState<TableType>([{ id: 1 }]);
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title: '商品',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '单价(元)',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '数量',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '订单状态',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '实收款',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
];
return (
<div className={'detail-information'}>
<div className={'detail-title'}>订单明细</div>
<div className={'detail-text'}>
<span className={'item'}>订单编号:UD202302181041156087</span>
<span className={'item'}>创建时间:2023-02-18 10:41:16</span>
<span className={'item'}>合同编号:UAV202334741131</span>
</div>
<Table
style={{ margin: '20px auto', width: '90%' }}
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
bordered
pagination={false}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/>
</div>
);
}
export default DetailInformation;
import React from 'react';
import { Button, Image } from 'antd';
function DetailPurchaser() {
return (
<div className={'detail-purchaser detail-half'}>
<div className={'detail-title'}>买家信息</div>
<div className={'detail-text'}>UID: UID4460817</div>
<div className={'detail-text'}>企业: 浙江科比特创新科技有限公司</div>
<div className={'detail-text'}>备注: 测试单,不用管</div>
<div className={'detail-title'}>合同信息</div>
<div className={'detail-text'}>合同编号: UAV202334741131</div>
<div className={'detail-text'}>合同状态: 已归档</div>
<div className={'detail-text'}>
合同操作:
<Button type={'link'}>平台签署</Button>
<Button type={'link'}>查看</Button>
<Button type={'link'}>下载</Button>
</div>
<div className={'detail-title'}>付款凭证</div>
<div className={'detail-text'}>预付款:</div>
<div className={'detail-image'}>
{[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
].map((i, j) => (
<Image key={j} className={'image'} src={i} alt='付款凭证' />
))}
</div>
<div className={'detail-text'}>尾款:</div>
<div className={'detail-image'}>
{[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
].map((i, j) => (
<Image key={j} className={'image'} src={i} alt='付款凭证' />
))}
</div>
<div className={'detail-text'}>全款:</div>
<div className={'detail-image'}>
{[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png',
].map((i, j) => (
<Image key={j} className={'image'} src={i} alt='付款凭证' />
))}
</div>
</div>
);
}
export default DetailPurchaser;
.order-detail {
position: relative;
box-sizing: border-box;
.order-head {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.head-text {
font-size: 13px;
font-weight: 600;
color: #000000;
div {
margin-bottom: 10px;
span {
margin-right: 20px;
}
}
}
}
.detail-wrap {
position: relative;
width: 100%;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
margin-top: 15px;
padding-bottom: 100px;
.detail-information {
margin-top: 10px;
width: 100%;
}
.detail-half {
width: 50%;
}
.detail-title {
font-size: 13px;
font-weight: 600;
color: #000000;
margin-bottom: 15px;
margin-top: 20px;
}
.detail-title:first-child {
margin-top: 0;
}
.detail-text {
margin-bottom: 10px;
.item {
margin-right: 20px;
}
}
.detail-image {
display: flex;
justify-content: flex-start;
margin-left: 56px;
margin-top: -20px;
margin-bottom: 10px;
.image {
width: 68px;
height: 68px;
//margin-right: 10px;
}
.ant-image {
margin-right: 10px;
}
}
}
}
import { useEffect } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { Button } from 'antd';
import './index.scss';
import DetailDelivery from '~/pages/orderManage/serviceOrder/comp/detailDelivery';
import DetailPurchaser from '~/pages/orderManage/serviceOrder/comp/detailPurchaser';
import DetailInformation from '~/pages/orderManage/serviceOrder/comp/detailInformation';
function ServiceOrderDetail() {
// 路由钩子
const navigate = useNavigate();
// 参数钩子
const [searchParams] = useSearchParams();
// 接收到的参数
const id = searchParams.get('id');
// 返回上一页
const handleBack = () => {
navigate(-1);
};
// componentDidMount
useEffect(() => {
console.log('拿到的id是 --->', id);
}, [id]);
return (
<div className={'order-detail'}>
<div className={'order-head'}>
<div className='head-text'>
<div>
<span>订单编号:R2023051916330461</span>
<span>合同编号:UAV202334741131</span>
</div>
<div>
<span>当前状态:交易完成</span>
<span>创建时间:2023-02-18 10:41:16</span>
</div>
</div>
<Button type={'primary'} onClick={() => handleBack()}>
返回
</Button>
</div>
<div className={'detail-wrap'}>
<DetailPurchaser />
<DetailDelivery />
<DetailInformation />
</div>
</div>
);
}
export default ServiceOrderDetail;
import React from 'react'; import { useState } from 'react';
import SearchBox from '~/components/search-box';
import { Button, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import { useNavigate } from 'react-router-dom';
import qs from 'query-string';
// 表格数据类型
type TableType = any;
// 订单状态搜索列表
const statusCodeButtonList = [
{ value: -1, label: '全部订单' },
{ value: 0, label: '沟通意向' },
{ value: 1, label: '签约付款' },
{ value: 2, label: '待发货' },
{ value: 3, label: '待收货' },
{ value: 4, label: '已完成' },
{ value: 5, label: '已关闭' },
];
function ServiceOrderView() { function ServiceOrderView() {
return <div>ServiceOrderView</div>; // 路由钩子
const navigate = useNavigate();
// 当前选择的是第几个按钮
const [statusCodeButtonIndex, setStatusCodeButtonIndex] = useState<number>(0);
// 表格分页配置
const [pagination] = useState({
total: 0,
pageSize: 10,
current: 1,
totalPage: 0,
});
// 表格数据
const [tableData] = useState<TableType>([{ id: 1 }]);
// 订单状态筛选
const statusChangeEvent = (i: number) => {
console.log('订单状态筛选 --->', i);
setStatusCodeButtonIndex(i);
};
// 跳转订单详情
const handleDetail = (record: TableType[0]) => {
console.log('跳转订单详情 --->', record.id);
navigate(`/orderManage/serviceOrder/detail?${qs.stringify({ id: record.id })}`);
};
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title: '商品',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '单价(元)',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '数量',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '买家',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '订单状态',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '实收款',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '相关运营',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '推荐人',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '订单交期',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '备注',
dataIndex: 'remark',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
render: (_text, record) => (
<>
<Button type={'link'} onClick={() => handleDetail(record)}>
详情
</Button>
</>
),
},
];
return (
<>
<SearchBox
search={[
{
label: '订单编号',
name: 'keyword',
type: 'input',
placeholder: '请输入订单编号',
},
{
label: '买家账号',
name: 'keyword2',
type: 'input',
placeholder: '请输入用户账号',
},
{
label: '相关销售',
name: 'saleId',
type: 'Select',
placeholder: '请选择相关销售',
options: [],
},
{
label: '时间',
name: 'time',
type: 'rangePicker',
placeholder: '请选择创建时间',
},
]}
searchData={(e: any) => console.log('提交数据 --->', e)}
sufFixBtn={
<>
{statusCodeButtonList?.map((i, j) => {
return (
<Button
key={j}
type={j === statusCodeButtonIndex ? 'primary' : 'default'}
onClick={() => statusChangeEvent(j)}
style={{ marginTop: '5px' }}
>
{i.label}
</Button>
);
})}
</>
}
/>
<Table
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
scroll={{ x: 1200 }}
pagination={{
total: pagination.total,
pageSize: pagination.pageSize,
current: pagination.current,
showSizeChanger: true,
showQuickJumper: true,
// onChange: (page: number, pageSize: number) =>
// paginationChange(page, pageSize),
showTotal: (total, range) => `当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`,
}}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/>
</>
);
} }
export default ServiceOrderView; export default ServiceOrderView;
import { Form, Input, message, Modal, Radio, Select } from "antd"; import { Form, Input, message, Modal, Radio, Select } from 'antd';
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { debounce } from "lodash"; import { debounce } from 'lodash';
import { PointManageAPI } from "@/api"; import { PointManageAPI } from '@/api';
// 传参类型 // 传参类型
interface propType { interface propType {
...@@ -60,7 +60,7 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -60,7 +60,7 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => {
pageSize: pagination.pageSize, pageSize: pagination.pageSize,
...value, ...value,
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
const { list, pageNo, totalCount, pageSize, totalPage } = res.result; // 解构 const { list, pageNo, totalCount, pageSize, totalPage } = res.result; // 解构
const arr = list?.map((i) => ({ const arr = list?.map((i) => ({
value: i.id, value: i.id,
...@@ -111,17 +111,16 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -111,17 +111,16 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => {
...values, ...values,
orderId: orderData.orderId, orderId: orderData.orderId,
orderNO: orderData.orderNo, orderNO: orderData.orderNo,
uid: mallUserList.find((i) => i.value === values.mallUserId)?.uid || "", uid: mallUserList.find((i) => i.value === values.mallUserId)?.uid || '',
userName: userName: mallUserList.find((i) => i.value === values.mallUserId)?.userName || '',
mallUserList.find((i) => i.value === values.mallUserId)?.userName || "",
ruleType: 1, ruleType: 1,
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
push({ push({
...data, ...data,
...res?.result, ...res?.result,
}); });
message.success(data?.id ? "修改成功" : "添加成功").then(); message.success(data?.id ? '修改成功' : '添加成功').then();
handleCancel(); handleCancel();
} }
}; };
...@@ -139,37 +138,31 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -139,37 +138,31 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => {
setDivideMethod(data.proportionMode); setDivideMethod(data.proportionMode);
}, [open]); }, [open]);
return ( return (
<Modal <Modal open={open} title={title} onCancel={handleCancel} onOk={handleOk} destroyOnClose>
open={open}
title={title}
onCancel={handleCancel}
onOk={handleOk}
destroyOnClose
>
<Form <Form
name="addForm" name='addForm'
form={form} form={form}
labelAlign="right" labelAlign='right'
labelCol={{ span: 5 }} labelCol={{ span: 5 }}
wrapperCol={{ span: 10 }} wrapperCol={{ span: 10 }}
> >
<Form.Item <Form.Item
label="其它分成对象" label='其它分成对象'
name="proportionObjName" name='proportionObjName'
rules={[{ required: true, message: "请输入其它分成对象" }]} rules={[{ required: true, message: '请输入其它分成对象' }]}
> >
<Input placeholder="请输入其它分成对象" maxLength={20} /> <Input placeholder='请输入其它分成对象' maxLength={20} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="分成方式" label='分成方式'
name="proportionMode" name='proportionMode'
rules={[{ required: true, message: "请选择分成方式" }]} rules={[{ required: true, message: '请选择分成方式' }]}
initialValue={divideMethod} initialValue={divideMethod}
> >
<Radio.Group <Radio.Group
options={[ options={[
{ label: "分成比例", value: 0 }, { label: '分成比例', value: 0 },
{ label: "差价分成", value: 1, disabled: true }, { label: '差价分成', value: 1, disabled: true },
]} ]}
onChange={({ target: { value } }) => setDivideMethod(value)} onChange={({ target: { value } }) => setDivideMethod(value)}
/> />
...@@ -177,44 +170,39 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -177,44 +170,39 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => {
{divideMethod === 0 && ( {divideMethod === 0 && (
<> <>
<Form.Item <Form.Item
label="分成参数" label='分成参数'
name="proportionRate" name='proportionRate'
rules={[ rules={[
{ required: true, message: "请输入分成额度百分比" }, { required: true, message: '请输入分成额度百分比' },
// 只能输入0.1到100.0的一位小数,不能大于100.0 // 只能输入0.1到100.0的一位小数,不能大于100.0
{ {
pattern: /^(100(\.0)?|[1-9]?\d(\.\d)?)$/, pattern: /^(100(\.0)?|[1-9]?\d(\.\d)?)$/,
message: "只能输入0.1到100.0的一位小数", message: '只能输入0.1到100.0的一位小数',
}, },
]} ]}
> >
<Input <Input placeholder='请输入分成额度百分比' maxLength={20} type='number' suffix='%' />
placeholder="请输入分成额度百分比"
maxLength={20}
type="number"
suffix="%"
/>
</Form.Item> </Form.Item>
<div style={{ margin: "0 0 10px 60px" }}> <div style={{ margin: '0 0 10px 60px' }}>
说明:分成比例基数以订单金额减去相关渠道利润的得数为基准 说明:分成比例基数以订单金额减去相关渠道利润的得数为基准
</div> </div>
</> </>
)} )}
<Form.Item <Form.Item
label="分成用户" label='分成用户'
name="mallUserId" name='mallUserId'
rules={[{ required: true, message: "请选择分成用户" }]} rules={[{ required: true, message: '请选择分成用户' }]}
wrapperCol={{ span: 14 }} wrapperCol={{ span: 14 }}
> >
<Select <Select
placeholder="请选择分成用户" placeholder='请选择分成用户'
options={mallUserList} options={mallUserList}
allowClear allowClear
showSearch showSearch
filterOption={(input, option) => filterOption={(input, option) =>
(option?.label ?? "").toLowerCase().includes(input.toLowerCase()) (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
} }
optionFilterProp="label" optionFilterProp='label'
onPopupScroll={handlePopupScroll} onPopupScroll={handlePopupScroll}
/> />
</Form.Item> </Form.Item>
......
.divide-setting-modal{ .divide-setting-modal {
.divide-title { .divide-title {
font-size: 14px; font-size: 14px;
margin-bottom: 10px; margin-bottom: 10px;
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { import { Button, Form, Input, message, Modal, Select, Switch, Table } from 'antd';
Button, import { ColumnsType } from 'antd/es/table';
Form, import { PlusOutlined } from '@ant-design/icons';
Input, import DivideAddEditObject from '../divideAddEditObject';
message, import { AddAndEditBonusRuleType, BonusRuleListQueryType } from '@/api/interface/pointManageType';
Modal, import { PointManageAPI } from '@/api';
Select,
Switch,
Table,
} from "antd";
import { ColumnsType } from "antd/es/table";
import { PlusOutlined } from "@ant-design/icons";
import DivideAddEditObject from "../divideAddEditObject";
import {
AddAndEditBonusRuleType,
BonusRuleListQueryType,
} from "@/api/interface/pointManageType";
import { PointManageAPI } from "@/api";
// 编辑的数据类型 // 编辑的数据类型
type DataType = (ReturnType<BonusRuleListQueryType> extends Promise<infer T> type DataType = (ReturnType<BonusRuleListQueryType> extends Promise<infer T>
? T ? T
: never)["result"]["list"][0]; : never)['result']['list'][0];
type ReqType = Parameters<AddAndEditBonusRuleType>[0]; type ReqType = Parameters<AddAndEditBonusRuleType>[0];
// 传参类型 // 传参类型
interface propType { interface propType {
...@@ -35,22 +23,20 @@ interface propType { ...@@ -35,22 +23,20 @@ interface propType {
export const DivideAddEditModal: React.FC<propType> = (props: propType) => { export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
// 组件默认值 // 组件默认值
DivideAddEditModal.defaultProps = { DivideAddEditModal.defaultProps = {
data: { bonusSet: [], id: undefined, ruleName: "" }, data: { bonusSet: [], id: undefined, ruleName: '' },
}; };
// 参数 // 参数
const { title, open, closed, data, isEdit } = props; const { title, open, closed, data, isEdit } = props;
// 表单钩子 // 表单钩子
const [form] = Form.useForm(); const [form] = Form.useForm();
// 表格数据 // 表格数据
const [tableData, setTableData] = useState<DataType["bonusSet"]>([]); const [tableData, setTableData] = useState<DataType['bonusSet']>([]);
// 需要编辑的数据 // 需要编辑的数据
const [editData, setEditData] = useState<any>(); const [editData, setEditData] = useState<any>();
// 添加编辑弹窗 // 添加编辑弹窗
const [addEditVisible, setAddEditVisible] = useState<boolean>(false); const [addEditVisible, setAddEditVisible] = useState<boolean>(false);
// 分成对象列表 // 分成对象列表
const [propObjCode, setPropObjCode] = useState< const [propObjCode, setPropObjCode] = useState<{ label: string; value: number }[]>([]);
{ label: string; value: number }[]
>([]);
// 关闭弹窗 // 关闭弹窗
const handleCancel = () => { const handleCancel = () => {
form.resetFields(); form.resetFields();
...@@ -59,28 +45,28 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -59,28 +45,28 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
// 删除数据 // 删除数据
const handleDelete = (record: any) => { const handleDelete = (record: any) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: '提示',
content: "删除后此数据将会丢失,确定删除吗?", content: '删除后此数据将会丢失,确定删除吗?',
onOk: () => { onOk: () => {
// 删除数据 // 删除数据
setTableData(tableData.filter((i) => i.id !== record.id)); setTableData(tableData.filter((i) => i.id !== record.id));
message.success("操作成功").then(); message.success('操作成功').then();
}, },
}); });
}; };
// 获取分成对象列表 // 获取分成对象列表
const getListProportionObject = async () => { const getListProportionObject = async () => {
const res = await PointManageAPI.ListProportionObject(); const res = await PointManageAPI.ListProportionObject();
if (res && res.code === "200") { if (res && res.code === '200') {
setPropObjCode( setPropObjCode(
res.result?.map((i) => { res.result?.map((i) => {
return { label: i.name, value: i.code }; return { label: i.name, value: i.code };
}) }),
); );
} }
}; };
// 追加列表数据 // 追加列表数据
const handlePush = (val: DataType["bonusSet"][0]) => { const handlePush = (val: DataType['bonusSet'][0]) => {
// 原来列表中没有的数据就追加,有的话就替换 // 原来列表中没有的数据就追加,有的话就替换
if (tableData.some((i) => val?.id === i.id)) { if (tableData.some((i) => val?.id === i.id)) {
setTableData( setTableData(
...@@ -89,7 +75,7 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -89,7 +75,7 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
return val; return val;
} }
return i; return i;
}) }),
); );
} else { } else {
setTableData([...tableData, val]); setTableData([...tableData, val]);
...@@ -120,44 +106,41 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -120,44 +106,41 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
// 提交数据 // 提交数据
const handleSubmit = async (val: ReqType) => { const handleSubmit = async (val: ReqType) => {
const res = await PointManageAPI.AddAndEditBonusRule(val); const res = await PointManageAPI.AddAndEditBonusRule(val);
if (res && res.code === "200") { if (res && res.code === '200') {
message.success("操作成功").then(); message.success('操作成功').then();
closed(); closed();
} }
}; };
// 通用表格列 // 通用表格列
const defaultColumns: ColumnsType<DataType["bonusSet"][0]> = [ const defaultColumns: ColumnsType<DataType['bonusSet'][0]> = [
{ {
title: "分成对象", title: '分成对象',
dataIndex: "propObjCode", dataIndex: 'propObjCode',
align: "center", align: 'center',
render: (text) => render: (text) => propObjCode.find((i) => i.value === text)?.label || text,
propObjCode.find((i) => i.value === text)?.label || text,
}, },
{ {
title: "分成方式", title: '分成方式',
dataIndex: "proportionMode", dataIndex: 'proportionMode',
align: "center", align: 'center',
render: (text) => (text === 0 ? "比例分成" : "差价分成"), render: (text) => (text === 0 ? '比例分成' : '差价分成'),
}, },
{ {
title: "分成参数", title: '分成参数',
dataIndex: "proportionParam", dataIndex: 'proportionParam',
align: "center", align: 'center',
render: (text, record) => render: (text, record) =>
record.proportionMode === 0 record.proportionMode === 0 ? `${(Number(text) * 100).toFixed(1)}%` || '/' : '/',
? `${(Number(text) * 100).toFixed(1)}%` || "/"
: "/",
}, },
{ {
title: "操作", title: '操作',
dataIndex: "id", dataIndex: 'id',
align: "center", align: 'center',
width: 100, width: 100,
render: (text, record) => ( render: (text, record) => (
<div style={{ display: "flex", justifyContent: "center" }}> <div style={{ display: 'flex', justifyContent: 'center' }}>
<Button <Button
type="link" type='link'
onClick={() => { onClick={() => {
setEditData(record); setEditData(record);
setAddEditVisible(true); setAddEditVisible(true);
...@@ -165,7 +148,7 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -165,7 +148,7 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
> >
编辑 编辑
</Button> </Button>
<Button type="link" onClick={() => handleDelete(record)}> <Button type='link' onClick={() => handleDelete(record)}>
删除 删除
</Button> </Button>
</div> </div>
...@@ -190,12 +173,12 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -190,12 +173,12 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
// onOk={handleOk} // onOk={handleOk}
destroyOnClose destroyOnClose
width={768} width={768}
wrapClassName="divide-setting-modal" wrapClassName='divide-setting-modal'
footer={ footer={
!isEdit ? ( !isEdit ? (
<> <>
<Button onClick={handleCancel}>取消</Button> <Button onClick={handleCancel}>取消</Button>
<Button type="primary" onClick={handleOk}> <Button type='primary' onClick={handleOk}>
确定 确定
</Button> </Button>
</> </>
...@@ -203,52 +186,48 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => { ...@@ -203,52 +186,48 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
} }
> >
<Form <Form
name="addForm" name='addForm'
form={form} form={form}
labelAlign="right" labelAlign='right'
disabled={isEdit} disabled={isEdit}
// layout="inline" // layout="inline"
> >
<div className="divide-title">一、基本信息</div> <div className='divide-title'>一、基本信息</div>
<Form.Item <Form.Item
label="规则名称" label='规则名称'
name="ruleName" name='ruleName'
rules={[{ required: true, message: "请输入规则名称" }]} rules={[{ required: true, message: '请输入规则名称' }]}
wrapperCol={{ span: 6 }} wrapperCol={{ span: 6 }}
> >
<Input placeholder="请输入规则名称" maxLength={20} allowClear /> <Input placeholder='请输入规则名称' maxLength={20} allowClear />
</Form.Item> </Form.Item>
<div className="divide-title">二、分成设置</div> <div className='divide-title'>二、分成设置</div>
{!isEdit && ( {!isEdit && (
<Button <Button icon={<PlusOutlined />} type='primary' onClick={() => setAddEditVisible(true)}>
icon={<PlusOutlined />}
type="primary"
onClick={() => setAddEditVisible(true)}
>
添加分成对象 添加分成对象
</Button> </Button>
)} )}
<Table <Table
size="small" size='small'
dataSource={tableData} dataSource={tableData}
columns={!isEdit ? defaultColumns : defaultColumns.slice(0, -1)} columns={!isEdit ? defaultColumns : defaultColumns.slice(0, -1)}
rowKey="id" rowKey='id'
bordered bordered
style={{ margin: "10px 0 -40px 0" }} style={{ margin: '10px 0 -40px 0' }}
/> />
<Form.Item <Form.Item
label="是否默认规则" label='是否默认规则'
name="defaultRule" name='defaultRule'
wrapperCol={{ span: 6 }} wrapperCol={{ span: 6 }}
valuePropName="checked" valuePropName='checked'
initialValue={false} initialValue={false}
> >
<Switch checkedChildren="是" unCheckedChildren="否" /> <Switch checkedChildren='是' unCheckedChildren='否' />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
<DivideAddEditObject <DivideAddEditObject
title={editData ? "编辑分成对象" : "添加分成对象"} title={editData ? '编辑分成对象' : '添加分成对象'}
open={addEditVisible} open={addEditVisible}
data={editData} data={editData}
closed={() => { closed={() => {
......
import { Form, Input, message, Modal, Radio, Select } from "antd"; import { Form, Input, message, Modal, Radio, Select } from 'antd';
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { BonusRuleListQueryType } from "@/api/interface/pointManageType"; import { BonusRuleListQueryType } from '@/api/interface/pointManageType';
// 编辑的数据类型 // 编辑的数据类型
type DataType = (ReturnType<BonusRuleListQueryType> extends Promise<infer T> type DataType = (ReturnType<BonusRuleListQueryType> extends Promise<infer T>
? T ? T
: never)["result"]["list"][0]; : never)['result']['list'][0];
// 传参类型 // 传参类型
interface propType { interface propType {
...@@ -15,7 +15,7 @@ interface propType { ...@@ -15,7 +15,7 @@ interface propType {
push: any; push: any;
data?: any; data?: any;
state?: { propObjCode?: { label: string; value: number }[] }; state?: { propObjCode?: { label: string; value: number }[] };
selected: DataType["bonusSet"]; selected: DataType['bonusSet'];
} }
const DivideAddEditObject: React.FC<propType> = (props: propType) => { const DivideAddEditObject: React.FC<propType> = (props: propType) => {
...@@ -34,8 +34,8 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => { ...@@ -34,8 +34,8 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
const [proportionModeList, setProportionModeList] = useState< const [proportionModeList, setProportionModeList] = useState<
{ label: string; value: number; disabled?: true }[] { label: string; value: number; disabled?: true }[]
>([ >([
{ label: "分成比例", value: 0 }, { label: '分成比例', value: 0 },
{ label: "差价分成", value: 1, disabled: true }, { label: '差价分成', value: 1, disabled: true },
]); ]);
// 关闭弹窗 // 关闭弹窗
const handleCancel = () => { const handleCancel = () => {
...@@ -44,11 +44,11 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => { ...@@ -44,11 +44,11 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
// 重置分成方式 // 重置分成方式
setDivideMethod(proportionModeList[0].value); setDivideMethod(proportionModeList[0].value);
// 重置分成对象 // 重置分成对象
form.setFieldValue("proportionMode", 0); form.setFieldValue('proportionMode', 0);
// 重置分成方式列表 // 重置分成方式列表
setProportionModeList([ setProportionModeList([
{ label: "分成比例", value: 0 }, { label: '分成比例', value: 0 },
{ label: "差价分成", value: 1, disabled: true }, { label: '差价分成', value: 1, disabled: true },
]); ]);
// 关闭弹窗 // 关闭弹窗
closed(); closed();
...@@ -80,24 +80,24 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => { ...@@ -80,24 +80,24 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
...data, ...data,
...values, ...values,
}); });
message.success(data?.id ? "修改成功" : "添加成功").then(); message.success(data?.id ? '修改成功' : '添加成功').then();
handleCancel(); handleCancel();
}; };
// 分成对象选择渠道监听 // 分成对象选择渠道监听
const handleChange = (e: number) => { const handleChange = (e: number) => {
if (e === 300) { if (e === 300) {
setProportionModeList([ setProportionModeList([
{ label: "分成比例", value: 0, disabled: true }, { label: '分成比例', value: 0, disabled: true },
{ label: "差价分成", value: 1 }, { label: '差价分成', value: 1 },
]); ]);
form.setFieldValue("proportionMode", proportionModeList[1].value); form.setFieldValue('proportionMode', proportionModeList[1].value);
setDivideMethod(proportionModeList[1].value); setDivideMethod(proportionModeList[1].value);
} else { } else {
setProportionModeList([ setProportionModeList([
{ label: "分成比例", value: 0 }, { label: '分成比例', value: 0 },
{ label: "差价分成", value: 1, disabled: true }, { label: '差价分成', value: 1, disabled: true },
]); ]);
form.setFieldValue("proportionMode", proportionModeList[0].value); form.setFieldValue('proportionMode', proportionModeList[0].value);
setDivideMethod(proportionModeList[0].value); setDivideMethod(proportionModeList[0].value);
} }
}; };
...@@ -113,27 +113,21 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => { ...@@ -113,27 +113,21 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
setDivideMethod(data.proportionMode); setDivideMethod(data.proportionMode);
}, [open]); }, [open]);
return ( return (
<Modal <Modal open={open} title={title} onCancel={handleCancel} onOk={handleOk} destroyOnClose>
open={open}
title={title}
onCancel={handleCancel}
onOk={handleOk}
destroyOnClose
>
<Form <Form
name="addForm" name='addForm'
form={form} form={form}
labelAlign="right" labelAlign='right'
labelCol={{ span: 5 }} labelCol={{ span: 5 }}
wrapperCol={{ span: 10 }} wrapperCol={{ span: 10 }}
> >
<Form.Item <Form.Item
label="分成对象" label='分成对象'
name="propObjCode" name='propObjCode'
rules={[{ required: true, message: "请选择分成对象" }]} rules={[{ required: true, message: '请选择分成对象' }]}
> >
<Select <Select
placeholder="请选择分成对象" placeholder='请选择分成对象'
options={state?.propObjCode?.map((i) => ({ options={state?.propObjCode?.map((i) => ({
label: i.label, label: i.label,
value: i.value, value: i.value,
...@@ -143,9 +137,9 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => { ...@@ -143,9 +137,9 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="分成方式" label='分成方式'
name="proportionMode" name='proportionMode'
rules={[{ required: true, message: "请选择分成方式" }]} rules={[{ required: true, message: '请选择分成方式' }]}
initialValue={divideMethod} initialValue={divideMethod}
> >
<Radio.Group <Radio.Group
...@@ -156,25 +150,20 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => { ...@@ -156,25 +150,20 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
{divideMethod === 0 && ( {divideMethod === 0 && (
<> <>
<Form.Item <Form.Item
label="分成参数" label='分成参数'
name="proportionParam" name='proportionParam'
rules={[ rules={[
{ required: true, message: "请输入分成额度百分比" }, { required: true, message: '请输入分成额度百分比' },
// 只能输入0.1到100.0的一位小数,不能大于100.0 // 只能输入0.1到100.0的一位小数,不能大于100.0
{ {
pattern: /^(100(\.0)?|[1-9]?\d(\.\d)?)$/, pattern: /^(100(\.0)?|[1-9]?\d(\.\d)?)$/,
message: "只能输入0.1到100.0的一位小数", message: '只能输入0.1到100.0的一位小数',
}, },
]} ]}
> >
<Input <Input placeholder='请输入分成额度百分比' maxLength={10} type='number' suffix='%' />
placeholder="请输入分成额度百分比"
maxLength={10}
type="number"
suffix="%"
/>
</Form.Item> </Form.Item>
<div style={{ margin: "0 0 10px 60px" }}> <div style={{ margin: '0 0 10px 60px' }}>
说明:分成比例基数以订单金额减去相关渠道利润的得数为基准 说明:分成比例基数以订单金额减去相关渠道利润的得数为基准
</div> </div>
</> </>
......
import { Descriptions, Modal } from "antd"; import { Descriptions, Modal } from 'antd';
import React from "react"; import React from 'react';
import { GetScoreListType } from "@/api/interface/pointManageType"; import { GetScoreListType } from '@/api/interface/pointManageType';
// 列表的类型 // 列表的类型
type TableType = (ReturnType<GetScoreListType> extends Promise<infer T> type TableType = (ReturnType<GetScoreListType> extends Promise<infer T>
? T ? T
: never)["result"]["list"]; : never)['result']['list'];
// 传参类型 // 传参类型
interface propType { interface propType {
title: string; title: string;
...@@ -32,17 +32,11 @@ const BankCardModal: React.FC<propType> = (props) => { ...@@ -32,17 +32,11 @@ const BankCardModal: React.FC<propType> = (props) => {
footer={null} footer={null}
destroyOnClose destroyOnClose
> >
<Descriptions bordered column={1} size="small"> <Descriptions bordered column={1} size='small'>
<Descriptions.Item label="银行卡号"> <Descriptions.Item label='银行卡号'>{data?.bankCardNumber}</Descriptions.Item>
{data?.bankCardNumber} <Descriptions.Item label='开户银行'>{data?.accountBank}</Descriptions.Item>
</Descriptions.Item> <Descriptions.Item label='支行'>{data?.branch}</Descriptions.Item>
<Descriptions.Item label="开户银行"> <Descriptions.Item label='开户姓名'>{data?.accountName}</Descriptions.Item>
{data?.accountBank}
</Descriptions.Item>
<Descriptions.Item label="支行">{data?.branch}</Descriptions.Item>
<Descriptions.Item label="开户姓名">
{data?.accountName}
</Descriptions.Item>
</Descriptions> </Descriptions>
</Modal> </Modal>
); );
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { import { Descriptions, Form, Input, InputNumber, message, Modal, Select, Space } from 'antd';
Descriptions, import { GetUserScoreDetailsType, UserScoreDetailsListType } from '@/api/interface/pointManageType';
Form, import { PointManageAPI } from '@/api';
Input, import { phoneNumber } from '@/utils/validateUtils';
InputNumber,
message,
Modal,
Select,
Space,
} from "antd";
import {
GetUserScoreDetailsType,
UserScoreDetailsListType,
} from "@/api/interface/pointManageType";
import { PointManageAPI } from "@/api";
import { phoneNumber } from "@/utils/validateUtils";
// 列表的类型 // 列表的类型
type TableType = (ReturnType<UserScoreDetailsListType> extends Promise<infer T> type TableType = (ReturnType<UserScoreDetailsListType> extends Promise<infer T>
? T ? T
: never)["result"]["list"]["userScoreList"]; : never)['result']['list']['userScoreList'];
// 传参类型 // 传参类型
interface propType { interface propType {
title: string; title: string;
...@@ -29,9 +17,9 @@ interface propType { ...@@ -29,9 +17,9 @@ interface propType {
} }
// 状态类型 // 状态类型
const statusList = [ const statusList = [
{ value: 0, label: "提现中" }, { value: 0, label: '提现中' },
{ value: 1, label: "提现成功" }, { value: 1, label: '提现成功' },
{ value: 2, label: "提现失败" }, { value: 2, label: '提现失败' },
]; ];
export const ApproveModal: React.FC<propType> = (props) => { export const ApproveModal: React.FC<propType> = (props) => {
...@@ -68,8 +56,8 @@ export const ApproveModal: React.FC<propType> = (props) => { ...@@ -68,8 +56,8 @@ export const ApproveModal: React.FC<propType> = (props) => {
withdrawDetailsId: data?.withdrawId, withdrawDetailsId: data?.withdrawId,
flag: values.flag, flag: values.flag,
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
message.success("操作成功"); message.success('操作成功');
handleCancel(); handleCancel();
} else { } else {
message.warning(res.message); message.warning(res.message);
...@@ -89,25 +77,25 @@ export const ApproveModal: React.FC<propType> = (props) => { ...@@ -89,25 +77,25 @@ export const ApproveModal: React.FC<propType> = (props) => {
width={400} width={400}
> >
<Form <Form
name="addForm" name='addForm'
form={form} form={form}
labelAlign="right" labelAlign='right'
labelCol={{ span: 8 }} labelCol={{ span: 8 }}
// layout="inline" // layout="inline"
> >
<Form.Item label="当前状态"> <Form.Item label='当前状态'>
<div>{transStatus(data?.status as number)}</div> <div>{transStatus(data?.status as number)}</div>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="审批结果" label='审批结果'
name="flag" name='flag'
rules={[{ required: true, message: "请选择审批结果" }]} rules={[{ required: true, message: '请选择审批结果' }]}
> >
<Select <Select
placeholder="请选择审批结果" placeholder='请选择审批结果'
options={[ options={[
{ value: true, label: "通过" }, { value: true, label: '通过' },
{ value: false, label: "不通过" }, { value: false, label: '不通过' },
]} ]}
allowClear allowClear
/> />
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { Descriptions, Modal } from "antd"; import { Descriptions, Modal } from 'antd';
import { import { GetUserScoreDetailsType, UserScoreDetailsListType } from '@/api/interface/pointManageType';
GetUserScoreDetailsType, import { PointManageAPI } from '@/api';
UserScoreDetailsListType,
} from "@/api/interface/pointManageType";
import { PointManageAPI } from "@/api";
// 列表的类型 // 列表的类型
type TableType = (ReturnType<UserScoreDetailsListType> extends Promise<infer T> type TableType = (ReturnType<UserScoreDetailsListType> extends Promise<infer T>
? T ? T
: never)["result"]["list"]["userScoreList"]; : never)['result']['list']['userScoreList'];
type DetailType = (ReturnType<GetUserScoreDetailsType> extends Promise<infer T> type DetailType = (ReturnType<GetUserScoreDetailsType> extends Promise<infer T>
? T ? T
: never)["result"]; : never)['result'];
// 传参类型 // 传参类型
interface propType { interface propType {
title: string; title: string;
...@@ -21,12 +18,12 @@ interface propType { ...@@ -21,12 +18,12 @@ interface propType {
data?: TableType[0]; data?: TableType[0];
} }
const contentStyle = { width: "180px" }; const contentStyle = { width: '180px' };
// 状态 // 状态
const statusList = [ const statusList = [
{ value: 0, label: "提现中" }, { value: 0, label: '提现中' },
{ value: 1, label: "提现成功" }, { value: 1, label: '提现成功' },
{ value: 2, label: "提现失败" }, { value: 2, label: '提现失败' },
]; ];
export const DetailModal: React.FC<propType> = (props) => { export const DetailModal: React.FC<propType> = (props) => {
...@@ -50,31 +47,31 @@ export const DetailModal: React.FC<propType> = (props) => { ...@@ -50,31 +47,31 @@ export const DetailModal: React.FC<propType> = (props) => {
const res = await PointManageAPI.GetUserScoreDetails({ const res = await PointManageAPI.GetUserScoreDetails({
id: Number(data?.id), id: Number(data?.id),
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
setDetailData(res.result); setDetailData(res.result);
// console.log(res.result); // console.log(res.result);
} }
}; };
// 获取使用时间 // 获取使用时间
const getUseTime = (record: DetailType) => { const getUseTime = (record: DetailType) => {
if (detailData?.type === "积分提现" && detailData?.status === 0) { if (detailData?.type === '积分提现' && detailData?.status === 0) {
return ""; return '';
} }
if (detailData?.type === "积分提现" && detailData?.status === 2) { if (detailData?.type === '积分提现' && detailData?.status === 2) {
return ""; return '';
} }
if (detailData?.type === "积分提现" && detailData?.status === 1) { if (detailData?.type === '积分提现' && detailData?.status === 1) {
return record?.approvalTime; return record?.approvalTime;
} }
return record?.useTime; return record?.useTime;
}; };
// 获取申请提现时间 // 获取申请提现时间
const getApplyTime = (record: DetailType) => { const getApplyTime = (record: DetailType) => {
if (detailData?.type === "积分提现" && detailData?.status === 0) { if (detailData?.type === '积分提现' && detailData?.status === 0) {
return record?.useTime; return record?.useTime;
} }
if (["积分转赠", "积分兑换"].includes(detailData?.type || "")) { if (['积分转赠', '积分兑换'].includes(detailData?.type || '')) {
return ""; return '';
} }
return record?.useTime; return record?.useTime;
}; };
...@@ -93,38 +90,36 @@ export const DetailModal: React.FC<propType> = (props) => { ...@@ -93,38 +90,36 @@ export const DetailModal: React.FC<propType> = (props) => {
destroyOnClose destroyOnClose
width={650} width={650}
> >
<Descriptions column={2} bordered size="small"> <Descriptions column={2} bordered size='small'>
<Descriptions.Item contentStyle={contentStyle} label="积分数值"> <Descriptions.Item contentStyle={contentStyle} label='积分数值'>
{detailData?.scoreNum && {detailData?.scoreNum &&
(detailData?.scoreNum > 0 (detailData?.scoreNum > 0 ? `+${detailData?.scoreNum}` : detailData?.scoreNum)}
? `+${detailData?.scoreNum}`
: detailData?.scoreNum)}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="流通方式"> <Descriptions.Item contentStyle={contentStyle} label='流通方式'>
{detailData?.type} {detailData?.type}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="订单编号"> <Descriptions.Item contentStyle={contentStyle} label='订单编号'>
{detailData?.orderNo} {detailData?.orderNo}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="兑换比例"> <Descriptions.Item contentStyle={contentStyle} label='兑换比例'>
{detailData?.convertRatio} {detailData?.convertRatio}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="领取时间"> <Descriptions.Item contentStyle={contentStyle} label='领取时间'>
{detailData?.getTime} {detailData?.getTime}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="使用时间"> <Descriptions.Item contentStyle={contentStyle} label='使用时间'>
{detailData && getUseTime(detailData)} {detailData && getUseTime(detailData)}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="状态"> <Descriptions.Item contentStyle={contentStyle} label='状态'>
{transStatus(detailData?.status as number)} {transStatus(detailData?.status as number)}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="申请提现时间"> <Descriptions.Item contentStyle={contentStyle} label='申请提现时间'>
{detailData && getApplyTime(detailData)} {detailData && getApplyTime(detailData)}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="获赠方UID"> <Descriptions.Item contentStyle={contentStyle} label='获赠方UID'>
{detailData?.giveAwayToUid} {detailData?.giveAwayToUid}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item contentStyle={contentStyle} label="转赠方UID"> <Descriptions.Item contentStyle={contentStyle} label='转赠方UID'>
{detailData?.gainFormUid} {detailData?.gainFormUid}
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { import { Descriptions, Form, Input, InputNumber, message, Modal, Select, Space } from 'antd';
Descriptions, import { UserScoreDetailsListType } from '@/api/interface/pointManageType';
Form, import { PointManageAPI } from '@/api';
Input, import { maxLength9, noSpaceFront } from '@/utils/validateUtils';
InputNumber,
message,
Modal,
Select,
Space,
} from "antd";
import { UserScoreDetailsListType } from "@/api/interface/pointManageType";
import { PointManageAPI } from "@/api";
import { maxLength9, noSpaceFront } from "@/utils/validateUtils";
// 列表的类型 // 列表的类型
type DetailType = (ReturnType<UserScoreDetailsListType> extends Promise<infer T> type DetailType = (ReturnType<UserScoreDetailsListType> extends Promise<infer T>
? T ? T
: never)["result"]["list"]; : never)['result']['list'];
// 传参类型 // 传参类型
interface propType { interface propType {
title: string; title: string;
...@@ -36,8 +27,7 @@ export const DistributionModal: React.FC<propType> = (props) => { ...@@ -36,8 +27,7 @@ export const DistributionModal: React.FC<propType> = (props) => {
// 流通方式选择 // 流通方式选择
const [circulateId, setCirculateId] = useState<number>(); const [circulateId, setCirculateId] = useState<number>();
// 流通方式列表 // 流通方式列表
const [circulateIdList, setCirculateIdList] = const [circulateIdList, setCirculateIdList] = useState<{ label: string; value: number }[]>();
useState<{ label: string; value: number }[]>();
// 关闭弹窗 // 关闭弹窗
const handleCancel = () => { const handleCancel = () => {
form.resetFields(); form.resetFields();
...@@ -50,17 +40,17 @@ export const DistributionModal: React.FC<propType> = (props) => { ...@@ -50,17 +40,17 @@ export const DistributionModal: React.FC<propType> = (props) => {
.validateFields() .validateFields()
.then(async (values) => { .then(async (values) => {
if (Number(values.score) === 0) { if (Number(values.score) === 0) {
return message.warning("积分数值不能为0"); return message.warning('积分数值不能为0');
} }
if (values.orderNo) { if (values.orderNo) {
// 从订单列表查询订单 // 从订单列表查询订单
const res = await PointManageAPI.GetOrderInfoByOrderNo({ const res = await PointManageAPI.GetOrderInfoByOrderNo({
orderNo: values.orderNo, orderNo: values.orderNo,
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
const { id } = res.result; const { id } = res.result;
if (!id) { if (!id) {
return message.warning("订单编号不存在"); return message.warning('订单编号不存在');
} }
await handleSubmit({ await handleSubmit({
...values, ...values,
...@@ -88,8 +78,8 @@ export const DistributionModal: React.FC<propType> = (props) => { ...@@ -88,8 +78,8 @@ export const DistributionModal: React.FC<propType> = (props) => {
orderId: values.orderId, orderId: values.orderId,
score: Number(`${values.symbol}${values.score}`), score: Number(`${values.symbol}${values.score}`),
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
message.success("操作成功"); message.success('操作成功');
handleCancel(); handleCancel();
} else { } else {
message.warning(res.message); message.warning(res.message);
...@@ -98,13 +88,13 @@ export const DistributionModal: React.FC<propType> = (props) => { ...@@ -98,13 +88,13 @@ export const DistributionModal: React.FC<propType> = (props) => {
// 获取流通数据列表 // 获取流通数据列表
const getListCirculateInfo = async () => { const getListCirculateInfo = async () => {
const res = await PointManageAPI.ListCirculateInfo({}); const res = await PointManageAPI.ListCirculateInfo({});
if (res && res.code === "200") { if (res && res.code === '200') {
setCirculateIdList( setCirculateIdList(
res.result res.result
.map((i) => { .map((i) => {
return { label: i.type, value: i.id }; return { label: i.type, value: i.id };
}) })
.filter((i) => [5, 7].includes(i.value)) .filter((i) => [5, 7].includes(i.value)),
); );
} }
}; };
...@@ -129,40 +119,40 @@ export const DistributionModal: React.FC<propType> = (props) => { ...@@ -129,40 +119,40 @@ export const DistributionModal: React.FC<propType> = (props) => {
width={400} width={400}
> >
<Form <Form
name="addForm" name='addForm'
form={form} form={form}
labelAlign="right" labelAlign='right'
labelCol={{ span: 8 }} labelCol={{ span: 8 }}
// layout="inline" // layout="inline"
> >
<Form.Item label="发放积分数值" required> <Form.Item label='发放积分数值' required>
<Space.Compact style={{ width: "100%" }}> <Space.Compact style={{ width: '100%' }}>
<Form.Item name="symbol" noStyle initialValue="+"> <Form.Item name='symbol' noStyle initialValue='+'>
<Select> <Select>
<Select.Option value="+">+</Select.Option> <Select.Option value='+'>+</Select.Option>
<Select.Option value="-">-</Select.Option> <Select.Option value='-'>-</Select.Option>
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="score" name='score'
noStyle noStyle
rules={[{ required: true, message: "请输入发放积分数值" }]} rules={[{ required: true, message: '请输入发放积分数值' }]}
> >
<Input <Input
style={{ width: "250%" }} style={{ width: '250%' }}
placeholder="请输入发放积分数值" placeholder='请输入发放积分数值'
onInput={maxLength9} onInput={maxLength9}
/> />
</Form.Item> </Form.Item>
</Space.Compact> </Space.Compact>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="流通方式" label='流通方式'
name="circulateId" name='circulateId'
rules={[{ required: true, message: "请选择流通方式" }]} rules={[{ required: true, message: '请选择流通方式' }]}
> >
<Select <Select
placeholder="请选择流通方式" placeholder='请选择流通方式'
options={circulateIdList} options={circulateIdList}
allowClear allowClear
value={circulateId} value={circulateId}
...@@ -171,16 +161,11 @@ export const DistributionModal: React.FC<propType> = (props) => { ...@@ -171,16 +161,11 @@ export const DistributionModal: React.FC<propType> = (props) => {
</Form.Item> </Form.Item>
{circulateId === 5 && ( {circulateId === 5 && (
<Form.Item <Form.Item
label="订单编号" label='订单编号'
name="orderNo" name='orderNo'
rules={[{ required: true, message: "请输入订单编号" }]} rules={[{ required: true, message: '请输入订单编号' }]}
> >
<Input <Input placeholder='请输入订单编号' maxLength={20} allowClear onInput={noSpaceFront} />
placeholder="请输入订单编号"
maxLength={20}
allowClear
onInput={noSpaceFront}
/>
</Form.Item> </Form.Item>
)} )}
</Form> </Form>
......
import React, { useState } from "react"; import React, { useState } from 'react';
import { DatePicker, Form, Input, message, Modal, Radio } from "antd"; import { DatePicker, Form, Input, message, Modal, Radio } from 'antd';
import moment from "dayjs"; import moment from 'dayjs';
import { PointManageAPI } from "@/api"; import { PointManageAPI } from '@/api';
import { maxLength8, maxString8 } from "@/utils/validateUtils"; import { maxLength8, maxString8 } from '@/utils/validateUtils';
// 传参类型 // 传参类型
interface propType { interface propType {
...@@ -50,83 +50,69 @@ export const AddEditModal: React.FC<propType> = (props: propType) => { ...@@ -50,83 +50,69 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
coupon: Number(values.coupon), coupon: Number(values.coupon),
entryIntoForceTime: entryIntoForceTime:
values.ruleSetting === 1 values.ruleSetting === 1
? moment(values.entryIntoForceTime.$d).format("YYYY-MM-DD HH:mm:ss") ? moment(values.entryIntoForceTime.$d).format('YYYY-MM-DD HH:mm:ss')
: undefined, : undefined,
ruleName: values.ruleName, ruleName: values.ruleName,
score: Number(values.score), score: Number(values.score),
}); });
if (res && res.code === "200") { if (res && res.code === '200') {
handleCancel(); handleCancel();
} }
}; };
return ( return (
<Modal <Modal open={open} title={title} onCancel={handleCancel} onOk={handleOk} destroyOnClose>
open={open}
title={title}
onCancel={handleCancel}
onOk={handleOk}
destroyOnClose
>
<Form <Form
name="addForm" name='addForm'
form={form} form={form}
labelAlign="right" labelAlign='right'
// layout="inline" // layout="inline"
> >
<Form.Item <Form.Item
label="规则名称" label='规则名称'
name="ruleName" name='ruleName'
rules={[{ required: true, message: "请输入规则名称" }]} rules={[{ required: true, message: '请输入规则名称' }]}
> >
<Input placeholder="请输入规则名称" maxLength={15} allowClear /> <Input placeholder='请输入规则名称' maxLength={15} allowClear />
</Form.Item> </Form.Item>
<Form.Item label="兑换比例(积分:券额)" required> <Form.Item label='兑换比例(积分:券额)' required>
<Form.Item <Form.Item
name="score" name='score'
rules={[{ required: true, message: "请输入积分比例" }]} rules={[{ required: true, message: '请输入积分比例' }]}
style={{ display: "inline-block", width: "calc(50% - 8px)" }} style={{ display: 'inline-block', width: 'calc(50% - 8px)' }}
> >
<Input <Input placeholder='请输入积分比例' type='number' onInput={maxLength8} />
placeholder="请输入积分比例"
type="number"
onInput={maxLength8}
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="coupon" name='coupon'
rules={[ rules={[
{ required: true, message: "请输入券额比例" }, { required: true, message: '请输入券额比例' },
{ {
pattern: /^(\d|[1-9]\d+)(\.\d{1,2})?$/, pattern: /^(\d|[1-9]\d+)(\.\d{1,2})?$/,
message: "只能输入两位小数", message: '只能输入两位小数',
}, },
]} ]}
style={{ style={{
display: "inline-block", display: 'inline-block',
width: "calc(50% - 8px)", width: 'calc(50% - 8px)',
margin: "0 8px", margin: '0 8px',
}} }}
> >
<Input <Input placeholder='请输入券额比例' type='number' onInput={maxString8} />
placeholder="请输入券额比例"
type="number"
onInput={maxString8}
/>
</Form.Item> </Form.Item>
</Form.Item> </Form.Item>
<div style={{ transform: "translateY(-10px)" }}> <div style={{ transform: 'translateY(-10px)' }}>
说明:若兑换比例为1:20,则1积分可兑20元VIP优惠券,且为无门槛优惠券 说明:若兑换比例为1:20,则1积分可兑20元VIP优惠券,且为无门槛优惠券
</div> </div>
<Form.Item <Form.Item
label="生效时间" label='生效时间'
name="ruleSetting" name='ruleSetting'
rules={[{ required: true, message: "请选择生效时间" }]} rules={[{ required: true, message: '请选择生效时间' }]}
initialValue={0} initialValue={0}
> >
<Radio.Group <Radio.Group
options={[ options={[
{ label: "立即生效", value: 0 }, { label: '立即生效', value: 0 },
{ label: "手动设置", value: 1 }, { label: '手动设置', value: 1 },
]} ]}
value={radioValue} value={radioValue}
onChange={({ target: { value } }) => { onChange={({ target: { value } }) => {
...@@ -136,16 +122,16 @@ export const AddEditModal: React.FC<propType> = (props: propType) => { ...@@ -136,16 +122,16 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
</Form.Item> </Form.Item>
{radioValue === 1 && ( {radioValue === 1 && (
<Form.Item <Form.Item
label="生效时间" label='生效时间'
name="entryIntoForceTime" name='entryIntoForceTime'
rules={[{ required: radioValue === 1, message: "请设置生效时间" }]} rules={[{ required: radioValue === 1, message: '请设置生效时间' }]}
> >
<DatePicker <DatePicker
placeholder="请选择生效时间" placeholder='请选择生效时间'
allowClear allowClear
showTime={{ format: "HH:mm:ss" }} showTime={{ format: 'HH:mm:ss' }}
format="YYYY-MM-DD HH:mm:ss" format='YYYY-MM-DD HH:mm:ss'
style={{ width: "100%" }} style={{ width: '100%' }}
disabledDate={(current) => { disabledDate={(current) => {
// 限制时间不可早于当日 // 限制时间不可早于当日
return current && current <= moment(); return current && current <= moment();
......
...@@ -2,15 +2,16 @@ import React from 'react'; ...@@ -2,15 +2,16 @@ import React from 'react';
import { Navigate, RouteObject } from 'react-router-dom'; import { Navigate, RouteObject } from 'react-router-dom';
import ErrorPage from '~/pages/common/error'; import ErrorPage from '~/pages/common/error';
import LayoutView from '~/components/layout'; import LayoutView from '~/components/layout';
import { import {
AccountBookOutlined, AccountBookOutlined,
MacCommandOutlined, MacCommandOutlined,
GiftOutlined,PayCircleOutlined, GiftOutlined,
BarsOutlined, PayCircleOutlined,
ShoppingOutlined, BarsOutlined,
ShopOutlined, ShoppingOutlined,
CreditCardOutlined ShopOutlined,
} from '@ant-design/icons'; CreditCardOutlined,
} from '@ant-design/icons';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
import { AgnosticIndexRouteObject } from '@remix-run/router'; import { AgnosticIndexRouteObject } from '@remix-run/router';
...@@ -23,16 +24,20 @@ import DivideOrder from '~/pages/pointManage/divideOrder'; ...@@ -23,16 +24,20 @@ import DivideOrder from '~/pages/pointManage/divideOrder';
import DivideRules from '~/pages/pointManage/divideRules'; import DivideRules from '~/pages/pointManage/divideRules';
import LoginView from '~/pages/common/login'; import LoginView from '~/pages/common/login';
import ProductOrderDetail from '~/pages/orderManage/productOrder/detail'; import ProductOrderDetail from '~/pages/orderManage/productOrder/detail';
import ServiceOrderDetail from '~/pages/orderManage/serviceOrder/detail';
import EquipmentOrderDetail from '~/pages/orderManage/equipmentOrder/detail';
const ActivityList = React.lazy(() => import('src/pages/activityManage/activityList'));//活动管理 const ActivityList = React.lazy(() => import('src/pages/activityManage/activityList')); //活动管理
const ProductOrderView = React.lazy(() => import('src/pages/orderManage/productOrder')); //销售订单 const ProductOrderView = React.lazy(() => import('src/pages/orderManage/productOrder')); //销售订单
const EquipmentOrderView = React.lazy(() => import('src/pages/orderManage/equipmentOrder')); //设备订单 const EquipmentOrderView = React.lazy(() => import('src/pages/orderManage/equipmentOrder')); //设备订单
const ServiceOrderView = React.lazy(() => import('src/pages/orderManage/serviceOrder')); //服务订单 const ServiceOrderView = React.lazy(() => import('src/pages/orderManage/serviceOrder')); //服务订单
const CouponList = React.lazy(() => import('src/pages/couponManage/couponList'));//优惠券管理 const CouponList = React.lazy(() => import('src/pages/couponManage/couponList')); //优惠券管理
const CouponDetail = React.lazy(() => import('src/pages/couponManage/couponList/detail'));//优惠券明细 const CouponDetail = React.lazy(() => import('src/pages/couponManage/couponList/detail')); //优惠券明细
const SplitCouponList = React.lazy(() => import('src/pages/couponManage/splitCouponList'));//裂变优惠券 const SplitCouponList = React.lazy(() => import('src/pages/couponManage/splitCouponList')); //裂变优惠券
const SplitCouponOperate = React.lazy(() => import('src/pages/couponManage/splitCouponList/addOrEditOrDetail'));//裂变优惠券操作 const SplitCouponOperate = React.lazy(
const CouponDetailed = React.lazy(() => import('src/pages/couponManage/couponDetailed'));//优惠券明细 () => import('src/pages/couponManage/splitCouponList/addOrEditOrDetail'),
); //裂变优惠券操作
const CouponDetailed = React.lazy(() => import('src/pages/couponManage/couponDetailed')); //优惠券明细
export interface RouteObjectType { export interface RouteObjectType {
path: AgnosticIndexRouteObject['path']; path: AgnosticIndexRouteObject['path'];
element: any; element: any;
...@@ -121,6 +126,16 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -121,6 +126,16 @@ export const routerList: Array<RouteObjectType> = [
}, },
}, },
{ {
path: '/orderManage/equipmentOrder/detail',
element: withLoadingComponent(<EquipmentOrderDetail />),
meta: {
id: 10020,
title: '租赁订单 / 详情',
icon: <ShopOutlined />,
hidden: true,
},
},
{
path: '/orderManage/serviceOrder', path: '/orderManage/serviceOrder',
element: withLoadingComponent(<ServiceOrderView />), element: withLoadingComponent(<ServiceOrderView />),
meta: { meta: {
...@@ -129,6 +144,16 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -129,6 +144,16 @@ export const routerList: Array<RouteObjectType> = [
icon: <CreditCardOutlined />, icon: <CreditCardOutlined />,
}, },
}, },
{
path: '/orderManage/serviceOrder/detail',
element: withLoadingComponent(<ServiceOrderDetail />),
meta: {
id: 10010,
title: '服务订单 / 详情',
icon: <CreditCardOutlined />,
hidden: true,
},
},
], ],
}, },
{ {
...@@ -152,9 +177,13 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -152,9 +177,13 @@ export const routerList: Array<RouteObjectType> = [
}, },
{ {
path: '/pointManage/pointList/detail', path: '/pointManage/pointList/detail',
element: withLoadingComponent(<PointDetail location={{ element: withLoadingComponent(
search: '' <PointDetail
}} />), location={{
search: '',
}}
/>,
),
meta: { meta: {
id: 25100, id: 25100,
title: '个人积分明细', title: '个人积分明细',
...@@ -173,9 +202,13 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -173,9 +202,13 @@ export const routerList: Array<RouteObjectType> = [
}, },
{ {
path: '/pointManage/pointList/list', path: '/pointManage/pointList/list',
element: withLoadingComponent(<PointDetailList location={{ element: withLoadingComponent(
search: '' <PointDetailList
}} />), location={{
search: '',
}}
/>,
),
meta: { meta: {
id: 25100, id: 25100,
title: '积分明细', title: '积分明细',
...@@ -225,14 +258,18 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -225,14 +258,18 @@ export const routerList: Array<RouteObjectType> = [
}, },
{ {
path: '/couponManage/couponList/detail', path: '/couponManage/couponList/detail',
element: withLoadingComponent(<CouponDetail location={{ element: withLoadingComponent(
search: '' <CouponDetail
}} />), location={{
search: '',
}}
/>,
),
meta: { meta: {
id: 26100, id: 26100,
title: '活动优惠券操作', title: '活动优惠券操作',
icon: <PayCircleOutlined />, icon: <PayCircleOutlined />,
hidden:true, hidden: true,
}, },
}, },
{ {
...@@ -251,7 +288,7 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -251,7 +288,7 @@ export const routerList: Array<RouteObjectType> = [
id: 26200, id: 26200,
title: '裂变优惠券操作', title: '裂变优惠券操作',
icon: <PayCircleOutlined />, icon: <PayCircleOutlined />,
hidden:true, hidden: true,
}, },
}, },
{ {
......
import { useSelector, useDispatch, TypedUseSelectorHook } from "react-redux"; import { useSelector, useDispatch, TypedUseSelectorHook } from 'react-redux';
import type { RootState, AppDispatch } from "../index"; import type { RootState, AppDispatch } from '../index';
export const useAppDispatch = () => useDispatch<AppDispatch>(); export const useAppDispatch = () => useDispatch<AppDispatch>();
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector; export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
import { configureStore } from "@reduxjs/toolkit"; import { configureStore } from '@reduxjs/toolkit';
import stateSlice from "@/store/slice"; import stateSlice from '@/store/slice';
const store = configureStore({ const store = configureStore({
reducer: { reducer: {
......
import { createSlice, createAsyncThunk, PayloadAction } from "@reduxjs/toolkit"; import { createSlice, createAsyncThunk, PayloadAction } from '@reduxjs/toolkit';
const stateSlice = createSlice({ const stateSlice = createSlice({
name: "ghj", name: 'ghj',
initialState: { initialState: {
num: 1, num: 1,
}, },
......
const TOKENKEY = "mmc-token"; const TOKENKEY = 'mmc-token';
const USERKEY = "mmc-custManage"; const USERKEY = 'mmc-custManage';
const getToken = () => { const getToken = () => {
return localStorage.getItem(TOKENKEY); return localStorage.getItem(TOKENKEY);
......
// 合同状态 // 合同状态
export const signStatusList = [ export const signStatusList = [
{ val: 0, label: "待用户签署合同" }, { val: 0, label: '待用户签署合同' },
{ val: 1, label: "用户签署失败" }, { val: 1, label: '用户签署失败' },
{ val: 2, label: "待平台签署合同" }, { val: 2, label: '待平台签署合同' },
{ val: 3, label: "平台签署失败" }, { val: 3, label: '平台签署失败' },
{ val: 4, label: "平台签署成功" }, { val: 4, label: '平台签署成功' },
{ val: 5, label: "合同归档完成" }, { val: 5, label: '合同归档完成' },
]; ];
// 裂变优惠券门槛 // 裂变优惠券门槛
export const splitCouponType = [ export const splitCouponType = [
{ {
val: 1, val: 1,
label: "有门槛", label: '有门槛',
}, },
{ {
val: 2, val: 2,
label: "减免券", label: '减免券',
}, },
{ {
val: 3, val: 3,
label: "无门槛", label: '无门槛',
}, },
]; ];
// 裂变优惠券使用类型 // 裂变优惠券使用类型
export const splitCouponUseType = [ export const splitCouponUseType = [
{ {
val: 2, val: 2,
label: "品牌券", label: '品牌券',
}, },
{ {
val: 1, val: 1,
label: "商品券", label: '商品券',
}, },
{ {
val: 3, val: 3,
label: "店铺券", label: '店铺券',
}, },
]; ];
export const base64ToFile = (dataUrl: string, name?: string) => { export const base64ToFile = (dataUrl: string, name?: string) => {
const arr: string[] = dataUrl.split(","); const arr: string[] = dataUrl.split(',');
// const mime = arr[0].match(/:(.*?);/)[1]; // const mime = arr[0].match(/:(.*?);/)[1];
const bstr: string = atob(arr[1]); const bstr: string = atob(arr[1]);
let n = bstr.length; let n = bstr.length;
...@@ -7,7 +7,7 @@ export const base64ToFile = (dataUrl: string, name?: string) => { ...@@ -7,7 +7,7 @@ export const base64ToFile = (dataUrl: string, name?: string) => {
while (n--) { while (n--) {
u8arr[n] = bstr.charCodeAt(n); u8arr[n] = bstr.charCodeAt(n);
} }
return new File([u8arr], `${name}.png`, { type: "image/png" }); return new File([u8arr], `${name}.png`, { type: 'image/png' });
}; };
export const urlToBase64 = (url: string) => { export const urlToBase64 = (url: string) => {
return new Promise((resolve) => { return new Promise((resolve) => {
...@@ -17,17 +17,17 @@ export const urlToBase64 = (url: string) => { ...@@ -17,17 +17,17 @@ export const urlToBase64 = (url: string) => {
// 处理缓存,fix缓存bug,有缓存,浏览器会报错; // 处理缓存,fix缓存bug,有缓存,浏览器会报错;
Img.src = `${url}?${timeStamp}`; Img.src = `${url}?${timeStamp}`;
// 解决控制台跨域报错的问题 // 解决控制台跨域报错的问题
Img.crossOrigin = "Anonymous"; Img.crossOrigin = 'Anonymous';
// 获取后缀 // 获取后缀
const ext = Img.src.substring(Img.src.lastIndexOf(".") + 1).toLowerCase(); const ext = Img.src.substring(Img.src.lastIndexOf('.') + 1).toLowerCase();
Img.onload = () => { Img.onload = () => {
// 要先确保图片完整获取到,这是个异步事件 // 要先确保图片完整获取到,这是个异步事件
const canvas: any = document.createElement("canvas"); // 创建canvas元素 const canvas: any = document.createElement('canvas'); // 创建canvas元素
// 确保canvas的尺寸和图片一样 // 确保canvas的尺寸和图片一样
canvas.width = Img.width; canvas.width = Img.width;
canvas.height = Img.height; canvas.height = Img.height;
// 将图片绘制到canvas中 // 将图片绘制到canvas中
canvas.getContext("2d").drawImage(Img, 0, 0, Img.width, Img.height); canvas.getContext('2d').drawImage(Img, 0, 0, Img.width, Img.height);
// 转换图片为dataURL // 转换图片为dataURL
resolve(canvas.toDataURL(`image/${ext}`)); resolve(canvas.toDataURL(`image/${ext}`));
}; };
......
// 过滤路由 // 过滤路由
import { limitEntity } from "@/api/modules/role"; import { limitEntity } from '@/api/modules/role';
export const filterRouter = (list: any, routeList: limitEntity[]) => { export const filterRouter = (list: any, routeList: limitEntity[]) => {
return list.reduce((pre: any, cur: any) => { return list.reduce((pre: any, cur: any) => {
...@@ -19,6 +19,6 @@ export const isRoute = (list: any, pathname: string) => { ...@@ -19,6 +19,6 @@ export const isRoute = (list: any, pathname: string) => {
(v: any) => (v: any) =>
v.path === pathname || v.path === pathname ||
(v.alias && pathname.includes(v.alias)) || (v.alias && pathname.includes(v.alias)) ||
(v.children && isRoute(v.children, pathname)) (v.children && isRoute(v.children, pathname)),
); );
}; };
// 格式化千分位并补零 // 格式化千分位并补零
export const moneyFormat = (num: number) => { export const moneyFormat = (num: number) => {
if (Number(num).toString() !== "NaN") { if (Number(num).toString() !== 'NaN') {
// 添加千分符 // 添加千分符
let _n = Number(num).toLocaleString(); let _n = Number(num).toLocaleString();
if (_n.indexOf(".") !== -1) { if (_n.indexOf('.') !== -1) {
_n += "00"; _n += '00';
} else { } else {
_n += ".00"; _n += '.00';
} }
// 因为有千分符所以,返回数据为字符串格式,无法做运算操作,适合做直接显示使用 // 因为有千分符所以,返回数据为字符串格式,无法做运算操作,适合做直接显示使用
return _n.substring(0, _n.indexOf(".") + 3); return _n.substring(0, _n.indexOf('.') + 3);
} }
}; };
// 是否允许操作 // 是否允许操作
const isAllowOption = (record: any) => { const isAllowOption = (record: any) => {
const userInfo = JSON.parse(localStorage.getItem("user_info") as string); const userInfo = JSON.parse(localStorage.getItem('user_info') as string);
return ( return (
userInfo.userAccountId === record.operationId || userInfo.userAccountId === record.operationId ||
(userInfo.roleInfo.pmc && (userInfo.roleInfo.pmc && (record.statusCode === 710 || record.statusCode === 500))
(record.statusCode === 710 || record.statusCode === 500))
); );
}; };
// 设置状态 // 设置状态
export const setStatus = (record: any, deliverBtn: boolean) => { export const setStatus = (record: any, deliverBtn: boolean) => {
if (record.statusCode !== 50 && !isAllowOption(record)) { if (record.statusCode !== 50 && !isAllowOption(record)) {
return ""; return '';
} }
// 新版 // 新版
if (record.statusCode === 200) { if (record.statusCode === 200) {
return record.signStatus === 2 ? "合同签署" : ""; return record.signStatus === 2 ? '合同签署' : '';
} }
switch (record.statusCode) { switch (record.statusCode) {
case 50: case 50:
return JSON.parse(localStorage.getItem("user_info") as string).roleInfo return JSON.parse(localStorage.getItem('user_info') as string).roleInfo.admin
.admin ? '分配订单'
? "分配订单" : '';
: "";
case 100: case 100:
return "确认订单"; return '确认订单';
case 300: case 300:
return "确认付款"; return '确认付款';
case 400: case 400:
return "确认库存"; return '确认库存';
case 710: case 710:
case 500: case 500:
return deliverBtn ? "发货" : ""; return deliverBtn ? '发货' : '';
case 660: case 660:
return "确认尾款"; return '确认尾款';
default: default:
return null; return null;
} }
......
// 不能输入数字,其他可惜输入 // 不能输入数字,其他可惜输入
export const exceptNumber = (val: any) => { export const exceptNumber = (val: any) => {
val.target.value = val.target.value val.target.value = val.target.value.replace(/1?(\d|([1-9]\d+))(.\d+)?$/g, '').replace(/\s/g, '');
.replace(/1?(\d|([1-9]\d+))(.\d+)?$/g, "")
.replace(/\s/g, "");
}; };
// 只能输入正整数 // 只能输入正整数
export const onlyNumberPositive = (val: any) => { export const onlyNumberPositive = (val: any) => {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (val.target.value == 0) { if (val.target.value == 0) {
val.target.value = val.target.value.replace(/0/g, ""); val.target.value = val.target.value.replace(/0/g, '');
} }
val.target.value = val.target.value.replace(/\D/g, ""); val.target.value = val.target.value.replace(/\D/g, '');
}; };
// 不能输入汉字,其他可输入 // 不能输入汉字,其他可输入
export const exceptChinese = (val: any) => { export const exceptChinese = (val: any) => {
val.target.value = val.target.value val.target.value = val.target.value
.replace(/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/g, "") .replace(/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/g, '')
.replace(/\s/g, ""); .replace(/\s/g, '');
}; };
// 只能输入字母和中文,不能输入数字和符号 // 只能输入字母和中文,不能输入数字和符号
export const onlyCharacter = (val: any) => { export const onlyCharacter = (val: any) => {
val.target.value = val.target.value val.target.value = val.target.value.replace(/[^a-zA-Z\u4E00-\u9FA5]/g, '').replace(/\s/g, '');
.replace(/[^a-zA-Z\u4E00-\u9FA5]/g, "")
.replace(/\s/g, "");
}; };
// 手机号输入,限制11位 // 手机号输入,限制11位
...@@ -33,13 +29,13 @@ export const phoneNumber = (val: any) => { ...@@ -33,13 +29,13 @@ export const phoneNumber = (val: any) => {
if (val.target.value.length > 11) { if (val.target.value.length > 11) {
val.target.value = val.target.value.slice(0, 11); val.target.value = val.target.value.slice(0, 11);
} else { } else {
val.target.value = val.target.value.replace(/\D/g, ""); val.target.value = val.target.value.replace(/\D/g, '');
} }
}; };
// 开头不能输入空格 // 开头不能输入空格
export const noSpaceFront = (val: any) => { export const noSpaceFront = (val: any) => {
val.target.value = val.target.value.replace(/^\s/g, ""); val.target.value = val.target.value.replace(/^\s/g, '');
}; };
// 数字限制长度 // 数字限制长度
...@@ -47,7 +43,7 @@ export const maxLength = (val: any) => { ...@@ -47,7 +43,7 @@ export const maxLength = (val: any) => {
if (val.target.value.length > 10) { if (val.target.value.length > 10) {
val.target.value = val.target.value.slice(0, 10); val.target.value = val.target.value.slice(0, 10);
} else { } else {
val.target.value = val.target.value.replace(/\D/g, ""); val.target.value = val.target.value.replace(/\D/g, '');
} }
}; };
...@@ -63,7 +59,7 @@ export const maxNumber = (val: any) => { ...@@ -63,7 +59,7 @@ export const maxNumber = (val: any) => {
if (val.target.value > 100000) { if (val.target.value > 100000) {
val.target.value = 100000; val.target.value = 100000;
} else { } else {
val.target.value = val.target.value.replace(/\D/g, ""); val.target.value = val.target.value.replace(/\D/g, '');
} }
}; };
...@@ -79,7 +75,7 @@ export const maxLength8 = (val: any) => { ...@@ -79,7 +75,7 @@ export const maxLength8 = (val: any) => {
if (val.target.value.length > 8) { if (val.target.value.length > 8) {
val.target.value = val.target.value.slice(0, 8); val.target.value = val.target.value.slice(0, 8);
} else { } else {
val.target.value = val.target.value.replace(/\D/g, ""); val.target.value = val.target.value.replace(/\D/g, '');
} }
}; };
...@@ -88,7 +84,7 @@ export const maxLength9 = (val: any) => { ...@@ -88,7 +84,7 @@ export const maxLength9 = (val: any) => {
if (val.target.value.length > 9) { if (val.target.value.length > 9) {
val.target.value = val.target.value.slice(0, 9); val.target.value = val.target.value.slice(0, 9);
} else { } else {
val.target.value = val.target.value.replace(/\D/g, ""); val.target.value = val.target.value.replace(/\D/g, '');
} }
}; };
...@@ -97,7 +93,7 @@ export const maxLength7 = (val: any) => { ...@@ -97,7 +93,7 @@ export const maxLength7 = (val: any) => {
if (val.target.value.length > 7) { if (val.target.value.length > 7) {
val.target.value = val.target.value.slice(0, 7); val.target.value = val.target.value.slice(0, 7);
} else { } else {
val.target.value = val.target.value.replace(/\D/g, ""); val.target.value = val.target.value.replace(/\D/g, '');
} }
}; };
...@@ -106,6 +102,6 @@ export const maxLength6 = (val: any) => { ...@@ -106,6 +102,6 @@ export const maxLength6 = (val: any) => {
if (val.target.value.length > 6) { if (val.target.value.length > 6) {
val.target.value = val.target.value.slice(0, 6); val.target.value = val.target.value.slice(0, 6);
} else { } else {
val.target.value = val.target.value.replace(/\D/g, ""); val.target.value = val.target.value.replace(/\D/g, '');
} }
}; };
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论