mall-components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/build/_components-raw.css +791 -0
- package/build/_shims/antd.js +1 -0
- package/build/_shims/icons.js +1 -0
- package/build/_shims/moment.js +1 -0
- package/build/_shims/react-dom.js +1 -0
- package/build/_shims/react.js +1 -0
- package/build/adapters/DataSourceAdapter.d.ts +46 -0
- package/build/components/AdminLayout/AdminLayout.d.ts +5 -0
- package/build/components/AdminLayout/Breadcrumb.d.ts +8 -0
- package/build/components/AdminLayout/MainContent.d.ts +17 -0
- package/build/components/AdminLayout/Navbar.d.ts +10 -0
- package/build/components/AdminLayout/Sidebar.d.ts +14 -0
- package/build/components/AdminLayout/TabBar.d.ts +13 -0
- package/build/components/AdminLayout/TabPane.d.ts +4 -0
- package/build/components/AdminLayout/index.d.ts +3 -0
- package/build/components/AdminLayout/types.d.ts +42 -0
- package/build/components/CouponCard/CouponCard.d.ts +20 -0
- package/build/components/CouponCard/index.d.ts +1 -0
- package/build/components/OrderForm/OrderForm.d.ts +18 -0
- package/build/components/OrderForm/index.d.ts +1 -0
- package/build/components/OrderList/OrderList.d.ts +29 -0
- package/build/components/OrderList/index.d.ts +1 -0
- package/build/components/ProductForm/ProductForm.d.ts +18 -0
- package/build/components/ProductForm/index.d.ts +3 -0
- package/build/components/ProductList/ProductList.d.ts +47 -0
- package/build/components/ProductList/index.d.ts +3 -0
- package/build/components/PromotionCard/PromotionCard.d.ts +22 -0
- package/build/components/PromotionCard/index.d.ts +1 -0
- package/build/components/RoleCard/RoleCard.d.ts +18 -0
- package/build/components/RoleCard/index.d.ts +1 -0
- package/build/components/UserCard/UserCard.d.ts +17 -0
- package/build/components/UserCard/index.d.ts +1 -0
- package/build/entry-meta.d.ts +603 -0
- package/build/index.css +1 -0
- package/build/index.js +1 -0
- package/build/mall-components-meta.js +2563 -0
- package/build/mall-components.cdn.umd.css +1 -0
- package/build/mall-components.cdn.umd.js +8 -0
- package/build/mall-components.codesandbox.combined.js +1094 -0
- package/build/mall-components.codesandbox.css +401 -0
- package/build/mall-components.codesandbox.js +1080 -0
- package/build/mall-components.umd.css +1 -0
- package/build/mall-components.umd.js +8 -0
- package/build/meta/adminLayoutMeta.d.ts +3 -0
- package/build/meta/couponCardMeta.d.ts +128 -0
- package/build/meta/icons.d.ts +10 -0
- package/build/meta/orderFormMeta.d.ts +111 -0
- package/build/meta/orderListMeta.d.ts +170 -0
- package/build/meta/productFormMeta.d.ts +3 -0
- package/build/meta/productListMeta.d.ts +200 -0
- package/build/meta/promotionCardMeta.d.ts +129 -0
- package/build/meta/roleCardMeta.d.ts +3 -0
- package/build/meta/tabPaneMeta.d.ts +3 -0
- package/build/meta/userCardMeta.d.ts +3 -0
- package/build/meta.d.ts +605 -0
- package/build/setters/RestApiTester.d.ts +11 -0
- package/build/types/common.d.ts +17 -0
- package/build/types/marketing.d.ts +128 -0
- package/build/types/order.d.ts +174 -0
- package/build/types/permission.d.ts +101 -0
- package/build/types/product.d.ts +47 -0
- package/package.json +1 -0
- package/src/adapters/DataSourceAdapter.ts +445 -0
- package/src/components/AdminLayout/AdminLayout.scss +447 -0
- package/src/components/AdminLayout/AdminLayout.tsx +681 -0
- package/src/components/AdminLayout/Breadcrumb.tsx +60 -0
- package/src/components/AdminLayout/MainContent.tsx +54 -0
- package/src/components/AdminLayout/Navbar.tsx +76 -0
- package/src/components/AdminLayout/Sidebar.tsx +256 -0
- package/src/components/AdminLayout/TabBar.tsx +177 -0
- package/src/components/AdminLayout/TabPane.tsx +29 -0
- package/src/components/AdminLayout/index.ts +3 -0
- package/src/components/AdminLayout/types.ts +46 -0
- package/src/components/CouponCard/CouponCard.scss +55 -0
- package/src/components/CouponCard/CouponCard.tsx +687 -0
- package/src/components/CouponCard/index.ts +1 -0
- package/src/components/OrderForm/OrderForm.scss +148 -0
- package/src/components/OrderForm/OrderForm.tsx +503 -0
- package/src/components/OrderForm/index.ts +1 -0
- package/src/components/OrderList/OrderList.scss +160 -0
- package/src/components/OrderList/OrderList.tsx +885 -0
- package/src/components/OrderList/index.ts +1 -0
- package/src/components/ProductForm/ProductForm.scss +23 -0
- package/src/components/ProductForm/ProductForm.tsx +442 -0
- package/src/components/ProductForm/index.ts +3 -0
- package/src/components/ProductList/ProductList.scss +293 -0
- package/src/components/ProductList/ProductList.tsx +454 -0
- package/src/components/ProductList/index.ts +3 -0
- package/src/components/PromotionCard/PromotionCard.scss +71 -0
- package/src/components/PromotionCard/PromotionCard.tsx +579 -0
- package/src/components/PromotionCard/index.ts +1 -0
- package/src/components/RoleCard/RoleCard.scss +77 -0
- package/src/components/RoleCard/RoleCard.tsx +463 -0
- package/src/components/RoleCard/index.ts +1 -0
- package/src/components/UserCard/UserCard.scss +51 -0
- package/src/components/UserCard/UserCard.tsx +432 -0
- package/src/components/UserCard/index.ts +1 -0
- package/src/entry-components.ts +39 -0
- package/src/entry-meta.ts +23 -0
- package/src/index.scss +4 -0
- package/src/index.ts +36 -0
- package/src/index.tsx +17 -0
- package/src/meta/adminLayoutMeta.ts +154 -0
- package/src/meta/couponCardMeta.ts +287 -0
- package/src/meta/icons.ts +41 -0
- package/src/meta/orderFormMeta.ts +279 -0
- package/src/meta/orderListMeta.ts +443 -0
- package/src/meta/productFormMeta.ts +253 -0
- package/src/meta/productListMeta.ts +434 -0
- package/src/meta/promotionCardMeta.ts +276 -0
- package/src/meta/roleCardMeta.ts +142 -0
- package/src/meta/tabPaneMeta.ts +69 -0
- package/src/meta/userCardMeta.ts +128 -0
- package/src/meta.ts +25 -0
- package/src/setters/RestApiTester.tsx +219 -0
- package/src/shims/require.js +8 -0
- package/src/types/common.ts +19 -0
- package/src/types/marketing.ts +124 -0
- package/src/types/order.ts +169 -0
- package/src/types/permission.ts +102 -0
- package/src/types/product.ts +49 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
.mall-order-form {
|
|
2
|
+
.ant-card {
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ant-tabs {
|
|
8
|
+
.ant-tabs-nav {
|
|
9
|
+
margin-bottom: 24px;
|
|
10
|
+
|
|
11
|
+
&::before {
|
|
12
|
+
border-bottom: 2px solid #f0f0f0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ant-tabs-tab {
|
|
16
|
+
padding: 12px 16px;
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
transition: all 0.3s ease;
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
color: #1890ff;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.ant-tabs-tab-active {
|
|
25
|
+
.ant-tabs-tab-btn {
|
|
26
|
+
color: #1890ff;
|
|
27
|
+
font-weight: 600;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ant-tabs-ink-bar {
|
|
33
|
+
height: 3px;
|
|
34
|
+
background: linear-gradient(90deg, #1890ff 0%, #40a9ff 100%);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ant-form {
|
|
40
|
+
.ant-form-item {
|
|
41
|
+
margin-bottom: 20px;
|
|
42
|
+
|
|
43
|
+
.ant-form-item-label {
|
|
44
|
+
label {
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
color: #262626;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ant-input,
|
|
51
|
+
.ant-input-number,
|
|
52
|
+
.ant-select {
|
|
53
|
+
border-radius: 4px;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
border-color: #40a9ff;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:focus,
|
|
60
|
+
&.ant-input-focused,
|
|
61
|
+
&.ant-select-focused {
|
|
62
|
+
border-color: #1890ff;
|
|
63
|
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ant-input-textarea-show-count::after {
|
|
68
|
+
float: right;
|
|
69
|
+
color: #8c8c8c;
|
|
70
|
+
font-size: 12px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ant-table {
|
|
76
|
+
.ant-table-thead > tr > th {
|
|
77
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
78
|
+
color: white;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ant-table-tbody > tr {
|
|
83
|
+
&:hover {
|
|
84
|
+
background: #f5f5f5;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
> td {
|
|
88
|
+
padding: 12px 8px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ant-divider {
|
|
94
|
+
margin: 24px 0;
|
|
95
|
+
border-color: #f0f0f0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ant-space {
|
|
99
|
+
.ant-btn {
|
|
100
|
+
min-width: 80px;
|
|
101
|
+
border-radius: 4px;
|
|
102
|
+
font-weight: 500;
|
|
103
|
+
transition: all 0.3s ease;
|
|
104
|
+
|
|
105
|
+
&:hover {
|
|
106
|
+
transform: translateY(-1px);
|
|
107
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&.ant-btn-primary {
|
|
111
|
+
background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
|
|
112
|
+
border: none;
|
|
113
|
+
|
|
114
|
+
&:hover {
|
|
115
|
+
background: linear-gradient(135deg, #40a9ff 0%, #69c0ff 100%);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@media (max-width: 768px) {
|
|
122
|
+
.ant-form {
|
|
123
|
+
.ant-col {
|
|
124
|
+
margin-bottom: 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.ant-tabs {
|
|
129
|
+
.ant-tabs-nav {
|
|
130
|
+
.ant-tabs-tab {
|
|
131
|
+
padding: 8px 12px;
|
|
132
|
+
font-size: 14px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.ant-table {
|
|
138
|
+
overflow-x: auto;
|
|
139
|
+
|
|
140
|
+
.ant-table-thead > tr > th,
|
|
141
|
+
.ant-table-tbody > tr > td {
|
|
142
|
+
white-space: nowrap;
|
|
143
|
+
font-size: 12px;
|
|
144
|
+
padding: 8px 4px;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Form,
|
|
4
|
+
Input,
|
|
5
|
+
InputNumber,
|
|
6
|
+
Select,
|
|
7
|
+
Button,
|
|
8
|
+
Card,
|
|
9
|
+
Space,
|
|
10
|
+
message,
|
|
11
|
+
Divider,
|
|
12
|
+
Row,
|
|
13
|
+
Col,
|
|
14
|
+
Tabs,
|
|
15
|
+
Table,
|
|
16
|
+
Descriptions,
|
|
17
|
+
Tag,
|
|
18
|
+
} from 'antd'
|
|
19
|
+
import type { ColumnsType } from 'antd/es/table'
|
|
20
|
+
import type {
|
|
21
|
+
OmsOrder,
|
|
22
|
+
OmsOrderDetail,
|
|
23
|
+
OmsOrderItem,
|
|
24
|
+
OmsReceiverInfoParam,
|
|
25
|
+
OmsMoneyInfoParam,
|
|
26
|
+
} from '../../types/order'
|
|
27
|
+
import {
|
|
28
|
+
ORDER_STATUS_OPTIONS,
|
|
29
|
+
PAY_TYPE_OPTIONS,
|
|
30
|
+
SOURCE_TYPE_OPTIONS,
|
|
31
|
+
ORDER_TYPE_OPTIONS,
|
|
32
|
+
ORDER_STATUS,
|
|
33
|
+
PAY_TYPE,
|
|
34
|
+
SOURCE_TYPE,
|
|
35
|
+
ORDER_TYPE,
|
|
36
|
+
} from '../../types/order'
|
|
37
|
+
import './OrderForm.scss'
|
|
38
|
+
|
|
39
|
+
const { TextArea } = Input
|
|
40
|
+
|
|
41
|
+
interface OrderFormProps {
|
|
42
|
+
initialValues?: string | Partial<OmsOrderDetail>
|
|
43
|
+
mode?: 'create' | 'edit' | 'view'
|
|
44
|
+
showBasicInfo?: boolean
|
|
45
|
+
showReceiverInfo?: boolean
|
|
46
|
+
showMoneyInfo?: boolean
|
|
47
|
+
showOrderItems?: boolean
|
|
48
|
+
showStatusInfo?: boolean
|
|
49
|
+
onSubmit?: (values: OmsOrder) => void
|
|
50
|
+
onCancel?: () => void
|
|
51
|
+
style?: React.CSSProperties
|
|
52
|
+
className?: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const OrderForm: React.FC<OrderFormProps> = ({
|
|
56
|
+
initialValues,
|
|
57
|
+
mode = 'create',
|
|
58
|
+
showBasicInfo = true,
|
|
59
|
+
showReceiverInfo = true,
|
|
60
|
+
showMoneyInfo = true,
|
|
61
|
+
showOrderItems = true,
|
|
62
|
+
showStatusInfo = true,
|
|
63
|
+
onSubmit,
|
|
64
|
+
onCancel,
|
|
65
|
+
style,
|
|
66
|
+
className,
|
|
67
|
+
}) => {
|
|
68
|
+
const [form] = Form.useForm()
|
|
69
|
+
const [activeTab, setActiveTab] = useState('basic')
|
|
70
|
+
const [orderItems, setOrderItems] = useState<OmsOrderItem[]>([])
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (initialValues) {
|
|
74
|
+
let parsedValues = initialValues
|
|
75
|
+
if (typeof initialValues === 'string') {
|
|
76
|
+
try {
|
|
77
|
+
parsedValues = JSON.parse(initialValues)
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.error('Failed to parse initialValues:', e)
|
|
80
|
+
parsedValues = {}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
form.setFieldsValue(parsedValues as any)
|
|
84
|
+
if ((parsedValues as OmsOrderDetail).orderItemList) {
|
|
85
|
+
setOrderItems((parsedValues as OmsOrderDetail).orderItemList)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, [initialValues, form])
|
|
89
|
+
|
|
90
|
+
const handleSubmit = async () => {
|
|
91
|
+
try {
|
|
92
|
+
const values = await form.validateFields()
|
|
93
|
+
onSubmit?.(values as OmsOrder)
|
|
94
|
+
message.success('提交成功')
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error('Validation failed:', error)
|
|
97
|
+
message.error('请检查表单填写是否正确')
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const handleCancel = () => {
|
|
102
|
+
form.resetFields()
|
|
103
|
+
onCancel?.()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const handleReset = () => {
|
|
107
|
+
form.resetFields()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const getParsedInitialValues = () => {
|
|
111
|
+
if (typeof initialValues === 'string') {
|
|
112
|
+
try {
|
|
113
|
+
return JSON.parse(initialValues)
|
|
114
|
+
} catch (e) {
|
|
115
|
+
return {}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return initialValues || {}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const isViewMode = mode === 'view'
|
|
122
|
+
|
|
123
|
+
const getStatusTag = (status: number) => {
|
|
124
|
+
const statusMap: Record<number, { color: string; text: string }> = {
|
|
125
|
+
[ORDER_STATUS.PENDING_PAYMENT]: { color: 'orange', text: '待付款' },
|
|
126
|
+
[ORDER_STATUS.PENDING_DELIVERY]: { color: 'blue', text: '待发货' },
|
|
127
|
+
[ORDER_STATUS.DELIVERED]: { color: 'cyan', text: '已发货' },
|
|
128
|
+
[ORDER_STATUS.COMPLETED]: { color: 'green', text: '已完成' },
|
|
129
|
+
[ORDER_STATUS.CLOSED]: { color: 'default', text: '已关闭' },
|
|
130
|
+
[ORDER_STATUS.INVALID]: { color: 'red', text: '无效订单' },
|
|
131
|
+
}
|
|
132
|
+
const { color, text } = statusMap[status] || { color: 'default', text: '未知' }
|
|
133
|
+
return <Tag color={color}>{text}</Tag>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const orderItemColumns: ColumnsType<OmsOrderItem> = [
|
|
137
|
+
{
|
|
138
|
+
title: '商品图片',
|
|
139
|
+
dataIndex: 'productPic',
|
|
140
|
+
key: 'productPic',
|
|
141
|
+
width: 80,
|
|
142
|
+
render: (pic: string) => (
|
|
143
|
+
<img src={pic} alt="商品图片" style={{ width: 50, height: 50, objectFit: 'cover' }} />
|
|
144
|
+
),
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
title: '商品名称',
|
|
148
|
+
dataIndex: 'productName',
|
|
149
|
+
key: 'productName',
|
|
150
|
+
width: 200,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
title: '商品货号',
|
|
154
|
+
dataIndex: 'productSn',
|
|
155
|
+
key: 'productSn',
|
|
156
|
+
width: 120,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
title: '商品品牌',
|
|
160
|
+
dataIndex: 'productBrand',
|
|
161
|
+
key: 'productBrand',
|
|
162
|
+
width: 100,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
title: '销售价格',
|
|
166
|
+
dataIndex: 'productPrice',
|
|
167
|
+
key: 'productPrice',
|
|
168
|
+
width: 100,
|
|
169
|
+
render: (price: number) => `¥${price.toFixed(2)}`,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
title: '购买数量',
|
|
173
|
+
dataIndex: 'productQuantity',
|
|
174
|
+
key: 'productQuantity',
|
|
175
|
+
width: 100,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
title: '小计',
|
|
179
|
+
key: 'subtotal',
|
|
180
|
+
width: 100,
|
|
181
|
+
render: (_, record) => `¥${(record.productPrice * record.productQuantity).toFixed(2)}`,
|
|
182
|
+
},
|
|
183
|
+
]
|
|
184
|
+
|
|
185
|
+
const basicInfoItems = [
|
|
186
|
+
<Row gutter={16} key="basic-row-1">
|
|
187
|
+
<Col span={12}>
|
|
188
|
+
<Form.Item
|
|
189
|
+
name="orderSn"
|
|
190
|
+
label="订单编号"
|
|
191
|
+
rules={[{ required: true, message: '请输入订单编号' }]}
|
|
192
|
+
>
|
|
193
|
+
<Input placeholder="请输入订单编号" disabled={isViewMode} />
|
|
194
|
+
</Form.Item>
|
|
195
|
+
</Col>
|
|
196
|
+
<Col span={12}>
|
|
197
|
+
<Form.Item
|
|
198
|
+
name="memberUsername"
|
|
199
|
+
label="用户账号"
|
|
200
|
+
rules={[{ required: true, message: '请输入用户账号' }]}
|
|
201
|
+
>
|
|
202
|
+
<Input placeholder="请输入用户账号" disabled={isViewMode} />
|
|
203
|
+
</Form.Item>
|
|
204
|
+
</Col>
|
|
205
|
+
</Row>,
|
|
206
|
+
|
|
207
|
+
<Row gutter={16} key="basic-row-2">
|
|
208
|
+
<Col span={8}>
|
|
209
|
+
<Form.Item name="payType" label="支付方式" rules={[{ required: true }]}>
|
|
210
|
+
<Select placeholder="请选择支付方式" disabled={isViewMode}>
|
|
211
|
+
{PAY_TYPE_OPTIONS.map((option) => (
|
|
212
|
+
<Select.Option key={option.value} value={option.value}>
|
|
213
|
+
{option.label}
|
|
214
|
+
</Select.Option>
|
|
215
|
+
))}
|
|
216
|
+
</Select>
|
|
217
|
+
</Form.Item>
|
|
218
|
+
</Col>
|
|
219
|
+
<Col span={8}>
|
|
220
|
+
<Form.Item name="sourceType" label="订单来源" rules={[{ required: true }]}>
|
|
221
|
+
<Select placeholder="请选择订单来源" disabled={isViewMode}>
|
|
222
|
+
{SOURCE_TYPE_OPTIONS.map((option) => (
|
|
223
|
+
<Select.Option key={option.value} value={option.value}>
|
|
224
|
+
{option.label}
|
|
225
|
+
</Select.Option>
|
|
226
|
+
))}
|
|
227
|
+
</Select>
|
|
228
|
+
</Form.Item>
|
|
229
|
+
</Col>
|
|
230
|
+
<Col span={8}>
|
|
231
|
+
<Form.Item name="orderType" label="订单类型" rules={[{ required: true }]}>
|
|
232
|
+
<Select placeholder="请选择订单类型" disabled={isViewMode}>
|
|
233
|
+
{ORDER_TYPE_OPTIONS.map((option) => (
|
|
234
|
+
<Select.Option key={option.value} value={option.value}>
|
|
235
|
+
{option.label}
|
|
236
|
+
</Select.Option>
|
|
237
|
+
))}
|
|
238
|
+
</Select>
|
|
239
|
+
</Form.Item>
|
|
240
|
+
</Col>
|
|
241
|
+
</Row>,
|
|
242
|
+
|
|
243
|
+
<Row gutter={16} key="basic-row-3">
|
|
244
|
+
<Col span={12}>
|
|
245
|
+
<Form.Item name="createTime" label="下单时间">
|
|
246
|
+
<Input placeholder="下单时间" disabled />
|
|
247
|
+
</Form.Item>
|
|
248
|
+
</Col>
|
|
249
|
+
<Col span={12}>
|
|
250
|
+
<Form.Item name="paymentTime" label="支付时间">
|
|
251
|
+
<Input placeholder="支付时间" disabled />
|
|
252
|
+
</Form.Item>
|
|
253
|
+
</Col>
|
|
254
|
+
</Row>,
|
|
255
|
+
]
|
|
256
|
+
|
|
257
|
+
const receiverInfoItems = [
|
|
258
|
+
<Row gutter={16} key="receiver-row-1">
|
|
259
|
+
<Col span={12}>
|
|
260
|
+
<Form.Item
|
|
261
|
+
name="receiverName"
|
|
262
|
+
label="收货人姓名"
|
|
263
|
+
rules={[{ required: true, message: '请输入收货人姓名' }]}
|
|
264
|
+
>
|
|
265
|
+
<Input placeholder="请输入收货人姓名" disabled={isViewMode} />
|
|
266
|
+
</Form.Item>
|
|
267
|
+
</Col>
|
|
268
|
+
<Col span={12}>
|
|
269
|
+
<Form.Item
|
|
270
|
+
name="receiverPhone"
|
|
271
|
+
label="收货人电话"
|
|
272
|
+
rules={[{ required: true, message: '请输入收货人电话' }]}
|
|
273
|
+
>
|
|
274
|
+
<Input placeholder="请输入收货人电话" disabled={isViewMode} />
|
|
275
|
+
</Form.Item>
|
|
276
|
+
</Col>
|
|
277
|
+
</Row>,
|
|
278
|
+
|
|
279
|
+
<Row gutter={16} key="receiver-row-2">
|
|
280
|
+
<Col span={8}>
|
|
281
|
+
<Form.Item name="receiverProvince" label="省份">
|
|
282
|
+
<Input placeholder="省份" disabled={isViewMode} />
|
|
283
|
+
</Form.Item>
|
|
284
|
+
</Col>
|
|
285
|
+
<Col span={8}>
|
|
286
|
+
<Form.Item name="receiverCity" label="城市">
|
|
287
|
+
<Input placeholder="城市" disabled={isViewMode} />
|
|
288
|
+
</Form.Item>
|
|
289
|
+
</Col>
|
|
290
|
+
<Col span={8}>
|
|
291
|
+
<Form.Item name="receiverRegion" label="区">
|
|
292
|
+
<Input placeholder="区" disabled={isViewMode} />
|
|
293
|
+
</Form.Item>
|
|
294
|
+
</Col>
|
|
295
|
+
</Row>,
|
|
296
|
+
|
|
297
|
+
<Form.Item key="receiverDetailAddress" name="receiverDetailAddress" label="详细地址">
|
|
298
|
+
<TextArea rows={2} placeholder="请输入详细地址" disabled={isViewMode} />
|
|
299
|
+
</Form.Item>,
|
|
300
|
+
|
|
301
|
+
<Row gutter={16} key="receiver-row-3">
|
|
302
|
+
<Col span={12}>
|
|
303
|
+
<Form.Item name="deliveryCompany" label="物流公司">
|
|
304
|
+
<Input placeholder="物流公司" disabled={isViewMode} />
|
|
305
|
+
</Form.Item>
|
|
306
|
+
</Col>
|
|
307
|
+
<Col span={12}>
|
|
308
|
+
<Form.Item name="deliverySn" label="物流单号">
|
|
309
|
+
<Input placeholder="物流单号" disabled={isViewMode} />
|
|
310
|
+
</Form.Item>
|
|
311
|
+
</Col>
|
|
312
|
+
</Row>,
|
|
313
|
+
]
|
|
314
|
+
|
|
315
|
+
const moneyInfoItems = [
|
|
316
|
+
<Row gutter={16} key="money-row-1">
|
|
317
|
+
<Col span={8}>
|
|
318
|
+
<Form.Item
|
|
319
|
+
name="totalAmount"
|
|
320
|
+
label="订单总金额"
|
|
321
|
+
rules={[{ required: true, message: '请输入订单总金额' }]}
|
|
322
|
+
>
|
|
323
|
+
<InputNumber
|
|
324
|
+
placeholder="订单总金额"
|
|
325
|
+
style={{ width: '100%' }}
|
|
326
|
+
min={0}
|
|
327
|
+
precision={2}
|
|
328
|
+
prefix="¥"
|
|
329
|
+
disabled={isViewMode}
|
|
330
|
+
/>
|
|
331
|
+
</Form.Item>
|
|
332
|
+
</Col>
|
|
333
|
+
<Col span={8}>
|
|
334
|
+
<Form.Item
|
|
335
|
+
name="payAmount"
|
|
336
|
+
label="实付金额"
|
|
337
|
+
rules={[{ required: true, message: '请输入实付金额' }]}
|
|
338
|
+
>
|
|
339
|
+
<InputNumber
|
|
340
|
+
placeholder="实付金额"
|
|
341
|
+
style={{ width: '100%' }}
|
|
342
|
+
min={0}
|
|
343
|
+
precision={2}
|
|
344
|
+
prefix="¥"
|
|
345
|
+
disabled={isViewMode}
|
|
346
|
+
/>
|
|
347
|
+
</Form.Item>
|
|
348
|
+
</Col>
|
|
349
|
+
<Col span={8}>
|
|
350
|
+
<Form.Item name="freightAmount" label="运费金额">
|
|
351
|
+
<InputNumber
|
|
352
|
+
placeholder="运费金额"
|
|
353
|
+
style={{ width: '100%' }}
|
|
354
|
+
min={0}
|
|
355
|
+
precision={2}
|
|
356
|
+
prefix="¥"
|
|
357
|
+
disabled={isViewMode}
|
|
358
|
+
/>
|
|
359
|
+
</Form.Item>
|
|
360
|
+
</Col>
|
|
361
|
+
</Row>,
|
|
362
|
+
|
|
363
|
+
<Row gutter={16} key="money-row-2">
|
|
364
|
+
<Col span={8}>
|
|
365
|
+
<Form.Item name="discountAmount" label="折扣金额">
|
|
366
|
+
<InputNumber
|
|
367
|
+
placeholder="折扣金额"
|
|
368
|
+
style={{ width: '100%' }}
|
|
369
|
+
min={0}
|
|
370
|
+
precision={2}
|
|
371
|
+
prefix="¥"
|
|
372
|
+
disabled={isViewMode}
|
|
373
|
+
/>
|
|
374
|
+
</Form.Item>
|
|
375
|
+
</Col>
|
|
376
|
+
<Col span={8}>
|
|
377
|
+
<Form.Item name="promotionAmount" label="促销优惠">
|
|
378
|
+
<InputNumber
|
|
379
|
+
placeholder="促销优惠"
|
|
380
|
+
style={{ width: '100%' }}
|
|
381
|
+
min={0}
|
|
382
|
+
precision={2}
|
|
383
|
+
prefix="¥"
|
|
384
|
+
disabled={isViewMode}
|
|
385
|
+
/>
|
|
386
|
+
</Form.Item>
|
|
387
|
+
</Col>
|
|
388
|
+
<Col span={8}>
|
|
389
|
+
<Form.Item name="couponAmount" label="优惠券抵扣">
|
|
390
|
+
<InputNumber
|
|
391
|
+
placeholder="优惠券抵扣"
|
|
392
|
+
style={{ width: '100%' }}
|
|
393
|
+
min={0}
|
|
394
|
+
precision={2}
|
|
395
|
+
prefix="¥"
|
|
396
|
+
disabled={isViewMode}
|
|
397
|
+
/>
|
|
398
|
+
</Form.Item>
|
|
399
|
+
</Col>
|
|
400
|
+
</Row>,
|
|
401
|
+
]
|
|
402
|
+
|
|
403
|
+
const statusInfoItems = [
|
|
404
|
+
<Row gutter={16} key="status-row-1">
|
|
405
|
+
<Col span={12}>
|
|
406
|
+
<Form.Item name="status" label="订单状态" rules={[{ required: true }]}>
|
|
407
|
+
<Select placeholder="请选择订单状态" disabled={isViewMode}>
|
|
408
|
+
{ORDER_STATUS_OPTIONS.map((option) => (
|
|
409
|
+
<Select.Option key={option.value} value={option.value}>
|
|
410
|
+
{option.label}
|
|
411
|
+
</Select.Option>
|
|
412
|
+
))}
|
|
413
|
+
</Select>
|
|
414
|
+
</Form.Item>
|
|
415
|
+
</Col>
|
|
416
|
+
<Col span={12}>
|
|
417
|
+
<Form.Item name="confirmStatus" label="确认收货状态">
|
|
418
|
+
<Select placeholder="请选择确认收货状态" disabled={isViewMode}>
|
|
419
|
+
<Select.Option value={0}>未确认</Select.Option>
|
|
420
|
+
<Select.Option value={1}>已确认</Select.Option>
|
|
421
|
+
</Select>
|
|
422
|
+
</Form.Item>
|
|
423
|
+
</Col>
|
|
424
|
+
</Row>,
|
|
425
|
+
|
|
426
|
+
<Form.Item key="promotionInfo" name="promotionInfo" label="活动信息">
|
|
427
|
+
<Input placeholder="活动信息" disabled={isViewMode} />
|
|
428
|
+
</Form.Item>,
|
|
429
|
+
|
|
430
|
+
<Form.Item key="note" name="note" label="订单备注">
|
|
431
|
+
<TextArea rows={3} placeholder="请输入订单备注" disabled={isViewMode} />
|
|
432
|
+
</Form.Item>,
|
|
433
|
+
]
|
|
434
|
+
|
|
435
|
+
const tabItems = [
|
|
436
|
+
{
|
|
437
|
+
key: 'basic',
|
|
438
|
+
label: '基本信息',
|
|
439
|
+
children: showBasicInfo ? basicInfoItems : null,
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
key: 'receiver',
|
|
443
|
+
label: '收货信息',
|
|
444
|
+
children: showReceiverInfo ? receiverInfoItems : null,
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
key: 'money',
|
|
448
|
+
label: '费用信息',
|
|
449
|
+
children: showMoneyInfo ? moneyInfoItems : null,
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
key: 'items',
|
|
453
|
+
label: '商品信息',
|
|
454
|
+
children: showOrderItems ? (
|
|
455
|
+
<Table
|
|
456
|
+
columns={orderItemColumns}
|
|
457
|
+
dataSource={orderItems}
|
|
458
|
+
rowKey="id"
|
|
459
|
+
pagination={false}
|
|
460
|
+
scroll={{ x: 900 }}
|
|
461
|
+
/>
|
|
462
|
+
) : null,
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
key: 'status',
|
|
466
|
+
label: '状态信息',
|
|
467
|
+
children: showStatusInfo ? statusInfoItems : null,
|
|
468
|
+
},
|
|
469
|
+
]
|
|
470
|
+
|
|
471
|
+
return (
|
|
472
|
+
<div className={`mall-order-form ${className || ''}`} style={style}>
|
|
473
|
+
<Card>
|
|
474
|
+
<Form
|
|
475
|
+
form={form}
|
|
476
|
+
layout="vertical"
|
|
477
|
+
initialValues={getParsedInitialValues()}
|
|
478
|
+
disabled={isViewMode}
|
|
479
|
+
>
|
|
480
|
+
<Tabs activeKey={activeTab} onChange={setActiveTab} items={tabItems} />
|
|
481
|
+
|
|
482
|
+
<Divider />
|
|
483
|
+
|
|
484
|
+
<Form.Item>
|
|
485
|
+
<Space>
|
|
486
|
+
{!isViewMode && (
|
|
487
|
+
<>
|
|
488
|
+
<Button type="primary" onClick={handleSubmit}>
|
|
489
|
+
{mode === 'create' ? '创建' : '保存'}
|
|
490
|
+
</Button>
|
|
491
|
+
<Button onClick={handleReset}>重置</Button>
|
|
492
|
+
</>
|
|
493
|
+
)}
|
|
494
|
+
<Button onClick={handleCancel}>{isViewMode ? '关闭' : '取消'}</Button>
|
|
495
|
+
</Space>
|
|
496
|
+
</Form.Item>
|
|
497
|
+
</Form>
|
|
498
|
+
</Card>
|
|
499
|
+
</div>
|
|
500
|
+
)
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export default OrderForm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './OrderForm'
|