@@ -14,6 +14,8 @@ const fieldLabels = { | |||
status: '物料状态', | |||
price: '成本价', | |||
netrecovery: '净料率(%)', | |||
OutstockUint: '出库单位', | |||
proportion: '换算比例(%)', | |||
}; | |||
const defaultData = []; | |||
@@ -206,6 +208,7 @@ const CreateForm = (props) => { | |||
label={fieldLabels.netrecovery} | |||
name="netrecovery" | |||
min={1} | |||
max={100} | |||
placeholder="请输入净料率" | |||
/> | |||
</Col> | |||
@@ -239,6 +242,33 @@ const CreateForm = (props) => { | |||
placeholder="请选择单位" | |||
/> | |||
</Col> | |||
<Col lg={8} md={12} sm={24}> | |||
<ProFormSelect | |||
label={fieldLabels.OutstockUint} | |||
name="OutstockUint" | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请选择出库单位', | |||
}, | |||
]} | |||
request={async () => props.uintListData} | |||
placeholder="请选择出库单位" | |||
/> | |||
</Col> | |||
<Col lg={8} md={12} sm={24}> | |||
<ProFormDigit | |||
label={fieldLabels.proportion} | |||
name="proportion" | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请输入出入库换算比例', | |||
}, | |||
]} | |||
placeholder="请输入换算比例" | |||
/> | |||
</Col> | |||
<Col lg={8} md={12} sm={24}> | |||
<ProFormSelect | |||
label={fieldLabels.status} | |||
@@ -5,7 +5,7 @@ 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 { addGoods, goodsType, goodsbigType, getgoodsTaste } from '../newgoods/service'; | |||
import { GetGoodsBom, AddBomApi, DelGoodsBom, GetCosRequestURL } from './service' | |||
import axios from 'axios'; | |||
const { Step } = Steps; | |||
@@ -18,7 +18,9 @@ const Advanced = (props) => { | |||
const [setGoodsBomModalVisible, handleGoodsBomModalVisible] = useState(); | |||
const [selectedRowsState, setSelectedRows] = useState([]); | |||
const actionRef = useRef(); | |||
const [url, setUrl] = useState(props.location.query.values?props.location.query.values.imgUrl:null); | |||
const [currTabKey, SetCurrTabKey] = useState("basis") | |||
const [url, setUrl] = useState(props.location.query.values ? props.location.query.values.imgUrl : null); | |||
const [currentGoodsProp, setCurrentGoodsProp] = useState(0); | |||
//事件 | |||
const onFinish = async (values) => { | |||
const hide = message.loading('正在添加'); | |||
@@ -101,12 +103,18 @@ const Advanced = (props) => { | |||
}; | |||
//设置 | |||
const [tabStatus, seTabStatus] = useState({ | |||
operationKey: 'basis', | |||
tabActiveKey: 'basis', | |||
operationKey: props.location.query.tabStatus ? props.location.query.tabStatus : 'basis', | |||
tabActiveKey: props.location.query.tabStatus ? props.location.query.tabStatus : 'basis', | |||
}); | |||
useEffect(() => { | |||
SetCurrTabKey(tabStatus.tabActiveKey); | |||
}, [tabStatus]) | |||
const onTabChange = (key) => { | |||
seTabStatus({ ...tabStatus, operationKey: key }); | |||
if (currentGoodsProp === 1) { | |||
message.info('套餐不能设置配方'); | |||
return; | |||
} | |||
seTabStatus({ operationKey: key, tabActiveKey: key }); | |||
}; | |||
const operationTabList = [ | |||
@@ -211,22 +219,9 @@ const Advanced = (props) => { | |||
<Form.Item name="price" label="商品价格" rules={[{ required: true }]}> | |||
<InputNumber placeholder="价格" min={0} /> | |||
</Form.Item> | |||
<Form.Item name="vipprice" label="会员价格"> | |||
<Form.Item name="vipPrice" label="会员价格"> | |||
<InputNumber placeholder="会员价" min={0} /> | |||
</Form.Item> | |||
<Form.Item name="imgUrl" hidden={true} > | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="imgUrl1" label="商品图片地址" | |||
> | |||
<Upload | |||
{...uploadProp} | |||
> | |||
{url ? <img src={url} alt="avatar" style={{ width: '100%' }} /> : <Button icon={<UploadOutlined />}>上传</Button>} | |||
</Upload> | |||
</Form.Item> | |||
<Form.Item name="parentTypeID" label="商品大类" rules={[{ required: true }]}> | |||
<Select> | |||
{ | |||
@@ -257,6 +252,21 @@ const Advanced = (props) => { | |||
} | |||
</Select> | |||
</Form.Item> | |||
<Form.Item | |||
name="goodsAttribute" | |||
label="商品属性" | |||
defaultValue={0} | |||
rules={[{ required: true, message: '请选择商品属性' }]} | |||
> | |||
<Select placeholder="请选择商品属性" onChange={(e) => { | |||
setCurrentGoodsProp(e); | |||
}}> | |||
<OptGroup> | |||
<Select.Option value={0}>单品</Select.Option> | |||
<Select.Option value={1}>套餐</Select.Option> | |||
</OptGroup> | |||
</Select> | |||
</Form.Item> | |||
<Form.Item | |||
name="status" | |||
label="状态" | |||
@@ -273,6 +283,19 @@ const Advanced = (props) => { | |||
<Form.Item name="remark" label="备注"> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="imgUrl" hidden={true} > | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="imgUrl1" label="商品图片地址" | |||
> | |||
<Upload | |||
{...uploadProp} | |||
> | |||
{url ? <img src={url} alt="avatar" style={{ width: '100%' }} /> : <Button icon={<UploadOutlined />}>上传</Button>} | |||
</Upload> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
@@ -353,7 +376,7 @@ const Advanced = (props) => { | |||
//初始化 | |||
useEffect(() => { | |||
function initGoodsType() { | |||
goodsType({ current: 1, status:0,pageSize: 1000 }).then((r) => { | |||
goodsType({ current: 1, status: 0, pageSize: 1000 }).then((r) => { | |||
var arr = r.data.data; | |||
arr.forEach((element) => { | |||
element.text = element.goodsType_Name; | |||
@@ -363,7 +386,7 @@ const Advanced = (props) => { | |||
}); | |||
} | |||
function initGoodsBigType() { | |||
goodsbigType({ current: 1,status:0, pageSize: 1000 }).then((r) => { | |||
goodsbigType({ current: 1, status: 0, pageSize: 1000 }).then((r) => { | |||
var arr = r.data.data; | |||
arr.forEach((element) => { | |||
element.text = element.name; | |||
@@ -379,6 +402,7 @@ const Advanced = (props) => { | |||
return ( | |||
<PageContainer | |||
title={props.location.query.isAdd ? '商品新增' : '详情'} | |||
tabActiveKey={currTabKey} | |||
onTabChange={onTabChange} | |||
tabList={operationTabList} | |||
> | |||
@@ -179,7 +179,7 @@ const GoodsManage = () => { | |||
}, | |||
{ | |||
title: '会员价', | |||
dataIndex: 'price', | |||
dataIndex: 'vipPrice', | |||
hideInForm: true, | |||
renderText: (val) => `${val}¥`, | |||
hideInSearch: true, | |||
@@ -199,6 +199,21 @@ const GoodsManage = () => { | |||
// hideInSearch: true, | |||
valueEnum: goodsTypes, | |||
}, | |||
{ | |||
title: '商品属性', | |||
dataIndex: 'goodsAttribute', | |||
hideInForm: true, | |||
valueEnum: { | |||
0: { | |||
text: '单品', | |||
}, | |||
1: { | |||
text: '套餐', | |||
} | |||
}, | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'status', | |||
@@ -237,7 +252,8 @@ const GoodsManage = () => { | |||
pathname: '/goods/goodsInfo', | |||
query: { | |||
isAdd: false, | |||
values:record | |||
values: record, | |||
tabStatus: 'basis' | |||
}, | |||
}); | |||
// handleModalVisible(true); | |||
@@ -246,6 +262,24 @@ const GoodsManage = () => { | |||
> | |||
更新 | |||
</a>, | |||
<a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/goods/goodsInfo', | |||
query: { | |||
isAdd: false, | |||
values: record, | |||
tabStatus: 'goodsbom' | |||
}, | |||
}); | |||
// handleModalVisible(true); | |||
// setCurrentRow(record); | |||
}} | |||
> | |||
商品配方设置 | |||
</a>, | |||
record.status === 0 && | |||
(( | |||
<a | |||
@@ -271,6 +305,22 @@ const GoodsManage = () => { | |||
启用 | |||
</a> | |||
), | |||
<a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/goods/goodsInfo', | |||
query: { | |||
isAdd: false, | |||
values: record, | |||
tabStatus: 'basis' | |||
}, | |||
}); | |||
}} | |||
> | |||
套餐配置 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
@@ -292,7 +342,8 @@ const GoodsManage = () => { | |||
pathname: '/goods/goodsInfo', | |||
query: { | |||
isAdd: true, | |||
values:null | |||
values: null, | |||
tabStatus: 'basis' | |||
}, | |||
}); | |||
}} | |||
@@ -3,7 +3,7 @@ import { Tabs, Card, Pagination, Table, message, Button, Modal } from 'antd'; | |||
const { TabPane } = Tabs; | |||
import React, { useState, useRef, useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import { GetStoreInfoPage, GetStoreGoods, AddStoreGood, UpdateStoreGoods, DelStoreGoods, UpdateStoreGoodsStatusAsync } from "./services" | |||
import { GetStoreInfoPage, GetStoreGoods, AddStoreGood, UpdateStoreGoods, DelStoreGoods, UpdateStoreGoodsStatusAsync,stopgoods } from "./services" | |||
import ProTable from '@ant-design/pro-table'; | |||
import CreateForm from './components/CreateForm'; | |||
import LogForm from './components/Logs'; | |||
@@ -151,6 +151,22 @@ const storeGoodsInfo = (props) => { | |||
1: { text: '下架', status: 'Success' }, | |||
}, | |||
}, | |||
{ | |||
title: '估清', | |||
dataIndex: 'stopSales', | |||
valueEnum: { | |||
0: { text: '销售', status: 'Processing' }, | |||
1: { text: '估清', status: 'Success' }, | |||
}, | |||
// render: (record) => { | |||
// const showText = record.stopSalesTime === null ? '估清' : '销售'; | |||
// return ( | |||
// <span> | |||
// {showText} | |||
// </span> | |||
// ) | |||
// } | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
@@ -169,8 +185,13 @@ const storeGoodsInfo = (props) => { | |||
<a | |||
key="primary" | |||
onClick={() => { | |||
record.status = record.status == 0 ? 1 : 0; | |||
UpdateStoreGoodsStatusAsync(record).then((r) => { | |||
var stopSales =0; | |||
if(record.stopSales == 0) | |||
stopSales =1; | |||
else | |||
stopSales =0; | |||
var goodss =[{goodsId:record.foodId,storeId:storeId,StopSales:stopSales}]; | |||
stopgoods(goodss).then((r) => { | |||
if (r.data) { | |||
actionRef.current.reload(); | |||
} | |||
@@ -178,9 +199,22 @@ const storeGoodsInfo = (props) => { | |||
}} | |||
> | |||
{' '} | |||
{record.status == 0 ? '停用' : '正常'} | |||
{record.stopSales == 0 ? '估清' : '销售'} | |||
</a>, | |||
, | |||
<a | |||
key="primary" | |||
onClick={() => { | |||
record.status = record.status == 0 ? 1 : 0; | |||
stopgoods(record).then((r) => { | |||
if (r.data) { | |||
actionRef.current.reload(); | |||
} | |||
}); | |||
}} | |||
> | |||
{' '} | |||
{record.status == 0 ? '停用' : '正常'} | |||
</a>, | |||
<a | |||
key="config" | |||
onClick={() => { | |||
@@ -28,7 +28,13 @@ export async function UpdateStoreGoodsStatusAsync(data) { | |||
data: data, | |||
}); | |||
} | |||
/**商品估清 */ | |||
export async function stopgoods(data) { | |||
return request(`/kitchen/api/goods/stopgoods`, { | |||
method: 'POST', | |||
data: data, | |||
}); | |||
} | |||
/** 修改 */ | |||
export async function UpdateStoreGoods(data) { | |||
return request(`/kitchen/api/Store/UpdateStoreGood`, { | |||