张洋 2 months ago
parent
commit
2e1f204a97

BIN
bin/Win32/Debug/zhipuzi_pos_windows/DuiLib_d.dll


+ 2 - 8
bin/Win32/Debug/zhipuzi_pos_windows/skin/aixuexi_page.xml

@@ -1,11 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Window>
-	<Font id="0" name="微软雅黑" size="24" />
-	<Font id="aixuexi_1" name="微软雅黑" size="28" />
-	<Font id="2" name="微软雅黑" size="16" />
-	<Font id="3" name="微软雅黑" size="14" />
-    <Font id="4" name="微软雅黑" size="12" />
-
 	<AIxuexiPage>
 		<VerticalLayout name="page_layout">		
 			<HorizontalLayout height="60" bkcolor="#FFFFFFFF">
@@ -19,9 +13,9 @@
 				<Control width="1" bkcolor="#FFD1D1D1"></Control>
 				
 				<VerticalLayout name="aixuexi_page_paishe_layout" width="420" padding="0,0,0,0" bordercorner="10,10" bkcolor="#FFFFFFFF" autocalcwidth="true">
-					<Label name="aixuexi_page_xuanzhong_food_name" text="当前选中商品:无" height="22" padding="10,10,10,10" textcolor="#FFFF0000" font="aixuexi_1"></Label>
+					<Label name="aixuexi_page_xuanzhong_food_name" text="当前选中商品:无" height="26" padding="10,10,10,10" textcolor="#FFFF0000" font="22"></Label>
 
-					<Label name="aixuexi_page_xuanzhong_food_name" wordbreak="true" height="40" padding="10,0,10,10" font="3" text="智铺子AI识别无需学习默认就能识别几百种常见的水果蔬菜,只需要对未正常识别的冷门商品或非水果蔬菜类商品进行学习。"></Label>
+					<Label name="aixuexi_page_xuanzhong_food_name" wordbreak="true" height="40" padding="10,0,10,10" font="14" text="智铺子AI识别无需学习默认就能识别几百种常见的水果蔬菜,只需要对未正常识别的冷门商品或非水果蔬菜类商品进行学习。"></Label>
 
 					<Control name="image" width="400" height="300" padding="10,0,10,0"></Control>
 

+ 215 - 5
bin/Win32/Debug/zhipuzi_pos_windows/skin/saomashouyin_page.xml

@@ -1,15 +1,225 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Window>
+	<Font id="140" name="微软雅黑" size="40" bold="true" />
+
 	<SaomashouyinPage>
 		<HorizontalLayout>
 			<Control width="1" bkcolor="#FFD1D1D1"></Control>
+
+			<HorizontalLayout width="490" bkcolor="#FFFFFFFF">					
+				<VerticalLayout width="490" padding="0,0,0,0">
+					<Control height="1" bkcolor="#FFEBE8E8"></Control>
+
+					<HorizontalLayout name="btn_saomashouyin_qingkong" height="60">
+						<Control bkimage="member_login.png" width="32" height="32" padding="10,14,0,0"></Control>
+						
+						<Button name="btn_saomashouyin_member_login" align="left" text="会员登录" height="38" width="135" padding="10,12,10,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+						
+						<VerticalLayout name="saomashouyin_page_member_info" width="135" padding="10,5,10,5" visible="false">
+							<Label name="saomashouyin_page_member_name" height="20" padding="0,0,0,0"></Label>
+							<HorizontalLayout padding="0,5,0,0">
+								<Button name="saomashouyin_page_member_info_btn" text="信息" font="14" height="20" width="40" padding="0,0,10,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+								
+								<Button name="saomashouyin_page_member_out_btn" text="退出" textcolor="#FFFF4500" font="14" height="20" width="40" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFFF4500" bkcolor="#FFFFFFFF"></Button>
+							</HorizontalLayout>
+						</VerticalLayout>							
+						
+						<Control></Control>
+						<Control width="100"></Control>
+						<Control bkimage="order_delete.png" width="20" height="20" padding="0,20,0,0"></Control>
+						<Button name="btn_saomashouyin_qingkong" text="清空" height="38" width="40" padding="0,10,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="saomashouyin_page_label_zhengdanbeizhu" text="整单备注:" height="30" padding="10,10,10,10" textcolor="#FF8D8D8D"></Label>
+					</HorizontalLayout>
+											
+					<List name="list_saomashouyin_cart" padding="0,0,0,0" itemlinecolor="#FF000000" itemvalign="vcenter" vscrollbar="true">
+						<ListHeader inset="10,0,0,0" height="42">
+							<ListHeaderItem text="商品" width="220" align="left" />
+							<ListHeaderItem text="数量" width="80" align="center" />
+							<ListHeaderItem text="金额" width="80" align="center" />
+						</ListHeader>
+					</List>
+					
+					<HorizontalLayout name="saomashouyin_page_youhui_tishi_layout" height="40" bkcolor="#FFFBEEEE" visible="false">
+						<Label name="saomashouyin_page_youhui_tishi" text="已优惠10元" textcolor="#FFFF3838" padding="15,0,0,0" width="270" hegiht="40"></Label>
+						<Button name="btn_saomashouyin_chakanyouhui" text="查看优惠>" height="30" width="80" padding="5,6,25,0" textcolor="#FF3CB371" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+					</HorizontalLayout>
+
+					<Control height="1" bkcolor="#FFEBE8E8"></Control>
 			
-			<VerticalLayout name="shangpin_food_layout">
-				<Control></Control>
-				<Label text="扫码收银功能暂未上线,敬请期待" align="center" font="20" padding="0,0,0,0"></Label>
-				<Control></Control>
-			</VerticalLayout>
+					<VerticalLayout height="145" bkcolor="#FFFFFFFF">
+						<HorizontalLayout height="50">
+							<Label name="saomashouyin_page_otherprice" text="" width="200" align="left" padding="15,14,0,0"></Label>
+							<Label name="saomashouyin_page_totalprice" text="总价:¥0.00" font="20" textcolor="#FFFF4444" width="150" align="right" padding="0,0,15,0"></Label>
+						</HorizontalLayout>
+
+						<HorizontalLayout height="50">
+							<Button name="btn_saomashouyin_cundan" width="90" height="40" padding="10,10,10,0" text="存单" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
+							<Button name="btn_saomashouyin_qudan" width="90" height="40" padding="10,10,10,0" text="取单" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
+						
+							<Label name="saomashouyin_page_qudan_num" text="10" mouse="false" width="19" height="19" align="center" float="true" pos="85,325,104,344" textcolor="#FFFFFFFF" bkimage="num_bkg.png" bordercolor="#FFFF0000" bordersize="0"></Label>
+						</HorizontalLayout>
+
+						<HorizontalLayout height="50">
+							<Button name="btn_saomashouyin_zhengdanbeizhu" width="90" height="40" padding="10,10,10,0" text="整单备注" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
+						
+							<Button name="btn_saomashouyin_qianxiang" width="90" height="40" padding="10,10,10,30" text="打开钱箱" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
+						</HorizontalLayout>
+					</VerticalLayout>
+				</VerticalLayout>
 				
+				<Control width="1" bkcolor="#FFEBE8E8"></Control>
+			</HorizontalLayout>
+			
+			<Control width="1" bkcolor="#FFEBE8E8"></Control>
+			
+			<HorizontalLayout name="saomashouyin_jiesuan_layout" bkcolor="#FFFFFFFF">
+				<VerticalLayout name="saomashouyin_jiesuan_youhui_layout" width="330">
+					<HorizontalLayout height="58">
+						<Label text="选择优惠" width="100" height="58" padding="20,0,0,0" font="20"></Label>
+						<Control></Control>
+						<Button name="saomashouyin_jiesuan_yincangyouhui_btn" text="隐藏优惠" height="36" width="90" padding="0,11,10,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+					</HorizontalLayout>					
+					
+					<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="saomashouyin_jiesuan_zhekou_value" text="" height="48" width="160" 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="saomashouyin_jiesuan_jiajia_value" text="" height="48" width="160" 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="saomashouyin_jiesuan_youhui_value" text="" height="48" width="160" 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="saomashouyin_jiesuan_youhuiquan_status" text="未使用" width="70" height="48" padding="0,0,0,0"></Label>
+						<Button name="saomashouyin_jiesuan_youhuiquan_btn" text="扫码使用" height="35" width="90" padding="0,6,0,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+						<Button name="saomashouyin_jiesuan_youhuiquan_btn_cancel" visible="false" text="取消使用" height="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="saomashouyin_jiesuan_shangpinquan_status" text="未使用" width="70" height="48" padding="0,0,0,0"></Label>
+						<Button name="saomashouyin_jiesuan_shangpinquan_btn" text="扫码使用" height="35" width="90" padding="0,6,0,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+						<Button name="saomashouyin_jiesuan_shangpinquan_btn_cancel" visible="false" text="取消使用" height="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="saomashouyin_jiesuan_cika_status" text="未使用" width="70" height="48" padding="0,0,0,0"></Label>
+						<Button name="saomashouyin_jiesuan_cika_btn" text="扫码使用" height="35" width="90" padding="0,6,0,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+						<Button name="saomashouyin_jiesuan_cika_btn_cancel" visible="false" text="取消使用" height="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="saomashouyin_jiesuan_quanyika_status" text="未使用" width="70" height="48" padding="0,0,0,0"></Label>
+						<Button name="saomashouyin_jiesuan_quanyika_btn" text="扫码使用" height="35" width="90" padding="0,6,0,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+						<Button name="saomashouyin_jiesuan_quanyika_btn_cancel" visible="false" text="取消使用" height="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="saomashouyin_jiesuan_moling_bumoling" group="saomashouyin_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="saomashouyin_jiesuan_moling_molingdaojiao" group="saomashouyin_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="saomashouyin_jiesuan_moling_molingdaoyuan" group="saomashouyin_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 name="saomashouyin_jiesuan_youhui_line" width="1" bkcolor="#FFEBE8E8"></Control>
+				
+				<VerticalLayout name="saomashouyin_page_jiesuan_zhangdan_layout" vscrollbar="true">
+					<HorizontalLayout height="58">
+						<Label text="账单明细" height="58" padding="20,0,0,0" font="20"></Label>
+						<Control></Control>
+						<Button name="saomashouyin_jiesuan_xianshiyouhui_btn" text="显示优惠" height="36" width="90" padding="0,11,10,0" textcolor="#FF41A846" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FF41A846" bkcolor="#FFFFFFFF"></Button>
+					</HorizontalLayout>	
+					
+					<Control height="1" bkcolor="#FFEBE8E8" padding="10,0,10,0"></Control>
+					
+					<VerticalLayout name="saomashouyin_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="saomashouyin_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="saomashouyin_jiesuan_zhifufangshi_layout">
+						<HorizontalLayout name="saomashouyin_jiesuan_zhifufangshi_weixinzhifu" width="120" hegiht="80" float="true">
+							<Button name="saomashouyin_jiesuan_zhifufangshi_weixinzhifu_btn" text="" height="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="微信支付/支付宝/云闪付" wordbreak="true" width="115" height="40" font="14" float="true" pos="2,35,117,75" textcolor="#FFFFFFFF" mouse="false"></Label>
+						</HorizontalLayout>
+						
+						<HorizontalLayout name="saomashouyin_jiesuan_zhifufangshi_huiyuan" width="120" hegiht="80" float="true">
+							<Button name="saomashouyin_jiesuan_zhifufangshi_huiyuan_btn" text="" height="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="saomashouyin_jiesuan_zhifufangshi_xianjin" width="120" hegiht="80" float="true">
+							<Button name="saomashouyin_jiesuan_zhifufangshi_xianjin_btn" text="" height="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="saomashouyin_jiesuan_zhifufangshi_gouwuka" width="122" hegiht="80" float="true">
+							<Button name="saomashouyin_jiesuan_zhifufangshi_gouwuka_btn" text="" height="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="saomashouyin_jiesuan_zhifufangshi_meishicheng" width="122" hegiht="80" float="true">
+							<Button name="saomashouyin_jiesuan_zhifufangshi_meishicheng_btn" text="" height="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="saomashouyin_jiesuan_zhifufangshi_fulika" width="122" hegiht="80" float="true">
+							<Button name="saomashouyin_jiesuan_zhifufangshi_fulika_btn" text="" height="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>
 	</SaomashouyinPage>
 </Window>

BIN
dll/debug/DuiLib_d.dll


BIN
temp/link/Win32/Debug/DuiLib/DuiLib_d.pdb


+ 1 - 0
zhipuzi_pos_windows/page/CDiandanPageUI.cpp

@@ -2316,6 +2316,7 @@ void CDiandanPageUI::ClickQudan()
 
 		pQudanDlg->SetGuadanOrders(m_guadan_orders);
 		pQudanDlg->SetPageUI(this);
+		pQudanDlg->SetPageType(0);
 
 		pQudanDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
 		pQudanDlg->SetIcon(IDI_ICON_DUILIB);

+ 3220 - 4
zhipuzi_pos_windows/page/CSaomashouyinPageUI.cpp

@@ -2,9 +2,33 @@
 #include "CSaomashouyinPageUI.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/CSaomaYouhuiquanWnd.h"
+#include "../wnd/CSaomaShangpinquanWnd.h"
+#include "../wnd/CSaomaCikaWnd.h"
+#include "../wnd/CSaomaQuanyikaWnd.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 "../wnd/CNumInputWnd.h"
+#include "../wnd/CHuiyuanInfoShowWnd.h"
+
+#include "../print/CPosPrinter.h"
+
+#include "../tool/CShuangpingTool.h"
+
+#include "../worker/CChengzhongWorker.h"
+#include "../worker/CDiandanAIShibieWorker.h"
+
 CSaomashouyinPageUI::CSaomashouyinPageUI()
 {
 }
@@ -22,7 +46,317 @@ void CSaomashouyinPageUI::InitControl()
 //初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
 void CSaomashouyinPageUI::InitShow()
 {
+	//初始化结算页面相关的展示,把所有活动清零
+	this->InitJiesuanShow();
+
+	//计算所有活动优惠,并且调整所有与价格相关的展示
+	this->UpdateJiesuanInfo();
+
+	if (m_is_zidingyizhifu_init == false)
+	{
+		//初始化结算页面的支付方式
+		this->InitJiesuanZhifu();
+
+		m_is_zidingyizhifu_init = true;
+	}
+}
+
+void CSaomashouyinPageUI::RefreshShow()
+{
+	//清空当前订单的信息
+	m_cur_diandan_order.RefreshDiandanInfo();
+
+
+	//初始化结算页面相关的展示,把所有活动清零
+	this->InitJiesuanShow();
+
+	//渲染左侧购物车(包含了调用UpdateJiesuanInfo重新计算价格)
+	this->UpdateShopcartShow();
+}
+
+//仅仅初始化结算相关的显示(比如折扣、优惠、价格等)
+void CSaomashouyinPageUI::InitJiesuanShow()
+{
+	//先清空会员登录状态
+	this->ClickMemberLogout();
+
+	m_is_member_zhekou = false;
+	m_member_zhekou_value = 10;
+
+	//整单备注
+	CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_label_zhengdanbeizhu")));
+	pLabel->SetText(L"整单备注:");
+
+	//再初始化取单数量
+	RefreshGuadanNum();
+
+	//先初始化折扣值
+	CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_zhekou_value")));
+	pZhekouEdit->SetText(L"100");
+
+	//再初始化加价
+	m_jiajia = 0;
+	CEditUI* pJiajiaEdit = static_cast<CEditUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_jiajia_value")));
+	pJiajiaEdit->SetText(L"0");
+
+	//初始化优惠
+	m_rengong_youhui = 0;
+	CEditUI* pYouhuiEdit = static_cast<CEditUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_youhui_value")));
+	pYouhuiEdit->SetText(L"0");
+
+	//优惠券
+	m_is_youhuiquan = false;
+	CLabelUI* pYouhuiquanEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_youhuiquan_status")));
+	pYouhuiquanEdit->SetText(L"未使用");
+
+	CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_youhuiquan_btn_cancel")));
+	pYouhuiquanCancel->SetVisible(false);
+
+	//商品券
+	m_is_shangpinquan = false;
+	CLabelUI* pShangpinEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_shangpinquan_status")));
+	pShangpinEdit->SetText(L"未使用");
+
+	CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_shangpinquan_btn_cancel")));
+	pShangpinquanCancel->SetVisible(false);
+
+	//次卡
+	m_is_cika = false;
+	CLabelUI* pCikaEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_cika_status")));
+	pCikaEdit->SetText(L"未使用");
+
+	CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_cika_btn_cancel")));
+	pCikaCancel->SetVisible(false);
+
+	//权益卡
+	m_is_quanyika = false;
+	CLabelUI* pQuanyikaEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_quanyika_status")));
+	pQuanyikaEdit->SetText(L"未使用");
+
+	CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_quanyika_btn_cancel")));
+	pQuanyikaCancel->SetVisible(false);
+
+	//抹零
+	std::string diandan_moling_type = CSetting::GetInstance()->GetParam("saomashouyin_moling_type");
+	m_moling_type = atoi(diandan_moling_type.c_str());
+
+	if (m_moling_type == 0)
+	{
+		CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_moling_bumoling")));
+		pMolingCheck->Selected(true, false);
+	}
+	else if (m_moling_type == 1)
+	{
+		CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_moling_molingdaojiao")));
+		pMolingCheck->Selected(true, false);
+	}
+	else if (m_moling_type == 2)
+	{
+		CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_moling_molingdaoyuan")));
+		pMolingCheck->Selected(true, false);
+	}
+}
+
+void CSaomashouyinPageUI::InitJiesuanZhifu()
+{
+	CHorizontalLayoutUI* pZhifufangshiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_zhifufangshi_layout")));
+
+	int num = 0;
+
+	CHorizontalLayoutUI* pWeixinLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("saomashouyin_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("saomashouyin_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("saomashouyin_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("saomashouyin_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("saomashouyin_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("saomashouyin_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"saomashouyin_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 CSaomashouyinPageUI::UpdateJiesuanZhifuPos()
+{
+	//添加支付方式
+	int nWidth = m_nPageWidth;
+	if (nWidth == 0)
+	{
+		return;
+	}
+
+	int nZhangdanWidth;
+	if (m_is_yincangyouhui == true)
+	{
+		nZhangdanWidth = nWidth - 491 - 5;
+	}
+	else
+	{
+		nZhangdanWidth = nWidth - 491 - 331 - 5;
+	}
+
+	if (nZhangdanWidth < 300)
+	{
+		nZhangdanWidth = 300;
+	}
+	CVerticalLayoutUI* pZhangdanLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(L"saomashouyin_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("saomashouyin_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;
+
+		// 强制设置固定大小和位置
+		SIZE size;
+		size.cx = rect.left;
+		size.cy = rect.top;
+		curItem->SetFixedXY(size);
+
+		curItem->SetFixedWidth(rect.right - rect.left);
+		curItem->SetFixedHeight(rect.bottom - rect.top);
+
+		num++;
+	}
+
+	//调整区域高度
+	int lastRow = (num - 1) / nMeihangNum + 1;
+	pZhifufangshiLayout->SetFixedHeight(lastRow * 105);
+}
+
+//只是刷新取单数量
+void CSaomashouyinPageUI::RefreshGuadanNum()
+{
+	size_t guadan_num = m_guadan_orders.size();
+	CLabelUI* pNum = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_qudan_num")));
+	if (guadan_num > 0)
+	{
+		//有挂单的
+		pNum->SetText(std::to_wstring(guadan_num).c_str());
+		pNum->SetVisible(true);
+	}
+	else
+	{
+		//没有挂单的
+		pNum->SetVisible(false);
+	}
 }
 
 //处理按钮点击类事件
@@ -30,6 +364,177 @@ void CSaomashouyinPageUI::HandleClickMsg(TNotifyUI& msg)
 {
 	CDuiString name = msg.pSender->GetName();
 
+	if (name == L"btn_saomashouyin_jia")
+	{
+		this->ClickAdd();
+	}
+	else if (name == L"btn_saomashouyin_jian")
+	{
+		this->ClickDel();
+	}
+	else if (name == L"btn_saomashouyin_shanchu")
+	{
+		this->ClickRemove();
+	}
+	else if (name == L"btn_saomashouyin_guige")
+	{
+		this->ClickGuige();
+	}
+	else if (name == L"btn_saomashouyin_qingkong")
+	{
+		//纯粹用于调试物理键盘
+		//CSystem::ShowKeyboardDeviceNames();
+
+		this->ClickQingkong();
+	}
+	else if (name == L"btn_saomashouyin_zhengdanbeizhu")
+	{
+		this->ClickZhengdanMemo();
+	}
+	else if (name == L"btn_saomashouyin_gengduozhifu_pay")
+	{
+		//点击更多支付
+		this->ClickGengduoPay();
+	}
+	else if (name == L"btn_saomashouyin_jixujiacai")
+	{
+		
+	}
+	else if (name == L"btn_saomashouyin_chakanyouhui")
+	{
+		//点击查看优惠
+		this->ClickChakanYouhui();
+	}
+	else if (name == L"btn_saomashouyin_dabao")
+	{
+		//点击打包
+		this->ClickDabao();
+	}
+	else if (name == L"btn_saomashouyin_member_login")
+	{
+		//点击会员登录
+		this->ClickMemberLogin();
+	}
+	else if (name == L"saomashouyin_jiesuan_zhekou_value")
+	{
+		//点击整单折扣
+		this->ClickZhekou();
+	}
+	else if (name == L"saomashouyin_jiesuan_jiajia_value")
+	{
+		//点击加价
+		this->ClickJiajia();
+	}
+	else if (name == L"saomashouyin_jiesuan_youhui_value")
+	{
+		//点击人工优惠
+		this->ClickRengongyouhui();
+	}
+	else if (name == L"saomashouyin_jiesuan_youhuiquan_btn")
+	{
+		//点击扫码优惠券
+		this->ClickSaomaYouhuiquan();
+	}
+	else if (name == L"saomashouyin_jiesuan_shangpinquan_btn")
+	{
+		//点击扫码商品券
+		this->ClickSaomaShangpinquan();
+	}
+	else if (name == L"saomashouyin_jiesuan_cika_btn")
+	{
+		//点击扫码次卡
+		this->ClickSaomaCika();
+	}
+	else if (name == L"saomashouyin_jiesuan_quanyika_btn")
+	{
+		//点击扫码权益卡
+		this->ClickSaomaQuanyika();
+	}
+	else if (name == L"btn_saomashouyin_weixinzhifu_pay" || name == L"saomashouyin_jiesuan_zhifufangshi_weixinzhifu_btn")
+	{
+		//点击微信支付
+		this->StartWeixinzhifuShoukuan();
+	}
+	else if (name == L"btn_saomashouyin_huiyuanzhifu_pay" || name == L"saomashouyin_jiesuan_zhifufangshi_huiyuan_btn")
+	{
+		//点击会员收款
+		this->StartHuiyuanShoukuan();
+	}
+	else if (name == L"btn_saomashouyin_xianjinzhifu_pay" || name == L"saomashouyin_jiesuan_zhifufangshi_xianjin_btn")
+	{
+		//点击现金收款
+		this->StartXianjinShoukuan();
+	}
+	else if (name == L"saomashouyin_jiesuan_zhifufangshi_fulika_btn")
+	{
+		//福利卡收款
+		this->StartFulikaShoukuan();
+	}
+	else if (name == L"saomashouyin_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"btn_saomashouyin_cundan")
+	{
+		this->ClickCundan();
+	}
+	else if (name == L"btn_saomashouyin_qudan")
+	{
+		this->ClickQudan();
+	}
+	else if (name == L"btn_saomashouyin_qianxiang")
+	{
+		CPosPrinter printer;
+		printer.OpenQianxiang();
+	}
+	else if (name == L"saomashouyin_jiesuan_youhuiquan_btn_cancel")
+	{
+		this->ClickQuxiaoYouhuiquan();
+	}
+	else if (name == L"saomashouyin_jiesuan_shangpinquan_btn_cancel")
+	{
+		this->ClickQuxiaoShangpinquan();
+	}
+	else if (name == L"saomashouyin_jiesuan_quanyika_btn_cancel")
+	{
+		this->ClickQuxiaoQuanyika();
+	}
+	else if (name == L"saomashouyin_jiesuan_cika_btn_cancel")
+	{
+		this->ClickQuxiaoCika();
+	}
+	else if (name == L"saomashouyin_jiesuan_yincangyouhui_btn")
+	{
+		this->YincangYouhui();
+	}
+	else if (name == L"saomashouyin_jiesuan_xianshiyouhui_btn")
+	{
+		this->XianshiYouhui();
+	}
+	else if (name == L"saomashouyin_page_member_out_btn")
+	{
+		this->ClickMemberLogout();
+	}
+	else if (name == L"saomashouyin_page_member_info_btn")
+	{
+		this->ClickMemberInfoShow();
+	}
+	else if (name == L"saomashouyin_page_aixuexi_btn")
+	{
+		this->ClickAixuexi();
+	}
+	else if (name == L"saomashouyin_page_chengzhong_zhiling")
+	{
+		this->ZhiLing();
+	}
+	else if (name == L"saomashouyin_page_chengzhong_qupi")
+	{
+		this->Qupi();
+	}
 }
 
 //处理option切换事件
@@ -40,6 +545,33 @@ void CSaomashouyinPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
 	COptionUI* curOption = static_cast<COptionUI*>(msg.pSender);
 	std::wstring groupname = curOption->GetGroup();
 
+	if (groupname == L"saomashouyin_jiesuan_moling")
+	{
+		if (name == _T("saomashouyin_jiesuan_moling_bumoling"))
+		{
+			m_moling_type = 0;
+
+			CSetting::GetInstance()->SetParam("saomashouyin_moling_type", "0");
+
+			UpdateJiesuanInfo();
+		}
+		else if (name == _T("saomashouyin_jiesuan_moling_molingdaojiao"))
+		{
+			m_moling_type = 1;
+
+			CSetting::GetInstance()->SetParam("saomashouyin_moling_type", "1");
+
+			UpdateJiesuanInfo();
+		}
+		else if (name == _T("saomashouyin_jiesuan_moling_molingdaoyuan"))
+		{
+			m_moling_type = 2;
+
+			CSetting::GetInstance()->SetParam("saomashouyin_moling_type", "2");
+
+			UpdateJiesuanInfo();
+		}
+	}
 }
 
 //处理下拉框、radio的切换事件
@@ -52,17 +584,2701 @@ void CSaomashouyinPageUI::HandleItemSelectMsg(TNotifyUI& msg)
 void CSaomashouyinPageUI::HandleTextChangedMsg(TNotifyUI& msg)
 {
 	CDuiString name = msg.pSender->GetName();
+
+	
 }
 
 //处理扫码枪捕捉到的扫码信息
 void CSaomashouyinPageUI::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 CSaomashouyinPageUI::SetPos(RECT rc, bool bNeedInvalidate)
+bool CSaomashouyinPageUI::HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-	m_nPageWidth = rc.right - rc.left;
+	if (uMsg == WM_MYHOTKEY_WEIXIN_SHOUKUAN)
+	{
+		StartWeixinzhifuShoukuan();
 
-	CContainerUI::SetPos(rc, bNeedInvalidate);
+		return true;
+	}
+	else if (uMsg == WM_MYHOTKEY_HUIYUAN_DENGLU)
+	{
+		ClickMemberLogin();
+
+		return true;
+	}
+	else if (uMsg == WM_MYHOTKEY_HUIYUAN_SHOUKUAN)
+	{
+		StartHuiyuanShoukuan();
+
+		return true;
+	}
+	else if (uMsg == WM_MYHOTKEY_XIANJIN_SHOUKUAN)
+	{
+		StartXianjinShoukuan();
+
+		return true;
+	}
+	else if (uMsg == WM_AI_RECOGNITION_SUCCESS)
+	{
+		HandleDiandanAIShibieResult();
+
+		return true;
+	}
+	else if (uMsg == WM_CHENGZHONG_SUCCESS)
+	{
+		HandleChengzhongValueChange();
+
+		return true;
+	}
+
+	return false;
+}
+
+void CSaomashouyinPageUI::UpdateShopcartShow(bool is_add_new)
+{
+	//先保留选中
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+	int nIndex = pList->GetCurSel();
+
+	//保留滚动条位置
+	SIZE ScrollPos = pList->GetScrollPos();
+
+	//先清空
+	pList->RemoveAll();
+
+	int nItemNum = m_cur_diandan_order.getItemNum();
+	for (int i = 0; i < nItemNum; i++)
+	{
+		CDiandanOrderItem item = m_cur_diandan_order.getDiandanOrderItem(i);
+
+		CDialogBuilder builder;
+		CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("saomashouyin_cart_item.xml"), (UINT)0, NULL, m_pManager));
+
+		pList->Add(pEle);
+
+		if (item.m_is_taocan)
+		{
+			CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_name")));
+			pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
+
+			CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_num")));
+			pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
+
+			CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_price")));
+			pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
+
+			CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_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("saomashouyin_cart_item_name")));
+			pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
+
+			CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_num")));
+			pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
+
+			CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_price")));
+			pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
+
+			CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_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);
+			}
+		}
+	}
+
+	if (is_add_new == true)
+	{
+		//增加新商品,取消选择
+		pList->SelectItem(-1, false);
+
+		//必须先刷新重绘,再获取range才准
+		pList->NeedUpdate();
+		pList->Invalidate();
+		m_pManager->Invalidate();
+
+		//这个是同步阻塞重绘
+		::UpdateWindow(m_pManager->GetPaintWindow());
+
+		pList->EnsureVisible(nItemNum - 1);
+	}
+	else
+	{
+		//保留选中
+		if (nIndex != -1 && pList->GetCount() > 0)
+		{
+			if (nIndex <= pList->GetCount() - 1)
+			{
+				pList->SelectItem(nIndex, false);
+			}
+			else
+			{
+				pList->SelectItem(pList->GetCount() - 1, false);
+			}
+		}
+
+		//恢复滚动条位置
+		pList->SetScrollPos(ScrollPos);
+	}
+
+	//更新结算信息
+	UpdateJiesuanInfo();
+}
+
+void CSaomashouyinPageUI::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("saomashouyin_jiesuan_zhekou_value")));
+	std::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("saomashouyin_jiesuan_jiajia_value")));
+	std::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("saomashouyin_jiesuan_youhui_value")));
+	std::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("saomashouyin_page_youhui_tishi_layout")));
+	CLabelUI* pYouhuiLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_youhui_tishi")));
+
+	if (total_youhui > 0)
+	{
+		std::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("saomashouyin_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("saomashouyin_page_totalprice")));
+	pTotalPrice->SetText((L"总价:¥" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(cur_price, 2))).c_str());
+
+	//再刷新账单明细展示
+	CVerticalLayoutUI* pmingxiLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("saomashouyin_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("saomashouyin_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 CSaomashouyinPageUI::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->UpdateShopcartShow();
+}
+
+void CSaomashouyinPageUI::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);
+
+	this->UpdateShopcartShow();
+}
+
+void CSaomashouyinPageUI::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->UpdateShopcartShow();
+}
+
+void CSaomashouyinPageUI::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;
+
+				this->UpdateShopcartShow();
+			}
+			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;
+
+				this->UpdateShopcartShow();
+			}
+			else
+			{
+				return;
+			}
+		}
+	}
+}
+
+void CSaomashouyinPageUI::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->UpdateShopcartShow();
+}
+
+void CSaomashouyinPageUI::ClickQingkong()
+{
+	m_cur_diandan_order.Clear();
+
+	this->UpdateShopcartShow();
+}
+
+//点击存单之后的逻辑
+void CSaomashouyinPageUI::ClickCundan()
+{
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		//没有选任何商品
+		return;
+	}
+
+	m_cur_diandan_order.m_guadan_time = CLewaimaiTime::DatetimeToString(time(NULL));
+
+	m_guadan_orders.push_back(m_cur_diandan_order);
+
+	//挂单之后,刷新所有显示
+	RefreshShow();
+}
+
+//点击取单之后的逻辑
+void CSaomashouyinPageUI::ClickQudan()
+{
+	if (m_guadan_orders.size() == 0)
+	{
+		return;
+	}
+
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CGuadanWnd* pQudanDlg = new CGuadanWnd();
+
+	if (pQudanDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pQudanDlg;
+
+		pQudanDlg->SetGuadanOrders(m_guadan_orders);
+		pQudanDlg->SetPageUI(this);
+		pQudanDlg->SetPageType(1);
+
+		pQudanDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pQudanDlg->SetIcon(IDI_ICON_DUILIB);
+		pQudanDlg->CenterWindow();
+
+		pQudanDlg->SetTitle(L"取单");
+
+		UINT ret = pQudanDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//取单成功逻辑处理
+			int nQudanNum = pQudanDlg->m_nQudanNum;
+
+			//先对当前的数据进行清空
+			RefreshShow();
+
+			//然后保存取单的订单
+			m_cur_diandan_order = m_guadan_orders[nQudanNum];
+			m_guadan_orders.erase(m_guadan_orders.begin() + nQudanNum);
+
+			RefreshGuadanNum();
+
+			//然后展示购物车
+			this->UpdateShopcartShow();
+
+			m_is_show_modal_wnd = false;
+			delete pQudanDlg;
+		}
+		else
+		{
+			RefreshGuadanNum();
+
+			m_is_show_modal_wnd = false;
+			delete pQudanDlg;
+
+			return;
+		}
+	}
+}
+
+void CSaomashouyinPageUI::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("saomashouyin_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 CSaomashouyinPageUI::ClickGengduoPay()
+{
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		m_pMainWnd->ShowToast(L"请先选择商品再支付");
+
+		return;
+	}
+}
+
+void CSaomashouyinPageUI::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 CSaomashouyinPageUI::ClickMemberLogin()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	if (m_is_member == true)
+	{
+		m_pMainWnd->ShowToast(L"会员已登录!");
+	}
+
+	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();
+
+		UINT ret = pMemberLoginDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明会员登录成功了
+			m_is_member = true;
+
+			m_member_name = pMemberLoginDlg->m_name;
+			m_member_level = pMemberLoginDlg->m_member_level;
+			m_member_level_name = pMemberLoginDlg->m_member_level_name;
+
+			m_member_id = pMemberLoginDlg->m_member_id;
+			m_card_no = pMemberLoginDlg->m_card_no;
+			m_balance = pMemberLoginDlg->m_balance;
+			m_phone = pMemberLoginDlg->m_phone;
+			m_birthday = pMemberLoginDlg->m_birthday;
+			m_sex = pMemberLoginDlg->m_sex;
+			m_address = pMemberLoginDlg->m_address;
+			m_is_card = pMemberLoginDlg->m_is_card;
+			m_point = pMemberLoginDlg->m_point;
+			m_open_no_card_payment = pMemberLoginDlg->m_open_no_card_payment;
+			m_pay_password = pMemberLoginDlg->m_pay_password;
+			m_freeze = pMemberLoginDlg->m_freeze;
+			m_card_identify = pMemberLoginDlg->m_card_identify;
+
+			CLabelUI* pMemberInfo = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_member_name")));
+			std::wstring memberInfo = L"会员:" + CLewaimaiString::UTF8ToUnicode(m_member_name);
+			pMemberInfo->SetText(memberInfo.c_str());
+
+			CButtonUI* pMemberLoginBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_saomashouyin_member_login")));
+			pMemberLoginBtn->SetVisible(false);
+
+			this->FindSubControl(_T("saomashouyin_page_member_info"))->SetVisible(true);
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pMemberLoginDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pMemberLoginDlg;
+
+			return;
+		}
+	}
+}
+
+//处理会员退出登陆
+void CSaomashouyinPageUI::ClickMemberLogout()
+{
+	m_is_member = false;
+
+	CButtonUI* pMemberLoginBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_saomashouyin_member_login")));
+	pMemberLoginBtn->SetVisible(true);
+
+	this->FindSubControl(_T("saomashouyin_page_member_info"))->SetVisible(false);
+
+	this->UpdateJiesuanInfo();
+}
+
+void CSaomashouyinPageUI::ClickMemberInfoShow()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CHuiyuanInfoShowWnd* pMemberLoginDlg = new CHuiyuanInfoShowWnd();
+
+	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->SetHuiyuanInfo(m_member_name, m_member_level, m_member_level_name, m_card_no, m_balance, m_phone, \
+			m_birthday, m_sex, m_address, m_is_card, m_point, m_open_no_card_payment, m_pay_password, m_freeze, m_card_identify);
+
+		UINT ret = pMemberLoginDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			m_is_show_modal_wnd = false;
+			delete pMemberLoginDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pMemberLoginDlg;
+
+			return;
+		}
+	}
+}
+
+void CSaomashouyinPageUI::ClickZhekou()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CNumInputWnd* pNumDlg = new CNumInputWnd();
+
+	if (pNumDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pNumDlg;
+
+		pNumDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pNumDlg->SetIcon(IDI_ICON_DUILIB);
+		pNumDlg->CenterWindow();
+
+		pNumDlg->SetTitle(L"输入折扣值");
+		pNumDlg->SetAttention(L"请输入折扣值(1到100之间的整数)");
+		pNumDlg->SetRange(1, 100);
+
+		UINT ret = pNumDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明折扣输入了
+			std::string zhekou = pNumDlg->GetNum();
+
+			CButtonUI* pZhekouEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_zhekou_value")));
+			pZhekouEdit->SetText(CLewaimaiString::UTF8ToUnicode(zhekou).c_str());
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pNumDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pNumDlg;
+
+			return;
+		}
+	}
+}
+
+void CSaomashouyinPageUI::ClickJiajia()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CNumInputWnd* pNumDlg = new CNumInputWnd();
+
+	if (pNumDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pNumDlg;
+
+		pNumDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pNumDlg->SetIcon(IDI_ICON_DUILIB);
+		pNumDlg->CenterWindow();
+
+		pNumDlg->SetTitle(L"输入加价金额");
+		pNumDlg->SetAttention(L"请输入加价金额(0到1000之间的整数)");
+		pNumDlg->SetRange(0, 1000);
+
+		UINT ret = pNumDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明加价金额输入了
+			std::string jiajia = pNumDlg->GetNum();
+
+			CButtonUI* pJiajiaEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_jiajia_value")));
+			pJiajiaEdit->SetText(CLewaimaiString::UTF8ToUnicode(jiajia).c_str());
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pNumDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pNumDlg;
+
+			return;
+		}
+	}
+}
+
+void CSaomashouyinPageUI::ClickRengongyouhui()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CNumInputWnd* pNumDlg = new CNumInputWnd();
+
+	if (pNumDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pNumDlg;
+
+		pNumDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pNumDlg->SetIcon(IDI_ICON_DUILIB);
+		pNumDlg->CenterWindow();
+
+		pNumDlg->SetTitle(L"输入优惠金额");
+		pNumDlg->SetAttention(L"请输入优惠金额(0到1000之间的整数)");
+		pNumDlg->SetRange(0, 1000);
+
+		UINT ret = pNumDlg->ShowModal();
+
+		if (ret == IDOK)
+		{
+			//这说明优惠金额输入了
+			std::string youhui = pNumDlg->GetNum();
+
+			CButtonUI* pYouhuiEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_youhui_value")));
+			pYouhuiEdit->SetText(CLewaimaiString::UTF8ToUnicode(youhui).c_str());
+
+			this->UpdateJiesuanInfo();
+
+			m_is_show_modal_wnd = false;
+			delete pNumDlg;
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pNumDlg;
+
+			return;
+		}
+	}
+}
+
+void CSaomashouyinPageUI::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("saomashouyin_jiesuan_youhuiquan_status")));
+			pYouhuiEdit->SetText(L"已使用");
+
+			CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_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 CSaomashouyinPageUI::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("saomashouyin_jiesuan_shangpinquan_status")));
+			pYouhuiEdit->SetText(L"已使用");
+
+			CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_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 CSaomashouyinPageUI::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("saomashouyin_jiesuan_quanyika_status")));
+			pYouhuiEdit->SetText(L"已使用");
+
+			CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_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 CSaomashouyinPageUI::ClickQuxiaoYouhuiquan()
+{
+	m_is_youhuiquan = false;
+
+	CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_youhuiquan_status")));
+	pYouhuiEdit->SetText(L"未使用");
+
+	CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_youhuiquan_btn_cancel")));
+	pYouhuiquanCancel->SetVisible(false);
+}
+
+//点击取消商品券
+void CSaomashouyinPageUI::ClickQuxiaoShangpinquan()
+{
+	m_is_shangpinquan = false;
+
+	CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_shangpinquan_status")));
+	pYouhuiEdit->SetText(L"未使用");
+
+	CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_shangpinquan_btn_cancel")));
+	pShangpinquanCancel->SetVisible(false);
+}
+
+//点击取消权益卡
+void CSaomashouyinPageUI::ClickQuxiaoQuanyika()
+{
+	m_is_quanyika = false;
+
+	CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_quanyika_status")));
+	pYouhuiEdit->SetText(L"未使用");
+
+	CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_quanyika_btn_cancel")));
+	pQuanyikaCancel->SetVisible(false);
+}
+
+//点击取消次卡
+void CSaomashouyinPageUI::ClickQuxiaoCika()
+{
+	m_is_cika = false;
+
+	CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_cika_status")));
+	pYouhuiEdit->SetText(L"未使用");
+
+	CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_cika_btn_cancel")));
+	pCikaCancel->SetVisible(false);
+}
+
+//点击扫码次卡
+void CSaomashouyinPageUI::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("saomashouyin_jiesuan_cika_status")));
+			pYouhuiEdit->SetText(L"已使用");
+
+			CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_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;
+		}
+	}
+}
+
+//获取通用参数,任何支付方式都要用到的参数,个性化参数在弹框里面处理
+//参考文档 http://apidoc.zhipuzi.com/index.php/home/item/show?item_id=4
+std::map<std::string, std::string> CSaomashouyinPageUI::GetSendorderParams()
+{
+	std::map<std::string, std::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"] = "";
+	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("saomashouyin_jiesuan_zhekou_value")));
+	std::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_id"] = m_member_id;
+		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_total_member_youhui > 0)
+	{
+		params["member_delete"] = CLewaimaiString::DoubleToString(m_total_member_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 CSaomashouyinPageUI::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 CSaomashouyinPageUI::StartHuiyuanShoukuan()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	if (m_cur_diandan_order.getItemNum() == 0)
+	{
+		m_pMainWnd->ShowToast(L"请先选择商品再支付");
+
+		return;
+	}
+
+	if (m_is_member == false)
+	{
+		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->SetMemberInfo(m_member_id, m_card_no, m_balance, m_member_name, m_member_level_name);
+
+		//这里要对提交订单的参数进行组装,然后方便请求
+		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 CSaomashouyinPageUI::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 CSaomashouyinPageUI::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 CSaomashouyinPageUI::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 CSaomashouyinPageUI::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 CSaomashouyinPageUI::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;
+	}
+
+	CDiandanOrderItem 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);
+
+	this->UpdateShopcartShow(is_add_new);
+
+	return true;
+}
+
+bool CSaomashouyinPageUI::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(std::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;
+	}
+
+	CDiandanOrderItem 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);
+
+	this->UpdateShopcartShow(is_add_new);
+
+	return true;
+}
+
+void CSaomashouyinPageUI::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);
+
+	//处理打印
+	CDiandanOrder order = this->GetPrintOrderinfo(take_food_code, show_trade_no, shoukuan_type, balance, member_number);
+
+	CPosPrinter printer;
+	printer.PrintDiandanOrder(order);
+
+	//最后才初始化页面信息
+	RefreshShow();
+}
+
+CDiandanOrder CSaomashouyinPageUI::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 = "";
+
+	for (std::vector<CDiandanOrderItem>::iterator it = m_cur_diandan_order.m_items.begin(); it != m_cur_diandan_order.m_items.end(); it++)
+	{
+		CDiandanOrderItemPrint 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->m_nature_selects[0].nature_select_index].GetString();
+
+				//要根据商品ID找出商品的名字
+				CFood foodinfo;
+				CSqlite3 sqlite;
+				bool is_found = sqlite.GetFoodById(food_id, foodinfo);
+				if (!is_found)
+				{
+					continue;
+				}
+
+				CDiandanOrderItemPrint 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 CSaomashouyinPageUI::SetPos(RECT rc, bool bNeedInvalidate)
+{
+	m_nPageWidth = rc.right - rc.left;
+
+	if (m_nPageWidth + 91 < 1260)
+	{
+		//小屏幕上,默认隐藏优惠区域
+		this->YincangYouhui();
+	}
+	else
+	{
+		this->XianshiYouhui();
+	}
+
+	//拖动窗口的时候,更新位置
+	UpdateJiesuanZhifuPos();
+
+	CContainerUI::SetPos(rc, bNeedInvalidate);
+}
+
+//隐藏优惠区域
+void CSaomashouyinPageUI::YincangYouhui()
+{
+	m_is_yincangyouhui = true;
+
+	this->FindSubControl(L"saomashouyin_jiesuan_youhui_layout")->SetVisible(false);
+	this->FindSubControl(L"saomashouyin_jiesuan_youhui_line")->SetVisible(false);
+
+	this->FindSubControl(L"saomashouyin_jiesuan_yincangyouhui_btn")->SetVisible(false);
+	this->FindSubControl(L"saomashouyin_jiesuan_xianshiyouhui_btn")->SetVisible(true);
+
+	UpdateJiesuanZhifuPos();
+}
+
+//显示优惠区域
+void CSaomashouyinPageUI::XianshiYouhui()
+{
+	m_is_yincangyouhui = false;
+
+	this->FindSubControl(L"saomashouyin_jiesuan_youhui_layout")->SetVisible(true);
+	this->FindSubControl(L"saomashouyin_jiesuan_youhui_line")->SetVisible(true);
+
+	this->FindSubControl(L"saomashouyin_jiesuan_yincangyouhui_btn")->SetVisible(true);
+	this->FindSubControl(L"saomashouyin_jiesuan_xianshiyouhui_btn")->SetVisible(false);
+
+	UpdateJiesuanZhifuPos();
+}
+
+void CSaomashouyinPageUI::HandleDiandanAIShibieResult()
+{
+	
+}
+
+void CSaomashouyinPageUI::HandleChengzhongValueChange()
+{
+	std::string weight = CChengzhongWorker::GetInstance()->GetWeight();
+
+	CControlUI* pWendingStatus = static_cast<CControlUI*>(this->FindSubControl(_T("saomashouyin_page_status_chengzhong_wending")));
+	if (CChengzhongWorker::GetInstance()->GetIsWending() == true)
+	{
+		pWendingStatus->SetBkImage(L"deng_on.png");
+	}
+	else
+	{
+		pWendingStatus->SetBkImage(L"deng_off.png");
+	}
+
+	CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_label_chengzhong_value")));
+	pLabel->SetText(CLewaimaiString::UTF8ToUnicode(weight).c_str());
+}
+
+void CSaomashouyinPageUI::ClickAixuexi()
+{
+	this->m_pMainWnd->SwitchPage(CMainWnd::AIXUEXI);
+}
+
+void CSaomashouyinPageUI::ZhiLing()
+{
+	std::string setting_dianzicheng_xinghao = CSetting::GetInstance()->GetParam("setting_dianzicheng_xinghao");
+	if (setting_dianzicheng_xinghao == "dahua_acs")
+	{
+		m_pMainWnd->ShowToast(L"大华ACS电子秤不支持置零操作,请在秤上操作");
+		return;
+	}
+
+	CChengzhongWorker::GetInstance()->Zhiling();
+}
+
+void CSaomashouyinPageUI::Qupi()
+{
+	std::string setting_dianzicheng_xinghao = CSetting::GetInstance()->GetParam("setting_dianzicheng_xinghao");
+	if (setting_dianzicheng_xinghao == "dahua_acs")
+	{
+		m_pMainWnd->ShowToast(L"大华ACS电子秤不支持去皮操作,请在秤上操作");
+		return;
+	}
+
+	CChengzhongWorker::GetInstance()->Qupi();
 }

+ 294 - 4
zhipuzi_pos_windows/page/CSaomashouyinPageUI.h

@@ -8,6 +8,7 @@
 #include "../zhipuzi/CFoodpackage.h"
 
 #include "../control/CDiandanFoodItemUI.h"
+#include "../control/CFoodtypeOptionUI.h"
 #include "../zhipuzi/CDiandanOrder.h"
 
 class CSaomashouyinPageUI : public CBasePageUI
@@ -22,6 +23,21 @@ public:
 	//初始化当前页面的展示,处理默认展示效果,在页面每次被选中加载(注意不是页面创建构造)的时候调用,如果多次选中会多次调用,这里要避免数据重复处理
 	void InitShow();
 
+	//收款一个订单成功,准备开始收款第2个订单的时候调用(会多次调度用)
+	void RefreshShow();
+
+	//仅仅初始化结算相关的显示(比如折扣、优惠、价格等)
+	void InitJiesuanShow();
+
+	//初始化结算页面的支付方式展示(仅需要在页面初始化的时候调用一次,这里只添加支付方式,不设置位置)
+	void InitJiesuanZhifu();
+
+	//这个只更新结算页面支付方式的位置,不处理控件添加
+	void UpdateJiesuanZhifuPos();
+
+	//只是刷新取单数量
+	void RefreshGuadanNum();
+
 	//处理按钮点击类事件
 	void HandleClickMsg(TNotifyUI& msg);
 
@@ -38,14 +54,288 @@ public:
 	void HandleTextCapture(std::string content);
 
 	//处理自定义消息,各个页面处理各个页面自己的(是自己处理的消息返回true,不是自己处理的消息返回false)
-	bool HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
-	{
-		return false;
-	}
+	bool HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+	void UpdateShopcartShow(bool is_add_new = false);
+
+	//任何可以引起价格变化的,比如添加、修改、删除商品,或者修改优惠等,需要重新计算总价格,刷新结算账单等地方的显示,都要调用这个方法
+	void UpdateJiesuanInfo();
+
+	//点击加号之后的逻辑
+	void ClickAdd();
+
+	//点击减号之后的逻辑
+	void ClickDel();
+
+	//点击删除之后的逻辑
+	void ClickRemove();
+
+	//点击规格之后的逻辑
+	void ClickGuige();
+
+	//点击打包之后的逻辑
+	void ClickDabao();
+
+	//点击清空之后的逻辑
+	void ClickQingkong();
+
+	//点击存单之后的逻辑
+	void ClickCundan();
+
+	//点击取单之后的逻辑
+	void ClickQudan();
+
+	//点击整单备注之后的逻辑
+	void ClickZhengdanMemo();
+
+	//点击更多支付之后的逻辑
+	void ClickGengduoPay();
+
+	//点击查看优惠
+	void ClickChakanYouhui();
+
+	//处理会员登录
+	void ClickMemberLogin();
+
+	//处理会员退出登陆
+	void ClickMemberLogout();
+
+	//展示会员详情
+	void ClickMemberInfoShow();
+
+	//点击AI学习
+	void ClickAixuexi();
+
+	//点击整单折扣
+	void ClickZhekou();
+
+	//点击加价
+	void ClickJiajia();
+
+	//点击优惠
+	void ClickRengongyouhui();
+
+	//点击扫码使用优惠券
+	void ClickSaomaYouhuiquan();
+
+	//点击扫码商品券
+	void ClickSaomaShangpinquan();
+
+	//点击扫码权益卡
+	void ClickSaomaQuanyika();
+
+	//点击扫码次卡
+	void ClickSaomaCika();
+
+	//点击取消使用优惠券
+	void ClickQuxiaoYouhuiquan();
+
+	//点击取消商品券
+	void ClickQuxiaoShangpinquan();
+
+	//点击取消权益卡
+	void ClickQuxiaoQuanyika();
+
+	//点击取消次卡
+	void ClickQuxiaoCika();
+
+	//开始进行微信支付收款,如果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 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 YincangYouhui();
+
+	//显示优惠区域
+	void XianshiYouhui();
+
 private:
+	//获取用于提交订单的参数结构
+	std::map<std::string, std::string> GetSendorderParams();
+
+	//用于支付完成后,获取用于打印的order
+	CDiandanOrder GetPrintOrderinfo(std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance, std::string member_number);
+
+	//处理AI识别结果
+	void HandleDiandanAIShibieResult();
+
+	//处理称重数值变化
+	void HandleChengzhongValueChange();
+
+	//点击置零按钮
+	void ZhiLing();
+
+	//点击去皮按钮
+	void Qupi();
+
+private:
+	CTileLayoutUI* m_foodLayout;
+	CContainerUI* m_foodtypeLayout;
+
+	bool m_is_ai_shibie = false;
+
+	bool m_is_zidingyizhifu_init = false;
+
+	//套餐商品数量
+	int m_nFoodpackageNum;
+
+	//所有商品分类(只包含收银机显示的分类)
+	std::vector<CFoodType> m_types;
+
+	//当前选中的商品分类ID,为空表示没选中任何分类,为taocan表示选中套餐分类,如果选中普通商品分类就是分类ID
+	std::string m_cur_type_id = "";
+	CFoodtypeOptionUI* m_curFoodtypeOption;
+
+	//商品搜索相关
+	std::string m_type_id_before_sousuo;
+	std::string m_sousuo_foodname;
+
+	//当前点击的哪个商品
+	CDiandanFoodItemUI* m_cur_click_food_item;
+
+	//当前购物车的订单,根据这个来进行渲染显示
+	CDiandanOrder m_cur_diandan_order;
+
+	//当前挂单的订单
+	std::vector<CDiandanOrder> 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; //会员商品优惠
+
+	//会员登录成功后返回的会员信息
+	std::string m_card_no;
+	std::string m_balance;
+	std::string m_phone;
+	std::string m_birthday;
+	std::string m_sex;
+	std::string m_address;
+	std::string m_is_card;
+	std::string m_point;
+	std::string m_open_no_card_payment;
+	std::string m_pay_password;
+	std::string m_freeze;
+	std::string m_card_identify;
+
+	std::string m_member_id;
+
+	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;
+
+	//模态对话框有关的
+	bool m_is_show_modal_wnd = false;
+
+	//结算页面总的支付方式数量
+	int m_nZhiufuNum;
+
 	//当前控件的实际宽度
 	int m_nPageWidth;
+
+	bool m_is_yincangyouhui = false;
+
+	//与称重显示相关的
+	bool m_is_dianzicheng_lianjie = false;
 };

+ 9 - 1
zhipuzi_pos_windows/wnd/CGuadanWnd.cpp

@@ -2,6 +2,7 @@
 #include "CGuadanWnd.h"
 
 #include "../page/CDiandanPageUI.h"
+#include "../page/CSaomashouyinPageUI.h"
 
 LRESULT CGuadanWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
@@ -155,7 +156,14 @@ void CGuadanWnd::Notify(TNotifyUI& msg)
 
 			RefreshOrder();
 
-			m_pageUI->RefreshGuadanNum();
+			if (m_nPageType == 0)
+			{
+				static_cast<CDiandanPageUI*>(m_pageUI)->RefreshGuadanNum();
+			}
+			else
+			{
+				static_cast<CSaomashouyinPageUI*>(m_pageUI)->RefreshGuadanNum();
+			}
 		}
 		else if (senderName == _T("guadan_order_queren"))
 		{

+ 8 - 2
zhipuzi_pos_windows/wnd/CGuadanWnd.h

@@ -34,11 +34,16 @@ public:
 
 	std::string getContent();
 
-	void SetPageUI(CDiandanPageUI* page)
+	void SetPageUI(CBasePageUI* page)
 	{
 		m_pageUI = page;
 	}
 
+	void SetPageType(int type)
+	{
+		m_nPageType = type;
+	}
+
 	void SetTitle(std::wstring title);
 
 	void SetGuadanOrders(std::vector<CDiandanOrder>& guadan_orders)
@@ -91,7 +96,8 @@ public:
 	//絞ゴ境等腔隆等
 	std::vector<CDiandanOrder>* m_guadan_orders;
 
-	CDiandanPageUI* m_pageUI;
+	CBasePageUI* m_pageUI;
+	int m_nPageType; //0ㄩ萸等隆等 1ㄩ禸鎢彶窅隆等
 
 	int m_nQudanNum;
 };

+ 17 - 80
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -1722,44 +1722,13 @@ void CMainWnd::UpdateGongnengString()
 	}
 
 	//考虑到餐饮和零售的差异,这里要对功能导航的内容进行过滤处理
-	std::vector<std::string> TmpchangyongVector;
 	for (std::vector<std::string>::iterator it = changyongVector.begin(); it != changyongVector.end(); it++)
 	{
-		if (CShopinfo::GetInstance()->m_version_type == "1")
-		{
-			if (*it == "saomashouyin")
-			{
-				//餐饮版不显示扫码收银
-				continue;
-			}
-
-			//如果以后有其他不显示的,继续加在这里就行
-
-			TmpchangyongVector.push_back(*it);
-
-			TmpMap[*it] = "1";
-		}
-		else if (CShopinfo::GetInstance()->m_version_type == "2")
-		{
-			if (*it == "zhengcan")
-			{
-				//零售版不显示正餐
-				continue;
-			}
-
-			//如果以后有其他不显示的,继续加在这里就行
-
-			TmpchangyongVector.push_back(*it);
-
-			TmpMap[*it] = "1";
-		}
+		TmpMap[*it] = "1";
 	}
 
-	//这个时候已经过滤掉了,保存到数据库
-	changyongVector = TmpchangyongVector;
-
-	std::string newChangyong = CLewaimaiString::Merge(changyongVector, ",");
-	CSetting::GetInstance()->SetParam("setting_gongneng_changyong_string", newChangyong);
+	//std::string newChangyong = CLewaimaiString::Merge(changyongVector, ",");
+	//CSetting::GetInstance()->SetParam("setting_gongneng_changyong_string", newChangyong);
 
 	//常用的处理完了,开始处理更多的
 	std::string gengduoString = CSetting::GetInstance()->GetParam("setting_gongneng_gengduo_string");
@@ -1773,63 +1742,31 @@ void CMainWnd::UpdateGongnengString()
 		gengduoVector = CLewaimaiString::Split(gengduoString, ",");
 	}
 
-	//考虑到餐饮和零售的差异,这里要对功能导航的内容进行过滤处理
 	std::vector<std::string> TmpgengduoVector;
-
 	for (std::vector<std::string>::iterator it = gengduoVector.begin(); it != gengduoVector.end(); it++)
 	{
-		if (CShopinfo::GetInstance()->m_version_type == "1")
-		{
-			if (*it == "saomashouyin")
-			{
-				//餐饮版不显示扫码收银
-				continue;
-			}
+		TmpgengduoVector.push_back(*it);
 
-			//如果以后有其他不显示的,继续加在这里就行
-
-			TmpgengduoVector.push_back(*it);
-
-			TmpMap[*it] = "1";
-		}
-		else if (CShopinfo::GetInstance()->m_version_type == "2")
-		{
-			if (*it == "zhengcan")
-			{
-				//零售版不显示正餐
-				continue;
-			}
-
-			//如果以后有其他不显示的,继续加在这里就行
-
-			TmpgengduoVector.push_back(*it);
-
-			TmpMap[*it] = "1";
-		}
+		TmpMap[*it] = "1";
 	}
 	
-	//如果发生了餐饮和零售的切换,比如从餐饮切换到零售,因为之前登录餐饮的时候把saomashouyin删除了,现在登录零售的话常用和更多都没有saomashouyin,这里要加入到更多的最后面
-	if (CShopinfo::GetInstance()->m_version_type == "1")
+	//可能没有的模块加进来
+	if (TmpMap.find("zhengcan") == TmpMap.end())
 	{
-		if (TmpMap.find("zhengcan") == TmpMap.end())
-		{
-			//餐饮版这时候没有zhengcan,说明切换过零售版被删除了,这里要加上
-			TmpgengduoVector.push_back("zhengcan");
-		}
-
-		//如果以后有其他餐饮版专属的,要在这里继续添加
+		//餐饮版这时候没有zhengcan,说明切换过零售版被删除了,这里要加上
+		TmpgengduoVector.push_back("zhengcan");
 	}
-	else if (CShopinfo::GetInstance()->m_version_type == "2")
-	{
-		if (TmpMap.find("saomashouyin") == TmpMap.end())
-		{
-			//零售版这时候没有saomashouyin,说明切换过餐饮版被删除了,这里要加上
-			TmpgengduoVector.push_back("saomashouyin");
-		}
 
-		//如果以后有其他零售版专属的,要在这里继续添加
+	//如果以后有其他餐饮版专属的,要在这里继续添加
+
+	if (TmpMap.find("saomashouyin") == TmpMap.end())
+	{
+		//零售版这时候没有saomashouyin,说明切换过餐饮版被删除了,这里要加上
+		TmpgengduoVector.push_back("saomashouyin");
 	}
 
+	//如果以后有其他零售版专属的,要在这里继续添加
+
 	//新版本增加了扫码收银
 	if (TmpMap.find("shoukuan") == TmpMap.end())
 	{