def init_sign(self): self.pushButton.clicked.connect(self.add_person) max_card = mysql.max('bill_tb')[0][0] or 0 self.lineEdit_2.setPlaceholderText('当前最高卡号:' + str(max_card) + ',推荐填' + str(int(max_card) + 1)) # self.doubleSpinBox.valueChanged.connect(lambda: self.lineEdit_3.setText(self.doubleSpinBox.text())) self.lineEdit_1.textChanged.connect(lambda: self.label_4.setText(str(len(self.lineEdit_1.text())) + '/11位')) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
def add_person(self): name = self.lineEdit.text().strip() phone = self.lineEdit_1.text().strip() card = self.lineEdit_2.text().strip() balance = self.doubleSpinBox.text() or 0 type = self.lineEdit_3.text().strip() if phone != '' and mysql.query_str('user_tb', 'phone', phone): QMessageBox.information(self, "温馨提示", "手机号已存在。", QMessageBox.Yes) return if card == '': QMessageBox.information(self, "温馨提示", "请填写卡号", QMessageBox.Yes) return if not card.isdigit(): QMessageBox.information(self, "温馨提示", "请填写数字", QMessageBox.Yes) return if mysql.query('user_tb', 'card', card): QMessageBox.information(self, "温馨提示", "卡号已存在。", QMessageBox.Yes) return mysql.add_person(name, phone, card, balance, type) id = mysql.query('user_tb', 'card', card) if id: bills.person_in(str(balance), name, phone, card, balance, id[0][0]) else: QMessageBox.information(self, "温馨提示", "请至少填写卡号或手机号", QMessageBox.Yes) return self.lineEdit.clear() self.lineEdit_1.clear() self.lineEdit_2.clear() self.doubleSpinBox.setValue(0) self.lineEdit_3.clear() self.lineEdit.setFocus() max_card = mysql.max('bill_tb')[0][0] or 0 self.lineEdit_2.setPlaceholderText('当前最高卡号:' + str(max_card) + ',推荐填' + str(int(max_card) + 1)) AddWindow.close() MainWindow.search_data_by_card(card) MainWindow.check_page_data() MainWindow.load_initial_bill()
def init_sign(self): _translate = QtCore.QCoreApplication.translate self.label_3.setText(_translate("Form", "<html><head/><body><p><img src=\":/main/充值.png\" width=\"30\" height=\"30\"/><span style=\" font-size:20pt; font-weight:600; vertical-align:super;\">余额</span></p></body></html>")) self.pushButton_2 = QtWidgets.QPushButton() self.pushButton_2.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.pushButton_2.setObjectName("pushButton_2") self.gridLayout.addWidget(self.pushButton_2, 6, 2, 1, 1) max_card = mysql.max('bill_tb')[0][0] or 0 self.lineEdit_2.setPlaceholderText('当前最高卡号:' + str(max_card) + ',推荐填' + str(int(max_card) + 1)) self.lineEdit_1.textChanged.connect(lambda: self.label_4.setText(str(len(self.lineEdit_1.text())) + '/11位')) self.pushButton_2.clicked.connect(self.cancel) self.pushButton.clicked.connect(self.add_person) self.pushButton.setText('下一个') self.pushButton_2.setText('结束') self.setTabOrder(self.lineEdit, self.lineEdit_1) self.setTabOrder(self.lineEdit_1, self.lineEdit_2) self.setTabOrder(self.lineEdit_2, self.doubleSpinBox) self.setTabOrder(self.doubleSpinBox, self.lineEdit_3) self.setTabOrder(self.lineEdit_3, self.pushButton) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
def cancel(self): AddMoreWindow.close() max_card = mysql.max('bill_tb')[0][0] or 0 AddMoreWindow.lineEdit_2.setPlaceholderText('当前最高卡号:' + str(max_card) + ',推荐填' + str(int(max_card) + 1))
def add_more_person(self): max_card = mysql.max('bill_tb')[0][0] or 0 AddMoreWindow.lineEdit_2.setPlaceholderText('当前最高卡号:' + str(max_card) + ',推荐填' + str(int(max_card) + 1)) AddMoreWindow.show()