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
f8c96d7c
Commit
f8c96d7c
authored
Jun 14, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改虚拟商品回显的问题
parent
a7bdf2f4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
13 deletions
+51
-13
SaleSectionModal.jsx
src/pages/businessGoods/components/SaleSectionModal.jsx
+4
-3
SelectGoodsModal.jsx
src/pages/businessGoods/components/SelectGoodsModal.jsx
+9
-4
goods.js
src/pages/businessGoods/staticData/goods.js
+3
-0
takeawayGoodsInfo.jsx
src/pages/businessGoods/takeawayGoodsInfo.jsx
+1
-1
virtualGoodsInfo.jsx
src/pages/businessGoods/virtualGoodsInfo.jsx
+34
-5
No files found.
src/pages/businessGoods/components/SaleSectionModal.jsx
View file @
f8c96d7c
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Form
,
Checkbox
,
Space
,
Modal
,
notification
,
message
}
from
'
antd
'
;
import
{
Checkbox
,
Space
,
Modal
,
notification
,
message
}
from
'
antd
'
;
import
{
mealColumn
}
from
'
../staticData/goods
'
;
import
{
apiMealInfoUpdate
}
from
'
../service
'
;
const
SaleDateModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
value
,
setValue
]
=
useState
([]);
// 关闭弹窗
...
...
@@ -54,7 +53,9 @@ const SaleDateModal = props => {
<
Checkbox
.
Group
onChange=
{
onChangeMeal
}
value=
{
value
}
>
<
Space
direction=
"vertical"
>
{
Object
.
keys
(
mealColumn
).
map
(
key
=>
(
<
Checkbox
value=
{
key
}
>
{
mealColumn
[
key
]
}
</
Checkbox
>
<
Checkbox
key=
{
key
}
value=
{
key
}
>
{
mealColumn
[
key
]
}
</
Checkbox
>
))
}
</
Space
>
</
Checkbox
.
Group
>
...
...
src/pages/businessGoods/components/SelectGoodsModal.jsx
View file @
f8c96d7c
...
...
@@ -11,7 +11,6 @@ const { Option } = Select;
const
SaleDateModal
=
props
=>
{
const
[
searchType
,
setSearchType
]
=
useState
(
'
1
'
);
const
[
searchKeyword
,
setSearchKeyword
]
=
useState
(
''
);
// const [goodsType, setGoodsType] = useState('1');
const
[
shopId
,
setShopId
]
=
useState
(
props
.
shopID
);
const
[
shopName
,
setShopName
]
=
useState
(
''
);
const
[
searchName
,
setSearchName
]
=
useState
(
''
);
...
...
@@ -21,8 +20,8 @@ const SaleDateModal = props => {
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
dataSource
,
setDataSource
]
=
useState
([]);
const
[
shopList
,
setShopList
]
=
useState
([]);
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
selectedRows
,
setSelectedRows
]
=
useState
([]);
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
(
props
.
selectedRowKeys
||
[]);
const
[
selectedRows
,
setSelectedRows
]
=
useState
(
props
.
selectedRows
||
[]);
const
searchList
=
async
params
=>
{
console
.
log
(
'
params :>>
'
,
params
);
...
...
@@ -58,6 +57,9 @@ const SaleDateModal = props => {
const
res
=
await
api
(
data
);
console
.
log
(
'
res :>>
'
,
res
);
if
(
res
&&
res
.
data
&&
res
.
data
.
records
)
{
res
.
data
.
records
.
forEach
(
item
=>
{
item
.
enterprisePrice
=
item
.
salePrice
;
});
setDataSource
(
res
.
data
.
records
);
setTotal
(
res
.
data
.
total
);
}
...
...
@@ -110,6 +112,9 @@ const SaleDateModal = props => {
if
(
!
props
.
shopID
)
{
props
.
onChangeShop
(
shopId
);
}
if
(
props
.
onSelectedRowKeys
)
{
props
.
onSelectedRowKeys
(
selectedRowKeys
);
}
handleCancel
();
};
...
...
@@ -212,7 +217,7 @@ const SaleDateModal = props => {
<
Pagination
defaultCurrent=
{
1
}
total=
{
total
}
showQuickJumper
onChange=
{
onPageChange
}
/>
<
div
className=
{
style
[
'
footers-btn
'
]
}
>
<
div
className=
{
style
[
'
footers-desc
'
]
}
>
已选商品(
<
span
className=
{
style
[
'
footers-num
'
]
}
>
{
selectedRows
.
length
}
</
span
>
)
已选商品(
<
span
className=
{
style
[
'
footers-num
'
]
}
>
{
selectedRow
Key
s
.
length
}
</
span
>
)
</
div
>
<
Button
key=
"back"
onClick=
{
handleCancel
}
>
取消
...
...
src/pages/businessGoods/staticData/goods.js
View file @
f8c96d7c
...
...
@@ -304,6 +304,9 @@ export const GoodsInfoColumn = options => {
if
(
arr
&&
arr
.
length
)
{
return
arr
[
0
].
stock
;
}
if
(
!
[
null
,
undefined
].
includes
(
v
))
{
return
v
;
}
return
'
-
'
;
},
},
...
...
src/pages/businessGoods/takeawayGoodsInfo.jsx
View file @
f8c96d7c
...
...
@@ -41,7 +41,7 @@ const TakeawayGoodsInfo = props => {
if
(
!
item
.
mealTypeList
||
item
.
mealTypeList
.
length
<
1
)
{
throw
Error
(
'
请添加餐品类型!
'
);
}
if
(
!
item
.
enterprisePrice
||
item
.
enterprisePrice
.
length
<
1
)
{
if
(
!
item
.
enterprisePrice
||
`
${
item
.
enterprisePrice
}
`
.
length
<
1
)
{
throw
Error
(
'
请添加企业价格!
'
);
}
if
(
!
item
.
saleDate
||
item
.
saleDate
.
length
<
1
)
{
...
...
src/pages/businessGoods/virtualGoodsInfo.jsx
View file @
f8c96d7c
...
...
@@ -8,7 +8,7 @@ import SaleDateModal from './components/SaleDateModal';
import
GoodPriceModal
from
'
./components/GoodPriceModal
'
;
import
SaleSectionModal
from
'
./components/SaleSectionModal
'
;
import
SelectGoodsModal
from
'
./components/SelectGoodsModal
'
;
import
{
apiSaveVirtualGoodsList
,
apiShopListByEnterpriseID
}
from
'
./service
'
;
import
{
apiSaveVirtualGoodsList
,
apiShopListByEnterpriseID
,
apiVirtualList
}
from
'
./service
'
;
import
style
from
'
./style/index.less
'
;
...
...
@@ -24,6 +24,7 @@ const VirtualGoodsInfo = props => {
const
[
shopList
,
setShopList
]
=
useState
({});
// 店铺列表
const
[
sleShopID
,
setSelShopID
]
=
useState
(
''
);
// 选中的店铺ID
const
[
sleShopName
,
setSelShopName
]
=
useState
(
''
);
// 选中的店铺名称
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
editID
,
setEditID
]
=
useState
(
''
);
// 编辑ID
// 取消
...
...
@@ -52,7 +53,7 @@ const VirtualGoodsInfo = props => {
if
(
!
item
.
mealTypeList
||
item
.
mealTypeList
.
length
<
1
)
{
throw
Error
(
'
请添加餐品类型!
'
);
}
if
(
!
item
.
enterprisePrice
||
item
.
enterprisePrice
.
length
<
1
)
{
if
(
!
item
.
enterprisePrice
||
`
${
item
.
enterprisePrice
}
`
.
length
<
1
)
{
throw
Error
(
'
请添加企业价格!
'
);
}
if
(
!
item
.
saleDate
||
item
.
saleDate
.
length
<
1
)
{
...
...
@@ -107,10 +108,38 @@ const VirtualGoodsInfo = props => {
}
};
// 查询已选商品列表
const
getGoodsList
=
async
shopId
=>
{
const
data
=
{
page
:
1
,
size
:
1000
,
data
:
{
enterpriseId
:
id
,
shopId
,
},
};
const
res
=
await
apiVirtualList
(
data
);
if
(
res
&&
res
.
data
&&
res
.
data
.
records
&&
res
.
data
.
records
.
length
)
{
const
keys
=
[];
setDataSource
(
res
.
data
.
records
.
map
(
item
=>
{
item
.
saleDate
=
item
.
saleDateList
.
map
(
d
=>
d
.
code
);
item
.
tabCate
=
item
.
tabCateList
.
map
(
c
=>
c
.
tabId
);
item
.
enterprisePrice
=
item
.
activityPrice
;
item
.
salePrice
=
item
.
price
;
keys
.
push
(
item
.
skuId
);
return
item
;
}),
);
setSelectedRowKeys
(
keys
);
}
};
// 选中店铺
const
onSelectShop
=
sid
=>
{
setSelShopID
(
sid
);
setSelShopName
(
shopList
[
sid
]);
getGoodsList
(
sid
);
};
// 刷新列表数据
...
...
@@ -128,9 +157,6 @@ const VirtualGoodsInfo = props => {
setDataSource
(
arr
);
};
// const initData = async () => {
// setLoading(true);
// };
useEffect
(()
=>
{
getShopList
();
},
[]);
...
...
@@ -233,7 +259,10 @@ const VirtualGoodsInfo = props => {
productType=
{
4
}
shopID=
{
sleShopID
}
shopName=
{
sleShopName
}
selectedRowKeys=
{
selectedRowKeys
}
selectedRows=
{
dataSource
}
onSelectChange=
{
setDataSource
}
onSelectedRowKeys=
{
setSelectedRowKeys
}
handleClose=
{
()
=>
setVisibleSelectGoods
(
false
)
}
/>
)
}
...
...
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