Prechádzať zdrojové kódy

管理后台-座位

panyong 3 rokov pred
rodič
commit
c3570e5dc8

+ 92 - 34
htmldev/manage/src/views/business/place/set/details.vue

@@ -1,19 +1,50 @@
 <template>
   <div>
-    <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false"
+    <el-dialog :title="exData.id ? '编辑': '新增'"
+               :visible.sync="dialog"
+               width="50%"
+               :close-on-click-modal="false"
                top="50px">
-      <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
-        <el-form-item v-if="!exData.id" label="项目选择:">
-          <el-select v-model="form.department_project_id">
-            <el-option v-for="(item, index) in projectArr" :key="index" :label="item.project_name"
-                       :value="item.id"></el-option>
-          </el-select>
+      <el-form ref="form"
+               :model="form"
+               :rules="formRules"
+               label-width="160px">
+        <el-form-item prop="bar_name"
+                      :rules="formRules.required"
+                      label="座位名称:">
+          <el-col :span="16">
+            <el-input v-model="form.bar_name"
+                      placeholder="请输入座位名称"
+                      clearable></el-input>
+          </el-col>
         </el-form-item>
-        <el-form-item label="部门名称:">
-          <el-input v-model="form.department_name" placeholder="请输入部门名称"></el-input>
+        <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="部门描述:">
-          <el-input v-model="form.department_desc" placeholder="请输入部门描述"></el-input>
+        <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"
+                      :rules="formRules.InterNum"
+                      label="开放预定数量:">
+          <el-col :span="16">
+            <el-input v-model="form.b"
+                      placeholder="请输入人数"
+                      @input="form.b=form.b.replace(/[^\d]/g, '').replace(/^0*/, '')"
+                      clearable></el-input>
+          </el-col>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
@@ -25,9 +56,8 @@
 </template>
 
 <script>
-import { mapGetters } from 'vuex'
-
 export default {
+  components: {},
   props: {
     value: {
       type: Boolean,
@@ -40,40 +70,68 @@ export default {
       }
     }
   },
-  computed: {
-    ...mapGetters([
-      'projectArr'
-    ])
-  },
   data () {
     return {
       dialog: !!this.value,
       form: {
-        department_project_id: undefined,
-        department_name: '',
-        department_desc: ''
+        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: ''
+        }]
       }
     }
   },
   methods: {
-    async handleSubmit () {
-      let url = this.exData.id ? '/department/edit' : '/department/add'
-      const data = await this.$fetch('/api/auth' + url, { ...this.form })
-      if (data.code === 200) {
-        this.$message.success('提交成功')
-        this.$emit('success')
-        this.dialog = false
+    removeDomain (item) {
+      var index = this.form.domains.indexOf(item)
+      if (index !== -1) {
+        this.form.domains.splice(index, 1)
       }
+    },
+    addDomain () {
+      this.form.domains.push({
+        value: '',
+        key: Date.now()
+      })
+    },
+    handleSubmit () {
+      const url = this.exData.id ? '/v1/bar/modify' : '/v1/bar/add'
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          const data = await this.$fetch(url, {
+            ...this.form
+          })
+          if (data.code === 200) {
+            this.$message.success('提交成功')
+            this.$emit('success')
+            this.dialog = false
+          }
+        }
+      })
     }
   },
   mounted () {
-    if (this.projectArr.length == 0) {
-      this.$store.dispatch('common/setProjectArr')
-    }
     if (this.exData.id) {
-      this.form.id = this.exData.id
-      this.form.department_name = this.exData.department_name
-      this.form.department_desc = this.exData.department_desc
+      this.$set(this.form, 'id', this.exData.id)
+      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()
+            }
+            this.$set(this.form, key, value)
+          }
+        }
+      }
     }
   },
   watch: {

+ 11 - 12
htmldev/manage/src/views/business/place/set/index.vue

@@ -2,7 +2,7 @@
   <div class="padding-20">
     <div class="search-box">
       <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
-        <el-form-item label="创建时间:">
+        <el-form-item label="开放预定日期:">
           <el-date-picker
             :editable="false"
             v-model="time"
@@ -13,14 +13,14 @@
             end-placeholder="结束时间"
           ></el-date-picker>
         </el-form-item>
-        <el-form-item label="部门名称:">
-          <el-input v-model="searchForm.department_name" placeholder="请输入部门名称" clearable></el-input>
+        <el-form-item label="座位名称:">
+          <el-input v-model="searchForm.department_name" placeholder="请输入座位名称" clearable></el-input>
         </el-form-item>
         <el-form-item class="ml-10">
           <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
         </el-form-item>
         <el-form-item class="ml-10">
-          <el-button icon="el-icon-plus" type="primary" @click="add" v-permission="'department_list_add'">新增</el-button>
+          <el-button icon="el-icon-plus" type="primary" @click="add">新增</el-button>
         </el-form-item>
       </el-form>
     </div>
@@ -31,17 +31,16 @@
               class="marginT-10 order-table"
               border
               :max-height="vheight">
-      <el-table-column label="日期" prop="id"></el-table-column>
-      <el-table-column label="名称" prop="department_name"></el-table-column>
-      <el-table-column label="开放数量" prop="department_project_name"></el-table-column>
-      <el-table-column label="座位状态" prop="department_project_name"></el-table-column>
-      <el-table-column label="最晚到店时间" prop="department_desc"></el-table-column>
+      <el-table-column label="ID" prop="id"></el-table-column>
+      <el-table-column label="座位名称" prop="department_name"></el-table-column>
       <el-table-column label="说明" prop="department_project_name"></el-table-column>
-      <el-table-column label="备注" prop="department_desc"></el-table-column>
+      <el-table-column label="总数量" prop="department_project_name"></el-table-column>
+      <el-table-column label="已预定" prop="department_project_name"></el-table-column>
+      <el-table-column label="日期" prop="department_desc"></el-table-column>
       <el-table-column label="操作">
         <template slot-scope="scope">
-          <el-button type="text" @click="edit(scope.row)" v-permission="'department_list_edit'">编辑</el-button>
-          <el-button type="text" @click="del(scope.row)" v-permission="'department_list_del'">删除</el-button>
+          <el-button type="text" @click="edit(scope.row)">编辑</el-button>
+          <el-button type="text">删除</el-button>
         </template>
       </el-table-column>
     </el-table>