张洋 4 лет назад
Родитель
Сommit
1d50e1ca4b

BIN
bin/Win32/Debug/zhipuzi_pos_windows/dump/2021-12-04-19-46-57.dmp


BIN
bin/Win32/Debug/zhipuzi_pos_windows/dump/2021-12-04-19-51-16.dmp


+ 99 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/huiyuan_add_wnd.xml

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window size="800,534" caption="0,0,0,44" roundcorner="4,4" >
+	<Font id="0" name="微软雅黑" size="24" />
+	<Font id="1" name="微软雅黑" size="40" />
+	<Font id="2" name="微软雅黑" size="18" />
+	<Font id="3" name="微软雅黑" size="32" />
+	<Font id="4" name="微软雅黑" size="14" />
+	<VerticalLayout bkimage="shoukuan_bkg.png" >
+		<HorizontalLayout name="shoukuan_title_bkg" height="44" bkcolor="0xFF3CB371">
+			<Label name="shoukuan_version" 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" tooltip="关闭" normalimage="file='close_normal.png'" hotimage="file='close_hover.png'" pushedimage="file='close_normal.png'"/>
+		</HorizontalLayout>
+		
+		<HorizontalLayout visible="true" name="shoukuan_before_pay_layout">
+			<VerticalLayout height="520" padding="0,20,0,0">					
+				<HorizontalLayout height="50" padding="0,20,0,0">
+					<Label text="手机号:" font="2" float="true" pos="30,12,180,40"/>
+					<Edit name="phone_edit" float="true" pos="128,12,355,48" normalimage="file='Chat_InputBox_BG.png' corner='4,4,4,4'" hotimage="file='Chat_InputBox_BG_Hover.png' corner='4,4,4,4'" />
+				</HorizontalLayout>
+				
+				<HorizontalLayout height="50" padding="0,35,0,0">
+					<Label text="支付密码:" font="2" float="true" pos="30,12,180,40"/>
+					<Edit name="password_edit" password="true" float="true" pos="128,12,355,48" normalimage="file='Chat_InputBox_BG.png' corner='4,4,4,4'" hotimage="file='Chat_InputBox_BG_Hover.png' corner='4,4,4,4'" />
+				</HorizontalLayout>
+				
+				<HorizontalLayout height="50" padding="0,35,0,0">
+					<Label text="会员名称:" font="2" float="true" pos="30,12,180,40"/>
+					<Edit name="name_edit" float="true" pos="128,12,355,48" normalimage="file='Chat_InputBox_BG.png' corner='4,4,4,4'" hotimage="file='Chat_InputBox_BG_Hover.png' corner='4,4,4,4'" />
+				</HorizontalLayout>
+				
+				<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.png' corner='5,5,5,5'" hotimage="file='Btn_Green_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" />
+				</HorizontalLayout>
+			</VerticalLayout>
+			
+			<HorizontalLayout width="340" 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>
+		
+		<HorizontalLayout height="50" padding="0,20,0,0">
+			<Control></Control>
+			<Label name="shoukuanresult" font="2" width="400" height="50" multiline="true" text="" visible="false" textcolor="#FF0000" align="center" />
+			<Control></Control>
+		</HorizontalLayout>
+		
+		<VerticalLayout name="shoukuan_paying_layout" visible="false">
+			<HorizontalLayout name="shoukuan_paying_loading" height="24" padding="0, 20, 0, 20">
+				<Control></Control>
+				<VerticalLayout width="24">
+					<Control></Control>
+					<HorizontalLayout height="24">
+						<GifAnim bkimage="loading.gif" autosize="true"></GifAnim>
+					</HorizontalLayout>
+					<Control></Control>
+				</VerticalLayout>
+				<Control></Control>
+			</HorizontalLayout>
+			
+			<Label height="40" padding="0,10,0,10" name="shoukuan_paying_money" text="收款金额:" font="3" textcolor="0xFF3CB371" align="center"></Label>
+			
+			<Label height="32" padding="0,10,0,10" name="shoukuan_paying_status" text="请求支付中..." font="2" textcolor="0xFF3CB371" align="center"></Label>
+			
+			<Label height="60" padding="20,30,20,0" name="shouyin_paying_attention" text="如果用户没有支付成功,则请确认客户不再进行支付时再关闭此窗口,按【Esc】取消本次支付" font="2" textcolor="0xFF808080" multiline="true" align="center" />
+		</VerticalLayout>
+		
+		<VerticalLayout name="shoukuan_pay_success_layout" visible="false">			
+			<Label height="40" padding="0,100,0,20" name="shoukuan_pay_success_money" text="成功收款:" font="3" textcolor="0xFF3CB371" align="center"></Label>
+			
+			<Label height="60" padding="20,30,20,0" name="shouyin_pay_success_attention" text="按任意键关闭窗口" font="2" textcolor="0xFF808080" multiline="true" align="center" />
+		</VerticalLayout>
+		
+		<VerticalLayout name="shoukuan_pay_fail_layout" visible="false">
+			<HorizontalLayout height="100" padding="0,20,0,0">
+				<Control></Control>
+				<Control bkimage="pay_fail.png" width="100" height="100" align="center"></Control>
+				<Control></Control>
+			</HorizontalLayout>
+			
+			<Label height="40" padding="0,20,0,20" name="shoukuan_pay_fail_money" text="订单支付失败" font="3" textcolor="0xFFD33E3A" align="center"></Label>
+			
+			<Label height="60" padding="20,30,20,0" name="shouyin_pay_fail_attention" text="" font="2" textcolor="0xFF808080" multiline="true" align="center" />
+		</VerticalLayout>
+    </VerticalLayout>
+</Window>

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

@@ -23,7 +23,7 @@
 				<Control></Control>
 				
 				<HorizontalLayout height="60" width="400" padding="43,0,0,80">
-					<Button name="huiyuan_page_add_btn" width="400" height="60" text="添加会员" textcolor="#FFFFFFFF" normalimage="file='green_zhengchang.png' corner='5,5,5,5'" hotimage="file='green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='green_dianji.png' corner='5,5,5,5'" />
+					<Button name="huiyuan_page_add_btn" width="400" height="60" text="添加会员" textcolor="#FFFFFFFF" normalimage="file='green_zhengchang.png' corner='5,5,5,5'" hotimage="file='green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='green_dianji.png' corner='5,5,5,5'" />
 				</HorizontalLayout>
 			</VerticalLayout>
 			

+ 59 - 2
zhipuzi_pos_windows/page/CHuiyuanPageUI.cpp

@@ -2,6 +2,7 @@
 #include "CHuiyuanPageUI.h"
 
 #include "../wnd/CHuiyuanChongzhiWnd.h"
+#include "../wnd/CHuiyuanAddWnd.h"
 
 CHuiyuanPageUI::CHuiyuanPageUI()
 {
@@ -27,12 +28,21 @@ void CHuiyuanPageUI::HandleClickMsg(TNotifyUI& msg)
 
 	if (name == _T("huiiyuan_page_sousuo_btn"))
 	{
+		//如果是手动点击了,就重置这个搜索手机号
+		CEditUI* m_pEdit = static_cast<CEditUI*>(this->FindSubControl(_T("huiyuan_page_shoujihao_edit")));
+		wstring ws_Value = m_pEdit->GetText();
+		m_sousuo_phone = CLewaimaiString::UnicodeToUTF8(ws_Value);
+
 		StartHuiyuanSousuo();
 	}
 	else if (name == L"huiiyuan_page_chongzhi_btn")
 	{
 		StartHuiyuanChongzhi();
 	}
+	else if (name == L"huiyuan_page_add_btn")
+	{
+		StartAddHuiyuan();
+	}
 }
 
 //处理option切换事件
@@ -61,6 +71,8 @@ void CHuiyuanPageUI::HandleTextChangedMsg(TNotifyUI& msg)
 			wstring ws_Value = m_pEdit->GetText();
 			string strValue = CLewaimaiString::UnicodeToUTF8(ws_Value);
 
+			m_sousuo_phone = strValue;
+
 			for (size_t nIndex = 0; nIndex < strValue.length(); nIndex++)
 			{
 				unsigned char tmp = strValue.at(nIndex);
@@ -69,6 +81,8 @@ void CHuiyuanPageUI::HandleTextChangedMsg(TNotifyUI& msg)
 					//ASCII码不是数字的都过滤掉
 					strValue = strValue.substr(0, nIndex);
 
+					m_sousuo_phone = strValue;
+
 					m_pEdit->SetText(CLewaimaiString::UTF8ToUnicode(strValue).c_str());
 					m_pEdit->SetSel(strValue.length(), strValue.length());//重设给光标设置位置
 
@@ -95,8 +109,7 @@ void CHuiyuanPageUI::StartHuiyuanSousuo()
 		return;
 	}
 
-	CEditUI* m_pEdit = static_cast<CEditUI*>(this->FindSubControl(_T("huiyuan_page_shoujihao_edit")));
-	std::wstring ws_phone = m_pEdit->GetText();
+	std::wstring ws_phone = CLewaimaiString::UTF8ToUnicode(m_sousuo_phone);
 
 	if (ws_phone.length() != 11)
 	{
@@ -189,6 +202,8 @@ void CHuiyuanPageUI::StartHuiyuanSousuo()
 		this->FindSubControl(L"huiyuan_page_no_layout")->SetVisible(false);
 
 		m_is_handle = false;
+
+		HideError();
 	}
 }
 
@@ -203,6 +218,39 @@ void CHuiyuanPageUI::ShowError(std::wstring err)
 	this->FindSubControl(L"huiyuan_page_no_layout")->SetVisible(true);
 }
 
+void CHuiyuanPageUI::StartAddHuiyuan()
+{
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CHuiyuanAddWnd* pShoukuanWnd = new CHuiyuanAddWnd();
+	if (pShoukuanWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pShoukuanWnd;
+
+		pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
+		pShoukuanWnd->CenterWindow();
+
+		UINT ret = pShoukuanWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			//会员开通成功
+			m_pMainWnd->ShowToast(L"会员开通成功");
+
+			m_sousuo_phone = pShoukuanWnd->m_phone;
+
+			StartHuiyuanSousuo();
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pShoukuanWnd;
+	}
+}
+
 void CHuiyuanPageUI::StartHuiyuanChongzhi()
 {
 	if (m_is_show_modal_wnd == true)
@@ -210,6 +258,9 @@ void CHuiyuanPageUI::StartHuiyuanChongzhi()
 		return;
 	}
 
+	//充值之前,保存一下搜索电话,因为充值成功后要刷新的
+	m_sousuo_phone = m_phone;
+
 	CHuiyuanChongzhiWnd* pShoukuanWnd = new CHuiyuanChongzhiWnd();
 	if (pShoukuanWnd != NULL)
 	{
@@ -234,4 +285,10 @@ void CHuiyuanPageUI::StartHuiyuanChongzhi()
 		m_is_show_modal_wnd = false;
 		delete pShoukuanWnd;
 	}
+}
+
+void CHuiyuanPageUI::HideError()
+{
+	CLabelUI* m_pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("errorinfo")));
+	m_pLabel->SetVisible(true);
 }

+ 8 - 0
zhipuzi_pos_windows/page/CHuiyuanPageUI.h

@@ -39,13 +39,21 @@ public:
 private:	
 	void StartHuiyuanSousuo();
 
+	void StartAddHuiyuan();
+
 	void StartHuiyuanChongzhi();
 
 	void ShowError(std::wstring err);
 
+	void HideError();
+
 private:
+	//是否正在请求服务器
 	bool m_is_handle = false;
 
+	//用于搜索的会员手机号
+	std::string m_sousuo_phone;
+
 	//当前搜索出来的会员信息
 	std::string m_phone;
 	std::string m_member_id;

+ 713 - 0
zhipuzi_pos_windows/wnd/CHuiyuanAddWnd.cpp

@@ -0,0 +1,713 @@
+#include "../pch/pch.h"
+#include "CHuiyuanAddWnd.h"
+
+#include "../helper/MD5.h"
+
+LRESULT CHuiyuanAddWnd::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 CHuiyuanAddWnd::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 CHuiyuanAddWnd::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 CHuiyuanAddWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
+{
+	if (uMsg == WM_KEYDOWN)
+	{
+		if (wParam == VK_RETURN)
+		{
+			StartYanzheng();
+
+			return true;
+		}
+		else if (wParam == VK_ESCAPE)
+		{
+			if (m_is_qingqiu == false)
+			{
+				Close(IDCANCEL);
+			}
+
+			return true;
+		}
+	}
+	else if (uMsg == WM_MEMBER_CHECK_SUCCESS)
+	{
+		m_qingqiu_mutex.lock();
+
+		m_is_qingqiu = false;
+
+		m_qingqiu_mutex.unlock();
+
+		//验证成功了
+		Close(IDOK);
+
+		return true;
+	}
+	else if (uMsg == WM_MEMBER_CHECK_FAIL)
+	{
+		//验证失败了
+		CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+		pPhone->SetEnabled(true);
+
+		CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+		pPassword->SetEnabled(true);
+
+		CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+		pName->SetEnabled(true);
+
+		CButtonUI* pSave = static_cast<CButtonUI*>(m_pm.FindControl(_T("save")));
+		pSave->SetEnabled(true);
+
+		//失败原因
+		CLabelUI* pErrorInfo = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuanresult")));
+		pErrorInfo->SetText(m_errorInfo.c_str());
+		pErrorInfo->SetVisible(true);
+
+		m_qingqiu_mutex.lock();
+
+		m_is_qingqiu = false;
+
+		m_qingqiu_mutex.unlock();
+
+		return true;
+	}
+
+	return false;
+}
+
+LRESULT CHuiyuanAddWnd::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("huiyuan_add_wnd.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 CHuiyuanAddWnd::Notify(TNotifyUI& msg)
+{
+	DuiLib::CDuiString senderName = msg.pSender->GetName();
+
+	if (msg.sType == _T("click"))
+	{
+		DuiLib::CDuiString senderName = msg.pSender->GetName();
+
+		if (senderName == _T("closebtn"))
+		{
+			if (m_is_qingqiu == false)
+			{
+				Close(IDCANCEL);
+			}
+
+			return;
+		}
+		else if (senderName == _T("save"))
+		{
+			StartYanzheng();
+		}
+		else if (senderName == L"jianpan_1")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"1";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_2")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"2";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_3")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"3";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_4")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"4";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_5")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"5";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_6")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"6";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_7")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"7";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_8")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"8";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_9")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"9";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_0")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason += L"0";
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_x")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason = wsReason.substr(0, wsReason.length() - 1);
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+		else if (senderName == L"jianpan_qingkong")
+		{
+			CEditUI* curEdit;
+
+			CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+			if (m_inputType == 1)
+			{
+				curEdit = pPhone;
+			}
+			else if (m_inputType == 2)
+			{
+				curEdit = pPassword;
+			}
+			else
+			{
+				curEdit = pName;
+			}
+			wstring wsReason = curEdit->GetText();
+
+			wsReason.clear();
+
+			curEdit->SetText(wsReason.c_str());
+			curEdit->SetFocus();
+		}
+	}
+	else if (msg.sType == _T("textchanged"))
+	{
+		if (senderName == L"phone_edit")
+		{
+
+			//只能输入数字,其他的全部删除
+			CEditUI* m_pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+			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;
+					}
+				}
+			}
+		}
+
+		if (senderName == L"password_edit")
+		{
+
+			//只能输入数字,其他的全部删除
+			CEditUI* m_pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+			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("phone_edit")));
+		pFukuanEdit->SetFocus();
+	}
+	else if (msg.sType == _T("setfocus"))
+	{
+		if (senderName == L"phone_edit")
+		{
+			m_inputType = 1;
+		}
+		else if (senderName == L"password_edit")
+		{
+			m_inputType = 2;
+		}
+		else if (senderName == L"name_edit")
+		{
+			m_inputType = 3;
+		}
+	}
+}
+
+void CHuiyuanAddWnd::Init()
+{
+
+}
+void CHuiyuanAddWnd::StartYanzheng()
+{
+	CEditUI* pPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("phone_edit")));
+	wstring wsPhone = pPhone->GetText();
+	m_phone = CLewaimaiString::UnicodeToUTF8(wsPhone);
+
+	if (wsPhone.length() == 0)
+	{
+		m_errorInfo = _T("手机号不能为空");
+		PostMessage(WM_MEMBER_CHECK_FAIL);
+
+		return;
+	}
+
+	if (wsPhone.length() != 11)
+	{
+		m_errorInfo = _T("手机号格式不对");
+		PostMessage(WM_MEMBER_CHECK_FAIL);
+
+		return;
+	}
+
+	pPhone->SetEnabled(false);
+
+	CEditUI* pPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("password_edit")));
+	wstring wsPassword = pPassword->GetText();
+	m_password = CLewaimaiString::UnicodeToUTF8(wsPassword);
+
+	if (wsPassword.length() == 0)
+	{
+		m_errorInfo = _T("支付密码不能为空");
+		PostMessage(WM_MEMBER_CHECK_FAIL);
+
+		return;
+	}
+
+	if (wsPassword.length() != 6)
+	{
+		m_errorInfo = _T("支付密码只能为6位数字");
+		PostMessage(WM_MEMBER_CHECK_FAIL);
+
+		return;
+	}
+
+	pPassword->SetEnabled(false);
+
+	CEditUI* pName = static_cast<CEditUI*>(m_pm.FindControl(_T("name_edit")));
+	wstring wsName = pName->GetText();
+	m_name = CLewaimaiString::UnicodeToUTF8(wsName);
+	pName->SetEnabled(false);
+
+	CButtonUI* pSave = static_cast<CButtonUI*>(m_pm.FindControl(_T("save")));
+	pSave->SetEnabled(false);
+
+	m_qingqiu_mutex.lock();
+
+	m_is_qingqiu = true;
+
+	m_qingqiu_mutex.unlock();
+
+	//开始处理
+	std::thread(&CHuiyuanAddWnd::ConfirmMember, this).detach();
+}
+
+void CHuiyuanAddWnd::ConfirmMember()
+{
+	std::map<string, string> params;
+	params["phone"] = m_phone;
+	params["name"] = m_name;
+	params["pay_password"] = md5(m_password);
+	params["open_no_card_payment"] = "1";
+	params["is_no_card"] = "1";
+
+	std::string response;
+	bool ret = CZhipuziHttpClient::Request("/member/add", params, response);
+	if (!ret)
+	{
+		m_errorInfo = _T("网络请求出错");
+		PostMessage(WM_MEMBER_CHECK_FAIL);
+
+		return;
+	}
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		m_errorInfo = _T("服务器返回数据格式错误");
+		PostMessage(WM_MEMBER_CHECK_FAIL);
+
+		return;
+	}
+	else
+	{
+		if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+		{
+			m_errorInfo = _T("服务器返回数据格式错误");
+			PostMessage(WM_MEMBER_CHECK_FAIL);
+
+			return;
+		}
+
+		rapidjson::Value& v_errcode = document["errcode"];
+		int errcode = v_errcode.GetInt();
+		if (errcode != 0)
+		{
+			std::string errmsg = CLewaimaiString::UnicodeToUTF8(L"添加会员失败:") + string(document["errmsg"].GetString());
+			m_errorInfo = CLewaimaiString::UTF8ToUnicode(errmsg);
+			PostMessage(WM_MEMBER_CHECK_FAIL);
+
+			return;
+		}
+
+		PostMessage(WM_MEMBER_CHECK_SUCCESS);
+	}
+}

+ 84 - 0
zhipuzi_pos_windows/wnd/CHuiyuanAddWnd.h

@@ -0,0 +1,84 @@
+#pragma once
+
+#include "../pch/pch.h"
+#include "CMainWnd.h"
+#include "CModalWnd.h"
+
+class CHuiyuanAddWnd : 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 StartYanzheng();
+
+	void ConfirmMember();
+
+	//处理键盘捕捉结果
+	void HandleTextCapture(std::string content)
+	{
+
+	}
+
+public:
+	CPaintManagerUI m_pm;
+
+	std::string m_phone;
+	std::string m_password;
+	std::string m_name;
+
+	std::wstring m_errorInfo;
+
+	std::mutex m_qingqiu_mutex;
+	bool m_is_qingqiu = false;
+
+	int m_inputType = 1; //当前输入框 1:手机号 2:密码 3:会员名字
+};

+ 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="wnd\CHuiyuanAddWnd.h" />
     <ClInclude Include="wnd\CHuiyuanChongzhiWnd.h" />
     <ClInclude Include="page\CHuiyuanPageUI.h" />
     <ClInclude Include="control\CDianneiOrderItemUI.h" />
@@ -304,6 +305,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CSystem.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="wnd\CHuiyuanAddWnd.cpp" />
     <ClCompile Include="wnd\CHuiyuanChongzhiWnd.cpp" />
     <ClCompile Include="page\CHuiyuanPageUI.cpp" />
     <ClCompile Include="control\CDianneiOrderItemUI.cpp" />

+ 6 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -240,6 +240,9 @@
     <ClInclude Include="wnd\CHuiyuanChongzhiWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="wnd\CHuiyuanAddWnd.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -443,6 +446,9 @@
     <ClCompile Include="wnd\CHuiyuanChongzhiWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="wnd\CHuiyuanAddWnd.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">