From ab0742bf945b5de8554761de6fa4ecda29f640e0 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期三, 09 七月 2025 11:01:29 +0800
Subject: [PATCH] fix:默认支付界面修改

---
 inc/thirdpay.asp   |    4 
 inc/thirdpay.php   |   35 ++++++++
 pay/weixin_pay.asp |    2 
 index.asp          |  199 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 235 insertions(+), 5 deletions(-)

diff --git a/inc/thirdpay.asp b/inc/thirdpay.asp
index f9eb1ce..cf05bcc 100644
--- a/inc/thirdpay.asp
+++ b/inc/thirdpay.asp
@@ -1,6 +1,6 @@
 <%
 '绗笁鏂规敮浠�
-Function ThirdPay(PayMoney,ServiceOrdID,DispatchOrdID)
+Function ThirdPay(PayType,PayMoney,ServiceOrdID,DispatchOrdID)
 'PayType:鏀粯绫诲瀷
 'PayMoney:鏀粯閲戦
 'ServiceOrdID:鏈嶅姟鍗旾D 
@@ -11,7 +11,7 @@
 If not rs.Eof then	 
       PayQRcodeURL = rs("PayQRcodeURL")
       if PayQRcodeURL<>"" then
-         PayQRcodeURL = PayQRcodeURL&"?PayMoney="&PayMoney&"&ServiceOrdID="&ServiceOrdID&"&DispatchOrdID="&DispatchOrdID
+         PayQRcodeURL = PayQRcodeURL&"?PayType="&PayType&"&PayMoney="&PayMoney&"&ServiceOrdID="&ServiceOrdID&"&DispatchOrdID="&DispatchOrdID
          Response.Redirect PayQRcodeURL
       end if
 End If
diff --git a/inc/thirdpay.php b/inc/thirdpay.php
new file mode 100644
index 0000000..15333bc
--- /dev/null
+++ b/inc/thirdpay.php
@@ -0,0 +1,35 @@
+<?php
+//绗笁鏂规敮浠�
+
+/**
+ * 绗笁鏂规敮浠樺鐞嗗嚱鏁�
+ * @param string $PayType 鏀粯绫诲瀷
+ * @param float $PayMoney 鏀粯閲戦
+ * @param int $ServiceOrdID 鏈嶅姟鍗旾D
+ * @param int $DispatchOrdID 璋冨害鍗旾D
+ * @return void
+ */
+function ThirdPay($PayType, $PayMoney, $ServiceOrdID, $DispatchOrdID) {
+    global $objConn; // 鍋囪鏁版嵁搴撹繛鎺ュ璞′负鍏ㄥ眬鍙橀噺
+    
+    // 鏌ヨ鏈嶅姟璁㈠崟淇℃伅
+    $sql = "SELECT * FROM ServiceOrder WHERE ServiceOrdID = ?";
+    $params = array($ServiceOrdID);
+    $result = sqlsrv_query($objConn, $sql, $params);
+    
+    if ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
+        $PayQRcodeURL = $row['PayQRcodeURL'];
+        if (!empty($PayQRcodeURL)) {
+            // 鏋勫缓鏀粯URL骞堕噸瀹氬悜
+            $PayQRcodeURL .= "?PayType=" . urlencode($PayType) . 
+                            "&PayMoney=" . urlencode($PayMoney) . 
+                            "&ServiceOrdID=" . intval($ServiceOrdID) . 
+                            "&DispatchOrdID=" . intval($DispatchOrdID);
+            header("Location: " . $PayQRcodeURL);
+            exit;
+        }
+    }
+    
+    sqlsrv_free_stmt($result);
+}
+?>
\ No newline at end of file
diff --git a/index.asp b/index.asp
index e12423b..6b37550 100644
--- a/index.asp
+++ b/index.asp
@@ -8,7 +8,202 @@
 n	= Request("n")
 s	= Request("s")
 u	= Request("u")
-l	= Request("l")	'注册用户/登陆
+l	= Request("l")	'娉ㄥ唽鐢ㄦ埛/鐧诲綍
+
+' 濡傛灉娌℃湁浼犻�掍换浣曞弬鏁帮紝鏄剧ず鐧诲綍鐮佽緭鍏ラ〉闈�
+If n="" And s="" And u="" And l="" Then
+%>
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>鐧诲綍鐮佽緭鍏�</title>
+    <style>
+        body {
+            font-family: Arial, sans-serif;
+            background-color: #f5f5f5;
+            margin: 0;
+            padding: 20px;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            min-height: 100vh;
+        }
+        .container {
+            background: white;
+            padding: 30px;
+            border-radius: 10px;
+            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
+            text-align: center;
+            max-width: 400px;
+            width: 100%;
+        }
+        .title {
+            font-size: 24px;
+            color: #333;
+            margin-bottom: 30px;
+        }
+        .input-group {
+            margin-bottom: 20px;
+        }
+        .input-group label {
+            display: block;
+            text-align: left;
+            margin-bottom: 8px;
+            color: #555;
+            font-weight: bold;
+        }
+        .input-group input {
+            width: 100%;
+            padding: 12px;
+            border: 2px solid #ddd;
+            border-radius: 5px;
+            font-size: 16px;
+            box-sizing: border-box;
+        }
+        .input-group input:focus {
+            outline: none;
+            border-color: #007bff;
+        }
+        .btn {
+            background-color: #007bff;
+            color: white;
+            padding: 12px 30px;
+            border: none;
+            border-radius: 5px;
+            font-size: 16px;
+            cursor: pointer;
+            margin: 5px;
+            transition: background-color 0.3s;
+        }
+        .btn:hover {
+            background-color: #0056b3;
+        }
+        .btn:disabled {
+            background-color: #ccc;
+            cursor: not-allowed;
+        }
+        .tip {
+            color: #666;
+            font-size: 14px;
+            margin-top: 20px;
+            line-height: 1.5;
+        }
+        .error {
+            color: #dc3545;
+            font-size: 14px;
+            margin-top: 10px;
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <div class="title">骞夸笢姘戣埅鍖荤枟蹇嚎 鏀粯鐧诲綍</div>
+        <form id="loginForm">
+            <div class="input-group">
+                <label for="loginCode">鐧诲綍鐮侊細</label>
+                <input type="text" id="loginCode" name="loginCode" maxlength="6" placeholder="璇疯緭鍏�6浣嶇櫥褰曠爜" autocomplete="off">
+            </div>
+            <div class="input-group">
+                <button type="button" id="payBtn" class="btn" disabled>鍘绘敮浠�</button>
+            </div>
+            <div class="tip">璇疯緭鍏ユ敮浠樼煭淇′腑鍙戦�佺殑鐧诲綍鐮�</div>
+            <div id="errorMsg" class="error" style="display: none;"></div>
+        </form>
+    </div>
+
+    <script>
+        const loginCodeInput = document.getElementById('loginCode');
+        const payBtn = document.getElementById('payBtn');
+        const errorMsg = document.getElementById('errorMsg');
+        let autoRedirectTimer = null;
+
+        function validateLoginCode(code) {
+            return /^[A-Za-z0-9]{6}$/.test(code);
+        }
+
+        function redirectToLogin(code) {
+            const currentUrl = window.location.href.split('?')[0];
+            window.location.href = currentUrl + '?n=' + encodeURIComponent(code);
+        }
+
+        function updateButtonState() {
+            const code = loginCodeInput.value.trim();
+            const isValid = validateLoginCode(code);
+            payBtn.disabled = !isValid;
+            
+            if (isValid) {
+                errorMsg.style.display = 'none';
+                // 娓呴櫎涔嬪墠鐨勫畾鏃跺櫒
+                if (autoRedirectTimer) {
+                    clearTimeout(autoRedirectTimer);
+                }
+                // 璁剧疆鑷姩璺宠浆瀹氭椂鍣紙2绉掑悗鑷姩璺宠浆锛�
+                autoRedirectTimer = setTimeout(() => {
+                    redirectToLogin(code);
+                }, 2000);
+            } else {
+                if (autoRedirectTimer) {
+                    clearTimeout(autoRedirectTimer);
+                    autoRedirectTimer = null;
+                }
+            }
+        }
+
+        function showError(message) {
+            errorMsg.textContent = message;
+            errorMsg.style.display = 'block';
+        }
+
+        function hideError() {
+            errorMsg.style.display = 'none';
+        }
+
+        // 杈撳叆妗嗕簨浠剁洃鍚�
+        loginCodeInput.addEventListener('input', function() {
+            const code = this.value.trim();
+            
+            // 鍙厑璁歌緭鍏ユ暟瀛楀拰瀛楁瘝
+            this.value = code.replace(/[^A-Za-z0-9]/g, '');
+            
+            updateButtonState();
+            hideError();
+        });
+
+        // 鏀粯鎸夐挳鐐瑰嚮浜嬩欢
+        payBtn.addEventListener('click', function() {
+            const code = loginCodeInput.value.trim();
+            if (validateLoginCode(code)) {
+                redirectToLogin(code);
+            } else {
+                showError('璇疯緭鍏ユ纭殑6浣嶇櫥褰曠爜');
+            }
+        });
+
+        // 鍥炶溅閿彁浜�
+        loginCodeInput.addEventListener('keypress', function(e) {
+            if (e.key === 'Enter') {
+                const code = this.value.trim();
+                if (validateLoginCode(code)) {
+                    redirectToLogin(code);
+                } else {
+                    showError('璇疯緭鍏ユ纭殑6浣嶇櫥褰曠爜');
+                }
+            }
+        });
+
+        // 椤甸潰鍔犺浇鏃惰仛鐒﹀埌杈撳叆妗�
+        window.addEventListener('load', function() {
+            loginCodeInput.focus();
+        });
+    </script>
+</body>
+</html>
+<%
+Response.End
+End If
+
 Response.Cookies("n")=n
 Response.Cookies("n").Expires=DateAdd("n",30,now())
 Response.Cookies("s")=s
@@ -50,7 +245,7 @@
 	End If
 	rs.close()
 
-ElseIf l="1" Then	'注册用户/登陆(手机)
+ElseIf l="1" Then	'娉ㄥ唽鐢ㄦ埛/鐧诲綍(鎵嬫満)
 	LoginType	= Request("t")
 	UserPhone	= Request("p")
 	If LoginType="" Then LoginType=1
diff --git a/pay/weixin_pay.asp b/pay/weixin_pay.asp
index ae64a21..9c40399 100644
--- a/pay/weixin_pay.asp
+++ b/pay/weixin_pay.asp
@@ -19,7 +19,7 @@
 If state="" Then state=session("state")
 session("state")=state
 '绗笁鏂规敮浠�
-ThirdPay Total_fee,ServiceOrdID,DispatchOrdID
+ThirdPay "weixin",Total_fee,ServiceOrdID,DispatchOrdID
 
 If code<>"" And Right(state,1)="N" Then
 	OpenID=GetOpenID(code)

--
Gitblit v1.9.1