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
f1e3c41b
Commit
f1e3c41b
authored
Jun 13, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改餐品类型
parent
ee7dfdf8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
125 additions
and
54 deletions
+125
-54
CustomerInfo.jsx
src/pages/businessCustomer/components/CustomerInfo.jsx
+13
-11
GoodPriceModal.jsx
src/pages/businessGoods/components/GoodPriceModal.jsx
+15
-9
SelectGoodsModal.jsx
src/pages/businessGoods/components/SelectGoodsModal.jsx
+22
-7
goods.js
src/pages/businessGoods/staticData/goods.js
+31
-5
takeawayGoods.jsx
src/pages/businessGoods/takeawayGoods.jsx
+3
-3
takeawayGoodsInfo.jsx
src/pages/businessGoods/takeawayGoodsInfo.jsx
+24
-6
virtualGoods.jsx
src/pages/businessGoods/virtualGoods.jsx
+9
-7
virtualGoodsInfo.jsx
src/pages/businessGoods/virtualGoodsInfo.jsx
+8
-6
No files found.
src/pages/businessCustomer/components/CustomerInfo.jsx
View file @
f1e3c41b
...
...
@@ -152,24 +152,26 @@ const CustomerInfo = props => {
});
};
// 改变餐品类型
// 改变餐品类型
(1和2要选都选 要不都不选)
const
onChangeMealType
=
async
ms
=>
{
try
{
if
(
props
.
info
&&
props
.
info
.
id
&&
ms
.
length
<
mealTypes
.
length
)
{
await
checkConfirm
();
}
if
(
mealTypes
.
includes
(
'
1
'
)
&&
mealTypes
.
includes
(
'
2
'
))
{
if
(
!
(
ms
.
includes
(
'
1
'
)
&&
ms
.
includes
(
'
2
'
)))
{
if
(
ms
.
includes
(
'
4
'
))
{
ms
=
[
'
4
'
];
}
else
{
ms
=
[];
}
console
.
log
(
'
ms :>>
'
,
ms
);
if
(
mealTypes
.
length
>
ms
.
length
)
{
if
(
ms
.
includes
(
'
1
'
)
&&
ms
.
includes
(
'
2
'
))
{
ms
=
[
'
1
'
,
'
2
'
];
}
else
if
(
ms
.
includes
(
'
4
'
))
{
ms
=
[
'
4
'
];
}
else
{
ms
=
[];
}
}
else
if
(
ms
.
length
<
3
&&
ms
.
length
)
{
ms
=
[
'
1
'
,
'
2
'
];
}
else
if
(
ms
.
includes
(
'
1
'
)
||
ms
.
includes
(
'
2
'
))
{
if
(
ms
.
includes
(
'
4
'
))
{
ms
.
push
(
'
4
'
);
ms
=
[
'
1
'
,
'
2
'
,
'
4
'
];
}
else
{
ms
=
[
'
1
'
,
'
2
'
];
}
}
form
.
setFieldsValue
({
...
...
src/pages/businessGoods/components/GoodPriceModal.jsx
View file @
f1e3c41b
import
React
,
{
useEffect
}
from
'
react
'
;
import
{
Form
,
InputNumber
,
Modal
,
notification
}
from
'
antd
'
;
import
{
layout
}
from
'
../staticData/goods
'
;
import
{
isCheckPriceTwoDecimal
}
from
'
@/utils/validator
'
;
import
{
apiMealInfoUpdate
}
from
'
../service
'
;
const
SaleDateModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
layout
=
{
labelCol
:
{
span
:
8
},
wrapperCol
:
{
span
:
14
},
};
// 关闭弹窗
const
handleCancel
=
()
=>
{
props
.
handleClose
(
false
);
...
...
@@ -16,14 +20,16 @@ const SaleDateModal = props => {
const
handleConfirm
=
async
()
=>
{
const
res
=
await
form
.
validateFields
();
console
.
log
(
'
res :>>
'
,
res
);
const
params
=
{
id
:
props
.
id
,
enterprisePrice
:
res
.
price
,
};
await
apiMealInfoUpdate
(
params
);
notification
.
success
({
message
:
'
保存成功
'
});
if
(
props
.
id
)
{
const
params
=
{
id
:
props
.
id
,
enterprisePrice
:
res
.
price
,
};
await
apiMealInfoUpdate
(
params
);
notification
.
success
({
message
:
'
保存成功
'
});
}
handleCancel
();
props
.
handleRefresh
();
props
.
handleRefresh
(
res
.
price
);
};
useEffect
(()
=>
{
...
...
@@ -38,7 +44,7 @@ const SaleDateModal = props => {
open=
{
props
.
visible
}
destroyOnClose
maskClosable=
{
false
}
width=
"
3
00px"
width=
"
4
00px"
okText=
"保存"
onOk=
{
handleConfirm
}
onCancel=
{
handleCancel
}
...
...
src/pages/businessGoods/components/SelectGoodsModal.jsx
View file @
f1e3c41b
...
...
@@ -11,7 +11,7 @@ const { Option } = Select;
const
SaleDateModal
=
props
=>
{
const
[
searchType
,
setSearchType
]
=
useState
(
'
1
'
);
const
[
searchKeyword
,
setSearchKeyword
]
=
useState
(
''
);
const
[
goodsType
,
setGoodsType
]
=
useState
(
'
1
'
);
//
const [goodsType, setGoodsType] = useState('1');
const
[
shopId
,
setShopId
]
=
useState
();
const
[
searchName
,
setSearchName
]
=
useState
(
''
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
...
...
@@ -19,7 +19,7 @@ const SaleDateModal = props => {
const
[
pageSize
,
setPageSize
]
=
useState
(
10
);
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
dataSource
,
setDataSource
]
=
useState
([]);
const
[
shopList
,
setShopList
]
=
useState
(
jsonToArray
(
productType
)
);
const
[
shopList
,
setShopList
]
=
useState
(
[]
);
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
selectedRows
,
setSelectedRows
]
=
useState
([]);
...
...
@@ -90,9 +90,18 @@ const SaleDateModal = props => {
notification
.
error
({
message
:
'
请选择要添加的商品
'
});
return
;
}
let
shopName
=
''
;
if
(
shopList
)
{
shopList
.
forEach
(
item
=>
{
if
(
+
item
.
value
===
+
shopId
)
{
shopName
=
item
.
label
;
}
});
}
const
arr
=
deepClone
(
selectedRows
).
map
(
item
=>
({
...
item
,
shopId
,
shopName
,
}));
props
.
onSelectChange
(
arr
);
handleCancel
();
...
...
@@ -123,9 +132,11 @@ const SaleDateModal = props => {
const
onSelectAllChange
=
(
selected
,
rows
)
=>
{
const
keys
=
[...
selectedRowKeys
];
const
arr
=
[...
selectedRows
];
console
.
log
(
'
selected :>>
'
,
selected
);
console
.
log
(
'
rows :>>
'
,
rows
);
if
(
selected
)
{
rows
.
forEach
(
item
=>
{
if
(
!
keys
.
includes
(
item
.
skuId
))
{
if
(
item
&&
!
keys
.
includes
(
item
.
skuId
))
{
keys
.
push
(
item
.
skuId
);
arr
.
push
(
item
);
}
...
...
@@ -181,13 +192,17 @@ const SaleDateModal = props => {
};
const
selectBefore
=
(
<
Select
defaultValue=
"1"
onChange=
{
setSearchType
}
>
<
Option
value=
"1"
>
名称
</
Option
>
<
Option
value=
"2"
>
SKU
</
Option
>
<
Option
value=
"1"
key=
{
1
}
>
名称
</
Option
>
<
Option
value=
"2"
key=
{
2
}
>
SKU
</
Option
>
</
Select
>
);
const
selectAfter
=
<
SearchOutlined
onClick=
{
onSearch
}
/>;
const
footers
=
()
=>
[
<
div
className=
{
style
.
footers
}
>
<
div
className=
{
style
.
footers
}
key=
"footer"
>
<
Pagination
defaultCurrent=
{
1
}
total=
{
total
}
showQuickJumper
onChange=
{
onPageChange
}
/>
<
div
className=
{
style
[
'
footers-btn
'
]
}
>
<
div
className=
{
style
[
'
footers-desc
'
]
}
>
...
...
@@ -205,7 +220,7 @@ const SaleDateModal = props => {
useEffect
(()
=>
{
getShopList
();
setGoodsType
(
props
.
productType
);
//
setGoodsType(props.productType);
},
[]);
return
(
...
...
src/pages/businessGoods/staticData/goods.js
View file @
f1e3c41b
...
...
@@ -26,6 +26,13 @@ export const productType = {
5
:
'
外卖商品
'
,
};
// 餐品类型:(1外卖 2 自助餐 4到店)
export
const
mealType
=
{
1
:
'
外卖
'
,
2
:
'
自助餐
'
,
4
:
'
到店
'
,
};
export
const
weekOptions
=
{
1
:
'
周一
'
,
2
:
'
周二
'
,
...
...
@@ -244,11 +251,11 @@ export const takeawayGoodsColumn = options => {
};
export
const
GoodsInfoColumn
=
options
=>
{
const
{
onDel
,
setVisibleSaleDate
,
setVisibleSaleSection
,
setEditID
}
=
options
;
const
{
onDel
,
setVisibleSaleDate
,
setVisibleSaleSection
,
setEditID
,
setVisiblePrice
}
=
options
;
return
[
{
title
:
'
微店名称
'
,
dataIndex
:
'
shop
Id
'
,
dataIndex
:
'
shop
Name
'
,
},
{
title
:
'
商品名称
'
,
...
...
@@ -263,9 +270,22 @@ export const GoodsInfoColumn = options => {
},
{
title
:
'
企业价格
'
,
dataIndex
:
'
activity
Price
'
,
dataIndex
:
'
enterprise
Price
'
,
width
:
120
,
align
:
'
center
'
,
render
:
(
_
,
record
)
=>
(
<
Space
>
<
span
>
{
_
}
<
/span
>
<
span
onClick
=
{()
=>
{
setEditID
(
record
.
skuId
);
setVisiblePrice
(
true
);
}}
>
<
FormOutlined
/>
<
/span
>
<
/Space
>
),
},
{
title
:
'
库存
'
,
...
...
@@ -302,7 +322,7 @@ export const GoodsInfoColumn = options => {
},
{
title
:
'
可售餐段
'
,
dataIndex
:
'
mealTyp
e
'
,
dataIndex
:
'
tabCat
e
'
,
align
:
'
center
'
,
hideInSearch
:
true
,
render
:
(
_
,
record
)
=>
(
...
...
@@ -321,10 +341,16 @@ export const GoodsInfoColumn = options => {
},
{
title
:
'
餐品类型
'
,
dataIndex
:
'
mealType
'
,
dataIndex
:
'
mealType
List
'
,
width
:
120
,
align
:
'
center
'
,
hideInSearch
:
true
,
render
(
arr
)
{
if
(
arr
&&
arr
.
length
)
{
return
arr
.
map
(
item
=>
mealType
[
item
]).
join
(
'
/
'
);
}
return
'
-
'
;
},
},
{
title
:
'
操作
'
,
...
...
src/pages/businessGoods/takeawayGoods.jsx
View file @
f1e3c41b
...
...
@@ -85,14 +85,14 @@ const TakeawayGoods = () => {
// 根据企业ID获取取餐点
const
getPickSelf
=
async
id
=>
{
const
res
=
await
apiSelPickSelfList
({
enterpriseId
:
id
});
if
(
res
)
{
if
(
res
&&
res
.
data
)
{
setPickSelfList
(
res
.
map
(
item
=>
({
res
.
data
.
map
(
item
=>
({
key
:
item
.
pickSelfId
,
label
:
<
span
>
{
item
.
pickSelfName
}
</
span
>,
})),
);
setActiveKey
(
res
[
0
].
pickSelfId
);
setActiveKey
(
res
.
data
[
0
].
pickSelfId
);
}
};
...
...
src/pages/businessGoods/takeawayGoodsInfo.jsx
View file @
f1e3c41b
...
...
@@ -4,6 +4,7 @@ import { useHistory } from 'react-router-dom';
import
{
PageHeaderWrapper
}
from
'
@ant-design/pro-layout
'
;
import
{
GoodsInfoColumn
}
from
'
./staticData/goods
'
;
import
SaleDateModal
from
'
./components/SaleDateModal
'
;
import
GoodPriceModal
from
'
./components/GoodPriceModal
'
;
import
SaleSectionModal
from
'
./components/SaleSectionModal
'
;
import
SelectGoodsModal
from
'
./components/SelectGoodsModal
'
;
import
{
apiSelPickSelfList
,
apiPickSelfList
,
apiSaveGoodsList
}
from
'
./service
'
;
...
...
@@ -17,6 +18,7 @@ const TakeawayGoodsInfo = props => {
const
[
visibleSaleDate
,
setVisibleSaleDate
]
=
useState
(
false
);
// 可售日期弹窗
const
[
visibleSaleSection
,
setVisibleSaleSection
]
=
useState
(
false
);
// 可售餐段弹窗
const
[
visibleSelectGoods
,
setVisibleSelectGoods
]
=
useState
(
false
);
// 选择商品弹窗
const
[
visiblePrice
,
setVisiblePrice
]
=
useState
(
false
);
// 修改企业商品价格弹窗
const
[
dataSource
,
setDataSource
]
=
useState
([]);
const
[
pickSelfList
,
setPickSelfList
]
=
useState
([]);
// 取餐点列表
const
[
slePickSelf
,
setSelPickSelf
]
=
useState
([]);
// 选中的取餐点列表
...
...
@@ -37,6 +39,7 @@ const TakeawayGoodsInfo = props => {
enterprisePrice
:
item
.
enterprisePrice
,
mealTypeList
:
item
.
mealType
,
saleDateList
:
item
.
saleDate
,
tabCateList
:
{
tabId
:
item
.
tabCate
},
}));
const
params
=
{
shopId
:
id
,
...
...
@@ -44,9 +47,11 @@ const TakeawayGoodsInfo = props => {
pickSelfIdList
:
slePickSelf
,
skuInfoList
,
};
await
apiSaveGoodsList
(
params
);
notification
.
success
({
message
:
'
添加成功
'
});
onCancel
();
const
res
=
await
apiSaveGoodsList
(
params
);
if
(
res
&&
res
.
success
)
{
notification
.
success
({
message
:
'
添加成功
'
});
onCancel
();
}
};
// 删除
...
...
@@ -74,7 +79,7 @@ const TakeawayGoodsInfo = props => {
enterpriseId
:
id
,
});
if
(
res
&&
res
.
data
)
{
setSelPickSelf
(
res
.
map
(
item
=>
item
.
pickSelfId
));
setSelPickSelf
(
res
.
data
.
map
(
item
=>
item
.
pickSelfId
));
}
};
...
...
@@ -115,6 +120,7 @@ const TakeawayGoodsInfo = props => {
setVisibleSaleSection
,
setEditID
,
onDel
,
setVisiblePrice
,
};
return
(
...
...
@@ -176,7 +182,11 @@ const TakeawayGoodsInfo = props => {
批量配置餐段
</
Button
>
</
div
>
<
Table
columns=
{
GoodsInfoColumn
(
options
)
}
dataSource=
{
dataSource
}
/>
<
Table
columns=
{
GoodsInfoColumn
(
options
)
}
pagination=
{
false
}
dataSource=
{
dataSource
}
/>
</
Col
>
</
Row
>
<
Row
className=
{
style
[
'
info-box--btns
'
]
}
>
...
...
@@ -205,10 +215,18 @@ const TakeawayGoodsInfo = props => {
{
visibleSaleSection
&&
(
<
SaleSectionModal
visible=
{
visibleSaleSection
}
handleRefresh=
{
v
=>
refreshList
(
'
mealTyp
e
'
,
v
)
}
handleRefresh=
{
v
=>
refreshList
(
'
tabCat
e
'
,
v
)
}
handleClose=
{
()
=>
setVisibleSaleSection
(
false
)
}
/>
)
}
{
/* 修改企业商品价格弹窗 */
}
{
visiblePrice
&&
(
<
GoodPriceModal
visible=
{
visiblePrice
}
handleRefresh=
{
v
=>
refreshList
(
'
enterprisePrice
'
,
v
)
}
handleClose=
{
()
=>
setVisiblePrice
(
false
)
}
/>
)
}
{
/* 选择商品弹窗 */
}
{
visibleSelectGoods
&&
(
<
SelectGoodsModal
...
...
src/pages/businessGoods/virtualGoods.jsx
View file @
f1e3c41b
...
...
@@ -79,13 +79,15 @@ const VirtualGoods = () => {
// 根据企业ID获取取餐点
const
getPickSelf
=
async
()
=>
{
const
res
=
await
apiSelPickSelfList
({});
setPickSelfList
(
res
.
map
(
item
=>
({
key
:
item
.
pickSelfId
,
label
:
<
span
>
{
item
.
pickSelfName
}
</
span
>,
})),
);
setActiveKey
(
res
[
0
].
pickSelfId
);
if
(
res
&&
res
.
data
)
{
setPickSelfList
(
res
.
data
.
map
(
item
=>
({
key
:
item
.
pickSelfId
,
label
:
<
span
>
{
item
.
pickSelfName
}
</
span
>,
})),
);
setActiveKey
(
res
.
data
[
0
].
pickSelfId
);
}
};
// 获取企业列表
...
...
src/pages/businessGoods/virtualGoodsInfo.jsx
View file @
f1e3c41b
...
...
@@ -59,12 +59,14 @@ const VirtualGoodsInfo = props => {
const
res
=
await
apiShopListByEnterpriseID
({
enterpriseId
:
id
,
});
setShopList
(
res
.
map
(
item
=>
({
key
:
item
.
id
,
label
:
<
span
>
{
item
.
name
}
</
span
>,
})),
);
if
(
res
&&
res
.
data
)
{
setShopList
(
res
.
data
.
map
(
item
=>
({
key
:
item
.
id
,
label
:
item
.
name
,
})),
);
}
};
// 刷新列表数据
...
...
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