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
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 {
<
FormItem
label=
"商品类型"
name=
"productType"
>
<
Select
style=
{
selectW
}
placeholder=
"请选择商品类型"
onChange=
{
this
.
onChangeProductType
}
>
<
Option
value=
{
1
}
>
实体商品
</
Option
>
<
Option
value=
{
2
}
>
虚拟商品
</
Option
>
<
Option
value=
{
4
}
>
服务类商品
</
Option
>
<
Option
value=
{
5
}
>
外卖商品
</
Option
>
</
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
{
DndProvider
}
from
'
react-dnd
'
;
import
HTML5Backend
from
'
react-dnd-html5-backend
'
;
...
...
@@ -8,7 +8,7 @@ import InsertTag from './InsertTag';
import
GroupInfo
from
'
./GroupInfo
'
;
import
{
apiDelStorage
,
apiSortStorage
,
apiStorageList
,
apiSupplierShopList
}
from
'
../../service
'
;
const
GoodsGroup
=
options
=>
{
const
GoodsGroup
=
forwardRef
((
options
,
ref
)
=>
{
const
[
groupEdit
,
setGroupEdit
]
=
useState
(
false
);
const
[
selected
,
setSelected
]
=
useState
(
0
);
const
[
storageId
,
setStorageId
]
=
useState
(
0
);
...
...
@@ -110,6 +110,10 @@ const GoodsGroup = options => {
options
.
changeGroup
(
selected
);
},
[
selected
]);
useImperativeHandle
(
ref
,
()
=>
({
setSelected
,
}));
return
(
<
div
className=
{
styles
.
groupBox
}
>
{
(
shops
&&
shops
.
length
&&
(
...
...
@@ -182,6 +186,6 @@ const GoodsGroup = options => {
/>
</
div
>
);
};
}
)
;
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
{
unstable_batchedUpdates
}
from
'
react-dom
'
;
import
{
SortableContainer
,
SortableElement
,
SortableHandle
}
from
'
react-sortable-hoc
'
;
...
...
@@ -39,6 +39,8 @@ const Takeaway = options => {
const
[
visibleSwitchGroup
,
setVisibleSwitchGroup
]
=
useState
(
false
);
const
[
scribeToken
,
setScribeToken
]
=
useState
(
''
);
const
groupRef
=
useRef
(
null
);
const
rowSelection
=
{
selectedRowKeys
,
onChange
:
setSelectedRowKeys
,
...
...
@@ -176,7 +178,8 @@ const Takeaway = options => {
useEffect
(()
=>
{
if
(
groupId
)
{
getDataList
(
0
,
pageSize
);
setPageNo
(
1
);
getDataList
(
1
,
pageSize
);
}
else
{
setTableData
([]);
}
...
...
@@ -184,11 +187,16 @@ const Takeaway = options => {
useEffect
(()
=>
{
const
stoken
=
PubSub
.
subscribe
(
'
refreshTakeAway
'
,
(
_
,
data
)
=>
{
setShopId
(
data
.
shopId
);
setGroupId
(
data
.
groupId
);
getDataList
(
0
,
pageSize
,
data
.
groupId
);
console
.
log
(
'
refreshTakeAway :>>
'
,
data
);
if
(
data
.
groupId
&&
groupId
!==
data
.
groupId
)
{
setGroupId
(
data
.
groupId
);
if
(
groupRef
.
current
)
{
groupRef
.
current
.
setSelected
(
`
${
data
.
groupId
}
`
);
}
}
});
setScribeToken
(
stoken
);
return
()
=>
{
PubSub
.
unsubscribe
(
scribeToken
);
};
...
...
@@ -208,7 +216,12 @@ const Takeaway = options => {
return
(
<
div
className=
{
styles
.
takeawayBox
}
>
<
Spin
spinning=
{
loading
}
>
<
GoodsGroup
shopId=
{
shopId
}
changeShop=
{
setShopId
}
changeGroup=
{
setGroupId
}
/>
<
GoodsGroup
ref=
{
groupRef
}
shopId=
{
shopId
}
changeShop=
{
setShopId
}
changeGroup=
{
setGroupId
}
/>
{
(
shopId
&&
(
<
ActionBar
selectedRowKeys=
{
selectedRowKeys
}
...
...
src/pages/GoodsManage/staticdata.js
View file @
82902dc9
...
...
@@ -8,6 +8,15 @@ import { apiChangeStateGoods, apiGoodsActionBatch } from './service';
const
{
confirm
}
=
Modal
;
export
const
NormalProduct
=
1
;
export
const
ServiceProduct
=
4
;
export
const
TakeawayProduct
=
5
;
export
const
GoodTypes
=
{
[
NormalProduct
]:
'
实体商品
'
,
[
ServiceProduct
]:
'
服务类商品
'
,
[
TakeawayProduct
]:
'
外卖商品
'
,
};
export
const
productType
=
[
{
value
:
1
,
...
...
src/pages/GoodsManage/style.less
View file @
82902dc9
...
...
@@ -139,7 +139,7 @@
.takeawayBox {
margin-top: 20px;
padding-bottom:
4
0px;
padding-bottom:
2
0px;
background-color: #fff;
&--page {
padding-top: 10px;
...
...
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
View file @
82902dc9
...
...
@@ -149,7 +149,7 @@ const AddRepertoryModal = (props, ref) => {
name=
"maxStock"
label=
"最大库存"
rules=
{
[
{
required
:
isRequired
,
message
:
'
请填写最大库存
'
},
{
required
:
!
isRequired
,
message
:
'
请填写最大库存
'
},
{
validator
:
isIntegerNotZero
,
type
:
'
number
'
,
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
82902dc9
/* eslint-disable consistent-return */
/* eslint-disable react/no-array-index-key */
/* eslint-disable no-shadow */
import
React
,
{
...
...
@@ -24,6 +25,7 @@ import {
Cascader
,
Divider
,
DatePicker
,
message
,
}
from
'
antd
'
;
import
moment
from
'
moment
'
;
import
{
MinusCircleOutlined
,
PlusOutlined
}
from
'
@ant-design/icons
'
;
...
...
@@ -71,8 +73,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const
[
tagList
,
setTagList
]
=
useState
([]);
const
[
unitsList
,
setUnitsList
]
=
useState
([]);
const
[
takeawayData
,
setTakeawayData
]
=
useState
({});
// eslint-disable-next-line prefer-const
let
[
multiSpu
,
setMultiSpu
]
=
useState
([]);
le
t
[
singularSpu
,
setSingularSpu
]
=
useState
([]);
cons
t
[
singularSpu
,
setSingularSpu
]
=
useState
([]);
const
[
intactData
,
setIntactData
]
=
useState
({});
const
[
repertoryState
,
setRepertoryState
]
=
useState
(
''
);
const
[
repertoryModel
,
setRepertoryModel
]
=
useState
({});
...
...
@@ -100,15 +103,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
return
null
;
}
};
// 过滤对象
const
objectComparison
=
(
item
,
itm
)
=>
{
const
{
serviceItem
:
{
maxStock
,
autoStock
,
productStock
},
}
=
itm
;
const
params
=
{
maxStock
,
autoStock
,
productStock
:
productStock
||
itm
.
productStock
};
const
temp
=
{
...
item
,
...
params
};
return
temp
;
};
// // 过滤存在的sku对象
// const objectComparison = (item, itm) => {
// console.log(item, itm, '==========');
// const {
// serviceItem: { maxStock, autoStock, productStock },
// } = itm;
// const params = { maxStock, autoStock, productStock: productStock || itm.productStock };
// const temp = { ...item, ...params };
// return temp;
// };
const
takeawayCalc
=
takeawayData
=>
{
// 商品基本信息编辑商品名称
const
{
infoMation
:
name
,
infoMation
,
takeawayItem
}
=
takeawayData
;
...
...
@@ -137,11 +142,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
let
{
unit
}
=
takeawayItem
;
unit
=
(
unit
&&
(
Array
.
isArray
(
unit
)
&&
unit
?.
length
&&
unit
?.
slice
(
1
).
toString
()))
||
unit
;
console
.
log
(
takeawayItem
,
'
takeawayItem
'
);
const
singularSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 单规格
const
multiSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 多规格
// const multiSpu = customer.isEdit ? skuList:[]; // 多库存spu、
// let singularSpu
= []; // 单库存spu
let
singularSpuData
=
[];
// 单库存spu
const
saleTimesTemp
=
[];
if
(
saleTimes
.
length
)
{
saleTimes
.
forEach
(
item
=>
{
...
...
@@ -184,14 +188,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if
(
peopleUnits
.
includes
(
specs
.
unit
))
{
delete
specs
.
quantity
;
}
console
.
log
(
'
specs====
'
,
specs
);
singularSpecList
[
0
].
specs
=
[
specs
];
singularSpu
=
[{
...
temp
,
specs
:
[
specs
]
}];
setSingularSpu
(
singularSpu
);
console
.
log
(
'
singularSpu
'
,
singularSpu
);
singularSpuData
=
[{
...
temp
,
specs
:
[
specs
]
}];
setSingularSpu
(
singularSpuData
);
}
console
.
log
(
'
name || editData.name
'
,
name
,
editData
.
name
,
weight
);
// 多规格
if
(
+
repertoryType
===
2
)
{
// if (name || editData.name) {
...
...
@@ -203,9 +204,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if
(
specsItem
&&
!
specsItem
.
generateSku
)
{
specsItem
.
generateSku
=
1
;
}
if
(
specsItem
.
specGroupName
)
{
specsItem
?.
specs
?
.
forEach
(
itm
=>
{
itm
.
specGroupName
=
specsItem
.
specGroupName
;
if
(
specsItem
?
.
specGroupName
)
{
specsItem
.
specs
.
forEach
(
itm
=>
{
itm
.
specGroupName
=
specsItem
?
.
specGroupName
;
});
}
multiSpecList
.
push
(
specsItem
);
...
...
@@ -225,7 +226,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
},
[[]],
);
console
.
log
(
'
multiSpu1111
'
,
multiSpu
);
multiSpu
=
tempSku
.
map
((
item
,
index
)
=>
{
const
obj
=
{};
obj
.
salePrice
=
salePrice
;
...
...
@@ -251,8 +251,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
});
}
multiSpu
.
map
(
item
=>
{
multiSpu
.
forEach
(
item
=>
{
item
.
salePrice
=
0
;
item
.
unique
=
''
;
item
.
unique
=
item
?.
specs
.
map
(
itm
=>
{
if
(
itm
?.
unit
)
{
...
...
@@ -266,24 +267,57 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if
(
itm
?.
specName
)
{
return
itm
.
specName
;
}
return
itm
})
.
toString
();
});
console
.
log
(
'
multiSpu
'
,
multiSpu
);
if
(
tempMultiSpu
.
length
)
{
// 编辑数据
if
(
customer
.
isEdit
)
{
const
uniqueArr
=
tempMultiSpu
.
map
(
item
=>
item
.
unique
);
const
multiSpuUnique
=
multiSpu
.
map
(
item
=>
item
.
unique
);
const
newArrLen
=
Array
.
from
(
new
Set
(
multiSpuUnique
)).
length
;
if
(
newArrLen
<
multiSpuUnique
.
length
)
{
message
.
error
(
'
份量名称不能重复!
'
);
}
// 新增对比数据
multiSpu
.
forEach
((
item
,
index
)
=>
{
tempMultiSpu
.
forEach
((
itm
,
idx
)
=>
{
if
(
!
uniqueArr
.
includes
(
item
.
unique
))
{
tempMultiSpu
.
push
({
...
item
,
serviceItem
:
{
...
temp
.
serviceItem
,
maxStock
:
0
,
autoStock
:
0
,
productStock
:
0
},
id
:
''
,
});
}
});
// // 删除对比数据
while
(
multiSpu
.
length
!==
tempMultiSpu
.
length
)
{
tempMultiSpu
.
forEach
((
item
,
index
)
=>
{
if
(
!
multiSpuUnique
.
includes
(
item
.
unique
))
{
tempMultiSpu
.
splice
(
index
,
1
);
}
});
}
// 同步库存设置
multiSpu
.
map
(
item
=>
{
tempMultiSpu
.
forEach
(
itm
=>
{
if
(
item
.
unique
===
itm
.
unique
)
{
item
.
serviceItem
=
objectComparison
(
item
.
serviceItem
,
itm
);
item
.
serviceItem
=
{
...
item
.
serviceItem
,
...
itm
.
serviceItem
};
itm
.
specs
=
[...
item
.
specs
];
}
});
return
item
;
});
}
console
.
log
(
multiSpu
,
'
multiSpumultiSpu
'
);
setMultiSpu
(
JSON
.
parse
(
JSON
.
stringify
(
multiSpu
)));
// }
setTempMultiSpu
(
tempMultiSpu
);
setMultiSpu
(
JSON
.
parse
(
JSON
.
stringify
(
multiSpu
)));
}
// 新增
if
(
!
customer
.
isEdit
)
{
setTempMultiSpu
(
multiSpu
);
setMultiSpu
(
multiSpu
);
}
}
// +repertoryType === 1 单规格 2多规格
const
intactDataTemp
=
{
...
...
@@ -298,7 +332,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
repertoryType
,
singleDelivery
,
specList
:
+
repertoryType
===
1
?
singularSpecList
:
multiSpecList
,
// 单库存和多库存specList
items
:
+
repertoryType
===
1
?
singularSpu
:
JSON
.
parse
(
JSON
.
stringify
(
multiSpu
)),
items
:
+
repertoryType
===
1
?
singularSpu
Data
:
JSON
.
parse
(
JSON
.
stringify
(
multiSpu
)),
// categoryId:
// (
// infoMation?.categoryId &&
...
...
@@ -327,9 +361,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
// 设置库存
const
modifiedInventory
=
(
type
,
idx
,
values
)
=>
{
const
{
productStock
,
maxStock
,
autoStock
}
=
values
;
console
.
log
(
'
idx
'
,
idx
);
if
(
type
===
'
multi
'
)
{
m
ultiSpu
.
map
(
item
=>
{
tempM
ultiSpu
.
map
(
item
=>
{
if
(
item
.
unique
===
idx
)
{
item
.
serviceItem
.
productStock
=
productStock
;
item
.
serviceItem
.
autoStock
=
autoStock
;
...
...
@@ -339,17 +372,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
});
}
if
(
type
===
'
all
'
)
{
m
ultiSpu
.
map
(
item
=>
{
tempM
ultiSpu
.
map
(
item
=>
{
item
.
serviceItem
.
productStock
=
productStock
;
item
.
serviceItem
.
autoStock
=
autoStock
;
item
.
serviceItem
.
maxStock
=
maxStock
;
return
item
;
});
}
const
temp
=
JSON
.
parse
(
JSON
.
stringify
(
multiSpu
));
tempMultiSpu
.
push
(...
temp
);
setTempMultiSpu
(
tempMultiSpu
);
setMultiSpu
(
multiSpu
);
getFormValues
();
return
false
;
};
...
...
@@ -456,7 +486,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
setRepertoryModel
({
type
,
idx
,
item
});
};
// 拼接sku 名称
const
calcLabelName
=
(
intactData
,
item
)
=>
{
const
calcLabelName
=
item
=>
{
let
firstName
=
''
;
let
lastName
=
''
;
const
tempName
=
`
${
editData
?.
name
||
''
}
`;
...
...
@@ -515,10 +545,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const weight = specList?.filter(item => item.specGroupName === '份量');
const specs = specList?.filter(item => item.specGroupName !== '份量');
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
weight
?
.forEach(item => {
weight.forEach(item => {
if (item?.specs?.length) {
item?.specs?.forEach(itm => {
if (tempWeightName.includes(itm.unit)) {
item.specs.forEach(itm => {
console.log('itm?.unit11111', itm?.unit);
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
itm.quantity =
itm?.quantity.indexOf('约') > -1 ? itm?.quantity.slice(1) : itm?.quantity || '';
}
...
...
@@ -553,16 +584,15 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
} else {
// 多规格
setRepertoryType('2');
const {
serviceItem: { saleTimeType, saleDates, saleTimes },
} = editData?.skuList[0];
const specList = editData?.specList;
const weight = specList.filter(item => item.specGroupName === '份量');
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
weight
?
.forEach(item => {
weight.forEach(item => {
if (item?.specs?.length) {
item.specs?.forEach(itm => {
if (tempWeightName.includes(itm.unit)) {
item.specs.forEach(itm => {
console.log('itm?.unit112222', itm?.unit);
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
itm.quantity =
itm?.quantity?.indexOf('约') > -1
? itm?.quantity.slice(1)
...
...
@@ -634,6 +664,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
useEffect(() => {
getFormValues();
}, [repertoryType]);
useEffect(() => {
setTempMultiSpu(tempMultiSpu);
}, [tempMultiSpu]);
return (
<>
<Form
...
...
@@ -931,7 +964,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
name="maxStock"
label="最大库存"
rules={[
{ required: isRequired, message: '请填写最大库存' },
{ required:
!
isRequired, message: '请填写最大库存' },
{
validator: isIntegerNotZero,
type: 'number',
...
...
@@ -960,7 +993,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
singularSpu[0]?.specs[0]?.unit &&
singularSpu.map((item, index) => (
<div className={styles.specsSingularBetween}>
<Form.Item label={calcLabelName(i
ntactData, i
tem, 'singular')}>
<Form.Item label={calcLabelName(item, 'singular')}>
<div className={styles.specsSingularBetween}>
<span className={styles.repertoryLimit}>
{item?.specs[0]?.productStock}/{item?.specs[0]?.maxStock}
...
...
@@ -1260,15 +1293,15 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
统一设置库存
</Button>
<div className={styles.rowWarp}>
{
m
ultiSpu.length > 0 &&
m
ultiSpu?.map((item, idx) => (
{
tempM
ultiSpu.length > 0 &&
tempM
ultiSpu?.map((item, idx) => (
<>
{item.unique && (
<>
<div key={idx} className={styles.specsBetween}>
<Form.Item>
<div className={styles.specsBetween}>
<div>{calcLabelName(i
ntactData, i
tem)} :</div>
<div>{calcLabelName(item)} :</div>
<span className={styles.repertoryLimit}>
{item?.serviceItem?.productStock}/
{item?.serviceItem?.maxStock}
...
...
src/pages/ServiceGoods/config.js
View file @
82902dc9
...
...
@@ -7,7 +7,7 @@ export const formItemLayout = {
},
};
export
const
TaskList
=
(
canAddService
,
canAddNormal
)
=>
[
export
const
TaskList
=
(
canAddService
,
canAddNormal
,
canTakeawayService
)
=>
[
{
name
:
'
实体商品
'
,
type
:
1
,
...
...
@@ -33,31 +33,31 @@ export const TaskList = (canAddService, canAddNormal) => [
},
},
},
{
name
:
'
虚拟商品
'
,
type
:
2
,
desc
:
'
无需物流
'
,
hide
:
!
canAddNormal
,
imgConfig
:
{
commonImageList
:
{
title
:
'
公共滑动图
'
,
rule
:
false
,
limit
:
null
,
renderExtra
:
()
=>
'
(图片最大上传2M)
'
,
},
imageList
:
{
rule
:
false
,
limit
:
null
,
renderExtra
:
()
=>
'
(图片最大上传2M)
'
,
},
detailImageList
:
{
title
:
'
详情图
'
,
rule
:
true
,
limit
:
null
,
renderExtra
:
()
=>
'
(图片最大上传2M)
'
,
},
},
},
//
{
//
name: '虚拟商品',
//
type: 2,
//
desc: '无需物流',
//
hide: !canAddNormal,
//
imgConfig: {
//
commonImageList: {
//
title: '公共滑动图',
//
rule: false,
//
limit: null,
//
renderExtra: () => '(图片最大上传2M)',
//
},
//
imageList: {
//
rule: false,
//
limit: null,
//
renderExtra: () => '(图片最大上传2M)',
//
},
//
detailImageList: {
//
title: '详情图',
//
rule: true,
//
limit: null,
//
renderExtra: () => '(图片最大上传2M)',
//
},
//
},
//
},
{
name
:
'
服务类商品
'
,
type
:
4
,
...
...
@@ -94,7 +94,7 @@ export const TaskList = (canAddService, canAddNormal) => [
name
:
'
外卖商品
'
,
type
:
5
,
desc
:
'
无需物流
'
,
// hide: !canAdd
Service,
hide
:
!
canTakeaway
Service
,
imgConfig
:
{
commonImageList
:
{
title
:
'
封面图片
'
,
...
...
@@ -324,10 +324,7 @@ export const StaticColumns = customer => [
},
];
export
const
ENUM_REPERTORY
=
[{
label
:
'
单规格
'
,
value
:
'
1
'
},
{
label
:
'
多规格
'
,
value
:
'
2
'
}];
export
const
ENUM_SET_REPERTORY
=
[
{
label
:
'
清零
'
,
value
:
'
0
'
},
{
label
:
'
最大
'
,
value
:
'
1
'
},
];
export
const
ENUM_SET_REPERTORY
=
[{
label
:
'
清零
'
,
value
:
'
0
'
},
{
label
:
'
最大
'
,
value
:
'
1
'
}];
export
const
ENUM_WEEK
=
[
{
value
:
'
1
'
,
label
:
'
周一
'
},
{
value
:
'
2
'
,
label
:
'
周二
'
},
...
...
src/pages/ServiceGoods/index.jsx
View file @
82902dc9
import
React
,
{
useState
,
useRef
,
useEffect
,
useCallback
,
useMemo
}
from
'
react
'
;
import
{
Spin
,
Button
,
Modal
,
message
,
notification
}
from
'
antd
'
;
import
moment
from
'
moment
'
;
import
PubSub
from
'
pubsub-js
'
;
import
{
Title
,
WrapperContainer
}
from
'
./components/CommonTemplate
'
;
import
{
TaskTypeSelect
}
from
'
./components/TaskTypeSelect
'
;
import
FormInformationBasic
from
'
./components/FormInformationBasic
'
;
...
...
@@ -45,7 +46,7 @@ const ServiceGoods = options => {
}
=
options
;
const
canAddService
=
permissions
[
GOOD_MANAGE
.
ADD_SERVICE_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
basicRef
=
useRef
(
null
);
const
stockRef
=
useRef
(
null
);
...
...
@@ -59,7 +60,9 @@ const ServiceGoods = options => {
const
[
categoryIds
,
setCategoryIds
]
=
useState
([]);
// 商品品类ID
const
[
isEdit
,
setIsEdit
]
=
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
[
afterAddressList
,
setAfterAddressList
]
=
useState
([]);
// 售后地址
const
[
supplierIdList
,
setSupplierIdList
]
=
useState
([]);
// 适用们店列表
...
...
@@ -159,25 +162,41 @@ const ServiceGoods = options => {
const
onResetData
=
refresh
=>
{
setPageId
(
null
);
setIsEdit
(
false
);
setProductType
(
canAddNormal
?
1
:
4
);
setProductType
(
ptype
);
setEditData
({});
setSpecKeyList
([]);
resetForm
();
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
);
if
(
info
&&
Object
.
keys
(
info
).
length
>
1
)
{
Modal
.
confirm
({
title
:
'
确认提示
'
,
content
:
'
商品信息还未保存,确认关闭弹窗?
'
,
onOk
()
{
onResetData
(
refresh
);
refreshPageList
(
refresh
,
sendData
);
},
});
}
else
{
onResetData
(
refresh
);
refreshPageList
(
refresh
,
sendData
);
}
};
...
...
@@ -210,7 +229,7 @@ const ServiceGoods = options => {
if
(
addResponse
.
data
)
{
message
.
success
(
`
${
isEdit
?
'
修改
'
:
'
添加
'
}
成功!`
);
localStorage
.
remove
(
localAutoSaveKey
);
handleCancel
(
true
);
handleCancel
(
true
,
sendData
);
}
setPageLoading
(
false
);
}
catch
(
error
)
{
...
...
@@ -371,7 +390,7 @@ const ServiceGoods = options => {
},
[
isEdit
,
options
.
visible
]);
useEffect
(()
=>
{
setProductType
(
canAddNormal
?
1
:
4
);
setProductType
(
ptype
);
},
[
canAddNormal
]);
const
onSpecCommonImgEvent
=
useCallback
(
...
...
@@ -478,7 +497,7 @@ const ServiceGoods = options => {
productType
,
canAddService
,
// 是否可以添加服务商品(电子卡券)
canAddNormal
,
// 是否可以添加实物商品
//
canTakeawayService, // 是否可以添加外卖商品
canTakeawayService
,
// 是否可以添加外卖商品
isCard
:
productType
===
4
,
isTakeawayService
:
productType
===
5
,
// 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) => {
// 外卖商品
if
(
type
===
5
)
{
const
temp
=
Object
.
assign
({},
takeawayItem
?.
intactData
,
infoMation
);
const
deepTemp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
))
const
deepTemp
=
JSON
.
parse
(
JSON
.
stringify
(
temp
))
;
deepTemp
.
categoryId
=
Array
.
isArray
(
deepTemp
.
categoryId
)
&&
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
'
));
deepTemp
.
items
.
forEach
(
item
=>
{
item
.
autoStock
=
item
.
autoStock
?
1
:
0
;
...
...
@@ -127,8 +127,8 @@ export const filterSendData = (type, params) => {
item
.
productStock
=
item
?.
serviceItem
?.
productStock
;
item
.
list
=
deepTemp
.
list
;
if
(
item
?.
specs
?.
length
)
{
item
?
.
specs
.
forEach
(
itm
=>
{
if
(
tempWeightName
.
includes
(
itm
.
unit
))
{
item
.
specs
.
forEach
(
itm
=>
{
if
(
itm
?.
unit
&&
tempWeightName
.
includes
(
itm
?
.
unit
))
{
itm
.
quantity
=
`
${
itm
?.
quantity
}
`.indexOf('约') > -1 ? itm?.quantity : `
约
$
{
itm
?.
quantity
}
`;
}
...
...
@@ -136,15 +136,17 @@ export const filterSendData = (type, params) => {
}
});
deepTemp.specList &&
deepTemp.specList.forEach(item => {
deepTemp.specList.forEach(item => {
if (item?.specs?.length) {
item?.specs.forEach(itm => {
itm.unit =
(Array.isArray(itm.unit) &&
itm.unit?.length >= 2 &&
itm.unit?.splice(itm.unit?.length - 1)[0]) ||
itm.unit;
if (tempWeightName.includes(itm.unit)) {
item.specs.forEach(itm => {
if (itm?.unit) {
itm.unit =
(Array.isArray(itm?.unit) &&
itm?.unit?.length >= 2 &&
itm?.unit?.splice(itm?.unit?.length - 1)[0]) ||
itm?.unit;
}
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
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() {
res
.
customList
=
res
.
facilities
.
customList
||
[];
res
.
selfList
=
res
.
facilities
.
selfList
||
[];
}
res
.
signDateType
=
[
res
.
signDateType
]
||
[];
res
.
signDateType
=
res
.
signDateType
?
[
res
.
signDateType
]
:
[];
res
.
accountOpenPermitImage
=
res
.
accountOpenPermitImage
?
[{
uid
:
0
,
url
:
res
.
accountOpenPermitImage
}]
:
[];
...
...
@@ -77,8 +77,11 @@ export async function getInfo() {
:
[];
// 工商局
res
.
icbProofImage
=
res
.
icbProofImage
?
[{
uid
:
0
,
url
:
res
.
icbProofImage
}]
:
[];
if
(
res
.
categoryQualificateImage
)
{
res
.
categoryQualificateImage
=
[{
uid
:
0
,
url
:
res
.
categoryQualificateImage
}];
if
(
res
.
categoryQualificateImage
&&
res
.
categoryQualificateImage
.
length
)
{
res
.
categoryQualificateImage
=
res
.
categoryQualificateImage
.
map
((
item
,
index
)
=>
({
uid
:
index
,
url
:
item
,
}));
}
if
(
res
.
otherImage
&&
res
.
otherImage
.
length
)
{
res
.
otherImage
=
res
.
otherImage
.
map
((
item
,
index
)
=>
({
...
...
@@ -126,7 +129,15 @@ export async function getInfo() {
// 删除图片
function
delImg
(
keyName
,
e
)
{
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
{
businessInfo
:
state
.
businessInfo
,
};
...
...
@@ -319,7 +330,6 @@ export async function getAreaAddr() {
label
:
item
.
addrName
,
value
:
item
.
addrId
,
}));
console
.
log
(
this
.
state
.
businessInfo
,
'
......
'
);
// 编辑时 回显 市、区、街道
if
(
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 {
}
});
}
obj
.
businessLicenseImage
=
(
imgs
?.
businessLicenseImage
?.
length
&&
imgs
?.
businessLicenseImage
[
0
].
url
)
||
''
;
obj
.
idCardEmblemImage
=
...
...
@@ -287,7 +286,11 @@ class BusinessInfo extends Component {
delete
obj
.
otherImage
;
}
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
{
delete
obj
.
categoryQualificateImage
;
}
...
...
@@ -449,9 +452,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
FormItem
label=
"联系人姓名"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
contactName
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入联系人姓名!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入联系人姓名!
'
},
{
pattern
:
/^
[
A-Za-z
\u
4e00-
\u
9fa5
]
+$/
,
message
:
'
请输入汉字或字母!
'
},
],
initialValue
:
businessInfo
.
contactName
,
})(<
Input
maxLength=
{
8
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
Col
>
<
Col
span=
{
12
}
>
...
...
@@ -604,9 +610,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
FormItem
label=
"统一社会信用代码"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
socialCode
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入统一社会信用代码!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入统一社会信用代码!
'
},
{
pattern
:
/^
[
A-Za-z0-9
]
*$/
,
message
:
'
仅支持输入数字和字母
'
},
],
initialValue
:
businessInfo
.
socialCode
,
})(<
Input
maxLength=
{
32
}
/>)
}
})(<
Input
maxLength=
{
18
}
/>)
}
</
FormItem
>
</
Col
>
{
(
!
companyNamedis
&&
...
...
@@ -680,6 +689,7 @@ class BusinessInfo extends Component {
{
...
uploadPropsFn
.
call
(
this
,
{
keyName
:
'
categoryQualificateImage
',
type
:
6,
limit
:
9,
})}
fileList=
{
businessInfo
.
categoryQualificateImage
}
>
...
...
@@ -808,7 +818,10 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
FormItem
label=
"身份证号码"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
legalPersonIdCard
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入身份证号码!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入身份证号码!
'
},
{
pattern
:
/^
[
A-Za-z0-9
]
*$/
,
message
:
'
请输入数字或字母
'
},
],
initialValue
:
businessInfo
.
legalPersonIdCard
,
})(<
Input
maxLength=
{
18
}
/>)
}
</
FormItem
>
...
...
@@ -926,9 +939,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
FormItem
label=
"开户许可证编号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
bankAccountLicenseNum
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入开户许可证编号!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入开户许可证编号!
'
},
{
pattern
:
/^
[
A-Za-z0-9
]
*$/
,
message
:
'
请输入数字或字母
'
},
],
initialValue
:
businessInfo
.
bankAccountLicenseNum
,
})(<
Input
maxLength=
{
32
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
Col
>
<
Col
span=
{
12
}
>
...
...
@@ -963,14 +979,18 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
bankAccount
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入银行帐号!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入银行帐号!
'
},
{
pattern
:
/^
[
0-9
]
*$/
,
message
:
'
请输入数字
'
},
],
initialValue
:
businessInfo
.
bankAccount
,
})(<
Input
maxLength=
{
20
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
Col
>
<
Col
span=
{
12
}
>
<
FormItem
label=
"联行号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
interbankNum
'
,
{
rules
:
[{
pattern
:
/^
[
0-9
]
*$/
,
message
:
'
请输入数字
'
}],
initialValue
:
businessInfo
.
interbankNum
,
})(<
Input
maxLength=
{
50
}
/>)
}
</
FormItem
>
...
...
@@ -1046,9 +1066,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
bankAccount
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入银行帐号!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入银行帐号!
'
},
{
pattern
:
/^
[
0-9
]
*$/
,
message
:
'
请输入数字
'
},
],
initialValue
:
businessInfo
.
bankAccount
,
})(<
Input
maxLength=
{
20
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
Col
>
</
Row
>
...
...
@@ -1107,9 +1130,12 @@ class BusinessInfo extends Component {
<
Col
span=
{
12
}
>
<
FormItem
label=
"银行帐号"
labelCol=
{
{
span
:
8
}
}
>
{
getFieldDecorator
(
'
bankAccount
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入银行帐号!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请输入银行帐号!
'
},
{
pattern
:
/^
[
0-9
]
*$/
,
message
:
'
请输入数字
'
},
],
initialValue
:
businessInfo
.
bankAccount
,
})(<
Input
maxLength=
{
20
}
/>)
}
})(<
Input
/>)
}
</
FormItem
>
</
Col
>
</
Row
>
...
...
src/pages/chainStoreManage/components/storeModal.jsx
View file @
82902dc9
...
...
@@ -4,7 +4,7 @@ import moment from 'moment';
import
{
PlusSquareFilled
,
MinusSquareFilled
}
from
'
@ant-design/icons
'
;
import
{
Modal
,
Input
,
TimePicker
,
Checkbox
,
Cascader
,
Radio
,
notification
,
Button
}
from
'
antd
'
;
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
style
from
'
./style.less
'
;
import
{
isCheckNumberLine
}
from
'
@/utils/validator
'
;
...
...
@@ -20,6 +20,7 @@ const StoreModal = props => {
formInfo
,
status
,
productBusiness
,
existTakewayShop
,
}
=
props
;
const
[
areaAddr
,
setAreaAddr
]
=
useState
([]);
const
[
visibleMap
,
setVisibleMap
]
=
useState
(
false
);
...
...
@@ -30,25 +31,19 @@ const StoreModal = props => {
address
:
''
,
});
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
();
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
=>
{
resetFields
();
onCancel
(
isSuccess
);
};
const
onSubmit
=
()
=>
{
validateFields
(
async
(
error
,
fieldsValue
)
=>
{
if
(
!
error
)
{
...
...
@@ -59,7 +54,7 @@ const StoreModal = props => {
params
[
areaArr
[
i
]]
=
item
;
});
}
if
(
params
.
shopHeadImage
.
length
)
{
if
(
params
?.
shopHeadImage
?
.
length
)
{
// eslint-disable-next-line prefer-destructuring
params
.
shopHeadImage
=
params
.
shopHeadImage
[
0
];
}
...
...
@@ -219,10 +214,42 @@ const StoreModal = props => {
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
(()
=>
{
if
(
visible
)
{
resetFields
();
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
)
{
info
.
week
=
info
.
businessHours
.
weeks
;
const
hours
=
info
.
businessHours
.
hoursItems
;
...
...
@@ -235,13 +262,13 @@ const StoreModal = props => {
});
});
}
info
.
lnglat
=
`
${
info
.
longitude
}
,
${
info
.
latitude
}
`
;
info
.
addr
=
[
info
.
provinceId
,
info
.
cityId
,
info
.
countyId
];
info
.
shopHeadImage
=
[
info
.
shopHeadImage
]
||
[];
info
.
shopHeadImage
=
(
info
.
shopHeadImage
&&
[
info
.
shopHeadImage
])
||
[];
if
(
info
.
townId
)
{
info
.
addr
.
push
(
info
.
townId
);
}
console
.
log
(
info
);
setTimes
(
harr
);
setFormData
(
info
);
getLazyAddr
(
info
);
...
...
@@ -278,8 +305,9 @@ const StoreModal = props => {
<
Form
{
...
layout
}
name=
"formData"
>
<
FormItem
label=
"业务模式"
>
{
getFieldDecorator
(
'
productBusiness
'
,
{
initialValue
:
productBusiness
,
})(<
Checkbox
.
Group
disabled
options=
{
businessModel
}
/>)
}
rules
:
[{
required
:
true
,
message
:
'
请选择业务模式
'
}],
initialValue
:
formData
.
productBusiness
,
})(<
Checkbox
.
Group
disabled=
{
disabled
}
options=
{
businessModel
}
onChange=
{
onBusiness
}
/>)
}
</
FormItem
>
{
isDisabled
&&
(
<
FormItem
label=
"门店头像"
>
...
...
@@ -317,18 +345,12 @@ const StoreModal = props => {
<
div
>
<
FormItem
name=
{
item
.
name
}
>
{
getFieldDecorator
(
item
.
name
,
{
rules
:
[{
required
:
true
,
message
:
'
请选择营业时间!
'
}],
rules
:
[
{
required
:
true
,
message
:
'
请选择营业时间!
'
},
{
validator
:
timerWrapper
,
message
:
'
选择开始时间结束时间不能一样
'
},
],
initialValue
:
formData
[
item
.
name
],
})(
<
TimePicker
.
RangePicker
format=
"HH:mm"
showTime=
{
{
hideDisabledOptions
:
true
,
defaultValue
:
[
moment
(
'
00:00
'
,
'
HH:mm
'
),
moment
(
'
23:59
'
,
'
HH:mm
'
)],
}
}
disabled=
{
disabled
}
/>,
)
}
})(<
TimePicker
.
RangePicker
format=
"HH:mm"
disabled=
{
disabled
}
/>)
}
</
FormItem
>
</
div
>
{
!
disabled
&&
...
...
src/pages/chainStoreManage/data.js
View file @
82902dc9
...
...
@@ -18,13 +18,6 @@ export const layout = {
wrapperCol
:
{
span
:
16
},
};
// 业务模式
export
const
businessModel
=
[
{
label
:
'
到家外卖业务(外卖配送业务)
'
,
value
:
1
},
{
label
:
'
实物商品业务员
'
,
value
:
2
},
{
label
:
'
到店业务(服务类业务)
'
,
value
:
3
},
];
export
const
businessList
=
[
{
label
:
'
外卖
'
,
value
:
1
},
{
label
:
'
实物类
'
,
value
:
2
},
...
...
src/pages/chainStoreManage/index.jsx
View file @
82902dc9
...
...
@@ -25,30 +25,33 @@ export default () => {
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
[
storeInfo
,
setStoreInfo
]
=
useState
({});
const
[
areaAddr
,
setAreaAddr
]
=
useState
([]);
const
[
status
,
setStatus
]
=
useState
();
const
[
status
,
setStatus
]
=
useState
(
false
);
const
[
dataList
,
setDataList
]
=
useState
([]);
const
[
pageNo
,
setPageNo
]
=
useState
(
1
);
const
[
totalNum
,
setTotalNum
]
=
useState
(
0
);
const
[
pageSize
,
setPageSize
]
=
useState
(
20
);
const
[
productBusiness
,
setProductBusiness
]
=
useState
([]);
const
[
existTakewayShop
,
setExistTakewayShop
]
=
useState
(
false
);
const
refSearch
=
useRef
();
const
divDom
=
useRef
();
// 获取业务模式
const
getBusiness
=
async
()
=>
{
const
res
=
await
apiproductBusiness
();
setProductBusiness
(
res
);
if
(
res
)
{
setProductBusiness
(
res
.
productBusiness
||
[]);
setExistTakewayShop
(
res
.
existTakewayShop
);
}
setVisible
(
true
);
};
const
onCreate
=
()
=>
{
setStatus
(
'
add
'
);
setStoreInfo
({});
setVisible
(
true
);
getBusiness
();
};
const
onShowInfo
=
(
info
,
val
)
=>
{
setStoreInfo
(
info
);
const
value
=
val
!==
'
edit
'
;
setStatus
(
value
);
setVisible
(
true
);
setStatus
(
val
);
getBusiness
();
};
...
...
@@ -122,6 +125,9 @@ export default () => {
if
(
val
.
businessStatus
)
{
params
.
businessStatus
=
val
.
businessStatus
;
}
if
(
val
.
productBusiness
)
{
params
.
productBusiness
=
val
.
productBusiness
;
}
getList
(
params
);
};
...
...
@@ -215,8 +221,8 @@ export default () => {
dataIndex
:
'
productBusiness
'
,
width
:
120
,
align
:
'
center
'
,
render
:
v
=>
v
&&
(
render
:
(
v
,
value
)
=>
v
alue
?.
productBusiness
?.
length
&&
(
<
div
>
{
v
.
map
(
it
=>
(
<
span
>
{
businessList
.
find
(
item
=>
+
it
===
+
item
.
value
).
label
}
</
span
>
...
...
@@ -265,7 +271,7 @@ export default () => {
fixed
:
'
right
'
,
render
:
(
val
,
r
)
=>
(
<
div
className=
{
style
.
actionBtn
}
>
<
Button
key=
"look"
onClick=
{
()
=>
onShowInfo
(
r
)
}
>
<
Button
key=
"look"
onClick=
{
()
=>
onShowInfo
(
r
,
'
look
'
)
}
>
查看
</
Button
>
<
Button
key=
"seek"
onClick=
{
()
=>
onShowInfo
(
r
,
'
edit
'
)
}
>
...
...
@@ -309,6 +315,17 @@ export default () => {
</
Select
>
</
Form
.
Item
>
</
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
>
<
div
className=
{
style
.
search
}
>
<
Button
type=
"primary"
htmlType=
"submit"
size=
"middle"
>
...
...
@@ -351,6 +368,7 @@ export default () => {
formInfo=
{
storeInfo
}
status=
{
status
}
productBusiness=
{
productBusiness
}
existTakewayShop=
{
existTakewayShop
}
/>
</
div
>
);
...
...
src/utils/utils.js
View file @
82902dc9
...
...
@@ -154,20 +154,20 @@ export const getObjectType = v => Object.prototype.toString.call(v).replace(/\[o
export
const
getErrorMessage
=
err
=>
{
const
message
=
'
请检查表单数据!
'
;
// eslint-disable-next-line wrap-iife
//
(function getMsg(v) {
//
if (Array.isArray(v)) {
//
getMsg(v[0]);
//
} else {
//
const keys = Object.keys(v);
//
if (Array.isArray(v[keys[0]])) {
//
getMsg(v[keys[0]][0]);
//
} else if (v[keys[0]].errors && v[keys[0]].errors.length) {
//
// eslint-disable-next-line no-const-assign
//
message = v[keys[0]].errors[0].message;
//
} else {
//
getMsg(v);
//
}
//
}
//
})(err);
(
function
getMsg
(
v
)
{
if
(
Array
.
isArray
(
v
))
{
getMsg
(
v
[
0
]);
}
else
{
const
keys
=
Object
.
keys
(
v
);
if
(
Array
.
isArray
(
v
[
keys
[
0
]]))
{
getMsg
(
v
[
keys
[
0
]][
0
]);
}
else
if
(
v
[
keys
[
0
]].
errors
&&
v
[
keys
[
0
]].
errors
.
length
)
{
// eslint-disable-next-line no-const-assign
message
=
v
[
keys
[
0
]].
errors
[
0
].
message
;
}
else
{
getMsg
(
v
);
}
}
})(
err
);
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