Przeglądaj źródła

修复一些bug

张洋 3 lat temu
rodzic
commit
31665f0b4c

+ 49 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/num_input_dlg.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window size="700,434" caption="0,0,0,44" roundcorner="4,4" >
+	<Font id="0" name="微软雅黑" size="26" />
+	<Font id="1" name="微软雅黑" size="32" />
+	<Font id="2" name="微软雅黑" size="22" />
+	
+	<VerticalLayout bkimage="shoukuan_bkg.png" >
+		<HorizontalLayout name="dlg_title_bkg" height="44" bkcolor="0xFF3CB371">
+			<Label name="dlg_title" text="" height="44" align="center" valign="center" padding="0,0,0,0" textcolor="#FFFFFFFF" font="2"/>
+			<Button name="closebtn" keyboard="false" padding="0,13,15,0" width="16" height="16" normalimage="file='close_normal.png'" hotimage="file='close_hover.png'" pushedimage="file='close_normal.png'"/>
+		</HorizontalLayout>
+		
+		<HorizontalLayout>
+			<VerticalLayout width="370">
+				<Label name="attention" text="请输入折扣值(1到100之间的整数)" height="30" width="300" padding="30,50,0,0" align="left"/>
+	
+				<HorizontalLayout height="50" padding="0,30,0,0">
+					<Edit name="content" width="250" height="50" padding="30,0,0,0" textcolor="0xFF3CB371" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" font="1"/>
+				</HorizontalLayout>
+				
+				
+				<Label name="errinfo" text=""  height="60" width="250" float="true" pos="30,150,280,290" align="left" textcolor="#FFFF0000" visible="false"/>
+				
+				<HorizontalLayout height="56" valign="center" padding="30,100,0,20">
+					<Button name="save" align="center" text="确认" textcolor="#FFFFFFFF" height="50" width="250" padding="0,0,0,0" normalimage="file='btn_green_zhengchang.png' corner='5,5,5,5'" hotimage="file='btn_green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='btn_green_dianji.png' corner='5,5,5,5'" />
+				</HorizontalLayout>
+			</VerticalLayout>
+			
+			<HorizontalLayout width="330" height="406" bkcolor="#FFF3F3F3">
+				<Button name="jianpan_1" text="1" font="0" heiht="60" width="60" float="true" pos="10,0,110,90" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				<Button name="jianpan_2" text="2" font="0" heiht="60" width="60" float="true" pos="120,0,220,90" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				<Button name="jianpan_3" text="3" font="0" heiht="60" width="60" float="true" pos="230,0,330,90" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				
+				<Button name="jianpan_4" text="4" font="0" heiht="60" width="60" float="true" pos="10,100,110,190" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				<Button name="jianpan_5" text="5" font="0" heiht="60" width="60" float="true" pos="120,100,220,190" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				<Button name="jianpan_6" text="6" font="0" heiht="60" width="60" float="true" pos="230,100,330,190" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				
+				<Button name="jianpan_7" text="7" font="0" heiht="60" width="60" float="true" pos="10,200,110,290" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				<Button name="jianpan_8" text="8" font="0" heiht="60" width="60" float="true" pos="120,200,220,290" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				<Button name="jianpan_9" text="9" font="0" heiht="60" width="60" float="true" pos="230,200,330,290" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				
+				<Button name="jianpan_qingkong" text="清空" font="0" heiht="60" width="60" float="true" pos="10,300,110,390" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				<Button name="jianpan_0" text="0" font="0" heiht="60" width="60" float="true" pos="120,300,220,390" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+				<Button name="jianpan_x" text="X" font="0" heiht="60" width="60" float="true" pos="230,300,330,390" normalimage="file='shuzi_btn_normal.png' corner='5,5,5,5'" hotimage="file='shuzi_btn_hover.png' corner='5,5,5,5'" pushedimage="file='shuzi_btn_push.png' corner='5,5,5,5'"></Button>
+			</HorizontalLayout>
+		</HorizontalLayout>
+		
+	</VerticalLayout>
+</Window>

+ 10 - 8
zhipuzi_pos_windows/control/CZhengcanTableItemUI.cpp

@@ -116,14 +116,6 @@ void CZhengcanTableItemUI::UpdateShow()
 
 			pStatus->SetText(L"待下单");
 		}
-		else if (m_order_status == "OPEN")
-		{
-			//说明已下单,未支付,处于待支付状态,用红色
-			this->SetBkColor(0xFFF95252);
-			pBottom->SetBkColor(0xFFF73F3F);
-
-			pStatus->SetText(L"待结账");
-		}
 		else if (m_order_status == "SUCCESS")
 		{
 			//待清台,用蓝色
@@ -132,6 +124,16 @@ void CZhengcanTableItemUI::UpdateShow()
 
 			pStatus->SetText(L"待清台");
 		}
+		else
+		{
+			//包含OPEN PASSWORD CLOSE等,只要没支付成功,就是未支付状态
+
+			//说明已下单,未支付,处于待支付状态,用红色
+			this->SetBkColor(0xFFF95252);
+			pBottom->SetBkColor(0xFFF73F3F);
+
+			pStatus->SetText(L"待结账");
+		}
 	}
 }
 

+ 104 - 62
zhipuzi_pos_windows/page/CZhengcanDiandanPageUI.cpp

@@ -25,6 +25,7 @@
 #include "../wnd/CChengzhongWnd.h"
 #include "../wnd/CGuadanWnd.h"
 #include "../wnd/CZhengcanRenshuWnd.h"
+#include "../wnd/CNumInputWnd.h"
 
 #include "../print/CPosPrinter.h"
 
@@ -2541,88 +2542,130 @@ void CZhengcanDiandanPageUI::ClickTuicai()
 		return;
 	}
 
-	std::map<string, string> params;
+	//选择退菜人数
+	CNumInputWnd* pNumDlg = new CNumInputWnd();
 
-	params["order_id"] = m_order_id;
-	
-	std::vector<std::map<string, string>> paramArray;
+	if (pNumDlg != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pNumDlg;
 
-	//先添加当前item的退菜参数
-	std::map<string, string> map_tmp;
-	map_tmp["id"] = item_id;
-	map_tmp["quantity"] = "1";
+		pNumDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pNumDlg->SetIcon(IDI_ICON_DUILIB);
+		pNumDlg->CenterWindow();
 
-	paramArray.push_back(map_tmp);
+		pNumDlg->SetTitle(L"退菜");
+		pNumDlg->SetAttention(L"请输入退菜份数");
+		pNumDlg->SetRange(1, 100);
 
-	//再看看是不是套餐,如果是套餐还要添加套餐的
-	CZhengcanOrderItem curItem;
-	bool res = m_cur_diandan_order.GetHistoryItemById(item_id, curItem);
-	if (res == false)
-	{
-		//这个是异常情况
-		LOG_INFO("异常情况,退菜的item_id不存在");
-		return;
-	}
+		UINT ret = pNumDlg->ShowModal();
 
-	if (curItem.m_is_taocan == true)
-	{
-		for (std::vector<CZhengcanOrderItem>::iterator it = curItem.m_taocan_items.begin(); it != curItem.m_taocan_items.end(); it++)
+		if (ret == IDOK)
 		{
+			//这说明人数输入了
+			std::string tuicai_num = pNumDlg->GetNum();
+
+			m_is_show_modal_wnd = false;
+			delete pNumDlg;
+
+			//获得退菜数量,开始真正处理退菜逻辑
+			CZhengcanOrderItem curItem;
+			bool res = m_cur_diandan_order.GetHistoryItemById(item_id, curItem);
+			if (res == false)
+			{
+				//这个是异常情况
+				LOG_INFO("异常情况,退菜的item_id不存在");
+				return;
+			}
+
+			if (atoi(tuicai_num.c_str()) > atoi(curItem.num.c_str()))
+			{
+				m_pMainWnd->ShowToast(L"退菜数量不能大于已点数量");
+				return;
+			}
+
+			std::map<string, string> params;
+
+			params["order_id"] = m_order_id;
+
+			std::vector<std::map<string, string>> paramArray;
+
+			//先添加当前item的退菜参数
 			std::map<string, string> map_tmp;
-			map_tmp["id"] = it->item_id;
-			map_tmp["quantity"] = "1";
+			map_tmp["id"] = item_id;
+			map_tmp["quantity"] = tuicai_num;
 
 			paramArray.push_back(map_tmp);
-		}
-	}
 
-	std::string item_json_string = CLewaimaiJson::ParamArrayToJsonstring(paramArray);
+			//再看看是不是套餐,如果是套餐还要添加套餐的
+			if (curItem.m_is_taocan == true)
+			{
+				for (std::vector<CZhengcanOrderItem>::iterator it = curItem.m_taocan_items.begin(); it != curItem.m_taocan_items.end(); it++)
+				{
+					std::map<string, string> map_tmp;
+					map_tmp["id"] = it->item_id;
+					map_tmp["quantity"] = tuicai_num;
 
-	params["item"] = item_json_string;
+					paramArray.push_back(map_tmp);
+				}
+			}
 
-	std::string response;
+			std::string item_json_string = CLewaimaiJson::ParamArrayToJsonstring(paramArray);
 
-	std::string url = "/dinnercash/retreatfood";
-	bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
-	if (ret == false)
-	{
-		return;
-	}
+			params["item"] = item_json_string;
 
-	rapidjson::Document document;
-	document.Parse(response.c_str());
+			std::string response;
 
-	if (document.HasParseError())
-	{
-		LOG_INFO("parse response error!");
-		return;
-	}
+			std::string url = "/dinnercash/retreatfood";
+			bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
+			if (ret == false)
+			{
+				return;
+			}
 
-	if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
-	{
-		LOG_INFO("json error!");
+			rapidjson::Document document;
+			document.Parse(response.c_str());
 
-		return;
-	}
+			if (document.HasParseError())
+			{
+				LOG_INFO("parse response error!");
+				return;
+			}
 
-	rapidjson::Value& v_errcode = document["errcode"];
-	int errcode = v_errcode.GetInt();
-	if (errcode != 0)
-	{
-		return;
-	}
+			if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+			{
+				LOG_INFO("json error!");
 
-	if (!document.HasMember("data"))
-	{
-		return;
-	}
+				return;
+			}
 
-	rapidjson::Value& data = document["data"];
+			rapidjson::Value& v_errcode = document["errcode"];
+			int errcode = v_errcode.GetInt();
+			if (errcode != 0)
+			{
+				return;
+			}
+
+			if (!document.HasMember("data"))
+			{
+				return;
+			}
 
-	Value& stock = data["stock"];
-	std::string kucun_string = CLewaimaiJson::JsonToString(stock);
+			rapidjson::Value& data = document["data"];
 
-	this->StartWorkAfterTuicai(kucun_string, curItem, 1);
+			Value& stock = data["stock"];
+			std::string kucun_string = CLewaimaiJson::JsonToString(stock);
+
+			this->StartWorkAfterTuicai(kucun_string, curItem, atoi(tuicai_num.c_str()));
+		}
+		else
+		{
+			m_is_show_modal_wnd = false;
+			delete pNumDlg;
+
+			return;
+		}
+	}
 }
 
 void CZhengcanDiandanPageUI::ClickXidanBtn()
@@ -4297,7 +4340,7 @@ CZhengcanOrder CZhengcanDiandanPageUI::GetPrintOrderinfoTuicai(CZhengcanOrderIte
 	CZhengcanOrderItemPrint itemPrint;
 
 	itemPrint.is_tuicai = true;
-	itemPrint.m_quantity = tuicai_num;
+	itemPrint.m_quantity = to_string(tuicai_num);
 	itemPrint.m_item_price = tuicaiItem.price;
 	itemPrint.m_type_id = tuicaiItem.type_id;
 
@@ -4355,7 +4398,6 @@ CZhengcanOrder CZhengcanDiandanPageUI::GetPrintOrderinfoYulan()
 	m_cur_diandan_order.shopname = CShopinfo::GetInstance()->m_shop_name;
 
 	m_cur_diandan_order.order_from = 1;
-	m_cur_diandan_order.init_time = CLewaimaiTime::DatetimeToString(time(NULL));
 
 	m_cur_diandan_order.m_shangpinquan_youhui = CLewaimaiString::DoubleToString(m_shangpinquan_youhui, 2);
 	m_cur_diandan_order.m_cika_youhui = CLewaimaiString::DoubleToString(m_cika_youhui, 2);

+ 13 - 5
zhipuzi_pos_windows/print/CPosPrinterData.cpp

@@ -2135,7 +2135,7 @@ std::string CPosPrinterData::PrintZhengcanOrderXiadanShouyin(CZhengcanOrder& ord
 			setting_printer_xiadanshijian_big = true;
 		}
 
-		string order_date = "下单时间:" + CLewaimaiString::UTF8ToANSI(order.init_time);
+		string order_date = "下单时间:" + CLewaimaiString::UTF8ToANSI(CLewaimaiTime::DatetimeToString(time(NULL)));
 		POS_TextOut(order_date, false, setting_printer_xiadanshijian_big);
 		POS_FeedLine();
 
@@ -2563,7 +2563,7 @@ std::vector<ChufangPrinterContent> CPosPrinterData::PrintZhengcanOrderXiadanChuf
 			POS_TextOut(order_type, false, false, 0);
 			POS_FeedLine();
 
-			string init_time = "下单时间:" + order.init_time;
+			string init_time = "下单时间:" + CLewaimaiTime::DatetimeToString(time(NULL));
 			POS_TextOut(init_time, false, false, 0);
 			POS_FeedLine();
 
@@ -2883,7 +2883,7 @@ std::vector<ChufangPrinterContent> CPosPrinterData::PrintZhengcanOrderTuicaiChuf
 			POS_TextOut(order_type, false, false, 0);
 			POS_FeedLine();
 
-			string init_time = "打印时间:" + order.init_time;
+			string init_time = "退菜时间:" + CLewaimaiTime::DatetimeToString(time(NULL));
 			POS_TextOut(init_time, false, false, 0);
 			POS_FeedLine();
 
@@ -3221,7 +3221,11 @@ std::string CPosPrinterData::PrintZhengcanOrderYulanShouyin(CZhengcanOrder& orde
 			setting_printer_xiadanshijian_big = true;
 		}
 
-		string order_date = "打印时间:" + CLewaimaiString::UTF8ToANSI(order.init_time);
+		string kaitai_date = "开台时间:" + CLewaimaiString::UTF8ToANSI(order.m_kaitai_time);
+		POS_TextOut(kaitai_date, false, setting_printer_xiadanshijian_big);
+		POS_FeedLine();
+
+		string order_date = "打印时间:" + CLewaimaiString::UTF8ToANSI(CLewaimaiTime::DatetimeToString(time(NULL)));
 		POS_TextOut(order_date, false, setting_printer_xiadanshijian_big);
 		POS_FeedLine();
 
@@ -3625,7 +3629,11 @@ std::string CPosPrinterData::PrintZhengcanOrderJiesuanShouyin(CZhengcanOrder& or
 			setting_printer_xiadanshijian_big = true;
 		}
 
-		string order_date = "打印时间:" + CLewaimaiString::UTF8ToANSI(order.init_time);
+		string kaitai_date = "开台时间:" + CLewaimaiString::UTF8ToANSI(order.m_kaitai_time);
+		POS_TextOut(kaitai_date, false, setting_printer_xiadanshijian_big);
+		POS_FeedLine();
+
+		string order_date = "结算时间:" + CLewaimaiString::UTF8ToANSI(CLewaimaiTime::DatetimeToString(time(NULL)));
 		POS_TextOut(order_date, false, setting_printer_xiadanshijian_big);
 		POS_FeedLine();
 

+ 1 - 158
zhipuzi_pos_windows/wnd/CHuiyuanShoukuanWnd.cpp

@@ -597,9 +597,6 @@ LRESULT CHuiyuanShoukuanWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lPar
 	case WM_MOUSEHOVER:
 		lRes = OnMouseMove(uMsg, wParam, lParam, bHandled);
 		break;
-	case WM_SHOUKUAN_STATUS_NEEDPASSWORD:
-		lRes = OnShoukuanNeedPassword(uMsg, wParam, lParam, bHandled);
-		break;
 	case WM_SHOUKUAN_STATUS_SUCCESS:
 		lRes = OnShoukuanSuccess(uMsg, wParam, lParam, bHandled);
 		break;
@@ -704,25 +701,6 @@ void CHuiyuanShoukuanWnd::SetCommonParams(std::map<string, string> params)
 	m_commonParams = params;
 }
 
-LRESULT CHuiyuanShoukuanWnd::OnShoukuanNeedPassword(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
-	wstring path = CSystem::GetProgramDir() + L"\\music\\pay_password.wav";
-
-	if (CSetting::GetInstance()->GetParam("setting_is_new_diannei_voice") == "1")
-	{
-		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
-	}
-
-	CLabelUI* pFukuanEdit = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuan_paying_status")));
-	pFukuanEdit->SetText(L"用户支付中,需要输入密码");
-
-	//需要用户输入密码,开始查询状态
-	std::thread(&CHuiyuanShoukuanWnd::HandleShoukuanPassword, this).detach();
-
-	bHandled = TRUE;
-	return 0;
-}
-
 LRESULT CHuiyuanShoukuanWnd::OnShoukuanSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
 	//播放收款成功的金额
@@ -886,8 +864,7 @@ void CHuiyuanShoukuanWnd::StartClose()
 	}
 	else if (m_shoukuan_status == 2)
 	{
-		//查询密码的过程中,取消付款
-		CancelShoukuanPassword();
+
 	}
 	else if (m_shoukuan_status == 3)
 	{
@@ -1106,13 +1083,6 @@ void CHuiyuanShoukuanWnd::HandleShoukuan()
 
 		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
 	}
-	else if (s_status == "password")
-	{
-		m_shoukuan_status = 2;
-
-		//需要查询支付状态
-		SendMessage(WM_SHOUKUAN_STATUS_NEEDPASSWORD, 0, 0);
-	}
 	else
 	{
 		m_shoukuan_status = 4;
@@ -1123,133 +1093,6 @@ void CHuiyuanShoukuanWnd::HandleShoukuan()
 	}
 }
 
-void CHuiyuanShoukuanWnd::HandleShoukuanPassword()
-{
-	std::map<string, string> params;
-
-	params["trade_no"] = "";
-
-	while (m_shoukuan_status == 2)
-	{
-		std::string response;
-
-		std::string url;
-		if (m_nType == 1)
-		{
-			url = "/diancan/queryorderstatus";
-		}
-		else if (m_nType == 2)
-		{
-			url = "/dinnercash/queryorderstatus";
-		}
-		bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
-		if (ret == false)
-		{
-			m_shoukuan_status = 4;
-
-			m_fail_message = L"请求服务器失败,请检查网络设置!";
-
-			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
-			return;
-		}
-
-		rapidjson::Document document;
-		document.Parse(response.c_str());
-
-		if (document.HasParseError())
-		{
-			LOG_INFO("parse response error!");
-			m_shoukuan_status = 4;
-
-			m_fail_message = L"服务器错误";
-
-			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
-			return;
-		}
-
-		if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
-		{
-			LOG_INFO("json error!");
-			m_shoukuan_status = 4;
-
-			m_fail_message = L"服务器错误";
-
-			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
-			return;
-		}
-
-		rapidjson::Value& v_errcode = document["errcode"];
-		int errcode = v_errcode.GetInt();
-		if (errcode != 0)
-		{
-			LOG_INFO("response failed! message:" << document["errmsg"].GetString());
-			m_shoukuan_status = 4;
-
-			m_fail_message = L"服务器错误";
-
-			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
-			return;
-		}
-
-		rapidjson::Value& data = document["data"];
-		rapidjson::Value& status = data["status"];
-
-		std::string s_status = status.GetString();
-
-		if (s_status == "success")
-		{
-			//支付成功
-			m_shoukuan_status = 3;
-
-			Value& stock = data["stock"];
-			m_kucun_string = CLewaimaiJson::JsonToString(stock);
-			m_show_trade_no = data["show_trade_no"].GetString();
-
-			if (m_nType == 1)
-			{
-				//快餐才有取餐号
-				m_take_food_code = data["take_food_code"].GetString();
-			}
-
-			SendMessage(WM_SHOUKUAN_STATUS_SUCCESS, 0, 0);
-
-			break;
-		}
-		else if (s_status == "closed")
-		{
-			//表示顾客那边出问题,已经失败了
-			m_shoukuan_status = 4;
-
-			m_fail_message = L"顾客取消支付,请重新扫码收款";
-
-			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
-
-			break;
-		}
-		else if (s_status == "fail")
-		{
-			//这个只是表示状态未知
-			Sleep(1000);
-		}
-		else
-		{
-			m_shoukuan_status = 4;
-
-			m_fail_message = L"服务器错误";
-
-			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
-			break;
-		}
-	}
-}
-
-void CHuiyuanShoukuanWnd::CancelShoukuanPassword()
-{
-	m_shoukuan_status = 5;
-
-	std::thread(&CHuiyuanShoukuanWnd::HandleCancelShoukuan, this).detach();
-}
-
 void CHuiyuanShoukuanWnd::HandleCancelShoukuan()
 {
 	std::map<string, string> params;

+ 0 - 8
zhipuzi_pos_windows/wnd/CHuiyuanShoukuanWnd.h

@@ -50,8 +50,6 @@ public:
 
 	LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 
-	LRESULT OnShoukuanNeedPassword(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-
 	LRESULT OnShoukuanSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 
 	LRESULT OnShoukuanFail(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
@@ -75,12 +73,6 @@ public:
 	//处理收款
 	void HandleShoukuan();
 
-	//处理收款的密码查询
-	void HandleShoukuanPassword();
-
-	//取消查询密码
-	void CancelShoukuanPassword();
-
 	//处理取消收款
 	void HandleCancelShoukuan();
 

+ 350 - 0
zhipuzi_pos_windows/wnd/CNumInputWnd.cpp

@@ -0,0 +1,350 @@
+#include "../pch/pch.h"
+#include "CNumInputWnd.h"
+
+LRESULT CNumInputWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	POINT pt;
+	pt.x = GET_X_LPARAM(lParam);
+	pt.y = GET_Y_LPARAM(lParam);
+	::ScreenToClient(*this, &pt);
+
+	RECT rcClient;
+	::GetClientRect(*this, &rcClient);
+
+	RECT rcCaption = m_pm.GetCaptionRect();
+	if (pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
+		&& pt.y >= rcCaption.top && pt.y < rcCaption.bottom)
+	{
+		CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(pt));
+		if (pControl && _tcscmp(pControl->GetClass(), DUI_CTR_BUTTON) != 0)
+		{
+			return HTCAPTION;
+		}
+	}
+
+	return HTCLIENT;
+}
+
+LRESULT CNumInputWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	SIZE szRoundCorner = m_pm.GetRoundCorner();
+	if (!::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0))
+	{
+		CDuiRect rcWnd;
+		::GetWindowRect(*this, &rcWnd);
+		rcWnd.Offset(-rcWnd.left, -rcWnd.top);
+		rcWnd.right++;
+		rcWnd.bottom++;
+		HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
+		::SetWindowRgn(*this, hRgn, TRUE);
+		::DeleteObject(hRgn);
+	}
+
+	bHandled = FALSE;
+	return 0;
+}
+
+LRESULT CNumInputWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+	LRESULT lRes = 0;
+	BOOL bHandled = TRUE;
+	switch (uMsg)
+	{
+	case WM_CREATE:
+		lRes = OnCreate(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCACTIVATE:
+		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCCALCSIZE:
+		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCPAINT:
+		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCHITTEST:
+		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_SIZE:
+		lRes = OnSize(uMsg, wParam, lParam, bHandled);
+		break;
+	default:
+		bHandled = FALSE;
+	}
+	if (bHandled)
+	{
+		return lRes;
+	}
+	if (m_pm.MessageHandler(uMsg, wParam, lParam, lRes))
+	{
+		return lRes;
+	}
+	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
+}
+
+LRESULT CNumInputWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
+{
+	if (uMsg == WM_KEYDOWN)
+	{
+		if (wParam == VK_RETURN)
+		{
+			SaveNum();
+
+			return true;
+		}
+		else if (wParam == VK_ESCAPE)
+		{
+			Close(IDCANCEL);
+
+			return true;
+		}
+	}
+
+	return false;
+}
+
+LRESULT CNumInputWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
+	styleValue &= ~WS_CAPTION;
+	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
+
+	// 把自己的窗口句柄与窗口绘制管理器挂接在一起
+	m_pm.Init(m_hWnd);
+
+	m_pm.AddPreMessageFilter(this);
+
+	CDialogBuilder builder;
+
+	CControlUI* pRoot = builder.Create(_T("num_input_dlg.xml"), (UINT)0, NULL, &m_pm);
+	ASSERT(pRoot && "Failed to parse XML");
+
+	// 把这些控件绘制到本窗口上
+	m_pm.AttachDialog(pRoot);
+
+	// 把自己加入到CPaintManagerUI的m_aNotifiers数组中,用于处理Notify函数
+	m_pm.AddNotifier(this);
+
+	Init();
+
+	return 0;
+}
+
+void CNumInputWnd::Notify(TNotifyUI& msg)
+{
+	if (msg.sType == _T("click"))
+	{
+		DuiLib::CDuiString senderName = msg.pSender->GetName();
+
+		if (senderName == _T("closebtn"))
+		{
+			Close(IDCANCEL);
+			return;
+		}
+		else if (senderName == _T("save"))
+		{
+			SaveNum();
+		}
+		else if (senderName == L"jianpan_1")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"1";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_2")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"2";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_3")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"3";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_4")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"4";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_5")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"5";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_6")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"6";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_7")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"7";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_8")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"8";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_9")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"9";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_0")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason += L"0";
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_x")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason = wsReason.substr(0, wsReason.length() - 1);
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+		else if (senderName == L"jianpan_qingkong")
+		{
+			CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+			wstring wsReason = pContent->GetText();
+
+			wsReason.clear();
+
+			pContent->SetText(wsReason.c_str());
+			pContent->SetFocus();
+		}
+	}
+	else if (msg.sType == _T("textchanged"))
+	{
+		//只能输入数字,其他的全部删除
+		CEditUI* m_pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+		if (!m_pEdit->GetText().IsEmpty())
+		{
+			wstring ws_Value = m_pEdit->GetText();
+			string strValue = CLewaimaiString::UnicodeToUTF8(ws_Value);
+
+			for (size_t nIndex = 0; nIndex < strValue.length(); nIndex++)
+			{
+				unsigned char tmp = strValue.at(nIndex);
+				if (tmp > 57 || tmp < 48)
+				{
+					//ASCII码不是数字的都过滤掉
+					strValue = strValue.substr(0, nIndex);
+
+					m_pEdit->SetText(CLewaimaiString::UTF8ToUnicode(strValue).c_str());
+					m_pEdit->SetSel(strValue.length(), strValue.length());//重设给光标设置位置
+
+					break;
+				}
+			}
+		}
+	}
+	else if (msg.sType == L"windowinit")
+	{
+		m_pm.SetNextTabControl(false);
+
+		CEditUI* pFukuanEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+		pFukuanEdit->SetFocus();
+	}
+}
+
+void CNumInputWnd::Init()
+{
+
+}
+
+void CNumInputWnd::SetTitle(std::wstring title)
+{
+	CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("dlg_title")));
+	pLabel->SetText(title.c_str());
+}
+
+//设置输入提示语的标题
+void CNumInputWnd::SetAttention(std::wstring attention)
+{
+	CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("attention")));
+	pLabel->SetText(attention.c_str());
+}
+
+void CNumInputWnd::SetRange(int min_int, int max_int)
+{
+	m_min_int = min_int;
+	m_max_int = max_int;
+}
+
+void CNumInputWnd::SaveNum()
+{
+	CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
+	wstring wsReason = pContent->GetText();
+
+	m_content = CLewaimaiString::UnicodeToUTF8(wsReason);
+
+	int zhekou = atoi(m_content.c_str());
+	if (zhekou > 100 || zhekou < 1)
+	{
+		CLabelUI* pErrorInfo = static_cast<CLabelUI*>(m_pm.FindControl(_T("errinfo")));
+		pErrorInfo->SetText((L"请输入" + to_wstring(m_min_int) + L"到" + to_wstring(m_max_int) + L"之间的整数").c_str());
+		pErrorInfo->SetVisible(true);
+
+		return;
+	}
+
+	Close(IDOK);
+}
+
+std::string CNumInputWnd::GetNum()
+{
+	return m_content;
+}

+ 97 - 0
zhipuzi_pos_windows/wnd/CNumInputWnd.h

@@ -0,0 +1,97 @@
+#pragma once
+
+#include "../pch/pch.h"
+#include "CMainWnd.h"
+#include "CModalWnd.h"
+
+/**
+ * 封装一个通用的数字输入弹框
+ * 这个类里面不处理任何网络请求逻辑,纯粹的输入返回数字而已
+ */
+
+class CNumInputWnd : public CModalWnd
+{
+public:
+	LPCTSTR GetWindowClassName() const
+	{
+		return _T("UIMemoWndFrame");
+	};
+
+	UINT GetClassStyle() const
+	{
+		return UI_CLASSSTYLE_DIALOG;
+	};
+
+	void OnFinalMessage(HWND /*hWnd*/)
+	{
+		//WindowImplBase::OnFinalMessage(hWnd);
+		m_pm.RemovePreMessageFilter(this);
+
+		//delete this;
+	};
+
+	void Init();
+
+	void Notify(TNotifyUI& msg);
+
+	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+	{
+		if (::IsIconic(*this))
+		{
+			bHandled = FALSE;
+		}
+		return (wParam == 0) ? TRUE : FALSE;
+	}
+
+	LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+	{
+		return 0;
+	}
+
+	LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+	{
+		return 0;
+	}
+
+	LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+	LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
+
+	//设置弹框标题
+	void SetTitle(std::wstring title);
+
+	//设置输入提示语的标题
+	void SetAttention(std::wstring attention);
+
+	//设置允许输入的最大值和最小值
+	void SetRange(int min_int, int max_int);
+
+	void SaveNum();
+
+	std::string GetNum();
+
+	//处理键盘捕捉结果
+	void HandleTextCapture(std::string content)
+	{
+
+	}
+
+public:
+	CPaintManagerUI m_pm;
+
+	std::string m_content;
+
+	std::wstring m_errorInfo;
+
+	int m_min_int;
+	int m_max_int;
+
+	//数字类型 1:只能为整数 2:可以为小数
+	int m_num_type = 1;
+};

+ 2 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -229,6 +229,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClInclude Include="wnd\CNumInputWnd.h" />
     <ClInclude Include="control\CZhengcanOrderItemUI.h" />
     <ClInclude Include="page\CZhengcanOrderInfoPageUI.h" />
     <ClInclude Include="page\CZhengcanOrderListPageUI.h" />
@@ -340,6 +341,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CSystem.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="wnd\CNumInputWnd.cpp" />
     <ClCompile Include="control\CZhengcanOrderItemUI.cpp" />
     <ClCompile Include="page\CZhengcanOrderInfoPageUI.cpp" />
     <ClCompile Include="page\CZhengcanOrderListPageUI.cpp" />

+ 6 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -342,6 +342,9 @@
     <ClInclude Include="page\CZhengcanOrderInfoPageUI.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="wnd\CNumInputWnd.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -644,6 +647,9 @@
     <ClCompile Include="page\CZhengcanOrderInfoPageUI.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="wnd\CNumInputWnd.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">