Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
e05f19dd
提交
e05f19dd
authored
5月 02, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
前端:商品编辑,部分逻辑
上级
788d6c38
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
151 行增加
和
39 行删除
+151
-39
router.config.js
admin-web/config/router.config.js
+5
-0
PicturesWall.js
admin-web/src/components/Image/PicturesWall.js
+3
-0
menu.js
admin-web/src/locales/zh-CN/menu.js
+1
-0
productAttrList.js
admin-web/src/models/product/productAttrList.js
+2
-2
productSpuAddOrUpdate.js
admin-web/src/models/product/productSpuAddOrUpdate.js
+119
-36
productSpuList.js
admin-web/src/models/product/productSpuList.js
+5
-0
ProductSpuAddOrUpdate.js
admin-web/src/pages/Product/ProductSpuAddOrUpdate.js
+0
-0
ProductSpuList.js
admin-web/src/pages/Product/ProductSpuList.js
+10
-1
product.js
admin-web/src/services/product.js
+6
-0
没有找到文件。
admin-web/config/router.config.js
浏览文件 @
e05f19dd
...
...
@@ -92,6 +92,11 @@ export default [
name
:
'product-spu-add'
,
component
:
'./Product/ProductSpuAddOrUpdate'
,
},
{
path
:
'/product/product-spu-update'
,
name
:
'product-spu-update'
,
component
:
'./Product/ProductSpuAddOrUpdate'
,
},
{
path
:
'/product/product-category-list'
,
name
:
'product-category-list'
,
...
...
admin-web/src/components/Image/PicturesWall.js
浏览文件 @
e05f19dd
...
...
@@ -6,6 +6,9 @@ import {Icon, Modal, Upload} from "antd";
import
styles
from
'./PicturesWall.less'
;
/**
* 照片墙,带有上传图片到七牛。
*/
class
PicturesWall
extends
React
.
Component
{
state
=
{
token
:
undefined
,
// 七牛 token
...
...
admin-web/src/locales/zh-CN/menu.js
浏览文件 @
e05f19dd
...
...
@@ -48,6 +48,7 @@ export default {
'menu.product'
:
'商品管理'
,
'menu.product.product-spu-list'
:
'商品管理'
,
'menu.product.product-spu-add'
:
'商品添加'
,
'menu.product.product-spu-update'
:
'商品编辑'
,
'menu.product.product-category-list'
:
'商品分类'
,
// 订单
'menu.order'
:
'订单管理'
,
...
...
admin-web/src/models/product/productAttrList.js
浏览文件 @
e05f19dd
import
{
message
}
from
'antd'
;
import
{
product
SpuPage
,
productAttrTree
,
productCategoryUpdate
,
productCategoryUpdateStatus
,
productCategoryDelet
e
}
from
'../../services/product'
;
import
{
product
AttrTre
e
}
from
'../../services/product'
;
export
default
{
namespace
:
'productAttrList'
,
...
...
@@ -54,7 +54,7 @@ export default {
*
tree
({
payload
},
{
call
,
put
})
{
const
{
queryParams
}
=
payload
;
const
response
=
yield
call
(
productAttrTree
,
queryParams
);
message
.
info
(
'查询成功!'
);
//
message.info('查询成功!');
yield
put
({
type
:
'treeSuccess'
,
payload
:
{
...
...
admin-web/src/models/product/productSpuAddOrUpdate.js
浏览文件 @
e05f19dd
import
{
message
}
from
'antd'
;
import
{
productCategoryTree
,
productSpuAdd
,
productCategoryUpdate
,
productCategoryUpdateStatus
,
productCategoryDelete
}
from
'../../services/product'
;
import
{
productCategoryTree
,
productSpuAdd
,
productCategoryUpdate
,
productCategoryUpdateStatus
,
productCategoryDelete
,
productSpuInfo
}
from
'../../services/product'
;
export
default
{
namespace
:
'productSpuAddOrUpdate'
,
state
:
{
list
:
[],
attrTree
:
[
// list: [],
loading
:
false
,
spu
:
{
// 商品 SPU
},
attrTree
:
[
// 商品规格
// {
// id: //
// name: //
...
...
@@ -16,7 +28,7 @@ export default {
// }]
// }
],
skus
:
[
skus
:
[
// 商品 SKU
// {
// attrs: [{
// id: // 规格值编号
...
...
@@ -29,17 +41,6 @@ export default {
},
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);
...
...
@@ -51,25 +52,87 @@ export default {
// 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: {},
// });
// },
*
info
({
payload
},
{
call
,
put
})
{
// 显示加载中
yield
put
({
type
:
'changeLoading'
,
payload
:
true
,
});
// 请求
const
response
=
yield
call
(
productSpuInfo
,
{
id
:
payload
,
});
// 响应
let
skus
=
[];
let
attrTree
=
[];
// SKU
for
(
let
i
in
response
.
data
.
skus
)
{
let
sku
=
response
.
data
.
skus
[
i
];
// 处理 sku
{
let
attrs
=
[];
for
(
let
j
in
sku
.
attrs
)
{
let
attr
=
sku
.
attrs
[
j
];
attrs
.
push
({
id
:
attr
.
attrValueId
,
name
:
attr
.
attrValueName
,
});
}
let
newSku
=
{
...
sku
,
attrs
,
};
skus
.
push
(
newSku
);
}
// 处理 attrTree
{
for
(
let
j
in
sku
.
attrs
)
{
// debugger;
let
attr
=
sku
.
attrs
[
j
];
let
attrTreeNode
=
undefined
;
for
(
let
k
in
attrTree
)
{
let
item
=
attrTree
[
k
];
if
(
item
.
id
===
attr
.
attrId
)
{
attrTreeNode
=
item
;
break
;
}
}
if
(
!
attrTreeNode
)
{
attrTreeNode
=
{
id
:
attr
.
attrId
,
name
:
attr
.
attrName
,
values
:
[{
id
:
attr
.
attrValueId
,
name
:
attr
.
attrValueName
,
}]
};
attrTree
.
push
(
attrTreeNode
);
}
else
{
// let values = attrTreeNode.values;
// for (let k in ) {
//
// }
}
}
}
}
// debugger;
yield
put
({
type
:
'setAll'
,
payload
:
{
spu
:
response
.
data
,
skus
:
skus
,
attrTree
:
attrTree
,
},
});
// 隐藏加载中
yield
put
({
type
:
'changeLoading'
,
payload
:
false
,
});
},
*
addAttr
({
payload
},
{
call
,
put
})
{
// const { queryParams } = payload;
// const response = yield call(productCategoryTree, queryParams);
...
...
@@ -212,11 +275,31 @@ export default {
...
state
}
},
treeSuccess
(
state
,
{
payload
})
{
clear
(
state
,
{
payload
})
{
return
{
...
state
,
...
payload
,
skus
:
[],
attrTree
:
[],
}
},
changeLoading
(
state
,
{
payload
})
{
return
{
...
state
,
listLoading
:
payload
,
};
},
// 设置所有属性
setAll
(
state
,
{
payload
})
{
return
{
...
state
,
...
payload
,
};
}
// treeSuccess(state, { payload }) {
// return {
// ...state,
// ...payload,
// };
// },
},
};
admin-web/src/models/product/productSpuList.js
浏览文件 @
e05f19dd
...
...
@@ -55,6 +55,11 @@ export default {
// const { callback, body } = payload;
yield
put
(
routerRedux
.
replace
(
'/product/product-spu-add'
));
},
*
redirectToUpdate
({
payload
},
{
call
,
put
})
{
// const { callback, body } = payload;
debugger
;
yield
put
(
routerRedux
.
replace
(
'/product/product-spu-update?id='
+
payload
));
},
*
page
({
payload
},
{
call
,
put
})
{
// const { queryParams } = payload;
const
response
=
yield
call
(
productSpuPage
,
payload
);
...
...
admin-web/src/pages/Product/ProductSpuAddOrUpdate.js
浏览文件 @
e05f19dd
差异被折叠。
点击展开。
admin-web/src/pages/Product/ProductSpuList.js
浏览文件 @
e05f19dd
...
...
@@ -47,6 +47,14 @@ class ProductSpuList extends PureComponent {
});
};
redirectToUpdate
=
(
spuId
)
=>
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'productSpuList/redirectToUpdate'
,
payload
:
spuId
,
});
};
render
()
{
// debugger;
const
{
list
,
data
}
=
this
.
props
;
...
...
@@ -103,7 +111,8 @@ class ProductSpuList extends PureComponent {
width
:
200
,
render
:
(
text
,
record
)
=>
(
<
Fragment
>
<
a
onClick
=
{()
=>
this
.
handleModalVisible
(
true
,
'update'
,
record
)}
>
更新
<
/a
>
{
/*<a onClick={() => this.handleModalVisible(true, 'update', record)}>更新</a>*/
}
<
a
onClick
=
{()
=>
this
.
redirectToUpdate
(
record
.
id
)}
>
更新
<
/a
>
<
/Fragment
>
),
},
...
...
admin-web/src/services/product.js
浏览文件 @
e05f19dd
...
...
@@ -52,6 +52,12 @@ export async function productSpuAdd(params) {
});
}
export
async
function
productSpuInfo
(
params
)
{
return
request
(
`/product-api/admins/spu/info?
${
stringify
(
params
)}
`
,
{
method
:
'GET'
,
});
}
// product attr + attr value
export
async
function
productAttrTree
(
params
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论