|
|
@@ -21,7 +21,7 @@
|
|
|
>
|
|
|
关闭批次
|
|
|
</el-button>
|
|
|
- <el-button icon="Refresh" @click="load">刷新</el-button>
|
|
|
+ <el-button icon="Refresh" :loading="refreshing" @click="refresh">刷新</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -108,6 +108,7 @@ const pageNo = ref(1);
|
|
|
const pageSize = ref(20);
|
|
|
const loading = ref(false);
|
|
|
const payLoading = ref(false);
|
|
|
+const refreshing = ref(false);
|
|
|
|
|
|
type TagType = "primary" | "success" | "warning" | "info" | "danger";
|
|
|
const STATUS_TAG: Record<string, TagType> = {
|
|
|
@@ -147,13 +148,31 @@ async function load() {
|
|
|
pageSize.value
|
|
|
);
|
|
|
order.value = res.data.data?.order || null;
|
|
|
- details.value = res.data.data?.details?.items || [];
|
|
|
+ // 双保险解包: 后端 PageResult 序列化字段是 list(与存量 index.vue 一致)
|
|
|
+ details.value = res.data.data?.details?.items || res.data.data?.details?.list || [];
|
|
|
total.value = res.data.data?.details?.total || 0;
|
|
|
} finally {
|
|
|
loading.value = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/** 刷新: 先调 batchQuery 同步支付宝侧批次+明细状态,再拉取本地详情展示(I1 手动兜底) */
|
|
|
+async function refresh() {
|
|
|
+ if (!enterpriseId.value) {
|
|
|
+ ElMessage.warning("未获取到企业信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ refreshing.value = true;
|
|
|
+ try {
|
|
|
+ await BatchPayAPI.batchQuery(enterpriseId.value, props.outBatchNo);
|
|
|
+ } catch {
|
|
|
+ // 同步失败不阻塞本地展示(batchQuery 失败原因已由 request.ts 提示)
|
|
|
+ } finally {
|
|
|
+ refreshing.value = false;
|
|
|
+ }
|
|
|
+ await load();
|
|
|
+}
|
|
|
+
|
|
|
async function handlePay() {
|
|
|
if (!order.value || !enterpriseId.value) return;
|
|
|
payLoading.value = true;
|
|
|
@@ -165,9 +184,14 @@ async function handlePay() {
|
|
|
ElMessage.warning("未获取到支付页面");
|
|
|
return;
|
|
|
}
|
|
|
- document.open();
|
|
|
- document.write(payHtml);
|
|
|
- document.close();
|
|
|
+ // 新窗口打开支付页(设计 M4): 避免 document.write 同页替换销毁当前 SPA
|
|
|
+ const w = window.open("about:blank", "_blank");
|
|
|
+ if (w) {
|
|
|
+ w.document.write(payHtml);
|
|
|
+ w.document.close();
|
|
|
+ } else {
|
|
|
+ ElMessage.warning("支付页弹窗被浏览器拦截,请允许弹窗后重试");
|
|
|
+ }
|
|
|
} finally {
|
|
|
payLoading.value = false;
|
|
|
}
|