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
82902dc9
Commit
82902dc9
authored
Apr 11, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20230327_public_takeaway' into feature/20230315_take_out_goods
parents
910a4dce
3158d3a5
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
343 additions
and
198 deletions
+343
-198
index.jsx
src/pages/GoodsManage/SearchForm/index.jsx
+0
-1
GoodsGroup.jsx
src/pages/GoodsManage/Takeaway/components/GoodsGroup.jsx
+7
-3
index.jsx
src/pages/GoodsManage/Takeaway/index.jsx
+19
-6
staticdata.js
src/pages/GoodsManage/staticdata.js
+9
-0
style.less
src/pages/GoodsManage/style.less
+1
-1
AddRepertoryModal.jsx
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
+1
-1
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+86
-53
config.js
src/pages/ServiceGoods/config.js
+28
-31
index.jsx
src/pages/ServiceGoods/index.jsx
+28
-9
utils.js
src/pages/ServiceGoods/utils.js
+14
-12
data.js
src/pages/businessManage/info/data.js
+15
-5
index.jsx
src/pages/businessManage/info/index.jsx
+41
-15
storeModal.jsx
src/pages/chainStoreManage/components/storeModal.jsx
+52
-30
data.js
src/pages/chainStoreManage/data.js
+0
-7
index.jsx
src/pages/chainStoreManage/index.jsx
+27
-9
utils.js
src/utils/utils.js
+15
-15
No files found.
src/pages/GoodsManage/SearchForm/index.jsx
View file @
82902dc9
...
@@ -172,7 +172,6 @@ class goodsManage extends Component {
...
@@ -172,7 +172,6 @@ class goodsManage extends Component {
<
FormItem
label=
"商品类型"
name=
"productType"
>
<
FormItem
label=
"商品类型"
name=
"productType"
>
<
Select
style=
{
selectW
}
placeholder=
"请选择商品类型"
onChange=
{
this
.
onChangeProductType
}
>
<
Select
style=
{
selectW
}
placeholder=
"请选择商品类型"
onChange=
{
this
.
onChangeProductType
}
>
<
Option
value=
{
1
}
>
实体商品
</
Option
>
<
Option
value=
{
1
}
>
实体商品
</
Option
>
<
Option
value=
{
2
}
>
虚拟商品
</
Option
>
<
Option
value=
{
4
}
>
服务类商品
</
Option
>
<
Option
value=
{
4
}
>
服务类商品
</
Option
>
<
Option
value=
{
5
}
>
外卖商品
</
Option
>
<
Option
value=
{
5
}
>
外卖商品
</
Option
>
</
Select
>
</
Select
>
...
...
src/pages/GoodsManage/Takeaway/components/GoodsGroup.jsx
View file @
82902dc9
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
,
forwardRef
,
useImperativeHandle
}
from
'
react
'
;
import
{
Button
,
Select
,
Tag
}
from
'
antd
'
;
import
{
Button
,
Select
,
Tag
}
from
'
antd
'
;
import
{
DndProvider
}
from
'
react-dnd
'
;
import
{
DndProvider
}
from
'
react-dnd
'
;
import
HTML5Backend
from
'
react-dnd-html5-backend
'
;
import
HTML5Backend
from
'
react-dnd-html5-backend
'
;
...
@@ -8,7 +8,7 @@ import InsertTag from './InsertTag';
...
@@ -8,7 +8,7 @@ import InsertTag from './InsertTag';
import
GroupInfo
from
'
./GroupInfo
'
;
import
GroupInfo
from
'
./GroupInfo
'
;
import
{
apiDelStorage
,
apiSortStorage
,
apiStorageList
,
apiSupplierShopList
}
from
'
../../service
'
;
import
{
apiDelStorage
,
apiSortStorage
,
apiStorageList
,
apiSupplierShopList
}
from
'
../../service
'
;
const
GoodsGroup
=
options
=>
{
const
GoodsGroup
=
forwardRef
((
options
,
ref
)
=>
{
const
[
groupEdit
,
setGroupEdit
]
=
useState
(
false
);
const
[
groupEdit
,
setGroupEdit
]
=
useState
(
false
);
const
[
selected
,
setSelected
]
=
useState
(
0
);
const
[
selected
,
setSelected
]
=
useState
(
0
);
const
[
storageId
,
setStorageId
]
=
useState
(
0
);
const
[
storageId
,
setStorageId
]
=
useState
(
0
);
...
@@ -110,6 +110,10 @@ const GoodsGroup = options => {
...
@@ -110,6 +110,10 @@ const GoodsGroup = options => {
options
.
changeGroup
(
selected
);
options
.
changeGroup
(
selected
);
},
[
selected
]);
},
[
selected
]);
useImperativeHandle
(
ref
,
()
=>
({
setSelected
,
}));
return
(
return
(
<
div
className=
{
styles
.
groupBox
}
>
<
div
className=
{
styles
.
groupBox
}
>
{
(
shops
&&
shops
.
length
&&
(
{
(
shops
&&
shops
.
length
&&
(
...
@@ -182,6 +186,6 @@ const GoodsGroup = options => {
...
@@ -182,6 +186,6 @@ const GoodsGroup = options => {
/>
/>
</
div
>
</
div
>
);
);
};
}
)
;
export
default
GoodsGroup
;
export
default
GoodsGroup
;
src/pages/GoodsManage/Takeaway/index.jsx
View file @
82902dc9
import
React
,
{
useState
,
useEffect
,
use
Callback
,
useMemo
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
,
use
Ref
}
from
'
react
'
;
import
{
Spin
,
Table
,
Pagination
,
message
,
notification
}
from
'
antd
'
;
import
{
Spin
,
Table
,
Pagination
,
message
,
notification
}
from
'
antd
'
;
import
{
unstable_batchedUpdates
}
from
'
react-dom
'
;
import
{
unstable_batchedUpdates
}
from
'
react-dom
'
;
import
{
SortableContainer
,
SortableElement
,
SortableHandle
}
from
'
react-sortable-hoc
'
;
import
{
SortableContainer
,
SortableElement
,
SortableHandle
}
from
'
react-sortable-hoc
'
;
...
@@ -39,6 +39,8 @@ const Takeaway = options => {
...
@@ -39,6 +39,8 @@ const Takeaway = options => {
const
[
visibleSwitchGroup
,
setVisibleSwitchGroup
]
=
useState
(
false
);
const
[
visibleSwitchGroup
,
setVisibleSwitchGroup
]
=
useState
(
false
);
const
[
scribeToken
,
setScribeToken
]
=
useState
(
''
);
const
[
scribeToken
,
setScribeToken
]
=
useState
(
''
);
const
groupRef
=
useRef
(
null
);
const
rowSelection
=
{
const
rowSelection
=
{
selectedRowKeys
,
selectedRowKeys
,
onChange
:
setSelectedRowKeys
,
onChange
:
setSelectedRowKeys
,
...
@@ -176,7 +178,8 @@ const Takeaway = options => {
...
@@ -176,7 +178,8 @@ const Takeaway = options => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
groupId
)
{
if
(
groupId
)
{
getDataList
(
0
,
pageSize
);
setPageNo
(
1
);
getDataList
(
1
,
pageSize
);
}
else
{
}
else
{
setTableData
([]);
setTableData
([]);
}
}
...
@@ -184,11 +187,16 @@ const Takeaway = options => {
...
@@ -184,11 +187,16 @@ const Takeaway = options => {
useEffect
(()
=>
{
useEffect
(()
=>
{
const
stoken
=
PubSub
.
subscribe
(
'
refreshTakeAway
'
,
(
_
,
data
)
=>
{
const
stoken
=
PubSub
.
subscribe
(
'
refreshTakeAway
'
,
(
_
,
data
)
=>
{
setShopId
(
data
.
shopId
);
console
.
log
(
'
refreshTakeAway :>>
'
,
data
);
setGroupId
(
data
.
groupId
);
if
(
data
.
groupId
&&
groupId
!==
data
.
groupId
)
{
getDataList
(
0
,
pageSize
,
data
.
groupId
);
setGroupId
(
data
.
groupId
);
if
(
groupRef
.
current
)
{
groupRef
.
current
.
setSelected
(
`
${
data
.
groupId
}
`
);
}
}
});
});
setScribeToken
(
stoken
);
setScribeToken
(
stoken
);
return
()
=>
{
return
()
=>
{
PubSub
.
unsubscribe
(
scribeToken
);
PubSub
.
unsubscribe
(
scribeToken
);
};
};
...
@@ -208,7 +216,12 @@ const Takeaway = options => {
...
@@ -208,7 +216,12 @@ const Takeaway = options => {
return
(
return
(
<
div
className=
{
styles
.
takeawayBox
}
>
<
div
className=
{
styles
.
takeawayBox
}
>
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
GoodsGroup
shopId=
{
shopId
}
changeShop=
{
setShopId
}
changeGroup=
{
setGroupId
}
/>
<
GoodsGroup
ref=
{
groupRef
}
shopId=
{
shopId
}
changeShop=
{
setShopId
}
changeGroup=
{
setGroupId
}
/>
{
(
shopId
&&
(
{
(
shopId
&&
(
<
ActionBar
<
ActionBar
selectedRowKeys=
{
selectedRowKeys
}
selectedRowKeys=
{
selectedRowKeys
}
...
...
src/pages/GoodsManage/staticdata.js
View file @
82902dc9
...
@@ -8,6 +8,15 @@ import { apiChangeStateGoods, apiGoodsActionBatch } from './service';
...
@@ -8,6 +8,15 @@ import { apiChangeStateGoods, apiGoodsActionBatch } from './service';
const
{
confirm
}
=
Modal
;
const
{
confirm
}
=
Modal
;
export
const
NormalProduct
=
1
;
export
const
ServiceProduct
=
4
;
export
const
TakeawayProduct
=
5
;
export
const
GoodTypes
=
{
[
NormalProduct
]:
'
实体商品
'
,
[
ServiceProduct
]:
'
服务类商品
'
,
[
TakeawayProduct
]:
'
外卖商品
'
,
};
export
const
productType
=
[
export
const
productType
=
[
{
{
value
:
1
,
value
:
1
,
...
...
src/pages/GoodsManage/style.less
View file @
82902dc9
...
@@ -139,7 +139,7 @@
...
@@ -139,7 +139,7 @@
.takeawayBox {
.takeawayBox {
margin-top: 20px;
margin-top: 20px;
padding-bottom:
4
0px;
padding-bottom:
2
0px;
background-color: #fff;
background-color: #fff;
&--page {
&--page {
padding-top: 10px;
padding-top: 10px;
...
...
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
View file @
82902dc9
...
@@ -149,7 +149,7 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -149,7 +149,7 @@ const AddRepertoryModal = (props, ref) => {
name=
"maxStock"
name=
"maxStock"
label=
"最大库存"
label=
"最大库存"
rules=
{
[
rules=
{
[
{
required
:
isRequired
,
message
:
'
请填写最大库存
'
},
{
required
:
!
isRequired
,
message
:
'
请填写最大库存
'
},
{
{
validator
:
isIntegerNotZero
,
validator
:
isIntegerNotZero
,
type
:
'
number
'
,
type
:
'
number
'
,
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
82902dc9
This diff is collapsed.
Click to expand it.
src/pages/ServiceGoods/config.js
View file @
82902dc9
...
@@ -7,7 +7,7 @@ export const formItemLayout = {
...
@@ -7,7 +7,7 @@ export const formItemLayout = {
},
},
};
};
export
const
TaskList
=
(
canAddService
,
canAddNormal
)
=>
[
export
const
TaskList
=
(
canAddService
,
canAddNormal
,
canTakeawayService
)
=>
[
{
{
name
:
'
实体商品
'
,
name
:
'
实体商品
'
,
type
:
1
,
type
:
1
,
...
@@ -33,31 +33,31 @@ export const TaskList = (canAddService, canAddNormal) => [
...
@@ -33,31 +33,31 @@ export const TaskList = (canAddService, canAddNormal) => [
},
},
},
},
},
},
{
//
{
name
:
'
虚拟商品
'
,
//
name: '虚拟商品',
type
:
2
,
//
type: 2,
desc
:
'
无需物流
'
,
//
desc: '无需物流',
hide
:
!
canAddNormal
,
//
hide: !canAddNormal,
imgConfig
:
{
//
imgConfig: {
commonImageList
:
{
//
commonImageList: {
title
:
'
公共滑动图
'
,
//
title: '公共滑动图',
rule
:
false
,
//
rule: false,
limit
:
null
,
//
limit: null,
renderExtra
:
()
=>
'
(图片最大上传2M)
'
,
//
renderExtra: () => '(图片最大上传2M)',
},
//
},
imageList
:
{
//
imageList: {
rule
:
false
,
//
rule: false,
limit
:
null
,
//
limit: null,
renderExtra
:
()
=>
'
(图片最大上传2M)
'
,
//
renderExtra: () => '(图片最大上传2M)',
},
//
},
detailImageList
:
{
//
detailImageList: {
title
:
'
详情图
'
,
//
title: '详情图',
rule
:
true
,
//
rule: true,
limit
:
null
,
//
limit: null,
renderExtra
:
()
=>
'
(图片最大上传2M)
'
,
//
renderExtra: () => '(图片最大上传2M)',
},
//
},
},
//
},
},
//
},
{
{
name
:
'
服务类商品
'
,
name
:
'
服务类商品
'
,
type
:
4
,
type
:
4
,
...
@@ -94,7 +94,7 @@ export const TaskList = (canAddService, canAddNormal) => [
...
@@ -94,7 +94,7 @@ export const TaskList = (canAddService, canAddNormal) => [
name
:
'
外卖商品
'
,
name
:
'
外卖商品
'
,
type
:
5
,
type
:
5
,
desc
:
'
无需物流
'
,
desc
:
'
无需物流
'
,
// hide: !canAdd
Service,
hide
:
!
canTakeaway
Service
,
imgConfig
:
{
imgConfig
:
{
commonImageList
:
{
commonImageList
:
{
title
:
'
封面图片
'
,
title
:
'
封面图片
'
,
...
@@ -324,10 +324,7 @@ export const StaticColumns = customer => [
...
@@ -324,10 +324,7 @@ export const StaticColumns = customer => [
},
},
];
];
export
const
ENUM_REPERTORY
=
[{
label
:
'
单规格
'
,
value
:
'
1
'
},
{
label
:
'
多规格
'
,
value
:
'
2
'
}];
export
const
ENUM_REPERTORY
=
[{
label
:
'
单规格
'
,
value
:
'
1
'
},
{
label
:
'
多规格
'
,
value
:
'
2
'
}];
export
const
ENUM_SET_REPERTORY
=
[
export
const
ENUM_SET_REPERTORY
=
[{
label
:
'
清零
'
,
value
:
'
0
'
},
{
label
:
'
最大
'
,
value
:
'
1
'
}];
{
label
:
'
清零
'
,
value
:
'
0
'
},
{
label
:
'
最大
'
,
value
:
'
1
'
},
];
export
const
ENUM_WEEK
=
[
export
const
ENUM_WEEK
=
[
{
value
:
'
1
'
,
label
:
'
周一
'
},
{
value
:
'
1
'
,
label
:
'
周一
'
},
{
value
:
'
2
'
,
label
:
'
周二
'
},
{
value
:
'
2
'
,
label
:
'
周二
'
},
...
...
src/pages/ServiceGoods/index.jsx
View file @
82902dc9
import
React
,
{
useState
,
useRef
,
useEffect
,
useCallback
,
useMemo
}
from
'
react
'
;
import
React
,
{
useState
,
useRef
,
useEffect
,
useCallback
,
useMemo
}
from
'
react
'
;
import
{
Spin
,
Button
,
Modal
,
message
,
notification
}
from
'
antd
'
;
import
{
Spin
,
Button
,
Modal
,
message
,
notification
}
from
'
antd
'
;
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
import
PubSub
from
'
pubsub-js
'
;
import
{
Title
,
WrapperContainer
}
from
'
./components/CommonTemplate
'
;
import
{
Title
,
WrapperContainer
}
from
'
./components/CommonTemplate
'
;
import
{
TaskTypeSelect
}
from
'
./components/TaskTypeSelect
'
;
import
{
TaskTypeSelect
}
from
'
./components/TaskTypeSelect
'
;
import
FormInformationBasic
from
'
./components/FormInformationBasic
'
;
import
FormInformationBasic
from
'
./components/FormInformationBasic
'
;
...
@@ -45,7 +46,7 @@ const ServiceGoods = options => {
...
@@ -45,7 +46,7 @@ const ServiceGoods = options => {
}
=
options
;
}
=
options
;
const
canAddService
=
permissions
[
GOOD_MANAGE
.
ADD_SERVICE_GOODS
];
const
canAddService
=
permissions
[
GOOD_MANAGE
.
ADD_SERVICE_GOODS
];
const
canAddNormal
=
permissions
[
GOOD_MANAGE
.
ADD_NORMAL_GOODS
];
const
canAddNormal
=
permissions
[
GOOD_MANAGE
.
ADD_NORMAL_GOODS
];
//
const canTakeawayService = permissions[GOOD_MANAGE.ADD_TAKEAWAY_GOODS];
const
canTakeawayService
=
permissions
[
GOOD_MANAGE
.
ADD_TAKEAWAY_GOODS
];
// const canTakeawayService = true
// const canTakeawayService = true
const
basicRef
=
useRef
(
null
);
const
basicRef
=
useRef
(
null
);
const
stockRef
=
useRef
(
null
);
const
stockRef
=
useRef
(
null
);
...
@@ -59,7 +60,9 @@ const ServiceGoods = options => {
...
@@ -59,7 +60,9 @@ const ServiceGoods = options => {
const
[
categoryIds
,
setCategoryIds
]
=
useState
([]);
// 商品品类ID
const
[
categoryIds
,
setCategoryIds
]
=
useState
([]);
// 商品品类ID
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
);
// 是否是编辑状态
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
);
// 是否是编辑状态
const
[
isUseCache
,
setIsUseCache
]
=
useState
(
false
);
// 是否使用缓存
const
[
isUseCache
,
setIsUseCache
]
=
useState
(
false
);
// 是否使用缓存
const
[
productType
,
setProductType
]
=
useState
(
canAddNormal
?
1
:
4
);
// 商品状态
let
ptype
=
canTakeawayService
?
5
:
4
;
ptype
=
canAddNormal
?
1
:
ptype
;
const
[
productType
,
setProductType
]
=
useState
(
ptype
);
// 商品状态
const
[
pageLoading
,
setPageLoading
]
=
useState
(
false
);
// 页面加载状态
const
[
pageLoading
,
setPageLoading
]
=
useState
(
false
);
// 页面加载状态
const
[
afterAddressList
,
setAfterAddressList
]
=
useState
([]);
// 售后地址
const
[
afterAddressList
,
setAfterAddressList
]
=
useState
([]);
// 售后地址
const
[
supplierIdList
,
setSupplierIdList
]
=
useState
([]);
// 适用们店列表
const
[
supplierIdList
,
setSupplierIdList
]
=
useState
([]);
// 适用们店列表
...
@@ -159,25 +162,41 @@ const ServiceGoods = options => {
...
@@ -159,25 +162,41 @@ const ServiceGoods = options => {
const
onResetData
=
refresh
=>
{
const
onResetData
=
refresh
=>
{
setPageId
(
null
);
setPageId
(
null
);
setIsEdit
(
false
);
setIsEdit
(
false
);
setProductType
(
canAddNormal
?
1
:
4
);
setProductType
(
ptype
);
setEditData
({});
setEditData
({});
setSpecKeyList
([]);
setSpecKeyList
([]);
resetForm
();
resetForm
();
options
.
onChange
(
false
,
refresh
);
options
.
onChange
(
false
,
refresh
);
};
};
const
handleCancel
=
refresh
=>
{
const
refreshPageList
=
(
refresh
,
sendData
)
=>
{
onResetData
(
refresh
);
// 新增外卖商品 关闭之后列表到跳转对应分组的下
if
(
!
isEdit
&&
sendData
&&
+
sendData
.
type
===
5
&&
sendData
.
storageRackIds
&&
sendData
.
storageRackIds
.
length
>
0
)
{
PubSub
.
publish
(
'
refreshTakeAway
'
,
{
groupId
:
sendData
.
storageRackIds
[
0
],
});
}
};
const
handleCancel
=
(
refresh
,
sendData
)
=>
{
const
info
=
localStorage
.
get
(
localAutoSaveKey
);
const
info
=
localStorage
.
get
(
localAutoSaveKey
);
if
(
info
&&
Object
.
keys
(
info
).
length
>
1
)
{
if
(
info
&&
Object
.
keys
(
info
).
length
>
1
)
{
Modal
.
confirm
({
Modal
.
confirm
({
title
:
'
确认提示
'
,
title
:
'
确认提示
'
,
content
:
'
商品信息还未保存,确认关闭弹窗?
'
,
content
:
'
商品信息还未保存,确认关闭弹窗?
'
,
onOk
()
{
onOk
()
{
onResetData
(
refresh
);
refreshPageList
(
refresh
,
sendData
);
},
},
});
});
}
else
{
}
else
{
onResetData
(
refresh
);
refreshPageList
(
refresh
,
sendData
);
}
}
};
};
...
@@ -210,7 +229,7 @@ const ServiceGoods = options => {
...
@@ -210,7 +229,7 @@ const ServiceGoods = options => {
if
(
addResponse
.
data
)
{
if
(
addResponse
.
data
)
{
message
.
success
(
`
${
isEdit
?
'
修改
'
:
'
添加
'
}
成功!`
);
message
.
success
(
`
${
isEdit
?
'
修改
'
:
'
添加
'
}
成功!`
);
localStorage
.
remove
(
localAutoSaveKey
);
localStorage
.
remove
(
localAutoSaveKey
);
handleCancel
(
true
);
handleCancel
(
true
,
sendData
);
}
}
setPageLoading
(
false
);
setPageLoading
(
false
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -371,7 +390,7 @@ const ServiceGoods = options => {
...
@@ -371,7 +390,7 @@ const ServiceGoods = options => {
},
[
isEdit
,
options
.
visible
]);
},
[
isEdit
,
options
.
visible
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
setProductType
(
canAddNormal
?
1
:
4
);
setProductType
(
ptype
);
},
[
canAddNormal
]);
},
[
canAddNormal
]);
const
onSpecCommonImgEvent
=
useCallback
(
const
onSpecCommonImgEvent
=
useCallback
(
...
@@ -478,7 +497,7 @@ const ServiceGoods = options => {
...
@@ -478,7 +497,7 @@ const ServiceGoods = options => {
productType
,
productType
,
canAddService
,
// 是否可以添加服务商品(电子卡券)
canAddService
,
// 是否可以添加服务商品(电子卡券)
canAddNormal
,
// 是否可以添加实物商品
canAddNormal
,
// 是否可以添加实物商品
//
canTakeawayService, // 是否可以添加外卖商品
canTakeawayService
,
// 是否可以添加外卖商品
isCard
:
productType
===
4
,
isCard
:
productType
===
4
,
isTakeawayService
:
productType
===
5
,
isTakeawayService
:
productType
===
5
,
// 0, "商品删除" 1, "新建" 2, "提交审核" 3, "待审核" 4, "驳回" 5, "未上架" 6, "已上架" 7, "已下架"
// 0, "商品删除" 1, "新建" 2, "提交审核" 3, "待审核" 4, "驳回" 5, "未上架" 6, "已上架" 7, "已下架"
...
...
src/pages/ServiceGoods/utils.js
View file @
82902dc9
...
@@ -114,12 +114,12 @@ export const filterSendData = (type, params) => {
...
@@ -114,12 +114,12 @@ export const filterSendData = (type, params) => {
// 外卖商品
// 外卖商品
if
(
type
===
5
)
{
if
(
type
===
5
)
{
const
temp
=
Object
.
assign
({},
takeawayItem
?.
intactData
,
infoMation
);
const
temp
=
Object
.
assign
({},
takeawayItem
?.
intactData
,
infoMation
);
const
deepTemp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
))
const
deepTemp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
))
;
deepTemp
.
categoryId
=
deepTemp
.
categoryId
=
Array
.
isArray
(
deepTemp
.
categoryId
)
&&
Array
.
isArray
(
deepTemp
.
categoryId
)
&&
deepTemp
.
categoryId
?.
slice
(
deepTemp
.
categoryId
?.
length
-
1
)?.
toString
();
deepTemp
.
categoryId
?.
slice
(
deepTemp
.
categoryId
?.
length
-
1
)?.
toString
();
deepTemp
.
productRefShopId
=
deepTemp
.
productRefShopId
.
toString
();
deepTemp
.
productRefShopId
=
deepTemp
.
productRefShopId
.
toString
();
const
tempWeightName
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'
weightUnits
'
));
const
tempWeightName
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'
weightUnits
'
));
deepTemp
.
items
.
forEach
(
item
=>
{
deepTemp
.
items
.
forEach
(
item
=>
{
item
.
autoStock
=
item
.
autoStock
?
1
:
0
;
item
.
autoStock
=
item
.
autoStock
?
1
:
0
;
...
@@ -127,8 +127,8 @@ export const filterSendData = (type, params) => {
...
@@ -127,8 +127,8 @@ export const filterSendData = (type, params) => {
item
.
productStock
=
item
?.
serviceItem
?.
productStock
;
item
.
productStock
=
item
?.
serviceItem
?.
productStock
;
item
.
list
=
deepTemp
.
list
;
item
.
list
=
deepTemp
.
list
;
if
(
item
?.
specs
?.
length
)
{
if
(
item
?.
specs
?.
length
)
{
item
?
.
specs
.
forEach
(
itm
=>
{
item
.
specs
.
forEach
(
itm
=>
{
if
(
tempWeightName
.
includes
(
itm
.
unit
))
{
if
(
itm
?.
unit
&&
tempWeightName
.
includes
(
itm
?
.
unit
))
{
itm
.
quantity
=
itm
.
quantity
=
`
${
itm
?.
quantity
}
`.indexOf('约') > -1 ? itm?.quantity : `
约
$
{
itm
?.
quantity
}
`;
`
${
itm
?.
quantity
}
`.indexOf('约') > -1 ? itm?.quantity : `
约
$
{
itm
?.
quantity
}
`;
}
}
...
@@ -136,15 +136,17 @@ export const filterSendData = (type, params) => {
...
@@ -136,15 +136,17 @@ export const filterSendData = (type, params) => {
}
}
});
});
deepTemp.specList &&
deepTemp.specList &&
deepTemp.specList.forEach(item => {
deepTemp.specList.forEach(item => {
if (item?.specs?.length) {
if (item?.specs?.length) {
item?.specs.forEach(itm => {
item.specs.forEach(itm => {
itm.unit =
if (itm?.unit) {
(Array.isArray(itm.unit) &&
itm.unit =
itm.unit?.length >= 2 &&
(Array.isArray(itm?.unit) &&
itm.unit?.splice(itm.unit?.length - 1)[0]) ||
itm?.unit?.length >= 2 &&
itm.unit;
itm?.unit?.splice(itm?.unit?.length - 1)[0]) ||
if (tempWeightName.includes(itm.unit)) {
itm?.unit;
}
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
itm.quantity =
itm.quantity =
`
$
{
itm
?.
quantity
}
`.indexOf('约') > -1 ? itm?.quantity : `
约
$
{
itm
?.
quantity
}
`;
`
$
{
itm
?.
quantity
}
`.indexOf('约') > -1 ? itm?.quantity : `
约
$
{
itm
?.
quantity
}
`;
}
}
...
...
src/pages/businessManage/info/data.js
View file @
82902dc9
...
@@ -53,7 +53,7 @@ export async function getInfo() {
...
@@ -53,7 +53,7 @@ export async function getInfo() {
res
.
customList
=
res
.
facilities
.
customList
||
[];
res
.
customList
=
res
.
facilities
.
customList
||
[];
res
.
selfList
=
res
.
facilities
.
selfList
||
[];
res
.
selfList
=
res
.
facilities
.
selfList
||
[];
}
}
res
.
signDateType
=
[
res
.
signDateType
]
||
[];
res
.
signDateType
=
res
.
signDateType
?
[
res
.
signDateType
]
:
[];
res
.
accountOpenPermitImage
=
res
.
accountOpenPermitImage
res
.
accountOpenPermitImage
=
res
.
accountOpenPermitImage
?
[{
uid
:
0
,
url
:
res
.
accountOpenPermitImage
}]
?
[{
uid
:
0
,
url
:
res
.
accountOpenPermitImage
}]
:
[];
:
[];
...
@@ -77,8 +77,11 @@ export async function getInfo() {
...
@@ -77,8 +77,11 @@ export async function getInfo() {
:
[];
:
[];
// 工商局
// 工商局
res
.
icbProofImage
=
res
.
icbProofImage
?
[{
uid
:
0
,
url
:
res
.
icbProofImage
}]
:
[];
res
.
icbProofImage
=
res
.
icbProofImage
?
[{
uid
:
0
,
url
:
res
.
icbProofImage
}]
:
[];
if
(
res
.
categoryQualificateImage
)
{
if
(
res
.
categoryQualificateImage
&&
res
.
categoryQualificateImage
.
length
)
{
res
.
categoryQualificateImage
=
[{
uid
:
0
,
url
:
res
.
categoryQualificateImage
}];
res
.
categoryQualificateImage
=
res
.
categoryQualificateImage
.
map
((
item
,
index
)
=>
({
uid
:
index
,
url
:
item
,
}));
}
}
if
(
res
.
otherImage
&&
res
.
otherImage
.
length
)
{
if
(
res
.
otherImage
&&
res
.
otherImage
.
length
)
{
res
.
otherImage
=
res
.
otherImage
.
map
((
item
,
index
)
=>
({
res
.
otherImage
=
res
.
otherImage
.
map
((
item
,
index
)
=>
({
...
@@ -126,7 +129,15 @@ export async function getInfo() {
...
@@ -126,7 +129,15 @@ export async function getInfo() {
// 删除图片
// 删除图片
function
delImg
(
keyName
,
e
)
{
function
delImg
(
keyName
,
e
)
{
this
.
setState
(
state
=>
{
this
.
setState
(
state
=>
{
state
.
businessInfo
[
keyName
].
splice
(
e
.
uid
,
1
);
if
(
keyName
===
'
categoryQualificateImage
'
)
{
state
.
businessInfo
.
categoryQualificateImage
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
uid
===
e
.
uid
)
{
state
.
businessInfo
.
categoryQualificateImage
.
splice
(
index
,
1
);
}
});
}
else
{
state
.
businessInfo
[
keyName
].
splice
(
e
.
uid
,
1
);
}
return
{
return
{
businessInfo
:
state
.
businessInfo
,
businessInfo
:
state
.
businessInfo
,
};
};
...
@@ -319,7 +330,6 @@ export async function getAreaAddr() {
...
@@ -319,7 +330,6 @@ export async function getAreaAddr() {
label
:
item
.
addrName
,
label
:
item
.
addrName
,
value
:
item
.
addrId
,
value
:
item
.
addrId
,
}));
}));
console
.
log
(
this
.
state
.
businessInfo
,
'
......
'
);
// 编辑时 回显 市、区、街道
// 编辑时 回显 市、区、街道
if
(
this
.
state
.
businessInfo
.
provinceId
)
{
if
(
this
.
state
.
businessInfo
.
provinceId
)
{
const
pros
=
res
.
filter
(
item
=>
+
item
.
value
===
+
this
.
state
.
businessInfo
.
provinceId
);
const
pros
=
res
.
filter
(
item
=>
+
item
.
value
===
+
this
.
state
.
businessInfo
.
provinceId
);
...
...
src/pages/businessManage/info/index.jsx
View file @
82902dc9
...
@@ -259,7 +259,6 @@ class BusinessInfo extends Component {
...
@@ -259,7 +259,6 @@ class BusinessInfo extends Component {
}
}
});
});
}
}
obj
.
businessLicenseImage
=
obj
.
businessLicenseImage
=
(
imgs
?.
businessLicenseImage
?.
length
&&
imgs
?.
businessLicenseImage
[
0
].
url
)
||
''
;
(
imgs
?.
businessLicenseImage
?.
length
&&
imgs
?.
businessLicenseImage
[
0
].
url
)
||
''
;
obj
.
idCardEmblemImage
=
obj
.
idCardEmblemImage
=
...
@@ -287,7 +286,11 @@ class BusinessInfo extends Component {
...
@@ -287,7 +286,11 @@ class BusinessInfo extends Component {
delete
obj
.
otherImage
;
delete
obj
.
otherImage
;
}
}
if
(
imgs
.
categoryQualificateImage
&&
imgs
.
categoryQualificateImage
.
length
)
{
if
(
imgs
.
categoryQualificateImage
&&
imgs
.
categoryQualificateImage
.
length
)
{
obj
.
categoryQualificateImage
=
imgs
.
categoryQualificateImage
[
0
].
url
;
const
list
=
[];
imgs
.
categoryQualificateImage
.
forEach
(
item
=>
{
list
.
push
(
item
.
url
);
});
obj
.
categoryQualificateImage
=
list
;
}
else
{
}
else
{
delete
obj
.
categoryQualificateImage
;
delete
obj
.
categoryQualificateImage
;
}
}
...
@@ -449,9 +452,12 @@ class BusinessInfo extends Component {
...
@@ -449,9 +452,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"联系人姓名"
labelCol=
{
{
span
:
8
}
}
>
<
FormItem
label=
"联系人姓名"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
contactName
'
,
{
{
getFieldDecorator
(
'
contactName
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入联系人姓名!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入联系人姓名!
'
},
{
pattern
:
/^
[
A-Za-z
\u
4e00-
\u
9fa5
]
+$/
,
message
:
'
请输入汉字或字母!
'
},
],
initialValue
:
businessInfo
.
contactName
,
initialValue
:
businessInfo
.
contactName
,
})(<
Input
maxLength=
{
8
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
FormItem
>
</
Col
>
</
Col
>
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
...
@@ -604,9 +610,12 @@ class BusinessInfo extends Component {
...
@@ -604,9 +610,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"统一社会信用代码"
labelCol=
{
{
span
:
8
}
}
>
<
FormItem
label=
"统一社会信用代码"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
socialCode
'
,
{
{
getFieldDecorator
(
'
socialCode
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入统一社会信用代码!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入统一社会信用代码!
'
},
{
pattern
:
/^
[
A-Za-z0-9
]
*$/
,
message
:
'
仅支持输入数字和字母
'
},
],
initialValue
:
businessInfo
.
socialCode
,
initialValue
:
businessInfo
.
socialCode
,
})(<
Input
maxLength=
{
32
}
/>)
}
})(<
Input
maxLength=
{
18
}
/>)
}
</
FormItem
>
</
FormItem
>
</
Col
>
</
Col
>
{
(
!
companyNamedis
&&
{
(
!
companyNamedis
&&
...
@@ -680,6 +689,7 @@ class BusinessInfo extends Component {
...
@@ -680,6 +689,7 @@ class BusinessInfo extends Component {
{
...
uploadPropsFn
.
call
(
this
,
{
{
...
uploadPropsFn
.
call
(
this
,
{
keyName
:
'
categoryQualificateImage
',
keyName
:
'
categoryQualificateImage
',
type
:
6,
type
:
6,
limit
:
9,
})}
})}
fileList=
{
businessInfo
.
categoryQualificateImage
}
fileList=
{
businessInfo
.
categoryQualificateImage
}
>
>
...
@@ -808,7 +818,10 @@ class BusinessInfo extends Component {
...
@@ -808,7 +818,10 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"身份证号码"
labelCol=
{
{
span
:
8
}
}
>
<
FormItem
label=
"身份证号码"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
legalPersonIdCard
'
,
{
{
getFieldDecorator
(
'
legalPersonIdCard
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入身份证号码!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入身份证号码!
'
},
{
pattern
:
/^
[
A-Za-z0-9
]
*$/
,
message
:
'
请输入数字或字母
'
},
],
initialValue
:
businessInfo
.
legalPersonIdCard
,
initialValue
:
businessInfo
.
legalPersonIdCard
,
})(<
Input
maxLength=
{
18
}
/>)
}
})(<
Input
maxLength=
{
18
}
/>)
}
</
FormItem
>
</
FormItem
>
...
@@ -926,9 +939,12 @@ class BusinessInfo extends Component {
...
@@ -926,9 +939,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"开户许可证编号"
labelCol=
{
{
span
:
8
}
}
>
<
FormItem
label=
"开户许可证编号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
bankAccountLicenseNum
'
,
{
{
getFieldDecorator
(
'
bankAccountLicenseNum
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入开户许可证编号!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入开户许可证编号!
'
},
{
pattern
:
/^
[
A-Za-z0-9
]
*$/
,
message
:
'
请输入数字或字母
'
},
],
initialValue
:
businessInfo
.
bankAccountLicenseNum
,
initialValue
:
businessInfo
.
bankAccountLicenseNum
,
})(<
Input
maxLength=
{
32
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
FormItem
>
</
Col
>
</
Col
>
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
...
@@ -963,14 +979,18 @@ class BusinessInfo extends Component {
...
@@ -963,14 +979,18 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
bankAccount
'
,
{
{
getFieldDecorator
(
'
bankAccount
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入银行帐号!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入银行帐号!
'
},
{
pattern
:
/^
[
0-9
]
*$/
,
message
:
'
请输入数字
'
},
],
initialValue
:
businessInfo
.
bankAccount
,
initialValue
:
businessInfo
.
bankAccount
,
})(<
Input
maxLength=
{
20
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
FormItem
>
</
Col
>
</
Col
>
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"联行号"
labelCol=
{
{
span
:
8
}
}
>
<
FormItem
label=
"联行号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
interbankNum
'
,
{
{
getFieldDecorator
(
'
interbankNum
'
,
{
rules
:
[{
pattern
:
/^
[
0-9
]
*$/
,
message
:
'
请输入数字
'
}],
initialValue
:
businessInfo
.
interbankNum
,
initialValue
:
businessInfo
.
interbankNum
,
})(<
Input
maxLength=
{
50
}
/>)
}
})(<
Input
maxLength=
{
50
}
/>)
}
</
FormItem
>
</
FormItem
>
...
@@ -1046,9 +1066,12 @@ class BusinessInfo extends Component {
...
@@ -1046,9 +1066,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
bankAccount
'
,
{
{
getFieldDecorator
(
'
bankAccount
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入银行帐号!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入银行帐号!
'
},
{
pattern
:
/^
[
0-9
]
*$/
,
message
:
'
请输入数字
'
},
],
initialValue
:
businessInfo
.
bankAccount
,
initialValue
:
businessInfo
.
bankAccount
,
})(<
Input
maxLength=
{
20
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
FormItem
>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
...
@@ -1107,9 +1130,12 @@ class BusinessInfo extends Component {
...
@@ -1107,9 +1130,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
bankAccount
'
,
{
{
getFieldDecorator
(
'
bankAccount
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入银行帐号!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入银行帐号!
'
},
{
pattern
:
/^
[
0-9
]
*$/
,
message
:
'
请输入数字
'
},
],
initialValue
:
businessInfo
.
bankAccount
,
initialValue
:
businessInfo
.
bankAccount
,
})(<
Input
maxLength=
{
20
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
FormItem
>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
...
...
src/pages/chainStoreManage/components/storeModal.jsx
View file @
82902dc9
...
@@ -4,7 +4,7 @@ import moment from 'moment';
...
@@ -4,7 +4,7 @@ import moment from 'moment';
import
{
PlusSquareFilled
,
MinusSquareFilled
}
from
'
@ant-design/icons
'
;
import
{
PlusSquareFilled
,
MinusSquareFilled
}
from
'
@ant-design/icons
'
;
import
{
Modal
,
Input
,
TimePicker
,
Checkbox
,
Cascader
,
Radio
,
notification
,
Button
}
from
'
antd
'
;
import
{
Modal
,
Input
,
TimePicker
,
Checkbox
,
Cascader
,
Radio
,
notification
,
Button
}
from
'
antd
'
;
import
{
apiAddrArea
,
apiCreatStore
,
apiEditStore
}
from
'
../services
'
;
import
{
apiAddrArea
,
apiCreatStore
,
apiEditStore
}
from
'
../services
'
;
import
{
weekOptions
,
weekDefault
,
layout
,
businessModel
}
from
'
../data
'
;
import
{
weekOptions
,
weekDefault
,
layout
}
from
'
../data
'
;
import
MapModal
from
'
@/components/GaoDeMap
'
;
import
MapModal
from
'
@/components/GaoDeMap
'
;
import
style
from
'
./style.less
'
;
import
style
from
'
./style.less
'
;
import
{
isCheckNumberLine
}
from
'
@/utils/validator
'
;
import
{
isCheckNumberLine
}
from
'
@/utils/validator
'
;
...
@@ -20,6 +20,7 @@ const StoreModal = props => {
...
@@ -20,6 +20,7 @@ const StoreModal = props => {
formInfo
,
formInfo
,
status
,
status
,
productBusiness
,
productBusiness
,
existTakewayShop
,
}
=
props
;
}
=
props
;
const
[
areaAddr
,
setAreaAddr
]
=
useState
([]);
const
[
areaAddr
,
setAreaAddr
]
=
useState
([]);
const
[
visibleMap
,
setVisibleMap
]
=
useState
(
false
);
const
[
visibleMap
,
setVisibleMap
]
=
useState
(
false
);
...
@@ -30,25 +31,19 @@ const StoreModal = props => {
...
@@ -30,25 +31,19 @@ const StoreModal = props => {
address
:
''
,
address
:
''
,
});
});
const
[
disabled
,
setDisabled
]
=
useState
(
false
);
const
[
disabled
,
setDisabled
]
=
useState
(
false
);
const
[
isDisabled
,
setIsDisabled
]
=
useState
(
true
);
const
[
isDisabled
,
setIsDisabled
]
=
useState
(
false
);
const
[
businessModel
,
setBusinessModel
]
=
useState
([
{
label
:
'
到家外卖业务(外卖配送业务)
'
,
value
:
1
},
{
label
:
'
实物商品业务员
'
,
value
:
2
},
{
label
:
'
到店业务(服务类业务)
'
,
value
:
3
},
]);
const
divDom
=
useRef
();
const
divDom
=
useRef
();
useEffect
(()
=>
{
setDisabled
(
props
.
status
);
},
[
props
.
status
]);
useEffect
(()
=>
{
if
(
props
.
productBusiness
.
length
)
{
const
val
=
props
.
productBusiness
.
includes
(
2
)
||
props
.
productBusiness
.
includes
(
3
);
setIsDisabled
(
val
);
}
},
[
props
.
productBusiness
]);
const
handleCancel
=
isSuccess
=>
{
const
handleCancel
=
isSuccess
=>
{
resetFields
();
resetFields
();
onCancel
(
isSuccess
);
onCancel
(
isSuccess
);
};
};
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
validateFields
(
async
(
error
,
fieldsValue
)
=>
{
validateFields
(
async
(
error
,
fieldsValue
)
=>
{
if
(
!
error
)
{
if
(
!
error
)
{
...
@@ -59,7 +54,7 @@ const StoreModal = props => {
...
@@ -59,7 +54,7 @@ const StoreModal = props => {
params
[
areaArr
[
i
]]
=
item
;
params
[
areaArr
[
i
]]
=
item
;
});
});
}
}
if
(
params
.
shopHeadImage
.
length
)
{
if
(
params
?.
shopHeadImage
?
.
length
)
{
// eslint-disable-next-line prefer-destructuring
// eslint-disable-next-line prefer-destructuring
params
.
shopHeadImage
=
params
.
shopHeadImage
[
0
];
params
.
shopHeadImage
=
params
.
shopHeadImage
[
0
];
}
}
...
@@ -219,10 +214,42 @@ const StoreModal = props => {
...
@@ -219,10 +214,42 @@ const StoreModal = props => {
const
normFile
=
fileList
=>
fileList
;
const
normFile
=
fileList
=>
fileList
;
const
timerWrapper
=
async
(
time
,
timeString
,
callback
)
=>
{
if
(
timeString
&&
timeString
.
length
)
{
const
begin
=
moment
(
timeString
[
0
]).
format
(
'
HH:mm
'
);
const
end
=
moment
(
timeString
[
1
]).
format
(
'
HH:mm
'
);
if
(
begin
===
end
)
{
callback
(
new
Error
(
'
选择开始时间结束时间不能一样
'
));
}
}
else
{
callback
();
}
};
const
onBusiness
=
e
=>
{
const
val
=
e
.
includes
(
1
);
setIsDisabled
(
val
);
};
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
visible
)
{
if
(
visible
)
{
resetFields
();
resetFields
();
const
info
=
Object
.
assign
({},
formInfo
);
const
info
=
Object
.
assign
({},
formInfo
);
const
val
=
info
?.
productBusiness
?.
includes
(
1
);
setIsDisabled
(
val
);
if
(
status
===
'
look
'
)
{
setDisabled
(
true
);
}
else
{
setDisabled
(
false
);
}
const
data
=
[...
businessModel
];
data
.
forEach
(
item
=>
{
item
.
disabled
=
!
productBusiness
.
includes
(
item
.
value
);
if
(
existTakewayShop
&&
item
.
value
===
1
&&
!
val
)
{
item
.
disabled
=
true
;
}
});
console
.
log
(
data
,
'
.........
'
);
setBusinessModel
(
data
);
if
(
info
&&
info
.
id
)
{
if
(
info
&&
info
.
id
)
{
info
.
week
=
info
.
businessHours
.
weeks
;
info
.
week
=
info
.
businessHours
.
weeks
;
const
hours
=
info
.
businessHours
.
hoursItems
;
const
hours
=
info
.
businessHours
.
hoursItems
;
...
@@ -235,13 +262,13 @@ const StoreModal = props => {
...
@@ -235,13 +262,13 @@ const StoreModal = props => {
});
});
});
});
}
}
info
.
lnglat
=
`
${
info
.
longitude
}
,
${
info
.
latitude
}
`
;
info
.
lnglat
=
`
${
info
.
longitude
}
,
${
info
.
latitude
}
`
;
info
.
addr
=
[
info
.
provinceId
,
info
.
cityId
,
info
.
countyId
];
info
.
addr
=
[
info
.
provinceId
,
info
.
cityId
,
info
.
countyId
];
info
.
shopHeadImage
=
[
info
.
shopHeadImage
]
||
[];
info
.
shopHeadImage
=
(
info
.
shopHeadImage
&&
[
info
.
shopHeadImage
])
||
[];
if
(
info
.
townId
)
{
if
(
info
.
townId
)
{
info
.
addr
.
push
(
info
.
townId
);
info
.
addr
.
push
(
info
.
townId
);
}
}
console
.
log
(
info
);
setTimes
(
harr
);
setTimes
(
harr
);
setFormData
(
info
);
setFormData
(
info
);
getLazyAddr
(
info
);
getLazyAddr
(
info
);
...
@@ -278,8 +305,9 @@ const StoreModal = props => {
...
@@ -278,8 +305,9 @@ const StoreModal = props => {
<
Form
{
...
layout
}
name=
"formData"
>
<
Form
{
...
layout
}
name=
"formData"
>
<
FormItem
label=
"业务模式"
>
<
FormItem
label=
"业务模式"
>
{
getFieldDecorator
(
'
productBusiness
'
,
{
{
getFieldDecorator
(
'
productBusiness
'
,
{
initialValue
:
productBusiness
,
rules
:
[{
required
:
true
,
message
:
'
请选择业务模式
'
}],
})(<
Checkbox
.
Group
disabled
options=
{
businessModel
}
/>)
}
initialValue
:
formData
.
productBusiness
,
})(<
Checkbox
.
Group
disabled=
{
disabled
}
options=
{
businessModel
}
onChange=
{
onBusiness
}
/>)
}
</
FormItem
>
</
FormItem
>
{
isDisabled
&&
(
{
isDisabled
&&
(
<
FormItem
label=
"门店头像"
>
<
FormItem
label=
"门店头像"
>
...
@@ -317,18 +345,12 @@ const StoreModal = props => {
...
@@ -317,18 +345,12 @@ const StoreModal = props => {
<
div
>
<
div
>
<
FormItem
name=
{
item
.
name
}
>
<
FormItem
name=
{
item
.
name
}
>
{
getFieldDecorator
(
item
.
name
,
{
{
getFieldDecorator
(
item
.
name
,
{
rules
:
[{
required
:
true
,
message
:
'
请选择营业时间!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请选择营业时间!
'
},
{
validator
:
timerWrapper
,
message
:
'
选择开始时间结束时间不能一样
'
},
],
initialValue
:
formData
[
item
.
name
],
initialValue
:
formData
[
item
.
name
],
})(
})(<
TimePicker
.
RangePicker
format=
"HH:mm"
disabled=
{
disabled
}
/>)
}
<
TimePicker
.
RangePicker
format=
"HH:mm"
showTime=
{
{
hideDisabledOptions
:
true
,
defaultValue
:
[
moment
(
'
00:00
'
,
'
HH:mm
'
),
moment
(
'
23:59
'
,
'
HH:mm
'
)],
}
}
disabled=
{
disabled
}
/>,
)
}
</
FormItem
>
</
FormItem
>
</
div
>
</
div
>
{
!
disabled
&&
{
!
disabled
&&
...
...
src/pages/chainStoreManage/data.js
View file @
82902dc9
...
@@ -18,13 +18,6 @@ export const layout = {
...
@@ -18,13 +18,6 @@ export const layout = {
wrapperCol
:
{
span
:
16
},
wrapperCol
:
{
span
:
16
},
};
};
// 业务模式
export
const
businessModel
=
[
{
label
:
'
到家外卖业务(外卖配送业务)
'
,
value
:
1
},
{
label
:
'
实物商品业务员
'
,
value
:
2
},
{
label
:
'
到店业务(服务类业务)
'
,
value
:
3
},
];
export
const
businessList
=
[
export
const
businessList
=
[
{
label
:
'
外卖
'
,
value
:
1
},
{
label
:
'
外卖
'
,
value
:
1
},
{
label
:
'
实物类
'
,
value
:
2
},
{
label
:
'
实物类
'
,
value
:
2
},
...
...
src/pages/chainStoreManage/index.jsx
View file @
82902dc9
...
@@ -25,30 +25,33 @@ export default () => {
...
@@ -25,30 +25,33 @@ export default () => {
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
[
storeInfo
,
setStoreInfo
]
=
useState
({});
const
[
storeInfo
,
setStoreInfo
]
=
useState
({});
const
[
areaAddr
,
setAreaAddr
]
=
useState
([]);
const
[
areaAddr
,
setAreaAddr
]
=
useState
([]);
const
[
status
,
setStatus
]
=
useState
();
const
[
status
,
setStatus
]
=
useState
(
false
);
const
[
dataList
,
setDataList
]
=
useState
([]);
const
[
dataList
,
setDataList
]
=
useState
([]);
const
[
pageNo
,
setPageNo
]
=
useState
(
1
);
const
[
pageNo
,
setPageNo
]
=
useState
(
1
);
const
[
totalNum
,
setTotalNum
]
=
useState
(
0
);
const
[
totalNum
,
setTotalNum
]
=
useState
(
0
);
const
[
pageSize
,
setPageSize
]
=
useState
(
20
);
const
[
pageSize
,
setPageSize
]
=
useState
(
20
);
const
[
productBusiness
,
setProductBusiness
]
=
useState
([]);
const
[
productBusiness
,
setProductBusiness
]
=
useState
([]);
const
[
existTakewayShop
,
setExistTakewayShop
]
=
useState
(
false
);
const
refSearch
=
useRef
();
const
refSearch
=
useRef
();
const
divDom
=
useRef
();
const
divDom
=
useRef
();
// 获取业务模式
// 获取业务模式
const
getBusiness
=
async
()
=>
{
const
getBusiness
=
async
()
=>
{
const
res
=
await
apiproductBusiness
();
const
res
=
await
apiproductBusiness
();
setProductBusiness
(
res
);
if
(
res
)
{
setProductBusiness
(
res
.
productBusiness
||
[]);
setExistTakewayShop
(
res
.
existTakewayShop
);
}
setVisible
(
true
);
};
};
const
onCreate
=
()
=>
{
const
onCreate
=
()
=>
{
setStatus
(
'
add
'
);
setStoreInfo
({});
setStoreInfo
({});
setVisible
(
true
);
getBusiness
();
getBusiness
();
};
};
const
onShowInfo
=
(
info
,
val
)
=>
{
const
onShowInfo
=
(
info
,
val
)
=>
{
setStoreInfo
(
info
);
setStoreInfo
(
info
);
const
value
=
val
!==
'
edit
'
;
setStatus
(
val
);
setStatus
(
value
);
setVisible
(
true
);
getBusiness
();
getBusiness
();
};
};
...
@@ -122,6 +125,9 @@ export default () => {
...
@@ -122,6 +125,9 @@ export default () => {
if
(
val
.
businessStatus
)
{
if
(
val
.
businessStatus
)
{
params
.
businessStatus
=
val
.
businessStatus
;
params
.
businessStatus
=
val
.
businessStatus
;
}
}
if
(
val
.
productBusiness
)
{
params
.
productBusiness
=
val
.
productBusiness
;
}
getList
(
params
);
getList
(
params
);
};
};
...
@@ -215,8 +221,8 @@ export default () => {
...
@@ -215,8 +221,8 @@ export default () => {
dataIndex
:
'
productBusiness
'
,
dataIndex
:
'
productBusiness
'
,
width
:
120
,
width
:
120
,
align
:
'
center
'
,
align
:
'
center
'
,
render
:
v
=>
render
:
(
v
,
value
)
=>
v
&&
(
v
alue
?.
productBusiness
?.
length
&&
(
<
div
>
<
div
>
{
v
.
map
(
it
=>
(
{
v
.
map
(
it
=>
(
<
span
>
{
businessList
.
find
(
item
=>
+
it
===
+
item
.
value
).
label
}
</
span
>
<
span
>
{
businessList
.
find
(
item
=>
+
it
===
+
item
.
value
).
label
}
</
span
>
...
@@ -265,7 +271,7 @@ export default () => {
...
@@ -265,7 +271,7 @@ export default () => {
fixed
:
'
right
'
,
fixed
:
'
right
'
,
render
:
(
val
,
r
)
=>
(
render
:
(
val
,
r
)
=>
(
<
div
className=
{
style
.
actionBtn
}
>
<
div
className=
{
style
.
actionBtn
}
>
<
Button
key=
"look"
onClick=
{
()
=>
onShowInfo
(
r
)
}
>
<
Button
key=
"look"
onClick=
{
()
=>
onShowInfo
(
r
,
'
look
'
)
}
>
查看
查看
</
Button
>
</
Button
>
<
Button
key=
"seek"
onClick=
{
()
=>
onShowInfo
(
r
,
'
edit
'
)
}
>
<
Button
key=
"seek"
onClick=
{
()
=>
onShowInfo
(
r
,
'
edit
'
)
}
>
...
@@ -309,6 +315,17 @@ export default () => {
...
@@ -309,6 +315,17 @@ export default () => {
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
8
}
>
<
Form
.
Item
label=
"业务模式"
name=
"productBusiness"
>
<
Select
>
{
businessList
.
map
(
item
=>
(
<
Option
label=
{
item
.
label
}
value=
{
item
.
value
}
key=
{
item
.
value
}
>
{
item
.
label
}
</
Option
>
))
}
</
Select
>
</
Form
.
Item
>
</
Col
>
</
Row
>
</
Row
>
<
div
className=
{
style
.
search
}
>
<
div
className=
{
style
.
search
}
>
<
Button
type=
"primary"
htmlType=
"submit"
size=
"middle"
>
<
Button
type=
"primary"
htmlType=
"submit"
size=
"middle"
>
...
@@ -351,6 +368,7 @@ export default () => {
...
@@ -351,6 +368,7 @@ export default () => {
formInfo=
{
storeInfo
}
formInfo=
{
storeInfo
}
status=
{
status
}
status=
{
status
}
productBusiness=
{
productBusiness
}
productBusiness=
{
productBusiness
}
existTakewayShop=
{
existTakewayShop
}
/>
/>
</
div
>
</
div
>
);
);
...
...
src/utils/utils.js
View file @
82902dc9
...
@@ -154,20 +154,20 @@ export const getObjectType = v => Object.prototype.toString.call(v).replace(/\[o
...
@@ -154,20 +154,20 @@ export const getObjectType = v => Object.prototype.toString.call(v).replace(/\[o
export
const
getErrorMessage
=
err
=>
{
export
const
getErrorMessage
=
err
=>
{
const
message
=
'
请检查表单数据!
'
;
const
message
=
'
请检查表单数据!
'
;
// eslint-disable-next-line wrap-iife
// eslint-disable-next-line wrap-iife
//
(function getMsg(v) {
(
function
getMsg
(
v
)
{
//
if (Array.isArray(v)) {
if
(
Array
.
isArray
(
v
))
{
//
getMsg(v[0]);
getMsg
(
v
[
0
]);
//
} else {
}
else
{
//
const keys = Object.keys(v);
const
keys
=
Object
.
keys
(
v
);
//
if (Array.isArray(v[keys[0]])) {
if
(
Array
.
isArray
(
v
[
keys
[
0
]]))
{
//
getMsg(v[keys[0]][0]);
getMsg
(
v
[
keys
[
0
]][
0
]);
//
} else if (v[keys[0]].errors && v[keys[0]].errors.length) {
}
else
if
(
v
[
keys
[
0
]].
errors
&&
v
[
keys
[
0
]].
errors
.
length
)
{
//
// eslint-disable-next-line no-const-assign
// eslint-disable-next-line no-const-assign
//
message = v[keys[0]].errors[0].message;
message
=
v
[
keys
[
0
]].
errors
[
0
].
message
;
//
} else {
}
else
{
//
getMsg(v);
getMsg
(
v
);
//
}
}
//
}
}
//
})(err);
})(
err
);
return
message
;
return
message
;
};
};
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