|
@@ -1,8 +1,6 @@
|
|
|
#include "../pch/pch.h"
|
|
#include "../pch/pch.h"
|
|
|
#include "CWaimaiOrderListPageUI.h"
|
|
#include "CWaimaiOrderListPageUI.h"
|
|
|
|
|
|
|
|
-#include "../control/CWaimaiOrderItemUI.h"
|
|
|
|
|
-
|
|
|
|
|
#include "../control/ControlEx.h"
|
|
#include "../control/ControlEx.h"
|
|
|
|
|
|
|
|
#include "../wnd/CWaimaiOrderFailReasonWnd.h"
|
|
#include "../wnd/CWaimaiOrderFailReasonWnd.h"
|
|
@@ -11,6 +9,10 @@
|
|
|
|
|
|
|
|
#include "../wnd/CMainWnd.h"
|
|
#include "../wnd/CMainWnd.h"
|
|
|
|
|
|
|
|
|
|
+#include "../helper/CSpeech.h"
|
|
|
|
|
+
|
|
|
|
|
+#include "../wnd/CThirdDeliverySelectWnd.h"
|
|
|
|
|
+
|
|
|
CWaimaiOrderListPageUI::CWaimaiOrderListPageUI()
|
|
CWaimaiOrderListPageUI::CWaimaiOrderListPageUI()
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -42,7 +44,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
|
|
|
|
|
if (name == _T("waimai_order_list_print"))
|
|
if (name == _T("waimai_order_list_print"))
|
|
|
{
|
|
{
|
|
|
- CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
|
|
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
std::string waimai_order_id = item->getOrderID();
|
|
std::string waimai_order_id = item->getOrderID();
|
|
|
std::string waimai_order_no = item->getOrderNo();
|
|
std::string waimai_order_no = item->getOrderNo();
|
|
|
|
|
|
|
@@ -51,7 +53,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
}
|
|
|
else if (name == _T("waimai_order_list_confirme"))
|
|
else if (name == _T("waimai_order_list_confirme"))
|
|
|
{
|
|
{
|
|
|
- CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
|
|
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
std::string waimai_order_id = item->getOrderID();
|
|
std::string waimai_order_id = item->getOrderID();
|
|
|
CWaimaiOrder order;
|
|
CWaimaiOrder order;
|
|
|
bool ret = order.ConfirmeOrder(waimai_order_id);
|
|
bool ret = order.ConfirmeOrder(waimai_order_id);
|
|
@@ -66,7 +68,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
}
|
|
|
else if (name == _T("waimai_order_list_success"))
|
|
else if (name == _T("waimai_order_list_success"))
|
|
|
{
|
|
{
|
|
|
- CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
|
|
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
std::string waimai_order_id = item->getOrderID();
|
|
std::string waimai_order_id = item->getOrderID();
|
|
|
CWaimaiOrder order;
|
|
CWaimaiOrder order;
|
|
|
bool ret = order.SuccessOrder(waimai_order_id);
|
|
bool ret = order.SuccessOrder(waimai_order_id);
|
|
@@ -82,7 +84,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
else if (name == _T("waimai_order_list_fail"))
|
|
else if (name == _T("waimai_order_list_fail"))
|
|
|
{
|
|
{
|
|
|
//外卖订单的打印
|
|
//外卖订单的打印
|
|
|
- CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
|
|
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
std::string waimai_order_id = item->getOrderID();
|
|
std::string waimai_order_id = item->getOrderID();
|
|
|
|
|
|
|
|
CWaimaiOrderFailReasonWnd* pWaimaiFailFrame = new CWaimaiOrderFailReasonWnd();
|
|
CWaimaiOrderFailReasonWnd* pWaimaiFailFrame = new CWaimaiOrderFailReasonWnd();
|
|
@@ -110,7 +112,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
}
|
|
|
else if (name == _T("waimai_order_list_agree"))
|
|
else if (name == _T("waimai_order_list_agree"))
|
|
|
{
|
|
{
|
|
|
- CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
|
|
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
std::string waimai_order_id = item->getOrderID();
|
|
std::string waimai_order_id = item->getOrderID();
|
|
|
CWaimaiOrder order;
|
|
CWaimaiOrder order;
|
|
|
bool ret = order.AgreeRefund(waimai_order_id);
|
|
bool ret = order.AgreeRefund(waimai_order_id);
|
|
@@ -125,7 +127,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
}
|
|
|
else if (name == _T("waimai_order_list_disagree"))
|
|
else if (name == _T("waimai_order_list_disagree"))
|
|
|
{
|
|
{
|
|
|
- CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
|
|
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
std::string waimai_order_id = item->getOrderID();
|
|
std::string waimai_order_id = item->getOrderID();
|
|
|
CWaimaiOrder order;
|
|
CWaimaiOrder order;
|
|
|
bool ret = order.DisagreeRefund(waimai_order_id);
|
|
bool ret = order.DisagreeRefund(waimai_order_id);
|
|
@@ -140,7 +142,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
}
|
|
|
else if (name == _T("waimai_order_list_info"))
|
|
else if (name == _T("waimai_order_list_info"))
|
|
|
{
|
|
{
|
|
|
- CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
|
|
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
std::string waimai_order_id = item->getOrderID();
|
|
std::string waimai_order_id = item->getOrderID();
|
|
|
std::string waimai_order_no = item->getOrderNo();
|
|
std::string waimai_order_no = item->getOrderNo();
|
|
|
|
|
|
|
@@ -150,6 +152,26 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
|
|
|
|
|
m_pMainWnd->SwitchPage(CMainWnd::WAIMAIINFO);
|
|
m_pMainWnd->SwitchPage(CMainWnd::WAIMAIINFO);
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (name == L"waimai_order_list_ziqu_hujiaoqucan")
|
|
|
|
|
+ {
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
|
|
+
|
|
|
|
|
+ std::thread t(&CWaimaiOrderListPageUI::Hujiaoqucan, this, item);
|
|
|
|
|
+ t.detach();
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (name == L"waimai_order_list_peisong_quxiaofadan")
|
|
|
|
|
+ {
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
|
|
+
|
|
|
|
|
+ std::thread t(&CWaimaiOrderListPageUI::Quxiaofadan, this, item);
|
|
|
|
|
+ t.detach();
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (name == L"waimai_order_list_peisong_fadan")
|
|
|
|
|
+ {
|
|
|
|
|
+ CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent()->GetParent());
|
|
|
|
|
+
|
|
|
|
|
+ this->Fadan(item);
|
|
|
|
|
+ }
|
|
|
else if (name == _T("waimai_order_list_last"))
|
|
else if (name == _T("waimai_order_list_last"))
|
|
|
{
|
|
{
|
|
|
this->LastPage();
|
|
this->LastPage();
|
|
@@ -467,3 +489,269 @@ void CWaimaiOrderListPageUI::SetPage(int n)
|
|
|
{
|
|
{
|
|
|
m_page = n;
|
|
m_page = n;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+void CWaimaiOrderListPageUI::Hujiaoqucan(CWaimaiOrderItemUI* item)
|
|
|
|
|
+{
|
|
|
|
|
+ std::string order_id = item->getOrderID();
|
|
|
|
|
+ std::string order_no = item->getOrderNo();
|
|
|
|
|
+ std::string take_food_code = item->getTakefoodcode();
|
|
|
|
|
+
|
|
|
|
|
+ std::map<string, string> params;
|
|
|
|
|
+
|
|
|
|
|
+ params["id"] = order_id;
|
|
|
|
|
+ params["order_no"] = order_no;
|
|
|
|
|
+
|
|
|
|
|
+ std::string response;
|
|
|
|
|
+
|
|
|
|
|
+ std::string url = "/waimaiorder/calltakefood";
|
|
|
|
|
+ bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
|
|
+ if (ret == false)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Document document;
|
|
|
|
|
+ document.Parse(response.c_str());
|
|
|
|
|
+
|
|
|
|
|
+ if (document.HasParseError())
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("parse response error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("json error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& v_errcode = document["errcode"];
|
|
|
|
|
+ int errcode = v_errcode.GetInt();
|
|
|
|
|
+ if (errcode != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("data"))
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& data = document["data"];
|
|
|
|
|
+
|
|
|
|
|
+ //语音播报
|
|
|
|
|
+ CSpeech::MSSSpeak((CLewaimaiString::UTF8ToUnicode(take_food_code) + L"号,请取餐!").c_str());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void CWaimaiOrderListPageUI::Fadan(CWaimaiOrderItemUI* item)
|
|
|
|
|
+{
|
|
|
|
|
+ std::string order_id = item->getOrderID();
|
|
|
|
|
+ std::string order_no = item->getOrderNo();
|
|
|
|
|
+ std::string take_food_code = item->getTakefoodcode();
|
|
|
|
|
+
|
|
|
|
|
+ std::map<string, string> params;
|
|
|
|
|
+
|
|
|
|
|
+ params["order_id"] = order_id;
|
|
|
|
|
+
|
|
|
|
|
+ std::string response;
|
|
|
|
|
+
|
|
|
|
|
+ std::string url = "/waimaiorder/getthirdcourierbyorderid";
|
|
|
|
|
+ bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
|
|
+ if (ret == false)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Document document;
|
|
|
|
|
+ document.Parse(response.c_str());
|
|
|
|
|
+
|
|
|
|
|
+ if (document.HasParseError())
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("parse response error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("json error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& v_errcode = document["errcode"];
|
|
|
|
|
+ int errcode = v_errcode.GetInt();
|
|
|
|
|
+ if (errcode != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("data"))
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& data = document["data"];
|
|
|
|
|
+
|
|
|
|
|
+ std::string open_kuaifuwu = CLewaimaiJson::ToString(data["open_kuaifuwu"]);
|
|
|
|
|
+ std::string open_dada = CLewaimaiJson::ToString(data["open_dada"]);
|
|
|
|
|
+ std::string open_shunfeng = CLewaimaiJson::ToString(data["open_shunfeng"]);
|
|
|
|
|
+ std::string open_lewaimai = CLewaimaiJson::ToString(data["open_lewaimai"]);
|
|
|
|
|
+ std::string open_fengniao = CLewaimaiJson::ToString(data["open_fengniao"]);
|
|
|
|
|
+
|
|
|
|
|
+ CThirdDeliverySelectWnd* pThirdDeliverySelectDlg = new CThirdDeliverySelectWnd();
|
|
|
|
|
+
|
|
|
|
|
+ if (pThirdDeliverySelectDlg != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ pThirdDeliverySelectDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
|
|
+ pThirdDeliverySelectDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
|
|
+ pThirdDeliverySelectDlg->CenterWindow();
|
|
|
|
|
+
|
|
|
|
|
+ pThirdDeliverySelectDlg->SetTitle(L"请选择第三方配送服务商");
|
|
|
|
|
+
|
|
|
|
|
+ pThirdDeliverySelectDlg->SetInfo(open_kuaifuwu, open_dada, open_shunfeng, open_lewaimai, open_fengniao);
|
|
|
|
|
+
|
|
|
|
|
+ UINT ret = pThirdDeliverySelectDlg->ShowModal();
|
|
|
|
|
+
|
|
|
|
|
+ if (ret == IDOK)
|
|
|
|
|
+ {
|
|
|
|
|
+ std::string select_type = pThirdDeliverySelectDlg->GetSelectType();
|
|
|
|
|
+
|
|
|
|
|
+ delete pThirdDeliverySelectDlg;
|
|
|
|
|
+
|
|
|
|
|
+ this->FadanByType(order_id, select_type);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ delete pThirdDeliverySelectDlg;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void CWaimaiOrderListPageUI::Quxiaofadan(CWaimaiOrderItemUI* item)
|
|
|
|
|
+{
|
|
|
|
|
+ std::string order_id = item->getOrderID();
|
|
|
|
|
+ std::string order_no = item->getOrderNo();
|
|
|
|
|
+ std::string take_food_code = item->getTakefoodcode();
|
|
|
|
|
+
|
|
|
|
|
+ std::map<string, string> params;
|
|
|
|
|
+
|
|
|
|
|
+ params["order_id"] = order_id;
|
|
|
|
|
+ params["reason"] = "";
|
|
|
|
|
+
|
|
|
|
|
+ std::string response;
|
|
|
|
|
+
|
|
|
|
|
+ std::string url = "/waimaiorder/cancelthirdorder";
|
|
|
|
|
+ bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
|
|
+ if (ret == false)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Document document;
|
|
|
|
|
+ document.Parse(response.c_str());
|
|
|
|
|
+
|
|
|
|
|
+ if (document.HasParseError())
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("parse response error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("json error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& v_errcode = document["errcode"];
|
|
|
|
|
+ int errcode = v_errcode.GetInt();
|
|
|
|
|
+ if (errcode != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ std::string errmsg = CLewaimaiJson::ToString(document["errmsg"]);
|
|
|
|
|
+ m_pMainWnd->ShowToast(CLewaimaiString::UTF8ToUnicode(errmsg).c_str());
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("data"))
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& data = document["data"];
|
|
|
|
|
+
|
|
|
|
|
+ //取消发单成功,刷新
|
|
|
|
|
+ Refresh();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void CWaimaiOrderListPageUI::FadanByType(std::string order_id, std::string select_type)
|
|
|
|
|
+{
|
|
|
|
|
+ std::map<string, string> params;
|
|
|
|
|
+
|
|
|
|
|
+ params["order_id"] = order_id;
|
|
|
|
|
+
|
|
|
|
|
+ std::string type;
|
|
|
|
|
+ if (select_type == "dada")
|
|
|
|
|
+ {
|
|
|
|
|
+ type = "2";
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (select_type == "shunfeng")
|
|
|
|
|
+ {
|
|
|
|
|
+ type = "3";
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (select_type == "fengniao")
|
|
|
|
|
+ {
|
|
|
|
|
+ type = "5";
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (select_type == "kuaifuwu")
|
|
|
|
|
+ {
|
|
|
|
|
+ type = "1";
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (select_type == "lewaimai")
|
|
|
|
|
+ {
|
|
|
|
|
+ type = "4";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ params["type"] = type;
|
|
|
|
|
+
|
|
|
|
|
+ std::string response;
|
|
|
|
|
+
|
|
|
|
|
+ std::string url = "/waimaiorder/sendtothird";
|
|
|
|
|
+ bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
|
|
+ if (ret == false)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Document document;
|
|
|
|
|
+ document.Parse(response.c_str());
|
|
|
|
|
+
|
|
|
|
|
+ if (document.HasParseError())
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("parse response error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("json error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& v_errcode = document["errcode"];
|
|
|
|
|
+ int errcode = v_errcode.GetInt();
|
|
|
|
|
+ if (errcode != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ std::string errmsg = CLewaimaiJson::ToString(document["errmsg"]);
|
|
|
|
|
+ m_pMainWnd->ShowToast(CLewaimaiString::UTF8ToUnicode(errmsg).c_str());
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!document.HasMember("data"))
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rapidjson::Value& data = document["data"];
|
|
|
|
|
+
|
|
|
|
|
+ //发单成功,刷新
|
|
|
|
|
+ Refresh();
|
|
|
|
|
+}
|