@@ -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(); | |||
}, []); | |||
@@ -38,3 +38,9 @@ export async function DelGoodsBom (data) { | |||
} | |||
export async function unitList(data) { | |||
return request(`/kitchen/api/goods-unit/type`, { | |||
method: 'Post', | |||
data: data, | |||
}); | |||
} |
@@ -21,9 +21,7 @@ export default function Index() { | |||
discountInfo: [] //优惠信息 | |||
}); | |||
const [orderStatus, setOrderStatus] = useState({ | |||
isTrue: true | |||
}); | |||
const [orderStatus, setOrderStatus] = useState(''); | |||
const onQueryOrderDetail = async () => { | |||
if (orderNumber) { | |||
@@ -38,36 +36,31 @@ export default function Index() { | |||
} | |||
const orderIsNormal = (order) => { | |||
let isNormal = { | |||
isTrue: true, | |||
msg: '正常订单' | |||
}; | |||
if (!(order.payMoneyEx === '正常')) { | |||
isNormal.isTrue = false; | |||
isNormal.msg = '订单支付金额异常'; | |||
} | |||
else if (!(order.payOrderTimeEx === '正常')) { | |||
isNormal.isTrue = false; | |||
isNormal.msg = '订单支付时间异常'; | |||
} | |||
else if (!(order.payOrderEx === '正常')) { | |||
isNormal.isTrue = false; | |||
isNormal.msg = '订单支付异常'; | |||
} | |||
else if (!(order.refundMoneyEx === '正常' || order.refundMoneyEx === '' || order.refundMoneyEx === null)) { | |||
isNormal.isTrue = false; | |||
isNormal.msg = '订单退款金额异常'; | |||
let orderStatus = ''; | |||
switch (order.orderStatus) { | |||
case 0: | |||
orderStatus = '未付款'; | |||
break; | |||
case 1: | |||
orderStatus = '已付款'; | |||
break; | |||
case -1: | |||
orderStatus = '退单申请'; | |||
break; | |||
case -2: | |||
orderStatus = '退单中'; | |||
break; | |||
case -3: | |||
orderStatus = '已退单'; | |||
break; | |||
case -4: | |||
orderStatus = '取消交易'; | |||
break; | |||
case -5: | |||
orderStatus = '撤销申请'; | |||
break; | |||
} | |||
else if (!(order.refundOrderTimeEx === '正常' || order.refundOrderTimeEx === '' || order.refundOrderTimeEx === null)) { | |||
isNormal.isTrue = false; | |||
isNormal.msg = '订单退款时间异常'; | |||
} | |||
else if (!(order.refundOrderEx === '正常' || order.refundOrderEx === '' || order.refundOrderEx === null)) { | |||
isNormal.isTrue = false; | |||
isNormal.msg = '订单退款异常'; | |||
} | |||
console.log('isNormal', isNormal); | |||
setOrderStatus(isNormal); | |||
setOrderStatus(orderStatus); | |||
} | |||
useEffect(() => { | |||
@@ -84,9 +77,7 @@ export default function Index() { | |||
#{orderInfo.sortId} | |||
</div> | |||
<div className={styles['order-cook-state']}> | |||
{ | |||
orderStatus.isTrue ? <div className={styles['order-status-true']}>正常订单</div> : <div className={styles['order-status-false']}>{orderStatus.msg}</div> | |||
} | |||
<div className={styles['order-status-true']}>{orderStatus}</div> | |||
</div> | |||
<div className={styles['order-cook-date']}> | |||
{orderInfo.createdAt} | |||
@@ -44,32 +44,36 @@ const columns = [ | |||
title: '订单状态', | |||
key: 'orderStatus', | |||
render: (record) => { | |||
let isNormal = true; | |||
if (!(record.payMoneyEx === '正常' && | |||
record.payOrderTimeEx === '正常' && | |||
record.payOrderEx === '正常') | |||
) { | |||
isNormal = false; | |||
} | |||
if (!(record.refundMoneyEx === '正常' || record.refundMoneyEx === '' || record.refundMoneyEx === null)) { | |||
isNormal = false; | |||
} | |||
if (!(record.refundOrderTimeEx === '正常' || record.refundOrderTimeEx === '' || record.refundOrderTimeEx === null)) { | |||
isNormal = false; | |||
} | |||
if (!(record.refundOrderEx === '正常' || record.refundOrderEx === '' || record.refundOrderEx === null)) { | |||
isNormal = false; | |||
let orderStatus = ''; | |||
switch (record.orderStatus) { | |||
case 0: | |||
orderStatus = '未付款'; | |||
break; | |||
case 1: | |||
orderStatus = '已付款'; | |||
break; | |||
case -1: | |||
orderStatus = '退单申请'; | |||
break; | |||
case -2: | |||
orderStatus = '退单中'; | |||
break; | |||
case -3: | |||
orderStatus = '已退单'; | |||
break; | |||
case -4: | |||
orderStatus = '取消交易'; | |||
break; | |||
case -5: | |||
orderStatus = '撤销申请'; | |||
break; | |||
} | |||
return ( | |||
<> | |||
{ | |||
isNormal ? <Tag icon={<CheckCircleOutlined />} color="success"> | |||
正常 | |||
<Tag icon={<CheckCircleOutlined />} color="success"> | |||
{orderStatus} | |||
</Tag> | |||
: | |||
<Tag icon={<CloseCircleOutlined />} color="error"> | |||
异常 | |||
</Tag> | |||
} | |||
</> | |||
) | |||
@@ -1,9 +1,9 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Tabs, Card, Pagination, Table, message, Button, Modal } from 'antd'; | |||
import { Tabs, Card, Pagination, Table, message, Button, Popconfirm, 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,stopgoods } from "./services" | |||
import { GetStoreInfoPage, GetStoreGoods, AddStoreGood, UpdateStoreGoods, DelStoreGoods, UpdateStoreGoodsStatusAsync, stopgoods,StoreGoodsAllUpdate } from "./services" | |||
import ProTable from '@ant-design/pro-table'; | |||
import CreateForm from './components/CreateForm'; | |||
import LogForm from './components/Logs'; | |||
@@ -185,12 +185,12 @@ const storeGoodsInfo = (props) => { | |||
<a | |||
key="primary" | |||
onClick={() => { | |||
var stopSales =0; | |||
if(record.stopSales == 0) | |||
stopSales =1; | |||
var stopSales = 0; | |||
if (record.stopSales == 0) | |||
stopSales = 1; | |||
else | |||
stopSales =0; | |||
var goodss =[{goodsId:record.foodId,storeId:storeId,StopSales:stopSales}]; | |||
stopSales = 0; | |||
var goodss = [{ goodsId: record.foodId, storeId: storeId, StopSales: stopSales }]; | |||
stopgoods(goodss).then((r) => { | |||
if (r.data) { | |||
actionRef.current.reload(); | |||
@@ -201,20 +201,34 @@ const storeGoodsInfo = (props) => { | |||
{' '} | |||
{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="primary" | |||
onClick={() => { | |||
record.status = record.status == 0 ? 1 : 0; | |||
UpdateStoreGoodsStatusAsync(record).then((r) => { | |||
if (r.data) { | |||
actionRef.current.reload(); | |||
} | |||
}); | |||
}} | |||
> | |||
{' '} | |||
{record.status == 0 ? '停用' : '正常'} | |||
</a>, | |||
<a | |||
key="primary" | |||
onClick={() => { | |||
record.isDevice = record.isDevice == 0 ? 1 : 0; | |||
UpdateStoreGoodsStatusAsync(record).then((r) => { | |||
if (r.data) { | |||
actionRef.current.reload(); | |||
} | |||
}); | |||
}} | |||
> | |||
{' '} | |||
{record.isDevice == 0 ? '设备制作' : '门店制作'} | |||
</a>, | |||
<a | |||
key="config" | |||
onClick={() => { | |||
@@ -222,8 +236,8 @@ const storeGoodsInfo = (props) => { | |||
pathname: '/store/storeAddGoodsInfo', | |||
query: { | |||
isAdd: false, | |||
values:record, | |||
storeId:storeId | |||
values: record, | |||
storeId: storeId | |||
}, | |||
}); | |||
}} | |||
@@ -252,28 +266,48 @@ const storeGoodsInfo = (props) => { | |||
rowKey="id" | |||
search={false} | |||
toolBarRender={() => [ | |||
// <Button | |||
// type="primary" | |||
// key="primary" | |||
// onClick={() => { | |||
// setCurrentTabRow(item.id); | |||
// handleModalVisible(true); | |||
// }} | |||
// > | |||
// <PlusOutlined /> 新增上架商品 | |||
// </Button>, | |||
<Button | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
setCurrentTabRow(item.id); | |||
title="确认估清门店所有商品" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
StoreGoodsAllUpdate({ StoreId: item.id, UpdateType: 0 }) | |||
actionRef.current.reload(); | |||
SetLogVisible(true); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<UnorderedListOutlined /> 操作记录 | |||
</Button> | |||
<Button type="primary" key="primary"> 估清</Button> | |||
</Popconfirm>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认停用门店所有商品" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
StoreGoodsAllUpdate({ StoreId: item.id, UpdateType: 1 }) | |||
actionRef.current.reload(); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<Button type="primary" key="primary"> 停用</Button> | |||
</Popconfirm>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认修改门店所有商品制作状态" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
StoreGoodsAllUpdate({ StoreId: item.id, UpdateType: 2 }) | |||
actionRef.current.reload(); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<Button type="primary" key="primary"> 门店制作</Button> | |||
</Popconfirm>, | |||
]} | |||
loading={loading} | |||
bordered | |||
@@ -335,17 +369,17 @@ const storeGoodsInfo = (props) => { | |||
/> | |||
<Modal | |||
destroyOnClose={true} | |||
width={800} | |||
destroyOnClose={true} | |||
width={800} | |||
visible={logVisible} | |||
footer={null} | |||
onCancel={() => { | |||
SetLogVisible(false); | |||
}}> | |||
<LogForm | |||
storeId={currentTabRow} | |||
actionLogRef={actionLogRef} | |||
/> | |||
storeId={currentTabRow} | |||
actionLogRef={actionLogRef} | |||
/> | |||
</Modal> | |||
@@ -77,6 +77,12 @@ export async function getGoods() { | |||
}); | |||
} | |||
export function StoreGoodsAllUpdate(data) { | |||
return request(`/kitchen//api/Store/StoreGoodsAllUpdate`, { | |||
method: 'post', | |||
data: data, | |||
}); | |||
} | |||
export function GetRequestLogPageAsync(data) { | |||