Просмотр исходного кода

开始做正餐的点单页面

张洋 4 лет назад
Родитель
Сommit
cdb3bdf8a3
25 измененных файлов с 5478 добавлено и 6 удалено
  1. BIN
      bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_back.png
  2. 270 0
      bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_diandan_page.xml
  3. 1 1
      bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_tableitem.xml
  4. 4 1
      zhipuzi_pos_windows/control/CZhengcanTableItemUI.cpp
  5. 2 1
      zhipuzi_pos_windows/control/CZhengcanTableItemUI.h
  6. 5 0
      zhipuzi_pos_windows/control/ControlEx.h
  7. 3852 0
      zhipuzi_pos_windows/page/CZhengcanDiandanPageUI.cpp
  8. 343 0
      zhipuzi_pos_windows/page/CZhengcanDiandanPageUI.h
  9. 6 3
      zhipuzi_pos_windows/page/CZhengcanPageUI.cpp
  10. 12 0
      zhipuzi_pos_windows/print/CPosPrinter.cpp
  11. 6 0
      zhipuzi_pos_windows/print/CPosPrinter.h
  12. 1 0
      zhipuzi_pos_windows/print/CPosPrinterData.h
  13. 11 0
      zhipuzi_pos_windows/tool/CShuangpingTool.cpp
  14. 3 0
      zhipuzi_pos_windows/tool/CShuangpingTool.h
  15. 1 0
      zhipuzi_pos_windows/wnd/CDiandanNatureWnd.h
  16. 93 0
      zhipuzi_pos_windows/wnd/CFupingWnd.cpp
  17. 3 0
      zhipuzi_pos_windows/wnd/CFupingWnd.h
  18. 7 0
      zhipuzi_pos_windows/wnd/CMainWnd.cpp
  19. 1 0
      zhipuzi_pos_windows/wnd/CMainWnd.h
  20. 578 0
      zhipuzi_pos_windows/zhipuzi/CZhengcanOrder.cpp
  21. 164 0
      zhipuzi_pos_windows/zhipuzi/CZhengcanOrder.h
  22. 74 0
      zhipuzi_pos_windows/zhipuzi/CZhengcanOrderItem.cpp
  23. 17 0
      zhipuzi_pos_windows/zhipuzi/CZhengcanOrderItem.h
  24. 6 0
      zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj
  25. 18 0
      zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_back.png


+ 270 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_diandan_page.xml

@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window>
+	<ZhengcanDiandanPage>
+		<VerticalLayout name="page_layout">
+			<HorizontalLayout height="60" bkcolor="#FFFFFFFF">
+				<Button name="diandan_page_return" tooltip="返回" width="38" height="38" padding="10,11,0,0" normalimage="file='zhengcan_back.png'" hotimage="" pushedimage=""/>
+				<Label name="diandan_page_table_name" text="" font="28" textcolor="#FF1087FF" width="130" heiht="30" padding="10,10,10,10"></Label>
+			</HorizontalLayout>
+			
+			<Control height="1" bkcolor="#FFEBE8E8"></Control>
+			
+			<HorizontalLayout>
+				<Control width="1" bkcolor="#FFD1D1D1"></Control>
+				
+				<VerticalLayout width="490" bkcolor="#FFFFFFFF">
+					<HorizontalLayout>					
+						<VerticalLayout width="380" padding="0,0,0,0">					
+							<HorizontalLayout height="60">
+								<Control bkimage="member_login.png" width="32" height="32" padding="10,14,0,0"></Control>
+								<Button name="btn_diandan_member_login" align="left" text="会员登录" heiht="38" width="100" padding="10,2,10,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+								<Label name="diandan_page_member_info" text="" width="130" heiht="30" padding="10,10,10,10" visible="false"></Label>
+								<Control></Control>
+								<Button name="btn_diandan_canpaihao" text="输入餐牌号" heiht="38" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+								<Control width="1" bkcolor="#FFEBE8E8" padding="5,15,15,15"></Control>
+								<Control bkimage="order_delete.png" width="20" height="20" padding="0,20,0,0"></Control>
+								<Button name="btn_diandan_qingkong" text="清空" heiht="38" width="40" padding="0,0,10,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+							</HorizontalLayout>
+							
+							<HorizontalLayout height="50" bkcolor="#FFF5F5F5">
+								<Control bkimage="beizhu_tishi.png" width="24" height="24" padding="10,13,0,0"></Control>
+								<Label name="diandan_page_label_zhengdanbeizhu" text="整单备注:" heiht="30" padding="10,10,10,10" textcolor="#FF8D8D8D"></Label>
+							</HorizontalLayout>
+													
+							<List name="list_diandan_cart" padding="0,10,0,0" itemlinecolor="#FF000000" vscrollbar="true">
+								<ListHeader inset="10,0,0,0"/>
+								<ListHeaderItem text="商品" width="220" align="left" />
+								<ListHeaderItem text="数量" width="80" align="center" />
+								<ListHeaderItem text="金额" width="80" align="center" />
+							</List>
+							
+							<HorizontalLayout name="diandan_page_youhui_tishi_layout" height="40" bkcolor="#FFFBEEEE" visible="false">
+								<Label name="diandan_page_youhui_tishi" text="已优惠10元" textcolor="#FFFF3838" padding="15,0,0,0" width="270" hegiht="40"></Label>
+								<Button name="btn_diandan_chakanyouhui" text="查看优惠>" heiht="30" width="80" padding="5,0,25,0" textcolor="#FF3CB371" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+							</HorizontalLayout>
+						</VerticalLayout>
+						
+						<Control width="1" bkcolor="#FFEBE8E8"></Control>
+						
+						<VerticalLayout width="110" padding="0,0,0,0" vscrollbar="true">
+							<Button name="btn_diandan_jia" width="90" height="46" padding="10,80,10,0" text="+" font="24" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+							<Button name="btn_diandan_jian" width="90" height="46" padding="10,15,10,0" text="-" font="24" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+							<Button name="btn_diandan_shanchu" width="90" height="46" padding="10,15,10,0" text="删除" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+							<Button name="btn_diandan_guige" width="90" height="46" padding="10,30,10,0" text="规格/做法" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+							
+							<Button name="btn_diandan_dabao" width="90" height="46" padding="10,15,10,0" text="打包" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+
+							<Label name="diandan_page_qudan_num" text="10" mouse="false" width="19" height="19" align="center" textcolor="#FFFFFFFF" bkimage="num_bkg.png" float="true" pos="85,490,104,509" bordercolor="#FFFF0000" bordersize="0"></Label>
+							
+							<Button name="btn_diandan_zhengdanbeizhu" width="90" height="46" padding="10,15,10,0" text="整单备注" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+							
+							<Button name="btn_diandan_qianxiang" width="90" height="46" padding="10,50,10,30" text="打开钱箱" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+						</VerticalLayout>
+					</HorizontalLayout>
+					
+					<Control height="1" bkcolor="#FFEBE8E8"></Control>
+					
+					<VerticalLayout height="165" bkcolor="#FFFFFFFF">
+						<HorizontalLayout height="70">
+							<Label name="diandan_page_otherprice" text="" width="260" align="left" padding="15,8,0,0"></Label>
+							<Label name="diandan_page_totalprice" text="总价:¥0.00" font="22" textcolor="#FFFF0000" width="200" align="right" padding="0,0,15,0"></Label>
+						</HorizontalLayout>
+						
+						<HorizontalLayout height="90" name="diandan_pay_layout">
+							<Button name="btn_diandan_weixinzhifu_pay" text="" heiht="75" width="110" padding="10,0,0,15" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF4242"></Button>
+							<Control bkimage="weixinzhifu_icon.png" width="24" height="22" float="true" pos="56,10,80,32" mouse="false"></Control>
+							<Label text="微信支付/支付宝/云闪付" multiline="true" width="110" height="40" font="14" float="true" pos="11,35,121,75" textcolor="#FFFFFFFF" mouse="false"></Label>
+							
+							<Button name="btn_diandan_huiyuanzhifu_pay" text="" heiht="75" width="110" padding="10,0,0,15" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF8910"></Button>
+							<Control bkimage="huiyuanzhifu_icon.png" width="26" height="20" float="true" pos="176,12,202,32" mouse="false"></Control>
+							<Label text="会员支付" width="110" height="35" font="14" float="true" pos="159,35,269,70" textcolor="#FFFFFFFF" mouse="false"></Label>
+						
+							<Button name="btn_diandan_xianjinzhifu_pay" text="" heiht="75" width="110" padding="10,0,0,15" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FF52CB4B"></Button>
+							<Control bkimage="xianjinzhifu_icon.png" width="21" height="24" float="true" pos="297,10,318,34" mouse="false"></Control>
+							<Label text="现金支付" width="110" height="35" font="14" float="true" pos="279,35,389,70" textcolor="#FFFFFFFF" mouse="false"></Label>
+							
+							<Button name="btn_diandan_gengduozhifu_pay" text="" heiht="75" width="108" padding="10,0,0,15" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
+							<Control bkimage="gengduozhifu_icon.png" width="21" height="21" float="true" pos="413,10,434,31" mouse="false"></Control>
+							<Label text="更多支付" width="110" height="35" font="14" float="true" pos="394,35,504,70" mouse="false"></Label>
+						</HorizontalLayout>
+						
+						<Button visible="false" name="btn_diandan_jixujiacai" text="继续点单" height="55" padding="20,20,20,15" textcolor="#FFFFFFFF"></Button>
+					</VerticalLayout>
+				</VerticalLayout>
+				
+				<Control width="1" bkcolor="#FFEBE8E8"></Control>
+				
+				<VerticalLayout name="diandan_food_layout">
+					<VerticalLayout name="diandan_fenlei_layout_scrolllayout" vscrollbar="true">
+						<HorizontalLayout name="diandan_fenlei_layout" padding="0,0,0,0" bkcolor="#FFFFFFFF">
+
+						</HorizontalLayout>
+					</VerticalLayout>
+					
+					<TileLayout name="diandan_foodlist" padding="0,0,0,0" inset="15,15,15,15" childpadding="1" itemsize="160,250" vscrollbar="true" hscrollbar="false">
+					
+					</TileLayout>
+					
+					<HorizontalLayout height="70" padding="0,0,0,0" bkcolor="#FFFFFFFF">
+						<Edit name="diandan_food_search_edit" tooltip="请输入商品名字搜索" width="380" height="50" padding="30,10,0,10" textpadding="50,0,50,0" borderround="45,45" bkcolor="#FFECEFED" nativebkcolor="#FFECEFED" />
+						
+						<Label name="diandan_food_search_tishi" text="请输入商品名字搜索" width="120" height="35" font="16" float="true" pos="90,18,425,50" mouse="false"></Label>
+						
+						<Control bkimage="search_icon.png" width="25" height="26" pos="45,23,70,49" float="true"></Control>
+						
+						<Button name="diandan_food_search_clear" visible="false" normalimage="search_clear.png" hotimage="search_clear.png" pushedimage="search_clear.png" bkimage="search_clear.png" width="23" height="23" pos="365,23,68,46" float="true"></Button>
+					</HorizontalLayout>
+				</VerticalLayout>
+				
+				<HorizontalLayout name="diandan_jiesuan_layout" bkcolor="#FFFFFFFF" visible="false" hscrollbar="true">
+					<VerticalLayout width="390">
+						<Label text="选择优惠" width="100" height="58" padding="20,0,0,0" font="20"></Label>
+						
+						<Control height="1" bkcolor="#FFEBE8E8" padding="10,0,10,0"></Control>
+						
+						<HorizontalLayout padding="0,15,0,0" height="48">
+							<Label text="整单折扣:" width="90" height="48" padding="20,0,0,0"></Label>
+							<Button name="diandan_jiesuan_zhekou_value" text="" heiht="48" width="220" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFA9A9A9" bkcolor="#00FFFFFF"></Button>
+							<Label text="%" width="60" height="48" padding="20,0,0,0"></Label>
+						</HorizontalLayout>
+						
+						<HorizontalLayout padding="0,15,0,0" height="48">
+							<Label text="加价:" width="90" height="48" padding="20,0,0,0"></Label>
+							<Button name="diandan_jiesuan_jiajia_value" text="" heiht="48" width="220" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFA9A9A9" bkcolor="#00FFFFFF"></Button>
+							<Label text="元" width="60" height="48" padding="20,0,0,0"></Label>
+						</HorizontalLayout>
+						
+						<HorizontalLayout padding="0,15,0,0" height="48">
+							<Label text="优惠:" width="90" height="48" padding="20,0,0,0"></Label>
+							<Button name="diandan_jiesuan_youhui_value" text="" heiht="48" width="220" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFA9A9A9" bkcolor="#00FFFFFF"></Button>
+							<Label text="元" width="60" height="48" padding="20,0,0,0"></Label>
+						</HorizontalLayout>
+						
+						<HorizontalLayout padding="0,15,0,0" height="48">
+							<Label text="优惠券:" width="90" height="48" padding="20,0,0,0"></Label>
+							<Label name="diandan_jiesuan_youhuiquan_status" text="未使用" width="70" height="48" padding="0,0,0,0"></Label>
+							<Button name="diandan_jiesuan_youhuiquan_btn" text="扫码使用" heiht="35" width="90" padding="0,6,0,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+							<Button name="diandan_jiesuan_youhuiquan_btn_cancel" visible="false" text="取消使用" heiht="35" width="90" padding="15,6,0,0" textcolor="#FFFF6666" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFFF6666" bkcolor="#FFFFFFFF"></Button>
+						</HorizontalLayout>
+						
+						<HorizontalLayout padding="0,15,0,0" height="48">
+							<Label text="商品券:" width="90" height="48" padding="20,0,0,0"></Label>
+							<Label name="diandan_jiesuan_shangpinquan_status" text="未使用" width="70" height="48" padding="0,0,0,0"></Label>
+							<Button name="diandan_jiesuan_shangpinquan_btn" text="扫码使用" heiht="35" width="90" padding="0,6,0,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+							<Button name="diandan_jiesuan_shangpinquan_btn_cancel" visible="false" text="取消使用" heiht="35" width="90" padding="15,6,0,0" textcolor="#FFFF6666" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFFF6666" bkcolor="#FFFFFFFF"></Button>
+						</HorizontalLayout>
+						
+						<HorizontalLayout padding="0,15,0,0" height="48">
+							<Label text="次卡:" width="90" height="48" padding="20,0,0,0"></Label>
+							<Label name="diandan_jiesuan_cika_status" text="未使用" width="70" height="48" padding="0,0,0,0"></Label>
+							<Button name="diandan_jiesuan_cika_btn" text="扫码使用" heiht="35" width="90" padding="0,6,0,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+							<Button name="diandan_jiesuan_cika_btn_cancel" visible="false" text="取消使用" heiht="35" width="90" padding="15,6,0,0" textcolor="#FFFF6666" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFFF6666" bkcolor="#FFFFFFFF"></Button>
+						</HorizontalLayout>
+						
+						<HorizontalLayout padding="0,15,0,0" height="48">
+							<Label text="权益卡:" width="90" height="48" padding="20,0,0,0"></Label>
+							<Label name="diandan_jiesuan_quanyika_status" text="未使用" width="70" height="48" padding="0,0,0,0"></Label>
+							<Button name="diandan_jiesuan_quanyika_btn" text="扫码使用" heiht="35" width="90" padding="0,6,0,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+							<Button name="diandan_jiesuan_quanyika_btn_cancel" visible="false" text="取消使用" heiht="35" width="90" padding="15,6,0,0" textcolor="#FFFF6666" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFFF6666" bkcolor="#FFFFFFFF"></Button>
+						</HorizontalLayout>
+						
+						<HorizontalLayout padding="0,15,0,0" height="130">
+							<Label text="抹零:" width="90" height="48" padding="20,0,0,0"></Label>
+							<VerticalLayout padding="0,10,0,0">
+								<HorizontalLayout padding="0,0,30,0" width="200" height="30">
+									<CheckBox name="diandan_jiesuan_moling_bumoling" group="diandan_jiesuan_moling" padding="0,7,0,7" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
+									<Label name="" text="不抹零" width="150" height="30" padding="15,0,0,0"/>
+								</HorizontalLayout>
+								
+								<HorizontalLayout padding="0,0,30,0" width="200" height="30">
+									<CheckBox name="diandan_jiesuan_moling_molingdaojiao" group="diandan_jiesuan_moling" padding="0,7,0,7" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
+									<Label name="" text="抹零到角" width="150" height="30" padding="15,0,0,0"/>
+								</HorizontalLayout>
+								
+								<HorizontalLayout padding="0,0,30,0" width="200" height="30">
+									<CheckBox name="diandan_jiesuan_moling_molingdaoyuan" group="diandan_jiesuan_moling" padding="0,7,0,7" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
+									<Label name="" text="抹零到元" width="150" height="30" padding="15,0,0,0"/>
+								</HorizontalLayout>
+							</VerticalLayout>
+						</HorizontalLayout>
+					</VerticalLayout>
+					
+					<Control width="1" bkcolor="#FFEBE8E8"></Control>
+					
+					<VerticalLayout name="diandan_page_jiesuan_zhangdan_layout" vscrollbar="true">
+						<Label text="账单明细" height="58" padding="20,0,0,0" font="20"></Label>
+						
+						<Control height="1" bkcolor="#FFEBE8E8" padding="10,0,10,0"></Control>
+						
+						<VerticalLayout name="diandan_jiesuan_zhangdanmingxi_jiage_layout" padding="20,0,20,0" height="100">
+						
+						</VerticalLayout>
+						
+						<Control height="1" bkcolor="#FFEBE8E8" padding="10,10,10,0"></Control>
+						
+						<HorizontalLayout height="50">
+							<Control></Control>
+							<Label name="diandan_jiesuan_total_yingshou" text="" width="150" height="50" align="right" padding="0,0,15,0"/>
+						</HorizontalLayout>
+						
+						<Label text="支付方式" width="100" height="58" padding="20,30,0,0" font="20"></Label>
+						
+						<Control height="1" bkcolor="#FFEBE8E8" padding="10,0,10,0"></Control>
+						
+						<HorizontalLayout name="diandan_jiesuan_zhifufangshi_layout">
+							<HorizontalLayout name="diandan_jiesuan_zhifufangshi_weixinzhifu" width="120" hegiht="80" float="true">
+								<Button name="diandan_jiesuan_zhifufangshi_weixinzhifu_btn" text="" heiht="80" width="120" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF4242"></Button>
+								<Control name="zhifu_icon" bkimage="weixinzhifu_icon.png" width="24" height="22" float="true" pos="53,10,77,32" mouse="false"></Control>
+								<Label name="zhifu_name" text="微信支付/支付宝/云闪付" multiline="true" width="115" height="40" font="14" float="true" pos="2,35,117,75" textcolor="#FFFFFFFF" mouse="false"></Label>
+							</HorizontalLayout>
+							
+							<HorizontalLayout name="diandan_jiesuan_zhifufangshi_huiyuan" width="120" hegiht="80" float="true">
+								<Button name="diandan_jiesuan_zhifufangshi_huiyuan_btn" text="" heiht="80" width="120" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF8910"></Button>
+								<Control name="zhifu_icon" bkimage="huiyuanzhifu_icon.png" width="26" height="20" float="true" pos="50,10,76,30" mouse="false"></Control>
+								<Label name="zhifu_name" text="会员支付" width="180" height="35" font="14" float="true" pos="30,35,210,70" textcolor="#FFFFFFFF" mouse="false"></Label>
+							</HorizontalLayout>
+							
+							<HorizontalLayout name="diandan_jiesuan_zhifufangshi_xianjin" width="120" hegiht="80" float="true">
+								<Button name="diandan_jiesuan_zhifufangshi_xianjin_btn" text="" heiht="80" width="120" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FF52CB4B"></Button>
+								<Control name="zhifu_icon" bkimage="xianjinzhifu_icon.png" width="21" height="24" float="true" pos="50,10,71,34" mouse="false"></Control>
+								<Label name="zhifu_name" text="现金支付" width="180" height="35" font="14" float="true" pos="30,35,210,70" textcolor="#FFFFFFFF" mouse="false"></Label>
+							</HorizontalLayout>
+							
+							<!--
+							<HorizontalLayout name="diandan_jiesuan_zhifufangshi_gouwuka" width="122" hegiht="80" float="true">
+								<Button name="diandan_jiesuan_zhifufangshi_gouwuka_btn" text="" heiht="80" width="120" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
+								<Control name="zhifu_icon" bkimage="gouwuka_icon.png" width="34" height="28" float="true" pos="45,10,79,38" mouse="false"></Control>
+								<Label name="zhifu_name" text="购物卡" width="180" height="35" font="14" float="true" pos="38,35,218,70" mouse="false"></Label>
+							</HorizontalLayout>
+							
+							<HorizontalLayout name="diandan_jiesuan_zhifufangshi_meishicheng" width="122" hegiht="80" float="true">
+								<Button name="diandan_jiesuan_zhifufangshi_meishicheng_btn" text="" heiht="80" width="120" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
+								<Control name="zhifu_icon" bkimage="meishicheng_icon.png" width="37" height="27" float="true" pos="48,10,85,37" mouse="false"></Control>
+								<Label name="zhifu_name" text="美食城临时卡" width="180" height="35" font="14" float="true" pos="25,35,205,70" mouse="false"></Label>
+							</HorizontalLayout>
+							-->
+							
+							<HorizontalLayout name="diandan_jiesuan_zhifufangshi_fulika" width="122" hegiht="80" float="true">
+								<Button name="diandan_jiesuan_zhifufangshi_fulika_btn" text="" heiht="80" width="120" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
+								<Control name="zhifu_icon" bkimage="fulika_icon.png" width="30" height="30" float="true" pos="48,10,78,40" mouse="false"></Control>
+								<Label name="zhifu_name" text="福利卡" width="180" height="35" font="14" float="true" pos="40,35,220,70" mouse="false"></Label>
+							</HorizontalLayout>
+						</HorizontalLayout>
+					</VerticalLayout>
+				</HorizontalLayout>
+			</HorizontalLayout>
+		</VerticalLayout>
+		
+		<HorizontalLayout name="loading">
+			<Control></Control>
+			<VerticalLayout width="24">
+				<Control></Control>
+				<HorizontalLayout height="24">
+					<GifAnim bkimage="loading.gif" autosize="true"></GifAnim>
+				</HorizontalLayout>
+				<Control></Control>
+			</VerticalLayout>
+			<Control></Control>
+		</HorizontalLayout>
+	</ZhengcanDiandanPage>
+</Window>

+ 1 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_tableitem.xml

@@ -9,7 +9,7 @@
 		<Control></Control>
 		<HorizontalLayout name="zhengcan_tableitem_bottom" height="32" bkcolor="#FFEBEBEB">
 			<Control name="people_image" bkimage="zhengcan_people_2.png" float="true" pos="10,9,28,25"></Control>
-			<Label name="renshu" visible="true" width="50" height="26" font="14" text="6人" float="true" pos="33,5,63,30"></Label>
+			<Label name="renshu" visible="true" width="50" height="26" font="14" text="6人" float="true" pos="33,5,90,30"></Label>
 
 			<Control name="time_image" bkimage="zhengcan_time_2.png" float="true" pos="97,10,115,26"></Control>			
 			<Label name="shijian" visible="true" font="14" text="" float="true" pos="113,5,175,30"></Label>	

+ 4 - 1
zhipuzi_pos_windows/control/CZhengcanTableItemUI.cpp

@@ -34,7 +34,7 @@ void CZhengcanTableItemUI::DoEvent(TEventUI& event)
 	CVerticalLayoutUI::DoEvent(event);
 }
 
-void CZhengcanTableItemUI::SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status, std::string order_id)
+void CZhengcanTableItemUI::SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status, std::string order_id, std::string limit_number)
 {
 	m_table_id = table_id;
 	m_table_name = table_name;
@@ -44,6 +44,7 @@ void CZhengcanTableItemUI::SetInfo(std::string table_id, std::string table_name,
 	m_from_type = from_type;
 	m_order_status = order_status;
 	m_order_id = order_id;
+	m_limit_number = limit_number;
 }
 
 void CZhengcanTableItemUI::UpdateShow()
@@ -59,6 +60,8 @@ void CZhengcanTableItemUI::UpdateShow()
 	CControlUI* pPeopleImage = static_cast<CControlUI*>(this->FindSubControl(_T("people_image")));
 	CControlUI* pTimeImage = static_cast<CControlUI*>(this->FindSubControl(_T("time_image")));
 
+	pRenshu->SetText(CLewaimaiString::UTF8ToUnicode(m_limit_number).c_str());
+
 	if (m_status == "0")
 	{
 		//δ¿ªÌ¨

+ 2 - 1
zhipuzi_pos_windows/control/CZhengcanTableItemUI.h

@@ -13,7 +13,7 @@ public:
 
 	void DoEvent(TEventUI& event);
 
-	void SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status, std::string order_id);
+	void SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status, std::string order_id, std::string limit_number);
 
 	//刷新显示
 	void UpdateShow();
@@ -47,5 +47,6 @@ private:
 	std::string m_from_type;
 	std::string m_order_status;
 	std::string m_order_id;
+	std::string m_limit_number;
 };
 

+ 5 - 0
zhipuzi_pos_windows/control/ControlEx.h

@@ -19,6 +19,7 @@
 #include "../page/CCaigouPageUI.h"
 #include "../page/CShangpinCreatePageUI.h"
 #include "../page/CShangpinUpdatePageUI.h"
+#include "../page/CZhengcanDiandanPageUI.h"
 
 #include "CWaimaiOrderItemUI.h"
 #include "CDianneiOrderItemUI.h"
@@ -103,6 +104,10 @@ public:
 		{
 			return new CShangpinUpdatePageUI;
 		}
+		else if (_tcscmp(pstrClass, _T("ZhengcanDiandanPage")) == 0)
+		{
+			return new CZhengcanDiandanPageUI;
+		}
 
 		//控件相关的
 		else if (_tcscmp(pstrClass, _T("WaimaiOrderItem")) == 0)

+ 3852 - 0
zhipuzi_pos_windows/page/CZhengcanDiandanPageUI.cpp

@@ -0,0 +1,3852 @@
+#include "../pch/pch.h"
+#include "CZhengcanDiandanPageUI.h"
+
+#include "../control/ControlEx.h"
+
+#include "../tool/CSqlite3.h"
+
+#include "../wnd/CDiandanNatureWnd.h"
+#include "../wnd/CMemoWnd.h"
+#include "../wnd/CYouhuiShowWnd.h"
+#include "../wnd/CMemberLoginWnd.h"
+#include "../wnd/CZhekouWnd.h"
+#include "../wnd/CRengongYouhuiWnd.h"
+#include "../wnd/CJiajiaWnd.h"
+#include "../wnd/CSaomaYouhuiquanWnd.h"
+#include "../wnd/CSaomaShangpinquanWnd.h"
+#include "../wnd/CSaomaCikaWnd.h"
+#include "../wnd/CSaomaQuanyikaWnd.h"
+#include "../wnd/CCanpaiWnd.h"
+#include "../wnd/CWeixinzhifuShoukuanWnd.h"
+#include "../wnd/CHuiyuanShoukuanWnd.h"
+#include "../wnd/CXianjinShoukuanWnd.h"
+#include "../wnd/CFulikaShoukuanWnd.h"
+#include "../wnd/CZidingyiShoukuanWnd.h"
+#include "../wnd/CChengzhongWnd.h"
+#include "../wnd/CGuadanWnd.h"
+
+#include "../print/CPosPrinter.h"
+
+#include "../tool/CShuangpingTool.h"
+
+CZhengcanDiandanPageUI::CZhengcanDiandanPageUI()
+{
+}
+
+
+CZhengcanDiandanPageUI::~CZhengcanDiandanPageUI()
+{
+}
+
+//初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
+void CZhengcanDiandanPageUI::InitShow()
+{
+	//先检查桌子状态,获取桌子信息
+	GetTableInfo();
+}
+
+void CZhengcanDiandanPageUI::InitTableShow()
+{
+	//先初始化商品分类
+	this->InitFoodtypeShow();
+
+	//再初始化商品显示
+	this->InitFoodShow();
+
+	//初始化结算页面相关的展示,把所有活动清零
+	this->InitJiesuanShow();
+
+	//计算所有活动优惠,并且调整所有与价格相关的展示
+	this->UpdateJiesuanInfo();
+
+	//展示选购页面
+	this->ShowXuangouPage();
+
+	if (m_is_zidingyizhifu_init == false)
+	{
+		//初始化结算页面的支付方式
+		this->InitJiesuanZhifu();
+
+		m_is_zidingyizhifu_init = true;
+	}
+}
+
+void CZhengcanDiandanPageUI::RefreshShow()
+{
+	//清空当前订单的信息
+	m_cur_diandan_order.RefreshDiandanInfo();
+
+	//初始化商品显示(因为这里要刷新商品库存状态)
+	this->InitFoodShow();
+
+	//清空购物车
+	this->ClearDiandanOrderItemShow();
+
+	//初始化结算页面相关的展示,把所有活动清零
+	this->InitJiesuanShow();
+
+	//计算所有活动优惠,并且调整所有与价格相关的展示
+	this->UpdateJiesuanInfo();
+
+	//展示选购页面
+	this->ShowXuangouPage();
+}
+
+void CZhengcanDiandanPageUI::GetTableInfo()
+{
+	//开始转菊花
+	CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("page_layout")));
+	pLayout->SetVisible(false);
+
+	this->FindSubControl(_T("loading"))->SetVisible(true);
+
+	//启动一个线程,进行网络请求操作
+
+	std::thread t(&CZhengcanDiandanPageUI::DoGetTableInfo, this);
+	t.detach();
+}
+
+void CZhengcanDiandanPageUI::DoGetTableInfo()
+{
+	std::map<string, string> params;
+
+	params["table_id"] = m_table_id;
+
+	std::string response;
+
+	std::string url = "/dinnercash/getonetableinfo";
+	bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
+	if (ret == false)
+	{
+		return;
+	}
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		LOG_INFO("parse response error!");
+		return;
+	}
+
+	if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+	{
+		LOG_INFO("json error!");
+
+		return;
+	}
+
+	rapidjson::Value& v_errcode = document["errcode"];
+	int errcode = v_errcode.GetInt();
+	if (errcode != 0)
+	{
+		return;
+	}
+
+	if (!document.HasMember("data"))
+	{
+		return;
+	}
+
+	rapidjson::Value& data = document["data"];
+
+	std::string status = CLewaimaiJson::ToString(data["status"]);
+
+	if (status == "0")
+	{
+		//还没开台,说明桌子在别的地方被清台了
+		m_pMainWnd->SwitchPage(CMainWnd::ZHENGCAN);
+
+		this->m_pMainWnd->ShowToast(L"该桌子已被清台,请重新选择");
+	}
+	else
+	{
+		//桌子开台中,那么开始获取订单信息
+		std::string order_id = CLewaimaiJson::ToString(data["order_id"]);
+
+		std::string name = CLewaimaiJson::ToString(data["name"]);
+		CLabelUI* nameLabel = static_cast<CLabelUI*>(this->FindSubControl(L"diandan_page_table_name"));
+		nameLabel->SetText(CLewaimaiString::UTF8ToUnicode(name).c_str());
+
+		if (order_id == "" || order_id == "0")
+		{
+			//这个说明是只开台了,还没下单那么直接显示点餐页面就行
+			this->InitTableShow();
+		}
+		else
+		{
+			//这个说明是开过台,也下过单了,那么要先获取当前的订单信息
+			
+
+			this->InitTableShow();
+		}
+
+		CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("page_layout")));
+		pLayout->SetVisible(true);
+
+		this->FindSubControl(_T("loading"))->SetVisible(false);
+	}
+}
+
+void CZhengcanDiandanPageUI::InitFoodtypeShow()
+{
+	//初始化商品渲染相关的信息
+	m_foodtypeLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
+	m_foodtypeLayout->RemoveAll();
+
+	CSqlite3 sqlite;
+	m_nFoodpackageNum = sqlite.GetFoodpackageNum();
+	m_types = sqlite.GetFoodtypes(); //只包含收银机显示的分类
+	if (m_nFoodpackageNum > 0)
+	{
+		//默认选中的分类是商品套餐
+		m_cur_type_id = "taocan";
+	}
+	else
+	{
+		//没有套餐,默认选中第一个商品分类
+		if (m_types.size() > 0)
+		{
+			m_cur_type_id = m_types[0].id;
+		}
+	}
+
+	m_curFoodtypeOption = NULL;
+
+	//先判断有没有套餐分类
+	if (m_nFoodpackageNum > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+
+		CFoodtypeOptionUI* pItem = static_cast<CFoodtypeOptionUI*>(builder.Create(_T("foodtype_option.xml"), (UINT)0, &cb, m_pManager));
+
+		pItem->SetName(L"商品套餐");
+		pItem->SetTypeId("taocan");
+		pItem->SetTaocan();
+		pItem->SetGroup(L"diandan_foodtype");
+
+		m_foodtypeLayout->Add(pItem);
+
+		if (m_cur_type_id == "taocan")
+		{
+			m_curFoodtypeOption = pItem;
+		}
+	}
+
+	//接下来开始处理商品分类
+	for (std::vector<CFoodType>::iterator it = m_types.begin(); it != m_types.end(); it++)
+	{
+		CFoodType type = *it;
+
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+
+		CFoodtypeOptionUI* pItem = static_cast<CFoodtypeOptionUI*>(builder.Create(_T("foodtype_option.xml"), (UINT)0, &cb, m_pManager));
+
+		pItem->SetName(CLewaimaiString::UTF8ToUnicode(type.name));
+		pItem->SetTypeId(type.id);
+		pItem->SetGroup(L"diandan_foodtype");
+
+		m_foodtypeLayout->Add(pItem);
+
+		if (m_cur_type_id == type.id)
+		{
+			m_curFoodtypeOption = pItem;
+		}
+	}
+
+	if (m_curFoodtypeOption != NULL)
+	{
+		m_curFoodtypeOption->SetBkColor(0xFF3CB371);
+	}
+
+	//如果不是一个分类都没有,选中第一个分类
+	if (m_cur_type_id != "")
+	{
+		CFoodtypeOptionUI* curTypeUI = static_cast<CFoodtypeOptionUI*>(m_foodtypeLayout->GetItemAt(0));
+
+		curTypeUI->Selected(true, false);
+	}
+
+	UpdateFoodtypePos();
+}
+
+void CZhengcanDiandanPageUI::UpdateFoodtypePos()
+{
+	int nFoodtypeNum = m_types.size();
+	if (m_nFoodpackageNum > 0)
+	{
+		nFoodtypeNum++;
+	}
+
+	//添加支付方式
+	int nWidth = m_nPageWidth;
+	if (nWidth == 0)
+	{
+		return;
+	}
+
+	//根据宽度计算每行显示的数量
+	int nMeihangNum = (nWidth - 491) / 135;
+
+	int num = 0;
+
+	CHorizontalLayoutUI* pFenleiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
+	for (int i = 0; i < nFoodtypeNum; i++)
+	{
+		CButtonUI* curItem = static_cast<CButtonUI*>(pFenleiLayout->GetItemAt(i));
+
+		int curRow = num / nMeihangNum + 1;
+		int curCol = num % nMeihangNum + 1;
+
+		RECT rect;
+		rect.left = (curCol - 1) * 135 + 15;
+		rect.right = rect.left + 120;
+		rect.top = (curRow - 1) * 61 + 19;
+		rect.bottom = rect.top + 42;
+
+		curItem->SetFloat(true);
+		curItem->SetPos(rect);
+
+		num++;
+	}
+
+	//调整区域高度
+	int lastRow = (num - 1) / nMeihangNum + 1;
+	pFenleiLayout->SetFixedHeight(lastRow * 61 + 19);
+
+	//处理滚动条问题
+	CVerticalLayoutUI* pFenleiScrollLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout_scrolllayout")));
+	if (lastRow > 2)
+	{
+		lastRow = 2;
+	}
+
+	pFenleiScrollLayout->SetFixedHeight(lastRow * 61 + 19);
+
+	SIZE size;
+	size.cx = 0;
+	size.cy = 0;
+	pFenleiScrollLayout->SetScrollPos(size);
+}
+
+void CZhengcanDiandanPageUI::InitFoodShow()
+{
+	bool is_youtu;
+	if (CSetting::GetInstance()->GetParam("setting_xianshi_is_youtu") == "1")
+	{
+		is_youtu = true;
+	}
+	else
+	{
+		is_youtu = false;
+	}
+
+	m_foodLayout = static_cast<CTileLayoutUI*>(this->FindSubControl(_T("diandan_foodlist")));
+	m_foodLayout->RemoveAll();
+
+	std::wstring xml_name;
+
+	if (is_youtu)
+	{
+		SIZE itemsize;
+		itemsize.cx = 160;
+		itemsize.cy = 250;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem.xml");
+	}
+	else
+	{
+		SIZE itemsize;
+		itemsize.cx = 160;
+		itemsize.cy = 105;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_wutu.xml");
+	}
+
+	//如果当前一个分类都没有,那么就不处理了
+	if (m_cur_type_id == "")
+	{
+		return;
+	}
+	else if (m_cur_type_id == "taocan")
+	{
+		//选择的是套餐分类
+		CSqlite3 sqlite;
+		std::vector<CFoodpackage> foodlist = sqlite.GetFoodpackages(true);
+
+		for (std::vector<CFoodpackage>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
+		{
+			CFoodpackage food = *it;
+
+			CDialogBuilder builder;
+			CDialogBuilderCallbackEx cb;
+
+			CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+			pItem->SetYoutuModel(is_youtu);
+			pItem->SetFoodpackageInfo(food);
+			pItem->UpdateShow();
+
+			m_foodLayout->Add(pItem);
+		}
+	}
+	else if (m_cur_type_id == "sousuo")
+	{
+		//展示的是商品搜索的结果
+		CSqlite3 sqlite;
+		std::vector<CFood> foodlist = sqlite.GetFoodByFoodname(m_sousuo_foodname);
+
+		for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
+		{
+			CFood food = *it;
+
+			CDialogBuilder builder;
+			CDialogBuilderCallbackEx cb;
+
+			CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+			pItem->SetYoutuModel(is_youtu);
+			pItem->SetFoodInfo(food);
+			pItem->UpdateShow();
+
+			m_foodLayout->Add(pItem);
+		}
+	}
+	else
+	{
+		//选择的是普通商品分类
+		CSqlite3 sqlite;
+		std::vector<CFood> foodlist = sqlite.GetFoodByTypeid(m_cur_type_id);
+
+		for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
+		{
+			CFood food = *it;
+
+			CDialogBuilder builder;
+			CDialogBuilderCallbackEx cb;
+
+			CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+			pItem->SetYoutuModel(is_youtu);
+			pItem->SetFoodInfo(food);
+			pItem->UpdateShow();
+
+			m_foodLayout->Add(pItem);
+		}
+	}
+}
+
+//仅仅初始化结算相关的显示(比如折扣、优惠、价格等)
+void CZhengcanDiandanPageUI::InitJiesuanShow()
+{
+	//先清空会员登录状态
+	m_is_member = false;
+
+	CButtonUI* pMemberLoginBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_member_login")));
+	pMemberLoginBtn->SetVisible(true);
+
+	CLabelUI* pMemberInfo = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_member_info")));
+	pMemberInfo->SetVisible(false);
+
+	m_is_member_zhekou = false;
+	m_member_zhekou_value = 10;
+
+	//再重新设置牌号
+	m_canpai = "";
+
+	CButtonUI* pCanpaiEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_canpaihao")));
+	pCanpaiEdit->SetText(L"输入餐牌号");
+
+	//整单备注
+	CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_label_zhengdanbeizhu")));
+	pLabel->SetText(L"整单备注:");
+
+	//再初始化取单数量
+	RefreshGuadanNum();
+
+	//先初始化折扣值
+	CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
+	pZhekouEdit->SetText(L"100");
+
+	//再初始化加价
+	m_jiajia = 0;
+	CEditUI* pJiajiaEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_jiajia_value")));
+	pJiajiaEdit->SetText(L"0");
+
+	//初始化优惠
+	m_rengong_youhui = 0;
+	CEditUI* pYouhuiEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_youhui_value")));
+	pYouhuiEdit->SetText(L"0");
+
+	//优惠券
+	m_is_youhuiquan = false;
+	CLabelUI* pYouhuiquanEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_status")));
+	pYouhuiquanEdit->SetText(L"未使用");
+
+	CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_btn_cancel")));
+	pYouhuiquanCancel->SetVisible(false);
+
+	//商品券
+	m_is_shangpinquan = false;
+	CLabelUI* pShangpinEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_status")));
+	pShangpinEdit->SetText(L"未使用");
+
+	CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_btn_cancel")));
+	pShangpinquanCancel->SetVisible(false);
+
+	//次卡
+	m_is_cika = false;
+	CLabelUI* pCikaEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_status")));
+	pCikaEdit->SetText(L"未使用");
+
+	CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_btn_cancel")));
+	pCikaCancel->SetVisible(false);
+
+	//权益卡
+	m_is_quanyika = false;
+	CLabelUI* pQuanyikaEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_status")));
+	pQuanyikaEdit->SetText(L"未使用");
+
+	CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_btn_cancel")));
+	pQuanyikaCancel->SetVisible(false);
+
+	//抹零
+	std::string diandan_moling_type = CSetting::GetInstance()->GetParam("diandan_moling_type");
+	m_moling_type = atoi(diandan_moling_type.c_str());
+
+	if (m_moling_type == 0)
+	{
+		CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("diandan_jiesuan_moling_bumoling")));
+		pMolingCheck->Selected(true, false);
+	}
+	else if (m_moling_type == 1)
+	{
+		CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("diandan_jiesuan_moling_molingdaojiao")));
+		pMolingCheck->Selected(true, false);
+	}
+	else if (m_moling_type == 2)
+	{
+		CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("diandan_jiesuan_moling_molingdaoyuan")));
+		pMolingCheck->Selected(true, false);
+	}
+}
+
+void CZhengcanDiandanPageUI::InitJiesuanZhifu()
+{
+	CHorizontalLayoutUI* pZhifufangshiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_layout")));
+
+	int num = 0;
+
+	CHorizontalLayoutUI* pWeixinLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_weixinzhifu")));
+	if (CShopinfo::GetInstance()->m_is_online_pay_open == "1")
+	{
+		//展示微信支付,并且调整位置
+		pWeixinLayout->SetVisible(true);
+
+		num++;
+	}
+	else
+	{
+		pZhifufangshiLayout->RemoveAt(num);
+	}
+
+	//会员支付
+	CHorizontalLayoutUI* pHuiyuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_huiyuan")));
+	if (CShopinfo::GetInstance()->m_is_vip_pay_open == "1")
+	{
+		pHuiyuanLayout->SetVisible(true);
+
+		num++;
+	}
+	else
+	{
+		pZhifufangshiLayout->RemoveAt(num);
+	}
+
+	//现金支付
+	CHorizontalLayoutUI* pXianjinLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_xianjin")));
+	if (CShopinfo::GetInstance()->m_is_cash_pay_open == "1")
+	{
+		pXianjinLayout->SetVisible(true);
+
+		num++;
+	}
+	else
+	{
+		pZhifufangshiLayout->RemoveAt(num);
+	}
+
+	/*
+	//购物卡
+	CHorizontalLayoutUI* pGouwukaLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_gouwuka")));
+	if (CShopinfo::GetInstance()->m_is_giftcard_pay_open == "1")
+	{
+		pGouwukaLayout->SetVisible(true);
+
+		num++;
+	}
+	else
+	{
+		pGouwukaLayout->SetVisible(false);
+	}
+
+	//美食城临时卡
+	CHorizontalLayoutUI* pMeishichengLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_meishicheng")));
+	if (CShopinfo::GetInstance()->m_is_food_town_card_pay_open == "1")
+	{
+		pMeishichengLayout->SetVisible(true);
+
+		num++;
+	}
+	else
+	{
+		pMeishichengLayout->SetVisible(false);
+	}
+	*/
+
+	//福利卡
+	CHorizontalLayoutUI* pFulikaLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_fulika")));
+	if (CShopinfo::GetInstance()->m_is_open_fulika_pay == "1")
+	{
+		pFulikaLayout->SetVisible(true);
+
+		num++;
+	}
+	else
+	{
+		pZhifufangshiLayout->RemoveAt(num);
+	}
+
+	//接着添加自定义支付的
+	for (std::vector<SelfPay>::iterator it = CShopinfo::GetInstance()->m_self_pay.begin(); it != CShopinfo::GetInstance()->m_self_pay.end(); it++)
+	{
+		SelfPay selfpay = *it;
+
+		if (selfpay.is_open == "1")
+		{
+			CButtonUI* newButton = new CButtonUI();
+
+			newButton->SetFixedWidth(120);
+			newButton->SetFixedHeight(80);
+			newButton->SetText(CLewaimaiString::UTF8ToUnicode(selfpay.name).c_str());
+
+			newButton->SetBorderSize(1);
+			newButton->SetBorderColor(0xFFC1C1C1);
+			newButton->SetBkColor(0xFFF7F7F7);
+
+			//设置定义属性,在点击按钮的时候好区分
+			newButton->SetAttribute(L"name", L"diandan_jiesuan_zhifufangshi_zidingyi_btn");
+			newButton->AddCustomAttribute(L"selfpay_id", CLewaimaiString::UTF8ToUnicode(selfpay.id).c_str());
+			newButton->SetAttribute(L"float", L"true");
+
+			//必须先Add,才能调用下面的SetPos,否则无效
+			pZhifufangshiLayout->Add(newButton);
+
+			num++;
+		}
+	}
+
+	m_nZhiufuNum = num;
+}
+
+void CZhengcanDiandanPageUI::UpdateJiesuanZhifuPos()
+{
+	//添加支付方式
+	int nWidth = m_nPageWidth;
+	if (nWidth == 0)
+	{
+		return;
+	}
+
+	int nZhangdanWidth = nWidth - 491 - 391 - 5;
+	if (nZhangdanWidth < 290)
+	{
+		nZhangdanWidth = 290;
+	}
+	CVerticalLayoutUI* pZhangdanLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(L"diandan_page_jiesuan_zhangdan_layout"));
+	pZhangdanLayout->SetFixedWidth(nZhangdanWidth);
+
+	//根据宽度计算每行显示的数量
+	int nMeihangNum = (nZhangdanWidth) / 144;
+	if (nMeihangNum < 1)
+	{
+		nMeihangNum = 1;
+	}
+
+	int num = 0;
+
+	CHorizontalLayoutUI* pZhifufangshiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_layout")));
+	for (int i = 0; i < m_nZhiufuNum; i++)
+	{
+		CButtonUI* curItem = static_cast<CButtonUI*>(pZhifufangshiLayout->GetItemAt(i));
+
+		int curRow = num / nMeihangNum + 1;
+		int curCol = num % nMeihangNum + 1;
+
+		RECT rect;
+		rect.left = (curCol - 1) * 140 + 20;
+		rect.right = rect.left + 120;
+		rect.top = (curRow - 1) * 100 + 20;
+		rect.bottom = rect.top + 80;
+
+		curItem->SetPos(rect);
+
+		num++;
+	}
+
+	//调整区域高度
+	int lastRow = (num - 1) / nMeihangNum + 1;
+	pZhifufangshiLayout->SetFixedHeight(lastRow * 105);
+}
+
+//展示结算页面,隐藏选购页面
+void CZhengcanDiandanPageUI::ShowJiesuanPage()
+{
+	//先隐藏商品页面
+	CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_food_layout")));
+	pFoodLayout->SetVisible(false);
+
+	//隐藏结算按钮
+	CHorizontalLayoutUI* pPayLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_pay_layout")));
+	pPayLayout->SetVisible(false);
+
+	//再展示结算页面
+	CHorizontalLayoutUI* pJiesuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_layout")));
+	pJiesuanLayout->SetVisible(true);
+
+	//展示继续加菜的按钮
+	CButtonUI* pJiacaiBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_jixujiacai")));
+	pJiacaiBtn->SetVisible(true);
+
+	//更新结算按钮位置
+	UpdateJiesuanZhifuPos();
+}
+
+//展示选购页面,隐藏结算页面
+void CZhengcanDiandanPageUI::ShowXuangouPage()
+{
+	//先展示商品页面
+	CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_food_layout")));
+	pFoodLayout->SetVisible(true);
+
+	//展示结算按钮
+	CHorizontalLayoutUI* pPayLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_pay_layout")));
+	pPayLayout->SetVisible(true);
+
+	//再隐藏结算页面
+	CHorizontalLayoutUI* pJiesuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_layout")));
+	pJiesuanLayout->SetVisible(false);
+
+	//隐藏继续加菜的按钮
+	CButtonUI* pJiacaiBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_jixujiacai")));
+	pJiacaiBtn->SetVisible(false);
+}
+
+//只是刷新取单数量
+void CZhengcanDiandanPageUI::RefreshGuadanNum()
+{
+	size_t guadan_num = m_guadan_orders.size();
+	CLabelUI* pNum = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_qudan_num")));
+	if (guadan_num > 0)
+	{
+		//有挂单的
+		pNum->SetText(to_wstring(guadan_num).c_str());
+		pNum->SetVisible(true);
+	}
+	else
+	{
+		//没有挂单的
+		pNum->SetVisible(false);
+	}
+}
+
+//处理按钮点击类事件
+void CZhengcanDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+
+	if (name == L"diandan_page_return")
+	{
+		m_pMainWnd->SwitchPage(CMainWnd::ZHENGCAN);
+	}
+	else if (name == L"diandan_fooditem")
+	{
+		CDiandanFoodItemUI* fooditemUI = static_cast<CDiandanFoodItemUI*>(msg.pSender);
+
+		m_cur_click_food_item = fooditemUI;
+
+		this->ClickFoodAction();
+	}
+	else if (name == L"btn_diandan_jia")
+	{
+		this->ClickAdd();
+	}
+	else if (name == L"btn_diandan_jian")
+	{
+		this->ClickDel();
+	}
+	else if (name == L"btn_diandan_shanchu")
+	{
+		this->ClickRemove();
+	}
+	else if (name == L"btn_diandan_guige")
+	{
+		this->ClickGuige();
+	}
+	else if (name == L"btn_diandan_qingkong")
+	{
+		this->ClickQingkong();
+	}
+	else if (name == L"btn_diandan_zhengdanbeizhu")
+	{
+		this->ClickZhengdanMemo();
+	}
+	else if (name == L"btn_diandan_gengduozhifu_pay")
+	{
+		//点击更多支付
+		this->ClickGengduoPay();
+	}
+	else if (name == L"btn_diandan_jixujiacai")
+	{
+		//点击继续加菜
+		this->JixuJiacai();
+	}
+	else if (name == L"btn_diandan_chakanyouhui")
+	{
+		//点击查看优惠
+		this->ClickChakanYouhui();
+	}
+	else if (name == L"btn_diandan_dabao")
+	{
+		//点击打包
+		this->ClickDabao();
+	}
+	else if (name == L"btn_diandan_member_login")
+	{
+		//点击会员登录
+		this->ClickMemberLogin();
+	}
+	else if (name == L"diandan_jiesuan_zhekou_value")
+	{
+		//点击整单折扣
+		this->ClickZhekou();
+	}
+	else if (name == L"diandan_jiesuan_jiajia_value")
+	{
+		//点击加价
+		this->ClickJiajia();
+	}
+	else if (name == L"diandan_jiesuan_youhui_value")
+	{
+		//点击人工优惠
+		this->ClickRengongyouhui();
+	}
+	else if (name == L"diandan_jiesuan_youhuiquan_btn")
+	{
+		//点击扫码优惠券
+		this->ClickSaomaYouhuiquan();
+	}
+	else if (name == L"diandan_jiesuan_shangpinquan_btn")
+	{
+		//点击扫码商品券
+		this->ClickSaomaShangpinquan();
+	}
+	else if (name == L"diandan_jiesuan_cika_btn")
+	{
+		//点击扫码次卡
+		this->ClickSaomaCika();
+	}
+	else if (name == L"diandan_jiesuan_quanyika_btn")
+	{
+		//点击扫码权益卡
+		this->ClickSaomaQuanyika();
+	}
+	else if (name == L"btn_diandan_canpaihao")
+	{
+		//点击餐牌号
+		this->ClickCanpai();
+	}
+	else if (name == L"btn_diandan_weixinzhifu_pay" || name == L"diandan_jiesuan_zhifufangshi_weixinzhifu_btn")
+	{
+		//点击微信支付
+		this->StartWeixinzhifuShoukuan();
+	}
+	else if (name == L"btn_diandan_huiyuanzhifu_pay" || name == L"diandan_jiesuan_zhifufangshi_huiyuan_btn")
+	{
+		//点击会员收款
+		this->StartHuiyuanShoukuan();
+	}
+	else if (name == L"btn_diandan_xianjinzhifu_pay" || name == L"diandan_jiesuan_zhifufangshi_xianjin_btn")
+	{
+		//点击现金收款
+		this->StartXianjinShoukuan();
+	}
+	else if (name == L"diandan_jiesuan_zhifufangshi_fulika_btn")
+	{
+		//福利卡收款
+		this->StartFulikaShoukuan();
+	}
+	else if (name == L"diandan_jiesuan_zhifufangshi_zidingyi_btn")
+	{
+		//自定义支付
+		std::wstring name = msg.pSender->GetText();
+		std::wstring selfpay_id = msg.pSender->GetCustomAttribute(L"selfpay_id");
+
+		this->StartZidingyiShoukuan(name, selfpay_id);
+	}
+	else if (name == L"diandan_food_search_clear")
+	{
+		CEditUI* m_pEdit = static_cast<CEditUI*>(m_pManager->FindControl(_T("diandan_food_search_edit")));
+		m_pEdit->SetText(L"");
+
+		StopSerachFood();
+	}
+	else if (name == L"btn_diandan_qianxiang")
+	{
+		CPosPrinter printer;
+		printer.OpenQianxiang();
+	}
+	else if (name == L"diandan_jiesuan_youhuiquan_btn_cancel")
+	{
+		this->ClickQuxiaoYouhuiquan();
+	}
+	else if (name == L"diandan_jiesuan_shangpinquan_btn_cancel")
+	{
+		this->ClickQuxiaoShangpinquan();
+	}
+	else if (name == L"diandan_jiesuan_quanyika_btn_cancel")
+	{
+		this->ClickQuxiaoQuanyika();
+	}
+	else if (name == L"diandan_jiesuan_cika_btn_cancel")
+	{
+		this->ClickQuxiaoCika();
+	}
+}
+
+//处理option切换事件
+void CZhengcanDiandanPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+
+	COptionUI* curOption = static_cast<COptionUI*>(msg.pSender);
+	std::wstring groupname = curOption->GetGroup();
+
+	if (groupname == L"diandan_foodtype")
+	{
+		//商品分类切换
+		CFoodtypeOptionUI* typeUI = static_cast<CFoodtypeOptionUI*>(curOption);
+		std::string id = typeUI->GetTypeId();
+
+		if (m_cur_type_id != id)
+		{
+			//切换了商品分类
+			m_curFoodtypeOption->SetBkColor(0xFFECECEC);
+
+			msg.pSender->SetBkColor(0xFF3CB371);
+
+			m_curFoodtypeOption = static_cast<CControlUI*>(msg.pSender);
+
+			m_cur_type_id = id;
+
+			this->InitFoodShow();
+
+			return;
+		}
+	}
+	else if (groupname == L"diandan_jiesuan_moling")
+	{
+		if (name == _T("diandan_jiesuan_moling_bumoling"))
+		{
+			m_moling_type = 0;
+
+			CSetting::GetInstance()->SetParam("diandan_moling_type", "0");
+
+			UpdateJiesuanInfo();
+		}
+		else if (name == _T("diandan_jiesuan_moling_molingdaojiao"))
+		{
+			m_moling_type = 1;
+
+			CSetting::GetInstance()->SetParam("diandan_moling_type", "1");
+
+			UpdateJiesuanInfo();
+		}
+		else if (name == _T("diandan_jiesuan_moling_molingdaoyuan"))
+		{
+			m_moling_type = 2;
+
+			CSetting::GetInstance()->SetParam("diandan_moling_type", "2");
+
+			UpdateJiesuanInfo();
+		}
+	}
+}
+
+//处理下拉框、radio的切换事件
+void CZhengcanDiandanPageUI::HandleItemSelectMsg(TNotifyUI& msg)
+{
+
+}
+
+//处理编辑框输入内容改变事件
+void CZhengcanDiandanPageUI::HandleTextChangedMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+
+	if (name == L"diandan_food_search_edit")
+	{
+		//商品搜索框的输入事件
+		CEditUI* m_pEdit = static_cast<CEditUI*>(m_pManager->FindControl(_T("diandan_food_search_edit")));
+		wstring ws_Value = m_pEdit->GetText();
+		string strValue = CLewaimaiString::UnicodeToUTF8(ws_Value);
+
+		if (strValue.length() == 0)
+		{
+			//搜索词被清空了,退出搜索
+			this->StopSerachFood();
+		}
+		else
+		{
+			//搜索词没清空,进入搜索
+			this->StartSearchFood(strValue);
+		}
+	}
+}
+
+//处理扫码枪捕捉到的扫码信息
+void CZhengcanDiandanPageUI::HandleTextCapture(std::string content)
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		m_curModalWnd->HandleTextCapture(content);
+
+		return;
+	}
+
+	//没有任何弹框,那么就是按扫描商品条码来处理
+	bool ret = this->SaomiaoBarcode(content);
+	if (ret == true)
+	{
+		//已经找到了条码,那么就处理完了
+		return;
+	}
+
+	if (content.length() != 12 && content.length() != 13 && content.length() != 17 && content.length() != 18)
+	{
+		//位数不对,那肯定不是称重条码
+	}
+	else
+	{
+		//如果没有找到条码,就找一下是不是称重的标签秤的码,这个时候要对码进行各种分析了
+		ret = this->BiaoqianchengSaomaBarcode(content);
+		if (ret == true)
+		{
+			return;
+		}
+	}
+
+	//代码走到这里,肯定不是条码了,也不是称重码,判断是不是付款码
+	std::string s_Fukuanma = content;
+
+	int length = s_Fukuanma.size();
+	if (length != 18 && length != 19)
+	{
+		//肯定不是付款码
+		m_pMainWnd->ShowToast(L"无效的条码!");
+		return;
+	}
+
+	for (int i = 0; i < length; i++)
+	{
+		char c = *(s_Fukuanma.c_str() + i);
+		if (isdigit(c) == 0)
+		{
+			//不是数字
+			m_pMainWnd->ShowToast(L"无效的条码!");
+			return;
+		}
+	}
+
+	if (s_Fukuanma.find("10") == 0 \
+		|| s_Fukuanma.find("11") == 0 \
+		|| s_Fukuanma.find("12") == 0 \
+		|| s_Fukuanma.find("13") == 0 \
+		|| s_Fukuanma.find("14") == 0 \
+		|| s_Fukuanma.find("15") == 0)
+	{
+		//微信付款码
+	}
+	else if (s_Fukuanma.find("25") == 0 \
+		|| s_Fukuanma.find("26") == 0 \
+		|| s_Fukuanma.find("27") == 0 \
+		|| s_Fukuanma.find("28") == 0 \
+		|| s_Fukuanma.find("29") == 0 \
+		|| s_Fukuanma.find("30") == 0)
+	{
+		//支付宝付款码
+	}
+	else if (s_Fukuanma.find("62") == 0)
+	{
+		//云闪付付款码
+	}
+	else
+	{
+		m_pMainWnd->ShowToast(L"无效的条码!");
+		return;
+	}
+
+	//代码能走到这里,说明肯定就是付款码了,默认唤起支付
+	this->StartWeixinzhifuShoukuan(content);
+}
+
+void CZhengcanDiandanPageUI::AddDiandanOrderItemShow(int index)
+{
+	CZhengcanOrderItem item = m_cur_diandan_order.getDiandanOrderItem(index);
+
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	CDialogBuilder builder;
+	CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("diandan_cart_item.xml"), (UINT)0, NULL, m_pManager));
+
+	pList->Add(pEle);
+
+	if (item.m_is_taocan)
+	{
+		CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
+		pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
+
+		CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
+		pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
+
+		CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
+		pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
+
+		CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
+
+		pEle->SetFixedHeight(84);
+		pNature->SetVisible(true);
+		pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
+	}
+	else
+	{
+		CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
+		pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
+
+		CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
+		pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
+
+		CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
+		pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
+
+		CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
+		if (item.is_nature)
+		{
+			pEle->SetFixedHeight(84);
+			pNature->SetVisible(true);
+			pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
+		}
+		else
+		{
+			pEle->SetFixedHeight(42);
+			pNature->SetVisible(false);
+		}
+	}
+
+	//更新结算信息
+	UpdateJiesuanInfo();
+}
+
+void CZhengcanDiandanPageUI::UpdateDiandanOrderItemShow(int index)
+{
+	CZhengcanOrderItem item = m_cur_diandan_order.getDiandanOrderItem(index);
+
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(pList->GetItemAt(index));
+
+	if (item.m_is_taocan)
+	{
+		CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
+		pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
+
+		CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
+		pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
+
+		CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
+		pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
+
+		CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
+
+		pEle->SetFixedHeight(84);
+		pNature->SetVisible(true);
+		pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
+	}
+	else
+	{
+		CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
+		pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
+
+		CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
+		pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
+
+		CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
+		pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
+
+		CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
+		if (item.is_nature)
+		{
+			pEle->SetFixedHeight(84);
+			pNature->SetVisible(true);
+			pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
+		}
+		else
+		{
+			pEle->SetFixedHeight(42);
+			pNature->SetVisible(false);
+		}
+	}
+
+	//更新结算信息
+	UpdateJiesuanInfo();
+}
+
+void CZhengcanDiandanPageUI::DelDiandanOrderItemShow(int index)
+{
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	pList->RemoveAt(index);
+
+	//更新结算信息
+	UpdateJiesuanInfo();
+}
+
+void CZhengcanDiandanPageUI::ClearDiandanOrderItemShow()
+{
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	pList->RemoveAll();
+
+	//更新结算信息
+	UpdateJiesuanInfo();
+}
+
+void CZhengcanDiandanPageUI::UpdateJiesuanInfo()
+{
+	//先按所有的价格公式规则,计算一次价格
+	//(基础商品价格+属性价格-商品券-次卡(抵扣金额、抵扣商品)-会员商品优惠)*店铺折扣*分等级会员折扣*权益卡折扣*次卡折扣-满减优惠-次卡满减-优惠券+加价-优惠-抹零+开台费+打包费+茶位费
+
+	//先计算基础商品价格(不包含任何优惠活动等情况下的实际金额,已包含商品属性价格)
+	double jichu_price = m_cur_diandan_order.getTotalPrice();
+
+	//这个是临时变量,表示每次优惠过后的实时价格
+	double cur_price = jichu_price;
+
+	double total_youhui = 0;
+
+	//判断是否有商品券,如果有的话把金额抵扣掉
+	m_shangpinquan_youhui = 0;
+	if (m_is_shangpinquan)
+	{
+		//判断当前购物车商品,是否有满足对应商品券使用要求的
+		bool ret = m_cur_diandan_order.UseShangpinquan(m_shangpinquan_foodid, m_shangpinquan_youhui);
+
+		total_youhui += m_shangpinquan_youhui;
+	}
+
+	//判断次卡
+	m_cika_youhui = 0;
+	if (m_is_cika)
+	{
+		//对次卡进行处理
+		if (m_cika_deduct_type == "0")
+		{
+		}
+		else if (m_cika_deduct_type == "1")
+		{
+		}
+		else if (m_cika_deduct_type == "2")
+		{
+			m_cika_youhui = atof(m_cika_offer_value.c_str());
+		}
+		else if (m_cika_deduct_type == "3")
+		{
+			//这种情况是次卡跟商品券一样抵扣商品\
+			
+			bool ret;
+			if (m_is_shangpinquan && m_shangpinquan_foodid == m_cika_bind_foods_id)
+			{
+				ret = m_cur_diandan_order.UseCikaDikou(m_cika_bind_foods_id, m_cika_youhui, true);
+			}
+			else
+			{
+				ret = m_cur_diandan_order.UseCikaDikou(m_cika_bind_foods_id, m_cika_youhui, false);
+			}
+		}
+
+		total_youhui += m_cika_youhui;
+	}
+
+	//判断会员商品优惠
+	m_total_member_youhui = 0;
+
+	if (m_is_member)
+	{
+		m_total_member_youhui = m_cur_diandan_order.getTotalMemberYouhui(m_member_level);
+	}
+	total_youhui += m_total_member_youhui;
+
+	cur_price = jichu_price - total_youhui;
+
+	//再判断整单折扣
+	CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
+	wstring ws_zhekou = pZhekouEdit->GetText();
+	int zhekouValue = atoi(CLewaimaiString::UnicodeToUTF8(ws_zhekou).c_str());
+
+	m_zhekou_value = zhekouValue;
+
+	if (zhekouValue == 100)
+	{
+		m_zhekou_youhui = 0;
+	}
+	else
+	{
+		m_zhekou_youhui = (100 - zhekouValue) * cur_price / 100.00;
+		total_youhui += m_zhekou_youhui;
+
+		cur_price = cur_price - m_zhekou_youhui;
+	}
+
+	//再判断分等级会员折扣
+	m_member_zhekou_youhui = 0;
+
+	std::vector<DiscountInfo> member_discount_info = CShopinfo::GetInstance()->m_discount_info;
+
+	for (std::vector<DiscountInfo>::iterator it = member_discount_info.begin(); it != member_discount_info.end(); it++)
+	{
+		DiscountInfo info = *it;
+		if (info.member_level == m_member_level)
+		{
+			if (info.is_discount == "1")
+			{
+				m_is_member_zhekou = true;
+				m_member_zhekou_value = info.discount_value;
+
+				double member_discount = atof(info.discount_value.c_str());
+				if (abs(member_discount - 10) < 0.0001)
+				{
+					m_member_zhekou_youhui = 0;
+				}
+				else
+				{
+					m_member_zhekou_youhui = (10 - member_discount) * cur_price / 10.00;
+					total_youhui += m_member_zhekou_youhui;
+
+					cur_price -= m_member_zhekou_youhui;
+				}
+
+				break;
+			}
+
+		}
+	}
+
+	//再判断权益卡折扣
+	m_quanyika_youhui = 0;
+	if (m_is_quanyika == true)
+	{
+		double quanyika_zhekou = atof(m_quanyika_discount.c_str());
+		if (abs(quanyika_zhekou - 10) < 0.0001)
+		{
+			m_quanyika_youhui = 0;
+		}
+		else
+		{
+			m_quanyika_youhui = (10 - quanyika_zhekou) * cur_price / 10.00;
+			total_youhui += m_quanyika_youhui;
+
+			cur_price -= m_quanyika_youhui;
+		}
+	}
+
+	//次卡折扣
+	if (m_is_cika)
+	{
+		//对次卡进行处理
+		if (m_cika_deduct_type == "0")
+		{
+			double cika_zhekou = atof(m_cika_discount_value.c_str());
+			if (abs(cika_zhekou - 10) < 0.0001)
+			{
+				m_cika_youhui = 0;
+			}
+			else
+			{
+				m_cika_youhui = (10 - cika_zhekou) * cur_price / 10.00;
+				total_youhui += m_cika_youhui;
+
+				cur_price -= m_cika_youhui;
+			}
+		}
+	}
+
+	//满减优惠
+	m_manjian_youhui = 0;
+
+	if (CShopinfo::GetInstance()->m_open_promotion == "1")
+	{
+		//开启了满减,进行判断
+
+		std::vector<Promotion> promotion = CShopinfo::GetInstance()->m_promotion;
+
+		for (std::vector<Promotion>::iterator it = promotion.begin(); it != promotion.end(); it++)
+		{
+			Promotion cur = *it;
+
+			if (jichu_price >= cur.amount)
+			{
+				m_manjian_youhui = cur.discount;
+
+				total_youhui += m_manjian_youhui;
+
+				cur_price -= m_manjian_youhui;
+
+				break;
+			}
+		}
+	}
+
+	//次卡满减
+	if (m_is_cika)
+	{
+		//对次卡进行处理
+		if (m_cika_deduct_type == "1")
+		{
+			std::vector<std::string> manjian = CLewaimaiString::Split(m_cika_full_reduce_value, ",");
+
+			double amount = atof(manjian[0].c_str());
+			double value = atof(manjian[1].c_str());
+
+			if (jichu_price >= amount)
+			{
+				m_cika_youhui = value;
+
+				total_youhui += m_cika_youhui;
+
+				cur_price -= m_cika_youhui;
+			}
+		}
+	}
+
+	//优惠券
+	m_youhuiquan_youhui = 0;
+
+	if (m_is_youhuiquan)
+	{
+		time_t deadline = CLewaimaiTime::StringToDatetime(m_coupon_deadline);
+		time_t now = time(NULL);
+		if (deadline > now)
+		{
+			if (jichu_price >= atof(m_coupon_basic_price.c_str()))
+			{
+				m_youhuiquan_youhui = atof(m_coupon_value.c_str());
+
+				total_youhui += m_youhuiquan_youhui;
+
+				cur_price -= m_youhuiquan_youhui;
+			}
+		}
+	}
+
+	//加价
+	m_jiajia = 0;
+	CEditUI* pJiajiaEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_jiajia_value")));
+	wstring ws_jiajia = pJiajiaEdit->GetText();
+	m_jiajia = atof(CLewaimaiString::UnicodeToUTF8(ws_jiajia).c_str());
+
+	cur_price += m_jiajia;
+
+	//人工优惠
+	m_rengong_youhui = 0;
+
+	CEditUI* pYouhuiEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_youhui_value")));
+	wstring ws_rengong_youhui = pYouhuiEdit->GetText();
+	m_rengong_youhui = atof(CLewaimaiString::UnicodeToUTF8(ws_rengong_youhui).c_str());
+
+	total_youhui += m_rengong_youhui;
+
+	cur_price -= m_rengong_youhui;
+
+	//开台费
+	m_kaitai = 0;
+
+	//打包费
+	m_dabao = m_cur_diandan_order.getDabaoMoney();
+
+	cur_price += m_dabao;
+
+	//茶位费
+	m_chawei = 0;
+
+	//抹零
+	m_moling_youhui = 0;
+
+	if (m_moling_type == 0)
+	{
+
+	}
+	else if (m_moling_type == 1)
+	{
+		double new_price = (int)(cur_price * 10) / 10.0;
+
+		m_moling_youhui = cur_price - new_price;
+		total_youhui += m_moling_youhui;
+
+		cur_price = new_price;
+	}
+	else if (m_moling_type == 2)
+	{
+		double new_price = (int)(cur_price);
+
+		m_moling_youhui = cur_price - new_price;
+		total_youhui += m_moling_youhui;
+
+		cur_price = new_price;
+	}
+
+	if (cur_price < 0)
+	{
+		cur_price = 0;
+	}
+
+	m_cur_total_price = cur_price;
+
+	m_total_youhui = total_youhui;
+
+	//至此优惠全部处理完了,开始刷新各个地方的展示
+
+	//先刷新优惠展示
+	CHorizontalLayoutUI* pYouhuiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_page_youhui_tishi_layout")));
+	CLabelUI* pYouhuiLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_youhui_tishi")));
+
+	if (total_youhui > 0)
+	{
+		wstring youhuilabel = L"已优惠 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(total_youhui, 2)) + L" 元";
+		pYouhuiLabel->SetText(youhuilabel.c_str());
+
+		pYouhuiLayout->SetVisible(true);
+	}
+	else
+	{
+		pYouhuiLayout->SetVisible(false);
+	}
+
+	//再刷新打包费展示
+	CLabelUI* pOtherPriceLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_otherprice")));
+	if (m_dabao > 0)
+	{
+		std::wstring ws_dabaofei = L"打包费 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_dabao, 2)) + L" 元";
+		pOtherPriceLabel->SetText(ws_dabaofei.c_str());
+	}
+	else
+	{
+		pOtherPriceLabel->SetText(L"");
+	}
+
+	//再刷新总价展示
+	CLabelUI* pTotalPrice = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_totalprice")));
+	pTotalPrice->SetText((L"总价:¥" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(cur_price, 2))).c_str());
+
+	//再刷新账单明细展示
+	CVerticalLayoutUI* pmingxiLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhangdanmingxi_jiage_layout")));
+	pmingxiLayout->RemoveAll();
+
+	int item_num = 0;
+
+	//先显示基础价格
+	if (true)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"商品原价:");
+		pValue->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(jichu_price, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	//开始展示各种优惠
+	if (m_shangpinquan_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"商品券优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_shangpinquan_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_cika_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"次卡优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_cika_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_total_member_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"商品会员价优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_total_member_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_zhekou_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"整单折扣优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_zhekou_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_member_zhekou_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"会员整单折扣优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_member_zhekou_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_quanyika_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"权益卡优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_quanyika_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_manjian_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"满减优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_manjian_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_youhuiquan_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"优惠券优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_youhuiquan_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_rengong_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"人工优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_rengong_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_moling_youhui > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"抹零优惠:");
+		pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_moling_youhui, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	//然后处理加价的各种
+	if (m_dabao > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"打包费:");
+		pValue->SetText((L"+" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_dabao, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	if (m_jiajia > 0)
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
+		pmingxiLayout->Add(pItem);
+
+		CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
+		CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
+
+		pName->SetText(L"人工加价:");
+		pValue->SetText((L"+" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_jiajia, 2)) + L"元").c_str());
+
+		item_num++;
+	}
+
+	pmingxiLayout->SetFixedHeight(item_num * 40);
+
+	CLabelUI* pYingshou = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_total_yingshou")));
+	pYingshou->SetText((L"应收金额:" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(cur_price, 2)) + L"元").c_str());
+
+	//同步更新副屏的显示内容
+	CShuangpingTool::GetInstance()->UpdateShow(m_cur_diandan_order, total_youhui, cur_price, m_dabao);
+}
+
+void CZhengcanDiandanPageUI::ClickFoodAction()
+{
+	bool is_taocan = m_cur_click_food_item->GetIsTaocan();
+
+	if (is_taocan)
+	{
+		//点击套餐之后的处理逻辑
+		CFoodpackage foodpackageinfo = m_cur_click_food_item->GetFoodpackageInfo();
+
+		CZhengcanOrderItem clickItem;
+
+		clickItem.foodpackage_id = foodpackageinfo.id;
+		clickItem.foodpackage_name = foodpackageinfo.name;
+		clickItem.price = foodpackageinfo.price;
+		clickItem.is_dabao = false;
+		clickItem.dabao_money = foodpackageinfo.dabao_money;
+		clickItem.num = "1";
+
+		//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+		clickItem.SetFoodpackageInfo(m_cur_click_food_item->GetFoodpackageInfo());
+		clickItem.SetIsTaocan(true);
+
+		if (m_is_show_modal_wnd == true)
+		{
+			return;
+		}
+
+		//先弹框进行选择属性
+		CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(1);
+		pNatureFrame->SetFoodItemUI(m_cur_click_food_item);
+
+		if (pNatureFrame != NULL)
+		{
+			m_is_show_modal_wnd = true;
+			m_curModalWnd = pNatureFrame;
+
+			pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+			pNatureFrame->SetIcon(IDI_ICON_DUILIB);
+			pNatureFrame->CenterWindow();
+			UINT ret = pNatureFrame->ShowModal();
+
+			if (ret == IDOK)
+			{
+				//保存选择的属性
+				std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
+				clickItem.natureSelectedArray = natureSelectedArray;
+
+				m_is_show_modal_wnd = false;
+				delete pNatureFrame;
+			}
+			else
+			{
+				m_is_show_modal_wnd = false;
+				delete pNatureFrame;
+
+				return;
+			}
+		}
+
+		//商品没有商品属性
+		bool is_add_new = false;
+
+		int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
+
+		if (is_add_new)
+		{
+			//说明是新增了一项,要刷新一下购物车展示
+			this->AddDiandanOrderItemShow(index);
+		}
+		else
+		{
+			//没有新增,而是修改了一项
+			this->UpdateDiandanOrderItemShow(index);
+		}
+	}
+	else
+	{
+		//点击普通商品之后的处理逻辑
+		CFood foodinfo = m_cur_click_food_item->GetFoodInfo();
+
+		if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < 0.001)
+		{
+			//库存为0了,不做任何处理
+			m_pMainWnd->ShowToast(L"该商品已售完");
+			return;
+		}
+
+		CZhengcanOrderItem clickItem;
+
+		clickItem.food_id = foodinfo.id;
+		clickItem.food_name = foodinfo.name;
+		clickItem.type_id = foodinfo.type_id;
+		clickItem.price = foodinfo.price;
+		clickItem.is_dabao = false;
+		clickItem.dabao_money = foodinfo.dabao_money;
+		clickItem.num = "1";
+
+		if (foodinfo.member_price_used == "1")
+		{
+			clickItem.is_member_price_used = true;
+		}
+		else
+		{
+			clickItem.is_member_price_used = false;
+		}
+
+		//处理会员价的json
+		std::string member_price_json = foodinfo.member_price_json;
+
+		rapidjson::Document document;
+		document.Parse(member_price_json.c_str());
+
+		rapidjson::Value& member_price = document;
+		for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
+		{
+			rapidjson::Value& member_price_info = member_price[i];
+
+			MemberPrice newPirce;
+			newPirce.id = CLewaimaiJson::ToString(member_price_info["id"]);
+			newPirce.level = CLewaimaiJson::ToString(member_price_info["level"]);
+
+			if (member_price_info["price"].IsString())
+			{
+				newPirce.price = member_price_info["price"].GetString();
+			}
+			else
+			{
+				newPirce.price = to_string(member_price_info["price"].GetDouble());
+			}
+
+
+			clickItem.m_member_price.push_back(newPirce);
+		}
+
+		//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+		clickItem.SetFoodInfo(m_cur_click_food_item->GetFoodInfo());
+		clickItem.SetIsTaocan(false);
+
+		if (foodinfo.is_weight == "1")
+		{
+			clickItem.is_weight = true;
+
+			if (m_is_show_modal_wnd == true)
+			{
+				return;
+			}
+
+			//这里要弹出称重框,不弹属性框
+			CChengzhongWnd* pChengzhongFrame = new CChengzhongWnd();
+
+			if (pChengzhongFrame != NULL)
+			{
+				m_is_show_modal_wnd = true;
+				m_curModalWnd = pChengzhongFrame;
+
+				pChengzhongFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+				pChengzhongFrame->SetIcon(IDI_ICON_DUILIB);
+				pChengzhongFrame->CenterWindow();
+
+				pChengzhongFrame->SetTitle(CLewaimaiString::UTF8ToUnicode(foodinfo.name));
+
+				UINT ret = pChengzhongFrame->ShowModal();
+
+				if (ret == IDOK)
+				{
+					std::string weight = pChengzhongFrame->m_weight;
+					if (atof(weight.c_str()) < 0.001)
+					{
+						return;
+					}
+
+					clickItem.num = weight;
+
+					m_is_show_modal_wnd = false;
+					delete pChengzhongFrame;
+				}
+				else
+				{
+					m_is_show_modal_wnd = false;
+					delete pChengzhongFrame;
+
+					return;
+				}
+			}
+		}
+		else
+		{
+			clickItem.is_weight = false;
+
+			if (foodinfo.is_nature == "1")
+			{
+				//商品有商品属性
+				clickItem.is_nature = true;
+
+				if (m_is_show_modal_wnd == true)
+				{
+					return;
+				}
+
+				//先弹框进行选择属性
+				CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(1);
+				pNatureFrame->SetFoodItemUI(m_cur_click_food_item);
+
+				if (pNatureFrame != NULL)
+				{
+					m_is_show_modal_wnd = true;
+					m_curModalWnd = pNatureFrame;
+
+					pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+					pNatureFrame->SetIcon(IDI_ICON_DUILIB);
+					pNatureFrame->CenterWindow();
+					UINT ret = pNatureFrame->ShowModal();
+
+					if (ret == IDOK)
+					{
+						//保存选择的属性
+						std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
+						clickItem.natureSelectedArray = natureSelectedArray;
+
+						m_is_show_modal_wnd = false;
+						delete pNatureFrame;
+					}
+					else
+					{
+						m_is_show_modal_wnd = false;
+						delete pNatureFrame;
+
+						return;
+					}
+				}
+			}
+		}
+
+		//商品没有商品属性
+		bool is_add_new = false;
+
+		int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
+
+		if (is_add_new)
+		{
+			//说明是新增了一项,要刷新一下购物车展示
+			this->AddDiandanOrderItemShow(index);
+		}
+		else
+		{
+			//没有新增,而是修改了一项
+			this->UpdateDiandanOrderItemShow(index);
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickAdd()
+{
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	int nIndex = pList->GetCurSel();
+
+	if (nIndex == -1)
+	{
+		return;
+	}
+
+	m_cur_diandan_order.AddNum(nIndex);
+
+	//没有新增,而是修改了一项
+	this->UpdateDiandanOrderItemShow(nIndex);
+}
+
+void CZhengcanDiandanPageUI::ClickDel()
+{
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	int nIndex = pList->GetCurSel();
+	if (nIndex == -1)
+	{
+		return;
+	}
+
+	bool is_del = m_cur_diandan_order.DelNum(nIndex);
+
+	//如果是删掉了,那么就刷新显示
+	if (is_del)
+	{
+		this->DelDiandanOrderItemShow(nIndex);
+	}
+	else
+	{
+		this->UpdateDiandanOrderItemShow(nIndex);
+	}
+
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		ShowXuangouPage();
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickRemove()
+{
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	int nIndex = pList->GetCurSel();
+	if (nIndex == -1)
+	{
+		return;
+	}
+
+	m_cur_diandan_order.Remove(nIndex);
+
+	this->DelDiandanOrderItemShow(nIndex);
+
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		ShowXuangouPage();
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickGuige()
+{
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	int nIndex = pList->GetCurSel();
+	if (nIndex == -1)
+	{
+		return;
+	}
+
+	bool is_taocan = m_cur_diandan_order.getDiandanOrderItem(nIndex).m_is_taocan;
+	if (is_taocan)
+	{
+		if (m_is_show_modal_wnd == true)
+		{
+			return;
+		}
+
+		//弹出属性框,开始重新选择属性
+		CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(2);
+		pNatureFrame->SetDiandanOrderItem(m_cur_diandan_order.getDiandanOrderItem(nIndex));
+
+		if (pNatureFrame != NULL)
+		{
+			m_is_show_modal_wnd = true;
+			m_curModalWnd = pNatureFrame;
+
+			pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+			pNatureFrame->SetIcon(IDI_ICON_DUILIB);
+			pNatureFrame->CenterWindow();
+			UINT ret = pNatureFrame->ShowModal();
+
+			if (ret == IDOK)
+			{
+				//保存选择的属性
+				std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
+				m_cur_diandan_order.UpdateItemGuige(nIndex, natureSelectedArray);
+
+				m_is_show_modal_wnd = false;
+				delete pNatureFrame;
+
+				//然后要刷新这个item的显示
+				this->UpdateDiandanOrderItemShow(nIndex);
+			}
+			else
+			{
+				m_is_show_modal_wnd = false;
+				delete pNatureFrame;
+
+				return;
+			}
+		}
+	}
+	else
+	{
+		bool is_nature = m_cur_diandan_order.getDiandanOrderItem(nIndex).is_nature;
+		if (!is_nature)
+		{
+			//当前商品没有商品属性
+			return;
+		}
+
+		//弹出属性框,开始重新选择属性
+		CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(2);
+		pNatureFrame->SetDiandanOrderItem(m_cur_diandan_order.getDiandanOrderItem(nIndex));
+
+		if (pNatureFrame != NULL)
+		{
+			pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+			pNatureFrame->SetIcon(IDI_ICON_DUILIB);
+			pNatureFrame->CenterWindow();
+			UINT ret = pNatureFrame->ShowModal();
+
+			if (ret == IDOK)
+			{
+				//保存选择的属性
+				std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
+				m_cur_diandan_order.UpdateItemGuige(nIndex, natureSelectedArray);
+
+				delete pNatureFrame;
+
+				//然后要刷新这个item的显示
+				this->UpdateDiandanOrderItemShow(nIndex);
+			}
+			else
+			{
+				return;
+			}
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickDabao()
+{
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+
+	int nIndex = pList->GetCurSel();
+
+	if (nIndex == -1)
+	{
+		return;
+	}
+
+	m_cur_diandan_order.SetDabao(nIndex);
+
+	//没有新增,而是修改了一项
+	this->UpdateDiandanOrderItemShow(nIndex);
+}
+
+void CZhengcanDiandanPageUI::ClickQingkong()
+{
+	m_cur_diandan_order.Clear();
+
+	this->ClearDiandanOrderItemShow();
+
+	ShowXuangouPage();
+}
+
+void CZhengcanDiandanPageUI::ClickZhengdanMemo()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CMemoWnd* pMemoDlg = new CMemoWnd();
+
+	if (pMemoDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pMemoDlg;
+
+		pMemoDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pMemoDlg->SetIcon(IDI_ICON_DUILIB);
+		pMemoDlg->CenterWindow();
+
+		pMemoDlg->SetTitle(L"整单备注");
+
+		UINT ret = pMemoDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//保存选择的属性
+			std::string sMemo = pMemoDlg->getContent();
+
+			//渲染整单备注的展示
+			CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_label_zhengdanbeizhu")));
+			pLabel->SetText((L"整单备注:" + CLewaimaiString::UTF8ToUnicode(sMemo)).c_str());
+
+			//保存备注,提交订单的时候用
+			m_cur_diandan_order.SetMemo(sMemo);
+
+			m_is_show_modal_wnd = false;
+			delete pMemoDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pMemoDlg;
+
+			return;
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickGengduoPay()
+{
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		m_pMainWnd->ShowToast(L"请先选择商品再支付");
+
+		return;
+	}
+
+	ShowJiesuanPage();
+}
+
+void CZhengcanDiandanPageUI::JixuJiacai()
+{
+	//先显示商品页面
+	CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_food_layout")));
+	pFoodLayout->SetVisible(true);
+
+	//显示结算按钮
+	CHorizontalLayoutUI* pPayLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_pay_layout")));
+	pPayLayout->SetVisible(true);
+
+	//再隐藏结算页面
+	CHorizontalLayoutUI* pJiesuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_layout")));
+	pJiesuanLayout->SetVisible(false);
+
+	//隐藏继续加菜的按钮
+	CButtonUI* pJiacaiBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_jixujiacai")));
+	pJiacaiBtn->SetVisible(false);
+}
+
+void CZhengcanDiandanPageUI::ClickChakanYouhui()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	//弹框展示所有的优惠
+	CYouhuiShowWnd* pYouhuiDlg = new CYouhuiShowWnd();
+
+	if (pYouhuiDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pYouhuiDlg;
+
+		pYouhuiDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pYouhuiDlg->SetIcon(IDI_ICON_DUILIB);
+		pYouhuiDlg->CenterWindow();
+
+		pYouhuiDlg->SetYouhuiValue(m_shangpinquan_youhui, m_cika_youhui, m_total_member_youhui, m_zhekou_youhui, m_member_zhekou_youhui, m_quanyika_youhui, m_manjian_youhui, m_youhuiquan_youhui, m_rengong_youhui, m_moling_youhui);
+
+		UINT ret = pYouhuiDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			m_is_show_modal_wnd = false;
+
+			delete pYouhuiDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pYouhuiDlg;
+
+			return;
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickMemberLogin()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CMemberLoginWnd* pMemberLoginDlg = new CMemberLoginWnd();
+
+	if (pMemberLoginDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pMemberLoginDlg;
+
+		pMemberLoginDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pMemberLoginDlg->SetIcon(IDI_ICON_DUILIB);
+		pMemberLoginDlg->CenterWindow();
+
+		pMemberLoginDlg->SetTitle(L"会员登录");
+
+		UINT ret = pMemberLoginDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明会员登录成功了
+			m_is_member = true;
+			m_member_name = pMemberLoginDlg->m_member_name;
+			m_member_level = pMemberLoginDlg->m_member_level;
+			m_member_level_name = pMemberLoginDlg->m_member_level_name;
+
+			CButtonUI* pMemberLoginBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_member_login")));
+			pMemberLoginBtn->SetVisible(false);
+
+			CLabelUI* pMemberInfo = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_member_info")));
+			std::wstring memberInfo = CLewaimaiString::UTF8ToUnicode(m_member_name) + L"【" + CLewaimaiString::UTF8ToUnicode(m_member_level_name) + L"】";
+			pMemberInfo->SetText(memberInfo.c_str());
+			pMemberInfo->SetVisible(true);
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pMemberLoginDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pMemberLoginDlg;
+
+			return;
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickZhekou()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CZhekouWnd* pZhekouDlg = new CZhekouWnd();
+
+	if (pZhekouDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pZhekouDlg;
+
+		pZhekouDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pZhekouDlg->SetIcon(IDI_ICON_DUILIB);
+		pZhekouDlg->CenterWindow();
+
+		pZhekouDlg->SetTitle(L"输入折扣值");
+
+		UINT ret = pZhekouDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明折扣输入了
+			std::string zhekou = pZhekouDlg->getContent();
+
+			CButtonUI* pZhekouEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
+			pZhekouEdit->SetText(CLewaimaiString::UTF8ToUnicode(zhekou).c_str());
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pZhekouDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pZhekouDlg;
+
+			return;
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickJiajia()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CjiajiaWnd* pJiajiaDlg = new CjiajiaWnd();
+
+	if (pJiajiaDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pJiajiaDlg;
+
+		pJiajiaDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pJiajiaDlg->SetIcon(IDI_ICON_DUILIB);
+		pJiajiaDlg->CenterWindow();
+
+		pJiajiaDlg->SetTitle(L"输入加价金额");
+
+		UINT ret = pJiajiaDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明折扣输入了
+			std::string jiajia = pJiajiaDlg->getContent();
+
+			CButtonUI* pJiajiaEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_jiajia_value")));
+			pJiajiaEdit->SetText(CLewaimaiString::UTF8ToUnicode(jiajia).c_str());
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pJiajiaDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pJiajiaDlg;
+
+			return;
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickRengongyouhui()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CRengongYouhuiWnd* pYouhuiDlg = new CRengongYouhuiWnd();
+
+	if (pYouhuiDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pYouhuiDlg;
+
+		pYouhuiDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pYouhuiDlg->SetIcon(IDI_ICON_DUILIB);
+		pYouhuiDlg->CenterWindow();
+
+		pYouhuiDlg->SetTitle(L"输入优惠金额");
+
+		UINT ret = pYouhuiDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明折扣输入了
+			std::string youhui = pYouhuiDlg->getContent();
+
+			CButtonUI* pYouhuiEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_youhui_value")));
+			pYouhuiEdit->SetText(CLewaimaiString::UTF8ToUnicode(youhui).c_str());
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pYouhuiDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pYouhuiDlg;
+
+			return;
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickSaomaYouhuiquan()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CSaomaYouhuiquanWnd* pSaomaYouhuiquanDlg = new CSaomaYouhuiquanWnd();
+
+	if (pSaomaYouhuiquanDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pSaomaYouhuiquanDlg;
+
+		pSaomaYouhuiquanDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pSaomaYouhuiquanDlg->SetIcon(IDI_ICON_DUILIB);
+		pSaomaYouhuiquanDlg->CenterWindow();
+
+		pSaomaYouhuiquanDlg->SetTitle(L"扫码使用优惠券");
+
+		UINT ret = pSaomaYouhuiquanDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明优惠券核销成功了
+			m_is_youhuiquan = true;
+			m_youhuiquan_id = pSaomaYouhuiquanDlg->m_coupon_id;
+			m_coupon_basic_price = pSaomaYouhuiquanDlg->m_coupon_basic_price;
+			m_coupon_deadline = pSaomaYouhuiquanDlg->m_coupon_deadline;
+			m_coupon_value = pSaomaYouhuiquanDlg->m_coupon_value;
+
+			CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_status")));
+			pYouhuiEdit->SetText(L"已使用");
+
+			CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_btn_cancel")));
+			pYouhuiquanCancel->SetVisible(true);
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pSaomaYouhuiquanDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pSaomaYouhuiquanDlg;
+
+			return;
+		}
+	}
+}
+
+//点击扫码商品券
+void CZhengcanDiandanPageUI::ClickSaomaShangpinquan()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CSaomaShangpinquanWnd* pSaomaShangpinquanDlg = new CSaomaShangpinquanWnd();
+
+	if (pSaomaShangpinquanDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pSaomaShangpinquanDlg;
+
+		pSaomaShangpinquanDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pSaomaShangpinquanDlg->SetIcon(IDI_ICON_DUILIB);
+		pSaomaShangpinquanDlg->CenterWindow();
+
+		pSaomaShangpinquanDlg->SetTitle(L"扫码使用商品券");
+
+		UINT ret = pSaomaShangpinquanDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明商品券核销成功了
+			m_is_shangpinquan = true;
+
+			m_shangpinquan_lewaimai_customer_id = pSaomaShangpinquanDlg->m_lewaimai_customer_id;
+			m_shangpinquan_id = pSaomaShangpinquanDlg->m_goodscoupon_id;
+			m_shangpinquan_name = pSaomaShangpinquanDlg->m_goods_coupon_name;
+			m_shangpinquan_foodid = pSaomaShangpinquanDlg->m_bind_foods_id;
+
+			CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_status")));
+			pYouhuiEdit->SetText(L"已使用");
+
+			CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_btn_cancel")));
+			pShangpinquanCancel->SetVisible(true);
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pSaomaShangpinquanDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pSaomaShangpinquanDlg;
+
+			return;
+		}
+	}
+}
+
+//点击扫码权益卡
+void CZhengcanDiandanPageUI::ClickSaomaQuanyika()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CSaomaQuanyikaWnd* pSaomaQuanyikaDlg = new CSaomaQuanyikaWnd();
+
+	if (pSaomaQuanyikaDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pSaomaQuanyikaDlg;
+
+		pSaomaQuanyikaDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pSaomaQuanyikaDlg->SetIcon(IDI_ICON_DUILIB);
+		pSaomaQuanyikaDlg->CenterWindow();
+
+		pSaomaQuanyikaDlg->SetTitle(L"扫码使用权益卡");
+
+		UINT ret = pSaomaQuanyikaDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明权益卡核销成功了
+			m_is_quanyika = true;
+
+			m_quanyika_discount = pSaomaQuanyikaDlg->m_discount;
+
+			CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_status")));
+			pYouhuiEdit->SetText(L"已使用");
+
+			CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_btn_cancel")));
+			pQuanyikaCancel->SetVisible(true);
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pSaomaQuanyikaDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pSaomaQuanyikaDlg;
+
+			return;
+		}
+	}
+}
+
+//点击取消使用优惠券
+void CZhengcanDiandanPageUI::ClickQuxiaoYouhuiquan()
+{
+	m_is_youhuiquan = false;
+
+	CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_status")));
+	pYouhuiEdit->SetText(L"未使用");
+
+	CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_btn_cancel")));
+	pYouhuiquanCancel->SetVisible(false);
+}
+
+//点击取消商品券
+void CZhengcanDiandanPageUI::ClickQuxiaoShangpinquan()
+{
+	m_is_shangpinquan = false;
+
+	CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_status")));
+	pYouhuiEdit->SetText(L"未使用");
+
+	CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_btn_cancel")));
+	pShangpinquanCancel->SetVisible(false);
+}
+
+//点击取消权益卡
+void CZhengcanDiandanPageUI::ClickQuxiaoQuanyika()
+{
+	m_is_quanyika = false;
+
+	CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_status")));
+	pYouhuiEdit->SetText(L"未使用");
+
+	CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_btn_cancel")));
+	pQuanyikaCancel->SetVisible(false);
+}
+
+//点击取消次卡
+void CZhengcanDiandanPageUI::ClickQuxiaoCika()
+{
+	m_is_cika = false;
+
+	CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_status")));
+	pYouhuiEdit->SetText(L"未使用");
+
+	CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_btn_cancel")));
+	pCikaCancel->SetVisible(false);
+}
+
+//点击扫码次卡
+void CZhengcanDiandanPageUI::ClickSaomaCika()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CSaomaCikaWnd* pSaomaCikaDlg = new CSaomaCikaWnd();
+
+	if (pSaomaCikaDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pSaomaCikaDlg;
+
+		pSaomaCikaDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pSaomaCikaDlg->SetIcon(IDI_ICON_DUILIB);
+		pSaomaCikaDlg->CenterWindow();
+
+		pSaomaCikaDlg->SetTitle(L"扫码使用次卡");
+
+		UINT ret = pSaomaCikaDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明商品券核销成功了
+			m_is_cika = true;
+
+			m_cika_lewaimai_customer_id = pSaomaCikaDlg->m_cika_lewaimai_customer_id;
+			m_cika_id = pSaomaCikaDlg->m_timescoupon_id;
+			m_cika_deduct_type = pSaomaCikaDlg->m_deduct_type;
+			m_cika_discount = pSaomaCikaDlg->m_discount;
+			m_cika_discount_value = pSaomaCikaDlg->m_discount_value;
+			m_cika_full_reduce = pSaomaCikaDlg->m_full_reduce;
+			m_cika_full_reduce_value = pSaomaCikaDlg->m_full_reduce_value;
+			m_cika_offer = pSaomaCikaDlg->m_offer;
+			m_cika_offer_value = pSaomaCikaDlg->m_offer_value;
+			m_cika_bind_foods_id = pSaomaCikaDlg->m_bind_foods_id;
+
+			CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_status")));
+			pYouhuiEdit->SetText(L"已使用");
+
+			CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_btn_cancel")));
+			pCikaCancel->SetVisible(true);
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pSaomaCikaDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pSaomaCikaDlg;
+
+			return;
+		}
+	}
+}
+
+void CZhengcanDiandanPageUI::ClickCanpai()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CCanpaiWnd* pCanpaiDlg = new CCanpaiWnd();
+
+	if (pCanpaiDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pCanpaiDlg;
+
+		pCanpaiDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pCanpaiDlg->SetIcon(IDI_ICON_DUILIB);
+		pCanpaiDlg->CenterWindow();
+
+		pCanpaiDlg->SetTitle(L"输入餐牌号");
+
+		UINT ret = pCanpaiDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明折扣输入了
+			std::string canpai = pCanpaiDlg->getContent();
+
+			m_canpai = canpai;
+
+			CButtonUI* pCanpaiEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_canpaihao")));
+			pCanpaiEdit->SetText((L"餐牌号 " + CLewaimaiString::UTF8ToUnicode(canpai)).c_str());
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pCanpaiDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pCanpaiDlg;
+
+			return;
+		}
+	}
+}
+
+//获取通用参数,任何支付方式都要用到的参数,个性化参数在弹框里面处理
+//参考文档 http://apidoc.zhipuzi.com/index.php/home/item/show?item_id=4
+std::map<string, string> CZhengcanDiandanPageUI::GetSendorderParams()
+{
+	std::map<string, string> params;
+
+	params["order_no"] = CRandomHelper::GetRandString(20);
+
+	//构建food_list参数
+	params["food_list"] = m_cur_diandan_order.getDiandanFoodlistParam();
+	params["foodpackage_array"] = m_cur_diandan_order.getDiandanTaocanParam();
+	params["person_num"] = "1";
+	params["table_name"] = m_canpai;
+	params["note"] = m_cur_diandan_order.GetMemo();
+	params["dabao_price"] = CLewaimaiString::DoubleToString(m_dabao, 2);
+	params["food_price"] = CLewaimaiString::DoubleToString(m_cur_diandan_order.getTotalPrice(), 2);
+	params["total_price"] = CLewaimaiString::DoubleToString(m_cur_diandan_order.getTotalPrice() + m_dabao, 2);
+
+	CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
+	wstring ws_zhekou = pZhekouEdit->GetText();
+	params["discount"] = CLewaimaiString::UnicodeToUTF8(ws_zhekou);
+
+	params["coupon"] = CLewaimaiString::DoubleToString(m_rengong_youhui, 2);
+	params["price_plus"] = CLewaimaiString::DoubleToString(m_jiajia, 2);
+	params["price_moling"] = CLewaimaiString::DoubleToString(m_moling_youhui, 2);
+	params["yingshou_value"] = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
+	params["shishou_value"] = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
+	params["zhaoling_value"] = "0";
+
+	params["zhifu_type"] = "";
+
+	if (m_is_youhuiquan)
+	{
+		params["coupon_id"] = m_youhuiquan_id;
+	}
+
+	if (m_is_cika)
+	{
+		params["timescoupon_id"] = m_cika_id;
+		params["lewaimai_customer_id"] = m_cika_lewaimai_customer_id;
+	}
+
+	if (m_is_shangpinquan)
+	{
+		params["goodscoupon_id"] = m_shangpinquan_id;
+	}
+
+	if (m_is_quanyika)
+	{
+		params["is_eq_card_discount"] = "1";
+		params["eq_card_discount_value"] = m_quanyika_discount;
+	}
+	else
+	{
+		params["is_eq_card_discount"] = "0";
+	}
+
+	if (m_is_member)
+	{
+		params["member_level"] = m_member_level;
+
+		if (m_is_member_zhekou)
+		{
+			params["member_level_value"] = m_member_zhekou_value;
+		}
+		else
+		{
+			params["member_level_value"] = 10;
+		}
+	}
+
+	if (m_is_cika == true)
+	{
+		params["time_coupon_type"] = m_cika_deduct_type;
+		params["time_coupon_discount_value"] = m_cika_discount_value;
+		params["time_coupon_full_reduce_value"] = m_cika_full_reduce_value;
+		params["time_coupon_offer_value"] = m_cika_offer_value;
+		params["time_coupon_band_food_value"] = CLewaimaiString::DoubleToString(m_cika_youhui, 2);
+	}
+
+	if (m_is_shangpinquan)
+	{
+		params["goods_coupon_band_food_value"] = CLewaimaiString::DoubleToString(m_shangpinquan_youhui, 2);
+	}
+
+	if (m_manjian_youhui > 0)
+	{
+		params["promotion_value"] = CLewaimaiString::DoubleToString(m_manjian_youhui, 2);
+	}
+
+	if (m_youhuiquan_youhui > 0)
+	{
+		params["coupon_value"] = CLewaimaiString::DoubleToString(m_youhuiquan_youhui, 2);
+	}
+
+	if (m_member_zhekou_youhui > 0)
+	{
+		params["member_discount_money"] = CLewaimaiString::DoubleToString(m_member_zhekou_youhui, 2);
+	}
+
+	if (m_zhekou_youhui > 0)
+	{
+		params["shop_discount_money"] = CLewaimaiString::DoubleToString(m_zhekou_youhui, 2);
+	}
+
+	if (m_cika_youhui > 0)
+	{
+		params["timescoupon_discount_money"] = CLewaimaiString::DoubleToString(m_cika_youhui, 2);
+	}
+
+	if (m_quanyika_youhui > 0)
+	{
+		params["eq_card_discount_money"] = CLewaimaiString::DoubleToString(m_quanyika_youhui, 2);
+	}
+
+	params["total_delete_money"] = CLewaimaiString::DoubleToString(m_total_youhui, 2);
+
+	return params;
+}
+
+void CZhengcanDiandanPageUI::StartWeixinzhifuShoukuan(std::string fukuanma)
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		m_pMainWnd->ShowToast(L"请先选择商品再支付");
+
+		return;
+	}
+
+	CWeixinzhifuShoukuanWnd* pShoukuanWnd = new CWeixinzhifuShoukuanWnd;
+	if (pShoukuanWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pShoukuanWnd;
+
+		pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
+		pShoukuanWnd->CenterWindow();
+
+		std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
+		std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
+		pShoukuanWnd->InitMoney(watchValue);
+
+		//这里要对提交订单的参数进行组装,然后方便请求
+		pShoukuanWnd->SetCommonParams(GetSendorderParams());
+
+		if (fukuanma != "")
+		{
+			pShoukuanWnd->InitFukuanma(fukuanma);
+		}
+
+		UINT ret = pShoukuanWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			int fukuanma_type = pShoukuanWnd->m_fukuanma_type;
+
+			std::string zhifu_type;
+			if (fukuanma_type == 1)
+			{
+				zhifu_type = "weixinzhifu";
+			}
+			else if (fukuanma_type == 2)
+			{
+				zhifu_type = "zhifubao";
+			}
+			else if (fukuanma_type == 3)
+			{
+				zhifu_type = "yunshanfu";
+			}
+
+			//说明收款成功了,需要进行一些后续的处理
+			this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, zhifu_type);
+
+			m_pMainWnd->ShowToast(L"收款成功!");
+		}
+		else
+		{
+			int a = 1;
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pShoukuanWnd;
+	}
+}
+
+void CZhengcanDiandanPageUI::StartHuiyuanShoukuan()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		m_pMainWnd->ShowToast(L"请先选择商品再支付");
+
+		return;
+	}
+
+	CHuiyuanShoukuanWnd* pShoukuanWnd = new CHuiyuanShoukuanWnd();
+	if (pShoukuanWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pShoukuanWnd;
+
+		pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
+		pShoukuanWnd->CenterWindow();
+
+		std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
+		std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
+		pShoukuanWnd->InitMoney(watchValue);
+
+		//这里要对提交订单的参数进行组装,然后方便请求
+		pShoukuanWnd->SetCommonParams(GetSendorderParams());
+
+		/*
+		if (m_is_start_catch && m_catch_string.length() == 18)
+		{
+			pShoukuanWnd->InitFukuanma(m_catch_string);
+		}
+		}*/
+
+		UINT ret = pShoukuanWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			std::string balance = pShoukuanWnd->m_balance;
+			std::string member_number = pShoukuanWnd->m_member_number;
+
+			//说明收款成功了,需要进行一些后续的处理
+			this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, "huiyuanzhifu", balance, member_number);
+
+			m_pMainWnd->ShowToast(L"收款成功!");
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pShoukuanWnd;
+	}
+}
+
+//开始进行现金收款
+void CZhengcanDiandanPageUI::StartXianjinShoukuan()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		m_pMainWnd->ShowToast(L"请先选择商品再支付");
+
+		return;
+	}
+
+	CXianjinShoukuanWnd* pShoukuanWnd = new CXianjinShoukuanWnd();
+	if (pShoukuanWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pShoukuanWnd;
+
+		pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
+		pShoukuanWnd->CenterWindow();
+
+		std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
+		std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
+		pShoukuanWnd->InitMoney(watchValue);
+
+		//这里要对提交订单的参数进行组装,然后方便请求
+		pShoukuanWnd->SetCommonParams(GetSendorderParams());
+
+		/*
+		if (m_is_start_catch && m_catch_string.length() == 18)
+		{
+			pShoukuanWnd->InitFukuanma(m_catch_string);
+		}
+		}*/
+
+		UINT ret = pShoukuanWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			m_shishou_value = pShoukuanWnd->m_shishou;
+			m_zhaoling_value = pShoukuanWnd->m_zhaoling;
+
+			//说明收款成功了,需要进行一些后续的处理
+			this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, "xianjinzhifu");
+
+			m_pMainWnd->ShowToast(L"收款成功!");
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pShoukuanWnd;
+	}
+}
+
+void CZhengcanDiandanPageUI::StartFulikaShoukuan()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		m_pMainWnd->ShowToast(L"请先选择商品再支付");
+
+		return;
+	}
+
+	CFulikaShoukuanWnd* pShoukuanWnd = new CFulikaShoukuanWnd();
+	if (pShoukuanWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pShoukuanWnd;
+
+		pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
+		pShoukuanWnd->CenterWindow();
+
+		std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
+		std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
+		pShoukuanWnd->InitMoney(watchValue);
+
+		//这里要对提交订单的参数进行组装,然后方便请求
+		pShoukuanWnd->SetCommonParams(GetSendorderParams());
+
+		/*
+		if (m_is_start_catch && m_catch_string.length() == 18)
+		{
+			pShoukuanWnd->InitFukuanma(m_catch_string);
+		}
+		}*/
+
+		UINT ret = pShoukuanWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			//说明收款成功了,需要进行一些后续的处理
+			this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, "fulikazhifu");
+
+			m_pMainWnd->ShowToast(L"收款成功!");
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pShoukuanWnd;
+	}
+}
+
+void CZhengcanDiandanPageUI::StartZidingyiShoukuan(std::wstring name, std::wstring selfpay_id)
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		m_pMainWnd->ShowToast(L"请先选择商品再支付");
+
+		return;
+	}
+
+	CZidingyiShoukuanWnd* pShoukuanWnd = new CZidingyiShoukuanWnd();
+	if (pShoukuanWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pShoukuanWnd;
+
+		pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
+		pShoukuanWnd->CenterWindow();
+
+		std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
+		std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
+		pShoukuanWnd->InitMoney(watchValue);
+
+		//这里要对提交订单的参数进行组装,然后方便请求
+		pShoukuanWnd->SetCommonParams(GetSendorderParams());
+
+		/*
+		if (m_is_start_catch && m_catch_string.length() == 18)
+		{
+			pShoukuanWnd->InitFukuanma(m_catch_string);
+		}
+		}*/
+
+		pShoukuanWnd->SetZidingyiName(name);
+		pShoukuanWnd->SetZidingyiId(selfpay_id);
+
+		UINT ret = pShoukuanWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			//说明收款成功了,需要进行一些后续的处理
+			this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, "zidingyizhifu");
+
+			m_pMainWnd->ShowToast(L"收款成功!");
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pShoukuanWnd;
+	}
+}
+
+void CZhengcanDiandanPageUI::UpdateFoodStock(std::string food_stock)
+{
+	rapidjson::Document doc;
+	rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //获取分配器
+
+	Value& data = CLewaimaiJson::StringToJson(food_stock, allocator);
+
+	for (rapidjson::SizeType i = 0; i < data.Size(); ++i)
+	{
+		std::string food_id = data[i]["food_id"].GetString();
+		std::string stock = data[i]["stock"].GetString();
+
+		CSqlite3 sqlite;
+		sqlite.UpdateFoodStock(food_id, stock);
+	}
+}
+
+//扫描了商品条码的逻辑处理
+bool CZhengcanDiandanPageUI::SaomiaoBarcode(std::string barcode)
+{
+	CSqlite3 sqlite;
+
+	CFood foodinfo;
+	bool ret = sqlite.GetFoodByBarcode(barcode, foodinfo);
+
+	if (ret == false)
+	{
+		//说明没找到对应的商品条码
+		return false;
+	}
+
+	//这里说明找到了,那么处理添加购物车逻辑,扫码的情况下,这里不管有没有属性,都按没属性处理,不管有没有称重都按没称重处理(以后标签秤可能会修改)
+
+	if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < 1)
+	{
+		//库存为0了,不做任何处理
+		m_pMainWnd->ShowToast(L"该商品已售完");
+
+		//只要找到了就返回true
+		return true;
+	}
+
+	CZhengcanOrderItem clickItem;
+
+	clickItem.food_id = foodinfo.id;
+	clickItem.food_name = foodinfo.name;
+	clickItem.type_id = foodinfo.type_id;
+	clickItem.price = foodinfo.price;
+	clickItem.is_dabao = false;
+	clickItem.dabao_money = foodinfo.dabao_money;
+	clickItem.num = "1";
+
+	if (foodinfo.member_price_used == "1")
+	{
+		clickItem.is_member_price_used = true;
+	}
+	else
+	{
+		clickItem.is_member_price_used = false;
+	}
+
+	//处理会员价的json
+	std::string member_price_json = foodinfo.member_price_json;
+
+	rapidjson::Document document;
+	document.Parse(member_price_json.c_str());
+
+	rapidjson::Value& member_price = document;
+	for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
+	{
+		rapidjson::Value& member_price_info = member_price[i];
+
+		MemberPrice newPirce;
+		newPirce.id = CLewaimaiJson::ToString(member_price_info["id"]);
+		newPirce.level = CLewaimaiJson::ToString(member_price_info["level"]);
+		newPirce.price = CLewaimaiJson::ToString(member_price_info["price"]);
+
+		clickItem.m_member_price.push_back(newPirce);
+	}
+
+	//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+	clickItem.SetFoodInfo(foodinfo);
+	clickItem.SetIsTaocan(false);
+
+	clickItem.is_weight = false;
+	clickItem.is_nature = false;
+
+	//商品没有商品属性
+	bool is_add_new = false;
+
+	int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
+
+	if (is_add_new)
+	{
+		//说明是新增了一项,要刷新一下购物车展示
+		this->AddDiandanOrderItemShow(index);
+	}
+	else
+	{
+		//没有新增,而是修改了一项
+		this->UpdateDiandanOrderItemShow(index);
+	}
+
+	return true;
+}
+
+bool CZhengcanDiandanPageUI::BiaoqianchengSaomaBarcode(std::string barcode)
+{
+	//先根据设置,分辨条码格式
+	std::string bianma;
+	std::string money;
+	std::string weight;
+	std::string jiaoyan;
+
+	std::string setting_tiaomacheng_geshi = CSetting::GetInstance()->GetParam("setting_tiaomacheng_geshi");
+	if (setting_tiaomacheng_geshi == "1")
+	{
+		if (barcode.length() != 12 && barcode.length() != 13)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 12)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//13位【FWWWWWWEEEEEC】
+		bianma = barcode.substr(1, 6);
+		money = barcode.substr(7, 5);
+		jiaoyan = barcode.substr(12, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "2")
+	{
+		if (barcode.length() != 12 && barcode.length() != 13)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 12)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//13位【FWWWWWWNNNNNC】
+		bianma = barcode.substr(1, 6);
+		weight = barcode.substr(7, 5);
+		jiaoyan = barcode.substr(12, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "3")
+	{
+		if (barcode.length() != 12 && barcode.length() != 13)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 12)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//13位【FFWWWWWEEEEEC】
+		bianma = barcode.substr(2, 5);
+		money = barcode.substr(7, 5);
+		jiaoyan = barcode.substr(12, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "4")
+	{
+		if (barcode.length() != 12 && barcode.length() != 13)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 12)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//13位【FFWWWWWNNNNNC】
+		bianma = barcode.substr(2, 5);
+		weight = barcode.substr(7, 5);
+		jiaoyan = barcode.substr(12, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "5")
+	{
+		if (barcode.length() != 17 && barcode.length() != 18)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 17)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//18位【FWWWWWWEEEEENNNNNC】
+		bianma = barcode.substr(1, 6);
+		money = barcode.substr(7, 5);
+		weight = barcode.substr(12, 5);
+		jiaoyan = barcode.substr(17, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "6")
+	{
+		if (barcode.length() != 17 && barcode.length() != 18)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 17)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//18位【FWWWWWWNNNNNEEEEEC】
+		bianma = barcode.substr(1, 6);
+		weight = barcode.substr(7, 5);
+		money = barcode.substr(12, 5);
+		jiaoyan = barcode.substr(17, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "7")
+	{
+		if (barcode.length() != 17 && barcode.length() != 18)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 17)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//18位【FFWWWWWEEEEENNNNNC】
+		bianma = barcode.substr(2, 5);
+		money = barcode.substr(7, 5);
+		weight = barcode.substr(12, 5);
+		jiaoyan = barcode.substr(17, 1);
+	}
+	else if (setting_tiaomacheng_geshi == "8")
+	{
+		if (barcode.length() != 17 && barcode.length() != 18)
+		{
+			//与该模式长度不匹配
+			return false;
+		}
+
+		if (barcode.length() == 17)
+		{
+			barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
+		}
+
+		//18位【FFWWWWWNNNNNEEEEEC】
+		bianma = barcode.substr(2, 5);
+		weight = barcode.substr(7, 5);
+		money = barcode.substr(12, 5);
+		jiaoyan = barcode.substr(17, 1);
+	}
+
+	//先检查编码是否存在,如果编码不存在直接返回false
+	int i_bianma = atoi(bianma.c_str());
+	if (i_bianma < 1)
+	{
+		return false;
+	}
+
+	CFood foodinfo;
+
+	CSqlite3 sqlite;
+	bool ret = sqlite.GetFoodByPluBianma(to_string(i_bianma), foodinfo);
+	if (ret == false)
+	{
+		//没找到这个商品
+		return false;
+	}
+
+	//走到这里是找到商品了,那么就开始计算价格和重量
+	double d_money = 0;
+	double d_weight = 0;
+
+	//如果有价格,优先用价格
+	if (money.length() > 0)
+	{
+		//这个出来的单位是分,要把单位转成员
+		d_money = atof(money.c_str());
+
+		d_money = d_money / 100;
+
+		//根据价格计算重量
+		d_weight = d_money / atof(foodinfo.price.c_str());
+	}
+	else if (weight.length() > 0)
+	{
+		//这个单位是克,要转化成千克
+		d_weight = atof(weight.c_str());
+
+		d_weight = d_weight / 1000;
+
+		//有重量了,其实不需要计算价格,价格加到购物车的时候会自己计算
+	}
+	else
+	{
+		//价格和重量都没有,这是异常情况
+		return false;
+	}
+
+	if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < d_weight)
+	{
+		//库存为0了,不做任何处理
+		m_pMainWnd->ShowToast(L"该商品已售完");
+
+		//只要找到了就返回true
+		return true;
+	}
+
+	CZhengcanOrderItem clickItem;
+
+	clickItem.food_id = foodinfo.id;
+	clickItem.food_name = foodinfo.name;
+	clickItem.type_id = foodinfo.type_id;
+	clickItem.price = foodinfo.price;
+	clickItem.is_dabao = false;
+	clickItem.dabao_money = foodinfo.dabao_money;
+	clickItem.num = CLewaimaiString::DoubleToString(d_weight, 3); //重量保留3位小数
+
+	if (foodinfo.member_price_used == "1")
+	{
+		clickItem.is_member_price_used = true;
+	}
+	else
+	{
+		clickItem.is_member_price_used = false;
+	}
+
+	//处理会员价的json
+	std::string member_price_json = foodinfo.member_price_json;
+
+	rapidjson::Document document;
+	document.Parse(member_price_json.c_str());
+
+	rapidjson::Value& member_price = document;
+	for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
+	{
+		rapidjson::Value& member_price_info = member_price[i];
+
+		MemberPrice newPirce;
+		newPirce.id = member_price_info["id"].GetString();
+		newPirce.level = member_price_info["level"].GetString();
+		newPirce.price = member_price_info["price"].GetString();
+
+		clickItem.m_member_price.push_back(newPirce);
+	}
+
+	//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+	clickItem.SetFoodInfo(foodinfo);
+	clickItem.SetIsTaocan(false);
+
+	clickItem.is_weight = true;
+	clickItem.is_nature = false;
+
+	//商品没有商品属性
+	bool is_add_new = false;
+
+	int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
+
+	if (is_add_new)
+	{
+		//说明是新增了一项,要刷新一下购物车展示
+		this->AddDiandanOrderItemShow(index);
+	}
+	else
+	{
+		//没有新增,而是修改了一项
+		this->UpdateDiandanOrderItemShow(index);
+	}
+
+	return true;
+}
+
+//开始搜索某个商品名字
+void CZhengcanDiandanPageUI::StartSearchFood(std::string foodname)
+{
+	//展示删除按钮
+	CButtonUI* pClear = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_food_search_clear")));
+	pClear->SetVisible(true);
+
+	//隐藏商品分类展示
+	CHorizontalLayoutUI* pFoodtype = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
+	pFoodtype->SetVisible(false);
+
+	if (m_cur_type_id != "sousuo")
+	{
+		m_type_id_before_sousuo = m_cur_type_id;
+	}
+
+	m_cur_type_id = "sousuo";
+
+	m_sousuo_foodname = foodname;
+
+	CLabelUI* pTishi = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_food_search_tishi")));
+	pTishi->SetVisible(false);
+
+	this->InitFoodShow();
+}
+
+//停止搜索商品
+void CZhengcanDiandanPageUI::StopSerachFood()
+{
+	//隐藏删除按钮
+	CButtonUI* pClear = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_food_search_clear")));
+	pClear->SetVisible(false);
+
+	//展示商品分类展示
+	CHorizontalLayoutUI* pFoodtype = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
+	pFoodtype->SetVisible(true);
+
+	m_cur_type_id = m_type_id_before_sousuo;
+
+	CLabelUI* pTishi = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_food_search_tishi")));
+	pTishi->SetVisible(true);
+
+	this->InitFoodShow();
+}
+
+void CZhengcanDiandanPageUI::StartWorkAfterShoukuan(std::string kucunstring, std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance, std::string member_number)
+{
+	//针对现金收款成功,单独做一个打开钱箱的判断处理
+	if (shoukuan_type == "xianjinzhifu")
+	{
+		std::string setting_is_diannei_xianjin_qianxiang = CSetting::GetInstance()->GetParam("setting_is_diannei_xianjin_qianxiang");
+		if (setting_is_diannei_xianjin_qianxiang == "1")
+		{
+			//打开钱箱
+			CPosPrinter printer;
+			printer.OpenQianxiang();
+		}
+	}
+
+	//更新商品库存
+	this->UpdateFoodStock(kucunstring);
+
+	//处理打印
+	CZhengcanOrder order = this->GetPrintOrderinfo(take_food_code, show_trade_no, shoukuan_type, balance, member_number);
+
+	CPosPrinter printer;
+	printer.PrintZhengcanOrder(order);
+
+	//最后才初始化页面信息
+	RefreshShow();
+}
+
+CZhengcanOrder CZhengcanDiandanPageUI::GetPrintOrderinfo(std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance, std::string member_number)
+{
+	m_cur_diandan_order.shopname = CShopinfo::GetInstance()->m_shop_name;
+	m_cur_diandan_order.take_food_code = take_food_code;
+	m_cur_diandan_order.show_trade_no = show_trade_no;
+	m_cur_diandan_order.balance = balance;
+	m_cur_diandan_order.member_number = member_number;
+
+	if (shoukuan_type == "weixinzhifu")
+	{
+		m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"微信支付");
+	}
+	else if (shoukuan_type == "zhifubao")
+	{
+		m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"支付宝");
+	}
+	else if (shoukuan_type == "yunshanfu")
+	{
+		m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"云闪付");
+	}
+	else if (shoukuan_type == "huiyuanzhifu")
+	{
+		m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"会员支付");
+	}
+	else if (shoukuan_type == "xianjinzhifu")
+	{
+		m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"现金支付");
+	}
+	else if (shoukuan_type == "fulikazhifu")
+	{
+		m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"福利卡支付");
+	}
+	else if (shoukuan_type == "zidingyizhifu")
+	{
+		m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"自定义支付");
+	}
+
+	m_cur_diandan_order.order_from = 1;
+	m_cur_diandan_order.init_time = CLewaimaiTime::DatetimeToString(time(NULL));
+
+	m_cur_diandan_order.m_shangpinquan_youhui = CLewaimaiString::DoubleToString(m_shangpinquan_youhui, 2);
+	m_cur_diandan_order.m_cika_youhui = CLewaimaiString::DoubleToString(m_cika_youhui, 2);
+	m_cur_diandan_order.m_total_member_youhui = CLewaimaiString::DoubleToString(m_total_member_youhui, 2);
+	m_cur_diandan_order.m_zhekou_youhui = CLewaimaiString::DoubleToString(m_zhekou_youhui, 2);
+	m_cur_diandan_order.m_member_zhekou_youhui = CLewaimaiString::DoubleToString(m_member_zhekou_youhui, 2);
+	m_cur_diandan_order.m_quanyika_youhui = CLewaimaiString::DoubleToString(m_quanyika_youhui, 2);
+	m_cur_diandan_order.m_manjian_youhui = CLewaimaiString::DoubleToString(m_manjian_youhui, 2);
+	m_cur_diandan_order.m_youhuiquan_youhui = CLewaimaiString::DoubleToString(m_youhuiquan_youhui, 2);
+	m_cur_diandan_order.m_rengong_youhui = CLewaimaiString::DoubleToString(m_rengong_youhui, 2);
+	m_cur_diandan_order.m_moling_youhui = CLewaimaiString::DoubleToString(m_moling_youhui, 2);
+
+	m_cur_diandan_order.m_jiajia = CLewaimaiString::DoubleToString(m_jiajia, 2);
+
+	m_cur_diandan_order.m_shishou_value = m_shishou_value;
+	m_cur_diandan_order.m_zhaoling_value = m_zhaoling_value;
+
+	m_cur_diandan_order.m_zhekou_value = m_zhekou_value;
+
+	m_cur_diandan_order.m_dabao_money = CLewaimaiString::DoubleToString(m_cur_diandan_order.getDabaoMoney(), 2);
+	m_cur_diandan_order.m_total_price = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
+
+	m_cur_diandan_order.m_canpai = m_canpai;
+
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_cur_diandan_order.m_items.begin(); it != m_cur_diandan_order.m_items.end(); it++)
+	{
+		CZhengcanOrderItemPrint itemPrint;
+
+		itemPrint.m_food_name = it->getNameWanzhengShow();
+		itemPrint.m_quantity = it->num;
+		itemPrint.m_item_price = it->getSinglePrice();
+		itemPrint.m_type_id = it->type_id;
+
+		if (it->m_is_taocan == true)
+		{
+			itemPrint.is_taocan = true;
+		}
+
+		m_cur_diandan_order.m_items_print.push_back(itemPrint);
+
+		if (it->m_is_taocan == true)
+		{
+			//开始保存套餐里面的商品详情,主要用于厨房打印
+			CFoodpackage foodpackageinfo;
+			foodpackageinfo = it->GetFoodpackageInfo();
+
+			std::string nature = foodpackageinfo.nature;
+
+			rapidjson::Document document;
+			document.Parse(nature.c_str());
+
+			if (document.HasParseError())
+			{
+				//属性json报错,直接不处理了
+				continue;
+			}
+
+			rapidjson::Value& data = document;
+
+			//接下来要把这个套餐的详情也保存下来
+			for (std::vector<FoodNatureSelectValue>::iterator it_2 = it->natureSelectedArray.begin(); it_2 != it->natureSelectedArray.end(); it_2++)
+			{
+				std::string food_id = data[it_2->nNameIndex]["value"][it_2->nature_select_index].GetString();
+
+				//要根据商品ID找出商品的名字
+				CFood foodinfo;
+				CSqlite3 sqlite;
+				bool is_found = sqlite.GetFoodById(food_id, foodinfo);
+				if (!is_found)
+				{
+					continue;
+				}
+
+				CZhengcanOrderItemPrint foodpackageitemPrint;
+
+				foodpackageitemPrint.m_food_name = foodinfo.name;
+				foodpackageitemPrint.m_quantity = it->num;
+				foodpackageitemPrint.m_item_price = foodinfo.price;
+				foodpackageitemPrint.m_type_id = foodinfo.type_id;
+
+				foodpackageitemPrint.is_taocan = false;
+				foodpackageitemPrint.is_taocan_item = true;
+
+				m_cur_diandan_order.m_items_print.push_back(foodpackageitemPrint);
+			}
+		}
+	}
+
+	return m_cur_diandan_order;
+}
+
+void CZhengcanDiandanPageUI::SetPos(RECT rc, bool bNeedInvalidate)
+{
+	m_nPageWidth = rc.right - rc.left;
+
+	//拖动窗口的时候,更新位置
+	UpdateJiesuanZhifuPos();
+
+	//更新分类位置
+	UpdateFoodtypePos();
+
+	CContainerUI::SetPos(rc, bNeedInvalidate);
+}
+
+void CZhengcanDiandanPageUI::SetTableId(std::string table_id)
+{
+	m_table_id = table_id;
+}

+ 343 - 0
zhipuzi_pos_windows/page/CZhengcanDiandanPageUI.h

@@ -0,0 +1,343 @@
+#pragma once
+
+#include "../pch/pch.h"
+#include "CBasePageUI.h"
+
+#include "../zhipuzi/CFood.h"
+#include "../zhipuzi/CFoodtype.h"
+#include "../zhipuzi/CFoodpackage.h"
+
+#include "../control/CDiandanFoodItemUI.h"
+#include "../zhipuzi/CZhengcanOrder.h"
+
+#include "../wnd/CModalWnd.h"
+
+class CZhengcanDiandanPageUI : public CBasePageUI
+{
+public:
+	CZhengcanDiandanPageUI();
+	~CZhengcanDiandanPageUI();
+
+	//初始化当前页面的展示,处理默认展示效果,在页面每次被选中加载(注意不是页面创建构造)的时候调用,如果多次选中会多次调用,这里要避免数据重复处理
+	void InitShow();
+
+	//这个是获取到桌位和订单相关信息之后执行的函数,初始化桌位和订单的显示
+	void InitTableShow();
+
+	//收款一个订单成功,准备开始收款第2个订单的时候调用(会多次调度用)
+	void RefreshShow();
+
+	//获取桌子信息和参数
+	void GetTableInfo();
+
+	//实际执行获取桌子信息的线程
+	void DoGetTableInfo();
+
+	//初始化商品分类的显示
+	void InitFoodtypeShow();
+
+	void UpdateFoodtypePos();
+
+	//根据当前选择的分类,刷新商品展示
+	void InitFoodShow();
+
+	//仅仅初始化结算相关的显示(比如折扣、优惠、价格等)
+	void InitJiesuanShow();
+
+	//初始化结算页面的支付方式展示(仅需要在页面初始化的时候调用一次,这里只添加支付方式,不设置位置)
+	void InitJiesuanZhifu();
+
+	//这个只更新结算页面支付方式的位置,不处理控件添加
+	void UpdateJiesuanZhifuPos();
+
+	//展示结算页面,隐藏选购页面
+	void ShowJiesuanPage();
+
+	//展示选购页面,隐藏结算页面
+	void ShowXuangouPage();
+
+	//只是刷新取单数量
+	void RefreshGuadanNum();
+
+	//处理按钮点击类事件
+	void HandleClickMsg(TNotifyUI& msg);
+
+	//处理option切换事件
+	void HandleSelectChangeMsg(TNotifyUI& msg);
+
+	//处理下拉框、radio的切换事件
+	void HandleItemSelectMsg(TNotifyUI& msg);
+
+	//处理编辑框输入内容改变事件
+	void HandleTextChangedMsg(TNotifyUI& msg);
+
+	//处理扫码枪捕捉到的扫码信息
+	void HandleTextCapture(std::string content);
+
+	//处理自定义消息,各个页面处理各个页面自己的(是自己处理的消息返回true,不是自己处理的消息返回false)
+	bool HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+	{
+		return false;
+	}
+
+	//添加一个新的商品到购物车展示
+	void AddDiandanOrderItemShow(int index);
+
+	//刷新某个购物车商品的显示
+	void UpdateDiandanOrderItemShow(int index);
+
+	//删除购物车中某一个商品
+	void DelDiandanOrderItemShow(int index);
+
+	//清空购物车中所有商品的展示
+	void ClearDiandanOrderItemShow();
+
+	//任何可以引起价格变化的,比如添加、修改、删除商品,或者修改优惠等,需要重新计算总价格,刷新结算账单等地方的显示,都要调用这个方法
+	void UpdateJiesuanInfo();
+
+	//点击某一个商品的item之后的处理逻辑
+	void ClickFoodAction();
+
+	//点击加号之后的逻辑
+	void ClickAdd();
+
+	//点击减号之后的逻辑
+	void ClickDel();
+
+	//点击删除之后的逻辑
+	void ClickRemove();
+
+	//点击规格之后的逻辑
+	void ClickGuige();
+
+	//点击打包之后的逻辑
+	void ClickDabao();
+
+	//点击清空之后的逻辑
+	void ClickQingkong();
+
+	//点击整单备注之后的逻辑
+	void ClickZhengdanMemo();
+
+	//点击更多支付之后的逻辑
+	void ClickGengduoPay();
+
+	//点击继续加菜之后的逻辑
+	void JixuJiacai();
+
+	//点击查看优惠
+	void ClickChakanYouhui();
+
+	//处理会员登录
+	void ClickMemberLogin();
+
+	//点击整单折扣
+	void ClickZhekou();
+
+	//点击加价
+	void ClickJiajia();
+
+	//点击优惠
+	void ClickRengongyouhui();
+
+	//点击扫码使用优惠券
+	void ClickSaomaYouhuiquan();
+
+	//点击扫码商品券
+	void ClickSaomaShangpinquan();
+
+	//点击扫码权益卡
+	void ClickSaomaQuanyika();
+
+	//点击扫码次卡
+	void ClickSaomaCika();
+
+	//点击取消使用优惠券
+	void ClickQuxiaoYouhuiquan();
+
+	//点击取消商品券
+	void ClickQuxiaoShangpinquan();
+
+	//点击取消权益卡
+	void ClickQuxiaoQuanyika();
+
+	//点击取消次卡
+	void ClickQuxiaoCika();
+
+	//点击餐牌号按钮
+	void ClickCanpai();
+
+	//开始进行微信支付收款,如果fukuanma不为空,默认自动唤起支付
+	void StartWeixinzhifuShoukuan(std::string fukuanma = "");
+
+	//开始进行会员收款
+	void StartHuiyuanShoukuan();
+
+	//开始进行现金收款
+	void StartXianjinShoukuan();
+
+	//开始进行福利卡收款
+	void StartFulikaShoukuan();
+
+	//开始自定义支付收款
+	void StartZidingyiShoukuan(std::wstring name, std::wstring selfpay_id);
+
+	//支付成功后,更新商品库存
+	void UpdateFoodStock(std::string food_stock);
+
+	//扫描了商品条码的逻辑处理,如果找到了这个条码的商品就返回true,如果没找到就返回false
+	bool SaomiaoBarcode(std::string barcode);
+
+	//判断是不是标签秤的条码,并进行处理,返回true表示是标签秤的条码,返回false表示不是
+	bool BiaoqianchengSaomaBarcode(std::string barcode);
+
+	//开始搜索某个商品名字
+	void StartSearchFood(std::string foodname);
+
+	//停止搜索商品
+	void StopSerachFood();
+
+	//执行付款成功后的所有操作逻辑
+	void StartWorkAfterShoukuan(std::string kucunstring, std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance = "", std::string member_number = "");
+
+	void SetPos(RECT rc, bool bNeedInvalidate = true);
+
+	void SetTableId(std::string table_id);
+
+private:
+	//获取用于提交订单的参数结构
+	std::map<string, string> GetSendorderParams();
+
+	//用于支付完成后,获取用于打印的order
+	CZhengcanOrder GetPrintOrderinfo(std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance, std::string member_number);
+
+private:
+	CTileLayoutUI* m_foodLayout;
+	CHorizontalLayoutUI* m_foodtypeLayout;
+
+	bool m_is_zidingyizhifu_init = false;
+
+	//套餐商品数量
+	int m_nFoodpackageNum;
+
+	//所有商品分类(只包含收银机显示的分类)
+	std::vector<CFoodType> m_types;
+
+	//当前选中的商品分类ID,为空表示没选中任何分类,为taocan表示选中套餐分类,如果选中普通商品分类就是分类ID
+	std::string m_cur_type_id = "";
+	CControlUI* m_curFoodtypeOption;
+
+	//商品搜索相关
+	std::string m_type_id_before_sousuo;
+	std::string m_sousuo_foodname;
+
+	//当前点击的哪个商品
+	CDiandanFoodItemUI* m_cur_click_food_item;
+
+	//当前购物车的订单,根据这个来进行渲染显示
+	CZhengcanOrder m_cur_diandan_order;
+
+	//当前挂单的订单
+	std::vector<CZhengcanOrder> m_guadan_orders;
+
+	//下面是结算相关信息
+
+	//总的优惠
+	double m_total_youhui;
+
+	//折扣
+	int m_zhekou_value;
+	double m_zhekou_youhui;
+
+	//人工加价
+	double m_jiajia;
+
+	//人工优惠
+	double m_rengong_youhui;
+
+	//开台费
+	double m_kaitai;
+
+	//茶位费
+	double m_chawei;
+
+	//打包费
+	double m_dabao;
+
+	//优惠券
+	bool m_is_youhuiquan;
+	std::string m_youhuiquan_id;
+	std::string m_coupon_basic_price;
+	std::string m_coupon_deadline;
+	std::string m_coupon_value;
+	double m_youhuiquan_youhui;
+
+	//商品券
+	bool m_is_shangpinquan; //是否核销的商品券
+	std::string m_shangpinquan_lewaimai_customer_id;
+	std::string m_shangpinquan_id;
+	std::string m_shangpinquan_name;
+	std::string m_shangpinquan_foodid;
+	double m_shangpinquan_youhui; //商品券优惠金额
+
+	//次卡
+	bool m_is_cika;
+	std::string m_cika_lewaimai_customer_id;
+	std::string m_cika_id;
+	std::string m_cika_deduct_type; //次卡优惠类型,0=>折扣,1=>满减,2=>抵扣,3=>指定商品兑换
+	std::string m_cika_discount; //折扣信息
+	std::string m_cika_discount_value; //折扣打折值
+	std::string m_cika_full_reduce; //满减信息
+	std::string m_cika_full_reduce_value; //满减,例如 200,100中间逗号隔开
+	std::string m_cika_offer;
+	std::string m_cika_offer_value;
+	std::string m_cika_bind_foods_id;
+	double m_cika_youhui;
+
+	//权益卡
+	bool m_is_quanyika;
+	std::string m_quanyika_discount; //这里是接口返回的,实际上店铺设置里面也有一个
+	double m_quanyika_youhui;
+
+	//抹零 0:不抹零 1:抹零到角 2:抹零到元
+	int m_moling_type;
+	double m_moling_youhui;
+
+	//会员相关
+	bool m_is_member = false;
+	std::string m_member_name;
+	std::string m_member_level;
+	std::string m_member_level_name;
+
+	double m_total_member_youhui; //会员商品优惠
+
+	bool m_is_member_zhekou = false;
+	std::string m_member_zhekou_value; //具体会员打几折
+	double m_member_zhekou_youhui; //会员店铺折扣优惠
+
+	//满减
+	double m_manjian_youhui;
+
+	//当前应收总价
+	double m_cur_total_price;
+
+	//仅用于现金收银成功后,对于实收和找零的临时记录
+	std::string m_shishou_value;
+	std::string m_zhaoling_value;
+
+	//餐牌
+	std::string m_canpai;
+
+	//模态对话框有关的
+	bool m_is_show_modal_wnd = false;
+	CModalWnd* m_curModalWnd;
+
+	//结算页面总的支付方式数量
+	int m_nZhiufuNum;
+
+	//当前控件的实际宽度
+	int m_nPageWidth;
+
+	//当前点餐对应的桌子id
+	std::string m_table_id;
+};

+ 6 - 3
zhipuzi_pos_windows/page/CZhengcanPageUI.cpp

@@ -312,12 +312,12 @@ void CZhengcanPageUI::DoRefreshTable()
 
 		CZhengcanTableItemUI* pItem = static_cast<CZhengcanTableItemUI*>(builder.Create(_T("zhengcan_tableitem.xml"), (UINT)0, &cb, m_pManager));
 
-		pItem->SetInfo(CLewaimaiJson::ToString(tableinfo["table_id"]), CLewaimaiJson::ToString(tableinfo["name"]), CLewaimaiJson::ToString(tableinfo["type_id"]), CLewaimaiJson::ToString(tableinfo["status"]), CLewaimaiJson::ToString(tableinfo["order_init_time"]), CLewaimaiJson::ToString(tableinfo["from_type"]), CLewaimaiJson::ToString(tableinfo["order_status"]), CLewaimaiJson::ToString(tableinfo["order_id"]));
+		pItem->SetInfo(CLewaimaiJson::ToString(tableinfo["table_id"]), CLewaimaiJson::ToString(tableinfo["name"]), CLewaimaiJson::ToString(tableinfo["type_id"]), CLewaimaiJson::ToString(tableinfo["status"]), CLewaimaiJson::ToString(tableinfo["order_init_time"]), CLewaimaiJson::ToString(tableinfo["from_type"]), CLewaimaiJson::ToString(tableinfo["order_status"]), CLewaimaiJson::ToString(tableinfo["order_id"]), CLewaimaiJson::ToString(tableinfo["limit_number"]));
 
 		pItem->UpdateShow();
 
 		m_tableLayout->Add(pItem);
-
+		
 		m_table_num++;
 	}
 
@@ -444,7 +444,7 @@ void CZhengcanPageUI::ClickTableAction()
 	else if (status == "2")
 	{
 		//ÒÑ¿ªÌ¨
-
+		this->EnterTable(table_id);
 	}
 }
 
@@ -499,5 +499,8 @@ bool CZhengcanPageUI::Kaitai(std::string table_id, std::string renshu)
 
 void CZhengcanPageUI::EnterTable(std::string table_id)
 {
+	CZhengcanDiandanPageUI* page = static_cast<CZhengcanDiandanPageUI*>(m_pMainWnd->GetPage(CMainWnd::ZHENGCANDIANDAN));
+	page->SetTableId(table_id);
 
+	m_pMainWnd->SwitchPage(CMainWnd::ZHENGCANDIANDAN);
 }

+ 12 - 0
zhipuzi_pos_windows/print/CPosPrinter.cpp

@@ -132,6 +132,18 @@ void CPosPrinter::PrintDiandanOrder(std::string order_id)
 	PrintDiandanOrder(order);
 }
 
+//完成所有打印一个正餐订单的操作(不等待,立即返回)
+void CPosPrinter::PrintZhengcanOrder(CZhengcanOrder& order)
+{
+
+}
+
+//通过订单号打印订单,后面要改成异步才行
+void CPosPrinter::PrintZhengcanOrder(std::string order_id)
+{
+
+}
+
 void CPosPrinter::PirntJiaobanOrder(CJiaobaoOrder& order)
 {
 	CPosPrinterData printData;

+ 6 - 0
zhipuzi_pos_windows/print/CPosPrinter.h

@@ -24,6 +24,12 @@ public:
 	//通过订单号打印订单,后面要改成异步才行
 	void PrintDiandanOrder(std::string order_id);
 
+	//完成所有打印一个正餐订单的操作(不等待,立即返回)
+	void PrintZhengcanOrder(CZhengcanOrder& order);
+
+	//通过订单号打印订单,后面要改成异步才行
+	void PrintZhengcanOrder(std::string order_id);
+
 	//打印交班单
 	void PirntJiaobanOrder(CJiaobaoOrder& order);
 

+ 1 - 0
zhipuzi_pos_windows/print/CPosPrinterData.h

@@ -3,6 +3,7 @@
 #include "../pch/pch.h"
 #include "../zhipuzi/CWaimaiOrder.h"
 #include "../zhipuzi/CDiandanOrder.h"
+#include "../zhipuzi/CZhengcanOrder.h"
 #include "../zhipuzi/CJiaobanOrder.h"
 #include "../zhipuzi/CHuiyuanchognzhiOrder.h"
 

+ 11 - 0
zhipuzi_pos_windows/tool/CShuangpingTool.cpp

@@ -117,3 +117,14 @@ void CShuangpingTool::UpdateShow(CDiandanOrder& order, double total_youhui, doub
 
 	m_pFuping->UpdateShow(order, total_youhui, total_price, dabao_money);
 }
+
+void CShuangpingTool::UpdateShow(CZhengcanOrder& order, double total_youhui, double total_price, double dabao_money)
+{
+	if (m_is_shuangping == false)
+	{
+		//如果都没双屏,就不处理了
+		return;
+	}
+
+	m_pFuping->UpdateShow(order, total_youhui, total_price, dabao_money);
+}

+ 3 - 0
zhipuzi_pos_windows/tool/CShuangpingTool.h

@@ -2,6 +2,7 @@
 
 #include "../wnd/CFupingWnd.h"
 #include "../zhipuzi/CDiandanOrder.h"
+#include "../zhipuzi/CZhengcanOrder.h"
 
 class CShuangpingTool
 {
@@ -25,6 +26,8 @@ public:
 	//刷新副屏显示,在点单页面的商品或价格发生变化时调用,重新计算渲染副屏显示数据
 	void UpdateShow(CDiandanOrder& order, double total_youhui, double total_price, double dabao_money);
 
+	void UpdateShow(CZhengcanOrder& order, double total_youhui, double total_price, double dabao_money);
+
 private:
 	CShuangpingTool();
 

+ 1 - 0
zhipuzi_pos_windows/wnd/CDiandanNatureWnd.h

@@ -7,6 +7,7 @@
 #include "../control/CDiandanNatureItemUI.h"
 #include "../zhipuzi/CDiandanOrder.h"
 
+
 #include "CModalWnd.h"
 
 class CDiandanNatureWnd : public CModalWnd

+ 93 - 0
zhipuzi_pos_windows/wnd/CFupingWnd.cpp

@@ -300,6 +300,99 @@ void CFupingWnd::UpdateShow(CDiandanOrder& order, double total_youhui, double to
 	pTotalPrice->SetText((L"总价:¥" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(total_price, 2))).c_str());
 }
 
+void CFupingWnd::UpdateShow(CZhengcanOrder& order, double total_youhui, double total_price, double dabao_money)
+{
+	//先清空当前的显示
+	CListUI* pList = static_cast<CListUI*>(m_pm.FindControl(_T("list_diandan_cart")));
+	pList->RemoveAll();
+
+	//然后依次渲染所有的
+	int nItemNum = order.getItemNum();
+	for (int i = 0; i < nItemNum; i++)
+	{
+		CZhengcanOrderItem item = order.getDiandanOrderItem(i);
+
+		CDialogBuilder builder;
+		CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("diandan_cart_item.xml"), (UINT)0, NULL, &m_pm));
+
+		pList->Add(pEle);
+
+		if (item.m_is_taocan)
+		{
+			CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
+			pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
+
+			CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
+			pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
+
+			CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
+			pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
+
+			CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
+
+			pEle->SetFixedHeight(84);
+			pNature->SetVisible(true);
+			pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
+		}
+		else
+		{
+			CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
+			pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
+
+			CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
+			pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
+
+			CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
+			pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
+
+			CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
+			if (item.is_nature)
+			{
+				pEle->SetFixedHeight(84);
+				pNature->SetVisible(true);
+				pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
+			}
+			else
+			{
+				pEle->SetFixedHeight(42);
+				pNature->SetVisible(false);
+			}
+		}
+	}
+
+	//刷新优惠展示
+	CHorizontalLayoutUI* pYouhuiLayout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("diandan_page_youhui_tishi_layout")));
+	CLabelUI* pYouhuiLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("diandan_page_youhui_tishi")));
+
+	if (total_youhui > 0)
+	{
+		wstring youhuilabel = L"已优惠 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(total_youhui, 2)) + L" 元";
+		pYouhuiLabel->SetText(youhuilabel.c_str());
+
+		pYouhuiLayout->SetVisible(true);
+	}
+	else
+	{
+		pYouhuiLayout->SetVisible(false);
+	}
+
+	//再刷新打包费展示
+	CLabelUI* pOtherPriceLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("diandan_page_otherprice")));
+	if (dabao_money > 0)
+	{
+		std::wstring ws_dabaofei = L"打包费 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(dabao_money, 2)) + L" 元";
+		pOtherPriceLabel->SetText(ws_dabaofei.c_str());
+	}
+	else
+	{
+		pOtherPriceLabel->SetText(L"");
+	}
+
+	//再刷新总价展示
+	CLabelUI* pTotalPrice = static_cast<CLabelUI*>(this->m_pm.FindControl(_T("diandan_page_totalprice")));
+	pTotalPrice->SetText((L"总价:¥" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(total_price, 2))).c_str());
+}
+
 void CFupingWnd::Stop()
 {
 	m_is_work = false;

+ 3 - 0
zhipuzi_pos_windows/wnd/CFupingWnd.h

@@ -3,6 +3,7 @@
 #include "../pch/pch.h"
 
 #include "../zhipuzi/CDiandanOrder.h"
+#include "../zhipuzi/CZhengcanOrder.h"
 
 class CFupingWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
 {
@@ -67,6 +68,8 @@ public:
 	//ˢи±ÆÁÏÔʾ
 	void UpdateShow(CDiandanOrder& order, double total_youhui, double total_price, double dabao_money);
 
+	void UpdateShow(CZhengcanOrder& order, double total_youhui, double total_price, double dabao_money);
+
 public:
 	CPaintManagerUI m_pm;
 

+ 7 - 0
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -1388,6 +1388,13 @@ void CMainWnd::CreatePages()
 		m_pages[CAIGOU] = pChildContainer;
 	}
 
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		pChildContainer = static_cast<CBasePageUI*>(builder.Create(_T("zhengcan_diandan_page.xml"), (UINT)0, &cb, &m_pm));
+		m_pages[ZHENGCANDIANDAN] = pChildContainer;
+	}
+
 	//这里纯粹只是创建对象,不做任何初始化等处理
 }
 

+ 1 - 0
zhipuzi_pos_windows/wnd/CMainWnd.h

@@ -32,6 +32,7 @@ public:
 		SAOMASHOUYIN, //扫码收银
 		CAIGOU, //采购
 		KUCUN, //库存
+		ZHENGCANDIANDAN, //正餐点单
 	};
 
     LPCTSTR GetWindowClassName() const

+ 578 - 0
zhipuzi_pos_windows/zhipuzi/CZhengcanOrder.cpp

@@ -0,0 +1,578 @@
+#include "../pch/pch.h"
+#include "CZhengcanOrder.h"
+
+void CZhengcanOrder::RefreshDiandanInfo()
+{
+	m_items.clear();
+
+	m_total_price_show = "";
+	m_guadan_time = "";
+	m_memo = "";
+
+	shopname = "";
+	take_food_code = "";
+	show_trade_no = "";
+	balance = "";
+	member_number = "";
+	m_renshu = "";
+	shoukuan_type = "";
+
+	int order_from = 1;
+
+	init_time = "";
+	m_shangpinquan_youhui = "";
+	m_cika_youhui = "";
+	m_total_member_youhui = "";
+	m_zhekou_youhui = "";
+	m_member_zhekou_youhui = "";
+	m_quanyika_youhui = "";
+	m_manjian_youhui = "";
+	m_youhuiquan_youhui = "";
+	m_rengong_youhui = "";
+	m_moling_youhui = "";
+	m_jiajia = "";
+	m_shishou_value = "";
+	m_zhaoling_value = "";
+	m_zhekou_value = "";
+	m_dabao_money = "";
+	m_total_price = "";
+	m_canpai = "";
+
+	m_items_print.clear();
+
+	m_order_id = "";
+	is_refund = "";
+	refund_time = "";
+	is_guazhang = "";
+	guazhang = "";
+}
+
+int CZhengcanOrder::getItemNum()
+{
+	return m_items.size();
+}
+
+std::string CZhengcanOrder::getTotalPriceShow()
+{
+	double total_price_show = 0;
+
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		total_price_show += std::stod((*it).show_price);
+	}
+
+	m_total_price_show = CLewaimaiString::DoubleToString(total_price_show, 2);
+
+	return m_total_price_show;
+}
+
+double CZhengcanOrder::getTotalPrice()
+{
+	double total_price_show = 0;
+
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		total_price_show += std::stod((*it).show_price);
+	}
+
+	return total_price_show;
+}
+
+CZhengcanOrderItem CZhengcanOrder::getDiandanOrderItem(int index)
+{
+	return m_items[index];
+}
+
+//这个函数的逻辑是选择一个新商品的时候,与已有商品进行对比,看看是加一个新的商品,还是对已有商品增加数量
+//返回值是表示新加的item,在第几个元素,方便刷新显示
+int CZhengcanOrder::AddItem(CZhengcanOrderItem newitem, bool& is_add_new)
+{
+	int index = 0;
+	bool is_found = false;
+
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		CZhengcanOrderItem curItem = *it;
+
+		if (curItem == newitem)
+		{
+			is_found = true;
+			break;
+		}
+
+		index++;
+	}
+
+	//如果找到了,更新数量
+	if (is_found)
+	{
+		std::string old_num = m_items[index].num;
+
+		double d_old_num = std::stod(old_num);
+		double d_new_num = d_old_num + std::stod(newitem.num);
+
+		//如果新的数量是一个整数,那么展示的时候就把小数去掉
+		if (d_new_num - (int)d_new_num < 0.0001)
+		{
+			m_items[index].num = std::to_string((int)d_new_num);
+		}
+		else
+		{
+			m_items[index].num = CLewaimaiString::DoubleToString(d_new_num, 3);
+		}
+
+		m_items[index].UpdateShowPrice();
+
+		is_add_new = false;
+	}
+	else
+	{
+		//如果没找到,直接加一个新的item
+		m_items.push_back(newitem);
+
+		m_items[index].UpdateShowPrice();
+
+		is_add_new = true;
+	}
+
+	return index;
+}
+
+void CZhengcanOrder::UpdateItemGuige(int index, std::vector<FoodNatureSelectValue>& natureSelectedArray)
+{
+	m_items[index].natureSelectedArray = natureSelectedArray;
+
+	this->UpdateGuigePrice(index);
+}
+
+//给某一项添加一个数量
+void CZhengcanOrder::AddNum(int index)
+{
+	std::string old_num = m_items[index].num;
+
+	double d_old_num = std::stod(old_num);
+	double d_new_num = d_old_num + 1;
+
+	//如果新的数量是一个整数,那么展示的时候就把小数去掉
+	if (d_new_num - (int)d_new_num < 0.0001)
+	{
+		m_items[index].num = std::to_string((int)d_new_num);
+	}
+	else
+	{
+		m_items[index].num = CLewaimaiString::DoubleToString(d_new_num, 3);
+	}
+
+	m_items[index].UpdateShowPrice();
+}
+
+//给某一项减少一个数量,返回值为true表示商品本删掉了,也就是为0份;如果为false表示没被删掉
+bool CZhengcanOrder::DelNum(int index)
+{
+	std::string old_num = m_items[index].num;
+
+	double d_old_num = std::stod(old_num);
+	double d_new_num = d_old_num - 1;
+
+	if (d_new_num < 0.0001)
+	{
+		//已经减为0了,那么就删掉这个item
+		m_items.erase(m_items.begin() + index);
+
+		return true;
+	}
+	else
+	{
+		//如果新的数量是一个整数,那么展示的时候就把小数去掉
+		if (d_new_num - (int)d_new_num < 0.0001)
+		{
+			m_items[index].num = std::to_string((int)d_new_num);
+		}
+		else
+		{
+			m_items[index].num = CLewaimaiString::DoubleToString(d_new_num, 3);
+		}
+
+		m_items[index].UpdateShowPrice();
+	}
+
+	return false;
+}
+
+//删除某一项
+void CZhengcanOrder::Remove(int index)
+{
+	//已经减为0了,那么就删掉这个item
+	m_items.erase(m_items.begin() + index);
+}
+
+//更新了某项的规格,那么重新刷新显示和价格
+void CZhengcanOrder::UpdateGuigePrice(int index)
+{
+	m_items[index].UpdateShowPrice();
+}
+
+void CZhengcanOrder::SetDabao(int index)
+{
+	m_items[index].SetDabao();
+}
+
+//清空商品
+void CZhengcanOrder::Clear()
+{
+	m_items.clear();
+}
+
+void CZhengcanOrder::SetMemo(std::string memo)
+{
+	m_memo = memo;
+}
+
+std::string CZhengcanOrder::GetMemo()
+{
+	return m_memo;
+}
+
+bool CZhengcanOrder::UseShangpinquan(std::string shangpinquan_food_id, double& youhui_value)
+{
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		CZhengcanOrderItem curItem = *it;
+
+		if (curItem.m_is_taocan == false && curItem.food_id == shangpinquan_food_id)
+		{
+			//找到了可以使用的商品
+			if (atof(curItem.num.c_str()) > 0.99999)
+			{
+				//如果当前份数大于1,那么抵扣价格就是商品单价
+				youhui_value = atof(curItem.price.c_str());
+			}
+			else
+			{
+				//如果当前份数不足1份,那么就抵扣价格就是单价乘以数量
+				youhui_value = atof(curItem.price.c_str()) * atof(curItem.num.c_str());
+			}
+
+			return true;
+		}
+	}
+
+	return false;
+}
+
+bool CZhengcanOrder::UseCikaDikou(std::string cika_food_id, double& youhui_value, bool is_shangpinquan_dikou)
+{
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		CZhengcanOrderItem curItem = *it;
+
+		if (curItem.m_is_taocan == false && curItem.food_id == cika_food_id)
+		{
+			//找到了可以使用的商品
+			if (is_shangpinquan_dikou)
+			{
+				if (atof(curItem.num.c_str()) > 1.99999)
+				{
+					//如果当前份数大于2,那么抵扣价格就是商品单价
+					youhui_value = atof(curItem.price.c_str());
+				}
+				else if (atof(curItem.num.c_str()) > 0.99999)
+				{
+					//如果当前份数不足2份,但是大于1份,那么就抵扣价格就是单价乘以数量
+					youhui_value = atof(curItem.price.c_str()) * (atof(curItem.num.c_str()) - 1);
+				}
+				else
+				{
+					//如果当前份数不足1份,那么已经被商品券抵扣了,次卡不再抵扣
+					youhui_value = 0;
+
+					return false;
+				}
+			}
+			else
+			{
+				if (atof(curItem.num.c_str()) > 0.99999)
+				{
+					//如果当前份数大于1,那么抵扣价格就是商品单价
+					youhui_value = atof(curItem.price.c_str());
+				}
+				else
+				{
+					//如果当前份数不足1份,那么就抵扣价格就是单价乘以数量
+					youhui_value = atof(curItem.price.c_str()) * atof(curItem.num.c_str());
+				}
+			}
+
+			return true;
+		}
+	}
+
+	return false;
+}
+
+double CZhengcanOrder::getTotalMemberYouhui(std::string member_level)
+{
+	double total_youhui = 0;
+
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		CZhengcanOrderItem curItem = *it;
+
+		double item_youhui = curItem.getMemberYouhui(member_level);
+
+		total_youhui += item_youhui;
+	}
+
+	return total_youhui;
+}
+
+//计算所有商品的总的打包费
+double CZhengcanOrder::getDabaoMoney()
+{
+	double total_dabao = 0;
+
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		CZhengcanOrderItem curItem = *it;
+
+		double item_dabao = curItem.getDabaoMoney();
+
+		total_dabao += item_dabao;
+	}
+
+	return total_dabao;
+}
+
+//获取点单相关的参数(仅用于非套餐)
+std::string CZhengcanOrder::getDiandanFoodlistParam()
+{
+	std::vector<std::map<string, string>> params;
+
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		if (it->m_is_taocan)
+		{
+			continue;
+		}
+
+		params.push_back(it->getDiandanParam());
+	}
+
+	std::string s_params = CLewaimaiJson::ParamArrayToJsonstring(params);
+
+	return s_params;
+}
+
+//获取点单相关的套餐参数(仅用于套餐)
+std::string CZhengcanOrder::getDiandanTaocanParam()
+{
+	rapidjson::Document doc;
+	doc.SetArray();
+	rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //获取分配器
+
+	for (std::vector<CZhengcanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		if (it->m_is_taocan == false)
+		{
+			continue;
+		}
+
+		Value& data = it->getDiandanTaocanParam(allocator);
+		doc.PushBack(data, allocator);
+	}
+
+	std::string paramString = CLewaimaiJson::JsonToString(doc);
+
+	return paramString;
+}
+
+bool CZhengcanOrder::InitData(std::string order_id)
+{
+	std::map<string, string> params;
+	params["id"] = order_id;
+
+	std::string response;
+	bool ret = CZhipuziHttpClient::GetInstance()->Request("/diancan/getorderdetail", params, response);
+	if (!ret)
+	{
+		LOG_INFO("网络请求出错");
+		return false;
+	}
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		LOG_INFO("parse response error!");
+		return false;
+	}
+	else
+	{
+		if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+		{
+			LOG_INFO("json error!");
+			return false;
+		}
+
+		rapidjson::Value& v_errcode = document["errcode"];
+		int errcode = v_errcode.GetInt();
+		if (errcode != 0)
+		{
+			LOG_INFO("response failed! message:" << document["errmsg"].GetString());
+			return false;
+		}
+
+		//获得数据成功
+		rapidjson::Value& data = document["data"];
+
+		m_order_id = data["id"].GetString();
+		take_food_code = data["take_food_code"].GetString();
+		show_trade_no = data["show_trade_no"].GetString();
+		m_jiajia = data["price_plus"].GetString();
+		m_shishou_value = data["shishou_value"].GetString();
+		m_zhaoling_value = data["zhaoling_value"].GetString();
+		m_moling_youhui = data["price_moling"].GetString();
+		m_rengong_youhui = data["coupon"].GetString();
+		m_zhekou_value = data["discount"].GetString();
+		m_renshu = data["person_num"].GetString();
+		m_total_price = data["yingshou_price"].GetString();
+		init_time = data["init_time"].GetString();
+		m_canpai = data["table_name"].GetString();
+		shoukuan_type = data["zhifu_type"].GetString();
+		m_dabao_money = data["dabao_price"].GetString();
+		shopname = data["shop_name"].GetString();
+		m_memo = data["note"].GetString();
+		is_refund = data["is_refund"].GetString();
+		refund_time = data["refund_time"].GetString();
+		is_guazhang = data["is_guazhang"].GetString();
+		guazhang = data["guazhang"].GetString();
+		m_youhuiquan_youhui = data["coupon_value"].GetString();
+		m_total_member_youhui = data["member_delete"].GetString();
+		m_manjian_youhui = data["promotion_value"].GetString();
+		m_member_zhekou_youhui = data["member_discount_money"].GetString();
+		m_zhekou_youhui = data["shop_discount_money"].GetString();
+		m_cika_youhui = data["timescoupon_discount_money"].GetString();
+		m_quanyika_youhui = data["eq_card_discount_money"].GetString();
+
+		std::string fromtype = data["from_type"].GetString();
+		if (fromtype == "1")
+		{
+			order_from = 1;
+		}
+		else if (fromtype == "4")
+		{
+			order_from = 2;
+		}
+		else if (fromtype == "2" || fromtype == "3")
+		{
+			order_from = 3;
+		}
+
+		//开始保存订单详情
+		rapidjson::Value& v_rows = data["order_item"];
+
+		for (rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
+		{
+
+			rapidjson::Value& v_row_i = v_rows[i];
+
+			CZhengcanOrderItemPrint itemPrint;
+			itemPrint.m_food_name = v_row_i["food_name"].GetString();
+			itemPrint.m_quantity = v_row_i["quantity"].GetString();
+			itemPrint.m_item_price = v_row_i["single_price"].GetString();
+			itemPrint.m_type_id = v_row_i["type_id"].GetString();
+
+			m_items_print.push_back(itemPrint);
+		}
+
+		//保存套餐的
+		rapidjson::Value& foodpackage_array = data["foodpackage_array"];
+
+		for (rapidjson::SizeType i = 0; i < foodpackage_array.Size(); ++i)
+		{
+
+			rapidjson::Value& cur_foodpackage = foodpackage_array[i];
+
+			CZhengcanOrderItemPrint itemPrint;
+
+			std::string taocan_name = cur_foodpackage["food_name"].GetString();
+
+			itemPrint.m_quantity = cur_foodpackage["quantity"].GetString();
+			itemPrint.m_item_price = cur_foodpackage["single_price"].GetString();
+			itemPrint.m_type_id = cur_foodpackage["type_id"].GetString();
+
+			itemPrint.is_taocan = true;
+
+			taocan_name += CLewaimaiString::UnicodeToUTF8(L"【");
+
+			//接着保存套餐的item
+			rapidjson::Value& food_item = cur_foodpackage["food_item"];
+			for (rapidjson::SizeType j = 0; j < food_item.Size(); ++j)
+			{
+				CZhengcanOrderItemPrint foodpackageitemPrint;
+				foodpackageitemPrint.m_food_name = food_item[j]["food_name"].GetString();
+				foodpackageitemPrint.m_quantity = food_item[j]["quantity"].GetString();
+				foodpackageitemPrint.m_item_price = food_item[j]["single_price"].GetString();
+				foodpackageitemPrint.m_type_id = food_item[j]["type_id"].GetString();
+
+				foodpackageitemPrint.is_taocan = false;
+				foodpackageitemPrint.is_taocan_item = true;
+
+				m_items_print.push_back(foodpackageitemPrint);
+
+				taocan_name += foodpackageitemPrint.m_food_name;
+
+				if (j < food_item.Size() - 1)
+				{
+					taocan_name += CLewaimaiString::UnicodeToUTF8(L"、");
+				}
+			}
+
+			taocan_name += CLewaimaiString::UnicodeToUTF8(L"】");
+
+			itemPrint.m_food_name = taocan_name;
+
+			m_items_print.push_back(itemPrint);
+		}
+	}
+
+	return true;
+}
+
+bool CZhengcanOrder::Refund(std::string order_id)
+{
+	std::string url = "/diancan/refund";
+
+	//请求外卖的未处理订单
+	std::map<string, string> params;
+	params["id"] = order_id;
+	std::string response;
+
+	CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		LOG_INFO("parse response error!");
+		return false;
+	}
+
+	if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+	{
+		LOG_INFO("json error!");
+		return false;
+	}
+
+	rapidjson::Value& v_errcode = document["errcode"];
+	int errcode = v_errcode.GetInt();
+	if (errcode != 0)
+	{
+		LOG_INFO("response failed! message:" << document["errmsg"].GetString());
+		return false;
+	}
+
+	return true;
+}

+ 164 - 0
zhipuzi_pos_windows/zhipuzi/CZhengcanOrder.h

@@ -0,0 +1,164 @@
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "../control/CDiandanNatureItemUI.h"
+
+#include "../zhipuzi/CFood.h"
+#include "../zhipuzi/CFoodpackage.h"
+
+#include "CZhengcanOrderItem.h"
+
+class CZhengcanOrderItemPrint
+{
+public:
+	std::string m_food_name; //这个是完整展示的名字
+	std::string m_quantity;
+	std::string m_item_price; //注意这个是单价,不是总价
+	std::string m_type_id;
+
+	//表示这个Item是否是套餐的名字
+	bool is_taocan = false;
+
+	//表示这个是否是套餐下面的商品详情,主要用于厨房打印的时候,一个套餐下面的每个商品都会生成一个CZhengcanOrderItemPrint对象
+	bool is_taocan_item = false;
+};
+
+/**
+ * 点单里面的一个“订单”,每个选中的商品被加入订单,通过订单数据来计算价格,渲染界面,提交订单也是通过这个数据来提交
+ * 挂单、取单操作的也是订单
+ */
+class CZhengcanOrder
+{
+public:
+	std::vector<CZhengcanOrderItem> m_items;
+
+	//这个是不包含其他费用的纯商品原价
+	std::string m_total_price_show;
+
+	std::string m_guadan_time;
+
+	//订单的整单备注
+	std::string m_memo;
+
+	/******  下面这些是专门用于打印的参数,不作为其他用途,点单逻辑中用不到,点单成功后赋值用于打印而已  ***********/
+	std::string shopname;
+	std::string take_food_code;
+	std::string show_trade_no;
+
+	//会员余额和会员卡号,仅会员支付时有用
+	std::string balance;
+	std::string member_number;
+
+	std::string m_renshu;
+
+	//微信支付 会员支付 现金支付 福利卡支付 自定义支付
+	std::string shoukuan_type;
+
+	int order_from; //1 收银机下单 2 商家app下单 3 扫码下单
+	std::string init_time;
+
+	//各种优惠
+	std::string m_shangpinquan_youhui;
+	std::string m_cika_youhui;
+	std::string m_total_member_youhui;
+	std::string m_zhekou_youhui;
+	std::string m_member_zhekou_youhui;
+	std::string m_quanyika_youhui;
+	std::string m_manjian_youhui;
+	std::string m_youhuiquan_youhui;
+	std::string m_rengong_youhui;
+	std::string m_moling_youhui;
+
+	//加价金额
+	std::string m_jiajia;
+
+	std::string m_shishou_value;
+	std::string m_zhaoling_value;
+
+	//折扣值(1-100)
+	std::string m_zhekou_value;
+
+	//实际最终总价
+	std::string m_dabao_money;
+	std::string m_total_price;
+
+	std::string m_canpai;
+
+	std::vector<CZhengcanOrderItemPrint> m_items_print;
+
+	//下面是从订单接口从服务端获取的参数,暂时存在这里
+	std::string m_order_id;
+	std::string is_refund;
+	std::string refund_time;
+	std::string is_guazhang;
+	std::string guazhang;
+
+public:
+	//刷新点单相关的参数,比如一个订单收银成功后准备开始收银下一个订单时,清空之前的信息
+	void RefreshDiandanInfo();
+
+	int getItemNum();
+
+	std::string getTotalPriceShow();
+
+	double getTotalPrice();
+
+	CZhengcanOrderItem getDiandanOrderItem(int index);
+
+	//这个函数的逻辑是选择一个新商品的时候,与已有商品进行对比,看看是加一个新的商品,还是对已有商品增加数量
+	//返回值是表示新加的item,在第几个元素,方便刷新显示
+	int AddItem(CZhengcanOrderItem newitem, bool& is_add_new);
+
+	void UpdateItemGuige(int index, std::vector<FoodNatureSelectValue>& natureSelectedArray);
+
+	//给某一项添加一个数量
+	void AddNum(int index);
+
+	//给某一项减少一个数量,返回值为true表示商品本删掉了,也就是为0份;如果为false表示没被删掉
+	bool DelNum(int index);
+
+	//删除某一项
+	void Remove(int index);
+
+	//更新了某项的规格,那么重新刷新显示和价格
+	void UpdateGuigePrice(int index);
+
+	//打包
+	void SetDabao(int index);
+
+	//清空商品
+	void Clear();
+
+	void SetMemo(std::string memo);
+
+	std::string GetMemo();
+
+	//判断某个商品券是否能使用,如果可以返回true,如果不行返回false,youhui_value是对应的商品券优惠金额
+	bool UseShangpinquan(std::string shangpinquan_food_id, double& youhui_value);
+
+	//判断某个次卡是否能使用,如果可以返回true,如果不行返回false,youhui_value是对应的商品券优惠金额
+	//is_shangpinquan_dikou 同一个商品,是否被商品券抵扣过了,用于商品券和次卡抵扣同一个商品时候的处理
+	bool UseCikaDikou(std::string cika_food_id, double& youhui_value, bool is_shangpinquan_dikou);
+
+	//计算所有商品的总的会员优惠金额
+	double getTotalMemberYouhui(std::string member_level);
+
+	//计算所有商品的总的打包费
+	double getDabaoMoney();
+
+	//获取点单相关的参数(仅用于非套餐)
+	std::string getDiandanFoodlistParam();
+
+	//获取点单相关的套餐参数(仅用于套餐)
+	std::string getDiandanTaocanParam();
+
+	/****************************下面这里开始,用于与服务器交互的函数*/
+
+	//根据订单ID,从服务器获取订单的数据,主要用于打印和展示订单详情
+	bool InitData(std::string order_id);
+
+	//根据订单ID,进行退款操作
+	bool Refund(std::string order_id);
+};

+ 74 - 0
zhipuzi_pos_windows/zhipuzi/CZhengcanOrderItem.cpp

@@ -0,0 +1,74 @@
+#include "../pch/pch.h"
+#include "CZhengcanOrderItem.h"
+
+#include "../tool/CSqlite3.h"
+
+bool CZhengcanOrderItem::operator==(CZhengcanOrderItem& t)
+{
+	if (this->m_is_taocan != t.m_is_taocan)
+	{
+		return false;
+	}
+
+	if (this->is_dabao != t.is_dabao)
+	{
+		return false;
+	}
+
+	if (this->m_is_taocan == true)
+	{
+		if (this->foodpackage_id != t.foodpackage_id)
+		{
+			return false;
+		}
+
+		int i = 0;
+		for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
+		{
+			if ((*it).nature_name != t.natureSelectedArray[i].nature_name)
+			{
+				return false;
+			}
+
+			if ((*it).nature_select_index != t.natureSelectedArray[i].nature_select_index)
+			{
+				return false;
+			}
+
+			i++;
+		}
+	}
+	else
+	{
+		if (this->food_id != t.food_id)
+		{
+			return false;
+		}
+
+		if (this->is_nature != t.is_nature)
+		{
+			return false;
+		}
+
+		if (this->is_nature == true)
+		{
+			int i = 0;
+			for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
+			{
+				if ((*it).nature_name != t.natureSelectedArray[i].nature_name)
+				{
+					return false;
+				}
+
+				if ((*it).nature_select_index != t.natureSelectedArray[i].nature_select_index)
+				{
+					return false;
+				}
+
+				i++;
+			}
+		}
+	}
+
+	return true;
+}

+ 17 - 0
zhipuzi_pos_windows/zhipuzi/CZhengcanOrderItem.h

@@ -0,0 +1,17 @@
+#pragma once
+
+#include "../zhipuzi/CFood.h"
+#include "../zhipuzi/CFoodpackage.h"
+
+#include "../control/CDiandanNatureItemUI.h"
+
+#include "CDiandanOrderItem.h"
+
+/**
+ * ¶©µ¥ÖеÄÒ»¸öÉÌÆ·
+ */
+class CZhengcanOrderItem : public CDiandanOrderItem
+{
+public:
+	bool operator==(CZhengcanOrderItem& t);
+};

+ 6 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -231,6 +231,9 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
   <ItemGroup>
     <ClInclude Include="control\CTabletypeOptionUI.h" />
     <ClInclude Include="control\CZhengcanTableItemUI.h" />
+    <ClInclude Include="zhipuzi\CZhengcanOrderItem.h" />
+    <ClInclude Include="zhipuzi\CZhengcanOrder.h" />
+    <ClInclude Include="page\CZhengcanDiandanPageUI.h" />
     <ClInclude Include="wnd\CZhengcanKaitaiWnd.h" />
     <ClInclude Include="wnd\CFupingWnd.h" />
     <ClInclude Include="tool\CShuangpingTool.h" />
@@ -333,6 +336,9 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
   <ItemGroup>
     <ClCompile Include="control\CTabletypeOptionUI.cpp" />
     <ClCompile Include="control\CZhengcanTableItemUI.cpp" />
+    <ClCompile Include="zhipuzi\CZhengcanOrderItem.cpp" />
+    <ClCompile Include="zhipuzi\CZhengcanOrder.cpp" />
+    <ClCompile Include="page\CZhengcanDiandanPageUI.cpp" />
     <ClCompile Include="wnd\CZhengcanKaitaiWnd.cpp" />
     <ClCompile Include="wnd\CFupingWnd.cpp" />
     <ClCompile Include="tool\CShuangpingTool.cpp" />

+ 18 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -315,6 +315,15 @@
     <ClInclude Include="wnd\CZhengcanKaitaiWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="page\CZhengcanDiandanPageUI.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="zhipuzi\CZhengcanOrder.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="zhipuzi\CZhengcanOrderItem.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -590,6 +599,15 @@
     <ClCompile Include="wnd\CZhengcanKaitaiWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="page\CZhengcanDiandanPageUI.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="zhipuzi\CZhengcanOrder.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="zhipuzi\CZhengcanOrderItem.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">