Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
e2a19a1d
提交
e2a19a1d
authored
3月 27, 2019
作者:
sin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加 orderList 订单页面
上级
c23eb737
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
191 行增加
和
137 行删除
+191
-137
orderList.js
admin-web/src/models/order/orderList.js
+20
-4
OrderList.js
admin-web/src/pages/Order/OrderList.js
+171
-133
WechatIMG1.png
admin-web/src/pages/Order/WechatIMG1.png
+0
-0
没有找到文件。
admin-web/src/models/order/orderList.js
浏览文件 @
e2a19a1d
...
@@ -5,17 +5,32 @@ export default {
...
@@ -5,17 +5,32 @@ export default {
namespace
:
'orderList'
,
namespace
:
'orderList'
,
state
:
{
state
:
{
list
:
[],
list
:
{
pagination
:
{
current
:
0
,
pageSize
:
10
,
total
:
0
,
},
dataSource
:
[],
},
},
},
effects
:
{
effects
:
{
*
queryPage
({
payload
},
{
call
,
put
})
{
*
queryPage
({
payload
},
{
call
,
put
})
{
const
response
=
yield
call
(
orderPage
,
payload
);
const
response
=
yield
call
(
orderPage
,
payload
);
message
.
info
(
'查询成功!'
);
message
.
info
(
'查询成功!'
,
response
);
const
{
total
,
orders
}
=
response
.
data
;
yield
put
({
yield
put
({
type
:
'queryPageSuccess'
,
type
:
'queryPageSuccess'
,
payload
:
{
payload
:
{
list
:
response
.
data
,
list
:
{
dataSource
:
orders
,
pagination
:
{
total
,
current
:
payload
.
pageNo
,
pageSize
:
payload
.
pageSize
,
},
},
},
},
});
});
},
},
...
@@ -34,9 +49,10 @@ export default {
...
@@ -34,9 +49,10 @@ export default {
reducers
:
{
reducers
:
{
queryPageSuccess
(
state
,
{
payload
})
{
queryPageSuccess
(
state
,
{
payload
})
{
const
{
list
}
=
payload
;
return
{
return
{
...
state
,
...
state
,
...
payload
,
list
,
};
};
},
},
},
},
...
...
admin-web/src/pages/Order/OrderList.js
浏览文件 @
e2a19a1d
import
React
,
{
PureComponent
}
from
'react'
;
import
React
,
{
Fragment
,
PureComponent
}
from
'react'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
connect
}
from
'dva'
;
import
{
connect
}
from
'dva'
;
import
{
import
{
Button
,
Card
,
Col
,
Divider
,
Form
,
Input
,
Row
,
Table
,
DatePicker
}
from
'antd'
;
Button
,
Card
,
Col
,
Dropdown
,
Form
,
Icon
,
Input
,
List
,
Menu
,
Modal
,
Row
,
Select
,
}
from
'antd'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
DictionaryText
from
'@/components/Dictionary/DictionaryText'
;
import
DictionaryText
from
'@/components/Dictionary/DictionaryText'
;
import
DictionarySelect
from
'@/components/Dictionary/DictionarySelect'
;
import
dictionary
from
'@/utils/dictionary'
;
import
dictionary
from
'@/utils/dictionary'
;
import
styles
from
'./OrderList.less'
;
import
styles
from
'./OrderList.less'
;
const
{
RangePicker
}
=
DatePicker
;
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
const
SelectOption
=
Select
.
Option
;
const
OrderList
=
props
=>
{
const
OrderList
=
props
=>
{
const
{
list
,
loading
}
=
props
;
const
{
list
,
dispatch
,
loading
,
handleModalVisible
}
=
props
;
const
paginationProps
=
{
// 翻页
showSizeChanger
:
true
,
const
onPageChange
=
page
=>
{
showQuickJumper
:
true
,
const
{
searchParams
}
=
props
;
pageSize
:
5
,
total
:
50
,
};
const
deleteItem
=
id
=>
{
const
{
dispatch
}
=
props
;
dispatch
({
dispatch
({
type
:
'list/submit'
,
type
:
'adminList/query'
,
payload
:
{
id
},
payload
:
{
pageNo
:
page
.
current
,
pageSize
:
page
.
pageSize
,
...
searchParams
,
},
});
});
};
};
const
handleEditor
=
currentItem
=>
{
const
columns
=
[
const
{
handleEditorClick
}
=
props
;
{
if
(
handleEditorClick
)
{
title
:
'订单id'
,
handleEditorClick
(
currentItem
);
dataIndex
:
'id'
,
}
},
};
{
title
:
'用户'
,
const
handleMoreMenu
=
(
key
,
currentItem
)
=>
{
dataIndex
:
'userId'
,
if
(
key
===
'edit'
)
{
},
handleEditor
(
currentItem
);
{
}
else
if
(
key
===
'delete'
)
{
title
:
'订单号'
,
Modal
.
confirm
({
dataIndex
:
'orderNo'
,
title
:
'删除任务'
,
},
content
:
'确定删除该任务吗?'
,
{
okText
:
'确认'
,
title
:
'金额'
,
cancelText
:
'取消'
,
dataIndex
:
'price'
,
onOk
:
()
=>
deleteItem
(
currentItem
.
id
),
render
(
val
)
{
});
return
<
span
>
{
val
}
元
<
/span>
;
}
},
};
},
{
const
ListContent
=
({
data
})
=>
(
title
:
'状态'
,
<
div
className
=
{
styles
.
listContent
}
>
dataIndex
:
'status'
,
<
div
className
=
{
styles
.
listContentItem
}
>
render
(
val
)
{
<
span
>
金额
:
{
data
.
price
/
100
}
元
<
/span
>
return
<
DictionaryText
dicKey
=
{
dictionary
.
ORDER_STATUS
}
dicValue
=
{
val
}
/>
;
<
p
>
编号
:
{
data
.
orderNo
}
<
/p
>
},
<
/div
>
},
<
div
className
=
{
styles
.
listContentItem
}
>
{
<
span
>
title
:
'付款时间'
,
付款时间
:
{
data
.
paymentTime
?
moment
(
data
.
paymentTime
).
format
(
'YYYY-MM-DD HH:mm'
)
:
''
}
dataIndex
:
'paymentTime'
,
<
/span
>
render
:
val
=>
(
!
val
?
''
:
<
span
>
{
moment
(
val
).
format
(
'YYYY-MM-DD HH:mm'
)}
<
/span>
)
,
<
p
>
创建时间:
{
moment
(
data
.
createTime
).
format
(
'YYYY-MM-DD HH:mm'
)}
<
/p
>
},
<
/div
>
{
<
div
className
=
{
styles
.
listContentItem
}
>
title
:
'发货时间'
,
<
span
>
dataIndex
:
'deliveryTime'
,
订单状态
:
<
DictionaryText
dicKey
=
{
dictionary
.
ORDER_STATUS
}
dicValue
=
{
data
.
status
}
/
>
render
:
val
=>
(
!
val
?
''
:
<
span
>
{
moment
(
val
).
format
(
'YYYY-MM-DD HH:mm'
)}
<
/span>
)
,
<
/span
>
},
<
/div
>
{
<
/div
>
title
:
'收货时间'
,
dataIndex
:
'receiverTime'
,
render
:
val
=>
(
!
val
?
''
:
<
span
>
{
moment
(
val
).
format
(
'YYYY-MM-DD HH:mm'
)}
<
/span>
)
,
},
{
title
:
'成交时间'
,
dataIndex
:
'closingTime'
,
render
:
val
=>
(
!
val
?
''
:
<
span
>
{
moment
(
val
).
format
(
'YYYY-MM-DD HH:mm'
)}
<
/span>
)
,
},
{
title
:
'创建时间'
,
dataIndex
:
'createTime'
,
render
:
val
=>
(
!
val
?
''
:
<
span
>
{
moment
(
val
).
format
(
'YYYY-MM-DD HH:mm'
)}
<
/span>
)
,
},
{
title
:
'操作'
,
width
:
100
,
render
:
(
text
,
record
)
=>
{
return
(
<
Fragment
>
<
a
onClick
=
{()
=>
handleModalVisible
(
true
,
'update'
,
record
)}
>
编辑
<
/a
>
<
Divider
type
=
"vertical"
/>
<
/Fragment
>
);
);
},
},
];
const
MoreBtn
=
()
=>
(
const
tableScroll
=
{
<
Dropdown
x
:
1400
,
overlay
=
{
};
<
Menu
onClick
=
{({
key
})
=>
handleMoreMenu
(
key
,
props
.
current
)}
>
<
Menu
.
Item
key
=
"edit"
>
编辑
<
/Menu.Item
>
<
Menu
.
Item
key
=
"delete"
>
删除
<
/Menu.Item
>
<
/Menu
>
}
>
<
a
>
更多
<
Icon
type
=
"down"
/>
<
/a
>
<
/Dropdown
>
);
return
(
return
(
<
List
<
Table
size
=
"large"
rowKey
=
"id"
rowKey
=
"id"
columns
=
{
columns
}
dataSource
=
{
list
.
dataSource
}
loading
=
{
loading
}
loading
=
{
loading
}
pagination
=
{
paginationProps
}
pagination
=
{
list
.
pagination
}
dataSource
=
{
list
}
onChange
=
{
onPageChange
}
renderItem
=
{
item
=>
(
scroll
=
{
tableScroll
}
<
List
.
Item
actions
=
{[
<
a
onClick
=
{
e
=>
{
e
.
preventDefault
();
handleEditor
(
item
);
}}
>
编辑
<
/a>
,
<
MoreBtn
current
=
{
item
}
/>
,
]}
>
<
ListContent
data
=
{
item
}
/
>
<
/List.Item
>
)}
/
>
/
>
);
);
};
};
...
@@ -131,30 +116,80 @@ const OrderList = props => {
...
@@ -131,30 +116,80 @@ const OrderList = props => {
const
SearchForm
=
props
=>
{
const
SearchForm
=
props
=>
{
const
{
const
{
form
:
{
getFieldDecorator
},
form
:
{
getFieldDecorator
},
form
,
handleSearch
,
}
=
props
;
}
=
props
;
const
handleFormReset
=
()
=>
{};
const
handleFormReset
=
()
=>
{};
const
handleSearch
=
()
=>
{};
const
onSubmit
=
e
=>
{
e
.
preventDefault
();
form
.
validateFields
((
err
,
fields
)
=>
{
const
buildTime
=
(
fieldValue
,
key
)
=>
{
const
res
=
{};
if
(
fieldValue
)
{
const
keySuffix
=
key
.
substring
(
0
,
1
).
toUpperCase
()
+
key
.
substring
(
1
);
// res[`start${keySuffix}`] = fieldValue[0].valueOf();
res
[
`start
${
keySuffix
}
`
]
=
fieldValue
[
0
].
format
(
'YYYY-MM-DD HH:mm:ss'
);
// res[`end${keySuffix}`] = fieldValue[1].valueOf();
res
[
`end
${
keySuffix
}
`
]
=
fieldValue
[
1
].
format
(
'YYYY-MM-DD HH:mm:ss'
);
}
return
res
;
};
const
timeFields
=
[
'createTime'
,
'closingTime'
];
const
buildSearchParams
=
fields2
=>
{
let
res
=
{};
Object
.
keys
(
fields
).
map
(
objectKey
=>
{
const
fieldValue
=
fields2
[
objectKey
];
if
(
timeFields
.
indexOf
(
objectKey
)
!==
-
1
)
{
// 处理时间
res
=
{
...
res
,
...
buildTime
(
fieldValue
,
objectKey
),
};
}
else
if
(
fieldValue
!==
undefined
)
{
res
[
objectKey
]
=
fieldValue
;
}
return
true
;
});
return
res
;
};
const
searchParams
=
buildSearchParams
(
fields
);
if
(
handleSearch
)
{
handleSearch
(
searchParams
);
}
});
};
return
(
return
(
<
Form
onSubmit
=
{
handleSearch
}
layout
=
"inline"
>
<
Form
onSubmit
=
{
onSubmit
}
layout
=
"inline"
>
<
Row
gutter
=
{{
md
:
8
,
lg
:
24
,
xl
:
48
}}
>
<
Row
gutter
=
{{
md
:
8
,
lg
:
24
,
xl
:
48
}}
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
FormItem
label
=
"
规则名称
"
>
<
FormItem
label
=
"
订单id
"
>
{
getFieldDecorator
(
'
name'
)(
<
Input
placeholder
=
"请输入
"
/>
)}
{
getFieldDecorator
(
'
id'
)(
<
Input
placeholder
=
"请输入订单id
"
/>
)}
<
/FormItem
>
<
/FormItem
>
<
/Col
>
<
/Col
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
FormItem
label
=
"使用状态"
>
<
FormItem
label
=
"订单号"
>
{
getFieldDecorator
(
'status'
)(
{
getFieldDecorator
(
'orderNo'
)(
<
Input
placeholder
=
"请输入订单号"
/>
)}
<
Select
placeholder
=
"请选择"
style
=
{{
width
:
'100%'
}}
>
<
SelectOption
value
=
"0"
>
关闭
<
/SelectOption
>
<
SelectOption
value
=
"1"
>
运行中
<
/SelectOption
>
<
/Select
>
)}
<
/FormItem
>
<
/FormItem
>
<
/Col
>
<
/Col
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
FormItem
label
=
"状态"
>
{
getFieldDecorator
(
'status'
,
{})(
<
DictionarySelect
dicKey
=
{
dictionary
.
ORDER_STATUS
}
/>
)
}
<
/FormItem
>
<
/Col
>
<
/Row
>
<
Row
gutter
=
{{
md
:
8
,
lg
:
24
,
xl
:
48
}}
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
FormItem
label
=
"创建时间"
>
{
getFieldDecorator
(
'createTime'
)(
<
RangePicker
/>
)}
<
/FormItem
>
<
/Col
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
FormItem
label
=
"成交时间"
>
{
getFieldDecorator
(
'closingTime'
)(
<
RangePicker
/>
)}
<
/FormItem
>
<
/Col
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
Col
md
=
{
8
}
sm
=
{
24
}
>
<
span
className
=
{
styles
.
submitButtons
}
>
<
span
className
=
{
styles
.
submitButtons
}
>
<
Button
type
=
"primary"
htmlType
=
"submit"
>
<
Button
type
=
"primary"
htmlType
=
"submit"
>
...
@@ -171,43 +206,46 @@ const SearchForm = props => {
...
@@ -171,43 +206,46 @@ const SearchForm = props => {
};
};
@
connect
(({
orderList
,
loading
})
=>
({
@
connect
(({
orderList
,
loading
})
=>
({
list
:
orderList
.
list
,
orderList
,
orderList
,
list
:
orderList
.
list
,
loading
:
loading
.
models
.
orderList
,
loading
:
loading
.
models
.
orderList
,
}))
}))
@
Form
.
create
()
@
Form
.
create
()
class
BasicList
extends
PureComponent
{
class
BasicList
extends
PureComponent
{
state
=
{
current
:
{},
};
componentDidMount
()
{
componentDidMount
()
{
const
{
list
:
{
pagination
},
}
=
this
.
props
;
this
.
queryList
({
pageNo
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
,
});
}
queryList
=
params
=>
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
dispatch
({
dispatch
({
type
:
'orderList/queryPage'
,
type
:
'orderList/queryPage'
,
payload
:
{
payload
:
{
pageNo
:
0
,
...
params
,
pageSize
:
10
,
},
},
});
});
}
}
;
handleEditorClick
=
()
=>
{
handleEditorClick
=
()
=>
{
console
.
info
(
'edit'
);
console
.
info
(
'edit'
);
};
};
handleSubmit
=
e
=>
{
handleSearch
=
fields
=>
{
e
.
preventDefault
();
const
{
const
{
dispatch
,
form
}
=
this
.
props
;
list
:
{
pagination
},
const
{
current
}
=
this
.
state
;
}
=
this
.
props
;
const
id
=
current
?
current
.
id
:
''
;
form
.
validateFields
((
err
,
fieldsValue
)
=>
{
this
.
queryList
({
if
(
err
)
return
;
...
fields
,
dispatch
({
pageNo
:
pagination
.
current
,
type
:
'list/submit'
,
pageSize
:
pagination
.
pageSize
,
payload
:
{
id
,
...
fieldsValue
},
});
});
});
};
};
...
@@ -223,7 +261,7 @@ class BasicList extends PureComponent {
...
@@ -223,7 +261,7 @@ class BasicList extends PureComponent {
bodyStyle
=
{{
padding
:
'0 32px 40px 32px'
}}
bodyStyle
=
{{
padding
:
'0 32px 40px 32px'
}}
>
>
<
div
className
=
{
styles
.
tableListForm
}
>
<
div
className
=
{
styles
.
tableListForm
}
>
<
SearchForm
{...
this
.
props
}
/
>
<
SearchForm
{...
this
.
props
}
handleSearch
=
{
this
.
handleSearch
}
/
>
<
/div
>
<
/div
>
<
OrderList
{...
this
.
props
}
handleEditorClick
=
{
this
.
handleEditorClick
}
/
>
<
OrderList
{...
this
.
props
}
handleEditorClick
=
{
this
.
handleEditorClick
}
/
>
<
/Card
>
<
/Card
>
...
...
admin-web/src/pages/Order/WechatIMG1.png
0 → 100644
浏览文件 @
e2a19a1d
450.3 KB
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论