Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
8a652c24
提交
8a652c24
authored
3月 17, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
前端:商品添加。提交部分,让小范帮忙看看~
上级
6ce040fb
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
231 行增加
和
16 行删除
+231
-16
productAttrList.js
admin-web/src/models/product/productAttrList.js
+75
-0
productSpuAddOrUpdate.js
admin-web/src/models/product/productSpuAddOrUpdate.js
+94
-0
ProductSpuAddOrUpdate.js
admin-web/src/pages/Product/ProductSpuAddOrUpdate.js
+52
-15
product.js
admin-web/src/services/product.js
+10
-1
没有找到文件。
admin-web/src/models/product/productAttrList.js
0 → 100644
浏览文件 @
8a652c24
import
{
message
}
from
'antd'
;
import
{
productSpuPage
,
productAttrTree
,
productCategoryUpdate
,
productCategoryUpdateStatus
,
productCategoryDelete
}
from
'../../services/product'
;
export
default
{
namespace
:
'productAttrList'
,
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: {},
// });
// },
*
tree
({
payload
},
{
call
,
put
})
{
const
{
queryParams
}
=
payload
;
const
response
=
yield
call
(
productAttrTree
,
queryParams
);
message
.
info
(
'查询成功!'
);
yield
put
({
type
:
'treeSuccess'
,
payload
:
{
tree
:
response
.
data
,
},
});
},
},
reducers
:
{
treeSuccess
(
state
,
{
payload
})
{
return
{
...
state
,
...
payload
,
};
},
},
};
admin-web/src/models/product/productSpuAddOrUpdate.js
0 → 100644
浏览文件 @
8a652c24
import
{
message
}
from
'antd'
;
import
{
productCategoryTree
,
productCategoryAdd
,
productCategoryUpdate
,
productCategoryUpdateStatus
,
productCategoryDelete
}
from
'../../services/product'
;
export
default
{
namespace
:
'productSpuAddOrUpdate'
,
state
:
{
list
:
[],
attrTree
:
[{
}
// {
// id: //
// name: //
// values: [{
// id: //
// name: //
// }]
// }
]
},
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: {},
// });
// },
*
addAttr
({
payload
},
{
call
,
put
})
{
// const { queryParams } = payload;
// const response = yield call(productCategoryTree, queryParams);
message
.
info
(
'调试:添加规格成功!'
);
yield
put
({
type
:
'addAttrSuccess'
,
payload
:
{
attrAdd
:
{},
},
});
},
},
reducers
:
{
addAttrSuccess
(
state
,
{
payload
})
{
// debugger;
console
.
log
(
state
.
attrTree
);
state
.
attrTree
.
push
(
payload
.
attrAdd
);
return
{
...
state
}
},
treeSuccess
(
state
,
{
payload
})
{
return
{
...
state
,
...
payload
,
};
},
},
};
admin-web/src/pages/Product/ProductSpuAddOrUpdate.js
浏览文件 @
8a652c24
...
@@ -3,19 +3,21 @@
...
@@ -3,19 +3,21 @@
import
React
,
{
PureComponent
,
Fragment
}
from
'react'
;
import
React
,
{
PureComponent
,
Fragment
}
from
'react'
;
import
{
connect
}
from
'dva'
;
import
{
connect
}
from
'dva'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
Card
,
Form
,
Input
,
Radio
,
Button
,
Table
,
Divider
}
from
'antd'
;
import
{
Card
,
Form
,
Input
,
Radio
,
Button
,
Table
,
Select
}
from
'antd'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
styles
from
'./ProductSpuAddOrUpdate.less'
;
import
styles
from
'./ProductSpuAddOrUpdate.less'
;
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
const
RadioGroup
=
Radio
.
Group
;
const
RadioGroup
=
Radio
.
Group
;
const
Option
=
Select
.
Option
;
// roleList
// roleList
@
connect
(({
productSpuList
,
loading
})
=>
({
@
connect
(({
productSpuList
,
productAttrList
,
productSpuAddOrUpdate
,
loading
})
=>
({
productSpuList
,
// list: productSpuList.list.spus,
list
:
productSpuList
.
list
.
spus
,
// loading: loading.models.productSpuList,
loading
:
loading
.
models
.
productSpuList
,
allAttrTree
:
productAttrList
.
tree
,
attrTree
:
productSpuAddOrUpdate
.
attrTree
}))
}))
@
Form
.
create
()
@
Form
.
create
()
...
@@ -31,7 +33,7 @@ class ProductSpuAddOrUpdate extends PureComponent {
...
@@ -31,7 +33,7 @@ class ProductSpuAddOrUpdate extends PureComponent {
componentDidMount
()
{
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
dispatch
({
dispatch
({
type
:
'product
SpuList/pag
e'
,
type
:
'product
AttrList/tre
e'
,
payload
:
{
payload
:
{
name
:
''
,
name
:
''
,
pageNo
:
0
,
pageNo
:
0
,
...
@@ -53,9 +55,19 @@ class ProductSpuAddOrUpdate extends PureComponent {
...
@@ -53,9 +55,19 @@ class ProductSpuAddOrUpdate extends PureComponent {
});
});
}
}
handleAddAttr
=
e
=>
{
// alert('你猜');
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'productSpuAddOrUpdate/addAttr'
,
payload
:
{
},
});
}
render
()
{
render
()
{
// debugger;
// debugger;
const
{
form
,
data
}
=
this
.
props
;
const
{
form
,
data
,
attrTree
}
=
this
.
props
;
// 规格明细
// 规格明细
const
columns
=
[
const
columns
=
[
...
@@ -76,6 +88,28 @@ class ProductSpuAddOrUpdate extends PureComponent {
...
@@ -76,6 +88,28 @@ class ProductSpuAddOrUpdate extends PureComponent {
}
}
];
];
// 添加规格
// debugger;
let
attrTreeHTML
=
[];
if
(
attrTree
&&
attrTree
.
length
>
0
)
{
for
(
let
i
in
attrTree
)
{
let
attr
=
attrTree
[
i
];
attr
=
<
div
>
<
Select
defaultValue
=
"lucy"
style
=
{{
width
:
120
}}
>
{
}
<
Option
value
=
"jack"
>
Jack
<
/Option
>
<
Option
value
=
"lucy"
>
Lucy
<
/Option
>
<
Option
value
=
"disabled"
disabled
>
Disabled
<
/Option
>
<
Option
value
=
"Yiminghe"
>
yiminghe
<
/Option
>
<
/Select
>
<
/div>
;
attrTreeHTML
.
push
(
attr
);
// debugger;
}
}
return
(
return
(
<
PageHeaderWrapper
title
=
""
>
<
PageHeaderWrapper
title
=
""
>
<
Card
bordered
=
{
false
}
>
<
Card
bordered
=
{
false
}
>
...
@@ -123,16 +157,19 @@ class ProductSpuAddOrUpdate extends PureComponent {
...
@@ -123,16 +157,19 @@ class ProductSpuAddOrUpdate extends PureComponent {
{
form
.
getFieldDecorator
(
'visible'
,
{
{
form
.
getFieldDecorator
(
'visible'
,
{
initialValue
:
1
,
// TODO 修改
initialValue
:
1
,
// TODO 修改
})(
})(
<
Button
>
添加规格项目
<
/Button
>
<
div
>
)}
{
attrTreeHTML
}
<
/FormItem
>
<
Button
onClick
=
{
this
.
handleAddAttr
}
>
添加规格项目
<
/Button
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"规格明细"
>
<
/div
>
{
form
.
getFieldDecorator
(
'visible'
,
{
initialValue
:
1
,
// TODO 修改
})(
<
Table
defaultExpandAllRows
=
{
true
}
columns
=
{
columns
}
rowKey
=
"id"
/>
)}
)}
<
/FormItem
>
<
/FormItem
>
{
/*<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="规格明细">*/
}
{
/*{form.getFieldDecorator('visible', {*/
}
{
/*initialValue: 1, // TODO 修改*/
}
{
/*})(*/
}
{
/*<Table defaultExpandAllRows={true} columns={columns} rowKey="id" />*/
}
{
/*)}*/
}
{
/*</FormItem>*/
}
<
/Form
>
<
/Form
>
<
/Card
>
<
/Card
>
<
/PageHeaderWrapper
>
<
/PageHeaderWrapper
>
...
...
admin-web/src/services/product.js
浏览文件 @
8a652c24
...
@@ -36,10 +36,18 @@ export async function productCategoryDelete(params) {
...
@@ -36,10 +36,18 @@ export async function productCategoryDelete(params) {
});
});
}
}
// product spu
// product spu
+ sku
export
async
function
productSpuPage
(
params
)
{
export
async
function
productSpuPage
(
params
)
{
return
request
(
`/product-api/admins/spu/page?
${
stringify
(
params
)}
`
,
{
return
request
(
`/product-api/admins/spu/page?
${
stringify
(
params
)}
`
,
{
method
:
'GET'
,
method
:
'GET'
,
});
});
}
}
// product attr + attr value
export
async
function
productAttrTree
(
params
)
{
return
request
(
`/product-api/admins/attr/tree?
${
stringify
(
params
)}
`
,
{
method
:
'GET'
,
});
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论