-        
测试
+      
+        {{ asbDesc }}
+      
+      
        
+        测试
       
       
         确定
@@ -94,6 +140,7 @@ export default {
         appointStopDate: "",
         completeFlag: "0"
       },
+      asbDesc: '', //所选套餐描述
       pickerOptions: {
         // disabledDate(time) {
         //   return time.getTime() > Date.now();
@@ -126,8 +173,16 @@ export default {
 
   },
 
+  updated() {
+    this.$nextTick(() => {
+      this.$refs['webBookingDetaills'].doLayout()
+    })
+  },
   //挂载完成
   mounted() {
+    //回车替代查询
+    this.enterToQuery()
+
     this.funMounted()
   },
 
@@ -202,11 +257,11 @@ export default {
 
     // 查询
     btnQuery() {
-      if(!(this.query.appointStartDate && this.query.appointStopDate)){
+      if (!(this.query.appointStartDate && this.query.appointStopDate)) {
         this.$message.error({ showClose: true, message: "必须选择日期段!" })
         return
       }
-      if(!(this.query.idNo || this.query.mobilePhone)){
+      if (!(this.query.idNo || this.query.mobilePhone)) {
         this.$message.error({ showClose: true, message: "手机号或身份证号必须填写一项!" })
         return
       }
@@ -217,13 +272,17 @@ export default {
 
       let body = deepCopy(this.query)
 
-      body.appointStartDate =  this.query.appointStartDate + " 00:00:00"
+      body.appointStartDate = this.query.appointStartDate + " 00:00:00"
       body.appointStopDate = this.query.appointStopDate + " 23:59:59"
 
       postapi('/api/app/AppointPatientRegister/GetListByFilter', body)
         .then(res => {
           if (res.code > -1) {
             this.tableData = res.data
+            if (res.data && Array.isArray(res.data) && res.data.length == 1) {
+              this.rowClick(res.data[0])
+              this.$refs['webBooking'].setCurrentRow(res.data[0]);
+            }
           }
         })
     },
@@ -243,9 +302,19 @@ export default {
         thirdInterFaceId: this.query.thirdInterfaceId,
         appointPatientRegisterId: row.appointPatientRegisterId
       }).then(res => {
-        if(res.code > -1){
+        if (res.code > -1) {
+
+          res.data.forEach(e => {
+              e.discount = e.standardPrice == 0 ? 100: Math.floor(e.chargePrice * 10000/e.standardPrice)/100
+              if(!e.isBelongGroupPackage){
+                e.isBelongGroupPackage = e.isInMedicalPackage
+              }              
+              // e.standTotal = e.amount * e.standardPrice
+              e.total = e.amount * e.chargePrice
+            });
+            
           this.tableDataDetails = res.data
-        }        
+        }
       })
 
     },
@@ -268,6 +337,107 @@ export default {
       this.dialogWin.WebBooking = false
     },
 
+    //自定义计算列
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sumCol = [6]  //需合计的列
+      const sums = [];
+
+      let count = this.tableDataDetails.length
+      let pack = this.tableDataDetails.filter(e => { return e.isBelongGroupPackage == 'Y' }).length
+
+      this.asbDesc = `共选 ${count} 个项目,其中套餐/分组 ${pack} 个,加做 ${count - pack} 个`
+
+      columns.forEach((column, index) => {
+        //console.log('column, index,data',column, index,data)
+        //显示合计列
+        if (index == 1) {
+          sums[index] = `合计`;
+          return;
+        }
+
+        //不合计的列
+        if (sumCol.indexOf(index) == -1) {
+          sums[index] = '';
+          return;
+        }
+
+        sums[index] = 0
+        data.forEach(e => {
+          if (!isNaN(e[column.property])) {
+            if (index == 1) {
+              sums[index] += e[column.property] * e['amount']
+            } else {
+              sums[index] += e[column.property]
+            }
+          }
+        })
+        sums[index] = Math.round(sums[index] * 100) / 100 //+ ' 元';
+
+        // const values = data.map(item => Number(item[column.property]));
+        // if (!values.every(value => isNaN(value))) {
+        //   sums[index] = values.reduce((prev, curr) => {
+        //     const value = Number(curr);
+        //     if (!isNaN(value)) {
+        //       //return prev + curr;  //原始
+        //       return prev + curr;  //改造
+        //     } else {
+        //       return prev;
+        //     }
+        //   }, 0);
+        //   sums[index] = sums[index].toFixed(2) + ' 元';
+        // } else {
+        //   sums[index] = 'N/A';
+        // }
+
+      });
+      this.totalStand = sums[1];
+      //console.log('this.totalFoucs/this.discountFoucs',this.totalFoucs,this.discountFoucs)
+      if (!this.totalFoucs) this.total = sums[5];
+      if (!this.discountFoucs) this.discount = Math.round(this.total * 10000 / this.totalStand) / 100;
+      return sums;
+    },
+
+    //回车替代查询
+    enterToQuery() {
+      // console.log('enterToTab');
+      this.$nextTick(() => {
+        let inputs = document.querySelectorAll(["input"]); //用数组可以读取多个标签的元素  //.inline-input
+
+        // 为每个输入框添加键盘事件监听器
+        inputs.forEach((input, i) => {
+          // console.log('input',input);
+          input.addEventListener('keydown', (event) => {
+            if (event.keyCode === 13) {
+              // 阻止回车键的默认行为(换行)            
+              event.preventDefault();
+
+              // 如果按下的是回车查询
+              // console.log(input.getAttribute('placeholder'),input.value)
+              let placeholder = input.getAttribute('placeholder')
+              switch (placeholder) {
+                case '预约手机号':
+                case '身份证号':
+                  this.btnQuery()
+                  input.select()
+                  break;
+              }
+            }
+          });
+
+          input.addEventListener('click', (event) => {
+            let placeholder = input.getAttribute('placeholder')
+            switch (placeholder) {
+              case '预约手机号':
+              case '身份证号':
+                input.select()
+                break;
+            }
+          });
+        });
+      });
+    },
+
   },
 
   //监听事件()