Browse Source

提交代码

dev
txb 1 year ago
parent
commit
5631af867e
2 changed files with 81 additions and 15 deletions
  1. +38
    -5
      src/pages/card/checkgoods/components/CreateForm.jsx
  2. +43
    -10
      src/pages/card/checkgoods/index.jsx

+ 38
- 5
src/pages/card/checkgoods/components/CreateForm.jsx View File

@@ -28,10 +28,10 @@ const CreateForm = (props) => {
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>
<Form.Item name="qty" label="预订数量" rules={[{ required: true }]}>
<InputNumber min={0} placeholder="预订数量" />
<Form.Item name="qty" label="预订数量" rules={[{ required: true }]}>
<InputNumber min={0} placeholder="预订数量" />
</Form.Item>
<Form.Item name="mealType" label="可预定时段" rules={[{ required: true }]}>
<Form.Item name="mealType" label="用餐时段" rules={[{ required: true }]}>
<Checkbox.Group options={[
{
label: '早餐',
@@ -47,14 +47,47 @@ const CreateForm = (props) => {
}
]} />
</Form.Item>
<Form.Item name="week" label="星期" rules={[{ required: true }]}>
<Checkbox.Group options={[
{
label: '一',
value: '1',
},
{
label: '二',
value: '2',
},
{
label: '三',
value: '3',
},
{
label: '四',
value: '4',
},
{
label: '五',
value: '5',
},
{
label: '六',
value: '6',
},
{
label: '日',
value: '7',
}

<Form.Item name="startReserveTime" label="开始时间" >
]} />
</Form.Item>

{/* <Form.Item name="startReserveTime" label="开始时间" >
<TimePicker ></TimePicker>
</Form.Item>

<Form.Item name="endReserveTime" label="结束时间" >
<TimePicker ></TimePicker>
</Form.Item>
</Form.Item> */}





+ 43
- 10
src/pages/card/checkgoods/index.jsx View File

@@ -20,15 +20,16 @@ import moment from 'moment';
*/

const handleUpdate = async (fields) => {
console.log("fields",fields);
console.log("fields", fields);
const hide = message.loading('正在设置可预订数量');
try {
await updateGoods({
goodsId: fields.id,
qty: fields.qty,
mealType: fields.mealType,
startReserveTime: fields.startReserveTime,
endReserveTime: fields.endReserveTime
week: fields.week,
// startReserveTime: fields.startReserveTime,
// endReserveTime: fields.endReserveTime
}).then((r) => {
if (r.data) {
message.success('设置可预订数量成功');
@@ -122,11 +123,11 @@ const GoodsManage = () => {
valueEnum: goodsTypes,
},
{
title: '预订数量',
title: '预订数量',
dataIndex: 'qty',
},
{
title: '可预定时段',
title: '用餐时段',
dataIndex: 'mealType',
render: (_, record) => {
var mealtypes = "";
@@ -145,6 +146,35 @@ const GoodsManage = () => {
return mealtypes;
}

},
{
title: '星期',
dataIndex: 'week',
render: (_, record) => {
var weeks = "";
if (record.week) {
var str_array = record.week.split(',')

for (var i = 0; i < str_array.length; i++) {
if (str_array[i] === '1')
weeks += "[一]";
if (str_array[i] === '2')
weeks += "[二]";
if (str_array[i] === '3')
weeks += "[三]";
if (str_array[i] === '4')
weeks += "[四]";
if (str_array[i] === '5')
weeks += "[五]";
if (str_array[i] === '6')
weeks += "[六]";
if (str_array[i] === '7')
weeks += "[日]";
}
}
return weeks;
}

},
{
title: '操作',
@@ -157,10 +187,10 @@ const GoodsManage = () => {
onClick={() => {
handleModalVisible(true);
const temp = JSON.parse(JSON.stringify(record));
if (temp.startReserveTime) { temp.startReserveTime = temp.startReserveTime = moment(temp.startReserveTime); }
else {temp.startReserveTime = moment(moment(new Date(Date.now() + 24 * 60 * 60 * 1000)).format('YYYY-MM-DD 00:00:00'));}
if (temp.startReserveTime) { temp.startReserveTime = temp.startReserveTime = moment(temp.startReserveTime); }
else { temp.startReserveTime = moment(moment(new Date(Date.now() + 24 * 60 * 60 * 1000)).format('YYYY-MM-DD 00:00:00')); }
if (temp.endReserveTime) { temp.endReserveTime = moment(temp.endReserveTime); }
else { temp.endReserveTime = moment(moment(new Date(Date.now() + 24 * 60 * 60 * 1000)).format('YYYY-MM-DD 23:59:59')); }
else { temp.endReserveTime = moment(moment(new Date(Date.now() + 24 * 60 * 60 * 1000)).format('YYYY-MM-DD 23:59:59')); }
setCurrentRow(temp);
}}
>
@@ -211,10 +241,13 @@ const GoodsManage = () => {
if (typeof value.mealType === 'object') {
value.mealType = value.mealType.join();
}
if (typeof value.week === 'object') {
value.week = value.week.join();
}
// value.mealType = value.mealType.join();
console.log("调试", value);
value.startReserveTime = new Date(value.startReserveTime).toLocaleString();
value.endReserveTime = new Date(value.endReserveTime).toLocaleString();
// value.startReserveTime = new Date(value.startReserveTime).toLocaleString();
// value.endReserveTime = new Date(value.endReserveTime).toLocaleString();
success = await handleUpdate(value);
if (success) {
handleModalVisible(false);


Loading…
Cancel
Save