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
d3d6f4e2
Commit
d3d6f4e2
authored
Sep 28, 2022
by
李腾
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.quantgroup.cn:ui/merchant-manage-ui into feature/serviceGoods20220907
parents
516d3d90
74922b7d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
517 additions
and
21 deletions
+517
-21
service.js
src/pages/GoodsManage/service.js
+10
-0
staticdata.js
src/pages/GoodsManage/staticdata.js
+44
-1
common.less
src/pages/ServiceGoods/common.less
+52
-0
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+1
-2
FormPackage.jsx
src/pages/ServiceGoods/components/FormPackage.jsx
+324
-0
FormPriceOrStock.jsx
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
+22
-5
FormRuleSetting.jsx
src/pages/ServiceGoods/components/FormRuleSetting.jsx
+17
-2
FormSettlementOthers.jsx
src/pages/ServiceGoods/components/FormSettlementOthers.jsx
+3
-3
config.js
src/pages/ServiceGoods/config.js
+5
-5
index.jsx
src/pages/ServiceGoods/index.jsx
+2
-1
utils.js
src/pages/ServiceGoods/utils.js
+6
-1
validator.js
src/utils/validator.js
+31
-1
No files found.
src/pages/GoodsManage/service.js
View file @
d3d6f4e2
...
@@ -230,3 +230,13 @@ export const apiQueryLastChangeLog = skuId =>
...
@@ -230,3 +230,13 @@ export const apiQueryLastChangeLog = skuId =>
request
.
get
(
`/api/kdsp/sku/last/stockChange/record?skuId=
${
skuId
}
`
,
{
request
.
get
(
`/api/kdsp/sku/last/stockChange/record?skuId=
${
skuId
}
`
,
{
prefix
:
goodsApi
,
prefix
:
goodsApi
,
});
});
// 商品上下架
export
const
apiChangeStateGoods
=
async
params
=>
{
const
data
=
await
request
.
post
(
'
/product/api/merchant/pushedOrOffline/batch
'
,
{
data
:
stringify
(
params
),
prefix
:
goodsApi
,
headers
,
});
return
data
;
};
src/pages/GoodsManage/staticdata.js
View file @
d3d6f4e2
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Button
,
Badge
}
from
'
antd
'
;
import
{
Button
,
Badge
,
Switch
,
Modal
}
from
'
antd
'
;
import
{
ExclamationCircleOutlined
}
from
'
@ant-design/icons
'
;
import
styles
from
'
./style.less
'
;
import
styles
from
'
./style.less
'
;
import
{
resetTime
}
from
'
../../utils/utils
'
;
import
{
resetTime
}
from
'
../../utils/utils
'
;
import
{
apiChangeStateGoods
}
from
'
./service
'
;
const
{
confirm
}
=
Modal
;
export
const
productType
=
[
export
const
productType
=
[
{
{
...
@@ -31,6 +35,22 @@ export const productType = [
...
@@ -31,6 +35,22 @@ export const productType = [
];
];
export
function
column
()
{
export
function
column
()
{
const
onChangeState
=
async
({
skuId
,
state
})
=>
{
confirm
({
icon
:
<
ExclamationCircleOutlined
/>
,
content
:
`确认
${
+
state
===
6
?
'
下架
'
:
'
上架
'
}
商品?`
,
onOk
:
async
()
=>
{
const
res
=
await
apiChangeStateGoods
({
ids
:
skuId
,
productState
:
+
state
===
6
?
7
:
6
,
// 6:上架,7:下架
});
if
(
res
.
businessCode
===
'
0000
'
&&
res
.
code
===
'
0000
'
)
{
this
.
handleSearch
();
}
},
});
};
return
[
return
[
{
{
title
:
'
SKU编码
'
,
title
:
'
SKU编码
'
,
...
@@ -132,6 +152,29 @@ export function column() {
...
@@ -132,6 +152,29 @@ export function column() {
width
:
200
,
width
:
200
,
align
:
'
center
'
,
align
:
'
center
'
,
},
},
{
title
:
'
上下架状态
'
,
dataIndex
:
'
stateDesc
'
,
// 5:未上架 ,6 :上架,7:下架
width
:
200
,
align
:
'
center
'
,
render
:
(
_
,
row
)
=>
(
<
div
>
{
row
.
type
===
4
&&
row
.
state
>=
5
?
(
<>
<
Switch
checkedChildren
=
"
已上架
"
checked
=
{
row
.
state
===
6
}
unCheckedChildren
=
"
已下架
"
onClick
=
{()
=>
onChangeState
(
row
)}
defaultChecked
/>
<
/
>
)
:
(
'
-
'
)}
<
/div
>
),
},
{
{
title
:
'
审核状态
'
,
title
:
'
审核状态
'
,
dataIndex
:
'
stateDesc
'
,
dataIndex
:
'
stateDesc
'
,
...
...
src/pages/ServiceGoods/common.less
View file @
d3d6f4e2
...
@@ -112,3 +112,55 @@
...
@@ -112,3 +112,55 @@
font-size: 16px;
font-size: 16px;
cursor: pointer;
cursor: pointer;
}
}
.formPackageBox {
margin-bottom: 20px;
:global {
.ant-col {
text-align: center;
}
.ant-btn {
margin-left: 0;
}
.ant-form-item {
margin-bottom: 0;
}
}
}
.subTitle {
padding: 10px 0;
font-weight: bold;
font-size: 14px;
:global {
.ant-row {
display: flex;
align-items: center;
}
.ant-col {
display: flex;
align-items: center;
justify-content: center;
}
}
}
.groupHeader {
font-weight: bold;
}
.subTitleTxt {
justify-content: left !important;
padding-left: 45px !important;
}
.groupMargin {
margin-bottom: 20px;
}
.caiRow {
margin: 0;
:global {
.ant-row {
margin-bottom: 10px;
}
.ant-input {
text-align: center;
}
}
}
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
d3d6f4e2
...
@@ -92,7 +92,6 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -92,7 +92,6 @@ const FormInformationBasic = forwardRef((props, ref) => {
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入商品类目!
'
}]
}
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入商品类目!
'
}]
}
>
>
<
Cascader
<
Cascader
disabled=
{
customer
.
isService
}
placeholder=
"请选择商品类目!"
placeholder=
"请选择商品类目!"
showSearch=
{
{
filter
:
filterCategoryOptions
}
}
showSearch=
{
{
filter
:
filterCategoryOptions
}
}
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
...
@@ -127,7 +126,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -127,7 +126,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
{
required
:
true
,
min
:
2
,
message
:
'
请输入最少两个字符的商品名称!
'
,
whitespace
:
true
},
{
required
:
true
,
min
:
2
,
message
:
'
请输入最少两个字符的商品名称!
'
,
whitespace
:
true
},
]
}
]
}
>
>
<
Input
disabled=
{
customer
.
isService
}
placeholder=
"请输入商品名称"
/>
<
Input
placeholder=
"请输入商品名称"
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Popover
>
</
Popover
>
{
customer
.
isJDGoods
&&
(
{
customer
.
isJDGoods
&&
(
...
...
src/pages/ServiceGoods/components/FormPackage.jsx
0 → 100644
View file @
d3d6f4e2
import
React
,
{
useState
,
forwardRef
,
useEffect
,
useImperativeHandle
}
from
'
react
'
;
import
{
Form
,
Button
,
Row
,
Col
,
Input
,
Select
,
Modal
,
notification
}
from
'
antd
'
;
import
{
PlusOutlined
}
from
'
@ant-design/icons
'
;
import
styles
from
'
../common.less
'
;
import
{
isIntegerNotZero
,
isCheckPriceOneDecimal
}
from
'
@/utils/validator
'
;
import
UUID
from
'
@/utils/uuid
'
;
const
{
Option
}
=
Select
;
const
getCaiJson
=
gname
=>
({
uuid
:
UUID
.
createUUID
(),
gName
:
gname
,
quantity
:
''
,
dishName
:
''
,
unit
:
'
份
'
,
price
:
''
,
skuId
:
''
,
});
const
FormCai
=
forwardRef
((
props
,
ref
)
=>
{
const
{
gitem
,
groupName
,
groupkey
,
packageIndex
}
=
props
;
const
onDel
=
(
callback
,
name
,
key
)
=>
{
// callback(name);
props
.
onDelCai
(
packageIndex
,
groupkey
,
key
);
};
const
onAdd
=
(
callback
,
key
)
=>
{
if
(
props
.
onAddCai
(
packageIndex
,
groupkey
))
{
callback
(
getCaiJson
(
groupName
));
}
};
return
(
<
Form
.
List
name=
{
gitem
}
>
{
(
items
,
{
add
,
remove
})
=>
(
<>
{
items
.
map
(({
key
,
name
},
caiIndex
)
=>
(
<
Row
gutter=
{
24
}
key=
{
`cai_${key}`
}
className=
{
styles
.
caiRow
}
>
<
Col
span=
{
5
}
>
<
Form
.
Item
name=
{
[
name
,
'
gName
'
]
}
>
<
Input
readOnly
hidden
/>
<
span
>
{
groupName
}
</
span
>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
3
}
>
<
Form
.
Item
name=
{
[
name
,
'
quantity
'
]
}
rules=
{
[
{
required
:
true
,
message
:
'
请输入数量.
'
},
{
validator
:
isIntegerNotZero
,
message
:
'
请输入正确的数量
'
},
]
}
>
<
Input
maxLength=
{
10
}
/>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
4
}
>
<
Form
.
Item
name=
{
[
name
,
'
dishName
'
]
}
rules=
{
[{
required
:
true
,
message
:
'
请输入菜名.
'
}]
}
>
<
Input
maxLength=
{
10
}
placeholder=
"最多10个字符"
/>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
2
}
>
<
Form
.
Item
mame=
{
[
name
,
'
unit
'
]
}
rules=
{
[{
required
:
true
,
message
:
'
请选择单位
'
}]
}
>
<
Select
defaultValue=
"份"
>
<
Option
value=
"份"
>
份
</
Option
>
<
Option
value=
"个"
>
个
</
Option
>
<
Option
value=
"瓶"
>
瓶
</
Option
>
<
Option
value=
"杯"
>
杯
</
Option
>
<
Option
value=
"串"
>
串
</
Option
>
<
Option
value=
"例"
>
例
</
Option
>
</
Select
>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
4
}
>
<
Form
.
Item
name=
{
[
name
,
'
price
'
]
}
rules=
{
[
{
required
:
true
,
message
:
'
请输入价格.
'
},
{
validator
:
isCheckPriceOneDecimal
,
message
:
'
请输入正确的价格
'
},
]
}
>
<
Input
maxLength=
{
10
}
/>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
3
}
>
<
Button
type=
"link"
onClick=
{
()
=>
onDel
(
remove
,
name
,
key
)
}
>
删除
</
Button
>
</
Col
>
<
Col
span=
{
3
}
>
{
caiIndex
===
0
&&
(
<
Button
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
onAdd
(
add
,
key
)
}
>
添加
</
Button
>
)
}
</
Col
>
</
Row
>
))
}
</>
)
}
</
Form
.
List
>
);
});
const
FormGroup
=
forwardRef
((
props
,
ref
)
=>
{
const
{
item
,
form
,
packageIndex
,
onAddCai
,
onDelCai
}
=
props
;
const
formInfo
=
form
.
getFieldsValue
();
return
(
<
Form
.
List
name=
{
item
}
>
{
(
items
,
{
add
,
remove
})
=>
(
<>
{
items
.
map
(({
key
,
name
})
=>
(
<
div
className=
{
styles
.
groupMargin
}
key=
{
`group_${key}`
}
>
<
Row
gutter=
{
24
}
className=
{
styles
.
groupHeader
}
>
<
Col
span=
{
5
}
>
组名
</
Col
>
<
Col
span=
{
3
}
>
数量
</
Col
>
<
Col
span=
{
4
}
>
菜名
</
Col
>
<
Col
span=
{
2
}
>
单位
</
Col
>
<
Col
span=
{
4
}
>
价格
</
Col
>
<
Col
span=
{
3
}
>
操作
</
Col
>
<
Col
span=
{
3
}
>
<
div
>
<
Form
.
Item
name=
{
[
name
,
'
groupName
'
]
}
>
<
Input
hidden
readOnly
/>
</
Form
.
Item
>
</
div
>
</
Col
>
</
Row
>
<
FormCai
gitem=
{
[
name
,
'
dishes
'
]
}
packageIndex=
{
packageIndex
}
groupkey=
{
key
}
onAddCai=
{
onAddCai
}
onDelCai=
{
onDelCai
}
groupName=
{
formInfo
.
lists
[
packageIndex
].
children
[
key
].
groupName
}
/>
</
div
>
))
}
</>
)
}
</
Form
.
List
>
);
});
const
FormPackage
=
forwardRef
((
props
,
ref
)
=>
{
const
[
visibleGroup
,
setVisibleGroup
]
=
useState
(
false
);
const
[
groupName
,
setGroupName
]
=
useState
(
''
);
const
[
groupIndex
,
setGroupIndex
]
=
useState
(
0
);
const
[
list
,
setList
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
const
{
validateFields
,
getFieldsValue
}
=
form
;
const
onCheck
=
async
()
=>
{
console
.
log
(
'
form :>>
'
,
form
);
try
{
const
values
=
await
validateFields
();
const
arr
=
[];
console
.
log
(
'
package values :>>
'
,
values
);
if
(
values
&&
values
.
lists
)
{
values
.
lists
.
forEach
(
item
=>
{
arr
.
push
({
setMealContent
:
[...
item
.
children
],
});
});
}
return
arr
;
}
catch
{
return
null
;
}
};
// 创建分组
const
onCreateGroup
=
()
=>
{
const
str
=
groupName
&&
groupName
.
trim
();
if
(
str
)
{
const
arr
=
[...
list
];
const
fieldsValue
=
getFieldsValue
();
const
obj
=
{
groupName
:
str
,
uuid
:
UUID
.
createUUID
(),
dishes
:
[
getCaiJson
(
str
)],
};
arr
[
groupIndex
].
children
.
push
(
obj
);
fieldsValue
.
lists
[
groupIndex
].
children
.
push
(
obj
);
setList
(
arr
);
form
.
setFieldsValue
(
fieldsValue
);
setVisibleGroup
(
!
1
);
}
};
// 显示创建分组弹窗
const
onCreate
=
index
=>
{
setVisibleGroup
(
!
0
);
setGroupIndex
(
index
);
};
// 新增菜品
const
onAddCai
=
(
i
,
j
)
=>
{
const
arr
=
[...
list
];
const
len
=
arr
[
i
].
children
[
j
].
dishes
.
length
;
if
(
len
<
50
)
{
arr
[
i
].
children
[
j
].
dishes
.
push
(
getCaiJson
(
arr
[
i
].
children
[
j
].
groupName
));
setList
(
arr
);
return
true
;
}
notification
.
error
({
message
:
'
最多添加50个菜品
'
,
});
return
false
;
};
// 删除菜品
const
onDelCai
=
(
i
,
j
,
k
)
=>
{
const
arr
=
[...
list
];
const
arrList
=
getFieldsValue
();
const
len
=
arr
[
i
].
children
[
j
].
dishes
.
length
;
if
(
len
===
1
)
{
arr
[
i
].
children
.
splice
(
j
,
1
);
arrList
.
lists
[
i
].
children
.
splice
(
j
,
1
);
}
else
{
arr
[
i
].
children
[
j
].
dishes
.
splice
(
k
,
1
);
console
.
log
(
'
arrList :>>
'
,
[...
arrList
.
lists
]);
arrList
.
lists
[
i
].
children
[
j
].
dishes
.
splice
(
k
,
1
);
}
setList
(
arr
);
form
.
setFieldsValue
(
arrList
);
};
useEffect
(()
=>
{
if
(
props
.
initData
&&
props
.
initData
.
length
)
{
if
(
props
.
initData
.
length
!==
list
.
length
)
{
const
arr
=
[];
props
.
initData
.
forEach
((
item
,
i
)
=>
{
let
children
=
[];
if
(
item
.
serviceItem
&&
item
.
serviceItem
.
setMealContent
&&
item
.
serviceItem
.
setMealContent
.
length
)
{
children
=
[...
item
.
serviceItem
.
setMealContent
];
}
arr
.
push
({
uuid
:
i
,
specName
:
`套餐
${
i
+
1
}
`
,
children
,
});
});
setList
(
arr
);
form
.
setFieldsValue
({
lists
:
arr
,
});
}
}
else
{
setList
([]);
form
.
setFieldsValue
({
lists
:
[],
});
}
},
[
props
.
initData
]);
useImperativeHandle
(
ref
,
()
=>
({
onCheck
,
}));
return
(
<
div
className=
{
styles
.
formPackageBox
}
>
<
Form
style=
{
{
marginBottom
:
10
}
}
form=
{
form
}
>
<
Form
.
List
name=
"lists"
>
{
(
fields
,
{
add
,
remove
})
=>
(
<>
{
fields
.
map
(({
name
,
key
},
packageIndex
)
=>
(
<
div
key=
{
key
}
>
<
div
className=
{
styles
.
subTitle
}
>
<
Row
gutter=
{
24
}
>
<
Col
className=
{
styles
.
subTitleTxt
}
>
<
Form
.
Item
key=
{
`specName_${key}`
}
name=
{
[
name
,
'
specName
'
]
}
>
<
Input
readOnly
hidden
/>
<
span
>
套餐
{
packageIndex
+
1
}
</
span
>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
3
}
>
<
Button
type=
"primary"
size=
"small"
onClick=
{
()
=>
onCreate
(
key
)
}
>
新建分组
</
Button
>
</
Col
>
</
Row
>
</
div
>
<
FormGroup
item=
{
[
name
,
'
children
'
]
}
onAddCai=
{
onAddCai
}
onDelCai=
{
onDelCai
}
packageIndex=
{
packageIndex
}
form=
{
form
}
/>
</
div
>
))
}
</>
)
}
</
Form
.
List
>
</
Form
>
<
Modal
title=
"新建分组"
visible=
{
visibleGroup
}
destroyOnClose
onOk=
{
onCreateGroup
}
onCancel=
{
()
=>
setVisibleGroup
(
false
)
}
>
<
Input
placeholder=
"请输入分组名称,最多10个字"
maxLength=
{
10
}
onChange=
{
e
=>
setGroupName
(
e
.
target
.
value
)
}
/>
</
Modal
>
</
div
>
);
});
export
default
FormPackage
;
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
View file @
d3d6f4e2
...
@@ -10,6 +10,7 @@ import React, {
...
@@ -10,6 +10,7 @@ import React, {
}
from
'
react
'
;
}
from
'
react
'
;
import
{
formItemLayout
,
StaticColumns
}
from
'
../config
'
;
import
{
formItemLayout
,
StaticColumns
}
from
'
../config
'
;
import
EditFormTable
from
'
./EditFormTable
'
;
import
EditFormTable
from
'
./EditFormTable
'
;
import
FormPackage
from
'
./FormPackage
'
;
import
{
import
{
createProductData
,
createProductData
,
cleanArray
,
cleanArray
,
...
@@ -20,7 +21,7 @@ import {
...
@@ -20,7 +21,7 @@ import {
}
from
'
../utils
'
;
}
from
'
../utils
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
SelectTemplate
}
from
'
./CommonTemplate
'
;
import
{
SelectTemplate
,
Title
}
from
'
./CommonTemplate
'
;
const
initSpecReced
=
()
=>
({
const
initSpecReced
=
()
=>
({
firstSpec
:
''
,
firstSpec
:
''
,
...
@@ -201,7 +202,7 @@ const CreateBatchFormItems = ({ specInitValue, batchChange, editRef, defaultColu
...
@@ -201,7 +202,7 @@ const CreateBatchFormItems = ({ specInitValue, batchChange, editRef, defaultColu
fieldNames=
{
{
label
:
'
secondSpecValue
'
,
value
:
'
secondSpecValue
'
}
}
fieldNames=
{
{
label
:
'
secondSpecValue
'
,
value
:
'
secondSpecValue
'
}
}
/>
/>
{
formItems
.
concat
(
{
formItems
.
concat
(
<
Button
key=
"batch"
type=
"primary"
disabled=
{
customer
.
isService
}
onClick=
{
batchChange
}
>
<
Button
key=
"batch"
type=
"primary"
onClick=
{
batchChange
}
>
批量设置
批量设置
</
Button
>,
</
Button
>,
)
}
)
}
...
@@ -213,7 +214,9 @@ const CreateBatchFormItems = ({ specInitValue, batchChange, editRef, defaultColu
...
@@ -213,7 +214,9 @@ const CreateBatchFormItems = ({ specInitValue, batchChange, editRef, defaultColu
const
FormPriceOrStock
=
forwardRef
((
props
,
ref
)
=>
{
const
FormPriceOrStock
=
forwardRef
((
props
,
ref
)
=>
{
const
{
specList
,
editData
,
skuList
=
[],
onSpecChange
}
=
props
;
const
{
specList
,
editData
,
skuList
=
[],
onSpecChange
}
=
props
;
const
editRef
=
useRef
(
null
);
const
editRef
=
useRef
(
null
);
const
packageRef
=
useRef
(
null
);
const
customer
=
useContext
(
ServiceContext
);
const
customer
=
useContext
(
ServiceContext
);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
[
specInitValue
,
setSpecInitValue
]
=
useState
(
initSpecReced
());
const
[
specInitValue
,
setSpecInitValue
]
=
useState
(
initSpecReced
());
...
@@ -224,10 +227,18 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -224,10 +227,18 @@ const FormPriceOrStock = forwardRef((props, ref) => {
const
onCheck
=
async
()
=>
{
const
onCheck
=
async
()
=>
{
try
{
try
{
const
setMealContent
=
await
packageRef
.
current
.
onCheck
();
const
values
=
await
form
.
validateFields
();
const
values
=
await
form
.
validateFields
();
const
items
=
await
editRef
.
current
.
onCheck
();
const
items
=
await
editRef
.
current
.
onCheck
();
if
(
items
)
{
if
(
!
setMealContent
)
{
return
{
...
values
,
items
,
temp
:
'
infoSpecData
'
};
notification
.
open
({
message
:
'
提示
'
,
description
:
'
请添加正确的套餐信息!
'
,
});
return
null
;
}
if
(
items
&&
setMealContent
)
{
return
{
...
values
,
items
,
setMealContent
,
temp
:
'
infoSpecData
'
};
}
}
notification
.
open
({
notification
.
open
({
message
:
'
提示
'
,
message
:
'
提示
'
,
...
@@ -390,7 +401,7 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -390,7 +401,7 @@ const FormPriceOrStock = forwardRef((props, ref) => {
specDataList=
{
specInitValue
.
secondSpecValue
}
specDataList=
{
specInitValue
.
secondSpecValue
}
/>
/>
<
div
style=
{
{
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
marginBottom
:
20
}
}
>
<
div
style=
{
{
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
marginBottom
:
20
}
}
>
<
Button
type=
"primary"
disabled=
{
customer
.
isService
}
onClick=
{
onFinish
}
>
<
Button
type=
"primary"
onClick=
{
onFinish
}
>
生成商品信息
生成商品信息
</
Button
>
</
Button
>
</
div
>
</
div
>
...
@@ -407,6 +418,12 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -407,6 +418,12 @@ const FormPriceOrStock = forwardRef((props, ref) => {
defaultColumns=
{
defaultColumns
}
defaultColumns=
{
defaultColumns
}
initData=
{
tableData
}
initData=
{
tableData
}
/>
/>
{
customer
.
isCard
&&
(
<>
<
Title
title=
"套餐内容"
/>
<
FormPackage
ref=
{
packageRef
}
initData=
{
tableData
}
/>
</>
)
}
</>
</>
);
);
});
});
...
...
src/pages/ServiceGoods/components/FormRuleSetting.jsx
View file @
d3d6f4e2
import
{
Form
,
Input
,
Select
,
Checkbox
,
DatePicker
}
from
'
antd
'
;
import
{
Form
,
Input
,
Select
,
Checkbox
,
DatePicker
}
from
'
antd
'
;
import
React
,
{
useEffect
,
forwardRef
,
useImperativeHandle
,
useContext
}
from
'
react
'
;
import
React
,
{
useEffect
,
forwardRef
,
useImperativeHandle
,
useContext
}
from
'
react
'
;
import
moment
from
'
moment
'
;
import
{
WeeksList
,
formItemLayout
}
from
'
../config
'
;
import
{
WeeksList
,
formItemLayout
}
from
'
../config
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
formatTime
}
from
'
../../../utils/utils
'
;
import
{
formatTime
}
from
'
../../../utils/utils
'
;
...
@@ -47,6 +48,9 @@ const FormRuleSetting = forwardRef((props, ref) => {
...
@@ -47,6 +48,9 @@ const FormRuleSetting = forwardRef((props, ref) => {
}
}
};
};
const
nowDateTime
=
moment
(
moment
().
format
(
'
YYYY-MM-DD 00:00:00
'
));
const
nowDateTimeEnd
=
moment
(
moment
().
format
(
'
YYYY-MM-DD 23:59:59
'
));
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
onCheck
,
onCheck
,
reset
:
form
.
resetFields
,
reset
:
form
.
resetFields
,
...
@@ -73,10 +77,21 @@ const FormRuleSetting = forwardRef((props, ref) => {
...
@@ -73,10 +77,21 @@ const FormRuleSetting = forwardRef((props, ref) => {
scrollToFirstError
scrollToFirstError
>
>
<
Form
.
Item
name=
"purchaseTime"
label=
"购买时间"
{
...
rangeConfig
}
>
<
Form
.
Item
name=
"purchaseTime"
label=
"购买时间"
{
...
rangeConfig
}
>
<
RangePicker
showTime
format=
"YYYY-MM-DD HH:mm:ss"
/>
<
RangePicker
showTime=
{
{
defaultValue
:
[
moment
(
'
00:00:00
'
,
'
HH:mm:ss
'
),
moment
(
'
23:59:59
'
,
'
HH:mm:ss
'
)],
}
}
format=
"YYYY-MM-DD HH:mm:ss"
defaultPickerValue=
{
[
nowDateTime
,
nowDateTimeEnd
]
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
name=
"useTime"
label=
"有效期"
{
...
rangeConfig
}
>
<
Form
.
Item
name=
"useTime"
label=
"有效期"
{
...
rangeConfig
}
>
<
RangePicker
showTime
format=
"YYYY-MM-DD HH:mm:ss"
/>
<
RangePicker
showTime=
{
{
defaultValue
:
[
moment
(
'
00:00:00
'
,
'
HH:mm:ss
'
),
moment
(
'
23:59:59
'
,
'
HH:mm:ss
'
)],
}
}
format=
"YYYY-MM-DD HH:mm:ss"
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
name=
"shopIds"
name=
"shopIds"
...
...
src/pages/ServiceGoods/components/FormSettlementOthers.jsx
View file @
d3d6f4e2
...
@@ -134,18 +134,18 @@ const FormSettlementOthers = forwardRef((props, ref) => {
...
@@ -134,18 +134,18 @@ const FormSettlementOthers = forwardRef((props, ref) => {
<
Form
.
Item
<
Form
.
Item
name=
"receptionVolume"
name=
"receptionVolume"
label=
"每日最低接待量"
label=
"每日最低接待量"
rules=
{
[{
required
:
true
,
message
:
'
每日最低接待量
'
}]
}
//
rules={[{ required: true, message: '每日最低接待量' }]}
>
>
<
InputNumber
min=
{
0
}
style=
{
{
width
:
200
}
}
placeholder=
"请输入每日最低接待量"
/>
<
InputNumber
min=
{
0
}
style=
{
{
width
:
200
}
}
placeholder=
"请输入每日最低接待量"
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Title
title=
"结算信息"
/>
<
Title
title=
"结算信息"
/>
<
Form
.
Item
{
/*
<Form.Item
name="packageContent"
name="packageContent"
label="套餐内容"
label="套餐内容"
rules={[{ required: true, message: '请输入套餐内容, 1000字以内!!' }]}
rules={[{ required: true, message: '请输入套餐内容, 1000字以内!!' }]}
>
>
<Input.TextArea showCount maxLength={1000} placeholder="请输入套餐内容, 1000字以内!!" />
<Input.TextArea showCount maxLength={1000} placeholder="请输入套餐内容, 1000字以内!!" />
</
Form
.
Item
>
</Form.Item>
*/
}
<
Form
.
Item
<
Form
.
Item
name=
"settlementMethod"
name=
"settlementMethod"
label=
"结算方式"
label=
"结算方式"
...
...
src/pages/ServiceGoods/config.js
View file @
d3d6f4e2
...
@@ -109,7 +109,7 @@ export const TaskList = [
...
@@ -109,7 +109,7 @@ export const TaskList = [
},
},
detailImageList
:
{
detailImageList
:
{
title
:
'
商品详情图
'
,
title
:
'
商品详情图
'
,
rule
:
true
,
//
rule: true,
limit
:
30
,
limit
:
30
,
renderExtra
()
{
renderExtra
()
{
return
'
最多上传30张
'
;
return
'
最多上传30张
'
;
...
@@ -165,7 +165,7 @@ export const StaticColumns = customer => [
...
@@ -165,7 +165,7 @@ export const StaticColumns = customer => [
min
:
0
,
min
:
0
,
},
},
roleRules
:
{
required
:
true
},
roleRules
:
{
required
:
true
},
disabeldRender
:
()
=>
customer
.
isJDGoods
||
customer
.
isService
,
disabeldRender
:
()
=>
customer
.
isJDGoods
,
},
},
{
{
title
:
'
佣金费率
'
,
title
:
'
佣金费率
'
,
...
@@ -188,7 +188,7 @@ export const StaticColumns = customer => [
...
@@ -188,7 +188,7 @@ export const StaticColumns = customer => [
min
:
0
,
min
:
0
,
},
},
roleRules
:
{
required
:
true
},
roleRules
:
{
required
:
true
},
disabeldRender
:
()
=>
customer
.
isService
,
//
disabeldRender: () => customer.isService,
},
},
{
{
title
:
'
销售价
'
,
title
:
'
销售价
'
,
...
@@ -219,7 +219,7 @@ export const StaticColumns = customer => [
...
@@ -219,7 +219,7 @@ export const StaticColumns = customer => [
precision
:
3
,
precision
:
3
,
max
:
999999.999
,
max
:
999999.999
,
},
},
disabeldRender
:
()
=>
customer
.
isService
,
//
disabeldRender: () => customer.isService,
},
},
{
{
title
:
'
库存
'
,
title
:
'
库存
'
,
...
@@ -250,7 +250,7 @@ export const StaticColumns = customer => [
...
@@ -250,7 +250,7 @@ export const StaticColumns = customer => [
precision
:
0
,
precision
:
0
,
maxLength
:
5
,
maxLength
:
5
,
},
},
disabeldRender
:
()
=>
customer
.
isService
,
//
disabeldRender: () => customer.isService,
},
},
{
{
title
:
'
商品自编码
'
,
title
:
'
商品自编码
'
,
...
...
src/pages/ServiceGoods/index.jsx
View file @
d3d6f4e2
...
@@ -241,7 +241,8 @@ const ServiceGoods = options => {
...
@@ -241,7 +241,8 @@ const ServiceGoods = options => {
title=
{
isEdit
?
'
修改商品
'
:
'
新增商品
'
}
title=
{
isEdit
?
'
修改商品
'
:
'
新增商品
'
}
visible=
{
options
.
visible
}
visible=
{
options
.
visible
}
onCancel=
{
()
=>
handleCancel
()
}
onCancel=
{
()
=>
handleCancel
()
}
width=
{
1000
}
destroyOnClose
width=
{
1050
}
maskClosable=
{
false
}
maskClosable=
{
false
}
keyboard=
{
false
}
keyboard=
{
false
}
footer=
{
[
footer=
{
[
...
...
src/pages/ServiceGoods/utils.js
View file @
d3d6f4e2
...
@@ -78,7 +78,8 @@ export const batchTableSourceData = ({ batchItem, tableData, bacthSecon, bacthFi
...
@@ -78,7 +78,8 @@ export const batchTableSourceData = ({ batchItem, tableData, bacthSecon, bacthFi
const
filterItems
=
(
type
,
props
)
=>
{
const
filterItems
=
(
type
,
props
)
=>
{
const
{
infoSpecData
,
serviceItem
,
infoImageData
,
infoMation
,
settlementItem
}
=
props
;
const
{
infoSpecData
,
serviceItem
,
infoImageData
,
infoMation
,
settlementItem
}
=
props
;
const
{
imageList
=
{},
commonImageList
,
cardImageList
}
=
infoImageData
;
const
{
imageList
=
{},
commonImageList
,
cardImageList
}
=
infoImageData
;
return
infoSpecData
.
items
.
map
(
item
=>
{
const
{
setMealContent
}
=
infoSpecData
;
return
infoSpecData
.
items
.
map
((
item
,
i
)
=>
{
if
(
type
===
4
)
{
if
(
type
===
4
)
{
// 如果为服务类商品,默认取cardImageList,cardImageList为必选项目
// 如果为服务类商品,默认取cardImageList,cardImageList为必选项目
item
.
imageList
=
[...
commonImageList
,
...
cardImageList
];
item
.
imageList
=
[...
commonImageList
,
...
cardImageList
];
...
@@ -89,12 +90,16 @@ const filterItems = (type, props) => {
...
@@ -89,12 +90,16 @@ const filterItems = (type, props) => {
}
}
item
.
firstSpecId
=
infoSpecData
.
firstSpecId
;
item
.
firstSpecId
=
infoSpecData
.
firstSpecId
;
item
.
secondSpecId
=
infoSpecData
.
secondSpecId
||
null
;
item
.
secondSpecId
=
infoSpecData
.
secondSpecId
||
null
;
console
.
log
(
'
setMealContent :>>
'
,
setMealContent
);
if
(
type
===
4
)
{
if
(
type
===
4
)
{
item
.
serviceItem
=
{
item
.
serviceItem
=
{
...
serviceItem
,
...
serviceItem
,
...
settlementItem
,
...
settlementItem
,
description
:
infoMation
.
description
||
''
,
description
:
infoMation
.
description
||
''
,
};
};
if
(
setMealContent
&&
setMealContent
[
i
]
&&
setMealContent
[
i
].
setMealContent
)
{
item
.
serviceItem
.
setMealContent
=
setMealContent
[
i
].
setMealContent
;
}
}
}
return
item
;
return
item
;
});
});
...
...
src/utils/validator.js
View file @
d3d6f4e2
...
@@ -157,7 +157,7 @@ export function isInteger(rule, value, callback) {
...
@@ -157,7 +157,7 @@ export function isInteger(rule, value, callback) {
// 验证是否大于0的整数
// 验证是否大于0的整数
export
const
isIntegerNotZero
=
(
rule
,
value
,
callback
)
=>
{
export
const
isIntegerNotZero
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
if
(
!
value
)
{
callback
(
new
Error
(
'
输入不可以为空
'
)
);
callback
();
}
}
if
(
!
Number
(
value
))
{
if
(
!
Number
(
value
))
{
callback
(
new
Error
(
'
请输入大于0的正整数
'
));
callback
(
new
Error
(
'
请输入大于0的正整数
'
));
...
@@ -389,3 +389,33 @@ export function isCheckNumberLine(rule, value, callback) {
...
@@ -389,3 +389,33 @@ export function isCheckNumberLine(rule, value, callback) {
}
}
}
}
}
}
// 验证数字价格
export
function
isCheckNumberPrice
(
rule
,
value
,
callback
)
{
if
(
!
value
)
{
callback
();
}
else
if
(
Number
.
isNaN
(
+
value
))
{
callback
(
new
Error
(
'
请输入数字
'
));
}
else
if
(
+
value
<
0
)
{
callback
(
new
Error
(
'
请输入大于0的数字
'
));
}
else
{
callback
();
}
}
// 验证价格保留小数点1位
export
function
isCheckPriceOneDecimal
(
rule
,
value
,
callback
)
{
const
num
=
+
value
;
const
arr
=
`
${
value
}
`
.
split
(
'
.
'
);
if
(
!
value
)
{
callback
();
}
else
if
(
Number
.
isNaN
(
num
))
{
callback
(
new
Error
(
'
请输入数字
'
));
}
else
if
(
num
<
0
)
{
callback
(
new
Error
(
'
请输入大于0的数字
'
));
}
else
if
(
arr
.
length
===
2
&&
arr
[
1
].
length
>
1
)
{
callback
(
new
Error
(
'
小数点保留1位
'
));
}
else
{
callback
();
}
}
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