Parcourir la source

明天接着调

zhangyang il y a 4 ans
Parent
commit
9dea552bfd

BIN
bin/Win32/Debug/zhipuzi_pos_windows/db/pos.db


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

@@ -50,7 +50,7 @@
 		</VerticalLayout>
 		
 		<VerticalLayout>
-			<HorizontalLayout height="56" hscrollbar="true" padding="15,15,15,0">
+			<HorizontalLayout name="diandan_fenlei_layout" height="56" hscrollbar="true" padding="15,15,15,0">
 				<Option name="option_diandan_1" group="diandan_fenlei_tab" text="商品分类1" width="120" height="38" padding="0,0,15,0" bkcolor="#FFFFFFFF" selectedtextcolor="FFFF0000"></Option>
 				
 				<Option name="option_diandan_1" group="diandan_fenlei_tab" text="商品分类1" width="120" height="38" padding="0,0,15,0" bkcolor="#FFFFFFFF" selectedtextcolor="FFFF0000"></Option>

+ 3 - 77
bin/Win32/Debug/zhipuzi_pos_windows/skin/main.xml

@@ -41,84 +41,10 @@
 				<Option name="main_gengduo" group="main_tab" width="100" height="100" text="更多" textpadding="0,75,0,0" selectedtextcolor="FFFF0000" normalimage="file='logo.png' source='0,0,77,54' dest='12,13,89,67'"></Option>
 			</VerticalLayout>
 			
+			<!-- 主要的布局内容,所有主页面的内容都放在这个容器的内部 -->
+			<Container name="main_content_layout">
 			
-			<TabLayout name="switch">					
-				<!--外卖的 -->
-				<VerticalLayout bkcolor="#FFEFF6EE">
-					<HorizontalLayout height="44" bkcolor="#FFFFFFFF" >
-						<Control />
-						<Button name="waimai_order_list_refresh" width="70" height="36" padding="20,4,0,0" text="刷新" textcolor="#FFFFFFFF" />
-						<Button name="waimai_order_list_last" width="70" height="36" padding="20,4,0,0" text="上一页" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
-						<Button name="waimai_order_list_next" width="70" height="36" padding="20,4,0,0" text="下一页" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
-						<Label name="waimai_order_list_page" width="150" height="36" padding="20,4,0,0" />
-					</HorizontalLayout>
-					
-					<HorizontalLayout>
-						<HorizontalLayout width="250" padding="20,20,20,0">
-							<VerticalLayout height="400" bkcolor="#FFFFFFFF" childpadding="15" inset="20,20,20,0">
-								<Option name="waimai_open_switch" selected="true" text="未处理" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
-								<Option name="waimai_confirmed_switch" text="已确认" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
-								<Option name="waimai_delivery_switch" text="配送中" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
-								<Option name="waimai_success_switch" text="成功" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
-								<Option name="waimai_fail_switch" text="失败"  group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
-								<Option name="waimai_cancel_switch" text="已取消"  group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
-								<Option name="waimai_refund_switch" text="退款中" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
-							</VerticalLayout>
-						</HorizontalLayout>
-												
-						<WaimaiOrderList name="orderlist" vscrollbar="true">
-						
-						</WaimaiOrderList>
-						
-						<HorizontalLayout name="main_orderlist_loading">
-							<Control></Control>
-							<VerticalLayout width="24">
-								<Control></Control>
-								<HorizontalLayout height="24">
-									<GifAnim bkimage="loading.gif" autosize="true"></GifAnim>
-								</HorizontalLayout>
-								<Control></Control>
-							</VerticalLayout>
-							<Control></Control>
-						</HorizontalLayout>
-					</HorizontalLayout>
-				</VerticalLayout>
-				
-				<!--外卖订单详情页-->
-				<HorizontalLayout vscrollbar="true">
-					<Include source="waimaiorder_info.xml" />
-				</HorizontalLayout>
-
-				<!--设置-->
-				<HorizontalLayout>
-					<Include source="setting.xml" />
-				</HorizontalLayout>
-				
-				<!--点单-->
-				<HorizontalLayout>
-					<Include source="diandan_index.xml" />
-				</HorizontalLayout>
-				
-				<!--会员-->
-				<HorizontalLayout>
-					<Include source="huiyuan_index.xml" />
-				</HorizontalLayout>
-				
-				<!--报表-->
-				<HorizontalLayout>
-					<Include source="baobiao_index.xml" />
-				</HorizontalLayout>
-				
-				<!--交班-->
-				<HorizontalLayout>
-					<Include source="jiaoban_index.xml" />
-				</HorizontalLayout>
-				
-				<!--更多-->
-				<HorizontalLayout>
-					<Include source="gengduo_index.xml" />
-				</HorizontalLayout>
-			</TabLayout>
+			</Container>
 		</HorizontalLayout>
 		
 	</VerticalLayout>        

+ 42 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/waimaiorder_list.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window>
+	<VerticalLayout bkcolor="#FFEFF6EE">
+		<HorizontalLayout height="44" bkcolor="#FFFFFFFF" >
+			<Control />
+			<Button name="waimai_order_list_refresh" width="70" height="36" padding="20,4,0,0" text="刷新" textcolor="#FFFFFFFF" />
+			<Button name="waimai_order_list_last" width="70" height="36" padding="20,4,0,0" text="上一页" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+			<Button name="waimai_order_list_next" width="70" height="36" padding="20,4,0,0" text="下一页" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
+			<Label name="waimai_order_list_page" width="150" height="36" padding="20,4,0,0" />
+		</HorizontalLayout>
+		
+		<HorizontalLayout>
+			<HorizontalLayout width="250" padding="20,20,20,0">
+				<VerticalLayout height="400" bkcolor="#FFFFFFFF" childpadding="15" inset="20,20,20,0">
+					<Option name="waimai_open_switch" selected="true" text="未处理" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
+					<Option name="waimai_confirmed_switch" text="已确认" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
+					<Option name="waimai_delivery_switch" text="配送中" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
+					<Option name="waimai_success_switch" text="成功" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
+					<Option name="waimai_fail_switch" text="失败"  group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
+					<Option name="waimai_cancel_switch" text="已取消"  group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
+					<Option name="waimai_refund_switch" text="退款中" group="waimai_status_switch" align="center" height="36" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
+				</VerticalLayout>
+			</HorizontalLayout>
+									
+			<WaimaiOrderList name="orderlist" vscrollbar="true">
+			
+			</WaimaiOrderList>
+			
+			<HorizontalLayout name="main_orderlist_loading">
+				<Control></Control>
+				<VerticalLayout width="24">
+					<Control></Control>
+					<HorizontalLayout height="24">
+						<GifAnim bkimage="loading.gif" autosize="true"></GifAnim>
+					</HorizontalLayout>
+					<Control></Control>
+				</VerticalLayout>
+				<Control></Control>
+			</HorizontalLayout>
+		</HorizontalLayout>
+	</VerticalLayout>
+</Window>

+ 59 - 45
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -17,20 +17,61 @@ void CMainWnd::Init()
     m_pRestoreBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("restorebtn")));
     m_pMinBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("minbtn")));
 
-	CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
-	pControl->SelectItem(3);
-
-    OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
-    orderlist->Refresh();
-
-    //初始化设置中心的状态
-    InitSettingStatus();
+	//默认选择点单页面
+	this->SwitchPage(DIANDAN);
 
     //登录成功,启动消息和任务处理
     m_push = new CMessagePush(m_hWnd);
     m_push->Start();
 }
 
+void CMainWnd::SwitchPage(MainPageName name)
+{
+	if (m_curPageName == name)
+	{
+		return;
+	}
+
+	//先删除现在的子对象
+	CContainerUI* pMainContentLayout = static_cast<CContainerUI*>(m_pm.FindControl(_T("main_content_layout")));
+	pMainContentLayout->RemoveAll();
+
+	//再创建一个对象
+	CDialogBuilder builder;
+	CDialogBuilderCallbackEx cb;
+
+	CContainerUI* pChildContainer = NULL;
+
+	if (name == DIANDAN)
+	{
+		pChildContainer = static_cast<CContainerUI*>(builder.Create(_T("diandan_index.xml"), (UINT)0, &cb, &m_pm));
+		pMainContentLayout->Add(pChildContainer);
+	}
+	else if (name == DINGDAN)
+	{
+		pChildContainer = static_cast<CContainerUI*>(builder.Create(_T("waimaiorder_list.xml"), (UINT)0, &cb, &m_pm));
+		pMainContentLayout->Add(pChildContainer);
+
+		OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
+		orderlist->Refresh();
+	}
+	else if (name == SHEZHI)
+	{
+		pChildContainer = static_cast<CContainerUI*>(builder.Create(_T("setting.xml"), (UINT)0, &cb, &m_pm));
+		pMainContentLayout->Add(pChildContainer);
+
+		//初始化设置中心的状态
+		InitSettingStatus();
+	}
+	else if (name == WAIMAIINFO)
+	{
+		pChildContainer = static_cast<CContainerUI*>(builder.Create(_T("waimaiorder_info.xml"), (UINT)0, &cb, &m_pm));
+		pMainContentLayout->Add(pChildContainer);
+	}
+
+	m_curPageName = name;
+}
+
 LRESULT CMainWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
     LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
@@ -51,7 +92,7 @@ void CMainWnd::Notify(TNotifyUI& msg)
 {
     if(msg.sType == _T("windowinit"))
     {
-        OnPrepare();
+        
     }
     else if(msg.sType == _T("click"))
     {
@@ -207,6 +248,8 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
     }
     else if(name == _T("waimai_order_list_info"))
     {
+		this->SwitchPage(WAIMAIINFO);
+
         CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
         std::string waimai_order_id = item->getOrderID();
         std::string waimai_order_no = item->getOrderNo();
@@ -219,14 +262,6 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
         CWaimaiOrderInfoUI* order_info_page = static_cast<CWaimaiOrderInfoUI*>(m_pm.FindControl(_T("waimaiorder_info_page")));
         order_info_page->SetDate(order);
         order_info_page->Refresh(order);
-
-        //显示订单详情页的内容
-        CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
-
-        if(pControl && pControl->GetCurSel() != 1)
-        {
-            pControl->SelectItem(1);
-        }
     }
     else if(name == _T("waimai_order_list_last"))
     {
@@ -245,16 +280,7 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
     }
     else if(name == _T("waimai_order_info_page_return"))
     {
-        CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
-
-        if(pControl && pControl->GetCurSel() != 0)
-        {
-            pControl->SelectItem(0);
-        }
-
-        //刷新当前列表
-        OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
-        orderlist->Refresh();
+		this->SwitchPage(DINGDAN);
     }
     else if(name == _T("waimai_order_info_page_print"))
     {
@@ -847,6 +873,9 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
     }
 }
 
+/**
+ * 这个处理Option的切换
+ */
 void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
 {
     CDuiString name = msg.pSender->GetName();
@@ -854,30 +883,15 @@ void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
     //先判断主页面的tab
     if(name == _T("main_waimai"))
     {
-        CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
-
-        if(pControl && pControl->GetCurSel() != 0)
-        {
-            pControl->SelectItem(0);
-        }
+		this->SwitchPage(DINGDAN);
     }
     else if(name == _T("main_setting"))
     {
-        CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
-
-        if(pControl && pControl->GetCurSel() != 2)
-        {
-            pControl->SelectItem(2);
-        }
+		this->SwitchPage(SHEZHI);
     }
     else if(name == _T("main_diandan"))
     {
-        CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
-
-        if(pControl && pControl->GetCurSel() != 3)
-        {
-            pControl->SelectItem(3);
-        }
+		this->SwitchPage(DIANDAN);
     }
     //判断外卖的tab
     else if(name == _T("waimai_open_switch") || name == _T("waimai_confirmed_switch") || name == _T("waimai_delivery_switch") || name == _T("waimai_success_switch") || name == _T("waimai_fail_switch") || name == _T("waimai_cancel_switch") || name == _T("waimai_refund_switch"))

+ 17 - 5
zhipuzi_pos_windows/wnd/CMainWnd.h

@@ -11,6 +11,19 @@ class CMessagePush;
 class CMainWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
 {
 public:
+	enum MainPageName
+	{
+		NOPAGE, //默认空页面
+		DIANDAN,
+		DINGDAN,
+		HUIYUAN,
+		BAOBIAO,
+		JIAOBAN,
+		SHEZHI,
+		GENGDUO,
+		WAIMAIINFO,
+	};
+
     CMainWnd() { };
 
     LPCTSTR GetWindowClassName() const
@@ -30,11 +43,8 @@ public:
     };
 
     void Init();
-
-    void OnPrepare()
-    {
-
-    }
+	
+	void SwitchPage(MainPageName name);
 
     void Notify(TNotifyUI& msg);
 
@@ -93,4 +103,6 @@ private:
     NOTIFYICONDATA m_trayIcon;
 
     CMessagePush* m_push = NULL;
+
+	MainPageName m_curPageName = NOPAGE;
 };