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

feat: 修改文案

parent f3a99ff4
......@@ -481,23 +481,27 @@ 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 = '';
let lastName = '';
if (item?.unique && item?.unique !== '[object Object]') {
const tempName = `${editData?.name || ''}`;
// const tempSpecName = `${item?.specs[0]?.specName || ''}`;
const tempQuantity = `(${item.specs[0]?.quantity || ''}`;
if ((item?.unique || item?.specs?.length >= 0) && item?.unique !== '[object Object]') {
const tempQuantity = `(${
item?.specs[0]?.unit
? (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 tempSecondSpecName = `${item.specs[1]?.specName || ''}`;
// const isShow = tempQuantity && tempUnit && '+';
const uniqueName = item?.unique?.split(',') || [];
if (uniqueName && uniqueName?.length) {
firstName = uniqueName[0] || '';
lastName = uniqueName?.slice(1).join(' ') || '';
}
// ${tempName}
return `${firstName} ${tempQuantity} ${tempUnit} ${lastName}`;
}
};
......@@ -633,7 +637,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
props.onValuesChange(editData, !0);
let tempEdit = JSON.parse(JSON.stringify(editData));
tempEdit = Object.assign({}, editData, { ...tempEdit.takeawayItem, ...tempEdit.infoMation });
console.log('tempEdit', tempEdit);
if (Object.keys(tempEdit).length) {
if (tempEdit?.saleTimes) {
tempEdit.saleTimes = tempEdit?.saleTimes?.length
......@@ -647,7 +650,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
setRepertoryType('2');
form.setFieldsValue({ weight: tempEdit?.weight });
form.setFieldsValue({ specs: tempEdit?.specs });
console.log('tempEdit?.multiSpu', tempEdit?.multiSpu);
setTempMultiSpu(JSON.parse(JSON.stringify(tempEdit?.multiSpu)));
}
if (tempEdit?.detailImageList) {
......@@ -862,9 +864,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
>
{form => {
let unit = form.getFieldValue('unit') || '';
unit =
(unit && (Array.isArray(unit) && unit?.length && unit?.slice(1).toString())) ||
unit;
unit = filterUnit(unit);
if (!peopleUnits.includes(unit)) {
return (
<Form.Item
......@@ -1036,21 +1036,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
>
<Input style={{ width: '200px' }} placeholder="名称" />
</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
// noStyle
shouldUpdate={(prevValues, curValues) => false}
>
{form => {
let unit = form.getFieldValue(['weight'])?.[index]?.unit || '';
unit =
(unit &&
(Array.isArray(unit) &&
unit?.length &&
unit?.slice(1).toString())) ||
unit;
unit = filterUnit(unit);
if (!peopleUnits.includes(unit)) {
return (
<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