Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
e8975995
Commit
e8975995
authored
Oct 21, 2020
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接完毕评论相关
parent
058b3fd3
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1719 additions
and
19 deletions
+1719
-19
index.ts
config/routes/tranactionRoute/index.ts
+42
-0
menu.ts
src/locales/zh-CN/menu.ts
+7
-1
index.tsx
src/pages/transaction/purchaserEvaluation/analysis/index.tsx
+36
-3
index.tsx
...ction/purchaserEvaluation/components/RecordList/index.tsx
+40
-2
index.ts
...purchaserEvaluation/components/RecordList/schema/index.ts
+22
-1
index.tsx
...ion/purchaserEvaluation/received/detail/effects/index.tsx
+6
-0
useBusinessEffects.tsx
...Evaluation/received/detail/effects/useBusinessEffects.tsx
+39
-0
index.less
...ransaction/purchaserEvaluation/received/detail/index.less
+0
-0
index.tsx
...transaction/purchaserEvaluation/received/detail/index.tsx
+198
-0
index.ts
...ction/purchaserEvaluation/received/detail/schema/index.ts
+100
-0
index.tsx
...saction/purchaserEvaluation/sent/detail/effects/index.tsx
+6
-0
useBusinessEffects.tsx
...aserEvaluation/sent/detail/effects/useBusinessEffects.tsx
+39
-0
index.less
...es/transaction/purchaserEvaluation/sent/detail/index.less
+0
-0
index.tsx
...ges/transaction/purchaserEvaluation/sent/detail/index.tsx
+243
-0
index.ts
...ansaction/purchaserEvaluation/sent/detail/schema/index.ts
+100
-0
index.ts
.../purchaserEvaluation/unevaluated/evaluate/schema/index.ts
+4
-1
index.tsx
src/pages/transaction/supplierEvaluation/analysis/index.tsx
+36
-3
index.tsx
...action/supplierEvaluation/components/RecordList/index.tsx
+40
-2
index.ts
.../supplierEvaluation/components/RecordList/schema/index.ts
+23
-2
index.tsx
...tion/supplierEvaluation/received/detail/effects/index.tsx
+6
-0
useBusinessEffects.tsx
...Evaluation/received/detail/effects/useBusinessEffects.tsx
+39
-0
index.less
...transaction/supplierEvaluation/received/detail/index.less
+0
-0
index.tsx
.../transaction/supplierEvaluation/received/detail/index.tsx
+198
-0
index.ts
...action/supplierEvaluation/received/detail/schema/index.ts
+100
-0
index.tsx
...nsaction/supplierEvaluation/sent/detail/effects/index.tsx
+6
-0
useBusinessEffects.tsx
...lierEvaluation/sent/detail/effects/useBusinessEffects.tsx
+39
-0
index.less
...ges/transaction/supplierEvaluation/sent/detail/index.less
+0
-0
index.tsx
...ages/transaction/supplierEvaluation/sent/detail/index.tsx
+243
-0
index.ts
...ransaction/supplierEvaluation/sent/detail/schema/index.ts
+100
-0
index.tsx
...saction/supplierEvaluation/unevaluated/evaluate/index.tsx
+3
-3
index.ts
...n/supplierEvaluation/unevaluated/evaluate/schema/index.ts
+3
-0
index.tsx
...ages/transaction/supplierEvaluation/unevaluated/index.tsx
+1
-1
No files found.
config/routes/tranactionRoute/index.ts
View file @
e8975995
...
...
@@ -509,6 +509,27 @@ const TranactionRoute: RouterChild = {
name
:
'analysis'
,
component
:
'@/pages/transaction/supplierEvaluation/analysis'
,
},
// 收到的评价-详情
{
path
:
'/memberCenter/tranactionAbility/supplierEvaluation/received/detail'
,
name
:
'receivedDetail'
,
component
:
'@/pages/transaction/supplierEvaluation/received/detail/index'
,
hideInMenu
:
true
,
},
// 发出的评价-详情
{
path
:
'/memberCenter/tranactionAbility/supplierEvaluation/sent/detail'
,
name
:
'sentDetail'
,
component
:
'@/pages/transaction/supplierEvaluation/sent/detail/index'
,
hideInMenu
:
true
,
},
// 发出的评价-编辑
{
path
:
'/memberCenter/tranactionAbility/supplierEvaluation/sent/edit'
,
name
:
'editSent'
,
component
:
'@/pages/transaction/supplierEvaluation/sent/detail/index'
,
hideInMenu
:
true
,
},
// 收到的评价(UI合并到评价统计了,暂时不需要)
// {
// path: '/memberCenter/tranactionAbility/supplierEvaluation/received',
...
...
@@ -548,6 +569,27 @@ const TranactionRoute: RouterChild = {
name
:
'analysis'
,
component
:
'@/pages/transaction/purchaserEvaluation/analysis'
,
},
// 收到的评价-详情
{
path
:
'/memberCenter/tranactionAbility/purchaserEvaluation/received/detail'
,
name
:
'receivedDetail'
,
component
:
'@/pages/transaction/purchaserEvaluation/received/detail/index'
,
hideInMenu
:
true
,
},
// 发出的评价-详情
{
path
:
'/memberCenter/tranactionAbility/purchaserEvaluation/sent/detail'
,
name
:
'sentDetail'
,
component
:
'@/pages/transaction/purchaserEvaluation/sent/detail/index'
,
hideInMenu
:
true
,
},
// 发出的评价-编辑
{
path
:
'/memberCenter/tranactionAbility/purchaserEvaluation/sent/edit'
,
name
:
'editSent'
,
component
:
'@/pages/transaction/purchaserEvaluation/sent/detail/index'
,
hideInMenu
:
true
,
},
// 收到的评价(UI合并到评价统计了,暂时不需要)
// {
// path: '/memberCenter/tranactionAbility/purchaserEvaluation/received',
...
...
src/locales/zh-CN/menu.ts
View file @
e8975995
...
...
@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-13 14:08:50
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-2
0 19:48:5
9
* @LastEditTime: 2020-10-2
1 11:43:4
9
*/
export
default
{
...
...
@@ -282,6 +282,9 @@ export default {
'menu.tranactionAbility.supplierEvaluation.evaluate'
:
'评价'
,
'menu.tranactionAbility.supplierEvaluation.analysis'
:
'评价统计'
,
'menu.tranactionAbility.supplierEvaluation.received'
:
'收到的评价'
,
'menu.tranactionAbility.supplierEvaluation.receivedDetail'
:
'查看收到的评价'
,
'menu.tranactionAbility.supplierEvaluation.sentDetail'
:
'查看发出的评价'
,
'menu.tranactionAbility.supplierEvaluation.editSent'
:
'编辑发出的评价'
,
'menu.tranactionAbility.supplierEvaluation.sent'
:
'发出的评价'
,
// 采购商评价
...
...
@@ -290,6 +293,9 @@ export default {
'menu.tranactionAbility.purchaserEvaluation.evaluate'
:
'评价'
,
'menu.tranactionAbility.purchaserEvaluation.analysis'
:
'评价统计'
,
'menu.tranactionAbility.purchaserEvaluation.received'
:
'收到的评价'
,
'menu.tranactionAbility.purchaserEvaluation.receivedDetail'
:
'查看收到的评价'
,
'menu.tranactionAbility.purchaserEvaluation.sentDetail'
:
'查看发出的评价'
,
'menu.tranactionAbility.purchaserEvaluation.editSent'
:
'编辑发出的评价'
,
'menu.tranactionAbility.purchaserEvaluation.sent'
:
'发出的评价'
,
// 物流能力
...
...
src/pages/transaction/purchaserEvaluation/analysis/index.tsx
View file @
e8975995
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Tabs
,
Row
,
Col
,
Button
}
from
'antd'
;
import
{
history
}
from
'umi'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
isJSONStr
}
from
'@/utils'
;
...
...
@@ -169,6 +170,7 @@ const Analysis: React.FC = () => {
data
:
data
.
map
(
item
=>
{
const
product
=
isJSONStr
(
item
.
product
)
||
{};
return
{
id
:
item
.
id
,
star
:
item
.
star
,
comment
:
item
.
comment
,
productName
:
product
.
productName
||
''
,
...
...
@@ -176,6 +178,7 @@ const Analysis: React.FC = () => {
quantity
:
product
.
purchaseCount
,
created
:
item
.
createTime
,
target
:
item
.
byMemberName
,
orderId
:
product
.
orderId
,
};
}),
totalCount
,
...
...
@@ -200,6 +203,7 @@ const Analysis: React.FC = () => {
data
:
data
.
map
(
item
=>
{
const
product
=
isJSONStr
(
item
.
product
)
||
{};
return
{
id
:
item
.
id
,
star
:
item
.
star
,
comment
:
item
.
comment
,
productName
:
product
.
productName
||
''
,
...
...
@@ -207,6 +211,7 @@ const Analysis: React.FC = () => {
quantity
:
product
.
purchaseCount
,
created
:
item
.
dealTime
as
string
,
target
:
item
.
memberName
,
orderId
:
product
.
orderId
,
};
}),
totalCount
,
...
...
@@ -233,6 +238,7 @@ const Analysis: React.FC = () => {
data
:
data
.
map
(
item
=>
{
const
product
=
isJSONStr
(
item
.
product
)
||
{};
return
{
id
:
item
.
id
,
star
:
item
.
star
,
comment
:
item
.
comment
,
productName
:
product
.
productName
||
''
,
...
...
@@ -240,6 +246,7 @@ const Analysis: React.FC = () => {
quantity
:
product
.
purchaseCount
,
created
:
item
.
dealTime
as
string
,
target
:
item
.
subMemberName
,
orderId
:
product
.
orderId
,
};
}),
totalCount
,
...
...
@@ -284,6 +291,18 @@ const Analysis: React.FC = () => {
getTradeSummary
();
},
[]);
const
handleJumpReceived
=
record
=>
{
history
.
push
(
`/memberCenter/tranactionAbility/purchaserEvaluation/received/detail?orderId=
${
record
.
orderId
}
&id=
${
record
.
id
}
&preview=1`
);
};
const
handleEditSent
=
record
=>
{
history
.
push
(
`/memberCenter/tranactionAbility/purchaserEvaluation/sent/edit?orderId=
${
record
.
orderId
}
&id=
${
record
.
id
}
&preview=0`
);
};
const
handleJumpSent
=
record
=>
{
history
.
push
(
`/memberCenter/tranactionAbility/purchaserEvaluation/sent/detail?orderId=
${
record
.
orderId
}
&id=
${
record
.
id
}
&preview=1`
);
};
return
(
<
PageHeaderWrapper
>
<
MellowCard
...
...
@@ -324,16 +343,30 @@ const Analysis: React.FC = () => {
</
Shelves
>
<
Shelves
title=
"评价记录"
>
<
RecordList
fetchList=
{
getTradeHistory
}
paginationType=
"button"
searchable=
{
false
}
/>
<
RecordList
fetchList=
{
getTradeHistory
}
paginationType=
"button"
searchable=
{
false
}
onCheck=
{
handleJumpReceived
}
/>
</
Shelves
>
</
TabPane
>
<
TabPane
tab=
"收到的评价"
key=
"2"
>
<
RecordList
fetchList=
{
getReceivedList
}
/>
<
RecordList
fetchList=
{
getReceivedList
}
onCheck=
{
handleJumpReceived
}
/>
</
TabPane
>
<
TabPane
tab=
"发出的评价"
key=
"3"
>
<
RecordList
fetchList=
{
getSentList
}
/>
<
RecordList
fetchList=
{
getSentList
}
onCheck=
{
handleJumpSent
}
onEdit=
{
handleEditSent
}
opposite=
{
false
}
editable=
{
true
}
/>
</
TabPane
>
</
Tabs
>
</
MellowCard
>
...
...
src/pages/transaction/purchaserEvaluation/components/RecordList/index.tsx
View file @
e8975995
...
...
@@ -74,6 +74,10 @@ export interface RecordItem {
* 评价方/被评价方
*/
target
:
string
/**
* 订单id
*/
orderId
:
string
};
export
interface
RecordRes
{
...
...
@@ -91,7 +95,14 @@ interface RecordListProps {
// 是否是查看收到的品论
opposite
?:
boolean
;
// 是否可编辑的
editable
?:
boolean
;
fetchList
:
(
params
:
ListParams
)
=>
Promise
<
RecordRes
>
;
onCheck
:
(
record
:
RecordItem
)
=>
void
;
onEdit
?:
(
record
:
RecordItem
)
=>
void
;
};
interface
RecordListState
{
...
...
@@ -140,8 +151,12 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
this
.
setState
({
loading
:
true
});
return
new
Promise
((
resolve
,
reject
)
=>
{
const
{
searchVal
,
page
,
size
}
=
this
.
state
;
const
{
dealTimeStart
,
dealTimeEnd
}
=
searchVal
;
fetchList
({
...
searchVal
,
dealTimeStart
:
dealTimeStart
?
moment
(
+
dealTimeStart
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
null
,
dealTimeEnd
:
dealTimeEnd
?
moment
(
+
dealTimeEnd
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
null
,
current
:
`
${
page
}
`
,
pageSize
:
`
${
size
}
`
,
}).
then
(
res
=>
{
...
...
@@ -210,11 +225,26 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
});
};
handleCheck
=
record
=>
{
const
{
onCheck
}
=
this
.
props
;
if
(
onCheck
)
{
onCheck
(
record
);
}
};
handleEdit
=
record
=>
{
const
{
onEdit
}
=
this
.
props
;
if
(
onEdit
)
{
onEdit
(
record
);
}
};
render
()
{
const
{
paginationType
=
'pagination'
,
searchable
=
true
,
opposite
=
true
,
editable
=
false
,
}
=
this
.
props
;
const
{
page
,
size
,
loading
,
receivedList
,
hasMore
}
=
this
.
state
;
...
...
@@ -232,7 +262,12 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
)
}
<
Spin
spinning=
{
paginationType
===
'pagination'
&&
loading
}
>
<
ul
className=
{
styles
.
record
}
>
<
ul
className=
{
styles
.
record
}
style=
{
{
minHeight
:
loading
?
69
:
'auto'
,
}
}
>
{
receivedList
.
data
.
map
((
item
,
index
)
=>
(
<
li
className=
{
styles
[
'record-item'
]
}
key=
{
index
}
>
<
div
className=
{
styles
[
'record-item-good'
]
}
>
...
...
@@ -272,7 +307,10 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
</
div
>
<
div
className=
{
styles
[
'record-item-actions'
]
}
>
<
Button
type=
"link"
>
查看
</
Button
>
{
editable
&&
(
<
Button
type=
"link"
onClick=
{
()
=>
this
.
handleEdit
(
item
)
}
>
编辑
</
Button
>
)
}
<
Button
type=
"link"
onClick=
{
()
=>
this
.
handleCheck
(
item
)
}
>
查看
</
Button
>
</
div
>
</
li
>
))
}
...
...
src/pages/transaction/purchaserEvaluation/components/RecordList/schema/index.ts
View file @
e8975995
...
...
@@ -19,7 +19,28 @@ export const searchSchema: ISchema = {
properties
:
{
star
:
{
type
:
'string'
,
enum
:
[],
enum
:
[
{
label
:
'一星'
,
value
:
1
,
},
{
label
:
'二星'
,
value
:
2
,
},
{
label
:
'三星'
,
value
:
3
,
},
{
label
:
'四星'
,
value
:
4
,
},
{
label
:
'五星'
,
value
:
5
,
},
],
'x-component-props'
:
{
placeholder
:
'评论星级'
,
allowClear
:
true
,
...
...
src/pages/transaction/purchaserEvaluation/received/detail/effects/index.tsx
0 → 100644
View file @
e8975995
import
{
useBusinessEffects
}
from
'./useBusinessEffects'
;
export
const
createEffects
=
(
context
,
actions
)
=>
{
useBusinessEffects
(
context
,
actions
);
};
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/received/detail/effects/useBusinessEffects.tsx
0 → 100644
View file @
e8975995
import
{
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
const
{
onFieldInputChange$
,
onFieldValueChange$
,
}
=
FormEffectHooks
;
export
const
useBusinessEffects
=
(
context
,
actions
)
=>
{
const
{
setFieldState
,
}
=
actions
;
// 评论图片限制 4 张
onFieldInputChange$
(
'comments.*.picture'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.picture`
}),
state
=>
{
state
.
props
[
'x-component-props'
].
disabled
=
value
.
length
>=
4
;
}
);
});
// 评分联动
onFieldInputChange$
(
'comments.*.star'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.smile`
}),
state
=>
{
state
.
value
=
value
;
}
);
});
}
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/received/detail/index.less
0 → 100644
View file @
e8975995
src/pages/transaction/purchaserEvaluation/received/detail/index.tsx
0 → 100644
View file @
e8975995
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
PageHeader
,
Descriptions
,
Card
,
Spin
,
Button
,
message
,
}
from
'antd'
;
import
{
FormOutlined
}
from
'@ant-design/icons'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
history
}
from
'umi'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetOrderPurchaseOrderDetailsResponse
}
from
'@/services/OrderApi'
;
import
{
normalizeFiledata
,
isJSONStr
}
from
'@/utils'
;
import
AvatarWrap
from
'@/components/AvatarWrap'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
normalizeUnevaluatedList
}
from
'../../utils'
;
import
{
evaluateSchema
}
from
'./schema'
;
import
{
createEffects
}
from
'./effects'
;
import
EvaluationList
from
'../../components/EvaluationList'
;
import
styles
from
'./index.less'
;
const
formActions
=
createFormActions
();
interface
Unevaluated
{
good
:
{
pic
:
string
,
productName
:
string
,
price
:
string
,
purchaseCount
:
string
,
};
star
:
number
;
comment
:
string
;
picture
:
string
[];
smile
:
number
;
};
const
ReceivedDetail
:
React
.
FC
=
()
=>
{
const
{
orderId
,
id
,
pageStatus
}
=
usePageStatus
();
const
[
orderInfo
,
setOrderInfo
]
=
useState
<
GetOrderPurchaseOrderDetailsResponse
>
(
null
);
const
[
orderInfoLoading
,
setOrderInfoLoading
]
=
useState
(
false
);
const
[
evaluationInfo
,
setEvaluationInfo
]
=
useState
<
Unevaluated
>
(
null
);
const
[
evaluationInfoLoading
,
setEvaluationInfoLoading
]
=
useState
(
false
);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
getOrderInfo
=
()
=>
{
if
(
!
orderId
)
{
return
;
}
setOrderInfoLoading
(
true
);
PublicApi
.
getOrderProcurementOrderDetails
({
id
:
orderId
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setOrderInfo
(
res
.
data
);
}
}).
finally
(()
=>
{
setOrderInfoLoading
(
false
);
});
};
const
getEvaluationInfo
=
()
=>
{
if
(
!
id
)
{
return
;
}
setEvaluationInfoLoading
(
true
);
PublicApi
.
getMemberCommentConsumerReceiveTradeHistoryGet
({
id
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
product
}
=
res
.
data
;
const
productObj
=
isJSONStr
(
product
)
||
{};
setEvaluationInfo
({
good
:
{
pic
:
productObj
.
pic
,
productName
:
productObj
.
productName
,
price
:
productObj
.
price
,
purchaseCount
:
productObj
.
purchaseCount
,
},
star
:
res
.
data
.
star
,
comment
:
res
.
data
.
comment
,
picture
:
res
.
data
.
pics
?
res
.
data
.
pics
.
map
(
item
=>
normalizeFiledata
(
item
))
:
[],
smile
:
res
.
data
.
star
,
});
}
}).
finally
(()
=>
{
setEvaluationInfoLoading
(
false
);
});
};
useEffect
(()
=>
{
getOrderInfo
();
getEvaluationInfo
();
},
[]);
const
handleSubmit
=
values
=>
{
};
const
beforeUpload
=
file
=>
{
if
(
file
.
size
/
1024
<
10
)
{
message
.
warning
(
'图片大小超过10M'
);
return
Promise
.
reject
();
}
};
const
UploadTip
=
(
<
span
style=
{
{
lineHeight
:
'24px'
,
color
:
'#909399'
,
fontWeight
:
400
,
wordBreak
:
'break-all'
,
position
:
'relative'
,
top
:
'34px'
,
}
}
>
支持JPG/PNG/JPEG
<
br
/>
每张最大不超过 10M,尺寸不限
<
br
/>
最大数量限制 4张
</
span
>
);
return
(
<
Spin
spinning=
{
orderInfoLoading
||
evaluationInfoLoading
}
>
<
PageHeaderWrapper
title=
{
<>
<
PageHeader
style=
{
{
padding
:
'0'
}
}
onBack=
{
()
=>
history
.
goBack
()
}
title=
{
<
AvatarWrap
info=
{
{
aloneTxt
:
'单'
,
name
:
orderInfo
?.
orderNo
,
}
}
/>
}
extra=
{
(
<>
{
pageStatus
===
PageStatus
.
EDIT
&&
(
<
Button
type=
"primary"
icon=
{
<
FormOutlined
/>
}
loading=
{
submitLoading
}
onClick=
{
()
=>
formActions
.
submit
()
}
>
修改
</
Button
>
)
}
</>
)
}
>
<
Descriptions
size=
"small"
column=
{
3
}
style=
{
{
padding
:
'0 32px'
,
}
}
>
<
Descriptions
.
Item
label=
"供应会员"
>
{
orderInfo
?.
supplyMembersName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"下单时间"
span=
{
2
}
>
{
orderInfo
?.
createTime
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
PageHeader
>
</>
}
>
<
NiceForm
actions=
{
formActions
}
initialValues=
{
{
comments
:
[
evaluationInfo
],
}
}
editable=
{
pageStatus
===
PageStatus
.
EDIT
}
expressionScope=
{
{
UploadTip
:
pageStatus
===
PageStatus
.
EDIT
?
UploadTip
:
null
,
beforeUpload
,
}
}
onSubmit=
{
handleSubmit
}
components=
{
{
EvaluationList
,
}
}
effects=
{
(
$
,
actions
)
=>
{
createEffects
(
$
,
actions
);
}
}
schema=
{
evaluateSchema
}
/>
</
PageHeaderWrapper
>
</
Spin
>
);
};
export
default
ReceivedDetail
;
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/received/detail/schema/index.ts
0 → 100644
View file @
e8975995
/*
* @Author: XieZhiXiong
* @Date: 2020-09-23 17:00:24
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-21 13:47:51
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
;
export
const
evaluateSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
comments
:
{
type
:
'array'
,
'x-component'
:
'EvaluationList'
,
default
:
[],
items
:
{
type
:
'object'
,
properties
:
{
LEFT_RIGHT
:
{
type
:
'object'
,
'x-component'
:
'LeftRightLayout'
,
'x-component-props'
:
{
rightProps
:
{
span
:
2
,
offset
:
4
,
},
},
properties
:
{
MEGA_LADYOUT
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
labelCol
:
6
,
labelAlign
:
'left'
,
position
:
'left'
,
},
properties
:
{
star
:
{
title
:
'满意程度'
,
required
:
true
,
'x-component'
:
'Rating'
,
'x-component-props'
:
{
allowHalf
:
false
,
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请选择满意程度'
,
},
],
},
comment
:
{
type
:
'string'
,
title
:
'评价'
,
'x-component'
:
'TextArea'
,
'x-component-props'
:
{
rows
:
4
,
},
'x-rules'
:
{
max
:
200
,
},
},
picture
:
{
type
:
'string'
,
title
:
'图片'
,
'x-component'
:
'Upload'
,
'x-component-props'
:
{
listType
:
'card'
,
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
'/purchaserEvaluation/'
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.png, .jpg, .jpeg'
,
},
'x-mega-props'
:
{
addonAfter
:
'{{UploadTip}}'
,
},
},
},
},
smile
:
{
type
:
'object'
,
default
:
1
,
'x-component'
:
'SmilingFace'
,
'x-component-props'
:
{
position
:
'right'
,
},
},
},
},
},
},
},
},
};
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/sent/detail/effects/index.tsx
0 → 100644
View file @
e8975995
import
{
useBusinessEffects
}
from
'./useBusinessEffects'
;
export
const
createEffects
=
(
context
,
actions
)
=>
{
useBusinessEffects
(
context
,
actions
);
};
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/sent/detail/effects/useBusinessEffects.tsx
0 → 100644
View file @
e8975995
import
{
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
const
{
onFieldInputChange$
,
onFieldValueChange$
,
}
=
FormEffectHooks
;
export
const
useBusinessEffects
=
(
context
,
actions
)
=>
{
const
{
setFieldState
,
}
=
actions
;
// 评论图片限制 4 张
onFieldInputChange$
(
'comments.*.picture'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.picture`
}),
state
=>
{
state
.
props
[
'x-component-props'
].
disabled
=
value
.
length
>=
4
;
}
);
});
// 评分联动
onFieldInputChange$
(
'comments.*.star'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.smile`
}),
state
=>
{
state
.
value
=
value
;
}
);
});
}
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/sent/detail/index.less
0 → 100644
View file @
e8975995
src/pages/transaction/purchaserEvaluation/sent/detail/index.tsx
0 → 100644
View file @
e8975995
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
PageHeader
,
Descriptions
,
Card
,
Spin
,
Button
,
message
,
}
from
'antd'
;
import
{
FormOutlined
}
from
'@ant-design/icons'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
history
}
from
'umi'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetOrderPurchaseOrderDetailsResponse
}
from
'@/services/OrderApi'
;
import
{
normalizeFiledata
,
isJSONStr
}
from
'@/utils'
;
import
AvatarWrap
from
'@/components/AvatarWrap'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
normalizeUnevaluatedList
}
from
'../../utils'
;
import
{
evaluateSchema
}
from
'./schema'
;
import
{
createEffects
}
from
'./effects'
;
import
EvaluationList
from
'../../components/EvaluationList'
;
import
styles
from
'./index.less'
;
const
formActions
=
createFormActions
();
const
{
onFormInit$
,
}
=
FormEffectHooks
;
interface
Unevaluated
{
good
:
{
pic
:
string
,
productName
:
string
,
price
:
string
,
purchaseCount
:
string
,
};
star
:
number
;
comment
:
string
;
picture
:
string
[];
smile
:
number
;
};
const
SentDetail
:
React
.
FC
=
()
=>
{
const
{
orderId
,
id
,
pageStatus
}
=
usePageStatus
();
const
[
orderInfo
,
setOrderInfo
]
=
useState
<
GetOrderPurchaseOrderDetailsResponse
>
(
null
);
const
[
orderInfoLoading
,
setOrderInfoLoading
]
=
useState
(
false
);
const
[
evaluationInfo
,
setEvaluationInfo
]
=
useState
<
Unevaluated
>
(
null
);
const
[
evaluationInfoLoading
,
setEvaluationInfoLoading
]
=
useState
(
false
);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
getOrderInfo
=
()
=>
{
if
(
!
orderId
)
{
return
;
}
setOrderInfoLoading
(
true
);
PublicApi
.
getOrderProcurementOrderDetails
({
id
:
orderId
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setOrderInfo
(
res
.
data
);
}
}).
finally
(()
=>
{
setOrderInfoLoading
(
false
);
});
};
const
getEvaluationInfo
=
()
=>
{
if
(
!
id
)
{
return
;
}
setEvaluationInfoLoading
(
true
);
PublicApi
.
getMemberCommentConsumerSendTradeHistoryGet
({
id
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
product
}
=
res
.
data
;
const
productObj
=
isJSONStr
(
product
)
||
{};
setEvaluationInfo
({
good
:
{
pic
:
productObj
.
pic
,
productName
:
productObj
.
productName
,
price
:
productObj
.
price
,
purchaseCount
:
productObj
.
purchaseCount
,
},
star
:
res
.
data
.
star
,
comment
:
res
.
data
.
comment
,
picture
:
res
.
data
.
pics
?
res
.
data
.
pics
.
map
(
item
=>
normalizeFiledata
(
item
))
:
[],
smile
:
res
.
data
.
star
,
});
}
}).
finally
(()
=>
{
setEvaluationInfoLoading
(
false
);
});
};
useEffect
(()
=>
{
getOrderInfo
();
getEvaluationInfo
();
},
[]);
const
handleSubmit
=
values
=>
{
setSubmitLoading
(
true
);
const
payload
=
values
.
comments
.
map
(
item
=>
{
const
{
comment
,
good
,
picture
,
star
,
}
=
item
;
return
{
id
,
star
,
comment
,
};
});
if
(
!
payload
.
length
)
{
return
;
}
PublicApi
.
postMemberCommentConsumerSendTradeHistoryUpdate
(
payload
[
0
])
.
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTimeout
(()
=>
{
history
.
goBack
();
},
800
);
}
})
.
finally
(()
=>
{
setSubmitLoading
(
false
);
});
};
const
beforeUpload
=
file
=>
{
if
(
file
.
size
/
1024
<
10
)
{
message
.
warning
(
'图片大小超过10M'
);
return
Promise
.
reject
();
}
};
const
UploadTip
=
(
<
span
style=
{
{
lineHeight
:
'24px'
,
color
:
'#909399'
,
fontWeight
:
400
,
wordBreak
:
'break-all'
,
position
:
'relative'
,
top
:
'34px'
,
}
}
>
支持JPG/PNG/JPEG
<
br
/>
每张最大不超过 10M,尺寸不限
<
br
/>
最大数量限制 4张
</
span
>
);
return
(
<
Spin
spinning=
{
orderInfoLoading
||
evaluationInfoLoading
}
>
<
PageHeaderWrapper
title=
{
<>
<
PageHeader
style=
{
{
padding
:
'0'
}
}
onBack=
{
()
=>
history
.
goBack
()
}
title=
{
<
AvatarWrap
info=
{
{
aloneTxt
:
'单'
,
name
:
orderInfo
?.
orderNo
,
}
}
/>
}
extra=
{
(
<>
{
pageStatus
===
PageStatus
.
EDIT
&&
(
<
Button
type=
"primary"
icon=
{
<
FormOutlined
/>
}
disabled=
{
!
id
}
loading=
{
submitLoading
}
onClick=
{
()
=>
formActions
.
submit
()
}
>
修改
</
Button
>
)
}
</>
)
}
>
<
Descriptions
size=
"small"
column=
{
3
}
style=
{
{
padding
:
'0 32px'
,
}
}
>
<
Descriptions
.
Item
label=
"供应会员"
>
{
orderInfo
?.
supplyMembersName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"下单时间"
span=
{
2
}
>
{
orderInfo
?.
createTime
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
PageHeader
>
</>
}
>
<
NiceForm
actions=
{
formActions
}
initialValues=
{
{
comments
:
[
evaluationInfo
],
}
}
editable=
{
pageStatus
===
PageStatus
.
EDIT
}
expressionScope=
{
{
UploadTip
:
pageStatus
===
PageStatus
.
EDIT
?
UploadTip
:
null
,
beforeUpload
,
}
}
onSubmit=
{
handleSubmit
}
components=
{
{
EvaluationList
,
}
}
effects=
{
(
$
,
actions
)
=>
{
createEffects
(
$
,
actions
);
onFormInit$
().
subscribe
(()
=>
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
actions
.
setFieldState
(
'comments.*.picture'
,
state
=>
{
state
.
visible
=
false
;
}
);
}
});
}
}
schema=
{
evaluateSchema
}
/>
</
PageHeaderWrapper
>
</
Spin
>
);
};
export
default
SentDetail
;
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/sent/detail/schema/index.ts
0 → 100644
View file @
e8975995
/*
* @Author: XieZhiXiong
* @Date: 2020-09-23 17:00:24
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-19 16:23:24
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
;
export
const
evaluateSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
comments
:
{
type
:
'array'
,
'x-component'
:
'EvaluationList'
,
default
:
[],
items
:
{
type
:
'object'
,
properties
:
{
LEFT_RIGHT
:
{
type
:
'object'
,
'x-component'
:
'LeftRightLayout'
,
'x-component-props'
:
{
rightProps
:
{
span
:
2
,
offset
:
4
,
},
},
properties
:
{
MEGA_LADYOUT
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
labelCol
:
6
,
labelAlign
:
'left'
,
position
:
'left'
,
},
properties
:
{
star
:
{
title
:
'满意程度'
,
required
:
true
,
'x-component'
:
'Rating'
,
'x-component-props'
:
{
allowHalf
:
false
,
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请选择满意程度'
,
},
],
},
comment
:
{
type
:
'string'
,
title
:
'评价'
,
'x-component'
:
'TextArea'
,
'x-component-props'
:
{
rows
:
4
,
},
'x-rules'
:
{
max
:
200
,
},
},
picture
:
{
type
:
'string'
,
title
:
'图片'
,
'x-component'
:
'Upload'
,
'x-component-props'
:
{
listType
:
'card'
,
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
'/purchaserEvaluation/'
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.png, .jpg, .jpeg'
,
},
'x-mega-props'
:
{
addonAfter
:
'{{UploadTip}}'
,
},
},
},
},
smile
:
{
type
:
'object'
,
default
:
1
,
'x-component'
:
'SmilingFace'
,
'x-component-props'
:
{
position
:
'right'
,
},
},
},
},
},
},
},
},
};
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/unevaluated/evaluate/schema/index.ts
View file @
e8975995
...
...
@@ -58,6 +58,9 @@ export const evaluateSchema: ISchema = {
'x-component-props'
:
{
rows
:
4
,
},
'x-rules'
:
{
max
:
200
,
},
},
picture
:
{
type
:
'string'
,
...
...
@@ -68,7 +71,7 @@ export const evaluateSchema: ISchema = {
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
'/
suppli
erEvaluation/'
,
prefix
:
'/
purchas
erEvaluation/'
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.png, .jpg, .jpeg'
,
...
...
src/pages/transaction/supplierEvaluation/analysis/index.tsx
View file @
e8975995
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Tabs
,
Row
,
Col
,
Button
}
from
'antd'
;
import
{
history
}
from
'umi'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
isJSONStr
}
from
'@/utils'
;
...
...
@@ -169,6 +170,7 @@ const Analysis: React.FC = () => {
data
:
data
.
map
(
item
=>
{
const
product
=
isJSONStr
(
item
.
product
)
||
{};
return
{
id
:
item
.
id
,
star
:
item
.
star
,
comment
:
item
.
comment
,
productName
:
product
.
productName
||
''
,
...
...
@@ -176,6 +178,7 @@ const Analysis: React.FC = () => {
quantity
:
product
.
purchaseCount
,
created
:
item
.
createTime
,
target
:
item
.
byMemberName
,
orderId
:
product
.
orderId
,
};
}),
totalCount
,
...
...
@@ -200,6 +203,7 @@ const Analysis: React.FC = () => {
data
:
data
.
map
(
item
=>
{
const
product
=
isJSONStr
(
item
.
product
)
||
{};
return
{
id
:
item
.
id
,
star
:
item
.
star
,
comment
:
item
.
comment
,
productName
:
product
.
productName
||
''
,
...
...
@@ -207,6 +211,7 @@ const Analysis: React.FC = () => {
quantity
:
product
.
purchaseCount
,
created
:
item
.
dealTime
as
string
,
target
:
item
.
memberName
,
orderId
:
product
.
orderId
,
};
}),
totalCount
,
...
...
@@ -233,6 +238,7 @@ const Analysis: React.FC = () => {
data
:
data
.
map
(
item
=>
{
const
product
=
isJSONStr
(
item
.
product
)
||
{};
return
{
id
:
item
.
id
,
star
:
item
.
star
,
comment
:
item
.
comment
,
productName
:
product
.
productName
||
''
,
...
...
@@ -240,6 +246,7 @@ const Analysis: React.FC = () => {
quantity
:
product
.
purchaseCount
,
created
:
item
.
dealTime
as
string
,
target
:
item
.
subMemberName
,
orderId
:
product
.
orderId
,
};
}),
totalCount
,
...
...
@@ -284,6 +291,18 @@ const Analysis: React.FC = () => {
getTradeSummary
();
},
[]);
const
handleJumpReceived
=
record
=>
{
history
.
push
(
`/memberCenter/tranactionAbility/supplierEvaluation/received/detail?orderId=
${
record
.
orderId
}
&id=
${
record
.
id
}
&preview=1`
);
};
const
handleEditSent
=
record
=>
{
history
.
push
(
`/memberCenter/tranactionAbility/supplierEvaluation/sent/edit?orderId=
${
record
.
orderId
}
&id=
${
record
.
id
}
&preview=0`
);
};
const
handleJumpSent
=
record
=>
{
history
.
push
(
`/memberCenter/tranactionAbility/supplierEvaluation/sent/detail?orderId=
${
record
.
orderId
}
&id=
${
record
.
id
}
&preview=1`
);
};
return
(
<
PageHeaderWrapper
>
<
MellowCard
...
...
@@ -324,16 +343,30 @@ const Analysis: React.FC = () => {
</
Shelves
>
<
Shelves
title=
"评价记录"
>
<
RecordList
fetchList=
{
getTradeHistory
}
paginationType=
"button"
searchable=
{
false
}
/>
<
RecordList
fetchList=
{
getTradeHistory
}
paginationType=
"button"
searchable=
{
false
}
onCheck=
{
handleJumpReceived
}
/>
</
Shelves
>
</
TabPane
>
<
TabPane
tab=
"收到的评价"
key=
"2"
>
<
RecordList
fetchList=
{
getReceivedList
}
/>
<
RecordList
fetchList=
{
getReceivedList
}
onCheck=
{
handleJumpReceived
}
/>
</
TabPane
>
<
TabPane
tab=
"发出的评价"
key=
"3"
>
<
RecordList
fetchList=
{
getSentList
}
/>
<
RecordList
fetchList=
{
getSentList
}
onCheck=
{
handleJumpSent
}
onEdit=
{
handleEditSent
}
opposite=
{
false
}
editable=
{
true
}
/>
</
TabPane
>
</
Tabs
>
</
MellowCard
>
...
...
src/pages/transaction/supplierEvaluation/components/RecordList/index.tsx
View file @
e8975995
...
...
@@ -74,6 +74,10 @@ export interface RecordItem {
* 评价方/被评价方
*/
target
:
string
/**
* 订单id
*/
orderId
:
string
};
export
interface
RecordRes
{
...
...
@@ -91,7 +95,14 @@ interface RecordListProps {
// 是否是查看收到的品论
opposite
?:
boolean
;
// 是否可编辑的
editable
?:
boolean
;
fetchList
:
(
params
:
ListParams
)
=>
Promise
<
RecordRes
>
;
onCheck
:
(
record
:
RecordItem
)
=>
void
;
onEdit
?:
(
record
:
RecordItem
)
=>
void
;
};
interface
RecordListState
{
...
...
@@ -140,8 +151,12 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
this
.
setState
({
loading
:
true
});
return
new
Promise
((
resolve
,
reject
)
=>
{
const
{
searchVal
,
page
,
size
}
=
this
.
state
;
const
{
dealTimeStart
,
dealTimeEnd
}
=
searchVal
;
fetchList
({
...
searchVal
,
dealTimeStart
:
dealTimeStart
?
moment
(
+
dealTimeStart
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
null
,
dealTimeEnd
:
dealTimeEnd
?
moment
(
+
dealTimeEnd
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
null
,
current
:
`
${
page
}
`
,
pageSize
:
`
${
size
}
`
,
}).
then
(
res
=>
{
...
...
@@ -210,11 +225,26 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
});
};
handleCheck
=
record
=>
{
const
{
onCheck
}
=
this
.
props
;
if
(
onCheck
)
{
onCheck
(
record
);
}
};
handleEdit
=
record
=>
{
const
{
onEdit
}
=
this
.
props
;
if
(
onEdit
)
{
onEdit
(
record
);
}
};
render
()
{
const
{
paginationType
=
'pagination'
,
searchable
=
true
,
opposite
=
true
,
editable
=
false
,
}
=
this
.
props
;
const
{
page
,
size
,
loading
,
receivedList
,
hasMore
}
=
this
.
state
;
...
...
@@ -232,7 +262,12 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
)
}
<
Spin
spinning=
{
paginationType
===
'pagination'
&&
loading
}
>
<
ul
className=
{
styles
.
record
}
>
<
ul
className=
{
styles
.
record
}
style=
{
{
minHeight
:
loading
?
69
:
'auto'
,
}
}
>
{
receivedList
.
data
.
map
((
item
,
index
)
=>
(
<
li
className=
{
styles
[
'record-item'
]
}
key=
{
index
}
>
<
div
className=
{
styles
[
'record-item-good'
]
}
>
...
...
@@ -272,7 +307,10 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
</
div
>
<
div
className=
{
styles
[
'record-item-actions'
]
}
>
<
Button
type=
"link"
>
查看
</
Button
>
{
editable
&&
(
<
Button
type=
"link"
onClick=
{
()
=>
this
.
handleEdit
(
item
)
}
>
编辑
</
Button
>
)
}
<
Button
type=
"link"
onClick=
{
()
=>
this
.
handleCheck
(
item
)
}
>
查看
</
Button
>
</
div
>
</
li
>
))
}
...
...
src/pages/transaction/supplierEvaluation/components/RecordList/schema/index.ts
View file @
e8975995
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-10-19 18:08:51
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-
19 18:09:31
* @LastEditTime: 2020-10-
21 13:58:50
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
...
...
@@ -19,7 +19,28 @@ export const searchSchema: ISchema = {
properties
:
{
star
:
{
type
:
'string'
,
enum
:
[],
enum
:
[
{
label
:
'一星'
,
value
:
1
,
},
{
label
:
'二星'
,
value
:
2
,
},
{
label
:
'三星'
,
value
:
3
,
},
{
label
:
'四星'
,
value
:
4
,
},
{
label
:
'五星'
,
value
:
5
,
},
],
'x-component-props'
:
{
placeholder
:
'评论星级'
,
allowClear
:
true
,
...
...
src/pages/transaction/supplierEvaluation/received/detail/effects/index.tsx
0 → 100644
View file @
e8975995
import
{
useBusinessEffects
}
from
'./useBusinessEffects'
;
export
const
createEffects
=
(
context
,
actions
)
=>
{
useBusinessEffects
(
context
,
actions
);
};
\ No newline at end of file
src/pages/transaction/supplierEvaluation/received/detail/effects/useBusinessEffects.tsx
0 → 100644
View file @
e8975995
import
{
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
const
{
onFieldInputChange$
,
onFieldValueChange$
,
}
=
FormEffectHooks
;
export
const
useBusinessEffects
=
(
context
,
actions
)
=>
{
const
{
setFieldState
,
}
=
actions
;
// 评论图片限制 4 张
onFieldInputChange$
(
'comments.*.picture'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.picture`
}),
state
=>
{
state
.
props
[
'x-component-props'
].
disabled
=
value
.
length
>=
4
;
}
);
});
// 评分联动
onFieldInputChange$
(
'comments.*.star'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.smile`
}),
state
=>
{
state
.
value
=
value
;
}
);
});
}
\ No newline at end of file
src/pages/transaction/supplierEvaluation/received/detail/index.less
0 → 100644
View file @
e8975995
src/pages/transaction/supplierEvaluation/received/detail/index.tsx
0 → 100644
View file @
e8975995
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
PageHeader
,
Descriptions
,
Card
,
Spin
,
Button
,
message
,
}
from
'antd'
;
import
{
FormOutlined
}
from
'@ant-design/icons'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
history
}
from
'umi'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetOrderPurchaseOrderDetailsResponse
}
from
'@/services/OrderApi'
;
import
{
normalizeFiledata
,
isJSONStr
}
from
'@/utils'
;
import
AvatarWrap
from
'@/components/AvatarWrap'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
normalizeUnevaluatedList
}
from
'../../utils'
;
import
{
evaluateSchema
}
from
'./schema'
;
import
{
createEffects
}
from
'./effects'
;
import
EvaluationList
from
'../../components/EvaluationList'
;
import
styles
from
'./index.less'
;
const
formActions
=
createFormActions
();
interface
Unevaluated
{
good
:
{
pic
:
string
,
productName
:
string
,
price
:
string
,
purchaseCount
:
string
,
};
star
:
number
;
comment
:
string
;
picture
:
string
[];
smile
:
number
;
};
const
ReceivedDetail
:
React
.
FC
=
()
=>
{
const
{
orderId
,
id
,
pageStatus
}
=
usePageStatus
();
const
[
orderInfo
,
setOrderInfo
]
=
useState
<
GetOrderPurchaseOrderDetailsResponse
>
(
null
);
const
[
orderInfoLoading
,
setOrderInfoLoading
]
=
useState
(
false
);
const
[
evaluationInfo
,
setEvaluationInfo
]
=
useState
<
Unevaluated
>
(
null
);
const
[
evaluationInfoLoading
,
setEvaluationInfoLoading
]
=
useState
(
false
);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
getOrderInfo
=
()
=>
{
if
(
!
orderId
)
{
return
;
}
setOrderInfoLoading
(
true
);
PublicApi
.
getOrderPurchaseOrderDetails
({
id
:
orderId
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setOrderInfo
(
res
.
data
);
}
}).
finally
(()
=>
{
setOrderInfoLoading
(
false
);
});
};
const
getEvaluationInfo
=
()
=>
{
if
(
!
id
)
{
return
;
}
setEvaluationInfoLoading
(
true
);
PublicApi
.
getMemberCommentSupplySupplyTradeHistoryGet
({
id
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
product
}
=
res
.
data
;
const
productObj
=
isJSONStr
(
product
)
||
{};
setEvaluationInfo
({
good
:
{
pic
:
productObj
.
pic
,
productName
:
productObj
.
productName
,
price
:
productObj
.
price
,
purchaseCount
:
productObj
.
purchaseCount
,
},
star
:
res
.
data
.
star
,
comment
:
res
.
data
.
comment
,
picture
:
res
.
data
.
pics
?
res
.
data
.
pics
.
map
(
item
=>
normalizeFiledata
(
item
))
:
[],
smile
:
res
.
data
.
star
,
});
}
}).
finally
(()
=>
{
setEvaluationInfoLoading
(
false
);
});
};
useEffect
(()
=>
{
getOrderInfo
();
getEvaluationInfo
();
},
[]);
const
handleSubmit
=
values
=>
{
};
const
beforeUpload
=
file
=>
{
if
(
file
.
size
/
1024
<
10
)
{
message
.
warning
(
'图片大小超过10M'
);
return
Promise
.
reject
();
}
};
const
UploadTip
=
(
<
span
style=
{
{
lineHeight
:
'24px'
,
color
:
'#909399'
,
fontWeight
:
400
,
wordBreak
:
'break-all'
,
position
:
'relative'
,
top
:
'34px'
,
}
}
>
支持JPG/PNG/JPEG
<
br
/>
每张最大不超过 10M,尺寸不限
<
br
/>
最大数量限制 4张
</
span
>
);
return
(
<
Spin
spinning=
{
orderInfoLoading
||
evaluationInfoLoading
}
>
<
PageHeaderWrapper
title=
{
<>
<
PageHeader
style=
{
{
padding
:
'0'
}
}
onBack=
{
()
=>
history
.
goBack
()
}
title=
{
<
AvatarWrap
info=
{
{
aloneTxt
:
'单'
,
name
:
orderInfo
?.
orderNo
,
}
}
/>
}
extra=
{
(
<>
{
pageStatus
===
PageStatus
.
EDIT
&&
(
<
Button
type=
"primary"
icon=
{
<
FormOutlined
/>
}
loading=
{
submitLoading
}
onClick=
{
()
=>
formActions
.
submit
()
}
>
修改
</
Button
>
)
}
</>
)
}
>
<
Descriptions
size=
"small"
column=
{
3
}
style=
{
{
padding
:
'0 32px'
,
}
}
>
<
Descriptions
.
Item
label=
"采购会员"
>
{
orderInfo
?.
createMemberName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"下单时间"
span=
{
2
}
>
{
orderInfo
?.
createTime
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
PageHeader
>
</>
}
>
<
NiceForm
actions=
{
formActions
}
initialValues=
{
{
comments
:
[
evaluationInfo
],
}
}
editable=
{
pageStatus
===
PageStatus
.
EDIT
}
expressionScope=
{
{
UploadTip
:
pageStatus
===
PageStatus
.
EDIT
?
UploadTip
:
null
,
beforeUpload
,
}
}
onSubmit=
{
handleSubmit
}
components=
{
{
EvaluationList
,
}
}
effects=
{
(
$
,
actions
)
=>
{
createEffects
(
$
,
actions
);
}
}
schema=
{
evaluateSchema
}
/>
</
PageHeaderWrapper
>
</
Spin
>
);
};
export
default
ReceivedDetail
;
\ No newline at end of file
src/pages/transaction/supplierEvaluation/received/detail/schema/index.ts
0 → 100644
View file @
e8975995
/*
* @Author: XieZhiXiong
* @Date: 2020-09-23 17:00:24
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-21 13:46:22
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
;
export
const
evaluateSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
comments
:
{
type
:
'array'
,
'x-component'
:
'EvaluationList'
,
default
:
[],
items
:
{
type
:
'object'
,
properties
:
{
LEFT_RIGHT
:
{
type
:
'object'
,
'x-component'
:
'LeftRightLayout'
,
'x-component-props'
:
{
rightProps
:
{
span
:
2
,
offset
:
4
,
},
},
properties
:
{
MEGA_LADYOUT
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
labelCol
:
6
,
labelAlign
:
'left'
,
position
:
'left'
,
},
properties
:
{
star
:
{
title
:
'满意程度'
,
required
:
true
,
'x-component'
:
'Rating'
,
'x-component-props'
:
{
allowHalf
:
false
,
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请选择满意程度'
,
},
],
},
comment
:
{
type
:
'string'
,
title
:
'评价'
,
'x-component'
:
'TextArea'
,
'x-component-props'
:
{
rows
:
4
,
},
'x-rules'
:
{
max
:
200
,
},
},
picture
:
{
type
:
'string'
,
title
:
'图片'
,
'x-component'
:
'Upload'
,
'x-component-props'
:
{
listType
:
'card'
,
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
'/supplierEvaluation/'
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.png, .jpg, .jpeg'
,
},
'x-mega-props'
:
{
addonAfter
:
'{{UploadTip}}'
,
},
},
},
},
smile
:
{
type
:
'object'
,
default
:
1
,
'x-component'
:
'SmilingFace'
,
'x-component-props'
:
{
position
:
'right'
,
},
},
},
},
},
},
},
},
};
\ No newline at end of file
src/pages/transaction/supplierEvaluation/sent/detail/effects/index.tsx
0 → 100644
View file @
e8975995
import
{
useBusinessEffects
}
from
'./useBusinessEffects'
;
export
const
createEffects
=
(
context
,
actions
)
=>
{
useBusinessEffects
(
context
,
actions
);
};
\ No newline at end of file
src/pages/transaction/supplierEvaluation/sent/detail/effects/useBusinessEffects.tsx
0 → 100644
View file @
e8975995
import
{
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
const
{
onFieldInputChange$
,
onFieldValueChange$
,
}
=
FormEffectHooks
;
export
const
useBusinessEffects
=
(
context
,
actions
)
=>
{
const
{
setFieldState
,
}
=
actions
;
// 评论图片限制 4 张
onFieldInputChange$
(
'comments.*.picture'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.picture`
}),
state
=>
{
state
.
props
[
'x-component-props'
].
disabled
=
value
.
length
>=
4
;
}
);
});
// 评分联动
onFieldInputChange$
(
'comments.*.star'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.smile`
}),
state
=>
{
state
.
value
=
value
;
}
);
});
}
\ No newline at end of file
src/pages/transaction/supplierEvaluation/sent/detail/index.less
0 → 100644
View file @
e8975995
src/pages/transaction/supplierEvaluation/sent/detail/index.tsx
0 → 100644
View file @
e8975995
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
PageHeader
,
Descriptions
,
Card
,
Spin
,
Button
,
message
,
}
from
'antd'
;
import
{
FormOutlined
}
from
'@ant-design/icons'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
history
}
from
'umi'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetOrderPurchaseOrderDetailsResponse
}
from
'@/services/OrderApi'
;
import
{
normalizeFiledata
,
isJSONStr
}
from
'@/utils'
;
import
AvatarWrap
from
'@/components/AvatarWrap'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
normalizeUnevaluatedList
}
from
'../../utils'
;
import
{
evaluateSchema
}
from
'./schema'
;
import
{
createEffects
}
from
'./effects'
;
import
EvaluationList
from
'../../components/EvaluationList'
;
import
styles
from
'./index.less'
;
const
formActions
=
createFormActions
();
const
{
onFormInit$
,
}
=
FormEffectHooks
;
interface
Unevaluated
{
good
:
{
pic
:
string
,
productName
:
string
,
price
:
string
,
purchaseCount
:
string
,
};
star
:
number
;
comment
:
string
;
picture
:
string
[];
smile
:
number
;
};
const
SentDetail
:
React
.
FC
=
()
=>
{
const
{
orderId
,
id
,
pageStatus
}
=
usePageStatus
();
const
[
orderInfo
,
setOrderInfo
]
=
useState
<
GetOrderPurchaseOrderDetailsResponse
>
(
null
);
const
[
orderInfoLoading
,
setOrderInfoLoading
]
=
useState
(
false
);
const
[
evaluationInfo
,
setEvaluationInfo
]
=
useState
<
Unevaluated
>
(
null
);
const
[
evaluationInfoLoading
,
setEvaluationInfoLoading
]
=
useState
(
false
);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
getOrderInfo
=
()
=>
{
if
(
!
orderId
)
{
return
;
}
setOrderInfoLoading
(
true
);
PublicApi
.
getOrderPurchaseOrderDetails
({
id
:
orderId
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setOrderInfo
(
res
.
data
);
}
}).
finally
(()
=>
{
setOrderInfoLoading
(
false
);
});
};
const
getEvaluationInfo
=
()
=>
{
if
(
!
id
)
{
return
;
}
setEvaluationInfoLoading
(
true
);
PublicApi
.
getMemberCommentSupplySendTradeHistoryGet
({
id
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
product
}
=
res
.
data
;
const
productObj
=
isJSONStr
(
product
)
||
{};
setEvaluationInfo
({
good
:
{
pic
:
productObj
.
pic
,
productName
:
productObj
.
productName
,
price
:
productObj
.
price
,
purchaseCount
:
productObj
.
purchaseCount
,
},
star
:
res
.
data
.
star
,
comment
:
res
.
data
.
comment
,
picture
:
res
.
data
.
pics
?
res
.
data
.
pics
.
map
(
item
=>
normalizeFiledata
(
item
))
:
[],
smile
:
res
.
data
.
star
,
});
}
}).
finally
(()
=>
{
setEvaluationInfoLoading
(
false
);
});
};
useEffect
(()
=>
{
getOrderInfo
();
getEvaluationInfo
();
},
[]);
const
handleSubmit
=
values
=>
{
setSubmitLoading
(
true
);
const
payload
=
values
.
comments
.
map
(
item
=>
{
const
{
comment
,
good
,
picture
,
star
,
}
=
item
;
return
{
id
,
star
,
comment
,
};
});
if
(
!
payload
.
length
)
{
return
;
}
PublicApi
.
postMemberCommentSupplySendTradeHistoryUpdate
(
payload
[
0
])
.
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTimeout
(()
=>
{
history
.
goBack
();
},
800
);
}
})
.
finally
(()
=>
{
setSubmitLoading
(
false
);
});
};
const
beforeUpload
=
file
=>
{
if
(
file
.
size
/
1024
<
10
)
{
message
.
warning
(
'图片大小超过10M'
);
return
Promise
.
reject
();
}
};
const
UploadTip
=
(
<
span
style=
{
{
lineHeight
:
'24px'
,
color
:
'#909399'
,
fontWeight
:
400
,
wordBreak
:
'break-all'
,
position
:
'relative'
,
top
:
'34px'
,
}
}
>
支持JPG/PNG/JPEG
<
br
/>
每张最大不超过 10M,尺寸不限
<
br
/>
最大数量限制 4张
</
span
>
);
return
(
<
Spin
spinning=
{
orderInfoLoading
||
evaluationInfoLoading
}
>
<
PageHeaderWrapper
title=
{
<>
<
PageHeader
style=
{
{
padding
:
'0'
}
}
onBack=
{
()
=>
history
.
goBack
()
}
title=
{
<
AvatarWrap
info=
{
{
aloneTxt
:
'单'
,
name
:
orderInfo
?.
orderNo
,
}
}
/>
}
extra=
{
(
<>
{
pageStatus
===
PageStatus
.
EDIT
&&
(
<
Button
type=
"primary"
icon=
{
<
FormOutlined
/>
}
disabled=
{
!
id
}
loading=
{
submitLoading
}
onClick=
{
()
=>
formActions
.
submit
()
}
>
修改
</
Button
>
)
}
</>
)
}
>
<
Descriptions
size=
"small"
column=
{
3
}
style=
{
{
padding
:
'0 32px'
,
}
}
>
<
Descriptions
.
Item
label=
"采购会员"
>
{
orderInfo
?.
createMemberName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"下单时间"
span=
{
2
}
>
{
orderInfo
?.
createTime
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
PageHeader
>
</>
}
>
<
NiceForm
actions=
{
formActions
}
initialValues=
{
{
comments
:
[
evaluationInfo
],
}
}
editable=
{
pageStatus
===
PageStatus
.
EDIT
}
expressionScope=
{
{
UploadTip
:
pageStatus
===
PageStatus
.
EDIT
?
UploadTip
:
null
,
beforeUpload
,
}
}
onSubmit=
{
handleSubmit
}
components=
{
{
EvaluationList
,
}
}
effects=
{
(
$
,
actions
)
=>
{
createEffects
(
$
,
actions
);
onFormInit$
().
subscribe
(()
=>
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
actions
.
setFieldState
(
'comments.*.picture'
,
state
=>
{
state
.
visible
=
false
;
}
);
}
});
}
}
schema=
{
evaluateSchema
}
/>
</
PageHeaderWrapper
>
</
Spin
>
);
};
export
default
SentDetail
;
\ No newline at end of file
src/pages/transaction/supplierEvaluation/sent/detail/schema/index.ts
0 → 100644
View file @
e8975995
/*
* @Author: XieZhiXiong
* @Date: 2020-09-23 17:00:24
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-19 16:23:24
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
;
export
const
evaluateSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
comments
:
{
type
:
'array'
,
'x-component'
:
'EvaluationList'
,
default
:
[],
items
:
{
type
:
'object'
,
properties
:
{
LEFT_RIGHT
:
{
type
:
'object'
,
'x-component'
:
'LeftRightLayout'
,
'x-component-props'
:
{
rightProps
:
{
span
:
2
,
offset
:
4
,
},
},
properties
:
{
MEGA_LADYOUT
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
labelCol
:
6
,
labelAlign
:
'left'
,
position
:
'left'
,
},
properties
:
{
star
:
{
title
:
'满意程度'
,
required
:
true
,
'x-component'
:
'Rating'
,
'x-component-props'
:
{
allowHalf
:
false
,
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请选择满意程度'
,
},
],
},
comment
:
{
type
:
'string'
,
title
:
'评价'
,
'x-component'
:
'TextArea'
,
'x-component-props'
:
{
rows
:
4
,
},
'x-rules'
:
{
max
:
200
,
},
},
picture
:
{
type
:
'string'
,
title
:
'图片'
,
'x-component'
:
'Upload'
,
'x-component-props'
:
{
listType
:
'card'
,
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
'/supplierEvaluation/'
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.png, .jpg, .jpeg'
,
},
'x-mega-props'
:
{
addonAfter
:
'{{UploadTip}}'
,
},
},
},
},
smile
:
{
type
:
'object'
,
default
:
1
,
'x-component'
:
'SmilingFace'
,
'x-component-props'
:
{
position
:
'right'
,
},
},
},
},
},
},
},
},
};
\ No newline at end of file
src/pages/transaction/supplierEvaluation/unevaluated/evaluate/index.tsx
View file @
e8975995
...
...
@@ -43,18 +43,18 @@ interface OrderInfo extends GetOrderPurchaseOrderDetailsResponse {
};
const
EvaluateOrder
:
React
.
FC
=
()
=>
{
const
{
i
d
}
=
usePageStatus
();
const
{
orderI
d
}
=
usePageStatus
();
const
[
orderInfo
,
setOrderInfo
]
=
useState
<
OrderInfo
>
(
null
);
const
[
infoLoading
,
setInfoLoading
]
=
useState
(
false
);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
getOrderInfo
=
()
=>
{
if
(
!
i
d
)
{
if
(
!
orderI
d
)
{
return
;
}
setInfoLoading
(
true
);
PublicApi
.
getOrderPurchaseOrderDetails
({
id
,
id
:
orderId
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
orderProductRequests
}
=
res
.
data
;
...
...
src/pages/transaction/supplierEvaluation/unevaluated/evaluate/schema/index.ts
View file @
e8975995
...
...
@@ -58,6 +58,9 @@ export const evaluateSchema: ISchema = {
'x-component-props'
:
{
rows
:
4
,
},
'x-rules'
:
{
max
:
200
,
},
},
picture
:
{
type
:
'string'
,
...
...
src/pages/transaction/supplierEvaluation/unevaluated/index.tsx
View file @
e8975995
...
...
@@ -84,7 +84,7 @@ const Unevaluated: React.FC = () => {
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<>
<
Link
to=
{
`/memberCenter/tranactionAbility/supplierEvaluation/unevaluated/evaluate?
i
d=${record.id}`
}
>
<
Link
to=
{
`/memberCenter/tranactionAbility/supplierEvaluation/unevaluated/evaluate?
orderI
d=${record.id}`
}
>
<
Button
type=
"link"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment