张洋 před 4 roky
rodič
revize
1e145bb17e

+ 5 - 4
bin/Win32/Debug/zhipuzi_pos_windows/skin/baobiao_page.xml

@@ -3,27 +3,28 @@
 	<Font id="0" name="微软雅黑" size="26" />
 	<Font id="1" name="微软雅黑" size="32" />
 	<Font id="2" name="微软雅黑" size="20" />
+	<Font id="3" name="微软雅黑" size="18" />
 	
 	<BaobiaoPage>
 		<VerticalLayout>
 			<HorizontalLayout height="53" padding="0,0,0,0" bkcolor="#FFFFFFFF">
 				<VerticalLayout width="100" height="53">
-					<Button name="btn_jintian" text="今天" textcolor="#FF43A947" font="2" height="50" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+					<Button name="btn_jintian" text="今天" textcolor="#FF43A947" font="3" height="50" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
 					<Control name="btn_jintian_line" width="60" height="3" bkcolor="#FF43A947" padding="20,0,20,0"></Control>
 				</VerticalLayout>
 				
 				<VerticalLayout width="100" height="53">
-					<Button name="btn_zuotian" text="昨天" font="2" height="50" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+					<Button name="btn_zuotian" text="昨天" font="3" height="50" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
 					<Control name="btn_zuotian_line" visible="false" width="60" height="3" bkcolor="#FF43A947" padding="20,0,20,0"></Control>
 				</VerticalLayout>
 				
 				<VerticalLayout width="100" height="53">
-					<Button name="btn_qitian" text="最近7天" font="2" height="50" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+					<Button name="btn_qitian" text="最近7天" font="3" height="50" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
 					<Control name="btn_qitian_line" visible="false" width="60" height="3" bkcolor="#FF43A947" padding="20,0,20,0"></Control>
 				</VerticalLayout>
 				
 				<VerticalLayout width="100" height="53">
-					<Button name="btn_sanshitian" text="最近30天" font="2" height="50" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
+					<Button name="btn_sanshitian" text="最近30天" font="3" height="50" width="100" padding="0,0,0,0" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
 					<Control name="btn_sanshitian_line" visible="false" width="60" height="3" bkcolor="#FF43A947" padding="20,0,20,0"></Control>
 				</VerticalLayout>
 			</HorizontalLayout>

+ 106 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/jiaoban_page.xml

@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window>
+	<Font id="0" name="微软雅黑" size="26" />
+	<Font id="1" name="微软雅黑" size="32" />
+	<Font id="2" name="微软雅黑" size="20" />
+	
+	<JiaobanPage>
+		<VerticalLayout>
+			<VerticalLayout name="data_layout" visible="false">
+				<HorizontalLayout height="180" padding="20,20,20,0" bkcolor="#FFFFFFFF">
+				
+				</HorizontalLayout>
+				
+				<VerticalLayout height="180" padding="0,30,0,0">
+					<Label text="营业概况" font="2" padding="20,0,0,0"></Label>
+					
+					<HorizontalLayout>					
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="waimai_num" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="外卖订单数量" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="waimai_value" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="外卖营业额" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="diannei_num" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="店内订单数量" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="diannei_value" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="店内营业额" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="huiyuan_num" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="新增会员数量" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="huiyuan_value" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="会员储值金额" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+					</HorizontalLayout>
+				</VerticalLayout>
+				
+				<VerticalLayout height="180" padding="0,30,0,0">
+					<Label text="资金概况" font="2" padding="20,0,0,0"></Label>
+					
+					<HorizontalLayout>					
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="waimai_num" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="店内退款订单数" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="waimai_value" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="店内退款订单金额" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="diannei_num" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="店内订单优惠金额" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+					</HorizontalLayout>
+				</VerticalLayout>
+				
+				<VerticalLayout height="180" padding="0,30,0,0">
+					<Label text="现金概况" font="2" padding="20,0,0,0"></Label>
+					
+					<HorizontalLayout>					
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="waimai_num" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="店内订单现金收入" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="waimai_value" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="店内订单现金退款" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+						
+						<VerticalLayout bkcolor="#FFFFFFFF" width="240" height="126" padding="20,15,0,0">
+							<Label name="diannei_num" text="" font="2" padding="20,25,0,0"></Label>
+							<Label text="现金净增长" padding="20,15,0,0" textcolor="#FF777777"></Label>
+						</VerticalLayout>
+					</HorizontalLayout>
+				</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>
+		</VerticalLayout>
+	</JiaobanPage>
+</Window>

+ 5 - 0
zhipuzi_pos_windows/control/ControlEx.h

@@ -10,6 +10,7 @@
 #include "../page/CSettingPageUI.h"
 #include "../page/CHuiyuanPageUI.h"
 #include "../page/CBaobiaoPageUI.h"
+#include "../page/CJiaobanPageUI.h"
 
 #include "CWaimaiOrderItemUI.h"
 #include "CDianneiOrderItemUI.h"
@@ -55,6 +56,10 @@ public:
 		{
 			return new CBaobiaoPageUI;
 		}
+		else if (_tcscmp(pstrClass, _T("JiaobanPage")) == 0)
+		{
+			return new CJiaobanPageUI;
+		}
 
 		//控件相关的
 		else if (_tcscmp(pstrClass, _T("WaimaiOrderItem")) == 0)

+ 153 - 0
zhipuzi_pos_windows/page/CJiaobanPageUI.cpp

@@ -0,0 +1,153 @@
+#include "../pch/pch.h"
+#include "CJiaobanPageUI.h"
+
+#include "../wnd/CHuiyuanChongzhiWnd.h"
+#include "../wnd/CHuiyuanAddWnd.h"
+
+CJiaobanPageUI::CJiaobanPageUI()
+{
+
+}
+
+CJiaobanPageUI::~CJiaobanPageUI()
+{
+
+}
+
+//初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
+void CJiaobanPageUI::InitShow()
+{
+	time_t now = time(NULL);
+
+	std::string s_now = CLewaimaiTime::DatetimeToDateString(now);
+
+	m_init_time = s_now + " 00:00:00";
+	m_end_time = s_now + " 23:59:59";
+
+	Refresh();
+}
+
+//处理按钮点击类事件
+void CJiaobanPageUI::HandleClickMsg(TNotifyUI& msg)
+{
+	CDuiString name = msg.pSender->GetName();
+}
+
+//处理option切换事件
+void CJiaobanPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
+{
+
+}
+
+//处理下拉框、radio的切换事件
+void CJiaobanPageUI::HandleItemSelectMsg(TNotifyUI& msg)
+{
+
+}
+
+//处理编辑框输入内容改变事件
+void CJiaobanPageUI::HandleTextChangedMsg(TNotifyUI& msg)
+{
+	DuiLib::CDuiString senderName = msg.pSender->GetName();
+
+	if (senderName == L"huiyuan_page_shoujihao_edit")
+	{
+
+	}
+}
+
+//处理扫码枪捕捉到的扫码信息
+void CJiaobanPageUI::HandleTextCapture(std::string content)
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		m_curModalWnd->HandleTextCapture(content);
+	}
+}
+
+void CJiaobanPageUI::Refresh()
+{
+	//根据当前的起始时间,刷新数据显示
+	//开始转菊花
+	CContainerUI* pOrderListLayout = static_cast<CContainerUI*>(this->FindSubControl(_T("data_layout")));
+	pOrderListLayout->SetVisible(false);
+
+	this->FindSubControl(_T("loading"))->SetVisible(true);
+
+	//启动一个线程,进行网络请求操作
+
+	std::thread t(&CJiaobanPageUI::HandleRefresh, this);
+	t.detach();
+}
+
+void CJiaobanPageUI::HandleRefresh()
+{
+	std::string url = "/analysis/index/statistics/index";
+
+
+	//请求外卖的未处理订单,直接用当前的page值去请求
+	std::map<string, string> params;
+	params["begin_time"] = m_init_time;
+	params["end_time"] = m_end_time;
+	std::string response;
+
+	CZhipuziHttpClient::RequestNew(url.c_str(), params, response);
+
+	rapidjson::Document document;
+	document.Parse(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"];
+
+	std::string waimai_num = to_string(data["today_num"].GetInt());
+	std::string diannei_num = to_string(data["today_num"].GetInt());
+	std::string huiyuan_num = to_string(data["today_member"].GetInt());
+
+	std::string waimai_value = CLewaimaiString::DoubleToString(data["today_money"].GetFloat(), 2);
+	std::string diannei_value = CLewaimaiString::DoubleToString(data["today_money"].GetFloat(), 2);
+	std::string huiyuan_value = CLewaimaiString::DoubleToString(data["today_recharge"].GetFloat(), 2);
+
+	//开始渲染数据
+	CLabelUI* waimainumLabel = static_cast<CLabelUI*>(this->FindSubControl(L"waimai_num"));
+	waimainumLabel->SetText(CLewaimaiString::UTF8ToUnicode(waimai_num).c_str());
+
+	CLabelUI* waimaivalueLabel = static_cast<CLabelUI*>(this->FindSubControl(L"waimai_value"));
+	waimaivalueLabel->SetText(CLewaimaiString::UTF8ToUnicode(waimai_value).c_str());
+
+	CLabelUI* dianneinumLabel = static_cast<CLabelUI*>(this->FindSubControl(L"diannei_num"));
+	dianneinumLabel->SetText(CLewaimaiString::UTF8ToUnicode(diannei_num).c_str());
+
+	CLabelUI* dianneivalueLabel = static_cast<CLabelUI*>(this->FindSubControl(L"diannei_value"));
+	dianneivalueLabel->SetText(CLewaimaiString::UTF8ToUnicode(diannei_value).c_str());
+
+	CLabelUI* huiyuannumLabel = static_cast<CLabelUI*>(this->FindSubControl(L"huiyuan_num"));
+	huiyuannumLabel->SetText(CLewaimaiString::UTF8ToUnicode(huiyuan_num).c_str());
+
+	CLabelUI* huiyuanvalueLabel = static_cast<CLabelUI*>(this->FindSubControl(L"huiyuan_value"));
+	huiyuanvalueLabel->SetText(CLewaimaiString::UTF8ToUnicode(huiyuan_value).c_str());
+
+	CContainerUI* pOrderListLayout = static_cast<CContainerUI*>(this->FindSubControl(_T("data_layout")));
+	pOrderListLayout->SetVisible(true);
+
+	this->FindSubControl(_T("loading"))->SetVisible(false);
+}

+ 57 - 0
zhipuzi_pos_windows/page/CJiaobanPageUI.h

@@ -0,0 +1,57 @@
+#pragma once
+
+#include "../pch/pch.h"
+#include "CBasePageUI.h"
+
+#include "../wnd/CModalWnd.h"
+
+class CJiaobanPageUI : public CBasePageUI
+{
+public:
+	CJiaobanPageUI();
+
+	~CJiaobanPageUI();
+
+	//初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
+	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)
+	{
+		return false;
+	}
+
+	void Refresh();
+	void HandleRefresh();
+
+private:
+
+
+private:
+	//是否正在请求服务器
+	bool m_is_handle = false;
+
+	//模态对话框有关的
+	bool m_is_show_modal_wnd = false;
+	CModalWnd* m_curModalWnd;
+
+	std::string m_init_time;
+	std::string m_end_time;
+
+
+};

+ 5 - 1
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -183,6 +183,10 @@ void CMainWnd::SwitchPage(MainPageName name)
 	{
 		pChildContainer = static_cast<CBasePageUI*>(builder.Create(_T("baobiao_page.xml"), (UINT)0, &cb, &m_pm));
 	}
+	else if (name == JIAOBAN)
+	{
+		pChildContainer = static_cast<CBasePageUI*>(builder.Create(_T("jiaoban_page.xml"), (UINT)0, &cb, &m_pm));
+	}
 
 	pChildContainer->SetMainWnd(this);
 	pMainContentLayout->Add(pChildContainer);
@@ -325,7 +329,7 @@ void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
 	}
 	else if (name == L"main_jiaoban")
 	{
-
+		this->SwitchPage(JIAOBAN);
 	}
     else if(name == _T("main_setting"))
     {

+ 2 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -227,6 +227,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClInclude Include="page\CJiaobanPageUI.h" />
     <ClInclude Include="page\CBaobiaoPageUI.h" />
     <ClInclude Include="wnd\CHuiyuanAddWnd.h" />
     <ClInclude Include="wnd\CHuiyuanChongzhiWnd.h" />
@@ -306,6 +307,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CSystem.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="page\CJiaobanPageUI.cpp" />
     <ClCompile Include="page\CBaobiaoPageUI.cpp" />
     <ClCompile Include="wnd\CHuiyuanAddWnd.cpp" />
     <ClCompile Include="wnd\CHuiyuanChongzhiWnd.cpp" />

+ 6 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -246,6 +246,9 @@
     <ClInclude Include="page\CBaobiaoPageUI.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="page\CJiaobanPageUI.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -455,6 +458,9 @@
     <ClCompile Include="page\CBaobiaoPageUI.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="page\CJiaobanPageUI.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">