소스 검색

修改pos功能

许智捷 2 년 전
부모
커밋
d1082d499f

+ 303 - 222
src/views/pos/diandan.vue

@@ -8,7 +8,7 @@
       ></a-tab-pane>
     </a-tabs>
     <div style="display: flex; height: calc(100vh - 350px)">
-      <a-card style="width: 30%">
+      <a-card style="width: 30%;">
         <a href="#" @click="remarkModal"> <a-icon type="edit" />整单备注</a>
         &nbsp;&nbsp;<a-icon type="user" />
         <span v-if="selectRoomOrder && selectRoomOrder.roomName">
@@ -22,12 +22,13 @@
           :data-source="selectGoodsList"
           :row-selection="rowSelection"
           rowKey="id"
-          :scroll="{ y: 560 }"
+          style=" overflow-y: scroll;"
         >
           <template slot="num" slot-scope="text, record, index">
             <div>
               <a-input-number
                 v-model="record.num"
+                style="width: auto; "
                 :max="record.inventory"
                 @change="(event) => numChange(event, index)"
               />
@@ -44,7 +45,10 @@
           </span>
         </a-table>
         <p>数量:{{ sum }}</p>
-        <div style="display: flex; gap: 5px; flex-flow: wrap">
+        <div v-if="this.posTableState === 1">
+          <a-button @click="placeOrder" :disabled="btnDisabled">下单</a-button>
+        </div>
+        <div v-else style="display: flex; gap: 5px; flex-flow: wrap">
           <a-button @click="handleClear" :disabled="btnDisabled">清空</a-button>
           <!-- <a-button @click="handleAdd" :disabled="btnDisabled">备注</a-button> -->
           <!-- <a-button :disabled="btnDisabled">退货</a-button> -->
@@ -53,13 +57,18 @@
           <a-button
             v-if="selectRoomOrder && selectRoomOrder.roomName && !btnDisabled"
             @click="handleToRoomFeePayment"
-            >确定挂房帐</a-button
+          >确定挂房帐</a-button
           >
-          <a-button v-else @click="handleSelectCheckInRoomOrder"
-            >挂房帐</a-button
+          <a-button
+            v-else
+            @click="handleSelectCheckInRoomOrder"
+          >挂房帐</a-button
           >
-          <a-button :disabled="btnDisabled" type="danger" @click="handlePayment"
-            >结账¥{{ amount.toFixed(2) }}</a-button
+          <a-button
+            :disabled="btnDisabled"
+            type="danger"
+            @click="handlePayment"
+          >结账¥{{ amount.toFixed(2) }}</a-button
           >
           <a-button :disabled="btnDisabled" @click="refundChange">退货</a-button>
         </div>
@@ -126,8 +135,9 @@
             ></a-input>
             <a-input v-else placeholder="请扫描条码"></a-input>
             <a-button v-if="!isSaoma">查询</a-button>
-            <a-button @click="isSaoma = !isSaoma"
-              >切换为{{ isSaoma ? "查询" : "扫码" }}模式</a-button
+            <a-button
+              @click="isSaoma = !isSaoma"
+            >切换为{{ isSaoma ? "查询" : "扫码" }}模式</a-button
             >
           </a-space>
         </a-row>
@@ -174,98 +184,122 @@
   </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 { 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 { computed } from 'vue'
+import { tree } from '@/api/good'
 const columns = [
   {
-    title: "商品名称",
-    dataIndex: "name",
+    title: '商品名称',
+    dataIndex: 'name',
+    width: '50%'
   },
   {
-    title: "数量",
-    dataIndex: "num",
+    title: '数量',
+    dataIndex: 'num',
+    width: '25%',
     scopedSlots: {
-      customRender: "num",
-    },
+      customRender: 'num'
+    }
   },
   {
-    title: "售价",
-    dataIndex: "sellingPrice",
-  },
-];
+    title: '售价',
+    dataIndex: 'sellingPrice',
+    width: '25%',
+  }
+]
 export default {
-  name: "memberList",
+  name: 'MemberList',
   components: {
     PaymentModal,
     goodsModal,
     PickingGoodsOrderModal,
-    SelectCheckInRoomOrderModal,
+    SelectCheckInRoomOrderModal
+  },
+  props: {
+    tableId: {
+      type: String,
+      default: ''
+    },
+    tableState: {
+      type: Number,
+      default: -1
+    }
+  },
+  watch: {
+    tableId: function (newValue, oldValue) {
+      this.posTableId = this.tableId
+      this.posTableState = this.tableState
+      if (this.tableId !== '' && this.tableState === 2) {
+        this.getOrderByTableId(this.tableId)
+      }
+    }
   },
   data() {
     return {
+      posTableId: '',
+      posTableState: -1,
+      tableState2: -1,
       isRemarkModal: false,
       isSaoma: false,
-      remark: "",
+      remark: '',
       columns,
       isRefund: false,
-      refundRemark: "",
+      refundRemark: '',
       sellClear: 0,
       queryParam: {},
       // 分页参数
       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: [],
       selectedRows: [],
       isorter: {
-        column: "createTime",
-        order: "desc",
+        column: 'createTime',
+        order: 'desc'
       },
       treeData: [],
       selectGoods: {},
       posTypeList: [],
-      tabPosTypeId: "",
+      tabPosTypeId: '',
       selectGoodsList: [],
       goodsTypeList: [],
-      tabgoodsTypeId: "1",
+      tabgoodsTypeId: '1',
       dataSource: [],
       dataSource2: [],
       oldSelectGoodsList: [],
       selectOrderInfo: {},
-      selectRoomOrder: {},
-    };
+      selectRoomOrder: {}
+    }
   },
   provide() {
     return {
-      treeData: computed(() => this.treeData),
-    };
+      treeData: computed(() => this.treeData)
+    }
   },
   computed: {
     rowSelection() {
@@ -273,322 +307,369 @@ export default {
         onChange: (selectedRowKeys, selectedRows) => {
           console.log(
             `selectedRowKeys: ${selectedRowKeys}`,
-            "selectedRows: ",
+            'selectedRows: ',
             selectedRows
-          );
-          this.selectedRowKeys = selectedRowKeys;
-          this.selectedRows = selectedRows;
+          )
+          this.selectedRowKeys = selectedRowKeys
+          this.selectedRows = selectedRows
         },
         getCheckboxProps: (record) => ({
           props: {
-            disabled: record.name === "Disabled User", // Column configuration not to be checked
-            name: record.name,
-          },
-        }),
-      };
+            disabled: record.name === 'Disabled User', // Column configuration not to be checked
+            name: record.name
+          }
+        })
+      }
     },
     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() {
     this.dataSource = [
       {
-        id: "0",
-      },
-    ];
-    getAction("/pos/posType/list", {
+        id: '0'
+      }
+    ]
+    getAction('/pos/posType/list', {
       pageNo: 1,
-      pageSize: 99,
+      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.loadGoodsType();
+          this.tabPosTypeId = this.posTypeList[0].id
+          this.loadGoodsType()
         }
       }
-    });
-    this.loadTree();
+    })
+    this.loadTree()
   },
   methods: {
+    getOrderByTableId(tableId) {
+      getAction('/pos/posOrderGoods/getOrderByTableId', { tableId }).then(resp => {
+        if (resp.success) {
+          this.selectOrderInfo = resp.result
+          this.selectGoodsList = resp.result.posOrderGoodsDetailList
+          this.selectGoodsList.forEach(e => {
+            this.$set(e, 'sellingPrice', e.money)
+            this.$set(e, 'name', e.goodsName)
+          })
+          this.oldSelectGoodsList = JSON.parse(JSON.stringify(this.selectGoodsList))
+        } else {
+          this.$message.warning('查询订单失败')
+        }
+      })
+    },
     remarkModal() {
       if (!this.selectGoodsList || this.selectGoodsList.length <= 0) {
-        this.$message.warning("请先选择商品");
-        return;
+        this.$message.warning('请先选择商品')
+        return
       }
-      this.isRemarkModal = true;
+      this.isRemarkModal = true
     },
-    refundModalOk(){
+    refundModalOk() {
 
     },
 
     /**
      * 退货
      */
-    refundChange(){
-      this.$message.warning("未下单餐品不支持退菜,请重新选择");
+    refundChange() {
+      this.$message.warning('未下单餐品不支持退菜,请重新选择')
       return
-      if(this.selectedRows.length == 0){
-        this.$message.warning("请先选择菜品");
-        return;
+      if (this.selectedRows.length == 0) {
+        this.$message.warning('请先选择菜品')
       }
-      this.isRefund = true;
+      this.isRefund = true
     },
 
     remarkModalOk() {
       this.handleAdd()
-      this.remark = "";
-      this.isRemarkModal = false;
+      this.remark = ''
+      this.isRemarkModal = false
     },
     onClearSelected() {
-      this.selectedRowKeys = [];
-      this.selectionRows = [];
+      this.selectedRowKeys = []
+      this.selectionRows = []
     },
     loadTree() {
-      var that = this;
+      var that = this
       tree().then((res) => {
         if (res.success) {
-          this.treeData = res.result;
+          this.treeData = res.result
         }
-      });
+      })
     },
     modalFormOk() {
-      this.selectGoodsList = [];
-      this.selectOrderInfo = {};
-      this.selectRoomOrder = {};
+      this.selectGoodsList = []
+      this.selectOrderInfo = {}
+      this.selectRoomOrder = {}
     },
     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.loadGoodsType();
+      this.loadGoodsType()
     },
     tabGoodsTypeChange(e) {
-      this.loadGoods();
+      this.loadGoods()
     },
     loadGoodsType() {
-      getAction("/rooms/cesStockType/getTopTypesByPosType", {
-        posType: this.tabPosTypeId,
+      getAction('/rooms/cesStockType/getTopTypesByPosType', {
+        posType: this.tabPosTypeId
       }).then((res2) => {
         if (res2.success) {
-          this.goodsTypeList = res2.result;
+          this.goodsTypeList = res2.result
           if (this.goodsTypeList && this.goodsTypeList.length > 0) {
-            this.loadGoods();
+            this.loadGoods()
           }
         }
-      });
+      })
     },
     loadGoods() {
-      var ids = [];
-      if (this.tabgoodsTypeId === "1") {
+      var ids = []
+      if (this.tabgoodsTypeId === '1') {
         this.goodsTypeList.forEach((t) => {
-          ids.push(t.id);
-        });
+          ids.push(t.id)
+        })
       } else {
-        ids.push(this.tabgoodsTypeId);
+        ids.push(this.tabgoodsTypeId)
       }
       this.dataSource = [
         {
-          id: "0",
-        },
-      ];
-      getAction("/pos/posSellClearGoods/list", {
+          id: '0'
+        }
+      ]
+      getAction('/pos/posSellClearGoods/list', {
         pageNo: 1,
         pageSize: 99999,
-        goodTypes: ids,
+        goodTypes: ids
       }).then((res) => {
         if (res.success) {
-          this.dataSource = [...this.dataSource, ...res.result.records];
+          this.dataSource = [...this.dataSource, ...res.result.records]
         }
-      });
-      getAction("/pos/posSellClearGoods/thali-list", {
+      })
+      getAction('/pos/posSellClearGoods/thali-list', {
         pageNo: 1,
         pageSize: 99999,
-        goodTypes: ids,
+        goodTypes: ids
       }).then((res) => {
         if (res.success) {
-          this.dataSource2 = res.result.records;
+          this.dataSource2 = res.result.records
         }
-      });
+      })
     },
     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();
+      let param = this.getParam()
+      postAction('/pos/posOrderGoods/addRoomFee', param).then(resp => {
+        if (resp.result === true) {
+          this.$message.success('挂账成功')
+          this.modalFormOk()
+        } else {
+          this.$message.warning('挂账失败')
+        }
+      })
     },
     handlePayment() {
-      this.handleAdd((e) => {
-        var amount = this.oldSelectGoodsList.reduce(function (total, item) {
-          return total + item.sellingPrice * item.num;
-        }, 0);
-        this.$refs.modalPaymentForm.edit({
-          billAmount: amount,
-          deposit: 0,
-          roomFee: amount,
-          subjectType: 5,
-          feeType: 2,
-          preferentialType: 1,
-          couponFirstAmount: 0,
-          discount: 9,
-          orderCode: e,
-        });
-        this.$refs.modalPaymentForm.title = "POS结账";
-        this.$refs.modalPaymentForm.disableSubmit = false;
-      });
+      console.log(this.posTableId)
+      if (this.posTableId === '') {
+        this.handleAdd((e) => {
+          this.settleAccounts(e)
+        })
+      } else {
+
+        this.settleAccounts(this.selectOrderInfo.code)
+      }
+    },
+    settleAccounts(orderCode) {
+      console.log(orderCode)
+      debugger
+      var amount = this.oldSelectGoodsList.reduce(function (total, item) {
+        return total + item.sellingPrice * item.num
+      }, 0)
+      this.$refs.modalPaymentForm.edit({
+        billAmount: amount,
+        deposit: 0,
+        roomFee: amount,
+        subjectType: 5,
+        feeType: 2,
+        preferentialType: 1,
+        couponFirstAmount: 0,
+        discount: 9,
+        orderCode: orderCode
+      })
+      this.$refs.modalPaymentForm.title = 'POS结账'
+      this.$refs.modalPaymentForm.disableSubmit = false
+    },
+    placeOrder() {
+      this.handleAdd()
     },
     handleAdd(callback) {
+      debugger
       if (!this.selectGoodsList || this.selectGoodsList.length <= 0) {
-        this.$message.warning("请先选择商品");
-        return;
-      }
-      var _info = JSON.parse(localStorage.getItem("storeInfo"));
-      var model = {
-        goodsId: this.selectGoods.id,
-      };
-      if (_info) {
-        model.hotelId = _info.id;
-      }
-      model.id = this.selectOrderInfo.id;
-      model.toRoomFeeOrderId = this.selectRoomOrder.livingOrderId;
-      model.posType = this.tabPosTypeId;
-      if (this.remark) {
-        model.remarks = this.remark;
+        this.$message.warning('请先选择商品')
+        return
       }
-      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)
+      let param = this.getParam()
+      postAction('/pos/posOrderGoods/add', param)
         .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.loadGoods()
+            if (this.posTableId !== '' || this.posTableId !== null){
+              this.$emit('reTable')
+            }
             if (callback) {
-              callback(res.result.code);
+              callback(res.result.code)
             }
           } else {
-            this.$message.warning(res.message);
+            this.$message.warning(res.message)
           }
         })
-        .finally(() => {});
+        .finally(() => {})
+    },
+
+    getParam() {
+      var _info = JSON.parse(localStorage.getItem('storeInfo'))
+      var model = {
+        goodsId: this.selectGoods.id,
+        posTableId: this.posTableId
+      }
+      if (_info) {
+        model.hotelId = _info.id
+      }
+      model.id = this.selectOrderInfo.id
+      model.toRoomFeeOrderId = this.selectRoomOrder.livingOrderId
+      model.posType = this.tabPosTypeId
+      if (this.remark) {
+        model.remarks = this.remark
+      }
+      var posOrderGoodsDetailList = []
+      this.selectGoodsList.forEach((t) => {
+        posOrderGoodsDetailList.push({
+          goodsId: t.id,
+          num: t.num,
+          money: t.sellingPrice
+        })
+      })
+      model.posOrderGoodsDetailList = posOrderGoodsDetailList
+      return model
     },
+
     itemClick(row) {
-      console.log(row);
-      if (row.id == "0") {
-        this.handleAddTempGoods();
-        return;
+      console.log(row)
+      if (row.id == '0') {
+        this.handleAddTempGoods()
+        return
       }
       if (row.isSellClear) {
-        this.$message.warning("选择的商品已沽清");
-        return;
+        this.$message.warning('选择的商品已沽清')
+        return
       }
-      var good = JSON.parse(JSON.stringify(row));
-      this.$set(good, "num", 1);
-      var find = this.selectGoodsList.find((t) => t.id === row.id);
+      var good = JSON.parse(JSON.stringify(row))
+      this.$set(good, 'num', 1)
+      var find = this.selectGoodsList.find((t) => t.id === row.id)
       if (find) {
         if (find.inventory > find.num) {
-          find.num++;
+          find.num++
         }
       } else {
-        this.selectGoodsList.push(good);
+        this.selectGoodsList.push(good)
       }
     },
     itemClick2(row) {
-      console.log(row);
-      var good = JSON.parse(JSON.stringify(row));
-      this.$set(good, "num", 1);
-      this.$set(good, "sellingPrice", good.price);
-      var find = this.selectGoodsList.find((t) => t.id === row.id);
+      console.log(row)
+      var good = JSON.parse(JSON.stringify(row))
+      this.$set(good, 'num', 1)
+      this.$set(good, 'sellingPrice', good.price)
+      var find = this.selectGoodsList.find((t) => t.id === row.id)
       if (find) {
-        find.num++;
+        find.num++
       } else {
-        this.selectGoodsList.push(good);
+        this.selectGoodsList.push(good)
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
-  
+
 <style scoped>
 @import "~@assets/less/common.less";
 

+ 3 - 2
src/views/pos/modules/SelectCheckInRoomOrder.vue

@@ -7,7 +7,8 @@
           <a-col :span="3">
             <a-form-item label="">
               <j-input
-                placeholder="入住单号/房间号/姓名"
+                  type="false"
+                  placeholder="入住单号/房间号/姓名"
                 v-model="queryParam.keyw"
               ></j-input>
             </a-form-item>
@@ -186,4 +187,4 @@ export default {
   opacity: 0.7;
   color: #ffffff;
 }
-</style>
+</style>

+ 37 - 11
src/views/pos/posInfo.vue

@@ -1,13 +1,13 @@
 <template>
   <a-card style="width: 100%; height: 100%">
-    <a-tabs v-model="activeKey">
+    <a-tabs v-model="activeKey" @change="tabChange">
       <a-tab-pane key="1">
         <span slot="tab"> 点单 </span>
-        <diandan></diandan>
+        <diandan ref="diandan" :tableId="diandanId" :tableState="diandanState" @reTable="reTable"></diandan>
       </a-tab-pane>
       <a-tab-pane key="2">
         <span slot="tab"> 桌台点单 </span>
-        <tablediandangallery v-if="activeKey == '2'"></tablediandangallery>
+        <tablediandangallery v-if="activeKey == '2'" ref="tablediandangallery" @retId="retId"></tablediandangallery>
       </a-tab-pane>
       <a-tab-pane key="3">
         <span slot="tab"> 订单列表 </span>
@@ -29,11 +29,11 @@
 </template>
 
 <script>
-import diandan from "./diandan.vue";
-import posType from "./posType.vue";
-import goodsOrder from "./goodsOrder.vue";
-import tablediandangallery from "./tablediandangallery.vue";
-import posThali from "./posThali.vue";
+import diandan from './diandan.vue'
+import posType from './posType.vue'
+import goodsOrder from './goodsOrder.vue'
+import tablediandangallery from './tablediandangallery.vue'
+import posThali from './posThali.vue'
 
 export default {
   components: {
@@ -41,12 +41,38 @@ export default {
     posType,
     goodsOrder,
     tablediandangallery,
-    posThali,
+    posThali
   },
   data() {
-    return { activeKey: "1" };
+    return {
+      activeKey: '1',
+      diandanId: '',
+      diandanState: -1
+    }
   },
-};
+  methods: {
+    retId(id, state) {
+      this.activeKey = '1'
+      this.diandanId = ''
+      setTimeout(()=>{
+        this.diandanId = id
+      }, 200)
+      this.diandanState = state
+    },
+    reTable() {
+      this.activeKey = '2'
+      this.$refs.diandan.modalFormOk()
+    },
+    tabChange(e) {
+      debugger
+      if (e !== '1') {
+        this.$refs.diandan.modalFormOk()
+        this.$refs.diandan.posTableId = ''
+        this.$refs.diandan.posTableState = -1
+      }
+    }
+  }
+}
 </script>
 
 <style scoped>

+ 11 - 7
src/views/pos/tablediandangallery.vue

@@ -110,7 +110,7 @@
     ></user-num-modal>
   </a-card>
 </template>
-  
+
   <script>
 // import { JeecgListMixin } from "@/mixins/JeecgListMixin";
 // import PosRegionModal from "./modules/PosRegionModal";
@@ -478,8 +478,9 @@ export default {
     },
     modalUserNmumFormOk() {
       this.loadTables();
+      // this.$emit('retId', this.selectTable.id)
       this.$router.push({
-        name: "pos-tablediandan",
+        name: "pos-posInfo",
         params: { tableId: this.selectTable.id },
       });
     },
@@ -510,10 +511,13 @@ export default {
           },
         });
       } else {
-        this.$router.push({
-          name: "pos-tablediandan",
-          params: { tableId: row.id },
-        });
+        debugger
+        console.log(this.selectTable)
+        this.$emit('retId', this.selectTable.id, this.selectTable.state)
+        // this.$router.push({
+        //   name: "pos-tablediandan",
+        //   params: { tableId: row.id },
+        // });
       }
     },
   },
@@ -599,4 +603,4 @@ export default {
   background-color: #ccc;
   border-radius: 4px;
 }
-</style>
+</style>

+ 83 - 52
src/views/room/modules/checkIn/BillRoomInfo.vue

@@ -406,30 +406,63 @@
             </div>
           </div>
         </div>
-        <a-divider />
-        <a-table
-          :columns="columns"
-          :data-source="feesList"
-          :pagination="false"
-          :scroll="{ y: 160 }"
-          rowKey="id"
-        >
-          <template slot="subjectType" slot-scope="text, record, index">
-            {{ getSubjectTypeText(text,record) }}
-          </template>
-          <template slot="roomId" slot-scope="text, record, index">
-            {{ getRoomName(text) }}
-          </template>
-        </a-table>
-        <div
-          style="
+        <a-divider style="margin-bottom: 0px" />
+        <a-tabs :v-model="active" @change="tabFeeChange" style="padding-top: 0px">
+          <a-tab-pane tab="未结算" key="1" :forceRender="true">
+            <a-table
+                :columns="columns"
+                :data-source="feesList"
+                :pagination="false"
+                :scroll="{ y: 160 }"
+                rowKey="id"
+                :rowSelection="{
+            consumSelectedRowKeys: consumSelectedRowKeys,
+            onChange: onSelectChange,
+          }"
+            >
+              <template slot="subjectType" slot-scope="text, record, index">
+                {{ getSubjectTypeText(text,record) }}
+              </template>
+              <template slot="roomId" slot-scope="text, record, index">
+                {{ getRoomName(text) }}
+              </template>
+            </a-table>
+            <div
+                style="
             color: rgba(255, 87, 51, 1);
             font-weight: 600;
             text-align: right;
           "
-        >
-          合计消费:{{ feesAmount.toFixed(2) }}
-        </div>
+            >
+              合计消费:{{ feesAmount.toFixed(2) }}
+            </div>
+          </a-tab-pane>
+          <a-tab-pane tab="已结算" key="2">
+            <a-table
+                :columns="columns"
+                :data-source="paidList"
+                :pagination="false"
+                :scroll="{ y: 160 }"
+                rowKey="id"
+            >
+              <template slot="subjectType" slot-scope="text, record, index">
+                {{ getSubjectTypeText(text,record) }}
+              </template>
+              <template slot="roomId" slot-scope="text, record, index">
+                {{ getRoomName(text) }}
+              </template>
+            </a-table>
+            <div
+                style="
+            color: rgba(255, 87, 51, 1);
+            font-weight: 600;
+            text-align: right;
+          "
+            >
+              合计消费:{{ paidMoney }}
+            </div>
+          </a-tab-pane>
+        </a-tabs>
         <div
           style="
             display: flex;
@@ -472,11 +505,6 @@
           :data-source="paymentList"
           :pagination="false"
           :scroll="{ y: 160 }"
-          rowKey="id"
-          :rowSelection="{
-            selectedRowKeys: selectedRowKeys,
-            onChange: onSelectChange,
-          }"
         >
           <template slot="payType" slot-scope="text, record, index">
             {{ getPayTypeText(text) }}
@@ -641,27 +669,25 @@ import StrikeBalance from '@views/room/modules/checkIn/StrikeBalanceModel'
 import StrikeBalanceModel from '@views/room/modules/checkIn/StrikeBalanceModel'
 import EnterAccountModel from '@views/room/modules/checkIn/EnterAccountModel'
 const columns = [
-  // {
-  //     title: "",
-  //     dataIndex: "key",
-  //     width: 20,
-  //   },
   {
     title: '房间号',
     dataIndex: 'roomId',
     width: 80,
+    align: 'center',
     scopedSlots: { customRender: 'roomId' }
   },
   {
     title: '费项',
     dataIndex: 'subjectType',
-    width: 160,
+    width: 150,
+    align: 'center',
     scopedSlots: { customRender: 'subjectType' }
   },
   {
     title: '入账日期',
     dataIndex: 'dayTime',
     width: 110,
+    align: 'center',
     customRender: function (text, record) {
       if (text !== null && text !== '') {
         return record.dayTime.substring(0, 10)
@@ -671,9 +697,10 @@ const columns = [
   {
     title: '单价',
     dataIndex: 'money',
-    // width: 60,
+    width: 67,
+    align: 'center',
     customRender: function (text, record) {
-      if (record.subjectType === 6 && record.feeGoodVo.originalPrice) {
+      if ((record.subjectType === 6 || record.subjectType === 7) && record.feeGoodVo.originalPrice) {
         return record.feeGoodVo.originalPrice
       }
       return record.originalMoney
@@ -683,8 +710,9 @@ const columns = [
     title: '数量',
     dataIndex: 'feeType',
     width: 60,
+    align: 'center',
     customRender: function (text, record) {
-      if (record.subjectType === 6 && record.feeGoodVo.num) {
+      if ((record.subjectType === 6 || record.subjectType === 7) && record.feeGoodVo.num) {
         return record.feeGoodVo.num
       }
       return 1
@@ -692,13 +720,15 @@ const columns = [
   },
   {
     title: '小计',
+    align: 'center',
     dataIndex: 'originalMoney',
-    // width: 60,
+    width: 67,
   },
   {
     title: '优惠价',
+    align: 'center',
     dataIndex: 'money',
-    // width: 60,
+    width: 67,
   }
 ]
 
@@ -837,6 +867,9 @@ export default {
       paymentList: [],
       oldpaymentList: [],
       payTypeList: [],
+      paidList: [],
+      paidMoney: 0,
+      active: 1,
       vipCustomer: {},
       selectRoomId: '1',
       /**
@@ -1127,7 +1160,6 @@ export default {
       this.$refs.modalEditCustomerSource.disableSubmit = false
     },
     editCustomerType(item) {
-      debugger
       console.log(item)
       var obj = {
         orderId: item.livingOrder.id,
@@ -1156,7 +1188,6 @@ export default {
         nation: customer.nation
       }
       console.log(obj)
-      debugger
       this.$refs.modalEditCustomer.edit(obj)
       this.$refs.modalEditCustomer.title = '修改'
       this.$refs.modalEditCustomer.disableSubmit = false
@@ -1330,7 +1361,6 @@ export default {
     },
     getRoomName(id) {
       console.log(this.model.livingRoomIds)
-      debugger
       var index = this.model.livingRoomIds.findLastIndex((t) => t.roomId == id)
       var find = this.model.livingRoomIds[index]
       return find ? find.roomName : ''
@@ -1350,7 +1380,7 @@ export default {
       } else if (text == 6) {
         msg = '商品-' + record.feeGoodVo.name
       } else if (text == 7) {
-        msg = '点餐'
+        msg = '点餐-' + record.feeGoodVo.name
       } else if (text == 8) {
         msg = '夜审房费'
       } else if (text == 9) {
@@ -1402,7 +1432,6 @@ export default {
       })
     },
     modalFormOk(e) {
-      debugger
       this.getBookingOrderInfo()
       this.$emit('ok')
     },
@@ -1471,20 +1500,21 @@ export default {
               : res.result.livingRoomIds[1].roomId
           this.selectRoomId = this.tabSelectRoomId
           this.model = res.result
-          debugger
           this.getWakeServiceData()
           getAction('/business/busRoomBookingOrders/living-fees', {
-            bookingOrderId: this.model.orderInfo.id
+            bookingOrderId: this.model.orderInfo.id,
+            isAllFee: true
           }).then((res) => {
             if (res.success) {
               if (res.result && res.result.length > 0) {
-                this.feesList = res.result.filter((t) => t.feeType === 1)
+                this.feesList = res.result.filter((t) => t.feeType === 1 && t.preferentialStatus === 1)
                 this.oldfeesList = JSON.parse(JSON.stringify(this.feesList))
                 this.tabChange(this.tabSelectRoomId)
-                this.paymentList = res.result.filter((t) => t.feeType === 2)
-                this.oldpaymentList = JSON.parse(
-                    JSON.stringify(this.paymentList)
-                )
+                this.paymentList = res.result.filter((t) => t.feeType === 2 && t.preferentialStatus === 1)
+                this.oldpaymentList = JSON.parse(JSON.stringify(this.paymentList))
+                // 已付款的消费
+                this.paidList = res.result.filter((t) => t.feeType === 1 && t.preferentialStatus === 2 && !t.isPreferential)
+                this.paidMoney = this.feesList.reduce(function (total, item) { return total + item.money }, 0)
               }
             }
           })
@@ -1494,9 +1524,12 @@ export default {
         }
       })
     },
+    tabFeeChange(){
+      // this.
+    },
     onSelectChange(selectedRowKeys, selectionRows) {
-      this.selectedRowKeys = selectedRowKeys
-      this.selectionRows = selectionRows
+      this.consumSelectedRowKeys = selectedRowKeys
+      this.consumSelectedRows = selectionRows
     },
     refund() {
       let chooseRooms = [this.chooseLivingRoom]
@@ -1608,7 +1641,6 @@ export default {
       this.roomId = roomId
       console.log(this.modelDefault)
       this.edit(this.modelDefault)
-      debugger
       this.getBookingOrderInfo()
     },
     edit(record) {
@@ -1626,7 +1658,6 @@ export default {
       var find = this.model.livingRoomIds[index]
 
       console.log(find)
-      debugger
       let url = '/business/busRoomBookingOrders/cancel-leave-not-settle?bookingOrderId='
       if (isLeaveNotSettle) {
         url = '/business/busRoomBookingOrders/leave-not-settle?bookingOrderId='

+ 3 - 0
src/views/room/modules/checkIn/EnterAccountModel.vue

@@ -125,6 +125,8 @@ export default {
           livingOrderId: e.livingOrder.id,
           feeType: 2,
           vipCardId: e.livingOrder.vipCustomerId,
+          contractTeamProtocolId: e.livingOrder.contractTeamProtocolId,
+          contractTeamId: e.livingOrder.contractTeamId,
           addAccountList: [{
             payType: '',
             money: 0,
@@ -217,6 +219,7 @@ export default {
           this.payTypeList[index].delFlag = 99
         }
       }
+      console.log(roomInfo, 'roomInfo')
       if (!roomInfo.contractTeamId || roomInfo.contractTeamId.length === 0 ||
           !roomInfo.contractTeamProtocolId || roomInfo.contractTeamProtocolId.length === 0) {
         let index = this.payTypeList.findIndex((t) =>