Browse Source

详情页还要再调整一下

zhangyang 6 years ago
parent
commit
a6166221c1

+ 2 - 2
bin/Win32/Debug/zhipuzi_pos_windows/skin/GameRes/main.xml

@@ -43,7 +43,7 @@
 						</VerticalLayout>
 					</HorizontalLayout>
 					
-					<VerticalLayout vscrollbar="true">
+					<VerticalLayout>
 						<HorizontalLayout height="44" inset="20,4,0,1" childpadding="0" bkcolor="#FFFFFFFF" >
 							<Button name="waimai_order_list_last" float="true" pos="20,6,70,36" text="上一页" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
 							<Button name="waimai_order_list_next" float="true" pos="90,6,140,36" text="下一页" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
@@ -55,7 +55,7 @@
 				</HorizontalLayout>
 				
 				<!--外卖订单详情页-->
-				<HorizontalLayout>
+				<HorizontalLayout vscrollbar="true">
 					<Include source="waimaiorder_info.xml" />
 				</HorizontalLayout>
 				

+ 11 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/GameRes/waimai_order_info_page_listitem.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<Window> 
+  <ListContainerElement name="waimai_order_info_page_listitem" height="30" minheight="30"> 
+    <HorizontalLayout height="38"> 
+      <Label name="waimai_order_info_page_listitem_foodname" /> 
+      <Label name="waimai_order_info_page_listitem_quantity" width="200" align="center"/> 
+      <Label name="waimai_order_info_page_listitem_price" width="200" align="center"/> 
+    </HorizontalLayout> 
+  </ListContainerElement> 
+</Window>

+ 60 - 40
bin/Win32/Debug/zhipuzi_pos_windows/skin/GameRes/waimaiorder_info.xml

@@ -1,50 +1,70 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Window>
-	<WaimaiOrderInfo name="waimaiorder_info_page" bkcolor="#FFD3D3D3" vscrollbar="true">
-		<VerticalLayout>
-			<HorizontalLayout height="50" bkcolor="#FFFFFFFF" padding="0,0,0,0">
-				<Button name="waimai_order_info_page_return" float="true" pos="20,10,120,40" text="返回" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
-			</HorizontalLayout>
-			
-			<HorizontalLayout>
-				<VerticalLayout padding="20,20,20,20">
-					<VerticalLayout bkcolor="#FFFFFFFF">
-						<HorizontalLayout height="50">
-							<Label float="true" name="waimai_order_info_page_liushuihao" text="#1" pos="10, 10, 30, 40" />
-							<Label float="true" name="waimai_order_info_page_order_no" text="订单号:" pos="50, 10, 500, 40" />
-						</HorizontalLayout>
-						
-						<Control height="1" bkcolor="#FF708090" />
-						
-						<List name="waimai_order_info_page_foodlist" height="260">
-							<ListHeader />
-							<ListHeaderItem text="商品" align="left" />
-							<ListHeaderItem text="数量" width="200" />
-							<ListHeaderItem text="单价" width="200" />
-						</List>  
-					</VerticalLayout>
+	<WaimaiOrderInfo name="waimaiorder_info_page" bkcolor="#FFD3D3D3">
+		<HorizontalLayout height="50" bkcolor="#FFFFFFFF" padding="0,0,0,0">
+			<Button name="waimai_order_info_page_return" float="true" pos="20,10,120,40" text="返回" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
+		</HorizontalLayout>
+		
+		<HorizontalLayout vscrollbar="true">
+			<VerticalLayout padding="20,20,20,20" vscrollbar="true" inset="2,2,2,2">
+				<VerticalLayout bkcolor="#FFFFFFFF" inset="2,2,2,2">
+					<HorizontalLayout height="50">
+						<Label float="true" name="waimai_order_info_page_liushuihao" text="#1" pos="10, 10, 30, 40" />
+						<Label float="true" name="waimai_order_info_page_order_no" text="订单号:" pos="50, 10, 500, 40" />
+					</HorizontalLayout>
 					
-					<VerticalLayout heigh="100" padding="0, 15, 0, 0" bkcolor="#FFFFFFFF">
-						<Label float="true" name="waimai_order_info_page_name" text="姓名:" textcolor="#FF558CC4" pos="0,6,182,36" mouse="false" />
-						<Label float="true" name="waimai_order_info_page_phone" text="电话:" textcolor="#FF558CC4" pos="200,6,350,36" mouse="false" />
-						<Label float="true" name="waimai_order_info_page_address" text="地址:" textcolor="#FF558CC4" pos="0,36,182,66" mouse="false" />
-						<Label float="true" name="waimai_order_info_page_init_date" text="下单时间:" textcolor="#FF558CC4" pos="0,66,182,96" mouse="false" />
-					</VerticalLayout>
+					<Control height="1" bkcolor="#FF708090" />
+					
+					<List name="waimai_order_info_page_foodlist">
+						<ListHeader height="30" />
+						<ListHeaderItem text="商品" align="left" />
+						<ListHeaderItem text="数量" width="200" align="center" />
+						<ListHeaderItem text="单价" width="200" align="center" />
+					</List>  
+					
+					<Control height="10" />
+					
+					<Label name="waimaorder_info_page_memo" height="38" text="备注:" />
+					
+					<Control height="1" bkcolor="#FF708090" />
+					
+					<Label name="waimai_order_info_page_delivery_fee" height="38" text="配送费:" />
+					<Label name="waimai_order_info_page_dabao_fee" height="38" text="打包费:" />
+					
+					<VerticalLayout name="waimai_order_info_page_addservice">
 					
-					<VerticalLayout padding="0, 15, 0, 0" bkcolor="#FFFFFFFF">
-						<Label name="waimai_order_info_page_type" text="订单来源:" />
-						<Label name="waimai_order_info_page_pay_type" text="付款方式:" />
-						<Label name="waimai_order_info_page_delivery_type" text="配送方式:" />
-						<Label name="waimai_order_info_page_delivery_time" text="配送时间:" />
 					</VerticalLayout>
+					
+					<Label name="waimai_order_info_page_discount" height="38" text="店铺折扣:" />
+					<Label name="waimai_order_info_page_memberfee" height="38" text="会员优惠:" />
+					<Label name="waimai_order_info_page_firstcut" height="38" text="首单优惠:" />
+					<Label name="waimai_order_info_page_manjian" height="38" text="满减优惠:" />
+					<Label name="waimai_order_info_page_coupon" height="38" text="优惠券:" />
+					<Label name="waimai_order_info_page_goodscoupon" height="38" text="商品券:" />
+				</VerticalLayout>
+				
+				<VerticalLayout padding="0, 15, 0, 0" bkcolor="#FFFFFFFF" inset="2,2,2,2">
+					<Label float="true" height="500" name="waimai_order_info_page_name" text="姓名:" textcolor="#FF558CC4" pos="0,6,182,36" mouse="false" />
+					<Label float="true" name="waimai_order_info_page_phone" text="电话:" textcolor="#FF558CC4" pos="200,6,350,36" mouse="false" />
+					<Label float="true" name="waimai_order_info_page_address" text="地址:" textcolor="#FF558CC4" pos="0,36,182,66" mouse="false" />
+					<Label float="true" name="waimai_order_info_page_init_date" text="下单时间:" textcolor="#FF558CC4" pos="0,66,182,96" mouse="false" />
 				</VerticalLayout>
 				
-				<HorizontalLayout width="300" height="500" bkcolor="#FFFFFFFF" padding="0,20,0,0">
-					<Button name="waimai_order_info_page_print" float="true" pos="20,60,120,90" text="打印" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
-					<Button name="waimai_order_info_page_confirme" float="true" pos="20,100,120,130" text="确认" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
-					<Button name="waimai_order_info_page_fail" float="true" pos="20,140,120,170" text="设为失败" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
-				</HorizontalLayout>
+				<VerticalLayout padding="0, 15, 0, 0" bkcolor="#FFFFFFFF">
+					<Label name="waimai_order_info_page_type" height="30" text="订单来源:" />
+					<Label name="waimai_order_info_page_pay_type" height="30" text="付款方式:" />
+					<Label name="waimai_order_info_page_delivery_type" height="30" text="配送方式:" />
+					<Label name="waimai_order_info_page_delivery_time" height="30" text="配送时间:" />
+					
+					<VerticalLayout name="waimai_order_info_page_field" />
+				</VerticalLayout>
+			</VerticalLayout>
+			
+			<HorizontalLayout width="300" height="500" bkcolor="#FFFFFFFF" padding="0,20,0,0">
+				<Button name="waimai_order_info_page_print" float="true" pos="20,60,120,90" text="打印" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
+				<Button name="waimai_order_info_page_confirme" float="true" pos="20,100,120,130" text="确认" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
+				<Button name="waimai_order_info_page_fail" float="true" pos="20,140,120,170" text="设为失败" textcolor="#FFFF0000" bkcolor="#FFFFFF00"/>
 			</HorizontalLayout>
-		</VerticalLayout>
+		</HorizontalLayout>
 	</WaimaiOrderInfo>
 </Window>

BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


+ 2 - 2
lewaimai_dispatch/tool/CPosPrinter.cpp

@@ -282,8 +282,8 @@ void CPosPrinter::PrintWaimaiOrder(CWaimaiOrder& order)
 		string promotion_value;
 		promotion_value.assign(order.m_promotion, position + 1);
 
-		string coupon = "满减优惠:-" + CLewaimaiString::DoubleToString((double)(atof(promotion_value.c_str())), 2);
-		POS_TextOut(coupon, false, 0);
+		string promotion = "满减优惠:-" + CLewaimaiString::DoubleToString((double)(atof(promotion_value.c_str())), 2);
+		POS_TextOut(promotion, false, 0);
 		POS_FeedLine();
 
 		is_other_money = true;

+ 212 - 7
lewaimai_dispatch/wnd/CWaimaiOrderInfoUI.cpp

@@ -5,7 +5,7 @@
 
 void CWaimaiOrderInfoUI::DoEvent(TEventUI& event)
 {
-	CHorizontalLayoutUI::DoEvent(event);
+	CVerticalLayoutUI::DoEvent(event);
 }
 
 void CWaimaiOrderInfoUI::Refresh(CWaimaiOrder& order)
@@ -16,12 +16,163 @@ void CWaimaiOrderInfoUI::Refresh(CWaimaiOrder& order)
 	std::wstring order_no_show = L"订单号:" + CLewaimaiString::UTF8ToUnicode(order.m_order_no);
 	this->FindSubControl(_T("waimai_order_info_page_order_no"))->SetText(order_no_show.c_str());
 
-	//CListUI* pUserList = static_cast<CListUI*>(this->FindSubControl(_T("waimai_order_info_page_foodlist")));
-	//pUserList->SetTextCallback(this);
-	//for (int i = 0; i < 400; i++) {
-	//	CListTextElementUI* pListElement = new CListTextElementUI;
-	//	pUserList->Add(pListElement);
-	//}
+	//商品详情的渲染
+	CListUI* pFoodList = static_cast<CListUI*>(this->FindSubControl(_T("waimai_order_info_page_foodlist")));
+	pFoodList->RemoveAll();
+
+	for (std::vector<CWaimaiOrderItem>::iterator it = order.m_order_items.begin(); it != order.m_order_items.end(); it++)
+	{
+		std::string food_name = (*it).m_food_name;
+		std::string food_price = (*it).m_item_price;
+		std::string quantity = (*it).m_quantity;
+
+		CDialogBuilder builder;
+		CListContainerElementUI* pEle = static_cast<CListContainerElementUI *>(builder.Create(_T("waimai_order_info_page_listitem.xml"), (UINT)0, NULL, m_pManager));
+
+		CLabelUI *pName = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_foodname")));
+		pName->SetText(CLewaimaiString::UTF8ToUnicode(food_name).c_str());
+
+		CLabelUI *pQuantity = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_quantity")));
+		pQuantity->SetText(CLewaimaiString::UTF8ToUnicode(quantity).c_str());
+
+		CLabelUI *pPrice = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_price")));
+		pPrice->SetText(CLewaimaiString::UTF8ToUnicode(food_price).c_str());
+
+		pFoodList->Add(pEle);
+	}
+
+	pFoodList->SetFixedHeight(1000);
+
+	CLabelUI *pMemo = static_cast<CLabelUI *>(this->FindSubControl(_T("waimaorder_info_page_memo")));
+	wstring memo = _T("备注:") + CLewaimaiString::UTF8ToUnicode(order.m_memo);
+	pMemo->SetText(memo.c_str());
+
+	//开始展示各种费用
+	CLabelUI *pDlieveryFee = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_fee")));
+	if (order.m_delivery > 0)
+	{
+		pDlieveryFee->SetVisible(true);
+		wstring delivery_fee = L"配送费:" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_delivery, 2));
+		pDlieveryFee->SetText(delivery_fee.c_str());
+	}
+	else
+	{
+		pDlieveryFee->SetVisible(false);
+	}
+
+	CLabelUI *pDabaoFee = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_dabao_fee")));
+	if (order.m_is_dabao == "1")
+	{
+		pDabaoFee->SetVisible(true);
+		wstring dabao_fee = L"打包费:" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_delivery, 2));
+		pDabaoFee->SetText(dabao_fee.c_str());
+	}
+	else
+	{
+		pDabaoFee->SetVisible(false);
+	}
+
+	//增值服务费
+	CVerticalLayoutUI* pAddserviceLayout = static_cast<CVerticalLayoutUI *>(this->FindSubControl(_T("waimai_order_info_page_addservice")));
+	pAddserviceLayout->RemoveAll();
+
+	if (order.m_addservie.size() > 0)
+	{
+		for (std::vector<CWaimaiOrderField>::iterator it = order.m_addservie.begin(); it != order.m_addservie.end(); it++)
+		{
+			wstring addservice = CLewaimaiString::UTF8ToUnicode((*it).name) + L":" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)atof((*it).value.c_str()), 2));
+
+			CLabelUI* newField = new CLabelUI();
+
+			newField->SetText(addservice.c_str());
+			newField->SetFixedHeight(38);
+
+			pAddserviceLayout->Add(newField);
+		}
+	}
+
+	//店铺折扣
+	CLabelUI *pDiscountFee = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_discount")));
+	if (order.m_discount < 10)
+	{
+		pDiscountFee->SetVisible(true);
+		wstring discount = L"店铺折扣:" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_discount, 2)) + L"折";
+		pDiscountFee->SetText(discount.c_str());
+	}
+	else
+	{
+		pDiscountFee->SetVisible(false);
+	}
+
+	//会员优惠
+	CLabelUI *pMemberFee = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_memberfee")));
+	if (order.m_is_member_discount == "1")
+	{
+		pMemberFee->SetVisible(true);
+		wstring memberfee = L"会员优惠:-" + CLewaimaiString::UTF8ToUnicode(order.m_member_discount);
+		pDiscountFee->SetText(memberfee.c_str());
+	}
+	else
+	{
+		pMemberFee->SetVisible(false);
+	}
+
+	//首单优惠
+	CLabelUI *pFirstCut = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_firstcut")));
+	if (order.m_is_firstcut == "1")
+	{
+		pFirstCut->SetVisible(true);
+		wstring firstcut = L"首单优惠:-" + CLewaimaiString::UTF8ToUnicode(order.m_firstcut_value);
+		pFirstCut->SetText(firstcut.c_str());
+	}
+	else
+	{
+		pFirstCut->SetVisible(false);
+	}
+
+	//满减
+	CLabelUI *pManjian = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_manjian")));
+	string::size_type position = order.m_promotion.find(":");
+	if (position != order.m_promotion.npos)
+	{
+		pManjian->SetVisible(true);
+
+		string promotion_value;
+		promotion_value.assign(order.m_promotion, position + 1);
+
+		wstring promotion = L"满减优惠:-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)(atof(promotion_value.c_str())), 2));
+		pManjian->SetText(promotion.c_str());
+	}
+	else
+	{
+		pManjian->SetVisible(false);
+	}
+
+	//优惠券
+	CLabelUI *pCoupon = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_coupon")));
+	if (order.m_coupon > 0)
+	{
+		pCoupon->SetVisible(true);
+		wstring coupon = L"优惠券:-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_coupon, 2));
+		pCoupon->SetText(coupon.c_str());
+	}
+	else
+	{
+		pCoupon->SetVisible(false);
+	}
+
+	//商品券
+	CLabelUI *pGoodsCoupon = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_goodscoupon")));
+	if (atof(order.m_goods_coupon_value.c_str()) > 0.0001)
+	{
+		pGoodsCoupon->SetVisible(true);
+		wstring goods_coupon = L"商品券:-" + CLewaimaiString::UTF8ToUnicode(order.m_goods_coupon_value);
+		pGoodsCoupon->SetText(goods_coupon.c_str());
+	}
+	else
+	{
+		pGoodsCoupon->SetVisible(false);
+	}
 
 	std::wstring name_show = L"姓名:" + CLewaimaiString::UTF8ToUnicode(order.m_customer_name);
 	this->FindSubControl(_T("waimai_order_info_page_name"))->SetText(name_show.c_str());
@@ -34,4 +185,58 @@ void CWaimaiOrderInfoUI::Refresh(CWaimaiOrder& order)
 
 	std::wstring order_date_show = L"下单时间:" + CLewaimaiString::UTF8ToUnicode(order.m_order_date);
 	this->FindSubControl(_T("waimai_order_info_page_init_date"))->SetText(order_date_show.c_str());
+
+	if (order.m_is_selftake == "1")
+	{
+		CLabelUI *pDeliveryType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_type")));
+		wstring wsDeliveryType = _T("配送方式:到店自取(取餐号:") + CLewaimaiString::UTF8ToUnicode(order.m_take_food_code) + _T(")");
+		pDeliveryType->SetText(wsDeliveryType.c_str());
+	}
+	else
+	{
+		CLabelUI *pDeliveryType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_type")));
+		wstring wsDeliveryType = _T("配送方式:外卖配送");
+		pDeliveryType->SetText(wsDeliveryType.c_str());
+	}
+
+	CLabelUI *pType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_type")));
+	wstring wsType = _T("订单来源:") + CLewaimaiString::UTF8ToUnicode(order.m_from_type);
+	pType->SetText(wsType.c_str());
+
+	//预设选项
+	CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI *>(this->FindSubControl(_T("waimai_order_info_page_field")));
+	pLayout->RemoveAll();
+
+	if (order.m_order_field.size() > 1)
+	{
+		for (std::vector<CWaimaiOrderField>::iterator it = order.m_order_field.begin(); it != order.m_order_field.end() - 1; it++)
+		{
+			wstring order_field = CLewaimaiString::UTF8ToUnicode((*it).name) + L":" + CLewaimaiString::UTF8ToUnicode((*it).value);
+
+			CLabelUI* newField = new CLabelUI();
+
+			newField->SetText(order_field.c_str());
+			newField->SetFixedHeight(30);
+
+			pLayout->Add(newField);
+		}
+	}
+
+	//配送时间
+	wstring delivery_date;
+	if (order.m_is_selftake == "1")
+	{
+		delivery_date = L"自取时间:" + CLewaimaiString::UTF8ToUnicode(order.m_delivery_date);
+	}
+	else
+	{
+		delivery_date = L"配送时间:" + CLewaimaiString::UTF8ToUnicode(order.m_delivery_date);
+	}
+
+	CLabelUI *pTime = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_time")));
+	pTime->SetText(delivery_date.c_str());
+
+	CLabelUI *pPayType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_pay_type")));
+	wstring wsPayType = _T("付款方式:") + CLewaimaiString::UTF8ToUnicode(order.m_pay_type);
+	pPayType->SetText(wsPayType.c_str());
 }

+ 1 - 1
lewaimai_dispatch/wnd/CWaimaiOrderInfoUI.h

@@ -2,7 +2,7 @@
 
 #include "../order/CWaimaiOrder.h"
 
-class CWaimaiOrderInfoUI : public CHorizontalLayoutUI
+class CWaimaiOrderInfoUI : public CVerticalLayoutUI
 {
 public:
 	CWaimaiOrderInfoUI()