Pārlūkot izejas kodu

订单列表可以了

zhangyang 6 gadi atpakaļ
vecāks
revīzija
1e6608c598

BIN
bin/Win32/Debug/lewaimai_pos_windows/db/pos.db


BIN
bin/Win32/Debug/lewaimai_pos_windows/lewaimai_pos_windows.exe


+ 8 - 3
bin/Win32/Debug/lewaimai_pos_windows/skin/waimai_order_item.xml

@@ -2,17 +2,22 @@
 <Window>
 	<WaimaiOrderItem height="200" bkcolor="#FFFFFFFF" padding="0,20,20,0">
 		<HorizontalLayout>
-			<Label float="true" name="waimai_order_list_order_no" text="订单号:" pos="10,6,320,36" />
+			<Label float="true" name="waimai_order_list_order_num" text="订单号:" pos="10,6,320,36" />
+			<Label float="true" name="waimai_order_list_from" text="订单来源:" pos="350,6,582,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="350,36,600,66" />
-			<Label float="true" name="waimai_order_list_address" text="地址:" pos="10,66,182,96" />
+			<Label float="true" name="waimai_order_list_price" text="价格:" pos="10,66,252,96" />
+			
 			<Label float="true" name="waimai_order_list_init_date" text="下单时间:" pos="10,96,220,126" />
+			
 			<Label float="true" name="waimai_order_list_type" text="订单类型:" pos="10,126,182,156" />
+			
 			<Label float="true" name="waimai_order_list_delivery_date" text="配送时间:" pos="10,156,182,186" />
 			
 			<Label float="true" name="waimai_order_list_refund_status" text="退款状态:" pos="350,156,800,186" />
 			
-			<Label float="true" name="waimai_order_list_price" text="价格:" pos="350,6,482,36" />
+			
 		</HorizontalLayout>
 		
 		<HorizontalLayout width="200">

+ 14 - 10
lewaimai_pos_windows/control/CWaimaiOrderItemUI.cpp

@@ -14,24 +14,28 @@ CWaimaiOrderItemUI::~CWaimaiOrderItemUI()
 void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 {
 	m_name = orderinfo["customer_name"].GetString();
-	m_address = orderinfo["address"].GetString();
+	//m_address = orderinfo["address"].GetString();
 	m_phone = orderinfo["customer_phone"].GetString();
 	m_price = orderinfo["price"].GetString();
 	m_order_no = orderinfo["order_no"].GetString();
-	m_init_date = orderinfo["init_date"].GetString();
+	m_order_num = orderinfo["order_num"].GetString();
+	m_init_date = orderinfo["order_date"].GetString();
 
 	m_is_selftake = orderinfo["is_selftake"].GetString();
-	m_delivery_date = orderinfo["delivery_date"].GetString();
+	//m_delivery_date = orderinfo["delivery_date"].GetString();
 
 	m_restaurant_number = orderinfo["restaurant_number"].GetString();
 
 	m_orderid = orderinfo["id"].GetString();
 
+	m_from_type = orderinfo["from_type"].GetString();
+	m_is_book = orderinfo["is_book"].GetString();
+
 	std::wstring name_show = L"姓名:" + CLewaimaiString::UTF8ToUnicode(m_name);
 	this->FindSubControl(L"waimai_order_list_name")->SetText(name_show.c_str());
 
-	std::wstring address_show = L"地址:" + CLewaimaiString::UTF8ToUnicode(m_address);
-	this->FindSubControl(L"waimai_order_list_address")->SetText(address_show.c_str());
+	std::wstring from_type_show = L"订单来源:" + CLewaimaiString::UTF8ToUnicode(m_from_type);
+	this->FindSubControl(L"waimai_order_list_from")->SetText(from_type_show.c_str());
 
 	std::wstring phone_show = L"电话:" + CLewaimaiString::UTF8ToUnicode(m_phone);
 	this->FindSubControl(L"waimai_order_list_phone")->SetText(phone_show.c_str());
@@ -39,8 +43,8 @@ void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
 	std::wstring price_show = L"价格:" + CLewaimaiString::UTF8ToUnicode(m_price);
 	this->FindSubControl(L"waimai_order_list_price")->SetText(price_show.c_str());
 
-	std::wstring order_no_show = L"#" + CLewaimaiString::UTF8ToUnicode(m_restaurant_number) + L"  订单号:" + CLewaimaiString::UTF8ToUnicode(m_order_no);
-	this->FindSubControl(L"waimai_order_list_order_no")->SetText(order_no_show.c_str());
+	std::wstring order_num_show = L"#" + CLewaimaiString::UTF8ToUnicode(m_restaurant_number) + L"  订单号:" + CLewaimaiString::UTF8ToUnicode(m_order_num);
+	this->FindSubControl(L"waimai_order_list_order_num")->SetText(order_num_show.c_str());
 
 	std::wstring init_date_show = L"下单时间:" + CLewaimaiString::UTF8ToUnicode(m_init_date);
 	this->FindSubControl(L"waimai_order_list_init_date")->SetText(init_date_show.c_str());
@@ -50,16 +54,16 @@ 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_delivery_date);
 	}
 	else
 	{
 		order_type = L"订单类型:外卖配送";
-		delivery_date = L"配送时间:" + CLewaimaiString::UTF8ToUnicode(m_delivery_date);
+		//delivery_date = L"配送时间:" + CLewaimaiString::UTF8ToUnicode(m_delivery_date);
 	}
 
 	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());
+	//this->FindSubControl(L"waimai_order_list_delivery_date")->SetText(delivery_date.c_str());
 
 	if (m_status == 1)
 	{

+ 4 - 0
lewaimai_pos_windows/control/CWaimaiOrderItemUI.h

@@ -40,6 +40,7 @@ private:
 	std::string m_phone;
 	std::string m_price;
 	std::string m_order_no;
+	std::string m_order_num;
 	std::string m_init_date;
 
 	std::string m_is_selftake;
@@ -49,6 +50,9 @@ private:
 
 	std::string m_orderid;
 
+	std::string m_from_type;
+	std::string m_is_book;
+
 	int m_status = 1; //1:未处理 2:已确认 3:配送中 4:成功 5:失败 6:已取消 7:退款中
 };
 

+ 7 - 7
lewaimai_pos_windows/control/OrderListUI.cpp

@@ -36,31 +36,31 @@ void OrderListUI::HandleRefresh(OrderListStatus* status)
 	std::string url;
 	if (status->m_status == 1)
 	{
-		url = "/waimaiorder/getopenlist";
+		url = "/order/getopenlist";
 	}
 	else if (status->m_status == 2)
 	{
-		url = "/waimaiorder/getconfirmedlist";
+		url = "/order/getconfirmedlist";
 	}
 	else if (status->m_status == 3)
 	{
-		url = "/waimaiorder/getdeliverylist";
+		url = "/order/getdeliverylist";
 	}
 	else if (status->m_status == 4)
 	{
-		url = "/waimaiorder/getsucceededlist";
+		url = "/order/getsucceededlist";
 	}
 	else if (status->m_status == 5)
 	{
-		url = "/waimaiorder/getfailedlist";
+		url = "/order/getfailedlist";
 	}
 	else if (status->m_status == 6)
 	{
-		url = "/waimaiorder/getcancelledlist";
+		url = "/order/getcancelledlist";
 	}
 	else if (status->m_status == 7)
 	{
-		url = "/waimaiorder/getrefundlist";
+		url = "/order/getrefundlist";
 	}
 
 	//请求外卖的未处理订单,直接用当前的page值去请求

+ 20 - 0
lewaimai_pos_windows/network/CLewaimaiHttpClient.cpp

@@ -58,6 +58,26 @@ bool CLewaimaiHttpClient::Login(std::string& errmsg)
 			errmsg = std::string(document["errmsg"].GetString());
 			return false;
 		}
+
+		rapidjson::Value& data = document["data"];
+		
+		string role_type;
+		if (data["role_type"].IsInt())
+		{
+			role_type = to_string(data["role_type"].GetInt());
+		}
+		else if (data["role_type"].IsString())
+		{
+			role_type = data["role_type"].GetString();
+		}
+
+		if (role_type != "1")
+		{
+			//不是商家账户,不允许登录
+			LOG_INFO("乐外卖PC版仅支持商户类型的子账号登录");
+			errmsg = CLewaimaiString::UnicodeToUTF8(L"乐外卖PC版仅支持商户类型的子账号登录");
+			return false;
+		}
 	}
 
 	LOG_INFO("login success!");