May 29 continued

product["001"]={"Name":"美式面包","Unit":"个","Price":10.00,"Class":"西点类","integral":10.00}
product["002"]={"Name":"法式面包","Unit":"个","Price":15.00,"Class":"西点类","integral":15.00}
product["003"]={"Name":"日食面包","Unit":"个","Price":8.00,"Class":"西点类","integral":8.00}
product["004"]={"Name":"法国啤酒","Unit":"瓶","Price":20.00,"Class":"酒类","integral":20.00}
product["005"]={"Name":"巴西扎啤","Unit":"听","Price":12.00,"Class":"酒类","integral":12.00}
product["007"]={"Name":"国窖100ml","Unit":"瓶","Price":98.00,"Class":"酒类","integral":98.00}
product["009"]={"Name":"美国红苹果","Unit":"Kg","Price":18.00,"Class":"水果类","integral":18.00}
product["010"]={"Name":"日本红富士","Unit":"Kg","Price":12.00,"Class":"水果类","integral":12.00}
product["012"]={"Name":"菲律宾香蕉","Unit":"Kg","Price":9.80,"Class":"水果类","integral":9.80}
product["013"]={"Name":"大白菜","Unit":"Kg","Price":6.00,"Class":"蔬菜类","integral":6.00}
product["014"]={"Name":"黄瓜","Unit":"Kg","Price":5.60,"Class":"蔬菜类","integral":5.60}
product["015"]={"Name":"西兰花","Unit":"Kg","Price":10.00,"Class":"蔬菜类","integral":10.00}
product["016"]={"Name":"大黄鱼","Unit":"Kg","Price":80.00,"Class":"海鲜类","integral":80.00}
product["017"]={"Name":"黄刺鱼","Unit":"Kg","Price":50.00,"Class":"海鲜类","integral":50.00}
product["018"]={"Name":"带鱼","Unit":"Kg","Price":6.00,"Class":"海鲜类","integral":6.00}
 

a = input ( "enter" registered "Create an account:")
IF A == "Register":
    user1 = the INPUT ( "Enter your name:")
    Sex = the INPUT ( "Sex enter:")
    userku the INPUT = ( "enter the account: ")
    psdku the iNPUT = (" enter password: ")
    Print (" registered, please login account ")
the User = the iNPUT (" enter the account: ")
PSD = the iNPUT (" enter password: ")
IF == userku the User and PSD == psdku:
    Print ( "Welcome Dear" + user1 + "into the store")
    Print ( "personal information:")
    hyjb = Print ( "membership levels: Normal")
    JF = 0.00;
    Print ( "name:" + user1)
    print ( "sex:" sex +)
the else:
    print ( "account password wrong!")
BuyGoods = {}
good_index the iNPUT = ( 'Please enter the product name search (enter "Buy" to exit):')
the while good_index = '!Buy':
    for key1 in product:
        if product[key1]["Name"].find(good_index)!=-1:
            tmpclass = Product [key1] [ "Class"]
            Print ( "Please select Number:")
            for key2 in Product:
                IF Product [key2] [ "Class"] the Find (tmpclass) = - 1:.!
                    Print ( "Product ID: {0: .3 denominated {1}}: {2} Price: {3: .2f} Points: {4: .2f} ". format (key2, product [key2] [" Name "], product [key2] [ "Unit"], Product [key2] [ "Price"], Product [key2] [ "Integral"]))
            selected_good, Qty = iNPUT ( 'enter three coded later, the number (separated by spaces ) | "end 0" exit: ') Split ().
            the while selected_good =!' End ':
                IF len (selected_good) == 3 and Product [selected_good] = "":!
                    BuyGoods [selected_good] = { "Name ": product [selected_good] [ "Name"], "Unit": product [selected_good] [ "Unit"], "Price": product [selected_good] [ "Price"], "integral ": Product [selected_good] [" Integral "]," Qty ": the eval (Qty)}
                selected_good, Qty = iNPUT ( 'enter purchase. 3 bit code, the number (space separated) |" end 0 "exit:' ) .split ()
            BREAK
    good_index the iNPUT = ( 'Please enter the product name search (enter "Buy" to exit):')
SubTotal = 0.00;
Print ( "************* settlement *** *********** ")
Print (" you buy goods amount as follows: ")
for key3 in BuyGoods:
    Print (" product number: {0: .3} {1} denominated in units of: { Unit 2}: {3: .2f} Points: {4: ". format ( key3, BuyGoods [key3] .2f} [" Name "], BuyGoods [key3] [" Unit "],BuyGoods[key3]["Price"],BuyGoods[key3]["integral"],BuyGoods[key3]["Qty"]))
    SubTotal+=BuyGoods[key3]["Price"]*BuyGoods[key3]["Qty"]
    if hyjb=="普通":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*1
    elif hyjb=="高级":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*1.5
    elif hyjb=="银钻":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*2
    elif hyjb=="金钻":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*3
    elif hyjb=="黑钻":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*6
    else:
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*0.5     print("======合计金额:{:.2f}元".format(SubTotal),"Get points: ", int (JF))     Print (" Sex: ", sex)    Print (" Name: ", user1)    Print (" Information successfully updated !!! ")
    




    print ( "membership levels: Silver Diamond", "Current Credit:", int (jf))
product["001"]={"Name":"美式面包","Unit":"个","Price":10.00,"Class":"西点类","integral":10.00}
product["002"]={"Name":"法式面包","Unit":"个","Price":15.00,"Class":"西点类","integral":15.00}
product["003"]={"Name":"日食面包","Unit":"个","Price":8.00,"Class":"西点类","integral":8.00}
product["004"]={"Name":"法国啤酒","Unit":"瓶","Price":20.00,"Class":"酒类","integral":20.00}
product["005"]={"Name":"巴西扎啤","Unit":"听","Price":12.00,"Class":"酒类","integral":12.00}
product["007"]={"Name":"国窖100ml","Unit":"瓶","Price":98.00,"Class":"酒类","integral":98.00}
product["009"]={"Name":"美国红苹果","Unit":"Kg","Price":18.00,"Class":"水果类","integral":18.00}
product["010"]={"Name":"日本红富士","Unit":"Kg","Price":12.00,"Class":"水果类","integral":12.00}
product["012"]={"Name":"菲律宾香蕉","Unit":"Kg","Price":9.80,"Class":"水果类","integral":9.80}
product["013"]={"Name":"大白菜","Unit":"Kg","Price":6.00,"Class":"蔬菜类","integral":6.00}
product["014"]={"Name":"黄瓜","Unit":"Kg","Price":5.60,"Class":"蔬菜类","integral":5.60}
product["015"]={"Name":"西兰花","Unit":"Kg","Price":10.00,"Class":"蔬菜类","integral":10.00}
product["016"]={"Name":"大黄鱼","Unit":"Kg","Price":80.00,"Class":"海鲜类","integral":80.00}
product["017"]={"Name":"黄刺鱼","Unit":"Kg","Price":50.00,"Class":"海鲜类","integral":50.00}
product["018"]={"Name":"带鱼","Unit":"Kg","Price":6.00,"Class":"海鲜类","integral":6.00}
 

a=input("输入”注册”创建账号:")
if a=="注册":
    user1=input("输入姓名:")
    sex=input("输入性别:")
    userku=input("输入账号:")
    psdku=input("输入密码:")
    print("注册成功,请登入账号")
user=input("输入账号:")
psd=input("输入密码:")
if user==userku and psd==psdku:
    print("欢迎尊敬的"+user1+"进入商店")
    print("个人信息:")
    hyjb=print("会员等级:普通")
    jf=0.00;
    print("姓名:"+user1)
    print("性别:"+sex)
else :
    print("账号密码错误!")
BuyGoods={}
good_index = input('请输入商品名称搜索(输入“Buy”退出):')
while good_index!='Buy':
    for key1 in product:
        if product[key1]["Name"].find(good_index)!=-1:
            tmpclass=product[key1]["Class"]
            print("请选择商品编号:")
            for key2 in product:
                if product[key2]["Class"].find(tmpclass)!=-1:
                    print("商品编号:{0:.3}   {1}    计价单位:{2}  单价:{3:.2f} 积分:{4:.2f}".format(key2,product[key2]["Name"],product[key2]["Unit"],product[key2]["Price"],product[key2]["integral"]))
            selected_good,Qty = input('请输入购买的3位编码、数量(空格隔开)|"end 0"退出:').split()
            while selected_good!='end':
                if len(selected_good)==3 and product[selected_good]!="":
                    BuyGoods[selected_good]={"Name":product[selected_good]["Name"],"Unit":product[selected_good]["Unit"],"Price":product[selected_good]["Price"],"integral":product[selected_good]["integral"],"Qty":eval(Qty)}
                selected_good,Qty = input('请输入购买的3位编码、数量(空格隔开)|"end 0"退出:').split()
            break
    good_index = input('请输入商品名称搜索(输入“Buy”退出):')
SubTotal=0.00;
print("*************结算**************")
print("你购买的商品、金额如下:")
for key3 in BuyGoods:
    print("商品编号:{0:.3}   {1}    计价单位:{2}  单价:{3:.2f} 积分:{4:.2f}".format(key3,BuyGoods[key3]["Name"],BuyGoods[key3]["Unit"],BuyGoods[key3]["Price"],BuyGoods[key3]["integral"],BuyGoods[key3]["Qty"]))
    SubTotal+=BuyGoods[key3]["Price"]*BuyGoods[key3]["Qty"]
    if hyjb=="普通":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*1
    elif hyjb=="高级":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*1.5
    elif hyjb=="银钻":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*2
    elif hyjb=="金钻":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*3
    elif hyjb=="黑钻":
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*6
    else:
        jf+=BuyGoods[key3]["integral"]*BuyGoods[key3]["Qty"]*0.5
    
    print("======合计金额:{:.2f}元".format(SubTotal),"获得积分:",int(jf))
    print("信息更新成功!!!")
    print("姓名:",user1)
    print("性别:",sex)
    print("会员等级:银钻","当前积分:",int(jf))

Guess you like

Origin www.cnblogs.com/2017129217fzx/p/10942920.html
May
29