feat: 收银台只有一个支付方式默认唤起

This commit is contained in:
wolter 2025-02-18 10:47:17 +08:00
parent d634ca7d22
commit 3f26ffa8cb
2 changed files with 6 additions and 3 deletions
app/third/paymentService
front/templates

View File

@ -30,7 +30,7 @@ type WxPay struct {
SerialNo string `json:"serial_no"` // 商户证书的证书序列号
ApiV3Key string `json:"api_v_3_key"` // apiV3Key商户平台获取
PrivateKey string `json:"private_key"` // 私钥 apiclient_key.pem 读取后的内容
Secret string `json:"secret"` // 商户私钥,读取后的内容
Secret string `json:"secret"` // 和appid配对使用
}
type AliPay struct {

View File

@ -1,6 +1,7 @@
{{define "payPage.html"}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -38,8 +39,6 @@
button:hover {
background-color: #0056b3;
}
</style>
</head>
@ -100,6 +99,8 @@
if (data === null || data.data.length === 0) {
const pay = document.getElementById('pay');
pay.innerHTML = '<h3>支付环境异常,请检查</h3>';
} else if (data.data.length === 1) {
window.location.href = `/pay/front/api/v1/payPage/submit?pay_channel_id=${data.data[0].pay_channel_id}&no=${id}`;
} else {
renderPaymentMethods(data.data);
}
@ -136,6 +137,7 @@
const submitButton = document.createElement('button');
submitButton.type = 'button';
submitButton.textContent = '提交';
submitButton.onclick = function () {
const no = getQueryParam('no');
const selectedMethod = document.querySelector('input[name="paymentMethod"]:checked');
@ -154,6 +156,7 @@
</script>
{{ else}}
<body>
<p>{{.message}}</p>
</body>