zhangyang 3 rokov pred
rodič
commit
c0f5f878bc

+ 283 - 2
zhipuzi_pos_windows/page/CHuiyuanPageUI.cpp

@@ -7,6 +7,8 @@
 #include "../wnd/CHuiyuanXiugaimimaWnd.h"
 #include "../wnd/CHuiyuanBangkaWnd.h"
 
+#include "../wnd/CAttentionWnd.h"
+
 #include "../zhipuzi/CHuiyuanchognzhiOrder.h"
 #include "../print/CPosPrinter.h"
 
@@ -185,6 +187,14 @@ void CHuiyuanPageUI::HandleClickMsg(TNotifyUI& msg)
 	{
 		StartGuashi();
 	}
+	else if (senderName == L"huiiyuan_page_dongjie_btn")
+	{
+		StartDongjie();
+	}
+	else if (senderName == L"huiiyuan_page_jiedong_btn")
+	{
+		StartJiedong();
+	}
 }
 
 //处理option切换事件
@@ -341,7 +351,7 @@ void CHuiyuanPageUI::StartHuiyuanSousuo()
 			is_card = true;
 		}
 
-		std::string freeze = rowinfo["freeze"].GetString();
+		m_freeze = rowinfo["freeze"].GetString();
 		m_is_open_pay_password = rowinfo["open_no_card_payment"].GetString();
 
 		m_md5_password = rowinfo["pay_password"].GetString();
@@ -377,7 +387,7 @@ void CHuiyuanPageUI::StartHuiyuanSousuo()
 			this->FindSubControl(L"huiyuan_shitika")->SetText(L"实体会员卡:未绑定");
 		}
 
-		if (freeze == "0")
+		if (m_freeze == "0")
 		{
 			this->FindSubControl(L"huiyuan_status")->SetText(L"会员状态:正常");
 
@@ -615,7 +625,278 @@ void CHuiyuanPageUI::StartBangka()
 
 void CHuiyuanPageUI::StartGuashi()
 {
+	if (m_card_identify == "")
+	{
+		m_pMainWnd->ShowToast(L"该会员还未绑实体卡,无需挂失");
+		return;
+	}
+
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CAttentionWnd* pXiugaiziliaoWnd = new CAttentionWnd();
+	if (pXiugaiziliaoWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pXiugaiziliaoWnd;
+
+		pXiugaiziliaoWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pXiugaiziliaoWnd->SetIcon(IDI_ICON_DUILIB);
+		pXiugaiziliaoWnd->CenterWindow();
+
+		pXiugaiziliaoWnd->SetTitle(L"会员挂失确认");
+		pXiugaiziliaoWnd->SetContent(L"确认挂失该会员卡吗,挂失后会员的实体会员卡将无法使用");
+
+		UINT ret = pXiugaiziliaoWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			std::map<string, string> params;
+			params["card_no"] = m_member_card_no;
+			params["name"] = m_name;
+			params["birthday"] = m_birthday;
+			params["address"] = m_address;
+			params["sex"] = m_sex;
+			params["captcha"] = "";
+			params["pay_password"] = m_md5_password;
+			params["open_no_card_payment"] = m_is_open_pay_password;
+			params["is_no_card"] = "1";
+			params["member_id"] = m_member_id;
+			params["card_identify"] = "";
+
+			std::string response;
+			bool ret = CZhipuziHttpClient::GetInstance()->Request("/member/changeinfo", params, response);
+			if (!ret)
+			{
+				m_pMainWnd->ShowToast(L"网络错误");
+
+				return;
+			}
+
+			rapidjson::Document document;
+			document.Parse(response.c_str());
+
+			if (document.HasParseError())
+			{
+				m_pMainWnd->ShowToast(L"服务器返回数据格式错误");
+
+				return;
+			}
+			else
+			{
+				if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+				{
+					m_pMainWnd->ShowToast(L"服务器返回数据格式错误");
+
+					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());
+					std:wstring errorInfo = CLewaimaiString::UTF8ToUnicode(errmsg);
+					m_pMainWnd->ShowToast(errorInfo);
+
+					return;
+				}
+
+				m_pMainWnd->ShowToast(L"实体卡挂失成功");
+
+				//重新搜索,更新会员信息
+				StartHuiyuanSousuo();
+			}
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pXiugaiziliaoWnd;
+	}
+}
+
+void CHuiyuanPageUI::StartDongjie()
+{
+	if (m_freeze == "1")
+	{
+		m_pMainWnd->ShowToast(L"该会员已冻结,无法继续冻结");
+		return;
+	}
+
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
+
+	CAttentionWnd* pXiugaiziliaoWnd = new CAttentionWnd();
+	if (pXiugaiziliaoWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pXiugaiziliaoWnd;
+
+		pXiugaiziliaoWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pXiugaiziliaoWnd->SetIcon(IDI_ICON_DUILIB);
+		pXiugaiziliaoWnd->CenterWindow();
+
+		pXiugaiziliaoWnd->SetTitle(L"会员挂失确认");
+		pXiugaiziliaoWnd->SetContent(L"确认挂失该会员卡吗,挂失后会员的实体会员卡将无法使用");
+
+		UINT ret = pXiugaiziliaoWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			std::map<string, string> params;
+			params["card_no"] = m_member_card_no;
+			params["name"] = m_name;
+			params["birthday"] = m_birthday;
+			params["address"] = m_address;
+			params["sex"] = m_sex;
+			params["captcha"] = "";
+			params["pay_password"] = m_md5_password;
+			params["open_no_card_payment"] = m_is_open_pay_password;
+			params["is_no_card"] = "1";
+			params["member_id"] = m_member_id;
+			params["card_identify"] = "";
+
+			std::string response;
+			bool ret = CZhipuziHttpClient::GetInstance()->Request("/member/changeinfo", params, response);
+			if (!ret)
+			{
+				m_pMainWnd->ShowToast(L"网络错误");
+
+				return;
+			}
+
+			rapidjson::Document document;
+			document.Parse(response.c_str());
+
+			if (document.HasParseError())
+			{
+				m_pMainWnd->ShowToast(L"服务器返回数据格式错误");
+
+				return;
+			}
+			else
+			{
+				if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+				{
+					m_pMainWnd->ShowToast(L"服务器返回数据格式错误");
+
+					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());
+				std:wstring errorInfo = CLewaimaiString::UTF8ToUnicode(errmsg);
+					m_pMainWnd->ShowToast(errorInfo);
+
+					return;
+				}
+
+				m_pMainWnd->ShowToast(L"实体卡挂失成功");
+
+				//重新搜索,更新会员信息
+				StartHuiyuanSousuo();
+			}
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pXiugaiziliaoWnd;
+	}
+}
+
+void CHuiyuanPageUI::StartJiedong()
+{
+	if (m_freeze == "0")
+	{
+		m_pMainWnd->ShowToast(L"该会员未冻结,无法继续解冻");
+		return;
+	}
+
+	if (m_is_show_modal_wnd == true)
+	{
+		return;
+	}
 
+	CAttentionWnd* pXiugaiziliaoWnd = new CAttentionWnd();
+	if (pXiugaiziliaoWnd != NULL)
+	{
+		m_is_show_modal_wnd = true;
+		m_curModalWnd = pXiugaiziliaoWnd;
+
+		pXiugaiziliaoWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pXiugaiziliaoWnd->SetIcon(IDI_ICON_DUILIB);
+		pXiugaiziliaoWnd->CenterWindow();
+
+		pXiugaiziliaoWnd->SetTitle(L"会员挂失确认");
+		pXiugaiziliaoWnd->SetContent(L"确认挂失该会员卡吗,挂失后会员的实体会员卡将无法使用");
+
+		UINT ret = pXiugaiziliaoWnd->ShowModal();
+		if (ret == IDOK)
+		{
+			std::map<string, string> params;
+			params["card_no"] = m_member_card_no;
+			params["name"] = m_name;
+			params["birthday"] = m_birthday;
+			params["address"] = m_address;
+			params["sex"] = m_sex;
+			params["captcha"] = "";
+			params["pay_password"] = m_md5_password;
+			params["open_no_card_payment"] = m_is_open_pay_password;
+			params["is_no_card"] = "1";
+			params["member_id"] = m_member_id;
+			params["card_identify"] = "";
+
+			std::string response;
+			bool ret = CZhipuziHttpClient::GetInstance()->Request("/member/changeinfo", params, response);
+			if (!ret)
+			{
+				m_pMainWnd->ShowToast(L"网络错误");
+
+				return;
+			}
+
+			rapidjson::Document document;
+			document.Parse(response.c_str());
+
+			if (document.HasParseError())
+			{
+				m_pMainWnd->ShowToast(L"服务器返回数据格式错误");
+
+				return;
+			}
+			else
+			{
+				if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+				{
+					m_pMainWnd->ShowToast(L"服务器返回数据格式错误");
+
+					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());
+				std:wstring errorInfo = CLewaimaiString::UTF8ToUnicode(errmsg);
+					m_pMainWnd->ShowToast(errorInfo);
+
+					return;
+				}
+
+				m_pMainWnd->ShowToast(L"实体卡挂失成功");
+
+				//重新搜索,更新会员信息
+				StartHuiyuanSousuo();
+			}
+		}
+
+		m_is_show_modal_wnd = false;
+		delete pXiugaiziliaoWnd;
+	}
 }
 
 void CHuiyuanPageUI::HideError()

+ 8 - 0
zhipuzi_pos_windows/page/CHuiyuanPageUI.h

@@ -55,6 +55,12 @@ private:
 	//挂失实体卡
 	void StartGuashi();
 
+	//冻结会员
+	void StartDongjie();
+
+	//解冻会员
+	void StartJiedong();
+
 	void ShowError(std::wstring err);
 
 	void HideError();
@@ -80,6 +86,8 @@ private:
 
 	std::string m_md5_password;
 
+	std::string m_freeze;
+
 	//模态对话框有关的
 	bool m_is_show_modal_wnd = false;
 	CModalWnd* m_curModalWnd;

+ 1 - 1
zhipuzi_pos_windows/wnd/CHuiyuanBangkaWnd.cpp

@@ -90,7 +90,7 @@ LRESULT CHuiyuanBangkaWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lPara
 	{
 		if (wParam == VK_RETURN)
 		{
-			StartYanzheng();
+			//StartYanzheng();
 
 			return true;
 		}