@@ -13,7 +13,8 @@ import { | |||||
CheckStockAdjust, | CheckStockAdjust, | ||||
removeSingleStockAdjust, | removeSingleStockAdjust, | ||||
PushDeviceTMC, | PushDeviceTMC, | ||||
CheckStockTMCAdjust | |||||
CheckStockTMCAdjust, | |||||
PushDeviceTMC_MT | |||||
} from './services'; | } from './services'; | ||||
const key = 'message'; | const key = 'message'; | ||||
@@ -54,7 +55,23 @@ const DeviceStockManager = (props) => { | |||||
const pushStock = async (id) => { | const pushStock = async (id) => { | ||||
try { | try { | ||||
message.loading('正在同步', key); | message.loading('正在同步', key); | ||||
if (props.isbom) { | |||||
if (props.values.deviceTypeKey =="TMC_MT") { | |||||
await PushDeviceTMC_MT(id).then((r) => { | |||||
message.destroy(key); | |||||
if (r.data) { | |||||
setSelectedRows([]); | |||||
message.success('同步成功'); | |||||
actionRef.current.reload(); | |||||
return true; | |||||
} else { | |||||
message.success('同步失败'); | |||||
actionRef.current.reload(); | |||||
return false; | |||||
} | |||||
} | |||||
); | |||||
} | |||||
else if (props.isbom) { | |||||
await PushDeviceTMC(id).then((r) => { | await PushDeviceTMC(id).then((r) => { | ||||
message.destroy(key); | message.destroy(key); | ||||
if (r.data) { | if (r.data) { | ||||
@@ -22,6 +22,14 @@ export async function PushStockAsync(data) { | |||||
}); | }); | ||||
} | } | ||||
/** 同步库存 */ | |||||
export async function PushDeviceTMC_MT(data) { | |||||
return request(`/kitchen/api/Device/PushDeviceTMC_MT?DeviceId=${data}`, { | |||||
method: 'post', | |||||
}); | |||||
} | |||||
/** 获取实时库存 */ | /** 获取实时库存 */ | ||||
export async function CheckStockAdjust(data) { | export async function CheckStockAdjust(data) { | ||||
return request(`/kitchen/api/Device/CheckStockAdjust?DeviceId=${data}`, { | return request(`/kitchen/api/Device/CheckStockAdjust?DeviceId=${data}`, { | ||||
@@ -1,18 +1,19 @@ | |||||
import { PlusOutlined, UploadOutlined } from '@ant-design/icons'; | 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 { GridContent, PageContainer, RouteContext } from '@ant-design/pro-layout'; | ||||
import React, { Fragment, useRef, useState, useEffect } from 'react'; | 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, unitList } from './service' | |||||
import axios from 'axios'; | import axios from 'axios'; | ||||
const { Step } = Steps; | const { Step } = Steps; | ||||
const { Option, OptGroup } = Select; | const { Option, OptGroup } = Select; | ||||
const Advanced = (props) => { | const Advanced = (props) => { | ||||
const [form] = Form.useForm(); | const [form] = Form.useForm(); | ||||
const [goodsTypes, setGoodsTypes] = useState([]); | const [goodsTypes, setGoodsTypes] = useState([]); | ||||
const [goodsUnit, setGoodsUnit] = useState([]); | |||||
const [goodsBigTypes, setGoodsBigTypes] = useState([]); | const [goodsBigTypes, setGoodsBigTypes] = useState([]); | ||||
const [goodsTaste, setGoodsTaste] = useState([]); | const [goodsTaste, setGoodsTaste] = useState([]); | ||||
const [setGoodsBomModalVisible, handleGoodsBomModalVisible] = useState(); | const [setGoodsBomModalVisible, handleGoodsBomModalVisible] = useState(); | ||||
@@ -111,10 +112,10 @@ const Advanced = (props) => { | |||||
SetCurrTabKey(tabStatus.tabActiveKey); | SetCurrTabKey(tabStatus.tabActiveKey); | ||||
}, [tabStatus]) | }, [tabStatus]) | ||||
const onTabChange = (key) => { | const onTabChange = (key) => { | ||||
if (currentGoodsProp === 1) { | |||||
message.info('套餐不能设置配方'); | |||||
return; | |||||
} | |||||
if (currentGoodsProp === 1) { | |||||
message.info('套餐不能设置配方'); | |||||
return; | |||||
} | |||||
seTabStatus({ operationKey: key, tabActiveKey: key }); | seTabStatus({ operationKey: key, tabActiveKey: key }); | ||||
}; | }; | ||||
@@ -217,6 +218,21 @@ const Advanced = (props) => { | |||||
<Form.Item name="name" label="商品名称" rules={[{ required: true }]}> | <Form.Item name="name" label="商品名称" rules={[{ required: true }]}> | ||||
<Input /> | <Input /> | ||||
</Form.Item> | </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 }]}> | <Form.Item name="price" label="商品价格" rules={[{ required: true }]}> | ||||
<InputNumber placeholder="价格" min={0} /> | <InputNumber placeholder="价格" min={0} /> | ||||
</Form.Item> | </Form.Item> | ||||
@@ -297,6 +313,11 @@ const Advanced = (props) => { | |||||
</Upload> | </Upload> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label="是否称重" name="isWeigh" valuePropName="checked" initialValue='false' > | |||||
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked='false' /> | |||||
</Form.Item> | |||||
<Form.Item> | <Form.Item> | ||||
<Button type="primary" htmlType="submit"> | <Button type="primary" htmlType="submit"> | ||||
保存 | 保存 | ||||
@@ -396,6 +417,14 @@ const Advanced = (props) => { | |||||
setGoodsBigTypes(arr); | setGoodsBigTypes(arr); | ||||
}); | }); | ||||
} | } | ||||
function initGoodsUnit() { | |||||
unitList('{"current":1,"pageSize":200}').then((r) => { | |||||
var arr = r.data.data; | |||||
setGoodsUnit(arr); | |||||
}); | |||||
} | |||||
initGoodsUnit(); | |||||
initGoodsType(); | initGoodsType(); | ||||
initGoodsBigType(); | 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: [] //优惠信息 | discountInfo: [] //优惠信息 | ||||
}); | }); | ||||
const [orderStatus, setOrderStatus] = useState({ | |||||
isTrue: true | |||||
}); | |||||
const [orderStatus, setOrderStatus] = useState(''); | |||||
const onQueryOrderDetail = async () => { | const onQueryOrderDetail = async () => { | ||||
if (orderNumber) { | if (orderNumber) { | ||||
@@ -38,36 +36,31 @@ export default function Index() { | |||||
} | } | ||||
const orderIsNormal = (order) => { | 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(() => { | useEffect(() => { | ||||
@@ -84,9 +77,7 @@ export default function Index() { | |||||
#{orderInfo.sortId} | #{orderInfo.sortId} | ||||
</div> | </div> | ||||
<div className={styles['order-cook-state']}> | <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> | ||||
<div className={styles['order-cook-date']}> | <div className={styles['order-cook-date']}> | ||||
{orderInfo.createdAt} | {orderInfo.createdAt} | ||||
@@ -44,32 +44,36 @@ const columns = [ | |||||
title: '订单状态', | title: '订单状态', | ||||
key: 'orderStatus', | key: 'orderStatus', | ||||
render: (record) => { | 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 ( | return ( | ||||
<> | <> | ||||
{ | { | ||||
isNormal ? <Tag icon={<CheckCircleOutlined />} color="success"> | |||||
正常 | |||||
<Tag icon={<CheckCircleOutlined />} color="success"> | |||||
{orderStatus} | |||||
</Tag> | </Tag> | ||||
: | |||||
<Tag icon={<CloseCircleOutlined />} color="error"> | |||||
异常 | |||||
</Tag> | |||||
} | } | ||||
</> | </> | ||||
) | ) | ||||