|
|
@@ -1,18 +1,19 @@ |
|
|
|
import { PlusOutlined, UploadOutlined } from '@ant-design/icons'; |
|
|
|
import { Button, Card, message, Steps, Empty, Form, Input, Upload, Select, InputNumber } from 'antd'; |
|
|
|
import { Button, Card, message, Steps, Empty, Form, Input, Upload, Select, InputNumber, Switch } from 'antd'; |
|
|
|
import { GridContent, PageContainer, RouteContext } from '@ant-design/pro-layout'; |
|
|
|
import React, { Fragment, useRef, useState, useEffect } from 'react'; |
|
|
|
import classNames from 'classnames'; |
|
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
|
import GoodsbomFrom from './components/GoodsbomFrom'; |
|
|
|
import { addGoods, goodsType, goodsbigType, getgoodsTaste } from '../newgoods/service'; |
|
|
|
import { GetGoodsBom, AddBomApi, DelGoodsBom, GetCosRequestURL } from './service' |
|
|
|
import { GetGoodsBom, AddBomApi, DelGoodsBom, GetCosRequestURL, unitList } from './service' |
|
|
|
import axios from 'axios'; |
|
|
|
const { Step } = Steps; |
|
|
|
const { Option, OptGroup } = Select; |
|
|
|
const Advanced = (props) => { |
|
|
|
const [form] = Form.useForm(); |
|
|
|
const [goodsTypes, setGoodsTypes] = useState([]); |
|
|
|
const [goodsUnit, setGoodsUnit] = useState([]); |
|
|
|
const [goodsBigTypes, setGoodsBigTypes] = useState([]); |
|
|
|
const [goodsTaste, setGoodsTaste] = useState([]); |
|
|
|
const [setGoodsBomModalVisible, handleGoodsBomModalVisible] = useState(); |
|
|
@@ -110,10 +111,10 @@ const Advanced = (props) => { |
|
|
|
SetCurrTabKey(tabStatus.tabActiveKey); |
|
|
|
}, [tabStatus]) |
|
|
|
const onTabChange = (key) => { |
|
|
|
if (currentGoodsProp === 1) { |
|
|
|
message.info('套餐不能设置配方'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (currentGoodsProp === 1) { |
|
|
|
message.info('套餐不能设置配方'); |
|
|
|
return; |
|
|
|
} |
|
|
|
seTabStatus({ operationKey: key, tabActiveKey: key }); |
|
|
|
}; |
|
|
|
|
|
|
@@ -216,6 +217,21 @@ const Advanced = (props) => { |
|
|
|
<Form.Item name="name" label="商品名称" rules={[{ required: true }]}> |
|
|
|
<Input /> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item name="goodsUintId" label="商品单位" rules={[{ required: true }]}> |
|
|
|
<Select> |
|
|
|
{ |
|
|
|
goodsUnit == undefined ? '' : ( |
|
|
|
goodsUnit.map((item, index) => { |
|
|
|
return ( |
|
|
|
<Select.Option index={index} value={item.id} key={item.id}> |
|
|
|
{item.name} |
|
|
|
</Select.Option> |
|
|
|
); |
|
|
|
}) |
|
|
|
) |
|
|
|
} |
|
|
|
</Select> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item name="price" label="商品价格" rules={[{ required: true }]}> |
|
|
|
<InputNumber placeholder="价格" min={0} /> |
|
|
|
</Form.Item> |
|
|
@@ -296,6 +312,11 @@ const Advanced = (props) => { |
|
|
|
|
|
|
|
</Upload> |
|
|
|
</Form.Item> |
|
|
|
|
|
|
|
<Form.Item label="是否称重" name="isWeigh" valuePropName="checked" initialValue='false' > |
|
|
|
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked='false' /> |
|
|
|
</Form.Item> |
|
|
|
|
|
|
|
<Form.Item> |
|
|
|
<Button type="primary" htmlType="submit"> |
|
|
|
保存 |
|
|
@@ -395,6 +416,14 @@ const Advanced = (props) => { |
|
|
|
setGoodsBigTypes(arr); |
|
|
|
}); |
|
|
|
} |
|
|
|
function initGoodsUnit() { |
|
|
|
unitList('{"current":1,"pageSize":200}').then((r) => { |
|
|
|
var arr = r.data.data; |
|
|
|
|
|
|
|
setGoodsUnit(arr); |
|
|
|
}); |
|
|
|
} |
|
|
|
initGoodsUnit(); |
|
|
|
initGoodsType(); |
|
|
|
initGoodsBigType(); |
|
|
|
}, []); |
|
|
|