Commit 0aa6a9e0 authored by 陈万宝's avatar 陈万宝

feat: 修改商品名称

parent 4714428f
...@@ -12,6 +12,7 @@ import { ServiceContext } from '../context'; ...@@ -12,6 +12,7 @@ import { ServiceContext } from '../context';
import { debounce } from '@/utils/utils'; import { debounce } from '@/utils/utils';
import AddMenusModal from './AddMenusModal'; import AddMenusModal from './AddMenusModal';
import UploadImage from './UploadImage'; import UploadImage from './UploadImage';
import UploadCropImage from './UploadCropImage'
import { apiShopIds, apiQueryShopList, getByProductType } from '../service'; import { apiShopIds, apiQueryShopList, getByProductType } from '../service';
import GroupInfo from '../../GoodsManage/Takeaway/components/GroupInfo'; import GroupInfo from '../../GoodsManage/Takeaway/components/GroupInfo';
...@@ -202,7 +203,7 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -202,7 +203,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
name="name" name="name"
label="商品名称" label="商品名称"
rules={[ rules={[
{ required: true, min: 2, message: '请输入最少两个字符的商品名称', whitespace: true }, { required: true, min: 2, max: 30, message: '请输入大于2个且小于30字符的商品名称', whitespace: true },
]} ]}
> >
<Input placeholder="请输入商品名称" disabled={customer.isDisabled} /> <Input placeholder="请输入商品名称" disabled={customer.isDisabled} />
...@@ -270,7 +271,7 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -270,7 +271,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
}, },
]} ]}
> >
<UploadImage <UploadCropImage
name="takeawayImageList" name="takeawayImageList"
limit={5} limit={5}
disabled={customer.isDisabled} disabled={customer.isDisabled}
......
...@@ -31,7 +31,7 @@ import { Title } from './CommonTemplate'; ...@@ -31,7 +31,7 @@ import { Title } from './CommonTemplate';
import { formItemLayout, ENUM_REPERTORY, ENUM_SET_REPERTORY, ENUM_WEEK } from '../config'; import { formItemLayout, ENUM_REPERTORY, ENUM_SET_REPERTORY, ENUM_WEEK } from '../config';
import { ServiceContext } from '../context'; import { ServiceContext } from '../context';
import { debounce } from '@/utils/utils'; import { debounce } from '@/utils/utils';
import UploadImage from './UploadImage'; import UploadCropImage from './UploadCropImage';
// import AddSellTimeModal from './AddSellTimeModal'; // import AddSellTimeModal from './AddSellTimeModal';
import styles from '../common.less'; import styles from '../common.less';
import AddRepertoryModal from './AddRepertoryModal'; import AddRepertoryModal from './AddRepertoryModal';
...@@ -163,7 +163,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -163,7 +163,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
salePrice, salePrice,
maxStock, maxStock,
quantity, quantity,
unit: (Array.isArray(unit) && unit?.length && unit?.splice(unit?.length - 1)[0]) || unit, // unit: (Array.isArray(unit) && unit?.length && unit?.splice(unit?.length - 1)[0]) || unit,
unit,
productStock, productStock,
specGroupName: '份量', specGroupName: '份量',
}; };
...@@ -471,6 +472,19 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -471,6 +472,19 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if (!editData) return; if (!editData) return;
let { label, firstCategoryId, secondCategoryId, thirdCategoryId, id } = editData; let { label, firstCategoryId, secondCategoryId, thirdCategoryId, id } = editData;
editData.label = label.split(',').map(item => +item); editData.label = label.split(',').map(item => +item);
let specList = editData?.specList;
let 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 (tempWeightName.includes(itm.unit)) {
itm.quantity =
itm?.quantity.indexOf('约') > -1 ? itm?.quantity.slice(1) : itm?.quantity || '';
}
});
}
});
if (editData?.skuList.length) { if (editData?.skuList.length) {
editData.minPurchaseNum = editData?.skuList[0]?.serviceItem.minPurchaseNum; editData.minPurchaseNum = editData?.skuList[0]?.serviceItem.minPurchaseNum;
// 单规格 // 单规格
...@@ -483,7 +497,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -483,7 +497,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
} = editData?.skuList[0]; } = editData?.skuList[0];
let { quantity, unit, salePrice } = specs[0]; let { quantity, unit, salePrice } = specs[0];
editData.productStock = productStock; editData.productStock = productStock;
editData.quantity = quantity; editData.quantity = `${quantity}`.indexOf('约') > -1 ? quantity.slice(1) :quantity || '';;
editData.unit = unit; editData.unit = unit;
editData.salePrice = salePrice; editData.salePrice = salePrice;
editData.maxStock = maxStock; editData.maxStock = maxStock;
...@@ -583,7 +597,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -583,7 +597,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
label="商品图片" label="商品图片"
extra="支持.jpg/png格式图片,建议单张切片宽750像素,大小200kb左右,您可以拖拽图片调整顺序,最多上传5张。" extra="支持.jpg/png格式图片,建议单张切片宽750像素,大小200kb左右,您可以拖拽图片调整顺序,最多上传5张。"
> >
<UploadImage <UploadCropImage
name="detailImageList" name="detailImageList"
limit={5} limit={5}
disabled={customer.isDisabled} disabled={customer.isDisabled}
...@@ -601,7 +615,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -601,7 +615,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<InputNumber <InputNumber
min={1} min={1}
max={999999999} max={999999999}
precision={2}
style={{ width: 200 }} style={{ width: 200 }}
placeholder="请输入购买量" placeholder="请输入购买量"
/> />
...@@ -695,7 +708,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -695,7 +708,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
)} )}
<Form.Item name="label" label="商品标签"> <Form.Item name="label" label="商品标签">
<Select <Select
mode="multiple" // mode="multiple"
allowClear allowClear
placeholder="请选择商品标签" placeholder="请选择商品标签"
style={{ width: 400 }} style={{ width: 400 }}
...@@ -793,7 +806,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -793,7 +806,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<InputNumber <InputNumber
min={0} min={0}
max={999999999} max={999999999}
precision={2}
style={{ width: 200, display: 'inline-block' }} style={{ width: 200, display: 'inline-block' }}
placeholder="请输入" placeholder="请输入"
/> />
...@@ -813,7 +825,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -813,7 +825,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<InputNumber <InputNumber
max={999999999} max={999999999}
min={0} min={0}
precision={2}
style={{ width: 200 }} style={{ width: 200 }}
placeholder="请输入" placeholder="请输入"
onChange={onChangeMaxStock} onChange={onChangeMaxStock}
......
...@@ -238,7 +238,7 @@ const UploadCropImage = forwardRef((props, ref) => { ...@@ -238,7 +238,7 @@ const UploadCropImage = forwardRef((props, ref) => {
{limit !== null && fileList.length >= limit ? ( {limit !== null && fileList.length >= limit ? (
'' ''
) : ( ) : (
<ImgCrop rotationSlider modalWidth={1200} quality={0.5} showReset> <ImgCrop rotationSlider modalWidth={900} modalHeight={900} quality={0.5} showReset>
<Upload <Upload
{...uploadParams} {...uploadParams}
disabled={Boolean(disabled)} disabled={Boolean(disabled)}
......
...@@ -117,10 +117,10 @@ export const filterSendData = (type, params) => { ...@@ -117,10 +117,10 @@ export const filterSendData = (type, params) => {
temp.categoryId = (Array.isArray(temp.categoryId) && temp.categoryId?.slice(temp.categoryId?.length - 1)?.toString()) temp.categoryId = (Array.isArray(temp.categoryId) && temp.categoryId?.slice(temp.categoryId?.length - 1)?.toString())
temp.productRefShopId = temp.productRefShopId.toString() temp.productRefShopId = temp.productRefShopId.toString()
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits')) const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'))
// console.log(tempWeightName, 'tempWeightName');
temp.items.forEach(item => { temp.items.forEach(item => {
item.autoStock = item.autoStock ? 1 : 0 item.autoStock = item.autoStock ? 1 : 0
item.serviceItem.autoStock = item?.serviceItem?.autoStock ? 1 : 0 item.serviceItem.autoStock = item?.serviceItem?.autoStock ? 1 : 0
item.productStock = item?.serviceItem?.productStock
if (item?.specs?.length) { if (item?.specs?.length) {
item?.specs.forEach(itm => { item?.specs.forEach(itm => {
if (tempWeightName.includes(itm.unit)) { if (tempWeightName.includes(itm.unit)) {
...@@ -132,6 +132,7 @@ export const filterSendData = (type, params) => { ...@@ -132,6 +132,7 @@ export const filterSendData = (type, params) => {
temp.specList && temp.specList.forEach(item => { temp.specList && temp.specList.forEach(item => {
if (item?.specs?.length) { if (item?.specs?.length) {
item?.specs.forEach(itm => { item?.specs.forEach(itm => {
itm.unit = (Array.isArray(itm.unit) && itm.unit?.length>=2 && itm.unit?.splice(itm.unit?.length - 1)[0]) || itm.unit
if (tempWeightName.includes(itm.unit)) { if (tempWeightName.includes(itm.unit)) {
itm.quantity = `${itm?.quantity}`.indexOf('约') > -1 ? itm?.quantity : `${itm?.quantity}` itm.quantity = `${itm?.quantity}`.indexOf('约') > -1 ? itm?.quantity : `${itm?.quantity}`
} }
......
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