Quellcode durchsuchen

开始做第三方配送

zhangyang vor 3 Jahren
Ursprung
Commit
a31fef274c

+ 56 - 34
bin/Win32/Debug/zhipuzi_pos_windows/skin/waimai_order_item.xml

@@ -1,41 +1,63 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Window>
-	<WaimaiOrderItem height="200" bkcolor="#FFFFFFFF" padding="0,20,20,0" borderround="10,10">
-		<HorizontalLayout>
-			<Label float="true" name="waimai_order_list_order_num" text="订单号:" pos="10,6,380,36" />
-			<Label float="true" name="waimai_order_list_from" text="订单来源:" pos="400,6,682,36" />
-			
-			<Label float="true" name="waimai_order_list_name" text="姓名:" pos="10,36,182,66" />
-			<Label float="true" name="waimai_order_list_phone" text="电话:" pos="400,36,700,66" />
-			<Label float="true" name="waimai_order_list_address" text="地址:" pos="10,66,700,96" />
-			
-			<Label float="true" name="waimai_order_list_init_date" text="下单时间:" pos="10,96,220,126" />
-			<Label float="true" name="waimai_order_list_price" text="价格:" pos="400,96,600,126" />
-			
-			<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_refund_status" text="退款状态:" pos="400,156,800,186" />
-			
-			<Control name="waimai_order_list_yuyue" bkimage="yuyue.png" float="true" pos="250,120,362,190" />
-			<Control name="waimai_order_list_ziqu" bkimage="ziti.png" float="true" pos="400,120,512,190" />
-			
-			<Control name="waimai_order_list_meituan_icon" bkimage="meituan_icon.png" visible="false" float="true" pos="490,5,520,35" />
-			<Control name="waimai_order_list_eleme_icon" bkimage="eleme_icon.png" visible="false" float="true" pos="490,5,520,35" />
-			<Control name="waimai_order_list_zhipuzi_icon" bkimage="zhipuzi_waimai_icon.png" visible="false" float="true" pos="490,5,520,35" />
+	<WaimaiOrderItem height="280" bkcolor="#FFFFFFFF" padding="0,20,20,0" borderround="10,10">
+		<HorizontalLayout height="200">
+			<HorizontalLayout>
+				<Label float="true" name="waimai_order_list_order_num" text="订单号:" pos="10,6,380,36" />
+				<Label float="true" name="waimai_order_list_from" text="订单来源:" pos="400,6,682,36" />
+				
+				<Label float="true" name="waimai_order_list_name" text="姓名:" pos="10,36,182,66" />
+				<Label float="true" name="waimai_order_list_phone" text="电话:" pos="400,36,700,66" />
+				<Label float="true" name="waimai_order_list_address" text="地址:" pos="10,66,700,96" />
+				
+				<Label float="true" name="waimai_order_list_init_date" text="下单时间:" pos="10,96,220,126" />
+				<Label float="true" name="waimai_order_list_price" text="价格:" pos="400,96,600,126" />
+				
+				<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_refund_status" text="退款状态:" pos="400,156,800,186" />
+				
+				<Control name="waimai_order_list_yuyue" bkimage="yuyue.png" float="true" pos="250,120,362,190" />
+				<Control name="waimai_order_list_ziqu" bkimage="ziti.png" float="true" pos="400,120,512,190" />
+				
+				<Control name="waimai_order_list_meituan_icon" bkimage="meituan_icon.png" visible="false" float="true" pos="490,5,520,35" />
+				<Control name="waimai_order_list_eleme_icon" bkimage="eleme_icon.png" visible="false" float="true" pos="490,5,520,35" />
+				<Control name="waimai_order_list_zhipuzi_icon" bkimage="zhipuzi_waimai_icon.png" visible="false" float="true" pos="490,5,520,35" />
+			</HorizontalLayout>
+			
+			<HorizontalLayout width="200">
+				<Button name="waimai_order_list_info" float="true" pos="100,6,180,44" text="详情" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'"/>
+				<Button name="waimai_order_list_print" float="true" pos="100,54,180,92" text="打印" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'"/>
+				
+				<Button name="waimai_order_list_confirme" float="true" pos="100,107,180,150" text="确认" textcolor="#FFFFFFFF"/>
+				<Button name="waimai_order_list_success" float="true" pos="100,107,180,150" text="设为成功" textcolor="#FFFFFFFF" normalimage="file='shuzi_btn_push.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 name="waimai_order_list_fail" float="true" pos="100,155,180,198" text="设为失败" textcolor="#FFFFFFFF" normalimage="file='btn_border_red.png' corner='5,5,5,5'" hotimage="file='btn_border_red_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_red_Click.png' corner='5,5,5,5'"/>
+				
+				<Button name="waimai_order_list_agree" float="true" pos="100,107,180,150" text="同意退款" textcolor="#FFFFFFFF" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
+				<Button name="waimai_order_list_disagree" float="true" pos="100,155,180,198" text="拒绝退款" textcolor="#FFFFFFFF" normalimage="file='btn_border_red.png' corner='5,5,5,5'" hotimage="file='btn_border_red_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_red_Click.png' corner='5,5,5,5'"/>
+			</HorizontalLayout>
 		</HorizontalLayout>
 		
-		<HorizontalLayout width="200">
-			<Button name="waimai_order_list_info" float="true" pos="100,6,180,44" text="详情" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'"/>
-			<Button name="waimai_order_list_print" float="true" pos="100,54,180,92" text="打印" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'"/>
-			
-			<Button name="waimai_order_list_confirme" float="true" pos="100,112,180,150" text="确认" textcolor="#FFFFFFFF"/>
-			<Button name="waimai_order_list_success" float="true" pos="100,112,180,150" text="设为成功" textcolor="#FFFFFFFF" normalimage="file='shuzi_btn_push.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 name="waimai_order_list_fail" float="true" pos="100,160,180,198" text="设为失败" textcolor="#FFFFFFFF" normalimage="file='btn_border_red.png' corner='5,5,5,5'" hotimage="file='btn_border_red_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_red_Click.png' corner='5,5,5,5'"/>
-			
-			<Button name="waimai_order_list_agree" float="true" pos="100,112,180,150" text="同意退款" textcolor="#FFFFFFFF" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
-			<Button name="waimai_order_list_disagree" float="true" pos="100,160,180,198" text="拒绝退款" textcolor="#FFFFFFFF" normalimage="file='btn_border_red.png' corner='5,5,5,5'" hotimage="file='btn_border_red_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_red_Click.png' corner='5,5,5,5'"/>
+		<Control height="1" bkcolor="#FFEAEAEA" padding="10,5,10,0"></Control>
+		
+		<HorizontalLayout>
+			<HorizontalLayout name="waimai_order_list_ziqu_layout">
+				<Label name="waimai_order_list_ziqu_qucanhao" font="18" width="300" padding="20,0,0,0"></Label>
+				
+				<Control></Control>
+				
+				<Button name="waimai_order_list_ziqu_hujiaoqucan" width="200" height="48" padding="0,16,20,0" text="呼叫取餐" textcolor="#FFFFFFFF"/>
+			</HorizontalLayout>
+			
+			<HorizontalLayout name="waimai_order_list_peisong_layout">
+				<Label name="waimai_order_list_peisong_type" font="18" width="300" padding="20,0,0,0"></Label>
+				
+				<Control></Control>
+				
+				<Button name="waimai_order_list_peisong_disanfangpeisong" width="200" height="48" padding="0,16,20,0" text="发第三方配送" textcolor="#FFFFFFFF"/>
+			</HorizontalLayout>
 		</HorizontalLayout>
 	</WaimaiOrderItem>
 </Window>

+ 29 - 0
zhipuzi_pos_windows/control/CWaimaiOrderItemUI.cpp

@@ -30,6 +30,9 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 
 	m_from_type = orderinfo["from_type"].GetString();
 
+	m_take_food_code = CLewaimaiJson::ToString(orderinfo["take_food_code"]);
+	m_is_self_delivery = CLewaimaiJson::ToString(orderinfo["is_self_delivery"]);
+
 	std::wstring name_show = L"姓名:" + CLewaimaiString::UTF8ToUnicode(m_name);
 	this->FindSubControl(L"waimai_order_list_name")->SetText(name_show.c_str());
 
@@ -50,12 +53,22 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 
 	std::wstring order_type;
 	std::wstring delivery_date;
+
+	CHorizontalLayoutUI* pZiquLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(L"waimai_order_list_ziqu_layout"));
+	CHorizontalLayoutUI* pPeisongLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(L"waimai_order_list_peisong_layout"));
+
 	if (m_is_selftake == "1")
 	{
 		order_type = L"订单类型:到店自取";
 		delivery_date = L"自取时间:" + CLewaimaiString::UTF8ToUnicode(m_delivery_date);
 
 		this->FindSubControl(L"waimai_order_list_ziqu")->SetVisible(true);
+
+		pZiquLayout->SetVisible(true);
+		pPeisongLayout->SetVisible(false);
+
+		CLabelUI* qucanhaoLabel = static_cast<CLabelUI*>(this->FindSubControl(L"waimai_order_list_ziqu_qucanhao"));
+		qucanhaoLabel->SetText((L"取餐号:" + CLewaimaiString::UTF8ToUnicode(m_take_food_code)).c_str());
 	}
 	else
 	{
@@ -63,6 +76,22 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 		delivery_date = L"配送时间:" + CLewaimaiString::UTF8ToUnicode(m_delivery_date);
 
 		this->FindSubControl(L"waimai_order_list_ziqu")->SetVisible(false);
+
+		pZiquLayout->SetVisible(false);
+		pPeisongLayout->SetVisible(true);
+
+		CLabelUI* peisongLabel = static_cast<CLabelUI*>(this->FindSubControl(L"waimai_order_list_peisong_type"));
+
+		if (m_is_self_delivery == "1")
+		{
+			peisongLabel->SetText(L"自配送订单");
+			peisongLabel->SetTextColor(0xFF228B22);
+		}
+		else
+		{
+			peisongLabel->SetText(L"外卖平台专送订单,等待骑手接单");
+			peisongLabel->SetTextColor(0xFFFF4500);
+		}
 	}
 
 	this->FindSubControl(L"waimai_order_list_type")->SetText(order_type.c_str());

+ 6 - 2
zhipuzi_pos_windows/control/CWaimaiOrderItemUI.h

@@ -2,7 +2,7 @@
 
 #include "../pch/pch.h"
 
-class CWaimaiOrderItemUI : public CHorizontalLayoutUI
+class CWaimaiOrderItemUI : public CVerticalLayoutUI
 {
 public:
 	CWaimaiOrderItemUI();
@@ -31,7 +31,7 @@ public:
 		{
 			int a = 1;
 		}
-		CHorizontalLayoutUI::DoEvent(event);
+		CVerticalLayoutUI::DoEvent(event);
 	}
 
 private:
@@ -52,5 +52,9 @@ private:
 
 	std::string m_orderid;
 
+	std::string m_take_food_code;
+
+	std::string m_is_self_delivery;
+
 	int m_status = 1; //1:未处理 2:已确认 3:配送中 4:成功 5:失败 6:已取消 7:退款中
 };

+ 8 - 8
zhipuzi_pos_windows/print/CPosPrinterData.cpp

@@ -81,20 +81,20 @@ std::string CPosPrinterData::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
 		}
 		else
 		{
-			if (order.m_is_book == "1")
+			if (order.m_delivertime == CLewaimaiString::UnicodeToUTF8(L"尽快送达"))
 			{
-				//预约单
-				string date = "【预约单】" + CLewaimaiString::UTF8ToANSI(order.m_delivery_date);
-				POS_TextOut(date, false, true);
-				POS_TextOut("送达", false, false);
+				//非预约单
+				string date = "【即时单】立即送达";
+				POS_TextOut(date, false, true, 1);
 
 				POS_FeedLine();
 			}
 			else
 			{
-				//非预约单
-				string date = "【即时单】立即送达";
-				POS_TextOut(date, false, true, 1);
+				//预约单
+				string date = "【预约单】" + CLewaimaiString::UTF8ToANSI(order.m_delivery_date);
+				POS_TextOut(date, false, true);
+				POS_TextOut("送达", false, false);
 
 				POS_FeedLine();
 			}

+ 5 - 0
zhipuzi_pos_windows/wnd/CAttentionWnd.h

@@ -4,6 +4,11 @@
 #include "CMainWnd.h"
 #include "CModalWnd.h"
 
+/**
+ * 封装一个提醒确认的弹框
+ * 这个类里面不处理任何网络请求逻辑,纯粹的提醒确认
+ */
+
 class CAttentionWnd : public CModalWnd
 {
 public: