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
fd77b238
Commit
fd77b238
authored
Apr 11, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新默认值
parent
d55b139b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
319 deletions
+30
-319
AddMultiSpecModal.jsx
src/pages/ServiceGoods/components/AddMultiSpecModal.jsx
+0
-268
AddRepertoryModal.jsx
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
+2
-15
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+27
-35
index.jsx
src/pages/ServiceGoods/index.jsx
+1
-1
No files found.
src/pages/ServiceGoods/components/AddMultiSpecModal.jsx
deleted
100644 → 0
View file @
d55b139b
// import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
// import { Button, Modal, Radio, Space, Form, InputNumber, Switch, Input } from 'antd';
// import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
// import styles from '../common.less';
// import { ENUM_SET_REPERTORY } from '../config';
// const AddMultiSpecModal = (props, ref) => {
// const [confirmLoading, setConfirmLoading] = useState(false);
// const [modalText, setModalText] = useState('Content of the modal');
// const [multiRepertory, setMultiRepertory] = useState(false);
// // const {
// // open,
// // setOpen,
// // } = props;
// useImperativeHandle(ref, () => ({
// // changeVal 就是暴露给父组件的方法
// setMultiRepertory: newVal => {
// setMultiRepertory(newVal);
// },
// }));
// const onChange3 = () => {};
// const handleOk = () => {
// setModalText('The modal will be closed after two seconds');
// setConfirmLoading(true);
// setTimeout(() => {
// setMultiRepertory(false);
// setConfirmLoading(false);
// }, 2000);
// };
// const handleCancel = () => {
// console.log('Clicked cancel button');
// setMultiRepertory(false);
// };
// useEffect(() => {
// console.log('open', multiRepertory);
// }, [multiRepertory]);
// return (
// <>
// {multiRepertory && (
// <Modal
// title="修改库存"
// visible={multiRepertory}
// onOk={handleOk}
// width={1050}
// confirmLoading={confirmLoading}
// onCancel={handleCancel}
// >
// <Form>
// <Form.Item>
// <div>份量(如大小/小份、微辣/特辣等)</div>
// <Form.List name="users">
// {(fields, { add, remove }) => (
// <>
// {fields.map(({ key, name, ...restField }) => (
// <Space
// key={key}
// style={{
// display: 'flex',
// flexDirection: 'column',
// marginBottom: 8,
// }}
// align="baseline"
// >
// <Form.Item className={styles.deal}>
// <Form.Item
// {...restField}
// name={[name, 'first']}
// rules={[
// {
// required: true,
// message: 'Missing first name',
// },
// ]}
// >
// <Input placeholder="名称" />
// </Form.Item>
// <Form.Item
// {...restField}
// name={[name, 'last']}
// rules={[
// {
// required: true,
// message: 'Missing last name',
// },
// ]}
// >
// <Input placeholder="约 份量(数字)" />
// </Form.Item>
// <Form.Item
// {...restField}
// name={[name, 'last']}
// rules={[
// {
// required: true,
// message: 'Missing last name',
// },
// ]}
// >
// <Input placeholder="约 份量(数字)" />
// </Form.Item>
// <Form.Item
// {...restField}
// name={[name, 'last']}
// rules={[
// {
// required: true,
// message: 'Missing last name',
// },
// ]}
// >
// <Input placeholder="销售价(元)" />
// </Form.Item>
// <Form.Item
// {...restField}
// name={[name, 'last']}
// rules={[
// {
// required: true,
// message: 'Missing last name',
// },
// ]}
// >
// <Input placeholder="活动价(元)" />
// </Form.Item>
// <MinusCircleOutlined onClick={() => remove(name)} />
// </Form.Item>
// <Form.Item>
// <Form.Item>
// <div>添加规格(如加料、甜度、辣度等)</div>
// <Form.Item>
// <Form.List name="names">
// {(fields, { add, remove }, { errors }) => (
// <>
// {fields.map((field, index) => (
// <Form.Item
// // {...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)}
// // label={index === 0 ? 'Passengers' : ''}
// required={false}
// key={field.key}
// >
// <Form.Item
// {...field}
// validateTrigger={['onChange', 'onBlur']}
// className={styles.deal}
// rules={[
// {
// required: true,
// whitespace: true,
// message:
// "Please input passenger's name or delete this field.",
// },
// ]}
// >
// <Input
// placeholder="规格名称"
// className={styles.nameWidth}
// />
// {fields.length > 1 ? (
// <MinusCircleOutlined
// className="dynamic-delete-button"
// onClick={() => remove(field.name)}
// />
// ) : null}
// </Form.Item>
// <Form.Item>
// <Form.List name="sights">
// {(fields, { add, remove }) => (
// <>
// {fields.map(field => (
// <Space key={field.key} align="baseline">
// <Form.Item
// noStyle
// shouldUpdate={(prevValues, curValues) =>
// prevValues.area !== curValues.area ||
// prevValues.sights !== curValues.sights
// }
// >
// {() => (
// <Form.Item
// {...field}
// // label="Sight"
// name={[field.name, 'sight']}
// rules={[
// {
// required: true,
// message: 'Missing sight',
// },
// ]}
// >
// <Input style={{ width: '200px' }} placeholder="加价名称" />
// </Form.Item>
// )}
// </Form.Item>
// <Form.Item
// {...field}
// // label="Price"
// // name={[field.name, 'price']}
// rules={[
// {
// required: true,
// message: 'Missing price',
// },
// ]}
// >
// <InputNumber style={{ width: '200px' }} placeholder="加价名称金额(元)" />
// </Form.Item>
// <MinusCircleOutlined
// onClick={() => remove(field.name)}
// />
// </Space>
// ))}
// <Form.Item>
// <Button
// type="dashed"
// onClick={() => add()}
// block
// icon={<PlusOutlined />}
// >
// 新增加价
// </Button>
// </Form.Item>
// </>
// )}
// </Form.List>
// </Form.Item>
// </Form.Item>
// ))}
// <Form.Item>
// <Button
// type="dashed"
// onClick={() => add()}
// style={{ width: '60%' }}
// icon={<PlusOutlined />}
// >
// 新增规格
// </Button>
// </Form.Item>
// </>
// )}
// </Form.List>
// </Form.Item>
// </Form.Item>
// </Form.Item>
// </Space>
// ))}
// <Form.Item>
// <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
// 新增份量
// </Button>
// </Form.Item>
// </>
// )}
// </Form.List>
// </Form.Item>
// </Form>
// </Modal>
// )}
// </>
// );
// };
// export default forwardRef(AddMultiSpecModal);
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
View file @
fd77b238
...
...
@@ -78,26 +78,13 @@ const AddRepertoryModal = (props, ref) => {
};
useEffect
(()
=>
{
if
(
item
?.
serviceItem
)
{
const
{
productStock
=
1
,
autoStock
=
0
,
maxStock
=
2
}
=
item
?.
serviceItem
;
const
{
productStock
=
0
,
autoStock
=
0
,
maxStock
=
0
}
=
item
?.
serviceItem
;
const
params
=
{
productStock
,
autoStock
:
+
autoStock
===
1
,
maxStock
,
};
switch
(
type
)
{
case
'
all
'
:
// 统一设置
form
.
setFieldsValue
(
params
);
break
;
case
'
multi
'
:
// 多规格设置
form
.
setFieldsValue
(
params
);
break
;
case
'
singular
'
:
// 单规格设置
// setInitialValues(params);
form
.
setFieldsValue
(
params
);
break
;
default
:
break
;
}
form
.
setFieldsValue
(
params
);
}
},
[
openRepertory
,
item
]);
return
(
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
fd77b238
...
...
@@ -38,7 +38,7 @@ import UploadCropImage from './UploadCropImage';
// import AddSellTimeModal from './AddSellTimeModal';
import
styles
from
'
../common.less
'
;
import
AddRepertoryModal
from
'
./AddRepertoryModal
'
;
import
AddMultiSpecModal
from
'
./AddMultiSpecModal
'
;
//
import AddMultiSpecModal from './AddMultiSpecModal';
import
{
apiTagList
,
apiUnits
}
from
'
../service
'
;
import
{
localAutoSaveKey
,
calcDescartes
}
from
'
../utils
'
;
import
localStorage
from
'
@/utils/localStorage
'
;
...
...
@@ -103,16 +103,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
return
null
;
}
};
// // 过滤存在的sku对象
// const objectComparison = (item, itm) => {
// console.log(item, itm, '==========');
// const {
// serviceItem: { maxStock, autoStock, productStock },
// } = itm;
// const params = { maxStock, autoStock, productStock: productStock || itm.productStock };
// const temp = { ...item, ...params };
// return temp;
// };
const
takeawayCalc
=
takeawayData
=>
{
// 商品基本信息编辑商品名称
...
...
@@ -551,16 +541,18 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const weight = specList?.filter(item => item.specGroupName === '份量');
const specs = specList?.filter(item => item.specGroupName !== '份量');
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
weight.forEach(item => {
if (item?.specs?.length) {
item.specs.forEach(itm => {
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
itm.quantity =
itm?.quantity.indexOf('约') > -1 ? itm?.quantity.slice(1) : itm?.quantity || '';
}
});
}
});
if (weight?.length) {
weight.forEach(item => {
if (item?.specs?.length) {
item.specs.forEach(itm => {
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
itm.quantity =
itm?.quantity.indexOf('约') > -1 ? itm?.quantity.slice(1) : itm?.quantity || '';
}
});
}
});
}
editData.saleTimes = saleTimes?.length
? saleTimes.map(item => [moment(item?.startTime, format), moment(item?.endTime, format)])
: [];
...
...
@@ -592,18 +584,20 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const specList = editData?.specList;
const weight = specList.filter(item => item.specGroupName === '份量');
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
weight.forEach(item => {
if (item?.specs?.length) {
item.specs.forEach(itm => {
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
itm.quantity =
itm?.quantity?.indexOf('约') > -1
? itm?.quantity.slice(1)
: itm?.quantity || '';
}
});
}
});
if (weight?.length) {
weight.forEach(item => {
if (item?.specs?.length) {
item.specs.forEach(itm => {
if (itm?.unit && tempWeightName.includes(itm?.unit)) {
itm.quantity =
itm?.quantity?.indexOf('约') > -1
? itm?.quantity.slice(1)
: itm?.quantity || '';
}
});
}
});
}
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
editData.productRefShopId = editData.shopId;
// setTempWeight(weight)
...
...
@@ -1313,8 +1307,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
intactData={intactData}
repertoryModel={repertoryModel}
/>
{/* 加入多规格 */}
<AddMultiSpecModal ref={AddMultiSpecRef} />
</>
);
});
...
...
src/pages/ServiceGoods/index.jsx
View file @
fd77b238
...
...
@@ -60,7 +60,7 @@ const ServiceGoods = options => {
const
[
categoryIds
,
setCategoryIds
]
=
useState
([]);
// 商品品类ID
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
);
// 是否是编辑状态
const
[
isUseCache
,
setIsUseCache
]
=
useState
(
false
);
// 是否使用缓存
let
ptype
=
can
TakeawayService
?
5
:
4
;
let
ptype
=
can
AddService
?
4
:
5
;
ptype
=
canAddNormal
?
1
:
ptype
;
const
[
productType
,
setProductType
]
=
useState
(
ptype
);
// 商品状态
const
[
pageLoading
,
setPageLoading
]
=
useState
(
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