Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
def1fa67
Commit
def1fa67
authored
Apr 13, 2022
by
lxd
Browse files
Options
Browse Files
Download
Plain Diff
feat: 系统升级
parents
e69e6e7f
555a3296
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
137 additions
and
28 deletions
+137
-28
env.config.js
config/env.config.js
+7
-7
batchSetting.jsx
src/pages/GoodsManage/createModal/batchSetting.jsx
+2
-1
index.jsx
src/pages/GoodsManage/createModal/index.jsx
+64
-11
mixin.jsx
src/pages/GoodsManage/createModal/mixin.jsx
+17
-2
index.jsx
src/pages/GoodsManage/index.jsx
+24
-3
service.js
src/pages/GoodsManage/service.js
+7
-0
staticdata.js
src/pages/GoodsManage/staticdata.js
+7
-2
style.less
src/pages/GoodsManage/style.less
+1
-0
index.jsx
src/pages/components/sortablUpload/index.jsx
+8
-2
No files found.
config/env.config.js
View file @
def1fa67
...
...
@@ -2,14 +2,14 @@ const isProduction = process.env.NODE_ENV === 'production';
const
isPre
=
process
.
env
.
PRE_ENV
===
'
pre
'
;
const
envAPi
=
{
api
:
'
//backstms-
test
2.liangkebang.net
'
,
kdspOpApi
:
'
https://kdsp-operation-
test
2.liangkebang.net
'
,
kdspApi
:
'
https://sc-op-api-
test
2.liangkebang.net
'
,
goodsApi
:
'
https://sc-op-api-
test
2.liangkebang.net
'
,
// goodsApi: '//192.168.
188.111
:7000',
prologueDomain
:
'
https://mall-
test
2.liangkebang.net
'
,
api
:
'
//backstms-
gyl
2.liangkebang.net
'
,
kdspOpApi
:
'
https://kdsp-operation-
gyl
2.liangkebang.net
'
,
kdspApi
:
'
https://sc-op-api-
gyl
2.liangkebang.net
'
,
goodsApi
:
'
https://sc-op-api-
gyl
2.liangkebang.net
'
,
// goodsApi: '//192.168.
28.107
:7000',
prologueDomain
:
'
https://mall-
gyl
2.liangkebang.net
'
,
qiniuHost
:
'
https://appsync.lkbang.net
'
,
opapiHost
:
'
https://opapi-
test
2.liangkebang.net
'
,
opapiHost
:
'
https://opapi-
gyl
2.liangkebang.net
'
,
};
const
prodApi
=
{
...
...
src/pages/GoodsManage/createModal/batchSetting.jsx
View file @
def1fa67
...
...
@@ -84,6 +84,7 @@ class goodsManage extends Component {
secondSpesName
=
''
,
productType
,
isEdit
,
isService
,
}
=
this
.
props
;
return
(
<
Form
layout=
"inline"
ref=
{
this
.
formRef
}
>
...
...
@@ -159,7 +160,7 @@ class goodsManage extends Component {
</
FormItem
>
)
}
<
FormItem
>
<
Button
type=
"primary"
htmlType=
"submit"
onClick=
{
this
.
batchSetting
}
>
<
Button
type=
"primary"
htmlType=
"submit"
onClick=
{
this
.
batchSetting
}
disabled=
{
isService
}
>
批量设置
</
Button
>
</
FormItem
>
...
...
src/pages/GoodsManage/createModal/index.jsx
View file @
def1fa67
...
...
@@ -335,11 +335,11 @@ class goodsManage extends Component {
const
{
form
:
{
validateFields
},
initData
,
specListData
,
}
=
this
.
props
;
const
{
editData
,
productType
}
=
this
.
state
;
validateFields
(
async
(
errors
,
values
)
=>
{
console
.
log
(
values
);
let
imgErr
=
false
;
if
(
!
errors
)
{
if
(
validateSpuInfo
(
values
,
initData
,
editData
,
productType
))
return
;
...
...
@@ -359,6 +359,15 @@ class goodsManage extends Component {
notification
.
error
({
message
:
'
滑动图不全,请检查!
'
});
return
;
}
const
specs
=
[];
specListData
.
forEach
(
item
=>
{
if
(
values
.
hasOwnProperty
(
item
.
specId
))
{
specs
.
push
({
specId
:
item
.
specId
,
specValues
:
values
[
item
.
specId
]
||
[],
});
}
});
await
this
.
setState
(
prev
=>
({
confirmLoading
:
true
,
createData
:
{
...
...
@@ -372,6 +381,8 @@ class goodsManage extends Component {
categoryId
:
prev
.
categoryId
?
prev
.
categoryId
:
initData
?.
thirdCategoryId
,
// productType: values.productType,
type
:
values
.
productType
,
specs
,
character
:
values
.
character
,
},
}));
const
data
=
initData
.
id
...
...
@@ -450,8 +461,10 @@ class goodsManage extends Component {
};
render
()
{
const
{
visible
,
form
,
initData
=
{},
treeData
,
virtualTreeData
}
=
this
.
props
;
const
{
visible
,
form
,
initData
=
{},
treeData
,
virtualTreeData
,
specListData
}
=
this
.
props
;
const
isEdit
=
Object
.
keys
(
initData
).
length
!==
0
;
// 是否仅编辑卖点和服务
const
isService
=
initData
.
state
&&
initData
.
state
!==
4
;
const
{
getFieldDecorator
,
getFieldsValue
}
=
form
;
getFieldDecorator
(
'
firstKeys
'
,
{
initialValue
:
[]
});
getFieldDecorator
(
'
secondKeys
'
,
{
initialValue
:
[]
});
...
...
@@ -461,7 +474,7 @@ class goodsManage extends Component {
if
(
isFirstSame
)
first
.
pop
();
if
(
isSecondSame
)
second
.
pop
();
let
colorKeys
=
isEdit
?
initData
.
firstSpecList
.
concat
(
first
||
this
.
state
.
initForm
.
first
||
[])
?
initData
?.
firstSpecList
?
.
concat
(
first
||
this
.
state
.
initForm
.
first
||
[])
:
first
||
this
.
state
.
initForm
.
first
||
[];
if
(
isEdit
&&
!
Object
.
keys
(
this
.
state
.
initForm
).
length
&&
!
this
.
state
.
isCancel
)
{
...
...
@@ -492,6 +505,12 @@ class goodsManage extends Component {
if
(
isEdit
&&
!
initData
.
editData
[
0
]?.
firstSpec
&&
!
initData
.
editData
[
0
]?.
secondSpec
)
{
colorKeys
=
colorKeys
.
length
>
1
?
colorKeys
.
filter
(
item
=>
item
!==
'
null
'
)
:
colorKeys
;
}
const
optionsWithDisabled
=
[
{
label
:
'
Apple
'
,
value
:
'
Apple
'
},
{
label
:
'
Pear
'
,
value
:
'
Pear
'
},
{
label
:
'
Orange
'
,
value
:
'
Orange
'
,
disabled
:
false
},
];
return
(
<
Modal
title=
{
initData
.
id
?
'
修改商品
'
:
'
新增商品
'
}
...
...
@@ -511,7 +530,7 @@ class goodsManage extends Component {
initialValue
:
productType
,
rules
:
[{
required
:
true
,
message
:
'
请选择商品类型
'
}],
})(
<
Radio
.
Group
disabled=
{
isEdit
}
onChange=
{
this
.
bundleRadioChange
}
>
<
Radio
.
Group
disabled=
{
isEdit
||
isService
}
onChange=
{
this
.
bundleRadioChange
}
>
{
productTypeList
.
map
(
item
=>
(
<
Radio
key=
{
item
.
value
}
value=
{
item
.
value
}
disabled=
{
item
.
disabled
}
>
{
item
.
label
}
...
...
@@ -540,7 +559,7 @@ class goodsManage extends Component {
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
options=
{
treeDataArray
}
onChange=
{
(
val
,
label
,
ext
)
=>
this
.
treeChange
(
val
,
label
,
ext
)
}
// disabled=
{
isEdit
}
disabled=
{
isService
}
/>,
)
}
</
FormItem
>
...
...
@@ -569,6 +588,7 @@ class goodsManage extends Component {
style=
{
{
width
:
280
}
}
filterOption=
{
filterOption
}
placeholder=
"请选择商品品牌,支持模糊搜索"
disabled=
{
isService
}
>
{
brandListArray
?.
length
&&
brandListArray
.
map
(
item
=>
(
...
...
@@ -606,6 +626,7 @@ class goodsManage extends Component {
maxLength=
{
100
}
placeholder=
"请输入商品名称"
allowClear
disabled=
{
isService
}
/>,
)
}
</
FormItem
>
...
...
@@ -616,6 +637,31 @@ class goodsManage extends Component {
</
div
>
)
}
</
Col
>
<
Col
span=
{
24
}
>
<
FormItem
label=
"商品卖点"
labelCol=
{
{
span
:
2
}
}
>
{
getFieldDecorator
(
'
character
'
,
{
initialValue
:
initData
.
character
,
})(
<
Input
style=
{
{
width
:
690
}
}
maxLength=
{
50
}
placeholder=
"好的卖点信息有利于提高商品转化,限50字"
allowClear
/>,
)
}
</
FormItem
>
</
Col
>
{
specListData
.
length
?
specListData
.
map
((
item
,
index
)
=>
(
<
Col
span=
{
24
}
>
<
FormItem
label=
{
item
.
specName
}
labelCol=
{
{
span
:
2
}
}
>
{
getFieldDecorator
(
`${item.specId}`
,
{
initialValue
:
initData
[
item
.
specId
],
})(<
Checkbox
.
Group
options=
{
item
.
specValues
}
/>)
}
</
FormItem
>
</
Col
>
))
:
''
}
</
Row
>
</
Card
>
<
Card
className=
{
styles
.
card
}
bordered=
{
false
}
>
...
...
@@ -629,7 +675,7 @@ class goodsManage extends Component {
showSearch
style=
{
{
width
:
200
}
}
placeholder=
"请选择一级规格"
disabled=
{
isEdit
&&
initData
.
firstSpecId
}
disabled=
{
(
isEdit
&&
initData
.
firstSpecId
)
||
isService
}
onChange=
{
(
val
,
option
)
=>
this
.
specChange
(
'
first
'
,
option
?.
props
.
children
,
val
)
}
...
...
@@ -706,7 +752,7 @@ class goodsManage extends Component {
<
Select
allowClear
showSearch
disabled=
{
isEdit
&&
initData
.
secondSpecId
}
disabled=
{
(
isEdit
&&
initData
.
secondSpecId
)
||
isService
}
placeholder=
"请选择二级规格"
style=
{
{
width
:
200
}
}
onChange=
{
(
val
,
option
)
=>
this
.
specChange
(
'
second
'
,
option
?.
props
.
children
)
}
...
...
@@ -767,6 +813,7 @@ class goodsManage extends Component {
type=
"primary"
className=
{
styles
.
logBtn
}
onClick=
{
()
=>
this
.
createShopInfo
(
isEdit
)
}
disabled=
{
isService
}
>
生成商品信息
</
Button
>
...
...
@@ -784,6 +831,7 @@ class goodsManage extends Component {
productType=
{
productType
}
isEdit=
{
isEdit
}
isJDGoods=
{
isJDGoods
}
isService=
{
isService
}
/>
<
Row
>
<
Table
...
...
@@ -804,6 +852,7 @@ class goodsManage extends Component {
this
.
state
.
initForm
.
secondSpecName
,
isJDGoods
,
isEdit
,
isService
,
)
}
/>
</
Row
>
...
...
@@ -832,7 +881,7 @@ class goodsManage extends Component {
initialValue
:
this
.
state
.
initForm
.
commonImageList
,
valuePropName
:
'
fileList
'
,
getValueFromEvent
:
normFile
,
})(<
Upload
/>)
}
})(<
Upload
isDisabled=
{
isService
}
/>)
}
</
FormItem
>
</
Col
>
</
Row
>
...
...
@@ -840,7 +889,6 @@ class goodsManage extends Component {
colorKeys
.
map
(
color
=>
{
if
(
JSON
.
stringify
(
color
)
===
'
{}
'
)
return
[];
if
((
color
!==
null
&&
!
color
)
||
(
color
&&
!
color
.
trim
()))
return
[];
// if (initData.)
{}
return
[
<
Row
>
<
Col
span=
{
1
}
>
...
...
@@ -861,7 +909,12 @@ class goodsManage extends Component {
this
.
state
.
initForm
.
imageList
&&
this
.
state
.
initForm
.
imageList
[
color
],
valuePropName
:
'
fileList
'
,
getValueFromEvent
:
normFile
,
})(<
Upload
onChange=
{
val
=>
this
.
imgChange
(
val
,
color
)
}
/>)
}
})(
<
Upload
isDisabled=
{
isService
}
onChange=
{
val
=>
this
.
imgChange
(
val
,
color
)
}
/>,
)
}
<
Button
disabled=
{
colorImg
[
color
]?.
length
}
size=
"small"
...
...
@@ -898,7 +951,7 @@ class goodsManage extends Component {
message
:
'
请上传详情图
'
,
},
],
})(<
Upload
/>)
}
})(<
Upload
isDisabled=
{
isService
}
/>)
}
</
FormItem
>
</
Col
>
</
Row
>
...
...
src/pages/GoodsManage/createModal/mixin.jsx
View file @
def1fa67
...
...
@@ -213,7 +213,15 @@ export function verify(initData, categoryId) {
return
false
;
}
export
function
editColumns
(
methods
,
firstData
,
firstSpec
,
secondSpec
,
isJDGoods
,
isEdit
)
{
export
function
editColumns
(
methods
,
firstData
,
firstSpec
,
secondSpec
,
isJDGoods
,
isEdit
,
isService
,
)
{
const
{
getJdPicList
,
inputChange
,
openModal
,
productType
}
=
methods
;
if
(
!
firstData
)
return
[];
...
...
@@ -231,7 +239,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
precision=
{
2
}
min=
{
0
}
onChange=
{
value
=>
inputChange
(
value
,
'
supplyPrice
'
,
index
)
}
disabled=
{
isJDGoods
}
disabled=
{
isJDGoods
||
isService
}
/>
),
},
...
...
@@ -248,6 +256,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
precision=
{
2
}
min=
{
0
}
onChange=
{
value
=>
inputChange
(
value
,
'
marketPrice
'
,
index
)
}
disabled=
{
isService
}
/>
),
},
...
...
@@ -263,6 +272,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
precision=
{
0
}
min=
{
0
}
onChange=
{
value
=>
inputChange
(
value
,
'
productStock
'
,
index
)
}
disabled=
{
isService
}
/>
),
},
...
...
@@ -278,6 +288,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
className=
{
`thirdSkuNo ${index}`
}
defaultValue=
{
val
}
onChange=
{
evt
=>
inputChange
(
evt
.
target
.
value
,
'
thirdSkuNo
'
,
index
)
}
disabled=
{
isService
}
/>
),
},
...
...
@@ -295,6 +306,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
className=
{
`skuLink ${index}`
}
defaultValue=
{
val
}
onChange=
{
evt
=>
inputChange
(
evt
.
target
.
value
,
'
skuLink
'
,
index
)
}
disabled=
{
isService
}
/>
}
</
Popover
>
...
...
@@ -319,6 +331,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
size=
"small"
style=
{
{
marginTop
:
'
5px
'
}
}
onClick=
{
()
=>
openModal
(
row
,
index
)
}
disabled=
{
isService
}
>
修改sku名称
</
Button
>
...
...
@@ -343,6 +356,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
max=
{
999999.999
}
precision=
{
3
}
onChange=
{
value
=>
inputChange
(
value
,
'
weight
'
,
index
)
}
disabled=
{
isService
}
/>
),
});
...
...
@@ -360,6 +374,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
min=
{
0
}
precision=
{
0
}
onChange=
{
value
=>
inputChange
(
value
,
'
productStockWarning
'
,
index
)
}
disabled=
{
isService
}
/>
),
});
...
...
src/pages/GoodsManage/index.jsx
View file @
def1fa67
...
...
@@ -5,11 +5,13 @@ import React, { Component } from 'react';
import
{
PageHeaderWrapper
}
from
'
@ant-design/pro-layout
'
;
import
{
connect
}
from
'
dva
'
;
import
{
sortBy
}
from
'
lodash
'
;
import
{
da
}
from
'
date-fns/locale
'
;
import
styles
from
'
./style.less
'
;
import
LocalStroage
from
'
@/utils/localStorage
'
;
import
configApi
from
'
../../../config/env.config
'
;
import
UpdateStock
from
'
./UpdateStock
'
;
import
{
spuDetail
,
categoryList
,
getVirtualCategory
,
getTemplateList
}
from
'
./service
'
;
import
{
spuDetail
,
categoryList
,
getVirtualCategory
,
getTemplateList
,
specList
}
from
'
./service
'
;
import
LogModal
from
'
./LogModal
'
;
import
CreateModal
from
'
./createModal
'
;
import
{
column
,
JDSHOPID
}
from
'
./staticdata
'
;
...
...
@@ -33,6 +35,7 @@ class goodsManage extends Component {
updateStockVisible
:
false
,
initData
:
{},
createloading
:
false
,
specListData
:
[],
templeatModalVisible
:
false
,
selectedRowKeys
:
[],
isAll
:
0
,
...
...
@@ -49,6 +52,7 @@ class goodsManage extends Component {
this
.
props
.
goodsManage
.
tableData
=
{};
this
.
categoryList
();
this
.
getVirtualCategory
();
this
.
specList
();
}
handleSearch
=
page
=>
{
...
...
@@ -99,12 +103,13 @@ class goodsManage extends Component {
this
.
handleSearch
();
};
onUpdateInfo
=
async
({
spuId
,
productType
})
=>
{
onUpdateInfo
=
async
({
s
tate
,
s
puId
,
productType
})
=>
{
this
.
setState
({
createloading
:
true
,
});
const
{
data
,
msg
}
=
await
spuDetail
({
id
:
spuId
});
if
(
data
)
{
data
.
state
=
state
;
data
.
pageProductType
=
productType
;
data
.
categoryId
=
data
.
thirdCategoryId
;
data
.
firstSpecId
=
data
.
skuList
[
0
].
firstSpecId
;
...
...
@@ -127,7 +132,15 @@ class goodsManage extends Component {
data
.
secondSpecList
.
push
(
i
.
secondSpecValue
);
}
});
data
.
specs
.
forEach
(
item
=>
{
const
arr
=
[];
if
(
item
.
specValues
.
length
)
{
item
.
specValues
.
forEach
(
childItem
=>
{
arr
.
push
(
childItem
.
value
);
});
}
data
[
item
.
specId
]
=
arr
;
});
data
.
imageList
=
[];
data
.
carouseList
.
forEach
(
i
=>
{
data
.
imageList
[
`
${
i
.
specValue
}
`
]
=
i
.
skuSpecImageList
||
[];
...
...
@@ -253,6 +266,13 @@ class goodsManage extends Component {
}
};
specList
=
async
()
=>
{
const
data
=
await
specList
();
if
(
data
.
businessCode
===
'
0000
'
&&
data
.
data
.
length
)
{
this
.
setState
({
specListData
:
data
.
data
});
}
};
onSelectChange
=
selectedRowKeys
=>
{
this
.
setState
({
selectedRowKeys
,
...
...
@@ -348,6 +368,7 @@ class goodsManage extends Component {
shopList=
{
this
.
filterShopList
(
this
.
shopList
,
Object
.
keys
(
this
.
state
.
initData
).
length
)
}
treeData=
{
this
.
state
.
treeData
}
virtualTreeData=
{
this
.
state
.
virtualTreeData
}
specListData=
{
this
.
state
.
specListData
}
></
CreateModal
>
<
UpdateStock
...
...
src/pages/GoodsManage/service.js
View file @
def1fa67
...
...
@@ -148,6 +148,13 @@ export async function getVirtualCategory() {
});
return
data
;
}
// 查询商品属性列表
export
async
function
specList
()
{
return
request
.
get
(
'
/product/api/merchant/spec
'
,
{
prefix
:
goodsApi
,
});
}
// sku绑定模板
export
async
function
getTemplate
(
params
)
{
const
data
=
await
request
.
post
(
'
/api/kdsp/sku/template
'
,
{
...
...
src/pages/GoodsManage/staticdata.js
View file @
def1fa67
...
...
@@ -137,7 +137,12 @@ export function column() {
dataIndex
:
'
stateDesc
'
,
width
:
200
,
align
:
'
center
'
,
render
:
(
_
,
row
)
=>
<
span
>
{
row
.
state
>=
5
?
'
审核通过
'
:
_
}
<
/span>
,
render
:
(
_
,
row
)
=>
(
<
div
>
<
p
>
{
row
.
state
>=
5
?
'
审核通过
'
:
_
}
<
/p
>
<
p
>
{
row
.
updateStateDesc
||
'
_ _
'
}
<
/p
>
<
/div
>
),
},
{
title
:
'
操作
'
,
...
...
@@ -146,7 +151,7 @@ export function column() {
align
:
'
center
'
,
render
:
(
_
,
row
)
=>
(
<
div
className
=
{
styles
.
actionBtn
}
>
{
row
.
state
===
4
&&
(
{
(
row
.
state
===
4
||
(
row
.
state
===
5
&&
row
.
updateState
!==
1
))
&&
(
<
Button
key
=
"
edit
"
type
=
"
primary
"
...
...
src/pages/GoodsManage/style.less
View file @
def1fa67
...
...
@@ -85,6 +85,7 @@
}
.warning {
margin-top: -20px;
margin-bottom: 20px;
color: red;
}
...
...
src/pages/components/sortablUpload/index.jsx
View file @
def1fa67
...
...
@@ -157,7 +157,7 @@ class PicturesWall extends React.Component {
<
div
className=
"ant-upload-text"
>
上传图片
</
div
>
</
div
>
);
const
{
max
}
=
this
.
props
;
const
{
max
,
isDisabled
}
=
this
.
props
;
const
that
=
this
;
const
uploadProps
=
{
beforeUpload
:
lodash
.
debounce
(
async
(
file
,
files
)
=>
{
...
...
@@ -229,7 +229,13 @@ class PicturesWall extends React.Component {
</
ReactSortable
>
)
}
</
div
>
<
Upload
multiple
{
...
uploadProps
}
fileList=
{
fileList
}
showUploadList=
{
false
}
>
<
Upload
multiple
{
...
uploadProps
}
fileList=
{
fileList
}
showUploadList=
{
false
}
disabled=
{
isDisabled
}
>
{
max
&&
fileList
.
length
>=
max
?
null
:
uploadButton
}
</
Upload
>
<
Modal
visible=
{
previewVisible
}
footer=
{
null
}
onCancel=
{
this
.
handleCancel
}
>
...
...
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