Prechádzať zdrojové kódy

处理完第三方配送相关

张洋 3 rokov pred
rodič
commit
7d8683096e

BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/logo_dada.png


BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/logo_fengniao.png


BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/logo_kuaifuwu.png


BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/logo_lewaimai.png


BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/logo_shunfengtongcheng.png


+ 75 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/third_delivery_select_dlg.xml

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window size="500,580" 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="shoukuan_title_bkg" height="44" bkcolor="0xFF3CB371">
+			<Label name="memo_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>
+				<VerticalLayout>					
+					<HorizontalLayout name="dada_layout" height="62" padding="0,20,0,0">
+						<Control></Control>
+						<HorizontalLayout width="300" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFFFFFFF">
+							<Control bkimage="logo_dada.png" width="60" height="60" padding="1,1,0,0" mouse="false"></Control>
+							<Label text="达达" width="150" height="44" align="left" valign="center" padding="20,8,0,0" mouse="false"/>
+							
+							<Button name="dada_btn" text="" float="true" pos="0,0,300,62" normalimage="" hotimage="" pushedimage=""></Button>
+						</HorizontalLayout>
+						<Control></Control>
+					</HorizontalLayout>
+					
+					<HorizontalLayout name="shunfeng_layout" height="62" padding="0,20,0,0">
+						<Control></Control>
+						<HorizontalLayout width="300" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFFFFFFF">
+							<Control bkimage="logo_shunfengtongcheng.png" width="60" height="60" padding="1,1,0,0" mouse="false"></Control>
+							<Label text="顺丰同城" width="150" height="44" align="left" valign="center" padding="20,8,0,0" mouse="false"/>
+							
+							<Button name="shunfeng_btn" text="" float="true" pos="0,0,300,62" normalimage="" hotimage="" pushedimage=""></Button>
+						</HorizontalLayout>
+						<Control></Control>
+					</HorizontalLayout>
+					
+					<HorizontalLayout name="fengniao_layout" height="62" padding="0,20,0,0">
+						<Control></Control>
+						<HorizontalLayout width="300" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFFFFFFF">
+							<Control bkimage="logo_fengniao.png" width="60" height="60" padding="1,1,0,0" mouse="false"></Control>
+							<Label text="蜂鸟配送" width="150" height="44" align="left" valign="center" padding="20,8,0,0" mouse="false"/>
+							
+							<Button name="fengniao_btn" text="" float="true" pos="0,0,300,62" normalimage="" hotimage="" pushedimage=""></Button>
+						</HorizontalLayout>
+						<Control></Control>
+					</HorizontalLayout>
+					
+					<HorizontalLayout name="kuaifuwu_layout" height="62" padding="0,20,0,0">
+						<Control></Control>
+						<HorizontalLayout width="300" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFFFFFFF">
+							<Control bkimage="logo_kuaifuwu.png" width="60" height="60" padding="1,1,0,0" mouse="false"></Control>
+							<Label text="快服务" width="150" height="44" align="left" valign="center" padding="20,8,0,0" mouse="false"/>
+							
+							<Button name="kuaifuwu_btn" text="" float="true" pos="0,0,300,62" normalimage="" hotimage="" pushedimage=""></Button>
+						</HorizontalLayout>
+						<Control></Control>
+					</HorizontalLayout>
+					
+					<HorizontalLayout name="lewaimai_layout" height="62" padding="0,20,0,0">
+						<Control></Control>
+						<HorizontalLayout width="300" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFFFFFFF">
+							<Control bkimage="logo_lewaimai.png" width="60" height="60" padding="1,1,0,0" mouse="false"></Control>
+							<Label text="乐外卖同城配送" width="150" height="44" align="left" valign="center" padding="20,8,0,0" mouse="false"/>
+							
+							<Button name="lewaimai_btn" text="" float="true" pos="0,0,300,62" normalimage="" hotimage="" pushedimage=""></Button>
+						</HorizontalLayout>
+						<Control></Control>
+					</HorizontalLayout>
+				</VerticalLayout>
+			</VerticalLayout>
+		</HorizontalLayout>
+		
+	</VerticalLayout>
+</Window>

+ 6 - 3
bin/Win32/Debug/zhipuzi_pos_windows/skin/waimai_order_item.xml

@@ -15,7 +15,7 @@
 				
 				<Label float="true" name="waimai_order_list_type" text="配送方式:" pos="10,126,400,156" />
 				
-				<Label float="true" name="waimai_order_list_delivery_date" text="配送时间:" pos="10,156,282,186" />
+				<Label float="true" name="waimai_order_list_delivery_date" text="配送时间:" pos="10,156,320,186" />
 				
 				<Label float="true" name="waimai_order_list_refund_status" text="退款状态:" pos="400,156,800,186" />
 				
@@ -48,7 +48,7 @@
 				
 				<Control></Control>
 				
-				<Button name="waimai_order_list_ziqu_hujiaoqucan" width="200" height="48" padding="0,16,20,0" text="呼叫取餐" textcolor="#FFFFFFFF"/>
+				<Button name="waimai_order_list_ziqu_hujiaoqucan" width="220" height="48" padding="0,16,20,0" text="呼叫取餐" textcolor="#FFFFFFFF" normalimage="file='btn_border_blue.png' corner='5,5,5,5'" hotimage="file='btn_border_blue_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_blue_Click.png' corner='5,5,5,5'"/>
 			</HorizontalLayout>
 			
 			<HorizontalLayout name="waimai_order_list_peisong_layout">
@@ -56,7 +56,10 @@
 				
 				<Control></Control>
 				
-				<Button name="waimai_order_list_peisong_disanfangpeisong" width="200" height="48" padding="0,16,20,0" text="发第三方配送" textcolor="#FFFFFFFF"/>
+				<Button name="waimai_order_list_peisong_fadan" width="220" height="48" padding="0,16,20,0" text="发第三方配送" textcolor="#FFFFFFFF" normalimage="file='btn_border_blue.png' corner='5,5,5,5'" hotimage="file='btn_border_blue_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_blue_Click.png' corner='5,5,5,5'"/>
+				
+				<Label name="waimai_order_list_peisong_fadan_info" font="18" width="300" align="right" padding="20,0,20,0" textcolor="#FF00CED1"></Label>
+				<Button name="waimai_order_list_peisong_quxiaofadan" width="220" height="48" padding="0,16,20,0" text="取消发单" textcolor="#FFFFFFFF" normalimage="file='btn_border_blue.png' corner='5,5,5,5'" hotimage="file='btn_border_blue_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_blue_Click.png' corner='5,5,5,5'"/>
 			</HorizontalLayout>
 		</HorizontalLayout>
 	</WaimaiOrderItem>

+ 150 - 11
zhipuzi_pos_windows/control/CWaimaiOrderItemUI.cpp

@@ -32,6 +32,10 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 
 	m_take_food_code = CLewaimaiJson::ToString(orderinfo["take_food_code"]);
 	m_is_self_delivery = CLewaimaiJson::ToString(orderinfo["is_self_delivery"]);
+	m_is_book = CLewaimaiJson::ToString(orderinfo["is_book"]);
+
+	std::string third_delivery_fee = CLewaimaiJson::ToString(orderinfo["third_delivery_fee"]);
+	std::string courier_type = CLewaimaiJson::ToString(orderinfo["courier_type"]);
 
 	std::wstring name_show = L"姓名:" + CLewaimaiString::UTF8ToUnicode(m_name);
 	this->FindSubControl(L"waimai_order_list_name")->SetText(name_show.c_str());
@@ -60,7 +64,7 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 	if (m_is_selftake == "1")
 	{
 		order_type = L"订单类型:到店自取";
-		delivery_date = L"自取时间:" + CLewaimaiString::UTF8ToUnicode(m_delivery_date);
+		delivery_date = L"自取时间:" + CLewaimaiString::UTF8ToUnicode(m_deliverytime);
 
 		this->FindSubControl(L"waimai_order_list_ziqu")->SetVisible(true);
 
@@ -73,7 +77,7 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 	else
 	{
 		order_type = L"订单类型:外卖配送";
-		delivery_date = L"配送时间:" + CLewaimaiString::UTF8ToUnicode(m_delivery_date);
+		delivery_date = L"配送时间:" + CLewaimaiString::UTF8ToUnicode(m_deliverytime);
 
 		this->FindSubControl(L"waimai_order_list_ziqu")->SetVisible(false);
 
@@ -82,23 +86,155 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 
 		CLabelUI* peisongLabel = static_cast<CLabelUI*>(this->FindSubControl(L"waimai_order_list_peisong_type"));
 
-		if (m_is_self_delivery == "1")
+		CButtonUI* fadanBtn = static_cast<CButtonUI*>(this->FindSubControl(L"waimai_order_list_peisong_fadan"));
+		CButtonUI* quxiaoFadanBtn = static_cast<CButtonUI*>(this->FindSubControl(L"waimai_order_list_peisong_quxiaofadan"));
+
+		CLabelUI* fadanInfoLabel = static_cast<CLabelUI*>(this->FindSubControl(L"waimai_order_list_peisong_fadan_info"));
+
+		if (m_status == 2)
 		{
-			peisongLabel->SetText(L"自配送订单");
-			peisongLabel->SetTextColor(0xFF228B22);
+			//针对已确认非配送中订单进行处理
+			if ((m_from_type == CLewaimaiString::UnicodeToUTF8(L"美团外卖") || m_from_type == CLewaimaiString::UnicodeToUTF8(L"饿了么")) && m_is_self_delivery == "0")
+			{
+				//美团饿了么订单,并且非商家自配送订单
+				peisongLabel->SetText(L"外卖平台专送订单,等待骑手接单");
+				peisongLabel->SetTextColor(0xFFFF4500);
+
+				//隐藏发单按钮
+				fadanBtn->SetVisible(false);
+				fadanInfoLabel->SetVisible(false);
+				quxiaoFadanBtn->SetVisible(false);
+			}
+			else
+			{
+				peisongLabel->SetText(L"自配送订单");
+				peisongLabel->SetTextColor(0xFF228B22);
+
+				if (atof(third_delivery_fee.c_str()) > 0.0001)
+				{
+					//第三方配送费大于0,说明已经发单给第三方了
+					fadanBtn->SetVisible(false);
+					fadanInfoLabel->SetVisible(true);
+					quxiaoFadanBtn->SetVisible(true);
+
+					if (courier_type == "3")
+					{
+						fadanInfoLabel->SetText(L"已发单给快服务,等待骑手接单...");
+					}
+					else if (courier_type == "5")
+					{
+						fadanInfoLabel->SetText(L"已发单给达达,等待骑手接单...");
+					}
+					else if (courier_type == "7")
+					{
+						fadanInfoLabel->SetText(L"已发单给顺丰同城,等待骑手接单...");
+					}
+					else if (courier_type == "8")
+					{
+						fadanInfoLabel->SetText(L"已发单给乐外卖同城配送,等待骑手接单...");
+					}
+					else if (courier_type == "9")
+					{
+						fadanInfoLabel->SetText(L"已发单给蜂鸟配送,等待骑手接单...");
+					}
+				}
+				else
+				{
+					//说明还没发第三方配送
+					fadanBtn->SetVisible(true);
+					fadanInfoLabel->SetVisible(false);
+					quxiaoFadanBtn->SetVisible(false);
+				}
+			}
+		}
+		else if (m_status == 3)
+		{
+			//针对已确认非配送中订单进行处理
+			if ((m_from_type == CLewaimaiString::UnicodeToUTF8(L"美团外卖") || m_from_type == CLewaimaiString::UnicodeToUTF8(L"饿了么")) && m_is_self_delivery == "0")
+			{
+				//美团饿了么订单,并且非商家自配送订单
+				peisongLabel->SetText(L"外卖平台专送订单,骑手已接单");
+				peisongLabel->SetTextColor(0xFFFF4500);
+
+				//隐藏发单按钮
+				fadanBtn->SetVisible(false);
+				fadanInfoLabel->SetVisible(false);
+				quxiaoFadanBtn->SetVisible(false);
+			}
+			else
+			{
+				peisongLabel->SetText(L"自配送订单,骑手已接单");
+				peisongLabel->SetTextColor(0xFF228B22);
+
+				//针对配送中订单进行处理
+				fadanBtn->SetVisible(false);
+
+				std::string courier_name = CLewaimaiJson::ToString(orderinfo["courier_name"]);
+				std::string courier_phone = CLewaimaiJson::ToString(orderinfo["courier_phone"]);
+
+				std::wstring qishou_type = L"";
+				if (courier_type == "1")
+				{
+					qishou_type = L"自配送";
+				}
+				else if (courier_type == "3")
+				{
+					qishou_type = L"快服务";
+				}
+				else if (courier_type == "5")
+				{
+					qishou_type = L"达达";
+				}
+				else if (courier_type == "7")
+				{
+					qishou_type = L"顺丰同城";
+				}
+				else if (courier_type == "8")
+				{
+					qishou_type = L"乐外卖";
+				}
+				else if (courier_type == "9")
+				{
+					qishou_type = L"蜂鸟";
+				}
+
+				std::wstring qishouInfo;
+				qishouInfo += qishou_type + L"骑手:" + CLewaimaiString::UTF8ToUnicode(courier_name) + L"," + CLewaimaiString::UTF8ToUnicode(courier_phone);
+
+				fadanInfoLabel->SetVisible(true);
+				fadanInfoLabel->SetText(qishouInfo.c_str());
+
+				quxiaoFadanBtn->SetVisible(true);
+			}
 		}
 		else
 		{
-			peisongLabel->SetText(L"外卖平台专送订单,等待骑手接单");
-			peisongLabel->SetTextColor(0xFFFF4500);
+			//针对已确认非配送中订单进行处理
+			if ((m_from_type == CLewaimaiString::UnicodeToUTF8(L"美团外卖") || m_from_type == CLewaimaiString::UnicodeToUTF8(L"饿了么")) && m_is_self_delivery == "0")
+			{
+				//美团饿了么订单,并且非商家自配送订单
+				peisongLabel->SetText(L"外卖平台专送订单");
+				peisongLabel->SetTextColor(0xFFFF4500);
+
+				//隐藏发单按钮
+				fadanBtn->SetVisible(false);
+				fadanInfoLabel->SetVisible(false);
+				quxiaoFadanBtn->SetVisible(false);
+			}
+			else
+			{
+				peisongLabel->SetText(L"自配送订单");
+				peisongLabel->SetTextColor(0xFF228B22);
+			}
+
+			fadanBtn->SetVisible(false);
+			fadanInfoLabel->SetVisible(false);
+			quxiaoFadanBtn->SetVisible(false);
 		}
 	}
 
-	this->FindSubControl(L"waimai_order_list_type")->SetText(order_type.c_str());
-	this->FindSubControl(L"waimai_order_list_delivery_date")->SetText(delivery_date.c_str());
-
 	//显示预约的戳
-	if (m_deliverytime == CLewaimaiString::UnicodeToUTF8(L"尽快送达"))
+	if (m_is_book == "0")
 	{
 		this->FindSubControl(L"waimai_order_list_yuyue")->SetVisible(false);
 	}
@@ -107,6 +243,9 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 		this->FindSubControl(L"waimai_order_list_yuyue")->SetVisible(true);
 	}
 
+	this->FindSubControl(L"waimai_order_list_type")->SetText(order_type.c_str());
+	this->FindSubControl(L"waimai_order_list_delivery_date")->SetText(delivery_date.c_str());
+
 	CControlUI* meituan_icon = this->FindSubControl(L"waimai_order_list_meituan_icon");
 	CControlUI* eleme_icon = this->FindSubControl(L"waimai_order_list_eleme_icon");
 	CControlUI* zhipuzi_icon = this->FindSubControl(L"waimai_order_list_zhipuzi_icon");

+ 8 - 1
zhipuzi_pos_windows/control/CWaimaiOrderItemUI.h

@@ -20,6 +20,11 @@ public:
 		return m_order_no;
 	}
 
+	std::string getTakefoodcode()
+	{
+		return m_take_food_code;
+	}
+
 	void SetStatus(int status)
 	{
 		m_status = status;
@@ -56,5 +61,7 @@ private:
 
 	std::string m_is_self_delivery;
 
+	std::string m_is_book;
+
 	int m_status = 1; //1:未处理 2:已确认 3:配送中 4:成功 5:失败 6:已取消 7:退款中
-};
+};

+ 297 - 9
zhipuzi_pos_windows/page/CWaimaiOrderListPageUI.cpp

@@ -1,8 +1,6 @@
 #include "../pch/pch.h"
 #include "CWaimaiOrderListPageUI.h"
 
-#include "../control/CWaimaiOrderItemUI.h"
-
 #include "../control/ControlEx.h"
 
 #include "../wnd/CWaimaiOrderFailReasonWnd.h"
@@ -11,6 +9,10 @@
 
 #include "../wnd/CMainWnd.h"
 
+#include "../helper/CSpeech.h"
+
+#include "../wnd/CThirdDeliverySelectWnd.h"
+
 CWaimaiOrderListPageUI::CWaimaiOrderListPageUI()
 {
 
@@ -42,7 +44,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 
 	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_no = item->getOrderNo();
 
@@ -51,7 +53,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 	}
 	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();
 		CWaimaiOrder order;
 		bool ret = order.ConfirmeOrder(waimai_order_id);
@@ -66,7 +68,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 	}
 	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();
 		CWaimaiOrder order;
 		bool ret = order.SuccessOrder(waimai_order_id);
@@ -82,7 +84,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 	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();
 
 		CWaimaiOrderFailReasonWnd* pWaimaiFailFrame = new CWaimaiOrderFailReasonWnd();
@@ -110,7 +112,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 	}
 	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();
 		CWaimaiOrder order;
 		bool ret = order.AgreeRefund(waimai_order_id);
@@ -125,7 +127,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 	}
 	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();
 		CWaimaiOrder order;
 		bool ret = order.DisagreeRefund(waimai_order_id);
@@ -140,7 +142,7 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 	}
 	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_no = item->getOrderNo();
 
@@ -150,6 +152,26 @@ void CWaimaiOrderListPageUI::HandleClickMsg(TNotifyUI& msg)
 
 		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"))
 	{
 		this->LastPage();
@@ -467,3 +489,269 @@ void CWaimaiOrderListPageUI::SetPage(int 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();
+}

+ 15 - 2
zhipuzi_pos_windows/page/CWaimaiOrderListPageUI.h

@@ -4,6 +4,8 @@
 
 #include "CBasePageUI.h"
 
+#include "../control/CWaimaiOrderItemUI.h"
+
 class OrderListStatus
 {
 public:
@@ -53,6 +55,18 @@ public:
 
 	void DoRefresh();
 
+	//呼叫取餐
+	void Hujiaoqucan(CWaimaiOrderItemUI* item);
+
+	//发单
+	void Fadan(CWaimaiOrderItemUI* item);
+
+	//调用第三方发单
+	void FadanByType(std::string order_id, std::string select_type);
+
+	//取消发单
+	void Quxiaofadan(CWaimaiOrderItemUI* item);
+
 private:
 	int m_status = 1; //1:未处理 2:已确认 3:配送中 4:成功 5:失败 6:已取消 7:退款中
 	int m_page = 1;
@@ -60,5 +74,4 @@ private:
 	int m_total_page; //总页数
 
 	std::string m_response;
-};
-
+};

+ 238 - 0
zhipuzi_pos_windows/wnd/CThirdDeliverySelectWnd.cpp

@@ -0,0 +1,238 @@
+#include "../pch/pch.h"
+#include "CThirdDeliverySelectWnd.h"
+
+LRESULT CThirdDeliverySelectWnd::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 CThirdDeliverySelectWnd::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 CThirdDeliverySelectWnd::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 CThirdDeliverySelectWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
+{
+	if (uMsg == WM_KEYDOWN)
+	{
+		if (wParam == VK_RETURN)
+		{
+			return true;
+		}
+		else if (wParam == VK_ESCAPE)
+		{
+			Close(IDCANCEL);
+
+			return true;
+		}
+	}
+	return false;
+}
+
+LRESULT CThirdDeliverySelectWnd::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("third_delivery_select_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 CThirdDeliverySelectWnd::Notify(TNotifyUI& msg)
+{
+	if (msg.sType == _T("click"))
+	{
+		DuiLib::CDuiString senderName = msg.pSender->GetName();
+
+		if (senderName == _T("closebtn"))
+		{
+			Close(IDCANCEL);
+			return;
+		}
+		else if (senderName == L"dada_btn")
+		{
+			m_select_type = "dada";
+			Close(IDOK);
+		}
+		else if (senderName == L"shunfeng_btn")
+		{
+			m_select_type = "shunfeng";
+			Close(IDOK);
+		}
+		else if (senderName == L"fengniao_btn")
+		{
+			m_select_type = "fengniao";
+			Close(IDOK);
+		}
+		else if (senderName == L"kuaifuwu_btn")
+		{
+			m_select_type = "kuaifuwu";
+			Close(IDOK);
+		}
+		else if (senderName == L"lewaimai_btn")
+		{
+			m_select_type = "lewaimai";
+			Close(IDOK);
+		}
+	}
+}
+
+void CThirdDeliverySelectWnd::Init()
+{
+	
+}
+
+void CThirdDeliverySelectWnd::SetTitle(std::wstring title)
+{
+	CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("memo_dlg_title")));
+	pLabel->SetText(title.c_str());
+}
+
+void CThirdDeliverySelectWnd::SetInfo(std::string open_kuaifuwu, std::string open_dada, std::string open_shunfeng, std::string open_lewaimai, std::string open_fengniao)
+{
+	m_open_lewaimai = open_lewaimai;
+	m_open_fengniao = open_fengniao;
+	m_open_dada = open_dada;
+	m_open_kuaifuwu = open_kuaifuwu;
+	m_open_shunfeng = open_shunfeng;
+
+	CHorizontalLayoutUI* dada_layout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(L"dada_layout"));
+	CHorizontalLayoutUI* shunfeng_layout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(L"shunfeng_layout"));
+	CHorizontalLayoutUI* fengniao_layout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(L"fengniao_layout"));
+	CHorizontalLayoutUI* kuaifuwu_layout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(L"kuaifuwu_layout"));
+	CHorizontalLayoutUI* lewaimai_layout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(L"lewaimai_layout"));
+
+	if (m_open_dada == "1")
+	{
+		dada_layout->SetVisible(true);
+	}
+	else
+	{
+		dada_layout->SetVisible(false);
+	}
+
+	if (m_open_shunfeng == "1")
+	{
+		shunfeng_layout->SetVisible(true);
+	}
+	else
+	{
+		shunfeng_layout->SetVisible(false);
+	}
+
+	if (m_open_fengniao == "1")
+	{
+		fengniao_layout->SetVisible(true);
+	}
+	else
+	{
+		fengniao_layout->SetVisible(false);
+	}
+
+	if (m_open_kuaifuwu == "1")
+	{
+		kuaifuwu_layout->SetVisible(true);
+	}
+	else
+	{
+		kuaifuwu_layout->SetVisible(false);
+	}
+
+	if (m_open_lewaimai == "1")
+	{
+		lewaimai_layout->SetVisible(true);
+	}
+	else
+	{
+		lewaimai_layout->SetVisible(false);
+	}
+}

+ 86 - 0
zhipuzi_pos_windows/wnd/CThirdDeliverySelectWnd.h

@@ -0,0 +1,86 @@
+#pragma once
+
+#include "../pch/pch.h"
+#include "CMainWnd.h"
+#include "CModalWnd.h"
+
+class CThirdDeliverySelectWnd : 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 HandleTextCapture(std::string content)
+	{
+
+	}
+
+	void SetTitle(std::wstring title);
+
+	void SetInfo(std::string open_kuaifuwu, std::string open_dada, std::string open_shunfeng, std::string open_lewaimai, std::string open_fengniao);
+
+	std::string GetSelectType()
+	{
+		return m_select_type;
+	}
+
+public:
+	CPaintManagerUI m_pm;
+
+	std::string m_open_dada;
+	std::string m_open_kuaifuwu;
+	std::string m_open_fengniao;
+	std::string m_open_shunfeng;
+	std::string m_open_lewaimai;
+
+	std::string m_select_type;
+};

+ 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\CThirdDeliverySelectWnd.h" />
     <ClInclude Include="wnd\CNumInputWnd.h" />
     <ClInclude Include="control\CZhengcanOrderItemUI.h" />
     <ClInclude Include="page\CZhengcanOrderInfoPageUI.h" />
@@ -341,6 +342,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CSystem.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="wnd\CThirdDeliverySelectWnd.cpp" />
     <ClCompile Include="wnd\CNumInputWnd.cpp" />
     <ClCompile Include="control\CZhengcanOrderItemUI.cpp" />
     <ClCompile Include="page\CZhengcanOrderInfoPageUI.cpp" />

+ 6 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -345,6 +345,9 @@
     <ClInclude Include="wnd\CNumInputWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="wnd\CThirdDeliverySelectWnd.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -650,6 +653,9 @@
     <ClCompile Include="wnd\CNumInputWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="wnd\CThirdDeliverySelectWnd.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">