Commit 60719448 authored by 陈万宝's avatar 陈万宝

feat: 修改文案

parent f3a99ff4
...@@ -481,23 +481,27 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -481,23 +481,27 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
AddRepertoryRef.current.setOpenRepertory(true); AddRepertoryRef.current.setOpenRepertory(true);
setRepertoryModel({ type, idx, item }); setRepertoryModel({ type, idx, item });
}; };
// 过滤单位
const filterUnit = unit =>
(Array.isArray(unit) && unit?.length && unit?.slice(1).toString()) || unit;
// 拼接sku 名称 // 拼接sku 名称
const calcLabelName = item => { const calcLabelName = item => {
let firstName = ''; let firstName = '';
let lastName = ''; let lastName = '';
if (item?.unique && item?.unique !== '[object Object]') { if ((item?.unique || item?.specs?.length >= 0) && item?.unique !== '[object Object]') {
const tempName = `${editData?.name || ''}`; const tempQuantity = `(${
// const tempSpecName = `${item?.specs[0]?.specName || ''}`; item?.specs[0]?.unit
const tempQuantity = `(${item.specs[0]?.quantity || ''}`; ? (weightUnits.includes(filterUnit(item.specs[0]?.unit)) && '') || ''
: ''
} ${
peopleUnits.includes(filterUnit(item.specs[0]?.unit)) ? '' : item.specs[0]?.quantity || ''
}`;
const tempUnit = `${item.specs[0]?.unit || ''} ${item.specs[0]?.unit ? ')' : ''}`; const tempUnit = `${item.specs[0]?.unit || ''} ${item.specs[0]?.unit ? ')' : ''}`;
// const tempSecondSpecName = `${item.specs[1]?.specName || ''}`;
// const isShow = tempQuantity && tempUnit && '+';
const uniqueName = item?.unique?.split(',') || []; const uniqueName = item?.unique?.split(',') || [];
if (uniqueName && uniqueName?.length) { if (uniqueName && uniqueName?.length) {
firstName = uniqueName[0] || ''; firstName = uniqueName[0] || '';
lastName = uniqueName?.slice(1).join(' ') || ''; lastName = uniqueName?.slice(1).join(' ') || '';
} }
// ${tempName}
return `${firstName} ${tempQuantity} ${tempUnit} ${lastName}`; return `${firstName} ${tempQuantity} ${tempUnit} ${lastName}`;
} }
}; };
...@@ -633,7 +637,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -633,7 +637,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
props.onValuesChange(editData, !0); props.onValuesChange(editData, !0);
let tempEdit = JSON.parse(JSON.stringify(editData)); let tempEdit = JSON.parse(JSON.stringify(editData));
tempEdit = Object.assign({}, editData, { ...tempEdit.takeawayItem, ...tempEdit.infoMation }); tempEdit = Object.assign({}, editData, { ...tempEdit.takeawayItem, ...tempEdit.infoMation });
console.log('tempEdit', tempEdit);
if (Object.keys(tempEdit).length) { if (Object.keys(tempEdit).length) {
if (tempEdit?.saleTimes) { if (tempEdit?.saleTimes) {
tempEdit.saleTimes = tempEdit?.saleTimes?.length tempEdit.saleTimes = tempEdit?.saleTimes?.length
...@@ -647,7 +650,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -647,7 +650,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
setRepertoryType('2'); setRepertoryType('2');
form.setFieldsValue({ weight: tempEdit?.weight }); form.setFieldsValue({ weight: tempEdit?.weight });
form.setFieldsValue({ specs: tempEdit?.specs }); form.setFieldsValue({ specs: tempEdit?.specs });
console.log('tempEdit?.multiSpu', tempEdit?.multiSpu);
setTempMultiSpu(JSON.parse(JSON.stringify(tempEdit?.multiSpu))); setTempMultiSpu(JSON.parse(JSON.stringify(tempEdit?.multiSpu)));
} }
if (tempEdit?.detailImageList) { if (tempEdit?.detailImageList) {
...@@ -862,9 +864,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -862,9 +864,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
> >
{form => { {form => {
let unit = form.getFieldValue('unit') || ''; let unit = form.getFieldValue('unit') || '';
unit = unit = filterUnit(unit);
(unit && (Array.isArray(unit) && unit?.length && unit?.slice(1).toString())) ||
unit;
if (!peopleUnits.includes(unit)) { if (!peopleUnits.includes(unit)) {
return ( return (
<Form.Item <Form.Item
...@@ -1036,21 +1036,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -1036,21 +1036,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
> >
<Input style={{ width: '200px' }} placeholder="名称" /> <Input style={{ width: '200px' }} placeholder="名称" />
</Form.Item> </Form.Item>
{weightUnits.includes(form.getFieldValue(['weight'])?.[index]?.unit) && (
<span className="ant-form-text"> 约</span> {weightUnits.includes(
)} filterUnit(form.getFieldValue(['weight'])?.[index]?.unit),
) && <span className="ant-form-text"> 约</span>}
<Form.Item <Form.Item
// noStyle // noStyle
shouldUpdate={(prevValues, curValues) => false} shouldUpdate={(prevValues, curValues) => false}
> >
{form => { {form => {
let unit = form.getFieldValue(['weight'])?.[index]?.unit || ''; let unit = form.getFieldValue(['weight'])?.[index]?.unit || '';
unit = unit = filterUnit(unit);
(unit &&
(Array.isArray(unit) &&
unit?.length &&
unit?.slice(1).toString())) ||
unit;
if (!peopleUnits.includes(unit)) { if (!peopleUnits.includes(unit)) {
return ( return (
<Form.Item <Form.Item
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment