Bläddra i källkod

管理后台-订座管理:预定、未来7天排座

panyong 3 år sedan
förälder
incheckning
049944722c

+ 3 - 1
htmldev/manage/README.md

@@ -206,4 +206,6 @@ npm run build
 yarn build
 ```
 
-### todo 按钮加锁,防止重复点击
+- [ ] 按钮加锁,防止重复点击
+- [ ] 订座安排:没有数据、修改、删除未测试
+- [ ] 座位预定:没有数据,字段缺

+ 3 - 3
htmldev/manage/src/router/modules/business.js

@@ -33,19 +33,19 @@ const businessRouter = {
           path: 'reserve',
           component: () => import('@/views/business/place/reserve/index'),
           name: 'BusinessPlaceReserve',
-          meta: { title: '座位预订' }
+          meta: { title: '预订' }
         },
         {
           path: 'set',
           component: () => import('@/views/business/place/set/index'),
           name: 'BusinessPlaceSet',
-          meta: { title: '订座安排' }
+          meta: { title: '未来7天排座' }
         },
         {
           path: 'list',
           component: () => import('@/views/business/place/list/index'),
           name: 'BusinessPlaceList',
-          meta: { title: '座位管理' }
+          meta: { title: '座位模板' }
         }
       ]
     },

+ 2 - 1
htmldev/manage/src/utils/rules.js

@@ -178,7 +178,8 @@ const formRules = {
   numPot2: [{ required: true, validator: checkNumPot2, trigger: 'blur' }],
   InterNum: [{ required: true, validator: checkInterNum, trigger: 'blur' }],
   coins: [{ required: true, validator: checkInterNum, trigger: 'blur' }],
-  uploadImgs: [{ type: 'array', required: true, message: '请选择图片', trigger: ['change', 'blur'] }]
+  uploadImgs: [{ type: 'array', required: true, message: '请选择图片', trigger: ['change', 'blur'] }],
+  time: [{ required: true, validator: time, trigger: ['change', 'blur'] }]
 }
 
 Vue.prototype.formRules = formRules

+ 15 - 39
htmldev/manage/src/views/business/place/reserve/details.vue

@@ -9,44 +9,46 @@
                :model="form"
                :rules="formRules"
                label-width="160px">
-        <el-form-item prop="bar_name"
+        <el-form-item prop="order_user_name"
                       label="预订人:">
           <el-col :span="16">
-            <el-input v-model="form.bar_name"
+            <el-input v-model="form.order_user_name"
                       placeholder=""
                       disabled
                       clearable></el-input>
           </el-col>
         </el-form-item>
-        <el-form-item prop="bar_name"
+        <el-form-item prop="order_user_phone"
                       label="手机号:">
           <el-col :span="16">
-            <el-input v-model="form.bar_name"
+            <el-input v-model="form.order_user_phone"
                       placeholder=""
                       disabled
                       clearable></el-input>
           </el-col>
         </el-form-item>
-        <el-form-item prop="bar_name"
+        <el-form-item prop="place_name"
                       label="预定座位类型:">
           <el-col :span="16">
-            <el-input v-model="form.bar_name"
+            <el-input v-model="form.place_name"
                       placeholder=""
                       disabled
                       clearable></el-input>
           </el-col>
         </el-form-item>
-        <el-form-item prop="a"
+        <el-form-item prop="order_sign_status"
                       :rules="formRules.InterNum"
                       label="签到状态:">
-          <el-radio v-model="form.bar_status" label="1">签到</el-radio>
+          <el-radio v-model="form.order_sign_status" label="1">签到</el-radio>
           <br>
-          <el-radio v-model="form.bar_status" label="0">未签到</el-radio>
+          <el-radio v-model="form.order_sign_status" label="0">未签到</el-radio>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="primary" @click="handleSubmit">保 存</el-button>
+        <el-button type="primary"
+                   @click="handleSubmit">保 存
+        </el-button>
       </div>
     </el-dialog>
   </div>
@@ -71,36 +73,13 @@ 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: ''
-        }]
+        order_sign_status: '' // 签到状态(0未签到1已签到)
       }
     }
   },
   methods: {
-    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'
+      const url = '/v1/prepare/order/sign'
       this.$refs.form.validate(async valid => {
         if (valid) {
           const data = await this.$fetch(url, {
@@ -121,10 +100,7 @@ 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) {
             this.$set(this.form, key, value)
           }
         }

+ 19 - 11
htmldev/manage/src/views/business/place/reserve/index.vue

@@ -28,18 +28,24 @@
               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="order_pre_time"></el-table-column>
+      <el-table-column label="预订人" prop="order_user_name"></el-table-column>
+      <el-table-column label="手机号" prop="order_user_phone"></el-table-column>
+      <el-table-column label="预定人数" prop="order_user_num"></el-table-column>
+      <el-table-column label="预定座位类型" prop="place_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">
+          <p>{{ ['未签到', '已签到'][scope.row.order_sign_status] }}</p>
+        </template>
+      </el-table-column>
       <el-table-column label="签到时间" prop="department_desc"></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="edit(scope.row)">签到
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -54,7 +60,9 @@
       background
       layout="total, sizes, prev, pager, next, jumper"
       :total="totalCount"/>
-    <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData"
+    <detail v-if="detailsDialog.show"
+            v-model="detailsDialog.show"
+            :exData="detailsDialog.exData"
             @success="init"></detail>
   </div>
 </template>
@@ -71,13 +79,13 @@ export default {
   data () {
     return {
       detailsDialog: {
-        show: false,
+        show: true,
         exData: {}
       },
       time: [],
       searchForm: {},
       tableData: [],
-      tableUrl: '/department/list'
+      tableUrl: '/v1/prepare/order/list'
     }
   },
   methods: {

+ 134 - 37
htmldev/manage/src/views/business/place/set/details.vue

@@ -9,46 +9,111 @@
                :model="form"
                :rules="formRules"
                label-width="160px">
-        <el-form-item prop="bar_name"
+        <el-form-item prop="place_time"
+                      :rules="formRules.time"
+                      label="开放预定日期:">
+          <el-col :span="16">
+            <el-date-picker
+              v-model="form.place_time"
+              align="right"
+              type="date"
+              placeholder="选择日期"
+              :picker-options="pickerOptions"
+              value-format="yyyy-MM-dd"
+              :readonly="form.id">
+            </el-date-picker>
+          </el-col>
+        </el-form-item>
+        <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"
+        <el-form-item prop="place_user_max"
                       :rules="formRules.InterNum"
-                      label="已预定:">
+                      label="单桌人数:">
           <el-col :span="16">
-            <el-input v-model="form.a"
-                      placeholder="请输入座位数量"
+            <el-input v-model="form.place_user_max"
+                      placeholder="请输入人数"
+                      @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="b"
-                      :rules="formRules.InterNum"
-                      label="开放预定数量:">
+        <el-form-item prop="place_price"
+                      :rules="formRules.numPot2"
+                      label="单价(元):">
           <el-col :span="16">
-            <el-input v-model="form.b"
-                      placeholder="请输入人数"
-                      @input="form.b=form.b.replace(/[^\d]/g, '').replace(/^0*/, '')"
+            <el-input v-model="form.place_price"
+                      placeholder="请输入单价"
+                      @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="place_latest_time"
+                      :rules="formRules.required"
+                      label="最晚到店时间:">
+          <el-time-select placeholder="请选择最晚到店时间"
+                          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="place_max_time"
+                      :rules="formRules.checkInterNum"
+                      label="最晚保留时间(分钟):">
+          <el-col :span="16">
+            <el-input v-model="form.place_max_time"
+                      placeholder="请输入分钟数"
+                      @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 prop="place_name"
+                      :rules="formRules.required"
+                      label="已预定:"
+                      v-if="form.id">
+          <el-col :span="16">
+            <el-input v-model="form.place_name"
+                      readonly
+                      placeholder=""
                       clearable></el-input>
           </el-col>
         </el-form-item>
+        <el-form-item :label="!form.id ? '桌号设置:' : '开放预定数量:'" required></el-form-item>
+        <el-form-item v-for="(desk, index) in form.place_number"
+                      :label="(index + 1) + '桌'"
+                      :key="index"
+                      :prop="'place_number.' + index + '.value'"
+                      :rules="formRules.required">
+          <el-col :span="16">
+            <el-input v-model="desk.value"
+                      :readonly="form.id"
+                      placeholder="请设置桌号"></el-input>
+          </el-col>
+          <el-col :span="7" :offset="1">
+            <el-button type="warning"
+                       @click.prevent="removeDeskNum(desk)">删除
+            </el-button>
+          </el-col>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
+        <el-button @click.prevent="addDomain">新增桌号</el-button>
         <el-button type="primary" @click="handleSubmit">确 定</el-button>
       </div>
     </el-dialog>
@@ -56,6 +121,8 @@
 </template>
 
 <script>
+import { fen2Yuan, yuan2Fen } from '@/utils'
+
 export default {
   components: {},
   props: {
@@ -73,41 +140,71 @@ export default {
   data () {
     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: ''
+      pickerOptions: {
+        disabledDate (time) {
+          return time.getTime() < Date.now() - 8.64e7
+        },
+        shortcuts: [{
+          text: '今天',
+          onClick (picker) {
+            picker.$emit('pick', new Date())
+          }
+        }, {
+          text: '昨天',
+          onClick (picker) {
+            const date = new Date()
+            date.setTime(date.getTime() - 3600 * 1000 * 24)
+            picker.$emit('pick', date)
+          }
+        }, {
+          text: '一周前',
+          onClick (picker) {
+            const date = new Date()
+            date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
+            picker.$emit('pick', date)
+          }
         }]
+      },
+      form: {
+        place_time: '2021-05-23', // 年月日
+        place_name: '10人卡座', // 座位名称
+        place_desc: '卡座台费3200元', // 座位描述
+        place_user_max: '10', // 最多到店人数
+        place_price: '1000', // 座位价格(单位为分)
+        place_latest_time: '2021-05-23 21:15:00', // 最晚到店时间
+        place_max_time: '30', // 最晚保留时间
+        // 座位编号(数组)
+        place_number: [
+          {
+            value: 'AF0004'
+          }
+        ]
       }
     }
   },
   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/modify' : '/v1/bar/place/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('提交成功')
@@ -124,9 +221,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)
           }

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

@@ -32,11 +32,11 @@
               border
               :max-height="vheight">
       <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_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="座位名称" prop="place_name"></el-table-column>
+      <el-table-column label="说明" prop="place_desc"></el-table-column>
+      <el-table-column label="总数量" prop="place_num"></el-table-column>
+      <el-table-column label="已预定" prop="place_pre_num"></el-table-column>
+      <el-table-column label="日期" prop="place_time"></el-table-column>
       <el-table-column label="操作">
         <template slot-scope="scope">
           <el-button type="text" @click="edit(scope.row)">编辑</el-button>
@@ -55,7 +55,9 @@
       background
       layout="total, sizes, prev, pager, next, jumper"
       :total="totalCount"/>
-    <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData"
+    <detail v-if="detailsDialog.show"
+            v-model="detailsDialog.show"
+            :exData="detailsDialog.exData"
             @success="init"></detail>
   </div>
 </template>
@@ -78,7 +80,7 @@ export default {
       time: [],
       searchForm: {},
       tableData: [],
-      tableUrl: '/department/list'
+      tableUrl: '/v1/bar/place/list'
     }
   },
   methods: {
@@ -96,8 +98,8 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const data = await this.$fetch('/api/auth/department/del', { id: row.id })
-        if (data.code == 200) {
+        const data = await this.$fetch('/v1/bar/place/delete', { id: row.id }, 'get')
+        if (data.code === 200) {
           this.$message.success('删除成功')
           this.init()
         }

+ 1 - 1
htmldev/manage/src/views/business/show/pickASong/index.vue

@@ -56,7 +56,7 @@ export default {
       time: [],
       searchForm: {},
       tableData: [],
-      tableUrl: '/department/list'
+      tableUrl: '/v1/user/song/order/list'
     }
   },
   mounted () {

+ 1 - 1
htmldev/manage/src/views/business/show/reward/index.vue

@@ -55,7 +55,7 @@ export default {
       time: [],
       searchForm: {},
       tableData: [],
-      tableUrl: '/department/list'
+      tableUrl: '/v1/user/support/order/list'
     }
   },
   mounted () {