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
81e54fd6
Commit
81e54fd6
authored
Jun 13, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改外卖商品列表
parent
f1e3c41b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
85 additions
and
62 deletions
+85
-62
env.config.js
config/env.config.js
+1
-1
SelectGoodsModal.jsx
src/pages/businessGoods/components/SelectGoodsModal.jsx
+1
-0
goods.js
src/pages/businessGoods/staticData/goods.js
+17
-16
takeawayGoods.jsx
src/pages/businessGoods/takeawayGoods.jsx
+55
-40
takeawayGoodsInfo.jsx
src/pages/businessGoods/takeawayGoodsInfo.jsx
+5
-3
virtualGoods.jsx
src/pages/businessGoods/virtualGoods.jsx
+1
-1
utils.js
src/utils/utils.js
+1
-1
utils.less
src/utils/utils.less
+4
-0
No files found.
config/env.config.js
View file @
81e54fd6
...
...
@@ -5,7 +5,7 @@ const environment = 'sc';
// 从tob进入的判断接口前缀
const
getUrlParams
=
name
=>
{
const
regArg
=
new
RegExp
(
`(^|&)
${
name
}
=([^&]*)(&|$)`
);
const
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
regArg
);
const
r
=
window
.
location
.
search
.
substr
ing
(
1
).
match
(
regArg
);
if
(
r
!=
null
)
return
decodeURIComponent
(
r
[
2
]);
return
null
;
};
...
...
src/pages/businessGoods/components/SelectGoodsModal.jsx
View file @
81e54fd6
...
...
@@ -104,6 +104,7 @@ const SaleDateModal = props => {
shopName
,
}));
props
.
onSelectChange
(
arr
);
props
.
onChangeShop
(
shopId
);
handleCancel
();
};
...
...
src/pages/businessGoods/staticData/goods.js
View file @
81e54fd6
...
...
@@ -46,7 +46,6 @@ export const weekOptions = {
export
const
takeawayGoodsColumn
=
options
=>
{
const
{
onDel
,
companyEnum
,
shopEnum
,
onChangeFlag
,
setVisibleSaleDate
,
...
...
@@ -73,28 +72,27 @@ export const takeawayGoodsColumn = options => {
title
:
'
微店名称
'
,
dataIndex
:
'
shopId
'
,
hideInTable
:
true
,
fieldProps
:
{
showSearch
:
true
,
},
//
fieldProps: {
//
showSearch: true,
//
},
// request: getShopList,
// valueEnum: {}, // shopEnum,
},
{
title
:
'
SKU编码
'
,
dataIndex
:
'
skuId
'
,
width
:
1
2
0
,
width
:
1
6
0
,
align
:
'
center
'
,
},
{
title
:
'
商品名称
'
,
dataIndex
:
'
skuName
'
,
width
:
120
,
align
:
'
center
'
,
},
{
title
:
'
商品图片
'
,
dataIndex
:
'
primaryImage
'
,
width
:
12
0
,
width
:
8
0
,
align
:
'
center
'
,
hideInSearch
:
true
,
valueType
:
'
image
'
,
...
...
@@ -121,13 +119,13 @@ export const takeawayGoodsColumn = options => {
},
{
title
:
'
可售餐段
'
,
dataIndex
:
'
saleDate
'
,
dataIndex
:
'
tabCateList
'
,
width
:
120
,
align
:
'
center
'
,
hideInSearch
:
true
,
render
:
(
_
,
record
)
=>
(
<
Space
>
<
span
>
{
_
}
<
/span
>
{
_
&&
_
.
length
&&
<
span
>
{
_
.
map
(
item
=>
item
.
tabName
).
join
(
'
/
'
)}
<
/span>
}
<
span
onClick
=
{()
=>
{
setRecordID
(
record
.
id
);
...
...
@@ -142,7 +140,7 @@ export const takeawayGoodsColumn = options => {
{
title
:
'
企业价格
'
,
dataIndex
:
'
activityPrice
'
,
width
:
1
2
0
,
width
:
1
0
0
,
align
:
'
center
'
,
hideInSearch
:
true
,
render
:
(
_
,
record
)
=>
(
...
...
@@ -162,14 +160,14 @@ export const takeawayGoodsColumn = options => {
{
title
:
'
商品销售价
'
,
dataIndex
:
'
price
'
,
width
:
1
2
0
,
width
:
1
0
0
,
align
:
'
center
'
,
hideInSearch
:
true
,
},
{
title
:
'
状态
'
,
dataIndex
:
'
status
'
,
width
:
12
0
,
width
:
8
0
,
align
:
'
center
'
,
hideInSearch
:
true
,
valueEnum
:
{
...
...
@@ -181,7 +179,7 @@ export const takeawayGoodsColumn = options => {
{
title
:
'
排序
'
,
dataIndex
:
'
sort
'
,
width
:
12
0
,
width
:
8
0
,
align
:
'
center
'
,
hideInSearch
:
true
,
render
:
(
_
,
record
)
=>
(
...
...
@@ -201,7 +199,7 @@ export const takeawayGoodsColumn = options => {
{
title
:
'
列出商品
'
,
dataIndex
:
'
showFlag
'
,
width
:
12
0
,
width
:
8
0
,
align
:
'
center
'
,
hideInSearch
:
true
,
render
:
(
_
,
record
)
=>
(
...
...
@@ -215,7 +213,7 @@ export const takeawayGoodsColumn = options => {
{
title
:
'
餐品类型
'
,
dataIndex
:
'
mealType
'
,
width
:
12
0
,
width
:
8
0
,
align
:
'
center
'
,
hideInSearch
:
true
,
},
...
...
@@ -225,6 +223,9 @@ export const takeawayGoodsColumn = options => {
width
:
120
,
valueType
:
'
dateRange
'
,
align
:
'
center
'
,
render
(
v
,
record
)
{
return
record
.
createDate
;
},
},
{
title
:
'
当日餐段
'
,
...
...
@@ -347,7 +348,7 @@ export const GoodsInfoColumn = options => {
hideInSearch
:
true
,
render
(
arr
)
{
if
(
arr
&&
arr
.
length
)
{
return
arr
.
map
(
item
=>
mealType
[
item
]
).
join
(
'
/
'
);
return
arr
.
map
(
item
=>
item
.
name
).
join
(
'
/
'
);
}
return
'
-
'
;
},
...
...
src/pages/businessGoods/takeawayGoods.jsx
View file @
81e54fd6
...
...
@@ -17,47 +17,59 @@ import { getToUrlQuery } from '@/utils/utils';
const
TakeawayGoods
=
()
=>
{
const
history
=
useHistory
();
const
refTable
=
useRef
();
const
[
pageLoad
ing
,
setPageLoading
]
=
useState
(
tru
e
);
// 可售日期弹窗
const
[
pageLoad
ed
,
setPageLoaded
]
=
useState
(
fals
e
);
// 可售日期弹窗
const
[
visibleSaleDate
,
setVisibleSaleDate
]
=
useState
(
false
);
// 可售日期弹窗
const
[
visibleSaleSection
,
setVisibleSaleSection
]
=
useState
(
false
);
// 可售餐段弹窗
const
[
visiblePrice
,
setVisiblePrice
]
=
useState
(
false
);
// 修改企业商品价格弹窗
const
[
visibleSort
,
setVisibleSort
]
=
useState
(
false
);
// 商品排序弹窗
const
[
enterprises
,
setEnterprises
]
=
useState
({
1
:
{
text
:
'
领红包
'
}
});
// 企业列表
const
[
enterprises
,
setEnterprises
]
=
useState
({});
// 企业列表
const
[
shopEnum
,
setShopEnum
]
=
useState
({});
// 店铺列表
const
[
activeKey
,
setActiveKey
]
=
useState
(
''
);
const
[
enterpriseId
,
setEnterpriseId
]
=
useState
(
'
1
'
);
const
[
enterpriseId
,
setEnterpriseId
]
=
useState
();
const
[
pickSelfList
,
setPickSelfList
]
=
useState
([]);
// 取餐点列表
const
[
recordID
,
setRecordID
]
=
useState
(
''
);
// 编辑的记录ID
// 刷新列表
const
onRefresh
=
()
=>
{
if
(
pageLoaded
)
{
refTable
.
current
.
reloadAndRest
();
// refTable.current.reload();
}
};
// 搜索商品列表
const
searchList
=
async
params
=>
{
if
(
params
.
enterpriseId
&&
params
.
enterpriseId
!==
enterpriseId
)
{
setEnterpriseId
(
params
.
enterpriseId
);
}
const
data
=
{
page
:
params
.
current
,
size
:
params
.
pageSize
,
data
:
Object
.
assign
(
{
enterpriseId
,
},
params
,
),
page
:
params
.
current
||
1
,
size
:
params
.
pageSize
||
10
,
data
:
Object
.
assign
({},
params
,
{
enterpriseId
,
pickSelfId
:
activeKey
,
}),
};
const
res
=
await
apiTakeawayList
(
data
);
if
(
res
&&
res
.
records
)
{
return
{
data
:
res
.
records
||
[],
total
:
res
.
total
||
0
,
};
}
return
{
data
:
res
.
records
,
total
:
res
.
total
,
data
:
[]
,
total
:
0
,
};
};
// 删除商品
const
onDel
=
async
id
=>
{
await
apiMealInfoDel
({
id
,
});
refTable
.
current
.
reload
();
notification
.
success
({
message
:
'
删除成功
'
,
});
};
// 跳转添加商品
const
onAdd
=
async
()
=>
{
const
params
=
getToUrlQuery
();
const
query
=
Object
.
assign
(
...
...
@@ -72,7 +84,7 @@ const TakeawayGoods = () => {
query
,
});
};
// 修改商品是否列出
const
onChangeFlag
=
async
(
id
,
checked
)
=>
{
const
params
=
{
id
,
...
...
@@ -80,28 +92,33 @@ const TakeawayGoods = () => {
};
await
apiMealInfoUpdate
(
params
);
notification
.
success
({
message
:
'
保存成功
'
});
onRefresh
();
};
// 根据企业ID获取取餐点
const
getPickSelf
=
async
id
=>
{
const
res
=
await
apiSelPickSelfList
({
enterpriseId
:
id
});
if
(
res
&&
res
.
data
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
length
)
{
setPickSelfList
(
res
.
data
.
map
(
item
=>
({
key
:
item
.
pickSelfId
,
key
:
`
${
item
.
pickSelfId
}
`
,
label
:
<
span
>
{
item
.
pickSelfName
}
</
span
>,
})),
);
setActiveKey
(
res
.
data
[
0
].
pickSelfId
);
const
pid
=
res
.
data
[
0
].
pickSelfId
;
setActiveKey
(
`
${
pid
}
`
);
if
(
pageLoaded
)
{
onRefresh
();
}
}
else
{
setPickSelfList
([]);
setActiveKey
(
''
);
if
(
pageLoaded
)
{
onRefresh
();
}
}
};
// 根据企业ID获取取餐点
// const getShops = async () => {
// const res = await getShopList({});
// setShopEnum(res.list);
// };
// 改变企业
const
onChangeEnterprise
=
v
=>
{
setEnterpriseId
(
v
);
...
...
@@ -113,18 +130,14 @@ const TakeawayGoods = () => {
const
obj
=
await
getEnterpriseList
();
if
(
obj
.
list
&&
Object
.
keys
(
obj
.
list
).
length
)
{
setEnterprises
(
obj
.
list
);
setEnterpriseId
(
obj
.
id
);
getPickSelf
(
obj
.
id
);
setPageLoad
ing
(
true
);
setEnterpriseId
(
`
${
obj
.
id
}
`
);
await
getPickSelf
(
obj
.
id
);
setPageLoad
ed
(
true
);
}
};
useEffect
(()
=>
{
getList
();
// getShops();
// setTimeout(() => {
// // refTable.current.reload();
// }, 1000);
},
[]);
const
options
=
{
...
...
@@ -137,12 +150,13 @@ const TakeawayGoods = () => {
enterprises
,
onChangeEnterprise
,
onChangeFlag
,
onRefresh
,
shopEnum
,
};
return
(
<
div
>
{
pageLoad
ing
&&
(
<
div
className=
{
utilStyle
.
formPageBox
}
>
{
pageLoad
ed
&&
(
<
ProTable
search=
{
{
span
:
6
,
...
...
@@ -165,7 +179,8 @@ const TakeawayGoods = () => {
activeKey
,
items
:
pickSelfList
,
onChange
:
key
=>
{
setActiveKey
(
key
);
setActiveKey
(
`${key}`
);
onRefresh
();
},
},
actions
:
[
...
...
@@ -182,7 +197,7 @@ const TakeawayGoods = () => {
<
SaleDateModal
visible=
{
visibleSaleDate
}
id=
{
recordID
}
handleRefresh=
{
()
=>
searchList
({}
)
}
handleRefresh=
{
()
=>
onRefresh
(
)
}
handleClose=
{
()
=>
setVisibleSaleDate
(
false
)
}
/>
)
}
...
...
@@ -191,7 +206,7 @@ const TakeawayGoods = () => {
<
SaleSectionModal
visible=
{
visibleSaleSection
}
id=
{
recordID
}
handleRefresh=
{
()
=>
searchList
({}
)
}
handleRefresh=
{
()
=>
onRefresh
(
)
}
handleClose=
{
()
=>
setVisibleSaleSection
(
false
)
}
/>
)
}
...
...
@@ -200,7 +215,7 @@ const TakeawayGoods = () => {
<
GoodPriceModal
visible=
{
visiblePrice
}
id=
{
recordID
}
handleRefresh=
{
()
=>
searchList
({}
)
}
handleRefresh=
{
()
=>
onRefresh
(
)
}
handleClose=
{
()
=>
setVisiblePrice
(
false
)
}
/>
)
}
...
...
@@ -209,7 +224,7 @@ const TakeawayGoods = () => {
<
GoodSortModal
visible=
{
visibleSort
}
id=
{
recordID
}
handleRefresh=
{
()
=>
searchList
({}
)
}
handleRefresh=
{
()
=>
onRefresh
(
)
}
handleClose=
{
()
=>
setVisibleSort
(
false
)
}
/>
)
}
...
...
src/pages/businessGoods/takeawayGoodsInfo.jsx
View file @
81e54fd6
...
...
@@ -23,6 +23,7 @@ const TakeawayGoodsInfo = props => {
const
[
pickSelfList
,
setPickSelfList
]
=
useState
([]);
// 取餐点列表
const
[
slePickSelf
,
setSelPickSelf
]
=
useState
([]);
// 选中的取餐点列表
const
[
editID
,
setEditID
]
=
useState
(
''
);
// 编辑ID
const
[
shopId
,
setShopId
]
=
useState
(
''
);
// 店铺ID
// 取消
const
onCancel
=
()
=>
{
...
...
@@ -37,12 +38,12 @@ const TakeawayGoodsInfo = props => {
const
skuInfoList
=
dataSource
.
map
(
item
=>
({
skuId
:
item
.
skuId
,
enterprisePrice
:
item
.
enterprisePrice
,
mealTypeList
:
item
.
mealType
,
mealTypeList
:
item
.
mealType
List
.
map
(
m
=>
m
.
code
)
,
saleDateList
:
item
.
saleDate
,
tabCateList
:
{
tabId
:
item
.
tabCate
}
,
tabCateList
:
item
.
tabCate
.
map
(
t
=>
({
tabId
:
t
}))
,
}));
const
params
=
{
shopId
:
id
,
shopId
,
enterpriseId
:
id
,
pickSelfIdList
:
slePickSelf
,
skuInfoList
,
...
...
@@ -234,6 +235,7 @@ const TakeawayGoodsInfo = props => {
enterpriseId=
{
id
}
productType=
{
5
}
pickSelfIdList=
{
slePickSelf
}
onChangeShop=
{
setShopId
}
onSelectChange=
{
setDataSource
}
handleClose=
{
()
=>
setVisibleSelectGoods
(
false
)
}
/>
...
...
src/pages/businessGoods/virtualGoods.jsx
View file @
81e54fd6
...
...
@@ -107,7 +107,7 @@ const VirtualGoods = () => {
},
[]);
return
(
<
div
>
<
div
className=
{
utilStyle
.
formPageBox
}
>
{
pageLoading
&&
(
<
ProTable
search=
{
{
...
...
src/utils/utils.js
View file @
81e54fd6
...
...
@@ -183,7 +183,7 @@ export const getErrorMessage = err => {
// 获取地址栏参数,name:参数名称
export
const
getUrlParams
=
name
=>
{
const
regArg
=
new
RegExp
(
`(^|&)
${
name
}
=([^&]*)(&|$)`
);
const
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
regArg
);
const
r
=
window
.
location
.
search
.
substr
ing
(
1
).
match
(
regArg
);
if
(
r
!=
null
)
return
decodeURIComponent
(
r
[
2
]);
return
null
;
};
...
...
src/utils/utils.less
View file @
81e54fd6
...
...
@@ -59,3 +59,7 @@
.formTable {
padding: 0;
}
.formPageBox {
box-sizing: border-box;
padding: 20px;
}
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