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
b852abb4
Commit
b852abb4
authored
Apr 13, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 禁用编辑时候可以存草稿问题
parent
d53eaa83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
37 deletions
+20
-37
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+10
-31
index.jsx
src/pages/ServiceGoods/index.jsx
+10
-6
No files found.
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
b852abb4
...
...
@@ -17,7 +17,6 @@ import {
Checkbox
,
Radio
,
Space
,
Modal
,
Switch
,
Row
,
Col
,
...
...
@@ -35,7 +34,6 @@ import { ServiceContext } from '../context';
import
{
debounce
}
from
'
@/utils/utils
'
;
import
{
isCheckPriceTwoDecimal
,
isIntegerNotZero
}
from
'
@/utils/validator
'
;
import
UploadCropImage
from
'
./UploadCropImage
'
;
// import AddSellTimeModal from './AddSellTimeModal';
import
styles
from
'
../common.less
'
;
import
AddRepertoryModal
from
'
./AddRepertoryModal
'
;
import
{
apiTagList
,
apiUnits
}
from
'
../service
'
;
...
...
@@ -89,7 +87,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const
showModal
=
()
=>
{
addSellTimeRef
.
current
.
setOpen
(
true
);
};
const
onCheck
=
async
()
=>
{
try
{
const
values
=
await
form
.
validateFields
();
...
...
@@ -102,9 +99,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
return
null
;
}
};
// 过滤单位
const
filterUnit
=
unit
=>
(
Array
.
isArray
(
unit
)
&&
unit
?.
length
&&
unit
?.
slice
(
1
).
toString
())
||
unit
;
// 商品基本信息编辑商品名称
const
takeawayCalc
=
takeawayData
=>
{
// 商品基本信息编辑商品名称
const
{
infoMation
:
name
,
infoMation
,
takeawayItem
}
=
takeawayData
;
// weight 份量 specs规格 生成sku规则 weight * specs
const
{
...
...
@@ -129,8 +128,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
categoryId
,
}
=
takeawayItem
;
let
{
unit
}
=
takeawayItem
;
unit
=
(
unit
&&
(
Array
.
isArray
(
unit
)
&&
unit
?.
length
&&
unit
?.
slice
(
1
).
toString
()))
||
unit
;
unit
=
(
unit
&&
filterUnit
(
unit
))
||
unit
;
const
singularSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 单规格
const
multiSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 多规格
...
...
@@ -329,12 +327,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
singleDelivery
,
specList
:
+
repertoryType
===
1
?
singularSpecList
:
multiSpecList
,
// 单库存和多库存specList
items
:
+
repertoryType
===
1
?
singularSpuData
:
JSON
.
parse
(
JSON
.
stringify
(
multiSpu
)),
// categoryId:
// (
// infoMation?.categoryId &&
// infoMation?.categoryId?.slice(infoMation?.categoryId?.length - 1)
// )?.toString() ||
// (Array.isArray(categoryId) && categoryId?.slice(categoryId?.length - 1)?.toString()),
};
setIntactData
(
intactDataTemp
);
...
...
@@ -481,9 +473,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
AddRepertoryRef
.
current
.
setOpenRepertory
(
true
);
setRepertoryModel
({
type
,
idx
,
item
});
};
// 过滤单位
const
filterUnit
=
unit
=>
(
Array
.
isArray
(
unit
)
&&
unit
?.
length
&&
unit
?.
slice
(
1
).
toString
())
||
unit
;
// 拼接sku 名称
const
calcLabelName
=
item
=>
{
let
firstName
=
''
;
...
...
@@ -563,7 +553,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
? saleTimes.map(item => [moment(item?.startTime, format), moment(item?.endTime, format)])
: [];
if (editData?.skuList?.length) {
// editData.minPurchaseNum = editData?.skuList[0]?.serviceItem.minPurchaseNum;
// 单规格
if (editData?.skuList?.length === 1) {
const {
...
...
@@ -582,7 +571,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
editData.autoStock = +autoStock === 1;
editData.productRefShopId = editData.shopId;
editData.skuId = id;
// setSingularSpu(JSON.parse(JSON.stringify(tempMultiSpu)) || []);
form.setFieldsValue(editData);
} else {
// 多规格
...
...
@@ -608,7 +596,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
editData.productRefShopId = editData.shopId;
// setTempWeight(weight)
// setTempSpecs(specs)
form.setFieldsValue({ weight: weight[0].specs });
form.setFieldsValue(editData);
form.setFieldsValue({ specs });
...
...
@@ -657,7 +644,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}
setTimeType(tempEdit?.saleTimeType);
form.setFieldsValue(tempEdit);
getFormValues();
//
getFormValues();
}
}
}, [customer.isEdit, editData]);
...
...
@@ -851,13 +838,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<>
<Form.Item label="份量" className={styles.required}>
{form.getFieldValue(['unit']) &&
Array.isArray(form.getFieldValue(['unit'])) &&
weightUnits.includes(
form
.getFieldValue(['unit'])
.slice(1)
.toString(),
) && <span className="ant-form-text"> 约</span>}
weightUnits.includes(filterUnit(form.getFieldValue(['unit']))) && (
<span className="ant-form-text"> 约</span>
)}
<Form.Item
// noStyle
shouldUpdate={(prevValues, curValues) => false}
...
...
@@ -1164,7 +1147,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
)}
</Form.List>
</Form.Item>
{/* takeawayData?.takeawayItem?.weight?.length > 0 && */}
{
<>
<Form.Item>
...
...
@@ -1176,7 +1158,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<Form.Item key={specsField.key} className={styles.conBg}>
<Form.Item
{...specsField}
// validateTrigger={['onChange', 'onBlur']}
name={[specsField.name, 'specGroupName']}
rules={[
{
...
...
@@ -1189,12 +1170,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
>
<Input placeholder="规格名称" className={styles.nameWidth} />
</Form.Item>
{/* {specsFields.length > 1 ? ( */}
<MinusCircleOutlined
className="dynamic-delete-button"
onClick={() => remove(specsField.name)}
/>
{/* ) : null} */}
<Form.List
{...specsField}
name={[specsField.name, 'specs']}
...
...
src/pages/ServiceGoods/index.jsx
View file @
b852abb4
...
...
@@ -94,7 +94,6 @@ const ServiceGoods = options => {
const
typeObj
=
{
type
:
productType
,
};
console
.
log
(
'
visibleCacheEdit
'
,
visibleCacheEdit
,
e
);
if
(
visibleCacheEdit
)
{
setVisibleCacheEdit
(
false
);
localStorage
.
remove
(
localAutoSaveKey
);
...
...
@@ -104,8 +103,11 @@ const ServiceGoods = options => {
}
if
(
productType
===
5
)
{
setTakeawayInfoMation
(
e
);
if
(
visibleCacheEdit
)
{
setVisibleCacheEdit
(
false
);
localStorage
.
remove
(
localAutoSaveKey
);
}
// onAutoSaveValue(Object.assign({ type: 5 }, e));
// console.log('takeawayInfoMation', takeawayInfoMation);
}
};
...
...
@@ -468,7 +470,7 @@ const ServiceGoods = options => {
productName
:
info
.
infoMation
.
name
,
productType
:
info
.
type
,
firstCategoryId
:
info
.
infoMation
.
categoryId
[
0
],
firstCategoryName
:
first
.
name
,
firstCategoryName
:
first
?
.
name
,
secondCategoryId
:
info
.
infoMation
.
categoryId
[
1
],
secondCategoryName
:
second
?.
name
||
''
,
thirdCategoryId
:
info
.
infoMation
.
categoryId
[
2
],
...
...
@@ -518,9 +520,11 @@ const ServiceGoods = options => {
maskClosable=
{
false
}
keyboard=
{
false
}
footer=
{
[
<
Button
key=
"draft"
type=
"primary"
ghost
loading=
{
pageLoading
}
onClick=
{
onSaveDraft
}
>
保存草稿
</
Button
>,
!
isEdit
&&
(
<
Button
key=
"draft"
type=
"primary"
ghost
loading=
{
pageLoading
}
onClick=
{
onSaveDraft
}
>
保存草稿
</
Button
>
),
<
Button
key=
"submit"
type=
"primary"
loading=
{
pageLoading
}
onClick=
{
submitEvent
}
>
提交
</
Button
>,
...
...
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