From b45eed171519ffe4f95d0d10743e7b3a25fcd569 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 01 七月 2024 15:43:07 +0800
Subject: [PATCH] 2024-07-01

---
 src/views/pay/index.jsx |   40 ++++++++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/src/views/pay/index.jsx b/src/views/pay/index.jsx
index 7230ba5..c3c5575 100644
--- a/src/views/pay/index.jsx
+++ b/src/views/pay/index.jsx
@@ -27,37 +27,46 @@
     second: 60,
     overdue: false,
     overdone: false,
-    appId: ''
+    appId: '',
+    merchId: ''
   }
 
   UNSAFE_componentWillMount () {
     let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
 
-    let _appId = param.appId || window.GLOB.WXAppID || window.GLOB.WXminiAppID || ''
+    let appId = param.appId || window.GLOB.WXAppID || window.GLOB.WXminiAppID || ''
+    let merchId = param.merchId || window.GLOB.WXMerchID || ''
 
     this.setState({
       orderId: param.ID,
-      appId: _appId
+      appId: appId,
+      merchId: merchId
     })
 
-    if (param.ID && _appId) {
-      this.getOrder(param.ID, _appId)
+    if (param.ID && appId && merchId) {
+      this.getOrder(param.ID, appId, merchId)
     } else if (!param.ID) {
       notification.warning({
         top: 92,
         message: '鏈幏鍙栧埌璁㈠崟ID锛�',
         duration: 5
       })
-    } else if (!_appId) {
+    } else if (!appId) {
       notification.warning({
         top: 92,
         message: '鏈幏鍙栧埌搴旂敤ID锛�',
         duration: 5
       })
+    } else if (!merchId) {
+      notification.warning({
+        top: 92,
+        message: '鏈幏鍙栧埌鍟嗘埛鍙凤紒',
+        duration: 5
+      })
     }
   }
 
-  getOrder = (Id, appId) => {
+  getOrder = (Id, appId, merchId) => {
     let param = {
       func: 's_get_weixin_pay_native',
       ID: Id
@@ -108,7 +117,7 @@
           return
         }
 
-        Api.getWxNativePay({ 'out_biz_no': res.out_trade_no, app_id: appId }).then(result => {
+        Api.getWxNativePay({ 'out_biz_no': res.out_trade_no, app_id: appId, mchid: merchId }).then(result => {
           if (result.status && result.code_url) {
             this.setState({
               qrcode: result.code_url
@@ -183,7 +192,7 @@
   }
 
   resetQrcode = () => {
-    const { orderNo, appId } = this.state
+    const { orderNo, appId, merchId } = this.state
 
     if (!orderNo) {
       notification.warning({
@@ -199,9 +208,16 @@
         duration: 5
       })
       return
+    } else if (!merchId) {
+      notification.warning({
+        top: 10,
+        message: '鏈幏鍙栧埌鍟嗘埛鍙凤紒',
+        duration: 5
+      })
+      return
     }
 
-    Api.getWxNativePay({ 'out_biz_no': orderNo, app_id: appId }).then(result => {
+    Api.getWxNativePay({ 'out_biz_no': orderNo, app_id: appId, mchid: merchId }).then(result => {
       if (result.status && result.code_url) {
         this.setState({
           qrcode: result.code_url,
@@ -219,9 +235,9 @@
     })
   }
 
-  onChange = () => {
+  // onChange = () => {
 
-  }
+  // }
 
   render () {
     const { logo, name, orderNo, icp, copyRight, total, unit, qrcode, second, overdue, overdone } = this.state

--
Gitblit v1.8.0