Browse Source

完善pos预约功能

许智捷 1 year ago
parent
commit
893568f227

+ 55 - 65
src/views/pos/modules/OrderFood.vue

@@ -22,19 +22,21 @@
                     :row-selection="rowSelection"
                     class="j-table-force-nowrap"
                 >
-                <template slot="num" slot-scope="text, record, index">
-                    <a-input-number
-                        v-if="record.id == null"
-                        v-model="record.num"
-                        style="width: auto; "
-                        :max="record.inventory"
-                        @change="(event) => numChange(event, index)"/>
-                    <span v-else>{{ record.num }}</span>
-                </template>
-                <template slot="sellingprice" slot-scope="text, record, index">
-                    ¥{{ (record.num * record.sellingprice).toFixed(2) }}
-                </template>
+                    <template slot="num" slot-scope="text, record, index">
+                        <a-input-number
+                            v-if="record.id == null"
+                            v-model="record.num"
+                            style="width: auto; "
+                            :max="record.inventory"
+                            @change="(event) => numChange(event, index)"/>
+                        <span v-else>{{ record.num }}</span>
+                    </template>
+                    <template slot="money" slot-scope="text, record, index">
+                        ¥{{ (record.num * record.money).toFixed(2) }}
+                    </template>
                 </a-table>
+              <a-button @click="cleanTable">清空</a-button>
+              <a-button @click="chooseOk">确定</a-button>
             </a-col>
             <a-col :span="16">
                 <a-tabs v-model="tabgoodsTypeId">
@@ -45,7 +47,7 @@
                         v-for="item in goodsTypeList"
                     ></a-tab-pane>
                     <!-- <a-tab-pane key="1" tab="4"> -->
-                        
+
                     <!-- </a-tab-pane> -->
                 </a-tabs>
                 <a-row :gutter="[5, 5]">
@@ -80,10 +82,10 @@
             <p>Some contents...</p>
         </a-modal> -->
 </template>
-  
+
 <script>
   import { httpAction, getAction, postAction } from '@/api/manage'
-  
+
   export default {
     name: 'OrderFood',
     components: {},
@@ -109,8 +111,8 @@
             },
             {
                 title: '售价',
-                dataIndex: 'sellingprice',
-                scopedSlots: { customRender: 'sellingprice'}
+                dataIndex: 'money',
+                scopedSlots: { customRender: 'money'}
             },
         ],
         dataSource: [],
@@ -180,62 +182,36 @@
         if (val <= 0) {
             this.merchandiseData.splice(index, 1)
         }
-      },    
+      },
       rowSelection() {
 
       },
+      cleanTable() {
+        this.merchandiseData = []
+        this.$emit('ok', [])
+      },
+      chooseOk() {
+        this.$emit('ok', this.merchandiseData)
+        this.foodOpen = false
+      },
       // 点击添加商品
       addMerchandise(val) {
         if (val.inventory <= 0) {
             this.$message.warning('此商品库存不足')
             return
         }
-        for (let item = 0; item < this.merchandiseData.length; item++) {
-            let tempcycle = false
-            if (this.merchandiseData[item].name == val.name && this.merchandiseData[item].num >= 1) {
-                let tempdata = {
-                    name: val.name,
-                    // sellingprice: (val.sellingPrice * (this.merchandiseData[item].num + 1)).toFixed(2),
-                    sellingprice: val.sellingPrice,
-                    num: this.merchandiseData[item].num + 1
-                }
-                let tempindex = this.merchandiseData.findIndex(index => index == this.merchandiseData[item])
-                this.merchandiseData.splice(tempindex,1,tempdata)
-                return tempcycle = true
-                // return
-            } 
-            if (tempcycle) {
-                return
+        let index = this.merchandiseData.findIndex(e => e.goodsId === val.id)
+        if (index === -1) {
+            let obj = {
+              goodsId: val.id,
+              name: val.name,
+              money: val.sellingPrice,
+              num: 1
             }
-            // return
-            // else {
-            //     console.log(222);
-            //     let tempdata = {
-            //         name: val.name,
-            //         sellingprice: val.sellingPrice.toFixed(2),
-            //         age: 1
-            //     }
-            //     this.merchandiseData.push(tempdata)
-            //     return
-            // }
-        }
-        // let temppic = this.merchandiseData.find(index => index.name == val.name)
-        // console.log(temppic);
-        // return
-        // this.merchandiseData.find(item => {
-            
-        // })
-        // if (this.merchandiseData.length !== 0) {
-        //     return
-        // }
-        // console.log(111);
-        let tempdata = {
-            name: val.name,
-            sellingprice: val.sellingPrice,
-            num: 1
+            this.merchandiseData.push(obj)
+        } else {
+          this.merchandiseData[index].num++
         }
-        this.merchandiseData.push(tempdata)
-        
       },
       // 请求商品列表数据
       loadGoods() {
@@ -248,7 +224,7 @@
             ids.push(this.tabgoodsTypeId)
         }
         this.dataSource = [
-            
+
         ]
         getAction('/pos/posSellClearGoods/list', {
             pageNo: 1,
@@ -293,8 +269,23 @@
         this.foodOpen = false
       },
     // 预定点餐
-      edit() {
+      edit(orderGoodsDetailList) {
         this.foodOpen = true
+        if (orderGoodsDetailList == null) {
+          return
+        }
+        this.$nextTick(() => {
+          this.merchandiseData = []
+          orderGoodsDetailList.forEach(e => {
+            let obj = {
+              goodsId: e.id,
+              name: e.goodsName,
+              money: e.money,
+              num: e.num
+            }
+            this.merchandiseData.push(obj)
+          })
+        })
       },
     }
   }
@@ -341,4 +332,3 @@
     height: 65vh !important;
 }
 </style>
-  

+ 425 - 364
src/views/pos/modules/ReserveModal.vue

@@ -1,267 +1,277 @@
-<
 <template>
-    <div>
+  <div >
     <j-modal
-        :title="title"
-        :width="width"
-        :visible="visible"
-        switchFullscreen
-        @ok="handleOk"
-        :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
-        @cancel="handleCancel"
-        cancelText="关闭">
-        <a-card style="margin: 20px">
+      :title="title"
+      :width="width"
+      :visible="visible"
+      switchFullscreen
+      @ok="handleOk"
+      :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+      @cancel="handleCancel"
+      cancelText="关闭">
+      <a-card style="margin: 20px" v-if="visible">
 
-            <a-row>
-                <a-col :span="16">
-                    <a-tabs v-model="tabPosTypeId" @change="tabPosTypeChange">
-                        <a-tab-pane
-                            :key="item.id"
-                            :tab="item.name"
-                            v-for="item in posTypeList"
-                        ></a-tab-pane>
-                    </a-tabs>
+        <a-row>
+          <a-col :span="16">
+            <a-tabs v-model="tabPosTypeId" @change="tabPosTypeChange">
+              <a-tab-pane
+                :key="item.id"
+                :tab="item.name"
+                v-for="item in posTypeList"
+              ></a-tab-pane>
+            </a-tabs>
 
-                    <a-tabs v-model="tabPosRegionId" @change="tabRegionChange">
-                        <a-tab-pane key="1" tab="全部"></a-tab-pane>
-                        <a-tab-pane
-                            :key="item.id"
-                            :tab="item.name"
-                            v-for="item in regionList"
-                        ></a-tab-pane>
-                    </a-tabs>
-                    <a-row :gutter="[5, 5]">
-                        <a-col
-                            v-for="item in dataSource"
-                            :key="item.id"
-                            :span="4"
-                            @click.stop="itemClick(item)"
-                        >
-                            <div
-                                class="room-item check"
-                                :class="{'active': model.reserveTableList.some(t => t.id == item.id) }">
-                                <div class="select-cell"></div>
-                                <template v-if="item.state === 1">
-                                    <div>{{ item.name }}</div>
-                                    <div style="margin-top: 10px">待下单</div>
-                                    <div style="
-                margin-top: 10px;
-                display: flex;
-                justify-content: space-between;
-              ">
-                                        <div>
-                                            <a-icon type="user"/>
-                                            {{ item.userNum }}/{{ item.num }}人
-                                        </div>
-                                        <div>
-                                            <a-icon type="clock-circle"/>
-                                            {{ hours(item.orderTime) }}
-                                        </div>
-                                    </div>
-                                </template>
-                                <template v-else-if="item.state === 2 || item.state === 4">
-                                    <div>{{ item.name }}</div>
-                                    <div style="margin-top: 10px">
-                                        ¥{{ item.posOrderGoods ? item.posOrderGoods.money : 0 }}
-                                    </div>
-                                    <div style="
-                margin-top: 10px;
-                display: flex;
-                justify-content: space-between;
-              ">
-                                        <div>
-                                            <a-icon type="user"/>
-                                            {{ item.userNum }}/{{ item.num }}人
-                                        </div>
-                                        <div>
-                                            <a-icon type="clock-circle"/>
-                                            {{ hours(item.orderTime) }}
-                                        </div>
-                                    </div>
-                                </template>
-                                <template v-else>
-                                    <div>{{ item.name }}</div>
-                                    <div style="margin-top: 10px"></div>
-                                    <div style="margin-top: 10px">
-                                        <a-icon type="user"/>
-                                        {{ item.num }}人
-                                    </div>
-                                </template>
-                            </div>
+            <a-tabs v-model="tabPosRegionId" @change="tabRegionChange">
+              <a-tab-pane key="1" tab="全部"></a-tab-pane>
+              <a-tab-pane
+                :key="item.id"
+                :tab="item.name"
+                v-for="item in regionList"
+              ></a-tab-pane>
+            </a-tabs>
+            <a-row :gutter="[5, 5]">
+              <a-col
+                v-for="item in dataSource"
+                :key="item.id"
+                :span="4"
+                @click.stop="itemClick(item)"
+              >
+                <div
+                  class="room-item check"
+                  :class="{'active': model.tableIds.some(t => t == item.id) }">
+                  <div class="select-cell"></div>
+                  <template v-if="item.state === 1">
+                    <div>{{ item.name }}</div>
+                    <div style="margin-top: 10px">待下单</div>
+                    <div style="margin-top: 10px; display: flex; justify-content: space-between;">
+                      <div>
+                        <a-icon type="user"/>
+                        {{ item.userNum }}/{{ item.num }}人
+                      </div>
+                      <div>
+                        <a-icon type="clock-circle"/>
+                        {{ hours(item.orderTime) }}
+                      </div>
+                    </div>
+                  </template>
+                  <template v-else-if="item.state === 2 || item.state === 4">
+                    <div>{{ item.name }}</div>
+                    <div style="margin-top: 10px">
+                      ¥{{ item.posOrderGoods ? item.posOrderGoods.money : 0 }}
+                    </div>
+                    <div style=" margin-top: 10px; display: flex; justify-content: space-between;">
+                      <div>
+                        <a-icon type="user"/>
+                        {{ item.userNum }}/{{ item.num }}人
+                      </div>
+                      <div>
+                        <a-icon type="clock-circle"/>
+                        {{ hours(item.orderTime) }}
+                      </div>
+                    </div>
+                  </template>
+                  <template v-else>
+                    <div>{{ item.name }}</div>
+                    <div style="margin-top: 10px"></div>
+                    <div style="margin-top: 10px">
+                      <a-icon type="user"/>
+                      {{ item.num }}人
+                    </div>
+                  </template>
+                </div>
+              </a-col>
+            </a-row>
+            <a-row type="flex" justify="end" style="width: 100%">
+              <a-pagination
+                show-size-changer
+                :default-current="1"
+                :total="ipagination.total"
+                :current="ipagination.current"
+                :pageSize="ipagination.pageSize"
+                :page-size-options="ipagination.pageSizeOptions"
+                @change="pageNoChange"
+                @showSizeChange="onShowSizeChange"
+              />
+            </a-row>
+          </a-col>
+          <a-col :span="8">
+            <a-form-model ref="form" :model="model" :rules="validatorRules">
+              <a-form-model-item label="用餐时间" prop="arriveTime" :labelCol="labelCol" :wrapperCol="wrapperCol">
+                <a-date-picker
+                  format="YYYY-MM-DD HH:mm:ss"
+                  v-model="model.arriveTime"
+                  :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }"
+                />
+                <!--                            :disabled-date="disabledDate"-->
+              </a-form-model-item>
+              <a-form-model-item label="预定桌数" :labelCol="labelCol" :wrapperCol="wrapperCol">
+                <div class="cell-gap">
+                  <a-input-number disabled :value="model.tableIds.length"/>
+                  <a-button @click="orderFood">预定点餐</a-button> {{ model.posOrderGoodsDetailList ? model.posOrderGoodsDetailList.length : '' }}
+                </div>
+              </a-form-model-item>
+              <a-form-model-item label="每桌人数" prop="peopleNum" :labelCol="labelCol" :wrapperCol="wrapperCol">
+                <a-input-number v-model="model.peopleNum"></a-input-number>
+              </a-form-model-item>
+              <a-form-model-item label="预定人" prop="customerName" :labelCol="labelCol" :wrapperCol="wrapperCol">
+                <div class="cell-gap">
+                  <a-input style="flex: 1" v-model="model.customerName"></a-input>
+                  <a-radio-group v-model="model.sex">
+                    <a-radio value="1">先生</a-radio>
+                    <a-radio value="2">女士</a-radio>
+                  </a-radio-group>
+                </div>
+              </a-form-model-item>
+              <a-form-model-item  prop="phone" label="联系电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
+                <a-input v-model="model.phone"></a-input>
+              </a-form-model-item>
+              <a-form-model-item label="定金" :labelCol="labelCol" :wrapperCol="wrapperCol">
+                <a-switch v-model="model.isDeposit"></a-switch>
+              </a-form-model-item>
+              <a-form-model-item label="客人类型" prop="customerType" :labelCol="labelCol" :wrapperCol="wrapperCol">
+                <div class="cell-gap">
+                  <a-select v-model="model.customerType">
+                    <a-select-option :value="1"> 散客</a-select-option>
+                    <a-select-option :value="2"> 会员</a-select-option>
+                    <a-select-option :value="3"> 协议单位</a-select-option>
+                  </a-select>
+                  <a-auto-complete
+                    v-if="model.customerType===2"
+                    v-model="vipCustomerData.name"
+                    @select="(e) => handleSelectVip(e)"
+                    @search="handleSearchVip"
+                  >
+                    <template slot="dataSource">
+                      <a-select-option
+                        :key="item.id"
+                        :value="item.id"
+                        :label="item.name"
+                        v-for="(item, index) in busMemberCardList"
+                      >
+                        {{ item.name }}-{{ item.gradeName }}-{{ item.balance }}
+                      </a-select-option>
+                    </template>
+                  </a-auto-complete>
+                  <a-auto-complete
+                    v-if="model.customerType===3"
+                    v-model="agreementUnitData.customerName"
+                    @select="(e) => handleSelectAgreementUnit(e)"
+                    @search="handleSearchAgreementUnit"
+                  >
+                    <template slot="dataSource">
+                      <a-select-option
+                        :key="item.id"
+                        :value="item.id"
+                        :label="item.customerName"
+                        v-for="(item, index) in busMarketAgreementUnitList"
+                      >
+                        {{ item.customerName }}
+                      </a-select-option>
+                    </template>
+                  </a-auto-complete>
+                </div>
+              </a-form-model-item>
+              <a-form-model-item :wrapperCol="{ span: 24 }">
+                <a-col :span="24" v-if="model.customerType === 2">
+                  <a-card :bordered="true" style="width: 100%; padding: 0 !important">
+                    <p>
+                      <a-row>
+                        <a-col :span="8">名称:{{ vipCustomerData.name }}</a-col>
+                        <a-col :span="8">电话:{{ vipCustomerData.mobile }}</a-col>
+                        <a-col :span="8">级别:{{ vipCustomerData.gradeName }}</a-col>
+                      </a-row>
+                      <a-row>
+                        <a-col :span="8">余额:{{ vipCustomerData.balance }}</a-col>
+                        <a-col :span="8">积分:{{ vipCustomerData.integral }}</a-col>
+                        <a-col :span="8">卡号:{{ vipCustomerData.cardNo }}</a-col>
+                      </a-row>
+                    </p>
+                  </a-card>
+                </a-col>
+                <a-col :span="24" v-if="model.customerType === 3">
+                  <a-card :bordered="true" style="width: 100%; padding: 0 !important">
+                    <p>
+                      <a-row>
+                        <a-col :span="8">
+                          名称:{{ agreementUnitData.customerName }}
+                        </a-col>
+                        <a-col :span="8">
+                          电话:{{ agreementUnitData.phone }}
+                        </a-col>
+                        <a-col :span="8">
+                          可用额度:{{ agreementUnitData.balance || 0 }}
                         </a-col>
-                    </a-row>
-                    <a-row type="flex" justify="end" style="width: 100%">
-                        <a-pagination
-                            show-size-changer
-                            :default-current="1"
-                            :total="ipagination.total"
-                            :current="ipagination.current"
-                            :pageSize="ipagination.pageSize"
-                            @showSizeChange="onShowSizeChange"
-                        />
-                    </a-row>
+                      </a-row>
+                    </p>
+                  </a-card>
                 </a-col>
-                <a-col :span="8">
-                    <a-form-model :model="model">
-                        <a-form-model-item label="用餐时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                            <a-date-picker
-                                format="YYYY-MM-DD HH:mm:ss"
-                                v-model="model.diningTime"
-                                :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }"
-                            />
-                            <!--                            :disabled-date="disabledDate"-->
-                        </a-form-model-item>
-                        <a-form-model-item label="预定桌数" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                            <div class="cell-gap">
-                                <a-input-number disabled :value="model.reserveTableList.length"/>
-                                <a-button @click="orderFood">预定点餐</a-button>
-                            </div>
-                        </a-form-model-item>
-                        <a-form-model-item label="每桌人数" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                            <a-input-number v-model="model.perTableNum"></a-input-number>
-                        </a-form-model-item>
-                        <a-form-model-item label="预定人" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                            <div class="cell-gap">
-                                <a-input style="flex: 1" v-model="model.reserveName"></a-input>
-                                <a-radio-group>
-                                    <a-radio value="0">先生</a-radio>
-                                    <a-radio value="1">女士</a-radio>
-                                </a-radio-group>
-                            </div>
-                        </a-form-model-item>
-                        <a-form-model-item label="联系电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                            <a-input v-model="model.phone"></a-input>
-                        </a-form-model-item>
-                        <a-form-model-item label="定金" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                            <a-switch v-model="model.isDeposit"></a-switch>
-                        </a-form-model-item>
-                        <a-form-model-item label="客人类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                            <div class="cell-gap">
-                                <a-select v-model="model.customerType">
-                                    <a-select-option :value="1"> 散客</a-select-option>
-                                    <a-select-option :value="2"> 会员</a-select-option>
-                                    <a-select-option :value="3"> 协议单位</a-select-option>
-                                </a-select>
-                                <a-auto-complete v-if="model.customerType===2"
-                                    v-model="vipCustomerData.name"
-                                    @select="(e) => handleSelectVip(e)"
-                                    @search="handleSearchVip"
-                                >
-                                    <template slot="dataSource">
-                                        <a-select-option
-                                            :key="item.id"
-                                            :value="item.id"
-                                            :label="item.name"
-                                            v-for="(item, index) in busMemberCardList"
-                                        >
-                                            {{ item.name }}-{{ item.gradeName }}-{{ item.balance }}
-                                        </a-select-option>
-                                    </template>
-                                </a-auto-complete>
-                                <a-auto-complete v-if="model.customerType===3"
-                                                 v-model="agreementUnitData.customerName"
-                                                 @select="(e) => handleSelectAgreementUnit(e)"
-                                                 @search="handleSearchAgreementUnit"
-                                >
-                                    <template slot="dataSource">
-                                        <a-select-option
-                                            :key="item.id"
-                                            :value="item.id"
-                                            :label="item.customerName"
-                                            v-for="(item, index) in busMarketAgreementUnitList"
-                                        >
-                                            {{ item.customerName }}
-                                        </a-select-option>
-                                    </template>
-                                </a-auto-complete>
-                            </div>
-                        </a-form-model-item>
-                        <a-form-model-item :wrapperCol="{ span: 24 }">
-                            <a-col :span="24" v-if="model.customerType === 2">
-                                <a-card :bordered="true" style="width: 100%; padding: 0 !important">
-                                    <p>
-                                        <a-row>
-                                            <a-col :span="8">名称:{{ vipCustomerData.name }}</a-col>
-                                            <a-col :span="8">电话:{{ vipCustomerData.mobile }}</a-col>
-                                            <a-col :span="8">级别:{{ vipCustomerData.gradeName }}</a-col>
-                                        </a-row>
-                                        <a-row>
-                                            <a-col :span="8">余额:{{ vipCustomerData.balance }}</a-col>
-                                            <a-col :span="8">积分:{{ vipCustomerData.integral }}</a-col>
-                                            <a-col :span="8">卡号:{{ vipCustomerData.cardNo }}</a-col>
-                                        </a-row>
-                                    </p>
-                                </a-card>
-                            </a-col>
-                            <a-col :span="24" v-if="model.customerType === 3">
-                                <a-card :bordered="true" style="width: 100%; padding: 0 !important">
-                                    <p>
-                                        <a-row>
-                                            <a-col :span="8">
-                                                名称:{{ agreementUnitData.customerName }}
-                                            </a-col>
-                                            <a-col :span="8">
-                                                电话:{{agreementUnitData.phone}}
-                                            </a-col>
-                                            <a-col :span="8">
-                                                可用额度:{{ agreementUnitData.balance || 0 }}
-                                            </a-col>
-                                        </a-row>
-                                    </p>
-                                </a-card>
-                            </a-col>
-                        </a-form-model-item>
-                        <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                            <a-textarea v-model="model.remark"></a-textarea>
-                        </a-form-model-item>
-                        <a-form-model-item :wrapperCol="{ span: 24 }">
-                            <a-button type="primary" @click="submitCallback">确认预定</a-button>
-                        </a-form-model-item>
-                    </a-form-model>
+              </a-form-model-item>
+              <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
+                <a-textarea v-model="model.remark"></a-textarea>
+              </a-form-model-item>
+<!--              <a-form-model-item :wrapperCol="{ span: 24 }">-->
+<!--                <a-button type="primary" @click="submitCallback">确认预定</a-button>-->
+<!--              </a-form-model-item>-->
+            </a-form-model>
 
-                </a-col>
-            </a-row>
-        </a-card>
+          </a-col>
+        </a-row>
+      </a-card>
     </j-modal>
     <!-- <order-food ref="orderFood"></order-food> -->
-</div>
+  </div>
 </template>
 
 <script>
 
 import PosTypeForm from './PosTypeForm'
-import {getAction} from '@api/manage'
-import moment from "moment";
+import { getAction, postAction } from '@api/manage'
+import moment from 'moment'
 // import OrderFood from './OrderFood.vue'
 
 export default {
     name: 'ReserveModal',
     components: {
-        PosTypeForm,
+        PosTypeForm
         // OrderFood
     },
     data() {
         return {
-            //需要提交的表单数据
+          validatorRules: {
+              arriveTime: [{ required: true, message: '请输入用餐时间!' }],
+              peopleNum: [{ required: true, message: '请输入每桌人数!' }],
+              customerName: [{ required: true, message: '请输入预定人!' }],
+              sex: [{ required: true, message: '请选择性别!' }],
+              phone: [{ required: true, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入手机号!' }],
+              customerType: [{ required: true, message: '请选择客户类型!' }]
+            },
+
+          // 需要提交的表单数据
             model: {
-                //用餐时间
-                diningTime: '',
-                //预定桌数
-                reserveTableList: [],
-                //每桌人数
-                perTableNum: '',
-                //预定人
-                reserveName: '',
-                //联系电话
+                // 用餐时间
+                arriveTime: '',
+                // 预定桌数
+                tableIds: [],
+                // 每桌人数
+                peopleNum: '',
+                // 预定人
+                customerName: '',
+                // 性别
+                sex: '1',
+                // 联系电话
                 phone: '',
-                //是否定金
+                // 是否定金
                 isDeposit: '',
                 // 客人类型
                 customerType: '',
-                //备注
-                remark: '',
+                // 备注
+                remark: ''
             },
-            //会员卡数据
+            url: {
+              add: 'pos/posOrderGoods/addBooking',
+              edit: 'pos/posOrderGoods/editBooking'
+            },
+            // 会员卡数据
             vipCustomerData: {},
             title: '',
             width: 1500,
@@ -269,72 +279,72 @@ export default {
             disableSubmit: false,
             dataSource: [],
             labelCol: {
-                xs: {span: 24},
-                sm: {span: 4},
+                xs: { span: 24 },
+                sm: { span: 4 }
             },
             wrapperCol: {
-                xs: {span: 24},
-                sm: {span: 18},
+                xs: { span: 24 },
+                sm: { span: 18 }
             },
-            //分页
+            // 分页
             ipagination: {
                 current: 1,
                 pageSize: 10,
-                pageSizeOptions: ['10', '20', '30', '40', '50'],
-                total: 0,
+                pageSizeOptions: ['10', '20', '30'],
+                total: 0
             },
 
-            //tab
+            // tab
             posTypeList: [],
-            tabPosTypeId: "",
+            tabPosTypeId: '',
             regionList: [],
-            tabPosRegionId: "1",
-            //color
+            tabPosRegionId: '1',
+            // color
             statusColorList: [
                 {
-                    title: "全部",
-                    color: "#fff",
+                    title: '全部',
+                    color: '#fff',
                     check: true,
-                    status: -100,
+                    status: -100
                 },
                 {
-                    title: "空桌",
-                    color: "#fff",
+                    title: '空桌',
+                    color: '#fff',
                     check: false,
-                    status: 0,
+                    status: 0
                 },
                 {
-                    title: "待下单",
-                    color: "#00a0e9",
+                    title: '待下单',
+                    color: '#00a0e9',
                     check: false,
-                    status: 1,
+                    status: 1
                 },
                 {
-                    title: "待结账",
-                    color: "rgba(10, 122, 114, 1)",
+                    title: '待结账',
+                    color: 'rgba(10, 122, 114, 1)',
                     check: false,
-                    status: 2,
+                    status: 2
                 },
                 {
-                    title: "已预结",
-                    color: "rgba(172, 51, 193, 1)",
+                    title: '已预结',
+                    color: 'rgba(172, 51, 193, 1)',
                     check: false,
-                    status: 3,
+                    status: 3
                 },
                 {
-                    title: "待清台",
-                    color: "rgba(128, 128, 128, 1)",
+                    title: '待清台',
+                    color: 'rgba(128, 128, 128, 1)',
                     check: false,
-                    status: 4,
-                },
+                    status: 4
+                }
             ],
 
-            //会员 协议单位相关
+            // 会员 协议单位相关
             oldBusMemberCardList: [],
             busMemberCardList: [],
-            agreementUnitData: { customerName: "" },
+            agreementUnitData: { customerName: '' },
             busMarketAgreementUnitList: [],
-            busMarketAgreementCustomer: {},
+            busMarketAgreementCustomer: {}
             // 控制预定点餐弹框
             // foodOpen: true,
             // 控制预定点餐弹框弹出方向
@@ -342,104 +352,156 @@ export default {
         }
     },
     methods: {
-        orderFood() {
+      add(record) {
+        this.visible = true
+        // this.loadTables()
+      },
+      edit(record) {
+        console.log(record)
+        this.visible = true
+        this.model.id = record.bookingId
+        this.model.code = record.bookingCode
+        this.model.arriveTime = record.arriveTime
+        this.model.peopleNum = record.peopleNum
+        this.model.customerName = record.customerName
+        this.model.sex = record.sex + ''
+        this.model.phone = record.phone
+        this.model.isDeposit = ''
+        this.model.customerType = record.customerType
+        this.model.remark = record.remark
+        console.log(this.model)
+        getAction('pos/posOrderGoods/getBookingOrderById', { bookingId: this.model.id }).then(resp => {
+          console.log(resp, 'resp')
+          this.model.tableIds = resp.result.tableList.map(e => e.id)
+          this.model.posOrderGoodsDetailList = resp.result.posOrderGoodsDetailList;
+        })
+      },
+      orderFood() {
             // this.$refs.orderFood.edit()
-            this.$parent.handleOrderFood()
+            this.$parent.handleOrderFood(this.model.posOrderGoodsDetailList)
         },
-        moment,
-        /**
+      changeGoodsDetail(orderGoodsDetailList) {
+          console.log(orderGoodsDetailList)
+          this.model.posOrderGoodsDetailList = orderGoodsDetailList
+          this.$forceUpdate()
+        },
+      moment,
+      /**
          * 切换tab
          * @param e
          */
         tabPosTypeChange(e) {
-            this.model.reserveTableList.length = 0;
-            this.loadRegion();
+            this.model.tableIds.length = 0
+            this.loadRegion()
         },
+      // 禁用时间
         tabRegionChange(e) {
-            this.model.reserveTableList.length = 0;
-            this.loadTables();
+            this.model.tableIds.length = 0
+            this.loadTables()
         },
-        //禁用时间
+
         disabledDate(current) {
             // Can not select days before today and today
-            return current && current < moment().endOf('day');
+            return current && current < moment().endOf('day')
         },
 
         /**
          * 分页
          */
         onShowSizeChange(current, pageSize) {
-            console.log(current, pageSize);
-            this.ipagination.current = current;
-            this.ipagination.pageSize = pageSize;
-            this.loadTables();
+            this.ipagination.current = 1
+            this.ipagination.pageSize = pageSize
+            this.loadTables()
+            this.$forceUpdate()
+        },
+        /**
+         * 分页
+         */
+        pageNoChange(current, pageSize) {
+            console.log(1, pageSize)
+            this.ipagination.current = current
+            this.ipagination.pageSize = pageSize
+            this.loadTables()
+            this.$forceUpdate()
         },
 
         /**
          * 计算颜色
          */
         getStatusColor(status) {
-            var find = this.statusColorList.find((t) => t.status == status);
-            return find ? find.color : "#fff";
+            var find = this.statusColorList.find((t) => t.status == status)
+            return find ? find.color : '#fff'
         },
-
-        /**
+      /**
          * 获取tab数据
          */
         loadRegion() {
-            getAction("/pos/posRegion/list", {
-                posTypeId: this.tabPosTypeId,
+            getAction('/pos/posRegion/list', {
+                posTypeId: this.tabPosTypeId
             }).then((res) => {
                 if (res.success) {
-                    this.regionList = res.result.records;
+                    this.regionList = res.result.records
                 }
-            });
-            this.loadTables();
-        },
-
-
-        edit(record) {
-            this.visible = true
-            // this.loadTables()
+            })
+            this.loadTables()
         },
         handleOk() {
-            this.visible = false
+          let that = this
+          this.$refs.form.validate(valid => {
+            if (valid) {
+              var _info = JSON.parse(localStorage.getItem('storeInfo'));
+              let model = JSON.parse(JSON.stringify(that.model))
+              model.arriveTime = moment(model.arriveTime).format('yyyy-MM-DD HH:mm:ss')
+              model.hotelId = _info.id
+              let url = that.model.id == null ? that.url.add : that.url.edit
+              postAction(url, model).then(resp => {
+                if (resp.success) {
+                  that.$message.success(resp.message)
+                  that.$emit('clean', true)
+                  that.visible = false
+                } else {
+                  that.$message.warning('预约失败');
+                }
+              })
+            }
+          })
         },
         submitCallback() {
             this.$emit('ok')
             this.visible = false
         },
         handleCancel() {
-            this.close()
+            this.visible = false
+            this.$emit('clean')
         },
         close() {
             this.visible = false
         },
         hours(start) {
-            var beginDate = new Date(start);
-            var endDate = new Date();
-            let hours = parseInt((endDate - beginDate) / (1000 * 60 * 60));
+            var beginDate = new Date(start)
+            var endDate = new Date()
+            let hours = parseInt((endDate - beginDate) / (1000 * 60 * 60))
             let leave1 =
-                (endDate.getTime() - beginDate.getTime()) % (24 * 3600 * 1000);
-            let leave2 = leave1 % (3600 * 1000);
-            let minutes = Math.floor(leave2 / (60 * 1000));
+                (endDate.getTime() - beginDate.getTime()) % (24 * 3600 * 1000)
+            let leave2 = leave1 % (3600 * 1000)
+            let minutes = Math.floor(leave2 / (60 * 1000))
             // return minutes == 0 ? hours : hours + 1;
-            return hours.toString().padStart(2, "0") + ":" + minutes.toString().padStart(2, "0");
+            return hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0')
         },
         loadTables() {
             var obj = {
                 pageNo: this.ipagination.current,
                 pageSize: this.ipagination.pageSize,
                 posTypeId: this.tabPosTypeId,
-                state: this.state,
-            };
-            if (this.tabPosRegionId != "1") {
-                obj.posRegionId = this.tabPosRegionId;
+                state: this.state
+            }
+            if (this.tabPosRegionId != '1') {
+                obj.posRegionId = this.tabPosRegionId
             }
             getAction('/pos/posTable/tableList', obj).then((res) => {
                 if (res.success) {
-                    this.dataSource = res.result.records;
-                    this.ipagination.total = res.result.total;
+                    this.dataSource = res.result.records
+                    this.ipagination.total = res.result.total
                 }
             })
         },
@@ -448,110 +510,109 @@ export default {
          * @param item
          */
         itemClick(item) {
-            if (this.model.reserveTableList.some((t) => t.id == item.id)) {
-                this.model.reserveTableList = this.model.reserveTableList.filter(
-                    (t) => t.id != item.id
-                );
-            } else {
-                this.model.reserveTableList.push(item);
-            }
+          let index = this.model.tableIds.findIndex(t => t === item.id)
+          if (index === -1) {
+            this.model.tableIds.push(item.id)
+          } else {
+            this.model.tableIds.splice(index, 1)
+          }
         },
 
         handleSearchVip(value) {
-            let result;
+            let result
             if (!value) {
-                result = this.oldBusMemberCardList;
+                result = this.oldBusMemberCardList
             } else {
-                console.log("this.oldBusMemberCardList", this.oldBusMemberCardList);
+                console.log('this.oldBusMemberCardList', this.oldBusMemberCardList)
                 result = this.oldBusMemberCardList.filter((t) => {
                     return (
                         t.name.includes(value) ||
                         (t.cardNo && t.cardNo.includes(value)) ||
                         (t.mobile && t.mobile.includes(value))
-                    );
-                });
+                    )
+                })
             }
-            this.busMemberCardList = JSON.parse(JSON.stringify(result));
+            this.busMemberCardList = JSON.parse(JSON.stringify(result))
         },
         handleSelectVip(value) {
-            console.log(value);
-            let result = this.busMemberCardList.find((t) => t.id == value);
-            this.model.vipCustomerId = value;
-            this.vipCustomerData = JSON.parse(JSON.stringify(result));
+            console.log(value)
+            let result = this.busMemberCardList.find((t) => t.id == value)
+            this.model.vipCustomerId = value
+            this.vipCustomerData = JSON.parse(JSON.stringify(result))
             // this.vipCustomerIdChange(result.id);
         },
         handleSearchAgreementUnit(value) {
-            let result;
+            let result
             if (!value) {
-                result = this.oldBusMarketAgreementUnitList;
+                result = this.oldBusMarketAgreementUnitList
             } else {
                 result = this.oldBusMarketAgreementUnitList.filter((t) =>
                     t.customerName.includes(value)
-                );
+                )
             }
-            this.busMarketAgreementUnitList = JSON.parse(JSON.stringify(result));
+            this.busMarketAgreementUnitList = JSON.parse(JSON.stringify(result))
         },
         handleSelectAgreementUnit(value) {
-            let result = this.busMarketAgreementUnitList.find((t) => t.id == value);
-            this.model.contractTeamId = value;
-            this.agreementUnitData = JSON.parse(JSON.stringify(result));
-            this.contractTeamIdChange(value);
+            let result = this.busMarketAgreementUnitList.find((t) => t.id == value)
+            this.model.contractTeamId = value
+            this.agreementUnitData = JSON.parse(JSON.stringify(result))
+            this.contractTeamIdChange(value)
         },
         contractTeamIdChange(e) {
-            this.model.contractTeamId = e;
-            getAction("/business/busMarketAgreementCustomer/list", {
-                agreementId: this.model.contractTeamId,
+            this.model.contractTeamId = e
+            getAction('/business/busMarketAgreementCustomer/list', {
+                agreementId: this.model.contractTeamId
             }).then((res) => {
                 if (res.success) {
-                    var list = res.result.records;
+                    var list = res.result.records
                     if (list && list.length > 0) {
-                        this.model.contractTeamProtocolName = list[0].name;
-                        this.model.contractTeamProtocolId = list[0].id;
-                        this.busMarketAgreementCustomer = list[0];
+                        this.model.contractTeamProtocolName = list[0].name
+                        this.model.contractTeamProtocolId = list[0].id
+                        this.busMarketAgreementCustomer = list[0]
                     }
                 }
-            });
-        },
+            })
+        }
     },
     created() {
-        getAction("/pos/posType/list", {pageNo: 1, pageSize: 99}).then((res) => {
+        getAction('/pos/posType/list', { pageNo: 1, pageSize: 99 }).then((res) => {
             if (res.success) {
-                this.posTypeList = res.result.records;
+                this.posTypeList = res.result.records
                 if (this.posTypeList && this.posTypeList.length > 0) {
-                    this.tabPosTypeId = this.posTypeList[0].id;
-                    this.loadRegion();
+                    this.tabPosTypeId = this.posTypeList[0].id
+                    this.loadRegion()
                 }
             }
-        });
-        getAction("/business/busMemberCard/list", {
+        })
+        getAction('/business/busMemberCard/list', {
             pageSize: 99999,
-            pageNo: 1,
+            pageNo: 1
         }).then((res) => {
             if (res.success) {
-                this.busMemberCardList = res.result.records;
+                this.busMemberCardList = res.result.records
                 this.oldBusMemberCardList = JSON.parse(
                     JSON.stringify(this.busMemberCardList)
-                );
+                )
                 if (this.model.vipCustomerId) {
-                    this.handleSelectVip(this.model.vipCustomerId);
+                    this.handleSelectVip(this.model.vipCustomerId)
                 }
             }
-            this.confirmLoading = false;
-        });
-        getAction("/business/busMarketAgreementUnit/list", {
+            this.confirmLoading = false
+        })
+        getAction('/business/busMarketAgreementUnit/list', {
             pageSize: 99999,
-            pageNo: 1,
+            pageNo: 1
         }).then((res) => {
             if (res.success) {
-                this.busMarketAgreementUnitList = res.result.records;
+                this.busMarketAgreementUnitList = res.result.records
                 this.oldBusMarketAgreementUnitList = JSON.parse(
                     JSON.stringify(res.result.records)
-                );
+                )
                 if (this.model.contractTeamId && this.model.contractTeamProtocolId) {
-                    this.handleSelectAgreementUnit(this.model.contractTeamId);
+                    this.handleSelectAgreementUnit(this.model.contractTeamId)
                 }
             }
-        });
+        })
     }
 }
 </script>

+ 102 - 0
src/views/pos/modules/bookingOpenModal.vue

@@ -0,0 +1,102 @@
+<template>
+  <div >
+    <a-modal
+        title="是否继续开台"
+        :width="800"
+        :visible="visible"
+        switchFullscreen
+        @ok="handleOk"
+        :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+        @cancel="handleCancel"
+        footer
+        >
+      <a-row>
+        <p style="color: red">{{ tableInfo.name }}桌台已存在预订,为避免客人用餐冲突,请再次确认</p>
+        <a-col>
+          <a-card v-for="record in bookingOrderList" style="margin: 20px" v-if="visible">
+            <p>预定人:{{ record.customerName }}</p>
+            <p>预定联系方式:{{ record.phone }}</p>
+            <p>预定就餐时间:{{ record.arriveTime }}</p>
+            <p>预定人数:{{ record.peopleNum }}</p>
+            <p>预定单号:{{ record.code }}</p>
+            <a-button @click="bookingOpen(record)" :loading="loading" style="width: 100%; color: #85d289">预定开台</a-button>
+          </a-card>
+        </a-col>
+        <a-col :span="12" style="padding: 5px">
+          <a-button @click="handleCancel" style="width: 100%;  color: #8ecaf6">取消开台</a-button>
+        </a-col>
+        <a-col :span="12" style="padding: 5px">
+          <a-button @click="newOpen" style="width: 100%;  color: #f56c6c">继续开台</a-button>
+        </a-col>
+      </a-row>
+    </a-modal>
+    <!-- <order-food ref="orderFood"></order-food> -->
+  </div>
+</template>
+
+<script>
+
+import { getAction } from '@api/manage'
+
+export default {
+  name: 'BookingOpenModel',
+  components: {
+  },
+  data() {
+    return {
+      visible: false,
+      loading: false,
+      tableInfo: {},
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 4 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 18 }
+      },
+      bookingOrderList: []
+    }
+  },
+  methods: {
+    edit(record) {
+      this.visible = true
+      this.$nextTick(() => {
+        this.tableInfo = record
+        getAction('pos/posOrderGoods/getBookingByTableId', { tableId: record.id }).then(resp => {
+          this.bookingOrderList = resp.result
+        })
+      })
+    },
+    handleOk() {
+
+    },
+    handleCancel() {
+      this.visible = false
+    },
+    bookingOpen(record) {
+      this.loading = true
+      getAction('/pos/posOrderGoods/addOrderByBookingId', { bookingId: record.id }).then(resp => {
+        if (resp.success) {
+          this.$message.success('开台成功')
+          this.$emit('ok')
+          this.visible = false
+        } else {
+          this.$message.warning('开台失败')
+        }
+      }).finally(e => {
+        this.loading = false
+      })
+    },
+    newOpen() {
+      this.$emit('newOpen', this.tableInfo)
+      this.visible = false
+    }
+  },
+  created() {
+
+  }
+}
+</script>
+<style>
+</style>

+ 240 - 158
src/views/pos/reserve.vue

@@ -25,15 +25,14 @@
             <a-form-item label="预订单状态">
               <a-select
                 ref="select"
-                v-model:value="orderStatus"
+                v-model="queryParam.state"
                 style="width: 150px"
-                @focus="focus"
                 @change="handleChange"
               >
-                <a-select-option value="jack">Jack</a-select-option>
-                <a-select-option value="lucy">Lucy</a-select-option>
-                <a-select-option value="disabled" disabled>Disabled</a-select-option>
-                <a-select-option value="Yiminghe">yiminghe</a-select-option>
+                <a-select-option value="1">未到店</a-select-option>
+                <a-select-option value="2">已到店</a-select-option>
+                <a-select-option value="3">已退款</a-select-option>
+                <a-select-option value="4">已逾期</a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
@@ -41,15 +40,11 @@
             <a-form-item label="POS类型">
               <a-select
                 ref="select"
-                v-model:value="orderStatus"
+                v-model="queryParam.posType"
                 style="width: 150px"
-                @focus="focus"
                 @change="handleChange"
               >
-                <a-select-option value="jack">Jack</a-select-option>
-                <a-select-option value="lucy">Lucy</a-select-option>
-                <a-select-option value="disabled" disabled>Disabled</a-select-option>
-                <a-select-option value="Yiminghe">yiminghe</a-select-option>
+                <a-select-option v-for="item in posTypeList" :value="item.id">{{ item.name }}</a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
@@ -57,9 +52,8 @@
             <a-form-item label="餐段">
               <a-select
                 ref="select"
-                v-model:value="orderStatus"
+                v-model="orderStatus"
                 style="width: 150px"
-                @focus="focus"
                 @change="handleChange"
               >
                 <a-select-option value="jack">Jack</a-select-option>
@@ -71,52 +65,35 @@
           </a-col>
           <a-col :span="4">
               <a-form-item label="预定单号">
-                <j-input
+                <a-input
                     placeholder="请输入预定单号"
-                    v-model="queryParam.tableNo"
-                ></j-input>
+                    v-model="queryParam.bookingCode"
+                ></a-input>
               </a-form-item>
             </a-col>
-            <a-col :span="4">
-            <a-form-item label="操作员">
-              <a-select
-                ref="select"
-                v-model:value="orderStatus"
-                style="width: 150px"
-                @focus="focus"
-                @change="handleChange"
-              >
-                <a-select-option value="jack">Jack</a-select-option>
-                <a-select-option value="lucy">Lucy</a-select-option>
-                <a-select-option value="disabled" disabled>Disabled</a-select-option>
-                <a-select-option value="Yiminghe">yiminghe</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
           <a-col :span="4">
             <a-form-item label="顾客姓名">
-              <j-input
+              <a-input
                   placeholder="请输入顾客姓名"
-                  v-model="queryParam.tableNo"
-              ></j-input>
+                  v-model="queryParam.customerName"
+              ></a-input>
             </a-form-item>
           </a-col>
           <a-col :span="4">
             <a-form-item label="顾客手机号">
-              <j-input
+              <a-input
                   placeholder="请输入顾客手机号"
-                  v-model="queryParam.tableNo"
-              ></j-input>
+                  v-model="queryParam.phone"
+              ></a-input>
             </a-form-item>
           </a-col>
             <a-col :span="2">
             <span>
               <a-button
                   type="primary"
-                  @click=""
+                  @click="loadData"
                   icon="search"
-              >查询</a-button
-              >
+              >查询</a-button>
             </span>
             </a-col>
             <a-col :span="2">
@@ -139,23 +116,33 @@
         <a-table
             ref="table"
             size="middle"
-            :scroll="{ x: true }"
             bordered
             rowKey="id"
             :columns="columns"
+            :scroll="{ x: 1800, y: 300 }"
             :dataSource="dataSource"
             :pagination="ipagination"
             :loading="loading"
             class="j-table-force-nowrap"
             @change="handleTableChange"
         >
-
+          <span slot="action" slot-scope="text, record">
+            <a v-if="record.state === 1" @click="bookingOpening(record)">开台</a>
+            <a-divider v-if="record.state === 1" type="vertical"/>
+            <a v-if="record.state === 1" @click="editReserve(record)">修改</a>
+            <a-divider v-if="record.state === 1" type="vertical"/>
+            <a v-if="record.state === 1" @click="unsubscribe(record)">退订</a>
+            <a-divider v-if="record.state === 1" type="vertical"/>
+            <a >入账</a>
+            <a-divider v-if="record.state === 1" type="vertical"/>
+            <a v-if="record.state === 1" @click="overdue(record)">逾期</a>
+          </span>
         </a-table>
       </div>
     </a-card>
-    
-    <reserve-modal ref="reserveModal"></reserve-modal>
-    <order-food ref="orderFoodModel"></order-food>
+
+    <reserve-modal ref="reserveModal" @clean="clearModelDate" v-if="isShow"></reserve-modal>
+    <order-food ref="orderFoodModel" @ok="chooseGoodsOk" v-if="isShow"></order-food>
     <!-- <a-drawer :width="500" title="Basic Drawer" placement="right" :visible="foodOpen"  @close="onClose">
         <p>Some contents...</p>
         <p>Some contents...</p>
@@ -169,110 +156,10 @@ import { JeecgListMixin } from "@/mixins/JeecgListMixin";
 import { mixinDevice } from '@/utils/mixin'
 import ReserveModal from '@views/pos/modules/ReserveModal'
 import OrderFood from './modules/OrderFood.vue'
-
-const columns = [
-  // {
-  //   title: '预定单号',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '预订单状态',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '就餐时间',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '桌数',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '合计价格',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '定金',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '创建时间',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-
-
-
-  {
-    title: '预定单号',
-    align: 'center',
-    dataIndex: 'code'
-  },
-  // {
-  //   title: '预订单状态',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: 'pos类型',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '来源',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '预定就餐时间',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '餐段',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '预定桌数',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '预定菜品合计价格(元)',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '订金金额(元)',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '顾客名字',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '性别',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // },
-  // {
-  //   title: '电话',
-  //   align: 'center',
-  //   dataIndex: 'code'
-  // }
-]
+import { getAction, postAction } from '@api/manage'
 
 export default {
-  components: { 
+  components: {
     ReserveModal,
     OrderFood
   },
@@ -281,34 +168,229 @@ export default {
   data() {
 
     return {
+      isShow: true,
       // foodOpen: true,
-      queryParam: {},
+      posTypeList: [],
+      // ipagination: {
+      //   current: 1,
+      //   pageSize: 10,
+      //   pageSizeOptions: ['10', '20', '30'],
+      //   showTotal: (total, range) => {
+      //     return range[0] + '-' + range[1] + ' 共' + total + '条'
+      //   },
+      //   showQuickJumper: true,
+      //   showSizeChanger: true,
+      //   total: 0
+      // },
       datetime: [],
-      columns: columns,
+      columns: [
+        {
+          title: '预定单号',
+          align: 'center',
+          dataIndex: 'bookingCode',
+          width: 200,
+          fixed: 'left'
+        },
+        {
+          title: '预订单状态',
+          align: 'center',
+          dataIndex: 'state',
+          width: 100,
+          fixed: 'left',
+          customRender: function (text, record) {
+            if (text === 1) {
+              return '未到店'
+            } else if (text === 2) {
+              return '已到店'
+            } else if (text === 3) {
+              return '已退款'
+            } else if (text === 4) {
+              return '已逾期'
+            }
+          }
+        },
+        {
+          title: 'pos类型',
+          align: 'center',
+          dataIndex: 'posType',
+          width: 100,
+          fixed: 'left',
+          customRender: (text, record) => {
+            return this.getPosTypeText(record)
+          }
+        },
+        {
+          title: '来源',
+          align: 'center',
+          width: 100,
+          key: '1',
+          customRender: function (text, record) {
+            if (text === 1) {
+              return '未到店'
+            } else if (text === 2) {
+              return '未到店'
+            } else if (text === 3) {
+              return '已退款'
+            } else if (text === 4) {
+              return '已逾期'
+            }
+          }
+        },
+        {
+          title: '预定就餐时间',
+          width: 150,
+          key: '2',
+          align: 'center',
+          dataIndex: 'arriveTime'
+        },
+        {
+          title: '餐段',
+          width: 100,
+          key: '3',
+          align: 'center',
+          customRender: function (text, record) {
+            return '未定义'
+          }
+        },
+        {
+          title: '预定桌数',
+          width: 100,
+          key: '4',
+          align: 'center',
+          // dataIndex: 'code'
+          customRender: function (text, record) {
+            return '--'
+          }
+        },
+        {
+          title: '预定菜品合计价格(元)',
+          width: 150,
+          dataIndex: 'money',
+          key: '5',
+          align: 'center'
+        },
+        {
+          title: '订金金额(元)',
+          width: 100,
+          key: '6',
+          align: 'center',
+          // dataIndex: 'code'
+        },
+        {
+          title: '顾客名字',
+          width: 100,
+          key: '7',
+          align: 'center',
+          dataIndex: 'customerName'
+        },
+        {
+          title: '性别',
+          width: 100,
+          key: '8',
+          align: 'center',
+          dataIndex: 'sex'
+        },
+        {
+          title: '电话',
+          key: '9',
+          // width: 100,
+          align: 'center',
+          dataIndex: 'phone'
+        },
+        {
+          title: '操作',
+          key: 'operation',
+          fixed: 'right',
+          scopedSlots: { customRender: 'action' },
+          width: 230
+        }
+      ],
       // 预定时间tab
       presetTimeTab: 'small',
       // 预订单状态
-      orderStatus: ''
+      orderStatus: '',
+      url: {
+        list: 'pos/posOrderGoods/getBookingPage'
+      },
 
     }
   },
+  created() {
+    getAction('pos/posType/list').then(resp => {
+      this.posTypeList = resp.result.records
+    })
+
+  },
   methods: {
+    handleChange() {},
     onClose() {
 
     },
+    getPosTypeText(record) {
+      console.log(this.posTypeList.length, 'posTypeList.length====================')
+      var find = this.posTypeList.find((t) => t.id === record.posType)
+      return find ? find.name : '--'
+    },
     onChange(e, dateString) {
       this.queryParam.startTime = dateString[0]
       this.queryParam.endTime = dateString[1]
     },
-    handleTableChange() {
-
-    },
     addReserve() {
-      this.$refs.reserveModal.edit()
+      this.$refs.reserveModal.add()
+    },
+    /** 修改预定 */
+    editReserve(record) {
+      this.$refs.reserveModal.edit(record)
+    },
+    /** 退订  */
+    unsubscribe(record) {
+      getAction('pos/posOrderGoods/removeBooking', { id: record.id, remark: '' }).then(resp => {
+        if (resp.success) {
+          this.$message.success('退订成功')
+          this.loadData()
+        } else {}
+          this.$message.warning('退订失败')
+      })
     },
-    handleOrderFood() {
-        this.$refs.orderFoodModel.edit()
+    /** 开台 */
+    bookingOpening(record) {
+      getAction('/pos/posOrderGoods/addOrderByBookingId', { bookingId: record.bookingId }).then(resp => {
+        if (resp.success) {
+          this.$message.success('开台成功')
+          this.loadData()
+        } else {
+          this.$message.warning('开台失败')
+        }
+      })
     },
+    /** 逾期 */
+    overdue(record) {
+      getAction('pos/posOrderGoods/overTimeBooking', { bookingOrderId: record.bookingId }).then(resp => {
+        if (resp.success) {
+          this.$message.success('置逾期成功')
+          this.loadData()
+        } else {
+          this.$message.warning('置逾期失败')
+        }
+      })
+    },
+    handleOrderFood(orderGoodsDetailList) {
+        this.$refs.orderFoodModel.edit(orderGoodsDetailList)
+    },
+    chooseGoodsOk(e) {
+      // this.model.posOrderGoodsDetailList = e;
+      this.$refs.reserveModal.changeGoodsDetail(e)
+    },
+    clearModelDate(isOk) {
+      if (isOk) {
+        this.loadData()
+      }
+      // 清除弹窗
+      this.isShow = false
+      setTimeout(() => {
+        this.isShow = true
+      },500)
+    }
   }
 }
 

+ 220 - 215
src/views/pos/tablediandangallery.vue

@@ -48,7 +48,7 @@
           <div class="select-cell"></div>
           <template v-if="item.state === 1">
             <!-- <div v-if="item.posOrderGoods !== null && item.posOrderGoods.teamId !== null && item.posOrderGoods.teamId !== ''">111</div> -->
-            <div>{{ item.name }}</div>
+            <div>{{ item.name }}&nbsp;&nbsp; {{ item.isBooking ? '预定' : '' }}</div>
             <div style="margin-top: 10px">待下单</div>
             <div
               style="
@@ -88,7 +88,7 @@
             </div></template
           >
           <template v-else>
-            <div>{{ item.name }}</div>
+            <div>{{ item.name }}&nbsp;&nbsp; {{ item.isBooking ? '预定' : '' }}</div>
             <div style="margin-top: 10px"></div>
             <div style="margin-top: 10px">
               <a-icon type="user" />{{ item.num }}人
@@ -99,56 +99,50 @@
     </a-row>
     <payment-modal ref="modalPaymentForm" @ok="modalFormOk"></payment-modal>
     <goods-modal ref="modalGoodsForm" @ok="modalFormOk2"></goods-modal>
-    <picking-goods-order-modal
-      ref="modalPickingGoodsOrderForm"
-      @ok="modalPickingGoodsOrderFormOk"
-    ></picking-goods-order-modal>
-    <select-check-in-room-order-modal
-      ref="modalSelectCheckInRoomOrderModal"
-      @ok="modalSelectCheckInRoomOrderFormOk"
-    ></select-check-in-room-order-modal>
-    <user-num-modal
-      ref="modalUserNmumForm"
-      @ok="modalUserNmumFormOk"
-    ></user-num-modal>
+    <picking-goods-order-modal ref="modalPickingGoodsOrderForm" @ok="modalPickingGoodsOrderFormOk" ></picking-goods-order-modal>
+    <select-check-in-room-order-modal ref="modalSelectCheckInRoomOrderModal" @ok="modalSelectCheckInRoomOrderFormOk"></select-check-in-room-order-modal>
+    <user-num-modal ref="modalUserNmumForm" @ok="modalUserNmumFormOk"></user-num-modal>
+    <booking-open-model ref="bookingOpenModel" @ok="bookingOpenModelOk" @newOpen="newOpen"></booking-open-model>
   </a-card>
 </template>
 
   <script>
 // import { JeecgListMixin } from "@/mixins/JeecgListMixin";
 // import PosRegionModal from "./modules/PosRegionModal";
-import { filterObj } from "@/utils/util";
-import { getAction, postAction, deleteAction } from "@/api/manage";
-import PaymentModal from "./modules/PaymentModal.vue";
-import goodsModal from "./modules/goodStock/goodsModal.vue";
-import PickingGoodsOrderModal from "./modules/PickingGoodsOrderModal.vue";
-import SelectCheckInRoomOrderModal from "./modules/SelectCheckInRoomOrderModal.vue";
-import UserNumModal from "./modules/UserNumModal.vue";
-import { computed } from "vue";
-import { tree } from "@/api/good";
+import { filterObj } from '@/utils/util'
+import { getAction, postAction, deleteAction } from '@/api/manage'
+import PaymentModal from './modules/PaymentModal.vue'
+import goodsModal from './modules/goodStock/goodsModal.vue'
+import PickingGoodsOrderModal from './modules/PickingGoodsOrderModal.vue'
+import SelectCheckInRoomOrderModal from './modules/SelectCheckInRoomOrderModal.vue'
+import UserNumModal from './modules/UserNumModal.vue'
+import { computed } from 'vue'
+import { tree } from '@/api/good'
+import BookingOpenModel from '@views/pos/modules/bookingOpenModal'
 const columns = [
   {
-    title: "商品名称",
-    dataIndex: "name",
+    title: '商品名称',
+    dataIndex: 'name'
   },
   {
-    title: "数量",
-    dataIndex: "num",
-    scopedSlots: { customRender: "num" },
+    title: '数量',
+    dataIndex: 'num',
+    scopedSlots: { customRender: 'num' }
   },
   {
-    title: "售价",
-    dataIndex: "sellingPrice",
-  },
-];
+    title: '售价',
+    dataIndex: 'sellingPrice'
+  }
+]
 export default {
-  name: "memberList",
+  name: 'MemberList',
   components: {
+    BookingOpenModel,
     PaymentModal,
     goodsModal,
     PickingGoodsOrderModal,
     SelectCheckInRoomOrderModal,
-    UserNumModal,
+    UserNumModal
   },
   data() {
     return {
@@ -159,271 +153,271 @@ export default {
       ipagination: {
         current: 1,
         pageSize: 99999,
-        pageSizeOptions: ["10", "20", "30"],
+        pageSizeOptions: ['10', '20', '30'],
         showTotal: (total, range) => {
-          return range[0] + "-" + range[1] + " 共" + total + "条";
+          return range[0] + '-' + range[1] + ' 共' + total + '条'
         },
         showQuickJumper: true,
         showSizeChanger: true,
-        total: 0,
+        total: 0
       },
       url: {
-        list: "/pos/posSellClearGoods/list",
-        delete: "/pos/posSellClearGoods/delete",
-        deleteBatch: "/pos/posSellClearGoods/deleteBatch",
-        exportXlsUrl: "/pos/posSellClearGoods/exportXls",
-        importExcelUrl: "pos/posSellClearGoods/importExcel",
+        list: '/pos/posSellClearGoods/list',
+        delete: '/pos/posSellClearGoods/delete',
+        deleteBatch: '/pos/posSellClearGoods/deleteBatch',
+        exportXlsUrl: '/pos/posSellClearGoods/exportXls',
+        importExcelUrl: 'pos/posSellClearGoods/importExcel'
       },
       dictOptions: {},
       superFieldList: [],
       selectedRowKeys: [],
       isorter: {
-        column: "createTime",
-        order: "desc",
+        column: 'createTime',
+        order: 'desc'
       },
       treeData: [],
       selectGoods: {},
       posTypeList: [],
-      tabPosTypeId: "",
+      tabPosTypeId: '',
       selectGoodsList: [],
       regionList: [],
-      tabPosRegionId: "1",
+      tabPosRegionId: '1',
       dataSource: [],
       oldSelectGoodsList: [],
       selectOrderInfo: {},
       selectRoomOrder: {},
       statusColorList: [
         {
-          title: "全部",
-          color: "#fff",
+          title: '全部',
+          color: '#fff',
           check: true,
-          status: -100,
+          status: -100
         },
         {
-          title: "空桌",
-          color: "#fff",
+          title: '空桌',
+          color: '#fff',
           check: false,
-          status: 0,
+          status: 0
         },
         {
-          title: "待下单",
-          color: "#00a0e9",
+          title: '待下单',
+          color: '#00a0e9',
           check: false,
-          status: 1,
+          status: 1
         },
         {
-          title: "待结账",
-          color: "rgba(10, 122, 114, 1)",
+          title: '待结账',
+          color: 'rgba(10, 122, 114, 1)',
           check: false,
-          status: 2,
+          status: 2
         },
         {
-          title: "已预结",
-          color: "rgba(172, 51, 193, 1)",
+          title: '已预结',
+          color: 'rgba(172, 51, 193, 1)',
           check: false,
-          status: 3,
+          status: 3
         },
         {
-          title: "待清台",
-          color: "rgba(128, 128, 128, 1)",
+          title: '待清台',
+          color: 'rgba(128, 128, 128, 1)',
           check: false,
-          status: 4,
-        },
+          status: 4
+        }
       ],
       state: undefined,
-      selectTable: {},
-    };
+      selectTable: {}
+    }
   },
   provide() {
     return {
-      treeData: computed(() => this.treeData),
-    };
+      treeData: computed(() => this.treeData)
+    }
   },
   computed: {
     sum() {
       return this.selectGoodsList.reduce(function (total, item) {
-        return total + item.num;
-      }, 0);
+        return total + item.num
+      }, 0)
     },
     amount() {
       return this.selectGoodsList.reduce(function (total, item) {
-        return total + item.sellingPrice * item.num;
-      }, 0);
+        return total + item.sellingPrice * item.num
+      }, 0)
     },
     btnDisabled() {
-      var res = this.selectGoodsList && this.selectGoodsList.length > 0;
-      return !res;
-    },
+      var res = this.selectGoodsList && this.selectGoodsList.length > 0
+      return !res
+    }
   },
   created() {
-    console.log("created");
-    this.dataSource = [{ id: "0" }];
-    getAction("/pos/posType/list", { pageNo: 1, pageSize: 99 }).then((res) => {
+    console.log('created')
+    this.dataSource = [{ id: '0' }]
+    getAction('/pos/posType/list', { pageNo: 1, pageSize: 99 }).then((res) => {
       if (res.success) {
-        this.posTypeList = res.result.records;
+        this.posTypeList = res.result.records
         if (this.posTypeList && this.posTypeList.length > 0) {
-          this.tabPosTypeId = this.posTypeList[0].id;
-          this.loadRegion();
+          this.tabPosTypeId = this.posTypeList[0].id
+          this.loadRegion()
         }
       }
-    });
+    })
   },
   activated() {
-    console.log("activated");
-    this.dataSource = [{ id: "0" }];
-    getAction("/pos/posType/list", { pageNo: 1, pageSize: 99 }).then((res) => {
+    console.log('activated')
+    this.dataSource = [{ id: '0' }]
+    getAction('/pos/posType/list', { pageNo: 1, pageSize: 99 }).then((res) => {
       if (res.success) {
-        this.posTypeList = res.result.records;
+        this.posTypeList = res.result.records
         if (this.posTypeList && this.posTypeList.length > 0) {
-          this.tabPosTypeId = this.posTypeList[0].id;
-          this.loadRegion();
+          this.tabPosTypeId = this.posTypeList[0].id
+          this.loadRegion()
         }
       }
-    });
+    })
   },
   methods: {
     hours(start) {
-      var beginDate = new Date(start);
-      var endDate = new Date();
-      let hours = parseInt((endDate - beginDate) / (1000 * 60 * 60));
+      var beginDate = new Date(start)
+      var endDate = new Date()
+      let hours = parseInt((endDate - beginDate) / (1000 * 60 * 60))
       let leave1 =
-        (endDate.getTime() - beginDate.getTime()) % (24 * 3600 * 1000);
-      let leave2 = leave1 % (3600 * 1000);
-      let minutes = Math.floor(leave2 / (60 * 1000));
+        (endDate.getTime() - beginDate.getTime()) % (24 * 3600 * 1000)
+      let leave2 = leave1 % (3600 * 1000)
+      let minutes = Math.floor(leave2 / (60 * 1000))
       // return minutes == 0 ? hours : hours + 1;
-      return hours.toString().padStart(2, "0") + ":" + minutes.toString().padStart(2, "0");
+      return hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0')
     },
     getStatusColor(status) {
-      var find = this.statusColorList.find((t) => t.status == status);
-      return find ? find.color : "#fff";
+      var find = this.statusColorList.find((t) => t.status == status)
+      return find ? find.color : '#fff'
     },
     loadTree() {
-      var that = this;
+      var that = this
       tree().then((res) => {
         if (res.success) {
-          this.treeData = res.result;
+          this.treeData = res.result
         }
-      });
+      })
     },
     modalFormOk() {},
     modalFormOk2(e) {
-      console.log(e);
-      var good = JSON.parse(JSON.stringify(e));
-      this.$set(good, "num", 1);
-      this.selectGoodsList.push(good);
+      console.log(e)
+      var good = JSON.parse(JSON.stringify(e))
+      this.$set(good, 'num', 1)
+      this.selectGoodsList.push(good)
     },
     modalSelectCheckInRoomOrderFormOk(e) {
-      console.log(e);
-      this.selectRoomOrder = e;
+      console.log(e)
+      this.selectRoomOrder = e
     },
     modalPickingGoodsOrderFormOk(e) {
-      console.log(e);
+      console.log(e)
       if (e && e.orderDetailList && e.orderDetailList.length > 0) {
-        this.selectOrderInfo = e.orderInfo;
+        this.selectOrderInfo = e.orderInfo
         e.orderDetailList.forEach((t) => {
-          t.sellingPrice = t.payMoney;
-          t.name = t.goodsName;
-          t.id = t.goodsId;
-        });
-        this.selectGoodsList = e.orderDetailList;
+          t.sellingPrice = t.payMoney
+          t.name = t.goodsName
+          t.id = t.goodsId
+        })
+        this.selectGoodsList = e.orderDetailList
       }
     },
     numChange(e, index) {
-      console.log(e);
+      console.log(e)
       if (e <= 0) {
-        this.selectGoodsList.splice(index, 1);
+        this.selectGoodsList.splice(index, 1)
       }
     },
     handleClear() {
-      this.selectGoodsList = [];
+      this.selectGoodsList = []
       // this.selectOrderInfo = {};
     },
     tabPosTypeChange(e) {
-      this.loadRegion();
+      this.loadRegion()
     },
     tabRegionChange(e) {
-      this.loadTables();
+      this.loadTables()
     },
     statusClick(index) {
       this.statusColorList.forEach((t) => {
         if (t.check) {
-          t.check = false;
+          t.check = false
         }
-      });
-      this.statusColorList[index].check = true;
+      })
+      this.statusColorList[index].check = true
       if (index === 0) {
-        this.state = undefined;
+        this.state = undefined
       } else {
-        this.state = this.statusColorList[index].status;
+        this.state = this.statusColorList[index].status
       }
-      this.loadTables();
+      this.loadTables()
     },
     loadRegion() {
-      getAction("/pos/posRegion/list", {
-        posTypeId: this.tabPosTypeId,
+      getAction('/pos/posRegion/list', {
+        posTypeId: this.tabPosTypeId
       }).then((res) => {
         if (res.success) {
-          this.regionList = res.result.records;
+          this.regionList = res.result.records
         }
-      });
-      this.loadTables();
+      })
+      this.loadTables()
     },
     loadTables() {
       var obj = {
         pageNo: 1,
         pageSize: 99999,
         posTypeId: this.tabPosTypeId,
-        state: this.state,
-      };
-      if (this.tabPosRegionId != "1") {
-        obj.posRegionId = this.tabPosRegionId;
+        state: this.state
+      }
+      if (this.tabPosRegionId != '1') {
+        obj.posRegionId = this.tabPosRegionId
       }
-      getAction("/pos/posTable/tableList", obj).then((res) => {
-        console.log(res);
+      getAction('/pos/posTable/tableList', obj).then((res) => {
+        console.log(res)
         if (res.success) {
-          this.dataSource = res.result.records;
+          this.dataSource = res.result.records
         }
-        console.log(this.dataSource);
-      });
+        console.log(this.dataSource)
+      })
     },
     handleDelete() {
-      deleteAction("/pos/posSellClearGoods/delete", {
-        goodsId: this.selectGoods.id,
+      deleteAction('/pos/posSellClearGoods/delete', {
+        goodsId: this.selectGoods.id
       })
         .then((res) => {
           if (res.success) {
-            this.$message.success(res.message);
-            this.loadData();
-            this.sellClear = 0;
+            this.$message.success(res.message)
+            this.loadData()
+            this.sellClear = 0
           } else {
-            this.$message.warning(res.message);
+            this.$message.warning(res.message)
           }
         })
-        .finally(() => {});
+        .finally(() => {})
     },
     handleSelectCheckInRoomOrder() {
-      this.$refs.modalSelectCheckInRoomOrderModal.add();
-      this.$refs.modalSelectCheckInRoomOrderModal.title = "选择转帐人";
-      this.$refs.modalSelectCheckInRoomOrderModal.disableSubmit = false;
+      this.$refs.modalSelectCheckInRoomOrderModal.add()
+      this.$refs.modalSelectCheckInRoomOrderModal.title = '选择转帐人'
+      this.$refs.modalSelectCheckInRoomOrderModal.disableSubmit = false
     },
     handlePickingGoodsOrder() {
-      this.$refs.modalPickingGoodsOrderForm.add();
-      this.$refs.modalPickingGoodsOrderForm.title = "取单";
-      this.$refs.modalPickingGoodsOrderForm.disableSubmit = false;
+      this.$refs.modalPickingGoodsOrderForm.add()
+      this.$refs.modalPickingGoodsOrderForm.title = '取单'
+      this.$refs.modalPickingGoodsOrderForm.disableSubmit = false
     },
     handleAddTempGoods() {
-      this.$refs.modalGoodsForm.add();
-      this.$refs.modalGoodsForm.title = "新增菜品";
-      this.$refs.modalGoodsForm.disableSubmit = false;
+      this.$refs.modalGoodsForm.add()
+      this.$refs.modalGoodsForm.title = '新增菜品'
+      this.$refs.modalGoodsForm.disableSubmit = false
     },
     handleToRoomFeePayment() {
-      this.handleAdd();
+      this.handleAdd()
     },
     handlePayment() {
       this.handleAdd((e) => {
         var amount = this.oldSelectGoodsList.reduce(function (total, item) {
-          return total + item.sellingPrice * item.num;
-        }, 0);
+          return total + item.sellingPrice * item.num
+        }, 0)
         this.$refs.modalPaymentForm.edit({
           billAmount: amount,
           deposit: 0,
@@ -433,90 +427,101 @@ export default {
           preferentialType: 1,
           couponFirstAmount: 0,
           discount: 9,
-          orderCode: e,
-        });
-        this.$refs.modalPaymentForm.title = "POS结账";
-        this.$refs.modalPaymentForm.disableSubmit = false;
-      });
+          orderCode: e
+        })
+        this.$refs.modalPaymentForm.title = 'POS结账'
+        this.$refs.modalPaymentForm.disableSubmit = false
+      })
     },
     handleAdd(callback) {
       if (!this.selectGoodsList || this.selectGoodsList.length <= 0) {
-        this.$message.warning("请先选择商品");
-        return;
+        this.$message.warning('请先选择商品')
+        return
       }
-      var _info = JSON.parse(localStorage.getItem("storeInfo"));
-      var model = { goodsId: this.selectGoods.id };
+      var _info = JSON.parse(localStorage.getItem('storeInfo'))
+      var model = { goodsId: this.selectGoods.id }
       if (_info) {
-        model.hotelId = _info.id;
+        model.hotelId = _info.id
       }
-      model.id = this.selectOrderInfo.id;
-      model.toRoomFeeOrderId = this.selectRoomOrder.id;
-      model.posType = this.tabPosTypeId;
-      var posOrderGoodsDetailList = [];
+      model.id = this.selectOrderInfo.id
+      model.toRoomFeeOrderId = this.selectRoomOrder.id
+      model.posType = this.tabPosTypeId
+      var posOrderGoodsDetailList = []
       this.selectGoodsList.forEach((t) => {
         posOrderGoodsDetailList.push({
           goodsId: t.id,
           num: t.num,
-          money: t.sellingPrice,
-        });
-      });
-      model.posOrderGoodsDetailList = posOrderGoodsDetailList;
-      postAction("/pos/posOrderGoods/add", model)
+          money: t.sellingPrice
+        })
+      })
+      model.posOrderGoodsDetailList = posOrderGoodsDetailList
+      postAction('/pos/posOrderGoods/add', model)
         .then((res) => {
           if (res.success) {
-            this.$message.success(res.message);
+            this.$message.success(res.message)
             this.oldSelectGoodsList = JSON.parse(
               JSON.stringify(this.selectGoodsList)
-            );
-            this.selectGoodsList = [];
-            this.selectOrderInfo = {};
-            this.selectRoomOrder = {};
-            this.loadGoods();
+            )
+            this.selectGoodsList = []
+            this.selectOrderInfo = {}
+            this.selectRoomOrder = {}
+            this.loadGoods()
             if (callback) {
-              callback(res.result.code);
+              callback(res.result.code)
             }
           } else {
-            this.$message.warning(res.message);
+            this.$message.warning(res.message)
           }
         })
-        .finally(() => {});
+        .finally(() => {})
     },
     modalUserNmumFormOk() {
-      this.loadTables();
+      this.loadTables()
       // this.$emit('retId', this.selectTable.id)
       this.$router.push({
-        name: "pos-posInfo",
-        params: { tableId: this.selectTable.id },
-      });
+        name: 'pos-posInfo',
+        params: { tableId: this.selectTable.id }
+      })
+    },
+    bookingOpenModelOk() {
+      this.loadTables()
+    },
+    newOpen(tableInfo) {
+      this.$refs.modalUserNmumForm.edit({ id: tableInfo.id, userNum: 1 })
+      this.$refs.modalUserNmumForm.title = '就餐人数'
+      this.$refs.modalUserNmumForm.disableSubmit = false
     },
     itemClick(row) {
-      var that = this;
-      console.log(row);
-      this.selectTable = row;
+      var that = this
+      console.log(row)
+      this.selectTable = row
       if (row.state === 0) {
-        this.$refs.modalUserNmumForm.edit({ id: row.id, userNum: 1 });
-        this.$refs.modalUserNmumForm.title = "就餐人数";
-        this.$refs.modalUserNmumForm.disableSubmit = false;
+        if (row.isBooking) {
+          this.$refs.bookingOpenModel.edit(row)
+          return
+        }
+        this.$refs.modalUserNmumForm.edit({ id: row.id, userNum: 1 })
+        this.$refs.modalUserNmumForm.title = '就餐人数'
+        this.$refs.modalUserNmumForm.disableSubmit = false
       } else if (row.state === 4) {
         this.$confirm({
-          content: "确定是否要清除房台?",
+          content: '确定是否要清除房台?',
           onOk: function () {
-            var model = JSON.parse(JSON.stringify(row));
-            model.state = 0;
-            model.userNum = 0;
-            model.orderTime = null;
-            postAction("/pos/posTable/edit", model).then((res) => {
+            var model = JSON.parse(JSON.stringify(row))
+            model.state = 0
+            model.userNum = 0
+            model.orderTime = null
+            postAction('/pos/posTable/edit', model).then((res) => {
               if (res.success) {
-                that.$message.success(res.message);
-                that.loadTables();
+                that.$message.success(res.message)
+                that.loadTables()
               } else {
-                that.$message.warning(res.message);
+                that.$message.warning(res.message)
               }
-            });
-          },
-        });
+            })
+          }
+        })
       } else {
-        
         console.log(this.selectTable)
         let isUnionStation = false
         if (this.selectTable.posOrderGoods.teamIndex !== null && this.selectTable.posOrderGoods.teamIndex !== '' && this.selectTable.posOrderGoods.isMain !== true) {
@@ -524,17 +529,17 @@ export default {
         } else {
           isUnionStation = false
         }
-        console.log(isUnionStation);
+        console.log(isUnionStation)
         // return
-        this.$emit('retId', this.selectTable.id, this.selectTable.state,this.selectTable.name,this.selectTable.posOrderGoods.id,isUnionStation)
+        this.$emit('retId', this.selectTable.id, this.selectTable.state, this.selectTable.name, this.selectTable.posOrderGoods.id, isUnionStation)
         // this.$router.push({
         //   name: "pos-tablediandan",
         //   params: { tableId: row.id },
         // });
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
   <style scoped>
 @import "~@assets/less/common.less";