Browse Source

已经开始做正餐的订单列表了

张洋 3 years ago
parent
commit
4d60096cbc

+ 8 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/dianneiorder_list_page.xml

@@ -13,6 +13,14 @@
 					<Control name="orderlist_diannei_line" height="3" bkcolor="#FF43A947" padding="70,0,70,0"></Control>
 				</VerticalLayout>
 			</HorizontalLayout>
+			
+			<Control height="1" bkcolor="#FFEAEAEA" padding="0,0,0,0"></Control>
+			
+			<HorizontalLayout bkcolor="#FFFFFFFF" height="70">
+				<Button name="orderlist_diandan_btn" text="点单订单" textcolor="#FFFFFFFF" font="2" height="50" width="160" padding="20,10,10,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FF3CB371"></Button>
+				
+				<Button name="orderlist_zhengcan_btn" text="正餐订单" font="2" height="50" width="160" padding="20,10,10,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFECECEC"></Button>
+			</HorizontalLayout>
 
 			<HorizontalLayout>										
 				<VerticalLayout name="orderlist" vscrollbar="true">

+ 20 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_order_item.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window>
+	<ZhengcanOrderItem height="130" bkcolor="#FFFFFFFF" padding="15,15,15,0" borderround="10,10">
+		<HorizontalLayout>
+			<Label float="true" name="zhengcan_order_list_order_num" text="订单号:" pos="10,6,320,36" />		
+			
+			<Label float="true" name="zhengcan_order_list_zhuowei" text="桌位:" pos="10,36,202,66" />
+			<Label float="true" name="zhengcan_order_list_renshu" text="人数:" pos="350,36,600,66" />			
+			
+			<Label float="true" name="zhengcan_order_list_init_date" text="下单时间:" pos="10,66,300,96" />
+			
+			<Label float="true" name="zhengcan_order_list_zhifu_type" text="支付方式:" pos="10,96,400,126" />
+			<Label float="true" name="zhengcan_order_list_price" text="价格:" pos="350,96,500,126" />
+		</HorizontalLayout>
+		
+		<HorizontalLayout width="200">
+			<Button name="zhengcan_order_list_info" float="true" pos="100,6,180,44" 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>
+	</ZhengcanOrderItem>
+</Window>

+ 11 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcan_saomadiancan_wnd.xml

@@ -13,6 +13,16 @@
 		
 		</VerticalLayout>
 		
-		
+		<HorizontalLayout name="loading">
+			<Control></Control>
+			<VerticalLayout width="24">
+				<Control></Control>
+				<HorizontalLayout height="24">
+					<GifAnim bkimage="loading.gif" autosize="true"></GifAnim>
+				</HorizontalLayout>
+				<Control></Control>
+			</VerticalLayout>
+			<Control></Control>
+		</HorizontalLayout>
 	</VerticalLayout>
 </Window>

+ 54 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhengcanorder_list_page.xml

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window>
+	<ZhengcanOrderListPage>
+		<VerticalLayout>
+			<HorizontalLayout height="53" padding="0,0,0,0" bkcolor="#FFFFFFFF">
+				<VerticalLayout width="300" height="53">
+					<Button name="orderlist_waimai" text="外卖订单" font="2" height="50" width="200" padding="50,0,10,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+					<Control name="orderlist_waimai_line" visible="false" height="3" bkcolor="#FF43A947" padding="70,0,70,0"></Control>
+				</VerticalLayout>
+				
+				<VerticalLayout width="300" height="53">
+					<Button name="orderlist_diannei" text="店内订单" textcolor="#FF43A947" font="2" height="50" width="200" padding="50,0,10,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+					<Control name="orderlist_diannei_line" height="3" bkcolor="#FF43A947" padding="70,0,70,0"></Control>
+				</VerticalLayout>
+			</HorizontalLayout>
+			
+			<Control height="1" bkcolor="#FFEAEAEA" padding="0,0,0,0"></Control>
+			
+			<HorizontalLayout bkcolor="#FFFFFFFF" height="70">
+				<Button name="orderlist_diandan_btn" text="点单订单" font="2" height="50" width="160" padding="20,10,10,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFECECEC"></Button>
+				
+				<Button name="orderlist_zhengcan_btn" text="正餐订单" textcolor="#FFFFFFFF" font="2" height="50" width="160" padding="20,10,10,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FF3CB371"></Button>
+			</HorizontalLayout>
+
+			<HorizontalLayout>										
+				<VerticalLayout name="orderlist" vscrollbar="true">
+				
+				</VerticalLayout>
+				
+				<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>
+			
+			<Control height="1" bkcolor="#FFEAEAEA"></Control>
+
+			<HorizontalLayout height="52" bkcolor="#FFFFFFFF" >
+				<Control />
+				<Button name="diannei_order_list_refresh" width="70" height="44" padding="20,4,0,0" text="刷新" textcolor="#FFFFFFFF" />
+				<Button name="diannei_order_list_last" width="70" height="44" padding="20,4,0,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="diannei_order_list_next" width="70" height="44" padding="20,4,0,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="diannei_order_list_page" width="150" height="44" padding="20,4,0,0" />
+			</HorizontalLayout>
+		</VerticalLayout>
+	</ZhengcanOrderListPage>
+</Window>

+ 87 - 0
zhipuzi_pos_windows/control/CZhengcanOrderItemUI.cpp

@@ -0,0 +1,87 @@
+#include "../pch/pch.h"
+#include "CZhengcanOrderItemUI.h"
+
+
+CZhengcanOrderItemUI::CZhengcanOrderItemUI()
+{
+}
+
+
+CZhengcanOrderItemUI::~CZhengcanOrderItemUI()
+{
+}
+
+void CZhengcanOrderItemUI::SetData(rapidjson::Value& orderinfo)
+{
+	m_orderid = orderinfo["order_id"].GetString();
+	m_show_trade_no = orderinfo["show_trade_no"].GetString();
+	m_is_refund = orderinfo["is_refund"].GetString();
+	m_init_time = orderinfo["init_time"].GetString();
+	m_table_name = orderinfo["table_name"].GetString();
+	m_person_num = orderinfo["person_num"].GetString();
+	m_zhifu_type = orderinfo["zhifu_type"].GetString();
+	m_zhifu_name = orderinfo["zhifu_name"].GetString();
+	m_yingshou_price = orderinfo["yingshou_price"].GetString();
+	m_refund_result = orderinfo["refund_result"].GetString();
+
+	std::wstring dingdanhao_show = L"订单号:" + CLewaimaiString::UTF8ToUnicode(m_show_trade_no);
+	this->FindSubControl(L"zhengcan_order_list_order_num")->SetText(dingdanhao_show.c_str());
+
+	std::wstring init_date_show = L"下单时间:" + CLewaimaiString::UTF8ToUnicode(m_init_time);
+	this->FindSubControl(L"zhengcan_order_list_init_date")->SetText(init_date_show.c_str());
+
+	std::wstring table_name_show = L"桌位:" + CLewaimaiString::UTF8ToUnicode(m_table_name);
+	this->FindSubControl(L"zhengcan_order_list_zhuowei")->SetText(table_name_show.c_str());
+
+	std::wstring person_num_show = L"人数:" + CLewaimaiString::UTF8ToUnicode(m_person_num);
+	this->FindSubControl(L"zhengcan_order_list_renshu")->SetText(person_num_show.c_str());
+
+	std::wstring price_show = L"价格:" + CLewaimaiString::UTF8ToUnicode(m_yingshou_price);
+	this->FindSubControl(L"zhengcan_order_list_price")->SetText(price_show.c_str());
+
+	std::wstring zhifu_name;
+
+	if (m_zhifu_type == "0")
+	{
+		zhifu_name = L"现金支付";
+	}
+	else if (m_zhifu_type == "1")
+	{
+		zhifu_name = L"微信支付";
+	}
+	else if (m_zhifu_type == "2")
+	{
+		zhifu_name = L"支付宝";
+	}
+	else if (m_zhifu_type == "3")
+	{
+		zhifu_name = L"刷卡支付";
+	}
+	else if (m_zhifu_type == "4")
+	{
+		zhifu_name = L"会员余额";
+	}
+	else if (m_zhifu_type == "5")
+	{
+		zhifu_name = CLewaimaiString::UTF8ToUnicode(m_zhifu_name);
+	}
+	else if (m_zhifu_type == "6")
+	{
+		zhifu_name = L"购物卡支付";
+	}
+	else if (m_zhifu_type == "8")
+	{
+		zhifu_name = L"美食城卡支付";
+	}
+	else if (m_zhifu_type == "9")
+	{
+		zhifu_name = L"云闪付";
+	}
+	else if (m_zhifu_type == "10")
+	{
+		zhifu_name = L"福利卡支付";
+	}
+
+	std::wstring zhifufangshi_show = L"支付方式:" + zhifu_name;
+	this->FindSubControl(L"zhengcan_order_list_zhifu_type")->SetText(zhifufangshi_show.c_str());
+}

+ 40 - 0
zhipuzi_pos_windows/control/CZhengcanOrderItemUI.h

@@ -0,0 +1,40 @@
+#pragma once
+
+#include "../pch/pch.h"
+
+class CZhengcanOrderItemUI : public CHorizontalLayoutUI
+{
+public:
+	CZhengcanOrderItemUI();
+	~CZhengcanOrderItemUI();
+
+	void SetData(rapidjson::Value& orderinfo);
+
+	std::string getOrderID()
+	{
+		return m_orderid;
+	}
+
+	void DoEvent(TEventUI& event)
+	{
+		if (event.Type == UIEVENT_BUTTONDOWN)
+		{
+			int a = 1;
+		}
+		CHorizontalLayoutUI::DoEvent(event);
+	}
+
+private:
+	std::string m_orderid;
+	std::string m_show_trade_no;
+	std::string m_is_refund;
+	std::string m_init_time;
+	std::string m_table_name;
+	std::string m_person_num;
+
+	//支付方式, 0:现金 1:微信支付 2:支付宝 3:刷卡 4:会员余额 5:自定义支付方式
+	std::string m_zhifu_type;
+	std::string m_zhifu_name;
+	std::string m_yingshou_price;
+	std::string m_refund_result;
+};

+ 10 - 0
zhipuzi_pos_windows/control/ControlEx.h

@@ -20,6 +20,7 @@
 #include "../page/CShangpinCreatePageUI.h"
 #include "../page/CShangpinUpdatePageUI.h"
 #include "../page/CZhengcanDiandanPageUI.h"
+#include "../page/CZhengcanOrderListPageUI.h"
 
 #include "CWaimaiOrderItemUI.h"
 #include "CDianneiOrderItemUI.h"
@@ -29,6 +30,7 @@
 #include "CShangpinFoodItemUI.h"
 #include "CTabletypeOptionUI.h"
 #include "CZhengcanTableItemUI.h"
+#include "CZhengcanOrderItemUI.h"
 
 class CDialogBuilderCallbackEx : public IDialogBuilderCallback
 {
@@ -108,6 +110,10 @@ public:
 		{
 			return new CZhengcanDiandanPageUI;
 		}
+		else if (_tcscmp(pstrClass, _T("ZhengcanOrderListPage")) == 0)
+		{
+			return new CZhengcanOrderListPageUI;
+		}
 
 		//控件相关的
 		else if (_tcscmp(pstrClass, _T("WaimaiOrderItem")) == 0)
@@ -142,6 +148,10 @@ public:
 		{
 			return new CZhengcanTableItemUI;
 		}
+		else if (_tcscmp(pstrClass, _T("ZhengcanOrderItem")) == 0)
+		{
+			return new CZhengcanOrderItemUI;
+		}
 
 		return NULL;
 	}

+ 2 - 0
zhipuzi_pos_windows/helper/define.h

@@ -14,6 +14,8 @@
 #define WM_LOGIN_AGAIN_OUT 10009
 #define WM_LOGIN_START_INIT_DATA 10010
 
+#define WM_ZHENGCAN_SAOMADIANCAI_XIADAN 10011
+
 //收款支付相关
 #define WM_SHOUKUAN_STATUS_NEEDPASSWORD 10100
 #define WM_SHOUKUAN_STATUS_SUCCESS 10101

+ 4 - 0
zhipuzi_pos_windows/page/CDianneiOrderListPageUI.cpp

@@ -67,6 +67,10 @@ void CDianneiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 	{
 		m_pMainWnd->SwitchPage(CMainWnd::DINGDAN);
 	}
+	else if (name == L"orderlist_zhengcan_btn")
+	{
+		m_pMainWnd->SwitchPage(CMainWnd::ZHENGCANDINGDAN);
+	}
 }
 
 //´¦ÀíoptionÇл»Ê¼þ

+ 7 - 0
zhipuzi_pos_windows/page/CZhengcanDiandanPageUI.cpp

@@ -3282,6 +3282,13 @@ void CZhengcanDiandanPageUI::ClickRenshu()
 
 void CZhengcanDiandanPageUI::ClickYulan()
 {
+	if (m_cur_diandan_order.m_order_history_array.size() == 0)
+	{
+		m_pMainWnd->ShowToast(L"您还没有下单,请先下单再打印预览单");
+
+		return;
+	}
+
 	//处理打印
 	CZhengcanOrder order = this->GetPrintOrderinfoYulan();
 

+ 302 - 0
zhipuzi_pos_windows/page/CZhengcanOrderListPageUI.cpp

@@ -0,0 +1,302 @@
+#include "../pch/pch.h"
+#include "CZhengcanOrderListPageUI.h"
+
+#include "../control/CZhengcanOrderItemUI.h"
+
+#include "../control/ControlEx.h"
+
+#include "../wnd/CWaimaiOrderFailReasonWnd.h"
+
+#include "../print/CPosPrinter.h"
+
+#include "../wnd/CMainWnd.h"
+
+CZhengcanOrderListPageUI::CZhengcanOrderListPageUI()
+{
+
+}
+
+
+CZhengcanOrderListPageUI::~CZhengcanOrderListPageUI()
+{
+}
+
+//初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
+void CZhengcanOrderListPageUI::InitShow()
+{
+	SetPage(1);
+	Refresh();
+}
+
+//处理按钮点击类事件
+void CZhengcanOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+
+	if (name == _T("diannei_order_list_print"))
+	{
+		CDianneiOrderItemUI* item = static_cast<CDianneiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
+		std::string diannei_order_id = item->getOrderID();
+
+		CPosPrinter printer;
+		printer.PrintDiandanOrder(diannei_order_id);
+	}
+	else if (name == _T("diannei_order_list_info"))
+	{
+		CDianneiOrderItemUI* item = static_cast<CDianneiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
+		std::string diannei_order_id = item->getOrderID();
+
+		CDianneiOrderInfoPageUI* page = static_cast<CDianneiOrderInfoPageUI*>(m_pMainWnd->GetPage(CMainWnd::DIANNEIINFO));
+		page->m_order_id = diannei_order_id;
+
+		m_pMainWnd->SwitchPage(CMainWnd::DIANNEIINFO);
+	}
+	else if (name == _T("diannei_order_list_last"))
+	{
+		this->LastPage();
+	}
+	else if (name == _T("diannei_order_list_next"))
+	{
+		this->NextPage();
+	}
+	else if (name == _T("diannei_order_list_refresh"))
+	{
+		this->Refresh();
+	}
+	else if (name == L"orderlist_waimai")
+	{
+		m_pMainWnd->SwitchPage(CMainWnd::DINGDAN);
+	}
+	else if (name == L"orderlist_diandan_btn")
+	{
+		m_pMainWnd->SwitchPage(CMainWnd::DIANNEIDINGDAN);
+	}
+}
+
+//处理option切换事件
+void CZhengcanOrderListPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+
+
+}
+
+//处理下拉框、radio的切换事件
+void CZhengcanOrderListPageUI::HandleItemSelectMsg(TNotifyUI& msg)
+{
+
+}
+
+//处理编辑框输入内容改变事件
+void CZhengcanOrderListPageUI::HandleTextChangedMsg(TNotifyUI& msg)
+{
+
+}
+
+//处理扫码枪捕捉到的扫码信息
+void CZhengcanOrderListPageUI::HandleTextCapture(std::string content)
+{
+
+}
+
+bool CZhengcanOrderListPageUI::HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+	if (uMsg == WM_ORDERLIST_REFRESH)
+	{
+		DoRefresh();
+
+		return true;
+	}
+
+	return false;
+}
+
+void CZhengcanOrderListPageUI::Refresh()
+{
+	//开始转菊花
+	CContainerUI* pOrderListLayout = static_cast<CContainerUI*>(this->FindSubControl(_T("orderlist")));
+	pOrderListLayout->SetVisible(false);
+
+	this->FindSubControl(_T("main_orderlist_loading"))->SetVisible(true);
+
+	//启动一个线程,进行网络请求操作
+	ZhengcanOrderListStatus* status = new ZhengcanOrderListStatus;
+	status->m_page = m_page;
+
+	std::thread t(&CZhengcanOrderListPageUI::HandleRefresh, this, status);
+	t.detach();
+}
+
+void CZhengcanOrderListPageUI::HandleRefresh(ZhengcanOrderListStatus* status)
+{
+	std::string url = "/dinnercash/getpayorderlist";
+
+	//请求外卖的未处理订单,直接用当前的page值去请求
+	std::map<string, string> params;
+	params["page"] = to_string(status->m_page);
+	std::string response;
+
+	CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
+
+	//走到这里,网络请求结束了,对比状态是否发生了改变
+	if (status->m_page != m_page)
+	{
+		//用户已经点击了其他状态,这个状态结果无效了,直接返回
+		delete status;
+		return;
+	}
+
+	//将网络返回结果保存起来,等待消息处理重新渲染页面
+	m_response = response;
+
+	::PostMessage(m_pManager->GetPaintWindow(), WM_ORDERLIST_REFRESH, 0, 0);
+
+	delete status;
+}
+
+void CZhengcanOrderListPageUI::DoRefresh()
+{
+	//请求成功之后,清空之前的数据
+	CContainerUI* pOrderListLayout = static_cast<CContainerUI*>(this->FindSubControl(_T("orderlist")));
+	pOrderListLayout->RemoveAll();
+
+	rapidjson::Document document;
+	document.Parse(m_response.c_str());
+
+	if (document.HasParseError())
+	{
+		LOG_INFO("parse response error!");
+		return;
+	}
+
+	if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+	{
+		LOG_INFO("json error!");
+		return;
+	}
+
+	rapidjson::Value& v_errcode = document["errcode"];
+	int errcode = v_errcode.GetInt();
+	if (errcode != 0)
+	{
+		LOG_INFO("response failed! message:" << document["errmsg"].GetString());
+		return;
+	}
+
+	//获得数据成功
+	rapidjson::Value& data = document["data"];
+
+	rapidjson::Value& v_count = data["count"];
+	string count = v_count.GetString();
+
+	//处理页数
+	int nCount = atoi(count.c_str());
+	m_total_page = (int)ceil(nCount / 20.0);
+	if (m_total_page < 1)
+	{
+		m_total_page = 1;
+	}
+
+	if (m_page <= 1)
+	{
+		m_page = 1;
+		CButtonUI* pControl = static_cast<CButtonUI*>(this->FindSubControl(_T("diannei_order_list_last")));
+		pControl->SetEnabled(false);
+	}
+	if (m_page >= m_total_page)
+	{
+		m_page = m_total_page;
+		CButtonUI* pControl = static_cast<CButtonUI*>(this->FindSubControl(_T("diannei_order_list_next")));
+		pControl->SetEnabled(false);
+	}
+
+	if (m_page > 1)
+	{
+		CButtonUI* pControl = static_cast<CButtonUI*>(this->FindSubControl(_T("diannei_order_list_last")));
+		pControl->SetEnabled(true);
+	}
+	if (m_page < m_total_page)
+	{
+		CButtonUI* pControl = static_cast<CButtonUI*>(this->FindSubControl(_T("diannei_order_list_next")));
+		pControl->SetEnabled(true);
+	}
+
+	CLabelUI* pControl = static_cast<CLabelUI*>(this->FindSubControl(_T("diannei_order_list_page")));
+	wstring pageinfo = _T("第 ") + CLewaimaiString::ANSIToUnicode(to_string(m_page)) + _T("页/共 ") + CLewaimaiString::ANSIToUnicode(to_string(m_total_page)) + _T("页");
+	pControl->SetText(pageinfo.c_str());
+
+	rapidjson::Value& v_rows = data["rows"];
+
+	for (rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
+	{
+		rapidjson::Value& v_row_i = v_rows[i];
+
+		//创建一个对象
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+
+		CZhengcanOrderItemUI* pItem = static_cast<CZhengcanOrderItemUI*>(builder.Create(_T("zhengcan_order_item.xml"), (UINT)0, &cb, m_pManager));
+		if (pItem != NULL)
+		{
+			//初始化该对应的数据
+			pItem->SetData(v_row_i);
+
+			pOrderListLayout->Add(pItem);
+
+			pItem = NULL;
+		}
+		else
+		{
+			LOG_INFO("create diannei_order_item fail!");
+		}
+	}
+
+	//重置滚动条的位置
+	tagSIZE size;
+	size.cx = 0;
+	size.cy = 0;
+	pOrderListLayout->SetScrollPos(size);
+
+	pOrderListLayout->SetVisible(true);
+
+	this->FindSubControl(_T("main_orderlist_loading"))->SetVisible(false);
+}
+
+void CZhengcanOrderListPageUI::LastPage()
+{
+	m_page--;
+	if (m_page < 1)
+	{
+		m_page = 1;
+	}
+
+	if (m_page == 1)
+	{
+		CButtonUI* pControl = static_cast<CButtonUI*>(this->FindSubControl(_T("diannei_order_list_last")));
+		pControl->SetEnabled(false);
+	}
+
+	Refresh();
+}
+
+void CZhengcanOrderListPageUI::NextPage()
+{
+	m_page++;
+	if (m_page > m_total_page)
+	{
+		m_page = m_total_page;
+	}
+
+	if (m_page == m_total_page)
+	{
+		CButtonUI* pControl = static_cast<CButtonUI*>(this->FindSubControl(_T("diannei_order_list_next")));
+		pControl->SetEnabled(false);
+	}
+
+	Refresh();
+}
+
+void CZhengcanOrderListPageUI::SetPage(int n)
+{
+	m_page = n;
+}

+ 60 - 0
zhipuzi_pos_windows/page/CZhengcanOrderListPageUI.h

@@ -0,0 +1,60 @@
+#pragma once
+
+#include "../pch/pch.h"
+
+#include "CBasePageUI.h"
+
+class ZhengcanOrderListStatus
+{
+public:
+	int m_page;
+};
+
+class CZhengcanOrderListPageUI : public CBasePageUI
+{
+public:
+	CZhengcanOrderListPageUI();
+	~CZhengcanOrderListPageUI();
+
+	//初始化当前页面的展示,处理默认展示效果,在页面每次被选中加载(注意不是页面创建构造)的时候调用,如果多次选中会多次调用,这里要避免数据重复处理
+	void InitShow();
+
+	//处理按钮点击类事件
+	void HandleClickMsg(TNotifyUI& msg);
+
+	//处理option切换事件
+	void HandleSelectChangeMsg(TNotifyUI& msg);
+
+	//处理下拉框、radio的切换事件
+	void HandleItemSelectMsg(TNotifyUI& msg);
+
+	//处理编辑框输入内容改变事件
+	void HandleTextChangedMsg(TNotifyUI& msg);
+
+	//处理扫码枪捕捉到的扫码信息
+	void HandleTextCapture(std::string content);
+
+	//处理自定义消息,各个页面处理各个页面自己的(是自己处理的消息返回true,不是自己处理的消息返回false)
+	bool HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+	//刷新当前页面的内容,注意这个函数不会改变当前的订单状态以及“页数”
+	void Refresh();
+
+	void LastPage();
+
+	void NextPage();
+
+	void SetPage(int n);
+
+	void HandleRefresh(ZhengcanOrderListStatus* status);
+
+	void DoRefresh();
+
+private:
+	int m_page = 1;
+
+	int m_total_page; //总页数
+
+	std::string m_response;
+};
+

+ 18 - 0
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -400,6 +400,17 @@ bool CMainWnd::HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 
 		return true;
 	}
+	else if (uMsg == WM_ZHENGCAN_SAOMADIANCAI_XIADAN)
+	{
+		//正餐扫码下单加菜
+		if (m_curPageName == ZHENGCAN)
+		{
+			CZhengcanPageUI* zhengcanPage = static_cast<CZhengcanPageUI*>(this->GetPage(ZHENGCAN));
+			zhengcanPage->RefreshTableShow();
+		}
+
+		return true;
+	}
 	else
 	{
 		//走到这里,说明消息还没有被处理,那就不是MainWnd自己要处理的消息,应该是自定义的消息,交给各个子页面自己处理去
@@ -1395,6 +1406,13 @@ void CMainWnd::CreatePages()
 		m_pages[ZHENGCANDIANDAN] = pChildContainer;
 	}
 
+	{
+		CDialogBuilder builder;
+		CDialogBuilderCallbackEx cb;
+		pChildContainer = static_cast<CBasePageUI*>(builder.Create(_T("zhengcanorder_list_page.xml"), (UINT)0, &cb, &m_pm));
+		m_pages[ZHENGCANDINGDAN] = pChildContainer;
+	}
+
 	//这里纯粹只是创建对象,不做任何初始化等处理
 }
 

+ 2 - 0
zhipuzi_pos_windows/wnd/CMainWnd.h

@@ -33,6 +33,8 @@ public:
 		CAIGOU, //采购
 		KUCUN, //库存
 		ZHENGCANDIANDAN, //正餐点单
+		ZHENGCANDINGDAN, //正餐订单列表
+		ZHENGCANINFO, //正餐订单详情
 	};
 
     LPCTSTR GetWindowClassName() const

+ 156 - 0
zhipuzi_pos_windows/wnd/CZhengcanSaomadiancanWnd.cpp

@@ -3,6 +3,10 @@
 
 #include "../page/CDiandanPageUI.h"
 
+#include "../print/CPosPrinter.h"
+
+#include "../page/CZhengcanPageUI.h"
+
 LRESULT CZhengcanSaomadiancanWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
 	POINT pt;
@@ -182,6 +186,12 @@ void CZhengcanSaomadiancanWnd::Init()
 
 void CZhengcanSaomadiancanWnd::RefreshOrder()
 {
+	//开始转菊花
+	CVerticalLayoutUI* pTableLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("zhengcan_saomadiancan_wnd_layout")));
+	pTableLayout->SetVisible(false);
+
+	m_pm.FindControl(_T("loading"))->SetVisible(true);
+
 	std::thread t(&CZhengcanSaomadiancanWnd::DoRefreshOrder, this);
 	t.detach();
 }
@@ -326,6 +336,11 @@ void CZhengcanSaomadiancanWnd::DoRefreshOrder()
 	}
 
 	m_is_wangluoqingqiu = false;
+
+	CVerticalLayoutUI* pTableLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("zhengcan_saomadiancan_wnd_layout")));
+	pTableLayout->SetVisible(true);
+
+	m_pm.FindControl(_T("loading"))->SetVisible(false);
 }
 
 void CZhengcanSaomadiancanWnd::SetTitle(std::wstring title)
@@ -336,10 +351,151 @@ void CZhengcanSaomadiancanWnd::SetTitle(std::wstring title)
 
 void CZhengcanSaomadiancanWnd::QuerenOrder(std::string order_id, std::string jiacai_no)
 {
+	m_order_id = order_id;
+	m_jiacai_no = jiacai_no;
+
+	//开始转菊花
+	CVerticalLayoutUI* pTableLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("zhengcan_saomadiancan_wnd_layout")));
+	pTableLayout->SetVisible(false);
+
+	m_pm.FindControl(_T("loading"))->SetVisible(true);
 
+	std::thread t(&CZhengcanSaomadiancanWnd::DoQuerenOrder, this);
+	t.detach();
+}
+
+void CZhengcanSaomadiancanWnd::DoQuerenOrder()
+{
+	m_is_wangluoqingqiu = true;
+
+	//请求服务器获取所有未处理的订单信息
+	std::map<string, string> params;
+
+	params["order_id"] = m_order_id;
+	params["jiacai_no"] = m_jiacai_no;
+	params["item"] = "";
+
+	std::string response;
+
+	std::string url = "/dinnercash/takenothandleorder";
+	bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
+	if (ret == false)
+	{
+		m_is_wangluoqingqiu = false;
+
+		return;
+	}
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		m_is_wangluoqingqiu = false;
+		LOG_INFO("parse response error!");
+		return;
+	}
+
+	if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+	{
+		m_is_wangluoqingqiu = false;
+		LOG_INFO("json error!");
+		return;
+	}
+
+	rapidjson::Value& v_errcode = document["errcode"];
+	int errcode = v_errcode.GetInt();
+	if (errcode != 0)
+	{
+		m_is_wangluoqingqiu = false;
+		return;
+	}
+
+	if (!document.HasMember("data"))
+	{
+		m_is_wangluoqingqiu = false;
+		return;
+	}
+
+	rapidjson::Value& data = document["data"];
+
+	//确认成功,先进行打印
+	CPosPrinter printer;
+	printer.PrintZhengcanOrderXiadan(m_order_id, m_jiacai_no);
+
+	DoRefreshOrder();
 }
 
 void CZhengcanSaomadiancanWnd::JujueOrder(std::string order_id, std::string jiacai_no)
 {
+	m_order_id = order_id;
+	m_jiacai_no = jiacai_no;
+
+	//开始转菊花
+	CVerticalLayoutUI* pTableLayout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("zhengcan_saomadiancan_wnd_layout")));
+	pTableLayout->SetVisible(false);
+
+	m_pm.FindControl(_T("loading"))->SetVisible(true);
+
+	std::thread t(&CZhengcanSaomadiancanWnd::DoJujueOrder, this);
+	t.detach();
+}
+void CZhengcanSaomadiancanWnd::DoJujueOrder()
+{
+	m_is_wangluoqingqiu = true;
+
+	//请求服务器获取所有未处理的订单信息
+	std::map<string, string> params;
+
+	params["order_id"] = m_order_id;
+	params["jiacai_no"] = m_jiacai_no;
+
+	std::string response;
+
+	std::string url = "/dinnercash/clearorderitem";
+	bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
+	if (ret == false)
+	{
+		m_is_wangluoqingqiu = false;
+
+		return;
+	}
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		m_is_wangluoqingqiu = false;
+		LOG_INFO("parse response error!");
+		return;
+	}
+
+	if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+	{
+		m_is_wangluoqingqiu = false;
+		LOG_INFO("json error!");
+		return;
+	}
+
+	rapidjson::Value& v_errcode = document["errcode"];
+	int errcode = v_errcode.GetInt();
+	if (errcode != 0)
+	{
+		m_is_wangluoqingqiu = false;
+		return;
+	}
+
+	if (!document.HasMember("data"))
+	{
+		m_is_wangluoqingqiu = false;
+		return;
+	}
+
+	rapidjson::Value& data = document["data"];
+
+	//拒绝了之后,要刷新桌位
+	m_pageUI->RefreshTableShow();
 
+	DoRefreshOrder();
 }

+ 6 - 0
zhipuzi_pos_windows/wnd/CZhengcanSaomadiancanWnd.h

@@ -78,8 +78,10 @@ public:
 	}
 
 	void QuerenOrder(std::string order_id, std::string jiacai_no);
+	void DoQuerenOrder();
 
 	void JujueOrder(std::string order_id, std::string jiacai_no);
+	void DoJujueOrder();
 
 public:
 	CPaintManagerUI m_pm;
@@ -87,4 +89,8 @@ public:
 	CZhengcanPageUI* m_pageUI;
 
 	bool m_is_wangluoqingqiu = false;
+
+	//正在处理确认或者作废的相关信息
+	std::string m_order_id;
+	std::string m_jiacai_no;
 };

+ 3 - 0
zhipuzi_pos_windows/worker/CMessagePushWorker.cpp

@@ -304,6 +304,9 @@ void CMessagePushWorker::HandelMessage(std::string msg)
 	else if (type == MESSAGE_TYPE::NEW_ZHENGCAN_H5_JIACAI)
 	{
 		CVoiceWorker::GetInstance()->AddVoice(6);
+
+		//同时自动刷新桌位
+		PostMessage(m_hwnd, WM_ZHENGCAN_SAOMADIANCAI_XIADAN, 0, 0);
 	}
 	else if (type == MESSAGE_TYPE::NEW_ZHENGCAN_TUICAI)
 	{

+ 4 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -229,6 +229,8 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClInclude Include="control\CZhengcanOrderItemUI.h" />
+    <ClInclude Include="page\CZhengcanOrderListPageUI.h" />
     <ClInclude Include="wnd\CZhengcanSaomadiancanWnd.h" />
     <ClInclude Include="wnd\CAttentionWnd.h" />
     <ClInclude Include="control\CTabletypeOptionUI.h" />
@@ -337,6 +339,8 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CSystem.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="control\CZhengcanOrderItemUI.cpp" />
+    <ClCompile Include="page\CZhengcanOrderListPageUI.cpp" />
     <ClCompile Include="wnd\CZhengcanSaomadiancanWnd.cpp" />
     <ClCompile Include="wnd\CAttentionWnd.cpp" />
     <ClCompile Include="control\CTabletypeOptionUI.cpp" />

+ 12 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -333,6 +333,12 @@
     <ClInclude Include="wnd\CZhengcanSaomadiancanWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="page\CZhengcanOrderListPageUI.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="control\CZhengcanOrderItemUI.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -626,6 +632,12 @@
     <ClCompile Include="wnd\CZhengcanSaomadiancanWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="page\CZhengcanOrderListPageUI.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="control\CZhengcanOrderItemUI.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">