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
shenshaokai
jinfa-platform
Commits
570a39b8
Commit
570a39b8
authored
Aug 09, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 跟进评价接口
parent
f19b7121
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
78 deletions
+104
-78
evaluateSchema.tsx
...ion/purchaserEvaluation/common/schemas/evaluateSchema.tsx
+47
-23
index.tsx
...action/purchaserEvaluation/unevaluated/evaluate/index.tsx
+17
-15
utils.ts
src/pages/transaction/purchaserEvaluation/utils.ts
+18
-19
index.tsx
...saction/supplierEvaluation/unevaluated/evaluate/index.tsx
+22
-21
No files found.
src/pages/transaction/purchaserEvaluation/common/schemas/evaluateSchema.tsx
View file @
570a39b8
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-07-16 16:53:17
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-09 1
6:18:13
* @LastEditTime: 2021-08-09 1
8:40:47
* @Description: 评价 schema
*/
import
{
ISchema
}
from
'@formily/antd'
;
...
...
@@ -55,31 +55,55 @@ export const evaluateSchema: ISchema = {
'x-rules'
:
{
max
:
200
,
},
},
picture
:
{
type
:
'string'
,
title
:
'图片'
,
'x-component'
:
'FixUpload'
,
},
MEGA_LADYOUT
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
listType
:
'card'
,
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
''
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.png, .jpg, .jpeg'
,
labelCol
:
9
,
labelAlign
:
'left'
,
grid
:
true
,
full
:
true
,
autoRow
:
true
,
},
'x-rules'
:
[
{
max
:
4
,
message
:
'最多可上传4张图片'
,
},
],
'x-mega-props'
:
{
addonAfter
:
'{{UploadTip}}'
,
properties
:
{
picture
:
{
type
:
'string'
,
title
:
'图片'
,
'x-component'
:
'FixUpload'
,
'x-mega-props'
:
{
span
:
2
,
},
'x-component-props'
:
{
listType
:
'card'
,
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
''
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.png, .jpg, .jpeg'
,
},
'x-rules'
:
[
{
max
:
4
,
message
:
'最多可上传4张图片'
,
},
],
// 'x-mega-props': {
// addonAfter: '{{UploadTip}}',
// },
},
UPLOAD_TIP
:
{
type
:
'object'
,
'x-mega-props'
:
{
span
:
1
,
grid
:
false
,
},
'x-component'
:
'UploadTip'
,
},
},
},
},
},
},
smile
:
{
...
...
src/pages/transaction/purchaserEvaluation/unevaluated/evaluate/index.tsx
View file @
570a39b8
...
...
@@ -60,10 +60,18 @@ const EvaluateOrder: React.FC = () => {
id
,
}
as
any
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
orderProductCommentList
}
=
res
.
data
;
const
{
orderProductCommentList
}
=
res
.
data
;
const
unevaluatedList
=
normalizeUnevaluatedList
(
orderProductCommentList
);
setOrderInfo
({
...
res
.
data
,
unevaluatedList
:
normalizeUnevaluatedList
(
orderProductCommentList
),
...
res
.
data
,
unevaluatedList
,
});
unevaluatedList
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
completeCommentStatus
)
{
formActions
.
setFieldState
(
`comments.
${
index
}
.*`
,
(
fieldState
)
=>
{
fieldState
.
editable
=
false
;
});
}
});
}
}).
finally
(()
=>
{
...
...
@@ -102,13 +110,8 @@ const EvaluateOrder: React.FC = () => {
});
PublicApi
.
postMemberCommentConsumerOrderTradeSubmit
({
memberId
:
orderInfo
.
supplyMembersId
,
roleId
:
orderInfo
.
supplyMembersRoleId
,
orderId
:
orderInfo
.
id
,
orderNo
:
orderInfo
.
orderNo
,
orderType
:
orderInfo
.
type
,
orderId
:
orderInfo
.
orderId
,
commentSubmitDetailList
:
payload
,
shopId
:
orderInfo
.
shopId
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setUnsaved
(
false
);
...
...
@@ -131,19 +134,18 @@ const EvaluateOrder: React.FC = () => {
return
Promise
.
resolve
();
};
const
UploadTip
=
(
<
span
const
UploadTip
=
(
)
=>
(
<
div
style=
{
{
lineHeight
:
'24px'
,
color
:
'#909399'
,
fontWeight
:
400
,
wordBreak
:
'break-all'
,
position
:
'relative'
,
top
:
'34px'
,
}
}
>
支持JPG/PNG/JPEG
<
br
/>
每张最大不超过 10M,尺寸不限
<
br
/>
最大数量限制 4张
</
span
>
</
div
>
);
return
(
...
...
@@ -202,12 +204,12 @@ const EvaluateOrder: React.FC = () => {
comments
:
orderInfo
?
orderInfo
.
unevaluatedList
:
[],
}
}
expressionScope=
{
{
UploadTip
,
beforeUpload
,
}
}
onSubmit=
{
handleSubmit
}
components=
{
{
EvaluationList
,
EvaluationList
,
UploadTip
,
}
}
effects=
{
(
$
,
actions
)
=>
{
createEffects
(
$
,
actions
);
...
...
src/pages/transaction/purchaserEvaluation/utils.ts
View file @
570a39b8
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-10-19 16:02:53
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-09 1
6:00:36
* @LastEditTime: 2021-08-09 1
8:30:30
* @Description:
*/
...
...
@@ -15,24 +15,23 @@ export const normalizeUnevaluatedList = (arr: {[key: string]: any}[]) => {
}
arr
.
forEach
(
item
=>
{
// 未评价过的
if
(
!
item
.
commentStatus
)
{
const
atom
=
{
good
:
{
pic
:
item
.
logo
||
''
,
productId
:
item
.
productId
,
productName
:
item
.
name
,
unit
:
item
.
unit
,
price
:
item
.
price
,
purchaseCount
:
item
.
quantity
,
// 采购数量
totalPrice
:
item
.
amount
,
},
star
:
undefined
,
// 评分星星
comment
:
''
,
// 评价
picture
:
[],
smile
:
undefined
,
// 笑脸
};
ret
.
push
(
atom
);
}
const
atom
=
{
good
:
{
pic
:
item
.
logo
||
''
,
productId
:
item
.
productId
,
productName
:
item
.
name
,
unit
:
item
.
unit
,
price
:
item
.
price
,
purchaseCount
:
item
.
quantity
,
// 采购数量
totalPrice
:
item
.
amount
,
},
star
:
undefined
,
// 评分星星
comment
:
undefined
,
// 评价
picture
:
[],
smile
:
undefined
,
// 笑脸
completeCommentStatus
:
item
.
completeCommentStatus
,
};
ret
.
push
(
atom
);
});
return
ret
;
...
...
src/pages/transaction/supplierEvaluation/unevaluated/evaluate/index.tsx
View file @
570a39b8
...
...
@@ -14,7 +14,7 @@ import moment from 'moment';
import
{
createFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
Get
OrderPurchaseOrderDetailsResponse
}
from
'@/services/Order
Api'
;
import
{
Get
MemberCommentSupplyOrderTradeDetailResponse
}
from
'@/services/MemberV2
Api'
;
import
AvatarWrap
from
'@/components/AvatarWrap'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
normalizeUnevaluatedList
}
from
'../../../purchaserEvaluation/utils'
;
...
...
@@ -40,7 +40,7 @@ interface Unevaluated {
smile
:
number
;
};
interface
OrderInfo
extends
Get
OrderPurchaseOrderDetails
Response
{
interface
OrderInfo
extends
Get
MemberCommentSupplyOrderTradeDetail
Response
{
unevaluatedList
:
Unevaluated
[];
};
...
...
@@ -56,15 +56,22 @@ const EvaluateOrder: React.FC = () => {
return
;
}
setInfoLoading
(
true
);
PublicApi
.
get
OrderPurchaseOrderDetails
({
PublicApi
.
get
MemberCommentSupplyOrderTradeDetail
({
id
,
orderNo
:
''
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
orderProductRequests
}
=
res
.
data
;
const
{
orderProductCommentList
}
=
res
.
data
;
const
unevaluatedList
=
normalizeUnevaluatedList
(
orderProductCommentList
);
setOrderInfo
({
...
res
.
data
,
unevaluatedList
:
normalizeUnevaluatedList
(
orderProductRequests
),
...
res
.
data
,
unevaluatedList
,
});
unevaluatedList
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
completeCommentStatus
)
{
formActions
.
setFieldState
(
`comments.
${
index
}
.*`
,
(
fieldState
)
=>
{
fieldState
.
editable
=
false
;
});
}
});
}
}).
finally
(()
=>
{
...
...
@@ -103,13 +110,8 @@ const EvaluateOrder: React.FC = () => {
});
PublicApi
.
postMemberCommentSupplyOrderTradeSubmit
({
memberId
:
orderInfo
.
createMemberId
,
roleId
:
orderInfo
.
createRoleId
,
orderId
:
orderInfo
.
id
,
orderNo
:
orderInfo
.
orderNo
,
orderType
:
orderInfo
.
type
,
orderId
:
orderInfo
.
orderId
,
commentSubmitDetailList
:
payload
,
shopId
:
orderInfo
.
shopId
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setUnsaved
(
false
);
...
...
@@ -132,19 +134,18 @@ const EvaluateOrder: React.FC = () => {
return
Promise
.
resolve
();
};
const
UploadTip
=
(
<
span
const
UploadTip
=
(
)
=>
(
<
div
style=
{
{
lineHeight
:
'24px'
,
color
:
'#909399'
,
fontWeight
:
400
,
wordBreak
:
'break-all'
,
position
:
'relative'
,
top
:
'34px'
,
}
}
>
支持JPG/PNG/JPEG
<
br
/>
每张最大不超过 10M,尺寸不限
<
br
/>
最大数量限制 4张
</
span
>
</
div
>
);
return
(
...
...
@@ -171,7 +172,7 @@ const EvaluateOrder: React.FC = () => {
<
Button
type=
"primary"
icon=
{
<
FormOutlined
/>
}
disabled=
{
!
orderInfo
||
!
orderInfo
.
id
}
disabled=
{
!
orderInfo
}
loading=
{
submitLoading
}
onClick=
{
()
=>
formActions
.
submit
()
}
>
...
...
@@ -187,7 +188,7 @@ const EvaluateOrder: React.FC = () => {
padding
:
'0 32px'
,
}
}
>
<
Descriptions
.
Item
label=
"供应会员"
>
{
orderInfo
?.
supplyM
embersName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"供应会员"
>
{
orderInfo
?.
m
embersName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"下单时间"
span=
{
2
}
>
{
orderInfo
&&
orderInfo
.
createTime
?
moment
(
orderInfo
.
createTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
}
</
Descriptions
.
Item
>
...
...
@@ -203,12 +204,12 @@ const EvaluateOrder: React.FC = () => {
comments
:
orderInfo
?
orderInfo
.
unevaluatedList
:
[],
}
}
expressionScope=
{
{
UploadTip
,
beforeUpload
,
}
}
onSubmit=
{
handleSubmit
}
components=
{
{
EvaluationList
,
EvaluationList
,
UploadTip
,
}
}
effects=
{
(
$
,
actions
)
=>
{
createEffects
(
$
,
actions
);
...
...
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