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

feat:更新修改库存

parent 06d4d844
...@@ -62,7 +62,7 @@ class goodsManage extends Component { ...@@ -62,7 +62,7 @@ class goodsManage extends Component {
auditRow: {}, // 查看审核信息使用 auditRow: {}, // 查看审核信息使用
isVisibleDraft: false, // 显示隐藏草稿箱 isVisibleDraft: false, // 显示隐藏草稿箱
isEditDraft: false, // 是否编辑草稿 isEditDraft: false, // 是否编辑草稿
productType: 5, // 商品类型 productType: 1, // 商品类型
takeAway: {}, // 弹窗外卖商品参数 takeAway: {}, // 弹窗外卖商品参数
searchValue: {}, // 搜索条件 searchValue: {}, // 搜索条件
refresh: '', // 外卖刷新 refresh: '', // 外卖刷新
......
...@@ -254,6 +254,20 @@ ...@@ -254,6 +254,20 @@
} }
} }
} }
.specsSingularBetween {
display: flex;
justify-content: flex-start;
width: max-content;
align-items:center;
:global {
.ant-form-item-label {
overflow: inherit;
}
.ant-col-sm-3 {
max-width: fit-content;
}
}
}
.specsBetween { .specsBetween {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
......
import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react'; import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } from 'react';
import { Button, Modal, Radio, Form, InputNumber, Switch, Space } from 'antd'; import { Button, Modal, Radio, Form, InputNumber, Switch, Space, message } from 'antd';
import styles from '../common.less'; import styles from '../common.less';
import { ENUM_SET_REPERTORY } from '../config'; import { ENUM_SET_REPERTORY } from '../config';
import { debounce } from '@/utils/utils'; import { debounce } from '@/utils/utils';
...@@ -59,6 +59,10 @@ const AddRepertoryModal = (props, ref) => { ...@@ -59,6 +59,10 @@ const AddRepertoryModal = (props, ref) => {
const handleOk = async () => { const handleOk = async () => {
const values = await form.validateFields(); const values = await form.validateFields();
values.autoStock = values.autoStock ? 1 : 0; values.autoStock = values.autoStock ? 1 : 0;
if (+values.autoStock === 1 && +values.maxStock === 0) {
message.error('最大库存不能为0')
return
}
// 回调库存 // 回调库存
modifiedInventory(type, idx, values); modifiedInventory(type, idx, values);
setConfirmLoading(true); setConfirmLoading(true);
......
...@@ -244,10 +244,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -244,10 +244,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
itm.unit = itm.unit =
itm?.unit && itm?.unit &&
(Array.isArray(itm?.unit) ? itm?.unit.slice(itm?.unit.length - 1)[0] : itm?.unit); (Array.isArray(itm?.unit) ? itm?.unit.slice(itm?.unit.length - 1)[0] : itm?.unit);
}
if (itm?.unit && peopleUnits.includes(itm.unit)) { if (itm?.unit && peopleUnits.includes(itm.unit)) {
delete itm.quantity; delete itm.quantity;
} }
}
if (itm?.specName) { if (itm?.specName) {
return itm.specName; return itm.specName;
} }
...@@ -890,11 +890,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -890,11 +890,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
</Form.Item> </Form.Item>
<div className={styles.rowWarp}> <div className={styles.rowWarp}>
{singularSpu.length > 0 && {singularSpu.length > 0 &&
(takeawayData?.infoMation?.name || takeawayData.takeawayItem.name) && singularSpu[0]?.specs[0]?.unit &&
singularSpu.map((item, index) => ( singularSpu.map((item, index) => (
<div className={styles.specsBetween}> <div className={styles.specsSingularBetween}>
<Form.Item label={calcLabelName(intactData, item, 'singular')}> <Form.Item label={calcLabelName(intactData, item, 'singular')}>
<div className={styles.specsBetween}> <div className={styles.specsSingularBetween}>
<span className={styles.repertoryLimit}> <span className={styles.repertoryLimit}>
{item?.specs[0]?.productStock}/{item?.specs[0]?.maxStock} {item?.specs[0]?.productStock}/{item?.specs[0]?.maxStock}
</span> </span>
...@@ -943,7 +943,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -943,7 +943,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
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 && (Array.isArray(unit) && unit?.length && unit?.slice(1).toString())) ||
unit;
if (!peopleUnits.includes(unit)) { if (!peopleUnits.includes(unit)) {
return ( return (
<Form.Item <Form.Item
......
...@@ -87,7 +87,6 @@ const ServiceGoods = options => { ...@@ -87,7 +87,6 @@ const ServiceGoods = options => {
const resetForm = () => clearCurrent(checkFormList).forEach(({ current }) => current.reset()); const resetForm = () => clearCurrent(checkFormList).forEach(({ current }) => current.reset());
const onValuesChange = e => { const onValuesChange = e => {
// console.log('e======', e, !isEdit, visibleCacheEdit);
if (!isEdit) { if (!isEdit) {
if (visibleCacheEdit) { if (visibleCacheEdit) {
setVisibleCacheEdit(false); setVisibleCacheEdit(false);
......
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