浏览代码

桌面订单查询

licc 2 周之前
父节点
当前提交
cf32f2d7ef
共有 1 个文件被更改,包括 15 次插入5 次删除
  1. 15 5
      src/views/order/console.vue

+ 15 - 5
src/views/order/console.vue

@@ -149,7 +149,8 @@ import {
     dishInc,
     dishListAll,
     toEmptyy,
-    orderSubmit
+    orderSubmit,
+    deskOrderedDishListAll
 } from '@/api/order'
 import feedback from '@/utils/feedback'
 // const route = useRoute()
@@ -184,9 +185,9 @@ const submit = () => {
         feedback.alert('未点菜品!')
     }
     orderSubmit(params).then(() => {
-        data.selectGoods.length = 0
-        orderData.priceSum = 0
-        orderData.numSum = 0
+        // data.selectGoods.length = 0
+        // orderData.priceSum = 0
+        // orderData.numSum = 0
         emit('init')
         feedback.closeLoading()
         feedback.notifySuccess('出单成功')
@@ -198,6 +199,15 @@ const open = (item: any, num?: number, orderNumber?: any) => {
     data.deskCap = item.num
     data.currentNum = item.userNum ? item.userNum : num
     params.number = item.ordersId ? item.ordersId : orderNumber
+
+    deskOrderedDishListAll({ id: params.number }).then((res) => {
+        data.selectGoods = res
+        if (res.length > 0) {
+            params.remark = res[0].remark
+            orderData.priceSum = res.reduce((accumulator, currentValue) => accumulator + currentValue.summary, 0);
+            orderData.numSum = res.reduce((accumulator, currentValue) => accumulator + currentValue.num, 0);
+        }
+    })
 }
 
 const addGoods = (item: any) => {
@@ -249,7 +259,7 @@ const toEmpty = () => {
     }
 }
 const beforeClose = () => {
-    if ((data.selectGoods, length != 0)) {
+    if (data.selectGoods && data.selectGoods.length > 0) {
         feedback.confirm('所点菜品信息将不被保存,确认关闭?').then(() => {
             toEmpty()
         })