Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
45b2497c
提交
45b2497c
authored
3月 16, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
前端:商品列表
上级
a901dd5d
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
150 行增加
和
176 行删除
+150
-176
productSpuList.js
admin-web/src/models/product/productSpuList.js
+74
-0
ProductSpuList.js
admin-web/src/pages/Product/ProductSpuList.js
+39
-173
product.js
admin-web/src/services/product.js
+10
-1
AdminsProductSpuVO.java
...all/product/application/vo/admins/AdminsProductSpuVO.java
+12
-0
ProductSpuBO.java
...ain/java/cn/iocoder/mall/product/api/bo/ProductSpuBO.java
+15
-0
ProductSpuDO.java
...java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java
+0
-2
没有找到文件。
admin-web/src/models/product/productSpuList.js
0 → 100644
浏览文件 @
45b2497c
import
{
message
}
from
'antd'
;
import
{
productSpuPage
,
productCategoryAdd
,
productCategoryUpdate
,
productCategoryUpdateStatus
,
productCategoryDelete
}
from
'../../services/product'
;
export
default
{
namespace
:
'productSpuList'
,
state
:
{
list
:
[],
},
effects
:
{
*
add
({
payload
},
{
call
,
put
})
{
const
{
callback
,
body
}
=
payload
;
const
response
=
yield
call
(
productCategoryAdd
,
body
);
if
(
callback
)
{
callback
(
response
);
}
yield
put
({
type
:
'tree'
,
payload
:
{},
});
},
*
update
({
payload
},
{
call
,
put
})
{
const
{
callback
,
body
}
=
payload
;
const
response
=
yield
call
(
productCategoryUpdate
,
body
);
if
(
callback
)
{
callback
(
response
);
}
yield
put
({
type
:
'tree'
,
payload
:
{},
});
},
*
updateStatus
({
payload
},
{
call
,
put
})
{
const
{
callback
,
body
}
=
payload
;
const
response
=
yield
call
(
productCategoryUpdateStatus
,
body
);
if
(
callback
)
{
callback
(
response
);
}
yield
put
({
type
:
'tree'
,
payload
:
{},
});
},
*
delete
({
payload
},
{
call
,
put
})
{
const
response
=
yield
call
(
productCategoryDelete
,
payload
);
message
.
info
(
'删除成功!'
);
yield
put
({
type
:
'tree'
,
payload
:
{},
});
},
*
page
({
payload
},
{
call
,
put
})
{
const
{
queryParams
}
=
payload
;
const
response
=
yield
call
(
productSpuPage
,
queryParams
);
message
.
info
(
'查询成功!'
);
yield
put
({
type
:
'treeSuccess'
,
payload
:
{
list
:
response
.
data
,
},
});
},
},
reducers
:
{
treeSuccess
(
state
,
{
payload
})
{
return
{
...
state
,
...
payload
,
};
},
},
};
admin-web/src/pages/Product/ProductSpuList.js
浏览文件 @
45b2497c
...
...
@@ -48,87 +48,15 @@ const CreateForm = Form.create()(props => {
);
});
// 角色分配
const
AssignModal
=
Form
.
create
()(
props
=>
{
const
{
modalVisible
,
form
,
handleOk
,
handleModalVisible
,
treeData
,
checkedKeys
,
loading
,
handleCheckBoxClick
,
}
=
props
;
const
renderTreeNodes
=
data
=>
{
return
data
.
map
(
item
=>
{
if
(
item
.
children
)
{
return
(
<
TreeNode
title
=
{
item
.
title
}
key
=
{
item
.
key
}
dataRef
=
{
item
}
>
{
renderTreeNodes
(
item
.
children
)}
<
/TreeNode
>
);
}
return
<
TreeNode
title
=
{
item
.
title
}
key
=
{
item
.
key
}
dataRef
=
{
item
}
/>
;
});
};
const
renderModalContent
=
treeData
=>
{
const
RenderTreeNodes
=
renderTreeNodes
(
treeData
);
if
(
RenderTreeNodes
)
{
return
(
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"角色名"
>
{
form
.
getFieldDecorator
(
'name'
,
{})(
<
Tree
defaultExpandAll
=
{
true
}
checkable
=
{
true
}
multiple
=
{
true
}
checkedKeys
=
{
checkedKeys
}
onCheck
=
{
handleCheckBoxClick
}
>
{
renderTreeNodes
(
treeData
)}
<
/Tree
>
)}
<
/FormItem
>
);
}
else
{
return
null
;
}
};
const
okHandle
=
()
=>
{
form
.
validateFields
((
err
,
fieldsValue
)
=>
{
if
(
err
)
return
;
form
.
resetFields
();
handleOk
({
fields
:
fieldsValue
,
});
});
};
return
(
<
Modal
destroyOnClose
title
=
"更新权限"
visible
=
{
modalVisible
}
onOk
=
{
okHandle
}
onCancel
=
{()
=>
handleModalVisible
()}
>
<
Spin
spinning
=
{
loading
}
>
{
renderModalContent
(
treeData
)}
<
/Spin
>
<
/Modal
>
);
});
// roleList
@
connect
(({
roleList
,
loading
})
=>
({
roleList
,
list
:
roleList
.
list
,
data
:
roleList
,
loading
:
loading
.
models
.
resourceList
,
@
connect
(({
productSpuList
,
loading
})
=>
({
productSpuList
,
list
:
productSpuList
.
list
.
spus
,
loading
:
loading
.
models
.
productSpuList
,
}))
@
Form
.
create
()
class
Role
List
extends
PureComponent
{
class
ProductSpu
List
extends
PureComponent
{
state
=
{
modalVisible
:
false
,
modalType
:
'add'
,
//add update
...
...
@@ -140,7 +68,7 @@ class RoleList extends PureComponent {
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'
roleList/query
'
,
type
:
'
productSpuList/page
'
,
payload
:
{
name
:
''
,
pageNo
:
0
,
...
...
@@ -157,51 +85,6 @@ class RoleList extends PureComponent {
});
};
handleAssignModalVisible
=
(
flag
,
record
)
=>
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'roleList/queryRoleAssign'
,
payload
:
{
id
:
record
.
id
,
},
});
this
.
setState
({
roleAssignVisible
:
!!
flag
,
roleAssignRecord
:
record
,
});
};
handleAssignModalVisibleClose
(
flag
)
{
this
.
setState
({
roleAssignVisible
:
!!
flag
,
});
}
handleAssignCheckBoxClick
=
checkedKeys
=>
{
const
{
dispatch
}
=
this
.
props
;
const
newCheckedKeys
=
checkedKeys
.
map
(
item
=>
{
return
parseInt
(
item
);
});
dispatch
({
type
:
'roleList/changeCheckedKeys'
,
payload
:
newCheckedKeys
,
});
};
handleAssignOK
=
()
=>
{
const
{
dispatch
,
data
}
=
this
.
props
;
const
{
roleAssignRecord
}
=
this
.
state
;
dispatch
({
type
:
'roleList/roleAssignResource'
,
payload
:
{
id
:
roleAssignRecord
.
id
,
resourceIds
:
data
.
checkedKeys
,
roleTreeData
:
data
.
roleTreeData
,
},
});
this
.
handleAssignModalVisibleClose
(
false
);
};
handleAdd
=
({
fields
,
modalType
,
initValues
})
=>
{
const
{
dispatch
,
data
}
=
this
.
props
;
const
queryParams
=
{
...
...
@@ -240,34 +123,11 @@ class RoleList extends PureComponent {
}
};
handleDelete
(
row
)
{
const
{
dispatch
,
data
}
=
this
.
props
;
const
queryParams
=
{
pageNo
:
data
.
pageNo
,
pageSize
:
data
.
pageSize
,
};
Modal
.
confirm
({
title
:
`确认删除?`
,
content
:
`
${
row
.
name
}
`
,
onOk
()
{
dispatch
({
type
:
'roleList/delete'
,
payload
:
{
body
:
{
id
:
row
.
id
,
},
queryParams
,
},
});
},
onCancel
()
{},
});
}
render
()
{
// debugger;
const
{
list
,
data
}
=
this
.
props
;
const
{
pageNo
,
pageSize
,
count
,
roleTreeData
,
checkedKeys
,
assignModalLoading
}
=
data
;
//
const { pageNo, pageSize, count, roleTreeData, checkedKeys, assignModalLoading } = data;
const
{
modalVisible
,
modalType
,
initValues
,
roleAssignVisible
}
=
this
.
state
;
const
parentMethods
=
{
...
...
@@ -284,9 +144,30 @@ class RoleList extends PureComponent {
render
:
text
=>
<
strong
>
{
text
}
<
/strong>
,
},
{
title
:
'名称'
,
title
:
'
商品
名称'
,
dataIndex
:
'name'
,
},
{
title
:
'商品分类'
,
dataIndex
:
'cid'
},
{
title
:
'商品主图'
,
dataIndex
:
'picUrls'
,
render
(
val
)
{
return
<
img
width
=
{
120
}
src
=
{
val
[
0
]}
/>
;
// return 'TODO';
},
},
{
title
:
'商品库存'
,
dataIndex
:
'quantity'
},
{
title
:
'排序值'
,
dataIndex
:
'sort'
,
render
:
sort
=>
<
span
>
{
sort
}
<
/span>
,
},
{
title
:
'创建时间'
,
dataIndex
:
'createTime'
,
...
...
@@ -299,25 +180,19 @@ class RoleList extends PureComponent {
render
:
(
text
,
record
)
=>
(
<
Fragment
>
<
a
onClick
=
{()
=>
this
.
handleModalVisible
(
true
,
'update'
,
record
)}
>
更新
<
/a
>
<
Divider
type
=
"vertical"
/>
<
a
onClick
=
{()
=>
this
.
handleAssignModalVisible
(
true
,
record
)}
>
分配权限
<
/a
>
<
Divider
type
=
"vertical"
/>
<
a
className
=
{
styles
.
tableDelete
}
onClick
=
{()
=>
this
.
handleDelete
(
record
)}
>
删除
<
/a
>
<
/Fragment
>
),
},
];
const
paginationProps
=
{
current
:
pageNo
,
pageSize
:
pageSize
,
total
:
count
,
};
//
const paginationProps = {
//
current: pageNo,
//
pageSize: pageSize,
//
total: count,
//
};
return
(
<
PageHeaderWrapper
title
=
"
查询表格
"
>
<
PageHeaderWrapper
title
=
""
>
<
Card
bordered
=
{
false
}
>
<
div
className
=
{
styles
.
tableList
}
>
<
div
className
=
{
styles
.
tableListOperator
}
>
...
...
@@ -326,25 +201,16 @@ class RoleList extends PureComponent {
type
=
"primary"
onClick
=
{()
=>
this
.
handleModalVisible
(
true
,
'add'
,
{})}
>
新建
发布商品
<
/Button
>
<
/div
>
<
/div
>
<
Table
columns
=
{
columns
}
dataSource
=
{
list
}
rowKey
=
"id"
/>
<
/Card
>
<
CreateForm
{...
parentMethods
}
modalVisible
=
{
modalVisible
}
/
>
<
AssignModal
loading
=
{
assignModalLoading
}
treeData
=
{
roleTreeData
}
checkedKeys
=
{
checkedKeys
}
handleOk
=
{
this
.
handleAssignOK
}
modalVisible
=
{
roleAssignVisible
}
handleCheckBoxClick
=
{
this
.
handleAssignCheckBoxClick
}
handleModalVisible
=
{()
=>
this
.
handleAssignModalVisibleClose
(
false
)}
/
>
<
/PageHeaderWrapper
>
);
}
}
export
default
Role
List
;
export
default
ProductSpu
List
;
admin-web/src/services/product.js
浏览文件 @
45b2497c
import
{
stringify
}
from
'@/utils/request.qs'
;
import
request
from
'@/utils/request'
;
//
dictiona
ry
//
product catego
ry
export
async
function
productCategoryTree
(
params
)
{
return
request
(
`/product-api/admins/category/tree?
${
stringify
(
params
)}
`
,
{
...
...
@@ -34,4 +34,12 @@ export async function productCategoryDelete(params) {
return
request
(
`/product-api/admins/category/delete?
${
stringify
(
params
)}
`
,
{
method
:
'POST'
,
});
}
// product spu
export
async
function
productSpuPage
(
params
)
{
return
request
(
`/product-api/admins/spu/page?
${
stringify
(
params
)}
`
,
{
method
:
'GET'
,
});
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductSpuVO.java
浏览文件 @
45b2497c
...
...
@@ -22,6 +22,8 @@ public class AdminsProductSpuVO {
private
Integer
cid
;
@ApiModelProperty
(
value
=
"商品主图地址的数组"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
)
private
List
<
String
>
picUrls
;
@ApiModelProperty
(
value
=
"库存数量"
,
required
=
true
,
example
=
"10"
)
private
Integer
quantity
;
// ========== 其他信息 =========
@ApiModelProperty
(
value
=
"是否上架商品(是否可见)"
,
required
=
true
,
example
=
"true"
)
...
...
@@ -101,4 +103,13 @@ public class AdminsProductSpuVO {
return
this
;
}
public
Integer
getQuantity
()
{
return
quantity
;
}
public
AdminsProductSpuVO
setQuantity
(
Integer
quantity
)
{
this
.
quantity
=
quantity
;
return
this
;
}
}
\ No newline at end of file
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductSpuBO.java
浏览文件 @
45b2497c
...
...
@@ -55,6 +55,12 @@ public class ProductSpuBO {
* 目前的计算方式是,以 Sku 最小价格为准
*/
private
Integer
price
;
/**
* 库存数量
*
* 目前的计算方式是,以 Sku 库存累加为准
*/
private
Integer
quantity
;
public
Integer
getId
()
{
return
id
;
...
...
@@ -137,4 +143,12 @@ public class ProductSpuBO {
return
this
;
}
public
Integer
getQuantity
()
{
return
quantity
;
}
public
ProductSpuBO
setQuantity
(
Integer
quantity
)
{
this
.
quantity
=
quantity
;
return
this
;
}
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java
浏览文件 @
45b2497c
...
...
@@ -40,8 +40,6 @@ public class ProductSpuDO extends BaseDO {
*/
private
String
picUrls
;
// TODO 价格库存
// TODO 运费信息
// ========== 其他信息 =========
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论