foodDetail.vue
6.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
<div>
<a-card>
<h3 style="font-weight: bold;">餐点信息</h3>
<a-form-model ref="ruleForm" :model="form" :rules="rules">
<a-row>
<a-col :span="8">
<a-form-model-item ref="staffId" label="餐点编号">
<a-input :disabled="true" style="width: 250px" v-model="form.staffId" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item ref="staffId" label="创建时间">
<a-date-picker v-model="form.startValue" show-time format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss" placeholder="创建时间" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="状态" prop="staffId">
<a-select v-model="form.staffId" style="width: 250px;" placeholder="请选择">
<a-select-option v-for="(item,i) in provinceData" :key="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-model-item ref="staffId" label="餐点" prop="staffId">
<a-input style="width: 250px;" v-model="form.staffId" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="线上售餐" prop="staffId">
<a-select v-model="form.staffId" style="width: 250px;" placeholder="请选择">
<a-select-option v-for="(item,i) in provinceData" :key="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</a-card>
<a-card>
<h3 style="font-weight: bold;">线上售餐设置</h3>
<a-form-model ref="ruleForm" :model="form" :rules="rules">
<a-col :span="8">
<a-form-model-item ref="staffId" label="餐点编号" prop="staffId">
<a-input style="width: 250px" v-model="form.staffId" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item ref="staffId" label="预定时间" prop="staffId">
<a-time-picker value-format="HH:mm:ss" v-model="form.strDate" @change="selectStr()" /> ---
<a-time-picker value-format="HH:mm:ss" v-model="form.entDate" @change="selectStr()" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item ref="staffId" label="备餐时间(分钟数)" prop="staffId">
<a-input :disabled="true" style="width: 250px" v-model="form.minutes" />
</a-form-model-item>
</a-col>
</a-form-model>
</a-card>
<div style="float: right; margin:20px;">
<a-button @click="$router.back(-1)">
返回
</a-button>
<a-button type="primary" style="margin-left: 10px;" @click="onSubmit">
保存
</a-button>
</div>
</div>
</template>
<script>
import '@/assets/less/TableExpand.less'
import moment from 'moment';
// import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
name: "",
// mixins: [JeecgListMixin],
components: {
},
created() {
},
data() {
return {
form: {
staffId: '123',
startValue: "",
strDate: "",
entDate: "",
minutes: "",
},
provinceData: [
{ id: 0, name: "启用" },
{ id: 1, name: "禁用" }
],
rules: {
staffId: [
{ required: true, message: '请输入姓名', trigger: 'blur' },
],
},
url: {
list: "/veri/veriDetail/list",
delete: "/veri/veriDetail/delete",
deleteBatch: "/veri/veriDetail/deleteBatch",
exportXlsUrl: "veri/veriDetail/exportXls",
importExcelUrl: "veri/veriDetail/importExcel",
},
}
},
computed: {
},
methods: {
moment,
onSubmit() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
console.log(this.form)
} else {
console.log('error submit!!');
return false;
}
});
},
selectStr() {
console.log(this.form.strDate)
if (this.form.strDate && this.form.entDate) {
if (this.form.strDate > this.form.entDate) {
this.$message.error("开始时间不得大于结束时间")
this.form.entDate = ""
this.form.strDate = ""
}
var time1 = this.form.strDate;
var time2 = this.form.entDate;
var begin1 = time1.substr(0, 8).split(":");
var begin2 = time2.substr(0, 8).split(":");
console.log((begin2[0] - begin1[0]) * 60)
var fenzhong = ((begin2[0] - begin1[0]) * 60) + (begin2[1] - begin1[1])
console.log("fenzhong", fenzhong)
this.form.minutes = fenzhong
}
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>