From 086f9ad4d37860f0610f575c47537c01f7a1747c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=B4=B2=E6=B4=B2?= <1423888965@qq.com> Date: Mon, 27 May 2024 13:37:24 +0800 Subject: [PATCH] first commit --- 银行系统v1.0/.idea/.gitignore | 3 + 银行系统v1.0/.idea/.name | 1 + .../inspectionProfiles/profiles_settings.xml | 6 + 银行系统v1.0/.idea/misc.xml | 7 + 银行系统v1.0/.idea/modules.xml | 8 + 银行系统v1.0/.idea/银行系统v1.0.iml | 10 ++ .../__pycache__/admin.cpython-37.pyc | Bin 0 -> 1473 bytes .../__pycache__/admin.cpython-39.pyc | Bin 0 -> 1208 bytes .../__pycache__/atm.cpython-37.pyc | Bin 0 -> 4916 bytes .../__pycache__/atm.cpython-39.pyc | Bin 0 -> 4871 bytes .../__pycache__/card.cpython-37.pyc | Bin 0 -> 474 bytes .../__pycache__/card.cpython-39.pyc | Bin 0 -> 477 bytes .../__pycache__/user.cpython-37.pyc | Bin 0 -> 467 bytes .../__pycache__/user.cpython-39.pyc | Bin 0 -> 470 bytes .../__pycache__/银行系统.cpython-39.pyc | Bin 0 -> 1616 bytes 银行系统v1.0/admin.py | 21 +++ 银行系统v1.0/atm.py | 137 ++++++++++++++ 银行系统v1.0/card.py | 6 + 银行系统v1.0/user.py | 6 + 银行系统v1.0/yinhang.py | 167 ++++++++++++++++++ 银行系统v1.0/银行系统.py | 43 +++++ 21 files changed, 415 insertions(+) create mode 100644 银行系统v1.0/.idea/.gitignore create mode 100644 银行系统v1.0/.idea/.name create mode 100644 银行系统v1.0/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 银行系统v1.0/.idea/misc.xml create mode 100644 银行系统v1.0/.idea/modules.xml create mode 100644 银行系统v1.0/.idea/银行系统v1.0.iml create mode 100644 银行系统v1.0/__pycache__/admin.cpython-37.pyc create mode 100644 银行系统v1.0/__pycache__/admin.cpython-39.pyc create mode 100644 银行系统v1.0/__pycache__/atm.cpython-37.pyc create mode 100644 银行系统v1.0/__pycache__/atm.cpython-39.pyc create mode 100644 银行系统v1.0/__pycache__/card.cpython-37.pyc create mode 100644 银行系统v1.0/__pycache__/card.cpython-39.pyc create mode 100644 银行系统v1.0/__pycache__/user.cpython-37.pyc create mode 100644 银行系统v1.0/__pycache__/user.cpython-39.pyc create mode 100644 银行系统v1.0/__pycache__/银行系统.cpython-39.pyc create mode 100644 银行系统v1.0/admin.py create mode 100644 银行系统v1.0/atm.py create mode 100644 银行系统v1.0/card.py create mode 100644 银行系统v1.0/user.py create mode 100644 银行系统v1.0/yinhang.py create mode 100644 银行系统v1.0/银行系统.py diff --git a/银行系统v1.0/.idea/.gitignore b/银行系统v1.0/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/银行系统v1.0/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/银行系统v1.0/.idea/.name b/银行系统v1.0/.idea/.name new file mode 100644 index 0000000..fb6e260 --- /dev/null +++ b/银行系统v1.0/.idea/.name @@ -0,0 +1 @@ +银行系统.py \ No newline at end of file diff --git a/银行系统v1.0/.idea/inspectionProfiles/profiles_settings.xml b/银行系统v1.0/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/银行系统v1.0/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/银行系统v1.0/.idea/misc.xml b/银行系统v1.0/.idea/misc.xml new file mode 100644 index 0000000..7d23246 --- /dev/null +++ b/银行系统v1.0/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/银行系统v1.0/.idea/modules.xml b/银行系统v1.0/.idea/modules.xml new file mode 100644 index 0000000..e03f935 --- /dev/null +++ b/银行系统v1.0/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/银行系统v1.0/.idea/银行系统v1.0.iml b/银行系统v1.0/.idea/银行系统v1.0.iml new file mode 100644 index 0000000..a2f61d1 --- /dev/null +++ b/银行系统v1.0/.idea/银行系统v1.0.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/银行系统v1.0/__pycache__/admin.cpython-37.pyc b/银行系统v1.0/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..750d4614f9c78dde799f201d8de799ca272cd70e GIT binary patch literal 1473 zcmb7E-A@xi5WkOJdlpK9l4vx+`qoo(T0V^-2E}MhOpQT&XqsFawk8#5>wQRQAc2U8 z1`q=pAS4I|KN6r18cF2C|Kncu+UpY!#%G<`YfEW(&}n97cV>3>`upwfHJ{JRfSil1 zM;ir(`GJ$7@Gxix)sBL>$q57hcW4L@v*uDp=_c%GUO9c6>7sl>7~Hc4^hltOOb)%0jWGQMO*b$*%1N8YO>|Y^~4X zxanX`vuy9I*z@8LbY?L6RK8(kIKPs#sVe40kM@`r9yZ z2peJtnTPBk+rz8%I_I2!!gpd8XdB`n%MWspZG$W&kY+hTNhF?5xVvx*#E@|cdfJ&y zdw0fqx|-Wq&P|V5ujT+RfPQa#!8il?im+3gpPjce8JSA{4~T(}LaCLN8OyyL!44-d zOxruL?Bes%LZcp%*_p|oJB!)zY3s$(-u48v$bFo&rl$(Mp#tu!DZ~>gLpR;@LUd6o zOd(2A{Y2s^BVjL1-NLf4FBR3a{-jFiw34hUT6rghJROJjC62ssm0Y0Ib0V9rbvP=k z4@sgaDoP^S7gH3|t0;X*V)Wv;T2USu(OxH`BKN8fjR%d02JdUxx8S3o;^|TGaYNPc f?Zr=kj}XNw8V|vV!`xvDO|i|{{t8z70%iUJ@&AOO literal 0 HcmV?d00001 diff --git a/银行系统v1.0/__pycache__/admin.cpython-39.pyc b/银行系统v1.0/__pycache__/admin.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e10c0fee1097a16aa1abd64a5242eb351e193c18 GIT binary patch literal 1208 zcmZ`&TTc^F5I%crO9i}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RESZIc7+R z#X2N|h(>HphBD@p;6|eBzMTM4%aM&X+sgVxpo2Lea!QH>L`} zL1}4fy>VaPgKvs-9GbYAE!+4y@v&8WI#qzkAJ2*4?l7GSNb_em)>LEoKznXgoc>~Y zVn*pzG^TGNuK!~+WcEY|uy6EPVjNPU zc$Dbl)&vT3(EewnM{Hp64#mdASsvZXSeb~GE!UukVWmo}2IruW-#klxC(%cZZkf?=8fKub`@M{GWEGXc!yD$EN5!==uF(ADrMcoQ-P2Q=O}- z!gd_tHC3VWK4h{gJgnunuc->Vps7}c7{{q(IIIn}M4!U{cTI?Mk}5m-iB+u$se)8B zVR7usYV}qv2-O@qme(l-YZipnL601-)@xJhwkn7GmrAha+^tZ>#;2^8uhf3@?<9wy zscJuco$8M?f}n}4q7o;$Ngdr(HK}8S;wk^HA?P1I>O+mNp-KT+I!bs_o(W7Z~YJE$OR<; literal 0 HcmV?d00001 diff --git a/银行系统v1.0/__pycache__/atm.cpython-39.pyc b/银行系统v1.0/__pycache__/atm.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cc4daa1cf4200c5f27c14cf2e555e1f006c6531e GIT binary patch literal 4871 zcmb7I|8Eq>72nz2yWKm^4gmr#OIBGf3o~}1%uzfz; zvwNh_wS;5Bm(&hKphA!v_G`NEu9f zU*iTh&uH8n)>9^r9M+Q2D)hA^^UV*OoS=SxM(`{NS6}t*{|ISLOEIpcbk4YbMoSrL zQ`(S6aUbCpx6wy=jK|SidM zjbC*f%Id40Phv_TD|}H?qe?Dn_#KzE5yz2j4iBbA7{cMKU628}R~~lnp_eXWWd>x>7n8)7z-V#>j6{ z+jkKle$8o}(~L%Awr;Wndzr=2o_diC)S%g5C2|&7N?K_O0~dC}n=|xe0UbRo1uKyR z7Lrzhm3o+X$JKdsm@sS|rgb*vBIsl2qh8dD^cdnObmDa#op17@+cmoPv~goX8?;>0 zv%H9B4jY5E8v$-~&+zPFb1>$`VDqSFy{lo5glDOB(&|m^#mzWtW$t0+$>reVo5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y)#T!<&FRbu zsd5Y&VKuDSxYkl{BhnST;`sDyex^S98rC-et)VpR#?JqLY3S5T!-3Ai&gYkgwen%0 zb6}f<3WEHmp7YzVD`MXD*)eywV{ zwN4U(o+W-n&6+Te7Ynr_jPjX73?-|!bqUgBBv3)Y?DQ~!d|-t-VkIR624kL!s5 literal 0 HcmV?d00001 diff --git a/银行系统v1.0/__pycache__/card.cpython-37.pyc b/银行系统v1.0/__pycache__/card.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8f3852e5addff7c555e6753c6d104004e74f2d2 GIT binary patch literal 474 zcmYjMu}T9$5S`tN$r(%|mi|DRpp_6rq9=+Vhafh`!E)T55R%Kq-HW1JXG%LiKrAh+ zM4SA{wHDD@?0u6E$sF&^%uy9bR%oe=H#HF`(>QL3yfm1cU>=Xy=4t5MXSpO{rR%&xUWY-t`)C>Rrz014%T@p1Kbwae`*XSMjlZ*9mP;?->4Lc=GT1=sP8IYDf zHJupm|Aj==f$R<}p+IN~q!wCEDR8udnMzslBBSF98dkw)p7bEQ3oArHiV6uAg#!lz z?q~u*c27X5#-N<(vc~!1Mwc6Do+Y=X%k_C44|tPJhL?uPhJVHIo)JwH57>|mUa!tckAujhyP+iX62y54W?g-mRXfL5xX^~Xvv(Yi1a)x~qy@VIAn z-^Fe;XHl9cRo0bCb3GaIc}uCQNiN(*fS zoBYYP7SUSleRCm_Io_Mu-8XOMPFk%dA>Pv0WQzRBhh=yuI)L2*oslLjCcuM?NXv5y zy%hKVAyIVzyA8@H5}G2Zg_aYFJncd6JO9FFCT&2#!I`_dfZYLAq9R3=1dGZ8%gP6P zn$RtJY%oj)nUlG8jnP#x%$%PlMu!dO+pK?S*v;_T#%JOIFJ#t{e)mD$gP0ev@v$D{ z!`zl8DGL*yX7;))M)CL4$Jg|6{yv+}o^SWsyYU#}_UO(9N2(|_+PYOhR?uCoIqUAp_+~9)4 L#fT&B`T^(Y5S`t-(=&LDSo#Oj9NLOVB!XRf;4F{10G~TT6U@F z<+%SB5>*SZ`=Ejnp(&ACXgQ>vHuyB5!8Qlz=Z;SHMu$p1}#%JOMFJ!ineq&JkIAs$yJ?r+m z>3LzVC!=xt{q*rQe_XyVmW$`xqxdkLq9-2TxlpP8us>0XWo-x|v9`f`xP--yJ(~{4-O5IGea{Xd$Sx=(58ed?Meic`9|*qntGWGn%8R}UTGf+XHcEQv-&Fs)tGcSY zs{K-_K%g!CdfWfqA>YHPCz}C- z%=1oT_@*B8_+WnvyGg^2-u<3imhBf3{OigP6#{>W%@}|pb=&J==LqDEXl(&w}`;Q z{Oc&d;<07akjo3T)3xOjT&^UoczL+>!=U>`|NGtk?v2$W^Ups(%*SiW^}HYo63?^2 zhJ*_tggUfHFV2plnIEnAUs&jy4(mw}Fq{qsWt=y=a9xSTXj@+!1Z7my1F)v|)$QKp z?fvhr_P@T``}E8G&u>(0fg39)jhUZtfexq~M4v(|%8o@4CBg+#2b#eYu5qQm$}!+P zjHCrX=**#c|14H<+A$e4meD~P;&*eqq!V#8=9LMb1raKG*=vRdEjnpt~BNf!0l$K1X{BFSCS5vwu-ini;6{&-IQm)C@)2M-rUSbDPoF-x#)vY9G za%Ibq^EgYmd_!Tx3HxY&BLEeZf>A zjmEN_#xWOS2DYo1Iz^QwxIC$xmiF?$*=#laAi|g>mNKCQ_$;G9UH##|_|RU2wYctL zX)pui0X0h;q^ME~I{#%?R98J1P#Ngzw1&V66$PF6{bwfUPXo z)EwH!tvs(%&^M#sD1D^*-4aiawExuiIq?>W=U_^?=itSR;l+ID-pYM7^ZPYSA6W({ M>a!?6i!nR&UjRj_d;kCd literal 0 HcmV?d00001 diff --git a/银行系统v1.0/admin.py b/银行系统v1.0/admin.py new file mode 100644 index 0000000..9cd95e1 --- /dev/null +++ b/银行系统v1.0/admin.py @@ -0,0 +1,21 @@ +class Admin: + adminU = '丑陋的妖怪' # 管理员的账号 + adpwd = '1' # 管理员的密码 + def printAdminView(self): + print("*** 欢迎登录银行系统 ***") + def printsysFunctionView(self): + print("1.开户(1)\n 2.查询(2) ") + print(" 3.取款(3)\n 4.存款(4) ") + print(" 5.转账(5)\n 6.锁定(6) \n7.解锁(7)\n退出(8)") + def adminOption(self): + adminInput = input("请输入管理员账户:") + if self.adminU != adminInput: + print("管理员账户输入错误......") + return -1 + passwordInput = input("请输入密码:") + if self.adpwd != passwordInput: + print("输入密码有误......") + return -1 + else: + print("操作成功,请稍后......") + return 0 diff --git a/银行系统v1.0/atm.py b/银行系统v1.0/atm.py new file mode 100644 index 0000000..bae00ae --- /dev/null +++ b/银行系统v1.0/atm.py @@ -0,0 +1,137 @@ +from user import User +from card import Card +class ATM: + def __init__(self, alluser): + self.alluser = alluser + def randomiCardId(self): + import random + while True: + str_data = '' # 存储卡号 + for i in range(6): + ch = chr(random.randrange(ord('0'), ord('9') + 1)) + str_data += ch + if not self.alluser.get(str): # 判断卡号是否重复 + return str_data + def creatUser(self): + name = input("请输入姓名:") + Uid = input("请输入身份证号:") + phone = input("请输入手机号:") + prestMoney = float(input("请输入预存金额:")) + if prestMoney <= 0: + print("预存款输入有误,开户失败") + return -1 + oncePwd = input("请输入密码:") + passWord = input("请再次输入密码:") + if passWord != oncePwd: + print("两次密码输入不同......") + return -1 + print("密码设置成功,请牢记密码: %s " % passWord) + cardId = self.randomiCardId() + card = Card(cardId, oncePwd, prestMoney) # 创建卡 + user = User(name, Uid, phone, card) # 创建用户 + self.alluser[cardId] = user # 存入用户字典 + print("您的开户已完成,请牢记开户账号: %s" % cardId) + def checkpwg(self, realPwd): + for i in range(3): + psd2 = input("请输入密码:") + if realPwd == psd2: + return True + print("密码输错三次,系统自动退出......") + return False + def lockCard(self): + inptcardId = input("请输入您的卡号:") + user = self.alluser.get(inptcardId) + if not self.alluser.get(inptcardId): + print("此卡号不存在...锁定失败!") + return -1 + if user.card.cardLock: + print("该卡已经被锁定,无需再次锁定!") + return -1 + if not self.checkpwg(user.card.cardPwd): # 验证密码 + print("密码错误...锁定失败!!") + return -1 + user.card.cardLock = True + print("该卡被锁定成功!") + def searchUser(self, base=1): + if base == 2: + inptcardId = input("请输入转出主卡号:") + elif base == 3: + inptcardId = input("请输入转入卡号:") + elif base == 1: + inptcardId = input("请输入您的卡号:") + user = self.alluser.get(inptcardId) + # 如果卡号不存在,下面代码就会执行 + if not self.alluser.get(inptcardId): + print("此卡号不存在...查询失败!") + return -1 + if user.card.cardLock: + print("该用户已经被锁定...请解卡后使用!") + return -1 + if not self.checkpwg(user.card.cardPwd): # 验证密码 + print("密码错误过多...卡已经被锁定,请解卡后使用!") + user.card.cardLock = True + return -1 + if not base == 3: #查询转入账户 不打印余额 + print("账户: %s 余额: %.2f " % (user.card.cardId, user.card.money)) + return user + def getMoney(self): + userTF = self.searchUser() + if userTF != -1: + if userTF.card.cardId != '': + inptMoney = float(input("请输入取款金额:")) + if inptMoney > float(userTF.card.money): + print("输入的金额大于余额,请先查询余额!") + return -1 + userTF.card.money = float(userTF.card.money) - inptMoney + print("取款成功! 账户: %s 余额: %.2f " % (userTF.card.cardId, userTF.card.money)) + else: + return -1 + def saveMoney(self): + userTF = self.searchUser() + if userTF != -1: + if not userTF.card.cardLock == True: + if userTF.card.cardId != '': + inptMoney = float(input("请输入要存入得金额:")) + if inptMoney < 0: + print("请输入正确金额") + else: + userTF.card.money += inptMoney + print("存款成功! 账户: %s 余额: %.2f " % + (userTF.card.cardId, userTF.card.money)) + else: + return -1 + def transferMoney(self): + MasterTF = self.searchUser(base=2) + if (MasterTF == -1): + return -1 + userTF = self.searchUser(base=3) + if (userTF == -1): + return -1 + in_tr_Money = float(input("请输入转账金额:")) + if MasterTF.card.money >= in_tr_Money: + str = input("您确认要继续转账操作吗(Y/N)?:") + if str == "Y": + MasterTF.card.money -= in_tr_Money + print("转账成功! 账户: %s 余额: %.2f " % + (MasterTF.card.cardId, MasterTF.card.money)) + else: + print("转账失败,中止了操作") + else: + print("转账失败,余额不足! 账户: %s 余额: %.2f " % + (MasterTF.card.cardId, MasterTF.card.money)) + def unlockCard(self): + inptcardId = input("请输入您的卡号:") + user = self.alluser.get(inptcardId) + while 1: + if not self.alluser.get(inptcardId): + print("此卡号不存在...解锁失败!") + return -1 + elif not user.card.cardLock: + print("该卡未被锁定,无需解锁!") + break + elif not self.checkpwg(user.card.cardPwd): + print("密码错误...解锁失败!!") + return -1 + user.card.cardLock = False # 解锁 + print("该卡 解锁 成功!") + break diff --git a/银行系统v1.0/card.py b/银行系统v1.0/card.py new file mode 100644 index 0000000..3003fb7 --- /dev/null +++ b/银行系统v1.0/card.py @@ -0,0 +1,6 @@ +class Card: + def __init__(self, cardId, cardPwd, money): + self.cardId = cardId + self.cardPwd = cardPwd + self.money = money + self.cardLock = False \ No newline at end of file diff --git a/银行系统v1.0/user.py b/银行系统v1.0/user.py new file mode 100644 index 0000000..4688f1e --- /dev/null +++ b/银行系统v1.0/user.py @@ -0,0 +1,6 @@ +class User: + def __init__(self, name, id, phone, card): + self.name = name + self.id = id + self.phone = phone + self.card = card \ No newline at end of file diff --git a/银行系统v1.0/yinhang.py b/银行系统v1.0/yinhang.py new file mode 100644 index 0000000..50a7d47 --- /dev/null +++ b/银行系统v1.0/yinhang.py @@ -0,0 +1,167 @@ +import tkinter as tk +from tkinter import messagebox +from PIL import Image, ImageTk + + +class BankSystem: + def __init__(self): + self.accounts = {} + self.current_id = 0 + + def create_account(self, name, amount): + if name in self.accounts: + messagebox.showerror('错误', '帐户已存在.') + else: + self.current_id += 1 + self.accounts[name] = [self.current_id, float(amount)] + + def deposit(self, name, amount): + if name not in self.accounts: + messagebox.showerror('错误', '找不到帐户.') + else: + self.accounts[name][1] += float(amount) + messagebox.showinfo('成功', f'{amount} 元人民币存入帐户 {name}') + + def withdraw(self, name, amount): + if name not in self.accounts: + messagebox.showerror('错误', '找不到帐户..') + else: + if self.accounts[name][1] < float(amount): + messagebox.showerror('错误', '余额不足') + else: + self.accounts[name][1] -= float(amount) + messagebox.showinfo('成功', f'{amount} 元人民币从帐户中取出 {name}') + + def transfer(self, sender_name, receiver_name, amount): + if sender_name not in self.accounts or receiver_name not in self.accounts: + messagebox.showerror('错误', '账号不存在') + else: + if self.accounts[sender_name][1] < float(amount): + messagebox.showerror('错误', '余额不足') + else: + self.accounts[sender_name][1] -= float(amount) + self.accounts[receiver_name][1] += float(amount) + messagebox.showinfo('成功', f'{amount} 元人民币从帐户 {sender_name} 转出到帐户 {receiver_name}') + + def check_balance(self, name): + if name not in self.accounts: + messagebox.showerror('错误', '找不到帐户..') + else: + balance = self.accounts[name][1] + balance = int(balance) + messagebox.showinfo('Balance', f'账户 {name} 余额为 {balance} 元') + + +class BankGUI: + def __init__(self): + self.bank = BankSystem() + self.root = tk.Tk() + self.root.title('银行管理系统') + self.root.geometry('900x800') + + # 设置背景图片 + self.background_image = Image.open('background.jpg') + self.background_photo = ImageTk.PhotoImage(self.background_image) + self.background_label = tk.Label(self.root, image=self.background_photo) + self.background_label.place(x=0, y=0, relwidth=1, relheight=1) + + # 创建账户 + self.create_label = tk.Label(self.root, text='创建账户', font=('Arial', 16, 'bold')) + self.create_label.place(x=100, y=100) + self.name_label = tk.Label(self.root, text='账户名:') + self.name_label.place(x=100, y=150) + self.name_entry = tk.Entry(self.root) + self.name_entry.place(x=200, y=150) + self.amount_label = tk.Label(self.root, text='初始金额:') + self.amount_label.place(x=100, y=200) + self.amount_entry = tk.Entry(self.root) + self.amount_entry.place(x=200, y=200) + self.create_button = tk.Button(self.root, text='创建', command=self.create_account) + self.create_button.place(x=200, y=250) + + # 存款 + self.deposit_label = tk.Label(self.root, text='存款', font=('Arial', 16, 'bold')) + self.deposit_label.place(x=400, y=100) + self.deposit_name_label = tk.Label(self.root, text='账户名:') + self.deposit_name_label.place(x=400, y=150) + self.deposit_name_entry = tk.Entry(self.root) + self.deposit_name_entry.place(x=500, y=150) + self.deposit_amount_label = tk.Label(self.root, text='存款金额:') + self.deposit_amount_label.place(x=400, y=200) + self.deposit_amount_entry = tk.Entry(self.root) + self.deposit_amount_entry.place(x=500, y=200) + self.deposit_button = tk.Button(self.root, text='存款', command=self.deposit) + self.deposit_button.place(x=500, y=250) + + # 取款 + self.withdraw_label = tk.Label(self.root, text='取款', font=('Arial', 16, 'bold')) + self.withdraw_label.place(x=100, y=350) + self.withdraw_name_label = tk.Label(self.root, text='账户名:') + self.withdraw_name_label.place(x=100, y=400) + self.withdraw_name_entry = tk.Entry(self.root) + self.withdraw_name_entry.place(x=200, y=400) + self.withdraw_amount_label = tk.Label(self.root, text='取款金额:') + self.withdraw_amount_label.place(x=100, y=450) + self.withdraw_amount_entry = tk.Entry(self.root) + self.withdraw_amount_entry.place(x=200, y=450) + self.withdraw_button = tk.Button(self.root, text='取款', command=self.withdraw) + self.withdraw_button.place(x=200, y=500) + # 转账 + self.transfer_label = tk.Label(self.root, text='转账', font=('Arial', 16, 'bold')) + self.transfer_label.place(x=400, y=350) + self.transfer_sender_label = tk.Label(self.root, text='转出账户:') + self.transfer_sender_label.place(x=400, y=400) + self.transfer_sender_entry = tk.Entry(self.root) + self.transfer_sender_entry.place(x=500, y=400) + self.transfer_receiver_label = tk.Label(self.root, text='转入账户:') + self.transfer_receiver_label.place(x=400, y=450) + self.transfer_receiver_entry = tk.Entry(self.root) + self.transfer_receiver_entry.place(x=500, y=450) + self.transfer_amount_label = tk.Label(self.root, text='转账金额:') + self.transfer_amount_label.place(x=400, y=500) + self.transfer_amount_entry = tk.Entry(self.root) + self.transfer_amount_entry.place(x=500, y=500) + self.transfer_button = tk.Button(self.root, text='转账', command=self.transfer) + self.transfer_button.place(x=500, y=550) + + # 查询余额 + self.balance_label = tk.Label(self.root, text='查询余额', font=('Arial', 16, 'bold')) + self.balance_label.place(x=100, y=600) + self.balance_name_label = tk.Label(self.root, text='账户名:') + self.balance_name_label.place(x=100, y=650) + self.balance_name_entry = tk.Entry(self.root) + self.balance_name_entry.place(x=200, y=650) + self.balance_button = tk.Button(self.root, text='查询', command=self.check_balance) + self.balance_button.place(x=200, y=700) + + self.root.mainloop() + + def create_account(self): + name = self.name_entry.get() + amount = self.amount_entry.get() + self.bank.create_account(name, amount) + messagebox.showinfo('Success', f'创建成功 账号:{name} 账号余额:{amount}') + + def deposit(self): + name = self.deposit_name_entry.get() + amount = self.deposit_amount_entry.get() + self.bank.deposit(name, amount) + + def withdraw(self): + name = self.withdraw_name_entry.get() + amount = self.withdraw_amount_entry.get() + self.bank.withdraw(name, amount) + + def transfer(self): + sender = self.transfer_sender_entry.get() + receiver = self.transfer_receiver_entry.get() + amount = self.transfer_amount_entry.get() + self.bank.transfer(sender, receiver, amount) + + def check_balance(self): + name = self.balance_name_entry.get() + balance = self.bank.check_balance(name) + + +if __name__ == '__main__': + bank_gui = BankGUI() diff --git a/银行系统v1.0/银行系统.py b/银行系统v1.0/银行系统.py new file mode 100644 index 0000000..057c0f9 --- /dev/null +++ b/银行系统v1.0/银行系统.py @@ -0,0 +1,43 @@ +from admin import Admin +from atm import ATM +import time +class HomePage: + def __init__(self): + self.allUserD = {} # 使用字典存储数据 + self.atm = ATM(self.allUserD) + self.admin = Admin() # 管理员开机界面 + def saveUser(self): + self.allUserD.update(self.atm.alluser) + print("数据存盘成功") + def main(self): + self.admin.printAdminView() + resL = self.admin.adminOption() + if not resL: + while True: + self.admin.printsysFunctionView() + option = input("请输入您的操作:") + if option not in ("1", "2", "3", "4", "5", "6", "7", "S", "Q"): + print("输入操作项有误,请仔细确认!") + time.sleep(1) + if option == "1": # 开户 + self.atm.creatUser() + elif option == "2": # 查询 + self.atm.searchUser() + elif option == "3": # 取款 + self.atm.getMoney() + elif option == "4": # 存储 + self.atm.saveMoney() + elif option == "5": # 转账 + self.atm.transferMoney() + elif option == "6": # 锁定 + self.atm.lockCard() + elif option == "7": # 解锁 + self.atm.unlockCard() + elif option.upper() == "8": + if not (self.admin.adminOption()): + self.saveUser() + print('退出系统') + return -1 +if __name__ == "__main__": + homepage = HomePage() + homepage.main()