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

feat:更新修改库存

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