import time, re
operation = '''********欢迎使用漫漫影院系统*********
1.查看信息 2.添加会员 3.注销会员
4.查看购票 5.影票出售 6.影票退订
7.查看余票 8.增删管理 9.增删影片
10.销售记录 11.修改信息 12.退出系统
*********************************'''
def management_login(a, b, c, d):
account = input('请您输入账号:')
password = input('请您输入密码:')
if account in a:
if a[account][0] == password:
time.sleep(0.5)
print('密码正确,登录成功!')
while True:
print(operation)
choose = input('请您选择操作选项:')
if choose == '1':
while True:
query = input('请你选择查询选项(1.查询会员 2.查询管理 3.退出查询):')
if query == '1':
for i in b:
time.sleep(0.5)
print('会员卡号:{}、会员昵称:{}、会员性别:{}、手机号码:{}'.format
(i, b[i][1], b[i][2], b[i][3]))
elif query =='2':
for i in a:
time.sleep(0.5)
print('管理账号:{}、管理昵称:{}、管理性别:{}、手机号码:{}'.format
(i, a[i][1], a[i][2], a[i][3]))
elif query == '3':
break
elif choose == '2':
while True:
add = input('是否需要添加会员(1.需要 2.退出):')
if add == '2':
break
else:
name = input('请您输入会员昵称:')
gender = input('请您输入会员性别:')
phone = input('请您输入手机号码:')
password = input('请您输入登录密码:')
account = []
for i in b:
account.append(int(i))
account.sort()
b[str(account[-1] + 1)] = [password, name, gender, phone]
time.sleep(0.5)
print('注册成功!')
time.sleep(0.5)
print('会员卡号:{}、登录密码:{}、会员昵称:{}、会员性别:{}、手机号码:{}'.format
(str(account[-1] + 1), password, name, gender,phone))
elif choose == '3':
while True:
delete = input('是否需要注销会员(1.需要 2.取消):')
if delete == '2':
break
cancel = input('请您输入需要注销会员卡号:')
if cancel not in b:
print('卡号输入有误!')
else:
del b[cancel]
time.sleep(0.5)
print('会员注销成功!')
elif choose == '4':
while True:
query = input('请您选择查询操作(1.查询个人 2.查询全部 3.退出查询):')
if query == '1':
query_personal = input('请您输入需要查询会员卡号:')
if query_personal in d:
for i in d[query_personal]:
time.sleep(0.5)
print('会员卡号:{}、会员昵称:{}、购票影片:{}、影厅座位:{}'.format
(query_personal, b[query_personal][1], i, ' '.join(d[query_personal][i])))
else:
print('未查询到购票信息!')
elif query == '2':
for x in d:
for y in d[x]:
if x in b:
time.sleep(0.5)
print('会员卡号:{}、会员昵称:{}、购票影片:{}、影厅座位:{}'.format
(x, b[x][1], y, ' '.join(d[x][y])))
else:
time.sleep(0.5)
print('会员卡号:{}、会员昵称:{}、购票影片:{}、影厅座位:{}'.format
(x, a[x][1], y, ' '.join(d[x][y])))
elif query == '3':
break
elif choose == '5':
card_number = ''
judge = input('是否有会员卡(1.有卡 2.无卡):')
if judge == '1':
card_number = input('请您输入会员卡号:')
elif judge == '2':
card_number = account
time.sleep(0.5)
print('*' * 3 + '电影放映表' + '*' * 3)
for x, y in list(enumerate(c, 1)):
print(x, y['name'])
print('*' * 13)
time.sleep(0.5)
buy = int(input('请您选择电影场次:'))
print('*' * 8 + '电影信息' + '*' * 8)
print('影名:{}'.format(c[buy - 1]['name']))
print('类别:{}'.format(c[buy - 1]['category']))
print('导演:{}'.format(c[buy - 1]['director']))
print('演员:{}'.format(c[buy - 1]['actor']))
print('*' * 23)
while True:
time.sleep(0.5)
print('*' * 13 + '影厅座位' + '*' * 13)
for i in c[buy - 1]['seat']:
print(' '.join(i))
print('*' * 32)
ticket = input('是否继续购票(1.继续 2.退出):')
if ticket == '2':
break
line_numbers = int(input('请您选择影厅行号:'))
seat_numbers = int(input('请您选择影厅座号:'))
if c[buy - 1]['seat'][line_numbers][seat_numbers] == '■':
print('不好意思,座位已选!')
else:
c[buy - 1]['seat'][line_numbers][seat_numbers] = '■'
time.sleep(0.5)
print('购票成功,电影名:{} 座位号:{}排{}号'.format
(c[buy - 1]['name'], line_numbers, seat_numbers))
if card_number in d and c[buy - 1]['name'] in d[card_number]:
d[card_number][c[buy - 1]['name']].append(
'{}排{}号'.format(line_numbers, seat_numbers))
elif card_number in d and c[buy - 1]['name'] not in d[card_number]:
d[card_number][c[buy - 1]['name']] = [
'{}排{}号'.format(line_numbers, seat_numbers)]
else:
d[card_number] = {
c[buy - 1]['name']: ['{}排{}号'.format(lin