Bladeren bron

feat: 补扣按钮直接放到订单操作列,一键触发

- 每行订单操作列新增「补扣」按钮(UNPAID + 有金额时显示)
- 点击弹出金额确认 → 确认后自动补扣,无需输入任何信息
- 保留原顶部工具栏按钮作为高级入口(可手动指定商户单号)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 22 uur geleden
bovenliggende
commit
224b9ded4f
2 gewijzigde bestanden met toevoegingen van 36 en 0 verwijderingen
  1. 11 0
      haha-admin-web/src/views/order/index.vue
  2. 25 0
      haha-admin-web/src/views/order/utils/hook.tsx

+ 11 - 0
haha-admin-web/src/views/order/index.vue

@@ -30,6 +30,7 @@ const {
   handlePayScoreCancel,
   handleQueryFromHaha,
   handleRepairPayScore,
+  quickRepairPayScore,
   handleSizeChange,
   handleCurrentChange
 } = useOrder(tableRef);
@@ -246,6 +247,16 @@ async function doPayScoreCancel() {
             >
               退款
             </el-button>
+            <el-button
+              v-if="row.payStatus === 'UNPAID' && (row.totalAmount || row.paidAmount) > 0"
+              class="reset-margin"
+              link
+              type="warning"
+              :size="size"
+              @click="quickRepairPayScore(row)"
+            >
+              补扣
+            </el-button>
           </template>
         </pure-table>
       </template>

+ 25 - 0
haha-admin-web/src/views/order/utils/hook.tsx

@@ -786,6 +786,30 @@ export function useOrder(tableRef: Ref) {
     }
   }
 
+  async function quickRepairPayScore(row: OrderItem) {
+    const amount = row.paidAmount || row.totalAmount || 0;
+    try {
+      await ElMessageBox.confirm(
+        `确认对订单 ${row.orderNo} 发起支付分补扣?扣款金额: ¥${amount}`,
+        "支付分补扣",
+        { confirmButtonText: "确认", cancelButtonText: "取消", type: "warning" }
+      );
+    } catch {
+      return;
+    }
+    try {
+      const res = await repairPayScorePayment(String(row.id), undefined);
+      if (res.code === 200) {
+        message(res.message || "补扣成功", { type: "success" });
+        onSearch();
+      } else {
+        message(res.message || "补扣失败", { type: "error" });
+      }
+    } catch {
+      message("补扣请求失败", { type: "error" });
+    }
+  }
+
   onMounted(() => {
     onSearch();
   });
@@ -801,6 +825,7 @@ export function useOrder(tableRef: Ref) {
     handleDetail,
     handleRefund,
     handleRepairPayScore,
+    quickRepairPayScore,
     handlePayScoreCancel,
     handleQueryFromHaha,
     handleSizeChange,