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
879a676a
Commit
879a676a
authored
Jan 10, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完善类型声明
parent
52e0b739
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
9 deletions
+83
-9
utils.ts
src/pages/transaction/purchaserEvaluation/utils.ts
+83
-9
No files found.
src/pages/transaction/purchaserEvaluation/utils.ts
View file @
879a676a
...
...
@@ -5,10 +5,84 @@
* @LastEditTime: 2021-08-10 18:24:06
* @Description:
*/
import
{
normalizeFiledata
}
from
'@/utils'
;
import
{
normalizeFiledata
,
FileData
}
from
'@/utils'
;
import
{
EvaluationFormValue
}
from
'./components/EvaluationForm'
;
export
type
EvaluateItem
=
{
/**
* 订单商品明细id
*/
orderProductId
:
number
/**
* 商品Id(来自商品服务)
*/
productId
:
number
/**
* 商品skuId(来自商品服务)
*/
skuId
:
number
/**
* 商品(物料)编号
*/
productNo
:
string
/**
* 商品名称
*/
name
:
string
/**
* 商品品类
*/
category
:
string
/**
* 商品品牌
*/
brand
:
string
/**
* 报价商品规格
*/
spec
:
string
/**
* 计价单位
*/
unit
:
string
/**
* 商品Logo
*/
logo
:
string
/**
* 价格
*/
price
:
number
/**
* 采购数量
*/
quantity
:
number
/**
* 金额
*/
amount
:
number
/**
* 评价星级(1-5)
*/
star
:
number
/**
* 评价内容
*/
comment
:
string
/**
* 评价图片 ,String
*/
pics
:
string
[]
/**
* 是否已评价0-否1-是
*/
commentStatus
:
number
}
export
type
NormalizedEvaluateItem
=
EvaluationFormValue
[
'comments'
][
0
]
&
{};
// 初始化待评价列表
export
const
normalizeUnevaluatedList
=
(
arr
:
{[
key
:
string
]:
any
}[])
=>
{
export
const
normalizeUnevaluatedList
=
(
arr
:
EvaluateItem
[]):
NormalizedEvaluateItem
[]
=>
{
const
ret
=
[];
if
(
!
Array
.
isArray
(
arr
))
{
...
...
@@ -18,18 +92,18 @@ export const normalizeUnevaluatedList = (arr: {[key: string]: any}[]) => {
// 未评价过的
const
atom
=
{
good
:
{
pic
:
item
.
logo
||
''
,
productId
:
item
.
productId
,
productName
:
item
.
name
,
unit
:
item
.
unit
,
price
:
item
.
price
,
pic
:
item
.
logo
||
''
,
productId
:
item
.
productId
,
productName
:
item
.
name
,
unit
:
item
.
unit
,
price
:
item
.
price
,
purchaseCount
:
item
.
quantity
,
// 采购数量
totalPrice
:
item
.
amount
,
orderProductId
:
item
.
orderProductId
,
},
},
star
:
item
.
star
||
undefined
,
// 评分星星
comment
:
item
.
comment
||
undefined
,
// 评价
picture
:
item
.
pics
?
item
.
pics
.
map
((
item
)
=>
normalizeFiledata
(
item
))
:
[],
picture
:
item
.
pics
?
item
.
pics
.
map
((
item
)
=>
normalizeFiledata
(
item
))
:
[],
smile
:
item
.
star
||
undefined
,
// 笑脸
commentStatus
:
item
.
commentStatus
,
};
...
...
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