Browse Source

🐞 fix(提交代码): 提交代码

提交代码
tags/小炒逻辑变更前
txb 2 years ago
parent
commit
c1ea419547
5 changed files with 176 additions and 31 deletions
  1. +30
    -0
      src/pages/erp/basic/product/components/CreateForm.jsx
  2. +46
    -22
      src/pages/goods/goodsInfo/index.jsx
  3. +54
    -3
      src/pages/goods/newgoods/index.jsx
  4. +39
    -5
      src/pages/store/storeGoodsInfo/index.jsx
  5. +7
    -1
      src/pages/store/storeGoodsInfo/services.js

+ 30
- 0
src/pages/erp/basic/product/components/CreateForm.jsx View File

@@ -14,6 +14,8 @@ const fieldLabels = {
status: '物料状态', status: '物料状态',
price: '成本价', price: '成本价',
netrecovery: '净料率(%)', netrecovery: '净料率(%)',
OutstockUint: '出库单位',
proportion: '换算比例(%)',
}; };


const defaultData = []; const defaultData = [];
@@ -206,6 +208,7 @@ const CreateForm = (props) => {
label={fieldLabels.netrecovery} label={fieldLabels.netrecovery}
name="netrecovery" name="netrecovery"
min={1} min={1}
max={100}
placeholder="请输入净料率" placeholder="请输入净料率"
/> />
</Col> </Col>
@@ -239,6 +242,33 @@ const CreateForm = (props) => {
placeholder="请选择单位" placeholder="请选择单位"
/> />
</Col> </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}> <Col lg={8} md={12} sm={24}>
<ProFormSelect <ProFormSelect
label={fieldLabels.status} label={fieldLabels.status}


+ 46
- 22
src/pages/goods/goodsInfo/index.jsx View File

@@ -5,7 +5,7 @@ import React, { Fragment, useRef, useState, useEffect } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import GoodsbomFrom from './components/GoodsbomFrom'; 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 { GetGoodsBom, AddBomApi, DelGoodsBom, GetCosRequestURL } from './service'
import axios from 'axios'; import axios from 'axios';
const { Step } = Steps; const { Step } = Steps;
@@ -18,7 +18,9 @@ const Advanced = (props) => {
const [setGoodsBomModalVisible, handleGoodsBomModalVisible] = useState(); const [setGoodsBomModalVisible, handleGoodsBomModalVisible] = useState();
const [selectedRowsState, setSelectedRows] = useState([]); const [selectedRowsState, setSelectedRows] = useState([]);
const actionRef = useRef(); 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 onFinish = async (values) => {
const hide = message.loading('正在添加'); const hide = message.loading('正在添加');
@@ -101,12 +103,18 @@ const Advanced = (props) => {
}; };
//设置 //设置
const [tabStatus, seTabStatus] = useState({ 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) => { const onTabChange = (key) => {
seTabStatus({ ...tabStatus, operationKey: key });
if (currentGoodsProp === 1) {
message.info('套餐不能设置配方');
return;
}
seTabStatus({ operationKey: key, tabActiveKey: key });
}; };


const operationTabList = [ const operationTabList = [
@@ -211,22 +219,9 @@ const Advanced = (props) => {
<Form.Item name="price" label="商品价格" rules={[{ required: true }]}> <Form.Item name="price" label="商品价格" rules={[{ required: true }]}>
<InputNumber placeholder="价格" min={0} /> <InputNumber placeholder="价格" min={0} />
</Form.Item> </Form.Item>
<Form.Item name="vipprice" label="会员价格">
<Form.Item name="vipPrice" label="会员价格">
<InputNumber placeholder="会员价" min={0} /> <InputNumber placeholder="会员价" min={0} />
</Form.Item> </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 }]}> <Form.Item name="parentTypeID" label="商品大类" rules={[{ required: true }]}>
<Select> <Select>
{ {
@@ -257,6 +252,21 @@ const Advanced = (props) => {
} }
</Select> </Select>
</Form.Item> </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 <Form.Item
name="status" name="status"
label="状态" label="状态"
@@ -273,6 +283,19 @@ const Advanced = (props) => {
<Form.Item name="remark" label="备注"> <Form.Item name="remark" label="备注">
<Input /> <Input />
</Form.Item> </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> <Form.Item>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">
保存 保存
@@ -353,7 +376,7 @@ const Advanced = (props) => {
//初始化 //初始化
useEffect(() => { useEffect(() => {
function initGoodsType() { 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; var arr = r.data.data;
arr.forEach((element) => { arr.forEach((element) => {
element.text = element.goodsType_Name; element.text = element.goodsType_Name;
@@ -363,7 +386,7 @@ const Advanced = (props) => {
}); });
} }
function initGoodsBigType() { 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; var arr = r.data.data;
arr.forEach((element) => { arr.forEach((element) => {
element.text = element.name; element.text = element.name;
@@ -379,6 +402,7 @@ const Advanced = (props) => {
return ( return (
<PageContainer <PageContainer
title={props.location.query.isAdd ? '商品新增' : '详情'} title={props.location.query.isAdd ? '商品新增' : '详情'}
tabActiveKey={currTabKey}
onTabChange={onTabChange} onTabChange={onTabChange}
tabList={operationTabList} tabList={operationTabList}
> >


+ 54
- 3
src/pages/goods/newgoods/index.jsx View File

@@ -179,7 +179,7 @@ const GoodsManage = () => {
}, },
{ {
title: '会员价', title: '会员价',
dataIndex: 'price',
dataIndex: 'vipPrice',
hideInForm: true, hideInForm: true,
renderText: (val) => `${val}¥`, renderText: (val) => `${val}¥`,
hideInSearch: true, hideInSearch: true,
@@ -199,6 +199,21 @@ const GoodsManage = () => {
// hideInSearch: true, // hideInSearch: true,
valueEnum: goodsTypes, valueEnum: goodsTypes,
}, },

{
title: '商品属性',
dataIndex: 'goodsAttribute',
hideInForm: true,
valueEnum: {
0: {
text: '单品',
},
1: {
text: '套餐',
}
},

},
{ {
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'status',
@@ -237,7 +252,8 @@ const GoodsManage = () => {
pathname: '/goods/goodsInfo', pathname: '/goods/goodsInfo',
query: { query: {
isAdd: false, isAdd: false,
values:record
values: record,
tabStatus: 'basis'
}, },
}); });
// handleModalVisible(true); // handleModalVisible(true);
@@ -246,6 +262,24 @@ const GoodsManage = () => {
> >
更新 更新
</a>, </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 && record.status === 0 &&
(( ((
<a <a
@@ -271,6 +305,22 @@ const GoodsManage = () => {
启用 启用
</a> </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', pathname: '/goods/goodsInfo',
query: { query: {
isAdd: true, isAdd: true,
values:null
values: null,
tabStatus: 'basis'
}, },
}); });
}} }}


+ 39
- 5
src/pages/store/storeGoodsInfo/index.jsx View File

@@ -3,7 +3,7 @@ import { Tabs, Card, Pagination, Table, message, Button, Modal } from 'antd';
const { TabPane } = Tabs; const { TabPane } = Tabs;
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; 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 ProTable from '@ant-design/pro-table';
import CreateForm from './components/CreateForm'; import CreateForm from './components/CreateForm';
import LogForm from './components/Logs'; import LogForm from './components/Logs';
@@ -151,6 +151,22 @@ const storeGoodsInfo = (props) => {
1: { text: '下架', status: 'Success' }, 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: '操作', title: '操作',
dataIndex: 'option', dataIndex: 'option',
@@ -169,8 +185,13 @@ const storeGoodsInfo = (props) => {
<a <a
key="primary" key="primary"
onClick={() => { 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) { if (r.data) {
actionRef.current.reload(); actionRef.current.reload();
} }
@@ -178,9 +199,22 @@ const storeGoodsInfo = (props) => {
}} }}
> >
{' '} {' '}
{record.status == 0 ? '停用' : '正常'}
{record.stopSales == 0 ? '估清' : '销售'}
</a>, </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 <a
key="config" key="config"
onClick={() => { onClick={() => {


+ 7
- 1
src/pages/store/storeGoodsInfo/services.js View File

@@ -28,7 +28,13 @@ export async function UpdateStoreGoodsStatusAsync(data) {
data: data, data: data,
}); });
} }

/**商品估清 */
export async function stopgoods(data) {
return request(`/kitchen/api/goods/stopgoods`, {
method: 'POST',
data: data,
});
}
/** 修改 */ /** 修改 */
export async function UpdateStoreGoods(data) { export async function UpdateStoreGoods(data) {
return request(`/kitchen/api/Store/UpdateStoreGood`, { return request(`/kitchen/api/Store/UpdateStoreGood`, {


Loading…
Cancel
Save