Kaynağa Gözat

继续做正餐

张洋 3 yıl önce
ebeveyn
işleme
e7360db458

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

@@ -7,7 +7,7 @@
 		<Label name="status" font="14" float="true" pos="10,70,170,100" align="left"></Label>
 		<Label name="status" font="14" float="true" pos="10,70,170,100" align="left"></Label>
 		
 		
 		<Control></Control>
 		<Control></Control>
-		<HorizontalLayout height="32" bkcolor="#FFF1F1F1">
+		<HorizontalLayout name="zhengcan_tableitem_bottom" height="32" bkcolor="#FFEBEBEB">
 			<Label name="renshu" visible="true" width="50" height="26" font="14" text="6人" float="true" pos="33,5,63,30" align="center"></Label>		
 			<Label name="renshu" visible="true" width="50" height="26" font="14" text="6人" float="true" pos="33,5,63,30" align="center"></Label>		
 			<Label name="shijian" visible="true" width="50" height="26" font="14" text="50分钟" float="true" pos="110,5,160,30" align="center"></Label>	
 			<Label name="shijian" visible="true" width="50" height="26" font="14" text="50分钟" float="true" pos="110,5,160,30" align="center"></Label>	
 		</HorizontalLayout>
 		</HorizontalLayout>

+ 38 - 2
zhipuzi_pos_windows/control/CZhengcanTableItemUI.cpp

@@ -34,7 +34,7 @@ void CZhengcanTableItemUI::DoEvent(TEventUI& event)
 	CVerticalLayoutUI::DoEvent(event);
 	CVerticalLayoutUI::DoEvent(event);
 }
 }
 
 
-void CZhengcanTableItemUI::SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status)
+void CZhengcanTableItemUI::SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status, std::string order_id)
 {
 {
 	m_table_id = table_id;
 	m_table_id = table_id;
 	m_table_name = table_name;
 	m_table_name = table_name;
@@ -43,6 +43,7 @@ void CZhengcanTableItemUI::SetInfo(std::string table_id, std::string table_name,
 	m_order_init_time = order_init_time;
 	m_order_init_time = order_init_time;
 	m_from_type = from_type;
 	m_from_type = from_type;
 	m_order_status = order_status;
 	m_order_status = order_status;
+	m_order_id = order_id;
 }
 }
 
 
 void CZhengcanTableItemUI::UpdateShow()
 void CZhengcanTableItemUI::UpdateShow()
@@ -52,6 +53,9 @@ void CZhengcanTableItemUI::UpdateShow()
 
 
 	CLabelUI* pStatus = static_cast<CLabelUI*>(this->FindSubControl(_T("status")));
 	CLabelUI* pStatus = static_cast<CLabelUI*>(this->FindSubControl(_T("status")));
 
 
+	CLabelUI* pRenshu = static_cast<CLabelUI*>(this->FindSubControl(_T("renshu")));
+	CLabelUI* pShijian = static_cast<CLabelUI*>(this->FindSubControl(_T("shijian")));
+
 	if (m_status == "0")
 	if (m_status == "0")
 	{
 	{
 		//未开台
 		//未开台
@@ -64,6 +68,38 @@ void CZhengcanTableItemUI::UpdateShow()
 	else if (m_status == "2")
 	else if (m_status == "2")
 	{
 	{
 		//已开台
 		//已开台
-		pStatus->SetText(L"已开台");
+		pName->SetTextColor(0xFFFFFFFF);
+		pStatus->SetTextColor(0xFFFFFFFF);
+
+		pRenshu->SetTextColor(0xFFFFFFFF);
+		pShijian->SetTextColor(0xFFFFFFFF);
+
+		CHorizontalLayoutUI* pBottom = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(L"zhengcan_tableitem_bottom"));
+
+		//区分待下单、待结账、待清台这3个状态
+		if (m_order_id == "0")
+		{
+			//说明还未下单,处于待下单状态,用绿色
+			this->SetBkColor(0xFF3CB371);
+			pBottom->SetBkColor(0xFF28A25E);
+
+			pStatus->SetText(L"待下单");
+		}
+		else if (m_order_status == "OPEN")
+		{
+			//说明已下单,未支付,处于待支付状态,用红色
+			this->SetBkColor(0xFFF95252);
+			pBottom->SetBkColor(0xFFF73F3F);
+
+			pStatus->SetText(L"待结账");
+		}
+		else if (m_order_status == "SUCCESS")
+		{
+			//待清台,用蓝色
+			this->SetBkColor(0xFF497FC7);
+			pBottom->SetBkColor(0xFF3A74C2);
+
+			pStatus->SetText(L"待清台");
+		}
 	}
 	}
 }
 }

+ 17 - 1
zhipuzi_pos_windows/control/CZhengcanTableItemUI.h

@@ -13,11 +13,26 @@ public:
 
 
 	void DoEvent(TEventUI& event);
 	void DoEvent(TEventUI& event);
 
 
-	void SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status);
+	void SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status, std::string order_id);
 
 
 	//刷新显示
 	//刷新显示
 	void UpdateShow();
 	void UpdateShow();
 
 
+	std::string GetTableId()
+	{
+		return m_table_id;
+	}
+
+	std::string GetStatus()
+	{
+		return m_status;
+	}
+
+	std::string GetOrderId()
+	{
+		return m_order_id;
+	}
+
 private:
 private:
 	std::string m_table_id;
 	std::string m_table_id;
 	std::string m_table_name;
 	std::string m_table_name;
@@ -26,5 +41,6 @@ private:
 	std::string m_order_init_time;
 	std::string m_order_init_time;
 	std::string m_from_type;
 	std::string m_from_type;
 	std::string m_order_status;
 	std::string m_order_status;
+	std::string m_order_id;
 };
 };
 
 

+ 32 - 2
zhipuzi_pos_windows/page/CZhengcanPageUI.cpp

@@ -27,6 +27,14 @@ void CZhengcanPageUI::HandleClickMsg(TNotifyUI& msg)
 {
 {
 	CDuiString name = msg.pSender->GetName();
 	CDuiString name = msg.pSender->GetName();
 
 
+	if (name == L"zhengcan_tableitem")
+	{
+		CZhengcanTableItemUI* tableitemUI = static_cast<CZhengcanTableItemUI*>(msg.pSender);
+
+		m_cur_click_table_item = tableitemUI;
+
+		this->ClickTableAction();
+	}
 }
 }
 
 
 //处理option切换事件
 //处理option切换事件
@@ -330,7 +338,7 @@ void CZhengcanPageUI::InitTableShow()
 
 
 		CZhengcanTableItemUI* pItem = static_cast<CZhengcanTableItemUI*>(builder.Create(_T("zhengcan_tableitem.xml"), (UINT)0, &cb, m_pManager));
 		CZhengcanTableItemUI* pItem = static_cast<CZhengcanTableItemUI*>(builder.Create(_T("zhengcan_tableitem.xml"), (UINT)0, &cb, m_pManager));
 
 
-		pItem->SetInfo(CLewaimaiJson::ToString(tableinfo["table_id"]), CLewaimaiJson::ToString(tableinfo["name"]), CLewaimaiJson::ToString(tableinfo["type_id"]), CLewaimaiJson::ToString(tableinfo["status"]), CLewaimaiJson::ToString(tableinfo["order_init_time"]), CLewaimaiJson::ToString(tableinfo["from_type"]), CLewaimaiJson::ToString(tableinfo["order_status"]));
+		pItem->SetInfo(CLewaimaiJson::ToString(tableinfo["table_id"]), CLewaimaiJson::ToString(tableinfo["name"]), CLewaimaiJson::ToString(tableinfo["type_id"]), CLewaimaiJson::ToString(tableinfo["status"]), CLewaimaiJson::ToString(tableinfo["order_init_time"]), CLewaimaiJson::ToString(tableinfo["from_type"]), CLewaimaiJson::ToString(tableinfo["order_status"]), CLewaimaiJson::ToString(tableinfo["order_id"]));
 
 
 		pItem->UpdateShow();
 		pItem->UpdateShow();
 
 
@@ -354,7 +362,7 @@ void CZhengcanPageUI::UpdateTablePos()
 	}
 	}
 
 
 	//根据宽度计算每行显示的数量
 	//根据宽度计算每行显示的数量
-	int nMeihangNum = (nWidth - 20) / 135;
+	int nMeihangNum = (nWidth - 20) / 192;
 
 
 	if (nMeihangNum < 1)
 	if (nMeihangNum < 1)
 	{
 	{
@@ -392,4 +400,26 @@ void CZhengcanPageUI::UpdateTablePos()
 	size.cy = 0;
 	size.cy = 0;
 	CVerticalLayoutUI* pFenleiLayoutScroll = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("zhengcan_tablelist_scrolllayout")));
 	CVerticalLayoutUI* pFenleiLayoutScroll = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("zhengcan_tablelist_scrolllayout")));
 	pFenleiLayoutScroll->SetScrollPos(size);
 	pFenleiLayoutScroll->SetScrollPos(size);
+}
+
+void CZhengcanPageUI::ClickTableAction()
+{
+	std::string table_id = m_cur_click_table_item->GetTableId();
+	std::string status = m_cur_click_table_item->GetStatus();
+	std::string order_id = m_cur_click_table_item->GetOrderId();
+
+	if (status == "0")
+	{
+		//未开台
+		
+	}
+	else if (status == "1")
+	{
+		//预约中
+	}
+	else if (status == "2")
+	{
+		//已开台
+
+	}
 }
 }

+ 5 - 2
zhipuzi_pos_windows/page/CZhengcanPageUI.h

@@ -7,8 +7,7 @@
 #include "../zhipuzi/CFoodtype.h"
 #include "../zhipuzi/CFoodtype.h"
 #include "../zhipuzi/CFoodpackage.h"
 #include "../zhipuzi/CFoodpackage.h"
 
 
-#include "../control/CDiandanFoodItemUI.h"
-#include "../zhipuzi/CDiandanOrder.h"
+#include "../control/CZhengcanTableItemUI.h"
 
 
 #include "../wnd/CModalWnd.h"
 #include "../wnd/CModalWnd.h"
 
 
@@ -54,6 +53,8 @@ public:
 
 
 	void UpdateTablePos();
 	void UpdateTablePos();
 
 
+	void ClickTableAction();
+
 private:
 private:
 	//当前控件的实际宽度
 	//当前控件的实际宽度
 	int m_nPageWidth;
 	int m_nPageWidth;
@@ -70,4 +71,6 @@ private:
 	//当前选中的桌子分类ID,为空表示没选中任何分类,为all表示选中全部分类,如果选中普通分类就是分类ID
 	//当前选中的桌子分类ID,为空表示没选中任何分类,为all表示选中全部分类,如果选中普通分类就是分类ID
 	std::string m_cur_type_id = "";
 	std::string m_cur_type_id = "";
 	CControlUI* m_curZhuozitypeOption;
 	CControlUI* m_curZhuozitypeOption;
+
+	CZhengcanTableItemUI* m_cur_click_table_item;
 };
 };