|
@@ -9,91 +9,77 @@
|
|
|
:model="form"
|
|
|
:rules="formRules"
|
|
|
label-width="160px">
|
|
|
- <el-form-item prop="bar_name"
|
|
|
+ <el-form-item prop="place_name"
|
|
|
:rules="formRules.required"
|
|
|
label="座位名称:">
|
|
|
<el-col :span="16">
|
|
|
- <el-input v-model="form.bar_name"
|
|
|
+ <el-input v-model="form.place_name"
|
|
|
placeholder="请输入座位名称"
|
|
|
clearable></el-input>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="说明:">
|
|
|
+ <el-form-item prop="place_desc"
|
|
|
+ :rules="formRules.required"
|
|
|
+ label="说明:">
|
|
|
<el-col :span="16">
|
|
|
<el-input type="textarea"
|
|
|
:rows="4"
|
|
|
placeholder="请输入座位说明"
|
|
|
- v-model="form.note">
|
|
|
+ v-model="form.place_desc">
|
|
|
</el-input>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="a"
|
|
|
- :rules="formRules.InterNum"
|
|
|
- label="座位数量:">
|
|
|
- <el-col :span="16">
|
|
|
- <el-input v-model="form.a"
|
|
|
- placeholder="请输入座位数量"
|
|
|
- clearable></el-input>
|
|
|
- </el-col>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="b"
|
|
|
+ <el-form-item prop="place_user_max"
|
|
|
:rules="formRules.InterNum"
|
|
|
label="单桌人数:">
|
|
|
<el-col :span="16">
|
|
|
- <el-input v-model="form.b"
|
|
|
+ <el-input v-model="form.place_user_max"
|
|
|
placeholder="请输入人数"
|
|
|
- @input="form.b=form.b.replace(/[^\d]/g, '').replace(/^0*/, '')"
|
|
|
+ @input="form.place_user_max=form.place_user_max.replace(/[^\d]/g, '').replace(/^0*/, '')"
|
|
|
clearable></el-input>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="c"
|
|
|
+ <el-form-item prop="place_price"
|
|
|
:rules="formRules.numPot2"
|
|
|
- label="单价:">
|
|
|
+ label="单价(元):">
|
|
|
<el-col :span="16">
|
|
|
- <el-input v-model="form.c"
|
|
|
+ <el-input v-model="form.place_price"
|
|
|
placeholder="请输入单价"
|
|
|
- @input="form.c=form.c.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
|
|
|
+ @input="form.place_price=form.place_price.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
|
|
|
clearable></el-input>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="bar_song_start_time"
|
|
|
+ <el-form-item prop="place_latest_time"
|
|
|
:rules="formRules.required"
|
|
|
label="最晚到店时间:">
|
|
|
<el-time-select placeholder="请选择最晚到店时间"
|
|
|
- v-model="form.bar_song_start_time"
|
|
|
+ v-model="form.place_latest_time"
|
|
|
:picker-options="{start: '00:00', step: '00:05', end: '23:59'}">
|
|
|
</el-time-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="bar_song_end_time"
|
|
|
- :rules="formRules.required"
|
|
|
+ <el-form-item prop="place_max_time"
|
|
|
+ :rules="formRules.checkInterNum"
|
|
|
label="最晚保留时间(分钟):">
|
|
|
<el-col :span="16">
|
|
|
- <el-input v-model="form.b"
|
|
|
+ <el-input v-model="form.place_max_time"
|
|
|
placeholder="请输入分钟数"
|
|
|
- @input="form.b=form.b.replace(/[^\d]/g, '').replace(/^0*/, '')"
|
|
|
+ @input="form.place_max_time=form.place_max_time.replace(/[^\d]/g, '').replace(/^0*/, '')"
|
|
|
clearable></el-input>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="备注:">
|
|
|
- <el-col :span="16">
|
|
|
- <el-input type="textarea"
|
|
|
- :rows="4"
|
|
|
- placeholder="请输入备注"
|
|
|
- v-model="form.note">
|
|
|
- </el-input>
|
|
|
- </el-col>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="桌号设置" required></el-form-item>
|
|
|
- <el-form-item v-for="(domain, index) in form.domains"
|
|
|
+ <el-form-item v-for="(desk, index) in form.place_number"
|
|
|
:label="(index + 1) + '桌'"
|
|
|
- :key="domain.key"
|
|
|
- :prop="'domains.' + index + '.value'"
|
|
|
- :rules="{required: true, message: '桌号不能为空', trigger: 'blur'}">
|
|
|
+ :key="index"
|
|
|
+ :prop="'place_number.' + index + '.value'"
|
|
|
+ :rules="formRules.required">
|
|
|
<el-col :span="16">
|
|
|
- <el-input v-model="domain.value" placeholder="请设置桌号"></el-input>
|
|
|
+ <el-input v-model="desk.value" placeholder="请设置桌号"></el-input>
|
|
|
</el-col>
|
|
|
<el-col :span="7" :offset="1">
|
|
|
- <el-button type="warning" size="small" @click.prevent="removeDomain(domain)">删除</el-button>
|
|
|
+ <el-button type="warning"
|
|
|
+ @click.prevent="removeDeskNum(desk)">删除
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -107,6 +93,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { fen2Yuan, yuan2Fen } from '@/utils'
|
|
|
+
|
|
|
export default {
|
|
|
components: {},
|
|
|
props: {
|
|
@@ -125,40 +113,44 @@ export default {
|
|
|
return {
|
|
|
dialog: !!this.value,
|
|
|
form: {
|
|
|
- bar_name: '', // 门店名称
|
|
|
- bar_address: '', // 门店地址
|
|
|
- bar_status: '1', // 门店状态(0无效1有效)
|
|
|
- bar_img_url: [], // 门店图片
|
|
|
- bar_song_start_time: '', // 点歌开始时间
|
|
|
- bar_song_end_time: '', // 点歌结束时间
|
|
|
- bar_place_reserve_start_time: '', // 座位预定开始时间
|
|
|
- bar_place_reserve_end_time: '', // 座位预定结束时间
|
|
|
- note: '', // 备注
|
|
|
- domains: [{
|
|
|
- value: ''
|
|
|
- }]
|
|
|
+ place_name: '', // 座位名称
|
|
|
+ place_desc: '', // 座位描述
|
|
|
+ place_user_max: '', // 最多到店人数
|
|
|
+ place_price: '', // 座位价格(单位为分)
|
|
|
+ place_latest_time: '', // 最晚到店时间
|
|
|
+ place_max_time: '', // 最晚保留时间
|
|
|
+ // 座位编号(数组)
|
|
|
+ place_number: [
|
|
|
+ {
|
|
|
+ value: ''
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- removeDomain (item) {
|
|
|
- var index = this.form.domains.indexOf(item)
|
|
|
+ removeDeskNum (item) {
|
|
|
+ var index = this.form.place_number.indexOf(item)
|
|
|
+ if (this.form.place_number.length <= 1) {
|
|
|
+ this.$message.warning('桌数不能小于1')
|
|
|
+ return
|
|
|
+ }
|
|
|
if (index !== -1) {
|
|
|
- this.form.domains.splice(index, 1)
|
|
|
+ this.form.place_number.splice(index, 1)
|
|
|
}
|
|
|
},
|
|
|
addDomain () {
|
|
|
- this.form.domains.push({
|
|
|
- value: '',
|
|
|
- key: Date.now()
|
|
|
+ this.form.place_number.push({
|
|
|
+ value: ''
|
|
|
})
|
|
|
},
|
|
|
handleSubmit () {
|
|
|
- const url = this.exData.id ? '/v1/bar/modify' : '/v1/bar/add'
|
|
|
+ const url = this.exData.id ? '/v1/bar/place/template/modify' : '/v1/bar/place/template/add'
|
|
|
this.$refs.form.validate(async valid => {
|
|
|
if (valid) {
|
|
|
const data = await this.$fetch(url, {
|
|
|
- ...this.form
|
|
|
+ ...this.form,
|
|
|
+ place_price: yuan2Fen(this.form.place_price)
|
|
|
})
|
|
|
if (data.code === 200) {
|
|
|
this.$message.success('提交成功')
|
|
@@ -175,9 +167,9 @@ export default {
|
|
|
for (const key in this.exData) {
|
|
|
if (this.form.hasOwnProperty(key)) {
|
|
|
let value = this.exData[key]
|
|
|
- if ((Array.isArray(value) && value.length > 0) || value) {
|
|
|
- if (key === 'bar_status') {
|
|
|
- value = value.toString()
|
|
|
+ if ((Array.isArray(value) && value.length > 0) || value === 0 || value) {
|
|
|
+ if (key === 'place_price') {
|
|
|
+ value = fen2Yuan(value)
|
|
|
}
|
|
|
this.$set(this.form, key, value)
|
|
|
}
|