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

fix: 修改库存问题

parent 8f1a428f
...@@ -3,6 +3,7 @@ import { Button, Modal, Radio, Form, InputNumber, Switch, Space, message } from ...@@ -3,6 +3,7 @@ import { Button, Modal, Radio, Form, InputNumber, Switch, Space, message } from
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';
import { isCheckPriceTwoDecimal, isIntegerNotZero } from '@/utils/validator';
const AddRepertoryModal = (props, ref) => { const AddRepertoryModal = (props, ref) => {
const [confirmLoading, setConfirmLoading] = useState(false); const [confirmLoading, setConfirmLoading] = useState(false);
...@@ -28,7 +29,7 @@ const AddRepertoryModal = (props, ref) => { ...@@ -28,7 +29,7 @@ const AddRepertoryModal = (props, ref) => {
form.setFieldsValue({ form.setFieldsValue({
autoStock: e ? 1 : 0, autoStock: e ? 1 : 0,
}); });
setIsRequired(!e) setIsRequired(!e);
}; };
// 勾选库存设置 // 勾选库存设置
const onChangeSetRepertory = e => { const onChangeSetRepertory = e => {
...@@ -60,8 +61,8 @@ const AddRepertoryModal = (props, ref) => { ...@@ -60,8 +61,8 @@ const AddRepertoryModal = (props, ref) => {
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) { if (+values.autoStock === 1 && +values.maxStock === 0) {
message.error('最大库存不能为0') message.error('最大库存不能为0');
return return;
} }
// 回调库存 // 回调库存
modifiedInventory(type, idx, values); modifiedInventory(type, idx, values);
...@@ -119,7 +120,14 @@ const AddRepertoryModal = (props, ref) => { ...@@ -119,7 +120,14 @@ const AddRepertoryModal = (props, ref) => {
display: 'flex', display: 'flex',
marginRight: '8px', marginRight: '8px',
}} }}
rules={[{ required: true, message: '请填写剩余库存' }]} rules={[
{ required: true, message: '请填写剩余库存' },
{
validator: isIntegerNotZero,
type: 'number',
message: '请输入大于0的整数',
},
]}
> >
<InputNumber <InputNumber
min={0} min={0}
...@@ -140,7 +148,14 @@ const AddRepertoryModal = (props, ref) => { ...@@ -140,7 +148,14 @@ const AddRepertoryModal = (props, ref) => {
<Form.Item <Form.Item
name="maxStock" name="maxStock"
label="最大库存" label="最大库存"
rules={[{ required: isRequired, message: '请填写最大库存' }]} rules={[
{ required: isRequired, message: '请填写最大库存' },
{
validator: isIntegerNotZero,
type: 'number',
message: '请输入大于0的整数',
},
]}
> >
<InputNumber <InputNumber
min={0} min={0}
......
...@@ -167,14 +167,16 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -167,14 +167,16 @@ const FormInformationBasic = forwardRef((props, ref) => {
useEffect(() => { useEffect(() => {
if (!editData) return; if (!editData) return;
if (editData.productType === 5 && editData.name) { if (editData.productType === 5 && editData?.name) {
shopGetByProductType(5); shopGetByProductType(5);
queryShopList({ shopId: editData.productRefShopId }); queryShopList({ shopId: editData?.productRefShopId });
setShopIdSource(editData.productRefShopId); setShopIdSource(editData?.productRefShopId);
setIsEditTakeaway(true); setIsEditTakeaway(true);
} }
form.setFieldsValue(editData); form.setFieldsValue(editData);
onTakeawayImageList(editData.commonImageList); if (editData?.commonImageList?.length) {
onTakeawayImageList(editData?.commonImageList);
}
}, [customer.isEdit, editData]); }, [customer.isEdit, editData]);
useEffect(() => { useEffect(() => {
setShopList([]); setShopList([]);
...@@ -188,9 +190,7 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -188,9 +190,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
productRefShopId: shopId ? [`${shopId}`] : [], productRefShopId: shopId ? [`${shopId}`] : [],
storageRackIds: groupId ? [+groupId] : [], storageRackIds: groupId ? [+groupId] : [],
}; };
setTimeout(() => {
form.setFieldsValue(temp); form.setFieldsValue(temp);
}, []);
}, [groupShopData]); }, [groupShopData]);
return ( return (
<Form <Form
......
...@@ -31,6 +31,7 @@ import { Title } from './CommonTemplate'; ...@@ -31,6 +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 { isCheckPriceTwoDecimal, isIntegerNotZero } from '@/utils/validator';
import UploadCropImage from './UploadCropImage'; import UploadCropImage from './UploadCropImage';
// import AddSellTimeModal from './AddSellTimeModal'; // import AddSellTimeModal from './AddSellTimeModal';
import styles from '../common.less'; import styles from '../common.less';
...@@ -70,7 +71,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -70,7 +71,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const [unitsList, setUnitsList] = useState([]); const [unitsList, setUnitsList] = useState([]);
const [takeawayData, setTakeawayData] = useState({}); const [takeawayData, setTakeawayData] = useState({});
let [multiSpu, setMultiSpu] = useState([]); let [multiSpu, setMultiSpu] = useState([]);
const [singularSpu, setSingularSpu] = useState([]); let [singularSpu, setSingularSpu] = useState([]);
const [intactData, setIntactData] = useState({}); const [intactData, setIntactData] = useState({});
const [repertoryState, setRepertoryState] = useState(''); const [repertoryState, setRepertoryState] = useState('');
const [repertoryModel, setRepertoryModel] = useState({}); const [repertoryModel, setRepertoryModel] = useState({});
...@@ -108,7 +109,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -108,7 +109,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
description, description,
detailImageList, detailImageList,
list, list,
minPurchaseNum = 0, minPurchaseNum = 1,
saleDates, saleDates,
maxStock = 0, maxStock = 0,
saleTimes = [], saleTimes = [],
...@@ -130,9 +131,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -130,9 +131,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const singularSpecList = [{ specGroupName: '份量', generateSku: 1, specs: [] }]; // 单规格 const singularSpecList = [{ specGroupName: '份量', generateSku: 1, specs: [] }]; // 单规格
const multiSpecList = [{ specGroupName: '份量', generateSku: 1, specs: [] }]; // 多规格 const multiSpecList = [{ specGroupName: '份量', generateSku: 1, specs: [] }]; // 多规格
// const multiSpu = customer.isEdit ? skuList:[]; // 多库存spu、 // const multiSpu = customer.isEdit ? skuList:[]; // 多库存spu、
let singularSpu = []; // 单库存spu // let singularSpu = []; // 单库存spu
const saleTimesTemp = []; const saleTimesTemp = [];
let initIndex = 0;
if (saleTimes.length) { if (saleTimes.length) {
saleTimes.forEach(item => { saleTimes.forEach(item => {
const startTime = item ? moment(item[0]).format(format) : ''; const startTime = item ? moment(item[0]).format(format) : '';
...@@ -178,6 +178,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -178,6 +178,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
singularSpecList[0].specs = [specs]; singularSpecList[0].specs = [specs];
singularSpu = [{ ...temp, specs: [specs] }]; singularSpu = [{ ...temp, specs: [specs] }];
setSingularSpu(singularSpu); setSingularSpu(singularSpu);
console.log('singularSpu', singularSpu);
} }
// 多规格 // 多规格
if (+repertoryType === 2) { if (+repertoryType === 2) {
...@@ -280,6 +281,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -280,6 +281,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
list, list,
description, description,
detailImageList, detailImageList,
repertoryType,
singleDelivery, singleDelivery,
specList: +repertoryType === 1 ? singularSpecList : multiSpecList, // 单库存和多库存specList specList: +repertoryType === 1 ? singularSpecList : multiSpecList, // 单库存和多库存specList
items: +repertoryType === 1 ? singularSpu : JSON.parse(JSON.stringify(multiSpu)), items: +repertoryType === 1 ? singularSpu : JSON.parse(JSON.stringify(multiSpu)),
...@@ -311,7 +313,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -311,7 +313,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
props.onValuesChange({ takeawayItem: JSON.parse(JSON.stringify(values)) }); props.onValuesChange({ takeawayItem: JSON.parse(JSON.stringify(values)) });
const takeawayData = customer.isEdit const takeawayData = customer.isEdit
? { takeawayItem: Object.assign({}, editData, values) } ? { takeawayItem: Object.assign({}, editData, values) }
: localStorage.get(localAutoSaveKey) || {}; : { takeawayItem: values };
// : localStorage.get(localAutoSaveKey) || {};
setTakeawayData(takeawayData); setTakeawayData(takeawayData);
takeawayCalc(takeawayData); takeawayCalc(takeawayData);
}, 400); }, 400);
...@@ -492,7 +495,15 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -492,7 +495,15 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
useEffect(() => { useEffect(() => {
if (customer.isEdit || customer.isUseCache) { if (customer.isEdit || customer.isUseCache) {
if (!editData) return; if (!editData) return;
let { label, firstCategoryId, secondCategoryId, thirdCategoryId, id ,saleTimes} = editData; let {
label,
firstCategoryId,
secondCategoryId,
thirdCategoryId,
id,
saleTimes,
saleTimeType,
} = editData;
editData.label = label && label.split(',')?.map(item => +item); editData.label = label && label.split(',')?.map(item => +item);
let specList = editData?.specList; let specList = editData?.specList;
let weight = specList?.filter(item => item.specGroupName === '份量'); let weight = specList?.filter(item => item.specGroupName === '份量');
...@@ -508,7 +519,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -508,7 +519,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}); });
} }
}); });
editData.saleTimes = saleTimes.length editData.saleTimes = saleTimes?.length
? saleTimes.map(item => { ? saleTimes.map(item => {
return [moment(item?.startTime, format), moment(item?.endTime, format)]; return [moment(item?.startTime, format), moment(item?.endTime, format)];
}) })
...@@ -516,12 +527,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -516,12 +527,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if (editData?.skuList?.length) { if (editData?.skuList?.length) {
// editData.minPurchaseNum = editData?.skuList[0]?.serviceItem.minPurchaseNum; // editData.minPurchaseNum = editData?.skuList[0]?.serviceItem.minPurchaseNum;
// 单规格 // 单规格
if (specs.length === 0 && !editData?.specList[0]?.specs[0]?.activityPrice) { if (editData?.skuList?.length === 1) {
let { let {
productStock, productStock,
shopId, shopId,
specs, specs,
serviceItem: { maxStock, saleTimeType, saleDates, saleTimes, id, autoStock }, serviceItem: { maxStock, id, autoStock },
} = editData?.skuList[0]; } = editData?.skuList[0];
let { quantity, unit, salePrice } = specs[0]; let { quantity, unit, salePrice } = specs[0];
editData.productStock = productStock; editData.productStock = productStock;
...@@ -530,15 +541,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -530,15 +541,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
editData.salePrice = salePrice; editData.salePrice = salePrice;
editData.maxStock = maxStock; editData.maxStock = maxStock;
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId]; editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
// editData.saleTimeType = saleTimeType;
// editData.saleDates = saleDates;
editData.autoStock = +autoStock === 1 ? true : false; editData.autoStock = +autoStock === 1 ? true : false;
editData.productRefShopId = editData.shopId; editData.productRefShopId = editData.shopId;
editData.skuId = id; editData.skuId = id;
// setSingularSpu(JSON.parse(JSON.stringify(tempMultiSpu)) || []);
form.setFieldsValue(editData); form.setFieldsValue(editData);
setTimeType(saleTimeType);
} else { } else {
// 多规格 // 多规格
setRepertoryType(`2`); setRepertoryType(`2`);
...@@ -560,20 +567,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -560,20 +567,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}); });
} }
}); });
console.log(specs, 'specs');
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId]; editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
// editData.saleTimeType = saleTimeType;
// editData.saleDates = saleDates;
// editData.saleTimes = saleTimes.length
// ? saleTimes.map(item => {
// return [moment(item?.startTime, format), moment(item?.endTime, format)];
// })
// : [];
editData.productRefShopId = editData.shopId; editData.productRefShopId = editData.shopId;
// setTempWeight(weight) // setTempWeight(weight)
// setTempSpecs(specs) // setTempSpecs(specs)
setTimeType(saleTimeType);
form.setFieldsValue({ weight: weight[0].specs }); form.setFieldsValue({ weight: weight[0].specs });
form.setFieldsValue(editData); form.setFieldsValue(editData);
form.setFieldsValue({ specs }); form.setFieldsValue({ specs });
...@@ -590,12 +588,13 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -590,12 +588,13 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
} }
return item; return item;
}); });
setTempMultiSpu(tempMultiSpu || []); setTempMultiSpu(tempMultiSpu || []);
setMultiSpu(JSON.parse(JSON.stringify(tempMultiSpu)) || []); setMultiSpu(JSON.parse(JSON.stringify(tempMultiSpu)) || []);
} }
setTimeType(saleTimeType);
form.setFieldsValue({ productRefShopId: editData.shopId }); form.setFieldsValue({ productRefShopId: editData.shopId });
onCardSuccessImageList(editData?.detailImageList); onCardSuccessImageList(editData?.detailImageList);
getFormValues();
} }
} }
}, [customer.isEdit, editData]); }, [customer.isEdit, editData]);
...@@ -659,7 +658,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -659,7 +658,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<Radio value={1}>自定义售卖时间</Radio> <Radio value={1}>自定义售卖时间</Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
{timeType === 1 && ( {+timeType === 1 && (
<> <>
<Form.Item name="saleDates" label="售卖时期(可多选)"> <Form.Item name="saleDates" label="售卖时期(可多选)">
<Checkbox.Group> <Checkbox.Group>
...@@ -793,7 +792,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -793,7 +792,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
style={{ style={{
display: 'inline-block', display: 'inline-block',
}} }}
rules={[{ required: true, message: '请输入分量' }]} rules={[
{ required: true, message: '请输入分量!' },
{
validator: isCheckPriceTwoDecimal,
type: 'number',
message: '保留两位小数',
},
]}
> >
<InputNumber <InputNumber
min={1} min={1}
...@@ -852,7 +858,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -852,7 +858,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
display: 'flex', display: 'flex',
marginRight: '8px', marginRight: '8px',
}} }}
rules={[{ required: true, message: '请填写剩余库存' }]} rules={[
{ required: true, message: '请填写剩余库存' },
{
validator: isIntegerNotZero,
type: 'number',
message: '请输入大于0的整数',
},
]}
> >
<InputNumber <InputNumber
min={0} min={0}
...@@ -871,7 +884,13 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -871,7 +884,13 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<Form.Item <Form.Item
name="maxStock" name="maxStock"
label="最大库存" label="最大库存"
rules={[{ required: isRequired, message: '请填写最大库存' }]} rules={[{ required: isRequired, message: '请填写最大库存' },
{
validator: isIntegerNotZero,
type: 'number',
message: '请输入大于0的整数',
},
]}
> >
<InputNumber <InputNumber
max={999999999} max={999999999}
...@@ -946,7 +965,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -946,7 +965,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
{form => { {form => {
let unit = form.getFieldValue(['weight'])?.[index]?.unit || ''; let unit = form.getFieldValue(['weight'])?.[index]?.unit || '';
unit = unit =
(unit && (Array.isArray(unit) && unit?.length && unit?.slice(1).toString())) || (unit &&
(Array.isArray(unit) &&
unit?.length &&
unit?.slice(1).toString())) ||
unit; unit;
if (!peopleUnits.includes(unit)) { if (!peopleUnits.includes(unit)) {
return ( return (
...@@ -968,6 +990,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => { ...@@ -968,6 +990,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
: true, : true,
message: '份量', message: '份量',
}, },
{
validator: isIntegerNotZero,
type: 'number',
message: '请输入大于0的整数',
},
]} ]}
> >
<InputNumber <InputNumber
......
...@@ -87,7 +87,7 @@ const ServiceGoods = options => { ...@@ -87,7 +87,7 @@ 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 => {
if (!isEdit) { if (!isEdit && productType !== 5) {
if (visibleCacheEdit) { if (visibleCacheEdit) {
setVisibleCacheEdit(false); setVisibleCacheEdit(false);
localStorage.remove(localAutoSaveKey); localStorage.remove(localAutoSaveKey);
...@@ -102,7 +102,6 @@ const ServiceGoods = options => { ...@@ -102,7 +102,6 @@ const ServiceGoods = options => {
} }
if (productType === 5) { if (productType === 5) {
setTakeawayInfoMation(e); setTakeawayInfoMation(e);
// console.log('takeawayInfoMation', takeawayInfoMation);
} }
}; };
...@@ -253,8 +252,12 @@ const ServiceGoods = options => { ...@@ -253,8 +252,12 @@ const ServiceGoods = options => {
const sendData = filterSendData(productType, params); const sendData = filterSendData(productType, params);
if (productType === 5) { if (productType === 5) {
console.log(sendData, 'sendData'); console.log(sendData, 'sendData');
if (+sendData?.repertoryType === 2 && sendData?.items?.length < 2) {
message.error('最少生成2个sku')
return
}
sendMerchantProductHttpRequest(sendData); sendMerchantProductHttpRequest(sendData);
return false; return;
} }
if (isEdit) { if (isEdit) {
sendData.id = pageId; sendData.id = pageId;
...@@ -374,9 +377,8 @@ const ServiceGoods = options => { ...@@ -374,9 +377,8 @@ const ServiceGoods = options => {
[specKeyList], [specKeyList],
); );
useEffect(() => { useEffect(() => {
console.log('takeAway', takeAway);
// 外卖类型 // 外卖类型
if (Object.keys(takeAway).length) { if (Object.keys(takeAway)?.length) {
const { spuId = '', groupId = '' } = takeAway; const { spuId = '', groupId = '' } = takeAway;
if (spuId) { if (spuId) {
querGetShopDetail(takeAway); querGetShopDetail(takeAway);
...@@ -510,7 +512,7 @@ const ServiceGoods = options => { ...@@ -510,7 +512,7 @@ const ServiceGoods = options => {
> >
<Spin tip="正在加载..." spinning={pageLoading} delay={100}> <Spin tip="正在加载..." spinning={pageLoading} delay={100}>
<WrapperContainer> <WrapperContainer>
{visibleCacheEdit && productType !== 5 && ( {visibleCacheEdit && (
<div className={styles.draftBox}> <div className={styles.draftBox}>
有未保存内容。是否 有未保存内容。是否
<span className={styles.conEdit} onClick={onContinueEdit}> <span className={styles.conEdit} onClick={onContinueEdit}>
......
...@@ -300,6 +300,11 @@ export const createProductData = (props, isEdit, skuList) => { ...@@ -300,6 +300,11 @@ export const createProductData = (props, isEdit, skuList) => {
export const localAutoSaveKey = 'good-info-auto-save'; export const localAutoSaveKey = 'good-info-auto-save';
export const onAutoSaveValue = (e, isClear) => { export const onAutoSaveValue = (e, isClear) => {
// 暂时去掉外卖类型
if (e && e.type === 5) {
localStorage.remove(localAutoSaveKey);
return;
}
const keys = Object.keys(e); const keys = Object.keys(e);
if ( if (
e && e &&
...@@ -314,7 +319,7 @@ export const onAutoSaveValue = (e, isClear) => { ...@@ -314,7 +319,7 @@ export const onAutoSaveValue = (e, isClear) => {
localStorage.set(localAutoSaveKey, Object.assign({}, e)); localStorage.set(localAutoSaveKey, Object.assign({}, e));
} else { } else {
const info = localStorage.get(localAutoSaveKey) || {}; const info = localStorage.get(localAutoSaveKey) || {};
localStorage.set(localAutoSaveKey, Object.assign({ type: 1 }, info, e)); localStorage.set(localAutoSaveKey, Object.assign({ type:e.type }, info, e));
} }
}; };
......
...@@ -419,3 +419,19 @@ export function isCheckPriceOneDecimal(rule, value, callback) { ...@@ -419,3 +419,19 @@ export function isCheckPriceOneDecimal(rule, value, callback) {
callback(); callback();
} }
} }
// 验证价格保留小数点2位
export function isCheckPriceTwoDecimal(rule, value, callback) {
const num = +value;
const arr = `${value}`.split('.');
if (!value) {
callback();
} else if (Number.isNaN(num)) {
callback(new Error('请输入数字'));
} else if (num < 0) {
callback(new Error('请输入大于0的数字'));
} else if (arr.length === 2 && arr[1].length > 2) {
callback(new Error('小数点保留2位'));
} else {
callback();
}
}
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