This commit is contained in:
2026-04-30 16:29:16 +08:00
parent 0ddcfcf7c6
commit e437b178ae
2 changed files with 34 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ from PySide6.QtWidgets import (
QMainWindow,
QMessageBox,
QPushButton,
QSizePolicy,
QTableWidget,
QTableWidgetItem,
QTextEdit,
@@ -81,6 +82,14 @@ def suggest_wallet_id(wallet_type: str, params: str) -> str:
mob = p.get("mobile")
if isinstance(mob, str) and mob:
return f"{wallet_type}_{mob}"
# googlepay business: merchantInfo.phone 或 channelUid
merchant_info = p.get("merchantInfo") or {}
phone = merchant_info.get("phone") or p.get("phone")
if isinstance(phone, str) and phone:
return f"{wallet_type}_{phone}"
channel_uid = p.get("channelUid")
if isinstance(channel_uid, str) and channel_uid:
return f"{wallet_type}_{channel_uid}"
return ""
@@ -98,12 +107,15 @@ class WalletEditDialog(QDialog):
) -> None:
super().__init__(parent)
self.setWindowTitle(title)
self.setMinimumSize(640, 480)
self.setMinimumSize(900, 480)
self.resize(1000, 600)
self._is_add = is_add
self._id_locked = not allow_change_id and bool(wallet_id)
layout = QVBoxLayout(self)
form = QFormLayout()
form.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
form.setLabelAlignment(Qt.AlignmentFlag.AlignRight)
self.edit_uid: QLineEdit | None = None
if is_add:
self.edit_uid = QLineEdit("10000")
@@ -120,6 +132,10 @@ class WalletEditDialog(QDialog):
self.combo_type.setCurrentText(wallet_type)
self.edit_id = QLineEdit(wallet_id)
self.edit_id.setPlaceholderText("留空则根据 params 里 mobile 自动生成")
self.edit_id.setMinimumWidth(720)
sp = self.edit_id.sizePolicy()
sp.setHorizontalPolicy(QSizePolicy.Policy.Expanding)
self.edit_id.setSizePolicy(sp)
if self._id_locked:
self.edit_id.setReadOnly(True)
form.addRow("类型", self.combo_type)
@@ -152,6 +168,9 @@ class WalletEditDialog(QDialog):
if not self._is_add or self.edit_uid is None:
return "10000"
return self.edit_uid.text().strip() or "10000"
@property
def wallet_type(self) -> str:
return self.combo_type.currentText().strip()
@property