shish 5 hours ago
parent
commit
63e84ff3eb

+ 109 - 10
ghs/src/components/order/OrderCommitDialog.vue

@@ -2,7 +2,8 @@
   开单确认提交面板(常驻在购物车右侧,非弹窗)
   由开单 POS 页四栏布局直接挂载,始终渲染;切换客户时刷新表单。
   UI/业务对齐 ghsApp affirm:账单日期入口已下线;送货日期写入 sendTime,可补录过去日期。
-  键盘:Ctrl+Enter 提交,差价弹窗也用 Ctrl+Enter 确认,F7 备注,Alt+1~3 配送,Alt+Q/W/E/R 付款。
+  键盘:Ctrl+Enter 先开大号确认框,框内再 Ctrl+Enter / 点确定才下单;Esc 取消。
+  差价弹窗也用 Ctrl+Enter 确认,F7 备注,Alt+1~3 配送,Alt+Q/W/E/R 付款。
 -->
 <template>
   <aside class="order-commit-panel" :class="{ 'is-kb-zone': kbActive }">
@@ -291,6 +292,32 @@
     </el-dialog>
 
     <!-- 打折:1–9折 / 不打 / 自定义;append-to-body 保证遮罩盖住整页 -->
+    <!-- 大号确认:替代 Element MessageBox,确定键写上 Ctrl+Enter -->
+    <el-dialog
+      :title="confirmTitle"
+      :visible.sync="confirmVisible"
+      width="560px"
+      append-to-body
+      custom-class="commit-confirm-dialog"
+      :close-on-click-modal="false"
+      @opened="focusConfirmBtn"
+    >
+      <div class="commit-confirm-body">
+        <div class="commit-confirm-tip">{{ confirmTip }}</div>
+        <div class="commit-confirm-row">客户 {{ form.customName || customName || '-' }}</div>
+        <div class="commit-confirm-row">收款 <span class="pay">¥{{ modifyPrice }}</span></div>
+      </div>
+      <span slot="footer">
+        <el-button @click="closeConfirmDialog">取消(Esc)</el-button>
+        <el-button
+          ref="confirmSubmitBtn"
+          type="primary"
+          :loading="submitting"
+          @click="submitOrder(false)"
+        >确定(Ctrl+Enter)</el-button>
+      </span>
+    </el-dialog>
+
     <el-dialog title="选择打折" :visible.sync="discountVisible" width="440px" append-to-body>
       <div class="discount-box">
         <el-button
@@ -336,6 +363,8 @@ export default {
   data() {
     return {
       submitting: false,
+      /** 大号确认框:点提交或 Ctrl+Enter 先弹这个,再确认才真正下单 */
+      confirmVisible: false,
       modifyPrice: 0,
       diffList: [],
       diffVisible: false,
@@ -404,6 +433,21 @@ export default {
       const shop = this.currentShop || {}
       return shop.shopName || shop.name || '门店'
     },
+    /** 确认框标题:跟付款方式走,避免只写「提示」看不出在确认什么 */
+    confirmTitle() {
+      if (this.form.hasPay == 1) return '确认线下付款'
+      if (this.form.hasPay == 2) return '确认挂账'
+      if (this.form.hasPay == 4) return '确认余额支付'
+      if (this.form.hasPay == 0) return '确认扫码收款'
+      return '确认提交'
+    },
+    confirmTip() {
+      if (this.form.hasPay == 1) return '确认线下付款提交这张单?'
+      if (this.form.hasPay == 2) return '确认挂账提交这张单?'
+      if (this.form.hasPay == 4) return '确认用余额支付这张单?'
+      if (this.form.hasPay == 0) return '确认扫码收款提交这张单?'
+      return '确认提交这张单?'
+    },
     displayPackCost() {
       return this.currentShop.pfLevel && this.currentShop.pfLevel == 1
     },
@@ -475,6 +519,7 @@ export default {
      * 用于:进页、切换客户、提交成功后;侧栏常驻,不再关弹窗
      */
     resetPanel() {
+      this.confirmVisible = false
       this.diffVisible = false
       this.diffList = []
       this.discountValue = 0
@@ -777,6 +822,17 @@ export default {
     /**
      * 挂账确认框关掉后差价弹窗才出现,延迟抢焦点,避免焦点还留在已关的 MessageBox 上
      */
+    /** 父页 Esc:关掉提交确认框,不跳回搜索 */
+    closeConfirmDialog() {
+      this.confirmVisible = false
+    },
+    /** 弹框打开后焦点落到确定,方便看见当前可 Ctrl+Enter */
+    focusConfirmBtn() {
+      this.$nextTick(() => {
+        const btn = this.$refs.confirmSubmitBtn
+        if (btn && btn.$el && typeof btn.$el.focus === 'function') btn.$el.focus()
+      })
+    },
     focusDiffConfirm() {
       const focusBtn = () => {
         const btn = this.$refs.diffConfirmBtn
@@ -930,19 +986,18 @@ export default {
 
       // 差价弹窗里已点过确认,不再套一层「确认挂账」
       if (forceDealPrice) {
+        this.confirmVisible = false
         doCreate()
         return
       }
 
-      let tip = '确认提交'
-      if (this.form.hasPay == 1) tip = '确认线下付款?'
-      else if (this.form.hasPay == 2) tip = '确认挂账?'
-      else if (this.form.hasPay == 4) tip = '确认余额支付?'
-      else if (this.form.hasPay == 0) tip = '确认扫码收款?'
-
-      this.$confirm(tip, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
-        doCreate()
-      }).catch(() => {})
+      // 第一次点/Ctrl+Enter 只开大号确认框;框已开再确认才下单
+      if (!this.confirmVisible) {
+        this.confirmVisible = true
+        return
+      }
+      this.confirmVisible = false
+      doCreate()
     }
   }
 }
@@ -950,6 +1005,50 @@ export default {
 
 <style lang="scss">
 /* 侧栏内嵌套弹窗无需改 el-dialog 全局高度 */
+/* append-to-body 的确认框不受 scoped 影响,单独放大标题/金额/按钮 */
+.commit-confirm-dialog {
+  .el-dialog__header {
+    padding: 24px 32px 10px;
+  }
+  .el-dialog__title {
+    font-size: 22px;
+    font-weight: 700;
+    line-height: 30px;
+  }
+  .el-dialog__body {
+    padding: 8px 32px 6px;
+  }
+  .el-dialog__footer {
+    padding: 16px 32px 28px;
+  }
+  .el-dialog__footer .el-button {
+    min-width: 168px;
+    height: 48px;
+    font-size: 16px;
+    padding: 0 18px;
+  }
+}
+.commit-confirm-body {
+  font-size: 16px;
+  line-height: 1.6;
+  color: #303133;
+}
+.commit-confirm-tip {
+  margin-bottom: 16px;
+  font-size: 18px;
+  font-weight: 700;
+  color: #303133;
+}
+.commit-confirm-row {
+  margin-top: 12px;
+  font-size: 16px;
+  color: #606266;
+  .pay {
+    font-size: 28px;
+    font-weight: 700;
+    color: #f56c6c;
+  }
+}
 </style>
 
 <style lang="scss" scoped>

+ 105 - 15
ghs/src/components/purchase/PurchaseCommitPanel.vue

@@ -2,7 +2,7 @@
   采购确认提交面板(常驻在采购清单右侧,非弹窗)
   由采购确认页 POS 四栏布局挂载;字段/校验/提交对齐 ghsApp pagesPurchase/details.vue。
   上游 inType=0 走改价;本地 inType=1 直接入库。
-  键盘:Ctrl+Enter 提交,F7 备注;本地打印快捷键写在按钮上
+  键盘:Ctrl+Enter 先开大号确认框,框内再 Ctrl+Enter / 点确定才下单;Esc 取消。F7 备注
 -->
 <template>
   <aside class="purchase-commit-panel" :class="{ 'is-kb-zone': kbActive }">
@@ -216,6 +216,32 @@
     </div>
     <!-- 与分类/商品/清单底栏一致:顶部分隔线 + Ctrl+4 -->
     <div class="kb-hint">Ctrl+4</div>
+
+    <!-- 大号确认:替代 Element MessageBox,确定键写上 Ctrl+Enter -->
+    <el-dialog
+      :title="isLocal ? '确认提交' : '确认下一步'"
+      :visible.sync="confirmVisible"
+      width="560px"
+      append-to-body
+      custom-class="commit-confirm-dialog"
+      :close-on-click-modal="false"
+      @opened="focusConfirmBtn"
+    >
+      <div class="commit-confirm-body">
+        <div class="commit-confirm-tip">{{ isLocal ? '确认提交这张采购单?' : '确认进入下一步改价入库?' }}</div>
+        <div class="commit-confirm-row">供货商 {{ ghsName || '-' }}</div>
+        <div class="commit-confirm-row">应付 <span class="pay">¥{{ displayModifyPrice }}</span></div>
+      </div>
+      <span slot="footer">
+        <el-button @click="closeConfirmDialog">取消(Esc)</el-button>
+        <el-button
+          ref="confirmSubmitBtn"
+          type="primary"
+          :loading="submitting"
+          @click="submitOrder"
+        >{{ isLocal ? '确定提交' : '确定下一步' }}(Ctrl+Enter)</el-button>
+      </span>
+    </el-dialog>
   </aside>
 </template>
 
@@ -251,6 +277,8 @@ export default {
   data() {
     return {
       submitting: false,
+      /** 大号确认框:点下一步/提交或 Ctrl+Enter 先弹这个,再确认才真正下单 */
+      confirmVisible: false,
       modifyPrice: 0,
       totalFreight: 0,
       perKgFreight: 0,
@@ -382,6 +410,7 @@ export default {
     },
     /** 切换供货商时重置费用与人员,避免串单 */
     resetPanel() {
+      this.confirmVisible = false
       this.form = this.createEmptyForm()
       this.form.needPrint = this.isLocal ? 1 : 2
       // 简约模式带入门店默认每公斤成本
@@ -475,12 +504,27 @@ export default {
       if (!this.isLocal) return
       this.form.needPrint = needPrint
     },
+    /** 父页 Esc:关掉确认框,不跳回搜索 */
+    closeConfirmDialog() {
+      this.confirmVisible = false
+    },
+    /** 弹框打开后焦点落到确定,方便看见当前可 Ctrl+Enter */
+    focusConfirmBtn() {
+      this.$nextTick(() => {
+        const btn = this.$refs.confirmSubmitBtn
+        if (btn && btn.$el && typeof btn.$el.focus === 'function') btn.$el.focus()
+      })
+    },
     /**
      * 提交采购单:对齐 App details.confirmFn → POST /purchase-order/create-order
      * 本地 inType=1;上游 inType=0(下一步改价)
+     * 第一次点/Ctrl+Enter 只开大号确认框;框已开再点或再按 Ctrl+Enter 才下单。
      */
     submitOrder() {
       const that = this
+      if (this.submitting) {
+        return
+      }
       if (!this.ghsId || Number(this.ghsId) === 0) {
         this.$message({ message: '请选择供货商', type: 'warning' })
         return
@@ -493,6 +537,11 @@ export default {
         this.$message({ message: '应付金额要大于0', type: 'warning' })
         return
       }
+      if (!this.confirmVisible) {
+        this.confirmVisible = true
+        return
+      }
+      this.confirmVisible = false
       const itemInfo = this.selectList.map(ele => ({
         name: ele.name,
         classId: ele.classId,
@@ -519,20 +568,14 @@ export default {
         inType,
         globalCgMyCharge: this.globalCgMyCharge || 0
       }
-      this.$confirm('确认提交?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        that.submitting = true
-        that.$service.purchaseOrder.createOrder(params).then(data => {
-          that.submitting = false
-          // 成功态由父页整页展示,不再弹右上角通知,避免和「采购成功」重复
-          that.$emit('success', data || {})
-        }).catch(() => {
-          that.submitting = false
-        })
-      }).catch(() => {})
+      that.submitting = true
+      that.$service.purchaseOrder.createOrder(params).then(data => {
+        that.submitting = false
+        // 成功态由父页整页展示,不再弹右上角通知,避免和「采购成功」重复
+        that.$emit('success', data || {})
+      }).catch(() => {
+        that.submitting = false
+      })
     }
   }
 }
@@ -674,3 +717,50 @@ export default {
   }
 }
 </style>
+
+<style lang="scss">
+/* append-to-body 的确认框不受 scoped 影响,单独放大标题/金额/按钮 */
+.commit-confirm-dialog {
+  .el-dialog__header {
+    padding: 24px 32px 10px;
+  }
+  .el-dialog__title {
+    font-size: 22px;
+    font-weight: 700;
+    line-height: 30px;
+  }
+  .el-dialog__body {
+    padding: 8px 32px 6px;
+  }
+  .el-dialog__footer {
+    padding: 16px 32px 28px;
+  }
+  .el-dialog__footer .el-button {
+    min-width: 168px;
+    height: 48px;
+    font-size: 16px;
+    padding: 0 18px;
+  }
+}
+.commit-confirm-body {
+  font-size: 16px;
+  line-height: 1.6;
+  color: #303133;
+}
+.commit-confirm-tip {
+  margin-bottom: 16px;
+  font-size: 18px;
+  font-weight: 700;
+  color: #303133;
+}
+.commit-confirm-row {
+  margin-top: 12px;
+  font-size: 16px;
+  color: #606266;
+  .pay {
+    font-size: 28px;
+    font-weight: 700;
+    color: #f56c6c;
+  }
+}
+</style>

+ 15 - 0
ghs/src/views/in/confirm.vue

@@ -1214,6 +1214,21 @@ export default {
       const that = this
       document.onkeydown = function(e) {
         if (!e) return
+        const commitPanel = that.$refs.commitPanel
+        // 大号确认框打开时:Esc 关框,Ctrl+Enter 真正提交,其它键不抢 POS
+        if (commitPanel && commitPanel.confirmVisible) {
+          if (e.key === 'Escape') {
+            e.preventDefault()
+            commitPanel.closeConfirmDialog()
+            return
+          }
+          if ((e.key == 'Enter' && e.ctrlKey && !e.altKey) || (e.key === '/' && e.ctrlKey)) {
+            e.preventDefault()
+            commitPanel.submitOrder()
+            return
+          }
+          return
+        }
         if (that.isMessageBoxOpen()) return
         // 中文输入法选词时不要抢 ↓/Enter,否则候选框无法用键盘
         if ((e.isComposing || e.keyCode === 229) && (e.key == 'ArrowDown' || e.key == 'ArrowUp' || e.key == 'ArrowLeft' || e.key == 'ArrowRight' || e.key == 'Enter')) return

+ 15 - 0
ghs/src/views/order/add.vue

@@ -962,6 +962,21 @@ export default {
       const that = this
       document.onkeydown = function(e) {
         if (!e) return
+        const commitPanel = that.$refs.commitPanel
+        // 大号确认框打开时:Esc 关框,Ctrl+Enter 真正提交,其它键不抢 POS
+        if (commitPanel && commitPanel.confirmVisible) {
+          if (e.key === 'Escape') {
+            e.preventDefault()
+            commitPanel.closeConfirmDialog()
+            return
+          }
+          if (e.key == 'Enter' && e.ctrlKey) {
+            e.preventDefault()
+            commitPanel.submitOrder(false)
+            return
+          }
+          return
+        }
         if (that.isMessageBoxOpen()) return
         // 中文输入法选词时不要抢 ↓/Enter,否则候选框无法用键盘
         if ((e.isComposing || e.keyCode === 229) && (e.key == 'ArrowDown' || e.key == 'ArrowUp' || e.key == 'ArrowLeft' || e.key == 'ArrowRight' || e.key == 'Enter')) return