소스 검색

继续做转台

张洋 3 년 전
부모
커밋
e7a410e843

+ 9 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_page.xml

@@ -16,6 +16,15 @@
 					
 					</VerticalLayout>
 					
+					<HorizontalLayout visible="false" name="zhengcan_zhuantai_layout" float="true" width="700" height="80" bkcolor="#FFFFFFFF">
+						<Label text="选择要转入的桌台" font="20" padding="20,0,0,0"></Label>
+						<Control></Control>
+						
+						<Button name="zhengcan_zhuantai_cancel" text="取消" height="45" width="120" padding="10,17,0,0" normalimage="file='Dialog_Btn1.png' corner='5,5,5,5'" hotimage="file='Dialog_Btn1_Hover.png' corner='5,5,5,5'" pushedimage="file='Dialog_Btn1_Click.png' corner='5,5,5,5'"></Button>
+							
+						<Button name="zhengcan_zhuantai_queding" text="确定" height="45" width="120" padding="10,17,20,0" textcolor="#FFFFFFFF" normalimage="file='Dialog_Btn3.png' corner='5,5,5,5'" hotimage="file='Dialog_Btn3_Hover.png' corner='5,5,5,5'" pushedimage="file='Dialog_Btn3_Click.png' corner='5,5,5,5'"></Button>
+					</HorizontalLayout>
+					
 					<HorizontalLayout name="loading">
 						<Control></Control>
 						<VerticalLayout width="24">

+ 3 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_tableitem.xml

@@ -14,5 +14,8 @@
 			<Control name="time_image" bkimage="zhengcan_time_2.png" float="true" pos="97,10,115,26"></Control>			
 			<Label name="shijian" visible="true" font="14" text="" float="true" pos="113,5,175,30"></Label>	
 		</HorizontalLayout>
+		
+		<Control visible="false" name="zhuantai_zhuanchu" bkimage="zhengcan_zhuanchu.png" float="true" pos="0,0,177,140"></Control>
+		<Control visible="false" name="zhuantai_zhuanru" bkimage="zhengcan_zhuanru.png" float="true" pos="0,0,177,140"></Control>
 	</ZhengcanTableItem>
 </Window>

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


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


+ 14 - 0
zhipuzi_pos_windows/control/CZhengcanTableItemUI.cpp

@@ -134,3 +134,17 @@ void CZhengcanTableItemUI::UpdateShow()
 		}
 	}
 }
+
+void CZhengcanTableItemUI::ShowZhuanchu(bool is_show)
+{
+	CControlUI* zhuanchuControl = static_cast<CControlUI*>(this->FindSubControl(L"zhuantai_zhuanchu"));
+
+	if (is_show == true)
+	{
+		zhuanchuControl->SetVisible(true);
+	}
+	else
+	{
+		zhuanchuControl->SetVisible(false);
+	}
+}

+ 2 - 0
zhipuzi_pos_windows/control/CZhengcanTableItemUI.h

@@ -38,6 +38,8 @@ public:
 		return m_table_name;
 	}
 
+	void ShowZhuanchu(bool is_show);
+
 private:
 	std::string m_table_id;
 	std::string m_table_name;

+ 67 - 0
zhipuzi_pos_windows/page/CZhengcanPageUI.cpp

@@ -37,6 +37,10 @@ void CZhengcanPageUI::HandleClickMsg(TNotifyUI& msg)
 
 		this->ClickTableAction();
 	}
+	else if (name == L"zhengcan_zhuantai_cancel")
+	{
+		this->CancelZhuanTai();
+	}
 }
 
 //处理option切换事件
@@ -92,6 +96,7 @@ void CZhengcanPageUI::HandleTextCapture(std::string content)
 void CZhengcanPageUI::SetPos(RECT rc, bool bNeedInvalidate)
 {
 	m_nPageWidth = rc.right - rc.left;
+	m_nPageHeight = rc.bottom - rc.top;
 
 	//更新分类位置
 	UpdateTabletypePos();
@@ -246,6 +251,8 @@ void CZhengcanPageUI::DoRefreshTable()
 	m_tableLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("zhengcan_tablelist")));
 	m_tableLayout->RemoveAll();
 
+	m_table_items.clear();
+
 	std::map<string, string> params;
 
 	if (m_cur_type_id == "all")
@@ -317,6 +324,8 @@ void CZhengcanPageUI::DoRefreshTable()
 		pItem->UpdateShow();
 
 		m_tableLayout->Add(pItem);
+
+		m_table_items.push_back(pItem);
 		
 		m_table_num++;
 	}
@@ -329,6 +338,11 @@ void CZhengcanPageUI::DoRefreshTable()
 	m_table_mutex.unlock();
 
 	UpdateTablePos();
+
+	if (m_nModel == 2)
+	{
+		ShowZhuanTai();
+	}
 }
 
 void CZhengcanPageUI::UpdateTablePos()
@@ -386,6 +400,20 @@ void CZhengcanPageUI::UpdateTablePos()
 	pFenleiLayoutScroll->SetScrollPos(size);
 
 	m_table_mutex.unlock();
+
+	//更新转台操作栏的位置
+	CHorizontalLayoutUI* pZhuantaiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("zhengcan_zhuantai_layout")));
+
+	CHorizontalLayoutUI* pTypeLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("zhengcan_zhuozi_type_layout")));
+	int nFenleiHeight = pTypeLayout->GetFixedHeight();
+
+	RECT rect;
+	rect.left = (nWidth - 700) / 2;
+	rect.right = rect.left + 700;
+	rect.top = m_nPageHeight - 80 - 30 - nFenleiHeight;
+	rect.bottom = rect.top + 80;
+
+	pZhuantaiLayout->SetPos(rect);
 }
 
 void CZhengcanPageUI::ClickTableAction()
@@ -513,4 +541,43 @@ void CZhengcanPageUI::SetModel(int nModel)
 void CZhengcanPageUI::SetHuantaiTableId(std::string tableId)
 {
 	m_HuantaiTableId = tableId;
+}
+
+void CZhengcanPageUI::ShowZhuanTai()
+{
+	if (m_nModel != 2)
+	{
+		return;
+	}
+
+	for (std::vector<CZhengcanTableItemUI*>::iterator it = m_table_items.begin(); it != m_table_items.end(); it++)
+	{
+		if ((*it)->GetTableId() == m_HuantaiTableId)
+		{
+			(*it)->ShowZhuanchu(true);
+			
+			break;
+		}
+	}
+
+	CHorizontalLayoutUI* pZhuantaiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("zhengcan_zhuantai_layout")));
+	pZhuantaiLayout->SetVisible(true);
+}
+
+void CZhengcanPageUI::CancelZhuanTai()
+{
+	m_nModel = 1;
+
+	for (std::vector<CZhengcanTableItemUI*>::iterator it = m_table_items.begin(); it != m_table_items.end(); it++)
+	{
+		if ((*it)->GetTableId() == m_HuantaiTableId)
+		{
+			(*it)->ShowZhuanchu(false);
+
+			break;
+		}
+	}
+
+	CHorizontalLayoutUI* pZhuantaiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("zhengcan_zhuantai_layout")));
+	pZhuantaiLayout->SetVisible(false);
 }

+ 12 - 0
zhipuzi_pos_windows/page/CZhengcanPageUI.h

@@ -55,10 +55,15 @@ public:
 
 	void ClickTableAction();
 
+	//设置当前桌位的展示模式,1:正常模式 2:换台模式
 	void SetModel(int nModel);
 
+	//设置要进行换台的桌子的ID
 	void SetHuantaiTableId(std::string tableId);
 
+	//进入到转台模式,处理相关的渲染展示
+	void ShowZhuanTai();
+
 private:
 	//执行开台动作,请求服务器
 	bool Kaitai(std::string table_id, std::string renshu);
@@ -68,9 +73,13 @@ private:
 
 	void DoRefreshTable();
 
+	//退出转台模式,回到正常模式
+	void CancelZhuanTai();
+
 private:
 	//当前控件的实际宽度
 	int m_nPageWidth;
+	int m_nPageHeight;
 
 	CHorizontalLayoutUI* m_zhuozitypeLayout;
 	CVerticalLayoutUI* m_tableLayout;
@@ -95,4 +104,7 @@ private:
 
 	//换台模式下,当前转出的桌子ID
 	std::string m_HuantaiTableId;
+
+	//保存所有桌位ITEM
+	std::vector<CZhengcanTableItemUI*> m_table_items;
 };