张洋 1 month ago
parent
commit
3071f3009c

+ 29 - 17
bin/Win32/Debug/zhipuzi_pos_windows/skin/saomashouyin_page.xml

@@ -29,11 +29,8 @@
 						<Control bkimage="order_delete.png" width="20" height="20" padding="0,20,0,0"></Control>
 						<Button name="btn_saomashouyin_qingkong" text="清空" height="38" width="40" padding="0,10,10,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
 					</HorizontalLayout>
-					
-					<HorizontalLayout height="50" bkcolor="#FFF5F5F5">
-						<Control bkimage="beizhu_tishi.png" width="24" height="24" padding="10,13,0,0"></Control>
-						<Label name="saomashouyin_page_label_zhengdanbeizhu" text="整单备注:" height="30" padding="10,10,10,10" textcolor="#FF8D8D8D"></Label>
-					</HorizontalLayout>
+
+					<Control height="1" bkcolor="#FFEBE8E8"></Control>
 											
 					<List name="list_saomashouyin_cart" padding="0,0,0,0" itemlinecolor="#FF000000" itemvalign="vcenter" vscrollbar="true">
 						<ListHeader inset="10,0,0,0" height="42">
@@ -47,30 +44,39 @@
 					</List>
 					
 					<HorizontalLayout name="saomashouyin_page_youhui_tishi_layout" height="40" bkcolor="#FFFBEEEE" visible="false">
-						<Label name="saomashouyin_page_youhui_tishi" text="已优惠10元" textcolor="#FFFF3838" padding="15,0,0,0" width="270" hegiht="40"></Label>
+						<Label name="saomashouyin_page_youhui_tishi" text="已优惠10元" textcolor="#FFFF3838" padding="15,0,0,0" width="270" height="40"></Label>
 						<Button name="btn_saomashouyin_chakanyouhui" text="查看优惠>" height="30" width="80" padding="5,6,25,0" textcolor="#FF3CB371" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#00FFFFFF"></Button>
 					</HorizontalLayout>
 
 					<Control height="1" bkcolor="#FFEBE8E8"></Control>
 			
 					<VerticalLayout height="145" bkcolor="#FFFFFFFF">
-						<HorizontalLayout height="50">
-							<Label name="saomashouyin_page_otherprice" text="" width="200" align="left" padding="15,14,0,0"></Label>
-							<Label name="saomashouyin_page_totalprice" text="总价:¥0.00" font="20" textcolor="#FFFF4444" width="150" align="right" padding="0,0,15,0"></Label>
+						<HorizontalLayout height="70">
+							<Label name="saomashouyin_page_fenshu" text="共0行,0份" font="20" textcolor="#FFFF4444" width="160" align="left" padding="15,0,0,0"></Label>
+
+							<Control></Control>
 							
-							<HorizontalLayout height="50">
-								<Button name="btn_saomashouyin_cundan" width="90" height="40" padding="10,10,10,0" 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="btn_saomashouyin_qudan" width="90" height="40" padding="10,10,10,0" 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'" />
+							<HorizontalLayout width="200" height="50">
+								<Button name="btn_saomashouyin_cundan" width="90" height="40" padding="10,10,0,0" 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="btn_saomashouyin_qudan" width="90" height="40" padding="10,10,0,0" 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'" />
 							
 								<Label name="saomashouyin_page_qudan_num" text="10" mouse="false" width="19" height="19" align="center" float="true" pos="85,325,104,344" textcolor="#FFFFFFFF" bkimage="num_bkg.png" bordercolor="#FFFF0000" bordersize="0"></Label>
 							</HorizontalLayout>
-
-							<Button name="btn_diandan_shanchu" width="90" height="40" padding="10,10,10,0" 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="btn_saomashouyin_shanchu" width="90" height="40" padding="10,10,10,0" 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'" />
 						</HorizontalLayout>						
 
-						<HorizontalLayout height="50">
-							<Button name="btn_saomashouyin_zhengdanbeizhu" width="90" height="40" padding="10,10,10,0" 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'" />
-						
+						<HorizontalLayout height="70">
+							<HorizontalLayout height="70" padding="0,0,0,0" bkcolor="#FFFFFFFF">
+								<Edit name="saomashouyin_food_search_edit" tooltip="请输入商品名字搜索" width="380" height="50" padding="15,10,0,10" textpadding="50,0,50,0" borderround="15,15" bkcolor="#FFECEFED" nativebkcolor="#FFECEFED" />
+								
+								<Label name="saomashouyin_food_search_tishi" text="请输入商品名字搜索" width="120" height="35" font="16" float="true" pos="75,18,410,50" mouse="false"></Label>
+								
+								<Control bkimage="search_icon.png" width="25" height="26" pos="30,23,55,49" float="true"></Control>
+								
+								<Button name="saomashouyin_food_search_clear" visible="false" width="23" height="23" pos="350,23,373,46" float="true" normalimage="search_clear.png" hotimage="search_clear.png" pushedimage="search_clear.png" bkimage="search_clear.png"></Button>
+							</HorizontalLayout>
+
 							<Button name="btn_saomashouyin_qianxiang" width="90" height="40" padding="10,10,10,0" 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'" />
 						</HorizontalLayout>
 					</VerticalLayout>
@@ -80,6 +86,12 @@
 			</HorizontalLayout>
 			
 			<Control width="1" bkcolor="#FFEBE8E8"></Control>
+
+			<VerticalLayout name="saomashouyin_food_layout" visible="false">				
+				<TileLayout name="saomashouyin_foodlist" padding="0,0,0,0" inset="10,10,0,10" childpadding="10" vscrollbar="true" hscrollbar="false">
+				
+				</TileLayout>
+			</VerticalLayout>
 			
 			<HorizontalLayout name="saomashouyin_jiesuan_layout" bkcolor="#FFFFFFFF">
 				<VerticalLayout name="saomashouyin_jiesuan_youhui_layout" width="330">

+ 437 - 72
zhipuzi_pos_windows/page/CSaomashouyinPageUI.cpp

@@ -74,6 +74,106 @@ void CSaomashouyinPageUI::RefreshShow()
 	this->UpdateShopcartShow();
 }
 
+void CSaomashouyinPageUI::InitFoodShow()
+{
+	std::string setting_xianshi_is_youtu = CSetting::GetInstance()->GetParam("setting_xianshi_is_youtu");
+
+	m_foodLayout = static_cast<CTileLayoutUI*>(this->FindSubControl(_T("saomashouyin_foodlist")));
+	m_foodLayout->RemoveAll();
+
+	std::wstring xml_name;
+
+	if (setting_xianshi_is_youtu == "1")
+	{
+		SIZE itemsize;
+		itemsize.cx = 130;
+		itemsize.cy = 200;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_youtu.xml");
+	}
+	else if (setting_xianshi_is_youtu == "2")
+	{
+		SIZE itemsize;
+		itemsize.cx = 230;
+		itemsize.cy = 90;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_youtu_2.xml");
+	}
+	else if (setting_xianshi_is_youtu == "3")
+	{
+		SIZE itemsize;
+		itemsize.cx = 140;
+		itemsize.cy = 120;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_youtu_3.xml");
+	}
+	else
+	{
+		SIZE itemsize;
+		itemsize.cx = 140;
+		itemsize.cy = 100;
+		m_foodLayout->SetItemSize(itemsize);
+
+		xml_name = _T("diandan_fooditem_wutu.xml");
+	}
+
+	//如果当前一个分类都没有,那么就不处理了
+	if (m_cur_type_id == "")
+	{
+		return;
+	}
+	else if (m_cur_type_id == "sousuo")
+	{
+		if (CLewaimaiString::is_only_number(m_sousuo_foodname))
+		{
+			//说明是纯数字,按商品条码来搜索
+			CSqlite3 sqlite;
+			CFood food;
+
+			bool ret = sqlite.GetFoodByBarcode(m_sousuo_foodname, food);
+
+			if (ret)
+			{
+				CDialogBuilder builder;
+				CDialogBuilderCallbackEx cb;
+
+				CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+				m_foodLayout->Add(pItem);
+
+				pItem->SetYoutuModel(setting_xianshi_is_youtu);
+				pItem->SetFoodInfo(food);
+				pItem->UpdateShow();
+			}
+		}
+		else
+		{
+			//当商品名字来搜索
+			CSqlite3 sqlite;
+			std::vector<CFood> foodlist = sqlite.GetFoodByFoodname(m_sousuo_foodname);
+
+			for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
+			{
+				CFood food = *it;
+
+				CDialogBuilder builder;
+				CDialogBuilderCallbackEx cb;
+
+				CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
+
+				m_foodLayout->Add(pItem);
+
+				pItem->SetYoutuModel(setting_xianshi_is_youtu);
+				pItem->SetFoodInfo(food);
+				pItem->UpdateShow();
+			}
+		}
+	}
+}
+
 //仅仅初始化结算相关的显示(比如折扣、优惠、价格等)
 void CSaomashouyinPageUI::InitJiesuanShow()
 {
@@ -83,10 +183,6 @@ void CSaomashouyinPageUI::InitJiesuanShow()
 	m_is_member_zhekou = false;
 	m_member_zhekou_value = 10;
 
-	//整单备注
-	CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_label_zhengdanbeizhu")));
-	pLabel->SetText(L"整单备注:");
-
 	//再初始化取单数量
 	RefreshGuadanNum();
 
@@ -341,6 +437,33 @@ void CSaomashouyinPageUI::UpdateJiesuanZhifuPos()
 	pZhifufangshiLayout->SetFixedHeight(lastRow * 105);
 }
 
+//展示结算页面,隐藏选购页面
+void CSaomashouyinPageUI::ShowJiesuanPage()
+{
+	//先隐藏商品页面
+	CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("saomashouyin_food_layout")));
+	pFoodLayout->SetVisible(false);
+
+	//再展示结算页面
+	CHorizontalLayoutUI* pJiesuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_layout")));
+	pJiesuanLayout->SetVisible(true);
+
+	//更新结算按钮位置
+	UpdateJiesuanZhifuPos();
+}
+
+//展示选购页面,隐藏结算页面
+void CSaomashouyinPageUI::ShowXuangouPage()
+{
+	//先展示商品页面
+	CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("saomashouyin_food_layout")));
+	pFoodLayout->SetVisible(true);
+
+	//再隐藏结算页面
+	CHorizontalLayoutUI* pJiesuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_layout")));
+	pJiesuanLayout->SetVisible(false);
+}
+
 //只是刷新取单数量
 void CSaomashouyinPageUI::RefreshGuadanNum()
 {
@@ -364,7 +487,15 @@ void CSaomashouyinPageUI::HandleClickMsg(TNotifyUI& msg)
 {
 	CDuiString name = msg.pSender->GetName();
 
-	if (name == L"btn_saomashouyin_jia")
+	if (name == L"diandan_fooditem")
+	{
+		CDiandanFoodItemUI* fooditemUI = static_cast<CDiandanFoodItemUI*>(msg.pSender);
+
+		m_cur_click_food_item = fooditemUI;
+
+		this->ClickFoodAction();
+	}
+	else if (name == L"btn_saomashouyin_jia")
 	{
 		this->ClickAdd();
 	}
@@ -387,10 +518,6 @@ void CSaomashouyinPageUI::HandleClickMsg(TNotifyUI& msg)
 
 		this->ClickQingkong();
 	}
-	else if (name == L"btn_saomashouyin_zhengdanbeizhu")
-	{
-		this->ClickZhengdanMemo();
-	}
 	else if (name == L"btn_saomashouyin_gengduozhifu_pay")
 	{
 		//点击更多支付
@@ -478,6 +605,13 @@ void CSaomashouyinPageUI::HandleClickMsg(TNotifyUI& msg)
 
 		this->StartZidingyiShoukuan(name, selfpay_id);
 	}
+	else if (name == L"saomashouyin_food_search_clear")
+	{
+		CEditUI* m_pEdit = static_cast<CEditUI*>(m_pManager->FindControl(_T("saomashouyin_food_search_edit")));
+		m_pEdit->SetText(L"");
+
+		StopSerachFood();
+	}
 	else if (name == L"btn_saomashouyin_cundan")
 	{
 		this->ClickCundan();
@@ -585,7 +719,24 @@ void CSaomashouyinPageUI::HandleTextChangedMsg(TNotifyUI& msg)
 {
 	CDuiString name = msg.pSender->GetName();
 
-	
+	if (name == L"saomashouyin_food_search_edit")
+	{
+		//商品搜索框的输入事件
+		CEditUI* m_pEdit = static_cast<CEditUI*>(m_pManager->FindControl(_T("saomashouyin_food_search_edit")));
+		std::wstring ws_Value = m_pEdit->GetText();
+		std::string strValue = CLewaimaiString::UnicodeToUTF8(ws_Value);
+
+		if (strValue.length() == 0)
+		{
+			//搜索词被清空了,退出搜索
+			this->StopSerachFood();
+		}
+		else
+		{
+			//搜索词没清空,进入搜索
+			this->StartSearchFood(strValue);
+		}
+	}
 }
 
 //处理扫码枪捕捉到的扫码信息
@@ -707,7 +858,7 @@ bool CSaomashouyinPageUI::HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM l
 void CSaomashouyinPageUI::UpdateShopcartShow(bool is_add_new)
 {
 	//先保留选中
-	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
+	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_saomashouyin_cart")));
 	int nIndex = pList->GetCurSel();
 
 	//保留滚动条位置
@@ -1118,20 +1269,9 @@ void CSaomashouyinPageUI::UpdateJiesuanInfo()
 	}
 
 	//再刷新打包费展示
-	CLabelUI* pOtherPriceLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_otherprice")));
-	if (m_dabao > 0)
-	{
-		std::wstring ws_dabaofei = L"打包费 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_dabao, 2)) + L" 元";
-		pOtherPriceLabel->SetText(ws_dabaofei.c_str());
-	}
-	else
-	{
-		pOtherPriceLabel->SetText(L"");
-	}
-
-	//再刷新总价展示
-	CLabelUI* pTotalPrice = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_totalprice")));
-	pTotalPrice->SetText((L"总价:¥" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(cur_price, 2))).c_str());
+	CLabelUI* pFenshuLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_fenshu")));
+	//std::wstring ws_dabaofei = L"打包费 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_dabao, 2)) + L" 元";
+	//pFenshuLabel->SetText(ws_dabaofei.c_str());
 
 	//再刷新账单明细展示
 	CVerticalLayoutUI* pmingxiLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("saomashouyin_jiesuan_zhangdanmingxi_jiage_layout")));
@@ -1359,6 +1499,237 @@ void CSaomashouyinPageUI::UpdateJiesuanInfo()
 	CShuangpingTool::GetInstance()->UpdateShow(m_cur_diandan_order, total_youhui, cur_price, m_dabao);
 }
 
+void CSaomashouyinPageUI::ClickFoodAction()
+{
+	bool is_taocan = m_cur_click_food_item->GetIsTaocan();
+
+	if (is_taocan)
+	{
+		//点击套餐之后的处理逻辑
+		CFoodpackage foodpackageinfo = m_cur_click_food_item->GetFoodpackageInfo();
+
+		CDiandanOrderItem clickItem;
+
+		clickItem.foodpackage_id = foodpackageinfo.id;
+		clickItem.foodpackage_name = foodpackageinfo.name;
+		clickItem.price = foodpackageinfo.price;
+		clickItem.is_dabao = false;
+		clickItem.dabao_money = foodpackageinfo.dabao_money;
+		clickItem.num = "1";
+
+		//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+		clickItem.SetFoodpackageInfo(m_cur_click_food_item->GetFoodpackageInfo());
+		clickItem.SetIsTaocan(true);
+
+		if (m_is_show_modal_wnd == true)
+		{
+			return;
+		}
+
+		//先弹框进行选择属性
+		CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(1);
+		pNatureFrame->SetFoodItemUI(m_cur_click_food_item);
+
+		if (pNatureFrame != NULL)
+		{
+			m_is_show_modal_wnd = true;
+			m_curModalWnd = pNatureFrame;
+
+			pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+			pNatureFrame->SetIcon(IDI_ICON_DUILIB);
+			pNatureFrame->CenterWindow();
+			UINT ret = pNatureFrame->ShowModal();
+
+			if (ret == IDOK)
+			{
+				//保存选择的属性
+				std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
+				clickItem.natureSelectedArray = natureSelectedArray;
+
+				m_is_show_modal_wnd = false;
+				delete pNatureFrame;
+			}
+			else
+			{
+				m_is_show_modal_wnd = false;
+				delete pNatureFrame;
+
+				return;
+			}
+		}
+
+		//商品没有商品属性
+		bool is_add_new = false;
+
+		int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
+
+		this->UpdateShopcartShow(is_add_new);
+	}
+	else
+	{
+		//点击普通商品之后的处理逻辑
+		CFood foodinfo = m_cur_click_food_item->GetFoodInfo();
+
+		if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < 0.001)
+		{
+			//库存为0了,不做任何处理
+			m_pMainWnd->ShowToast(L"该商品已售完");
+			return;
+		}
+
+		CDiandanOrderItem clickItem;
+
+		clickItem.food_id = foodinfo.id;
+		clickItem.food_name = foodinfo.name;
+		clickItem.type_id = foodinfo.type_id;
+		clickItem.price = foodinfo.price;
+		clickItem.is_dabao = false;
+		clickItem.dabao_money = foodinfo.dabao_money;
+		clickItem.num = "1";
+
+		if (foodinfo.member_price_used == "1")
+		{
+			clickItem.is_member_price_used = true;
+		}
+		else
+		{
+			clickItem.is_member_price_used = false;
+		}
+
+		//处理会员价的json
+		std::string member_price_json = foodinfo.member_price_json;
+
+		rapidjson::Document document;
+		document.Parse(member_price_json.c_str());
+
+		rapidjson::Value& member_price = document;
+		for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
+		{
+			rapidjson::Value& member_price_info = member_price[i];
+
+			MemberPrice newPirce;
+			newPirce.id = CLewaimaiJson::ToString(member_price_info["id"]);
+			newPirce.level = CLewaimaiJson::ToString(member_price_info["level"]);
+			newPirce.price = CLewaimaiJson::ToString(member_price_info["price"]);
+
+			clickItem.m_member_price.push_back(newPirce);
+		}
+
+		//把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
+		clickItem.SetFoodInfo(m_cur_click_food_item->GetFoodInfo());
+		clickItem.SetIsTaocan(false);
+
+		if (foodinfo.is_weight == "1")
+		{
+			if (m_is_dianzicheng_lianjie == false)
+			{
+				//设置中心未连接电子秤
+				m_pMainWnd->ShowToast(L"未连接电子秤,请检查连接设置");
+				return;
+			}
+
+			clickItem.is_weight = true;
+
+			if (m_is_show_modal_wnd == true)
+			{
+				return;
+			}
+
+			//这里要弹出称重框,不弹属性框
+			CChengzhongWnd* pChengzhongFrame = new CChengzhongWnd();
+
+			if (pChengzhongFrame != NULL)
+			{
+				m_is_show_modal_wnd = true;
+				m_curModalWnd = pChengzhongFrame;
+
+				pChengzhongFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+				pChengzhongFrame->SetIcon(IDI_ICON_DUILIB);
+				pChengzhongFrame->CenterWindow();
+
+				pChengzhongFrame->SetTitle(CLewaimaiString::UTF8ToUnicode(foodinfo.name));
+
+				UINT ret = pChengzhongFrame->ShowModal();
+
+				if (ret == IDOK)
+				{
+					std::string weight = pChengzhongFrame->m_weight;
+					if (atof(weight.c_str()) < 0.001)
+					{
+						return;
+					}
+
+					clickItem.num = weight;
+
+					m_is_show_modal_wnd = false;
+					delete pChengzhongFrame;
+				}
+				else
+				{
+					m_is_show_modal_wnd = false;
+					delete pChengzhongFrame;
+
+					return;
+				}
+			}
+		}
+		else
+		{
+			clickItem.is_weight = false;
+
+			if (foodinfo.is_nature == "1")
+			{
+				//商品有商品属性
+				clickItem.is_nature = true;
+
+				if (m_is_show_modal_wnd == true)
+				{
+					return;
+				}
+
+				//先弹框进行选择属性
+				CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(1);
+				pNatureFrame->SetFoodItemUI(m_cur_click_food_item);
+
+				if (pNatureFrame != NULL)
+				{
+					m_is_show_modal_wnd = true;
+					m_curModalWnd = pNatureFrame;
+
+					pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+					pNatureFrame->SetIcon(IDI_ICON_DUILIB);
+					pNatureFrame->CenterWindow();
+					UINT ret = pNatureFrame->ShowModal();
+
+					if (ret == IDOK)
+					{
+						//保存选择的属性
+						std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
+						clickItem.natureSelectedArray = natureSelectedArray;
+
+						m_is_show_modal_wnd = false;
+						delete pNatureFrame;
+					}
+					else
+					{
+						m_is_show_modal_wnd = false;
+						delete pNatureFrame;
+
+						return;
+					}
+				}
+			}
+		}
+
+		//商品没有商品属性
+		bool is_add_new = false;
+
+		int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
+
+		this->UpdateShopcartShow(is_add_new);
+	}
+}
+
 void CSaomashouyinPageUI::ClickAdd()
 {
 	CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
@@ -1599,53 +1970,6 @@ void CSaomashouyinPageUI::ClickQudan()
 	}
 }
 
-void CSaomashouyinPageUI::ClickZhengdanMemo()
-{
-	if (m_is_show_modal_wnd == true)
-	{
-		return;
-	}
-
-	CMemoWnd* pMemoDlg = new CMemoWnd();
-
-	if (pMemoDlg != NULL)
-	{
-		m_is_show_modal_wnd = true;
-		m_curModalWnd = pMemoDlg;
-
-		pMemoDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
-		pMemoDlg->SetIcon(IDI_ICON_DUILIB);
-		pMemoDlg->CenterWindow();
-
-		pMemoDlg->SetTitle(L"整单备注");
-
-		UINT ret = pMemoDlg->ShowModal();
-
-		if (ret == IDOK)
-		{
-			//保存选择的属性
-			std::string sMemo = pMemoDlg->getContent();
-
-			//渲染整单备注的展示
-			CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_label_zhengdanbeizhu")));
-			pLabel->SetText((L"整单备注:" + CLewaimaiString::UTF8ToUnicode(sMemo)).c_str());
-
-			//保存备注,提交订单的时候用
-			m_cur_diandan_order.SetMemo(sMemo);
-
-			m_is_show_modal_wnd = false;
-			delete pMemoDlg;
-		}
-		else
-		{
-			m_is_show_modal_wnd = false;
-			delete pMemoDlg;
-
-			return;
-		}
-	}
-}
-
 void CSaomashouyinPageUI::ClickGengduoPay()
 {
 	if (m_cur_diandan_order.getItemNum() == 0)
@@ -3014,6 +3338,47 @@ bool CSaomashouyinPageUI::BiaoqianchengSaomaBarcode(std::string barcode)
 	return true;
 }
 
+//开始搜索某个商品名字
+void CSaomashouyinPageUI::StartSearchFood(std::string foodname)
+{
+	this->ShowXuangouPage();
+	
+	//展示删除按钮
+	CButtonUI* pClear = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_food_search_clear")));
+	pClear->SetVisible(true);
+
+	if (m_cur_type_id != "sousuo")
+	{
+		m_type_id_before_sousuo = m_cur_type_id;
+	}
+
+	m_cur_type_id = "sousuo";
+
+	m_sousuo_foodname = foodname;
+
+	CLabelUI* pTishi = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_food_search_tishi")));
+	pTishi->SetVisible(false);
+
+	this->InitFoodShow();
+}
+
+//停止搜索商品
+void CSaomashouyinPageUI::StopSerachFood()
+{
+	this->ShowJiesuanPage();
+
+	//隐藏删除按钮
+	CButtonUI* pClear = static_cast<CButtonUI*>(this->FindSubControl(_T("saomashouyin_food_search_clear")));
+	pClear->SetVisible(false);
+
+	m_cur_type_id = m_type_id_before_sousuo;
+
+	CLabelUI* pTishi = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_food_search_tishi")));
+	pTishi->SetVisible(true);
+
+	this->InitFoodShow();
+}
+
 void CSaomashouyinPageUI::StartWorkAfterShoukuan(std::string kucunstring, std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance, std::string member_number)
 {
 	//针对现金收款成功,单独做一个打开钱箱的判断处理

+ 18 - 3
zhipuzi_pos_windows/page/CSaomashouyinPageUI.h

@@ -26,6 +26,9 @@ public:
 	//收款一个订单成功,准备开始收款第2个订单的时候调用(会多次调度用)
 	void RefreshShow();
 
+	//根据当前选择的分类,刷新商品展示
+	void InitFoodShow();
+
 	//仅仅初始化结算相关的显示(比如折扣、优惠、价格等)
 	void InitJiesuanShow();
 
@@ -35,6 +38,12 @@ public:
 	//这个只更新结算页面支付方式的位置,不处理控件添加
 	void UpdateJiesuanZhifuPos();
 
+	//展示结算页面,隐藏选购页面
+	void ShowJiesuanPage();
+
+	//展示选购页面,隐藏结算页面
+	void ShowXuangouPage();
+
 	//只是刷新取单数量
 	void RefreshGuadanNum();
 
@@ -61,6 +70,9 @@ public:
 	//任何可以引起价格变化的,比如添加、修改、删除商品,或者修改优惠等,需要重新计算总价格,刷新结算账单等地方的显示,都要调用这个方法
 	void UpdateJiesuanInfo();
 
+	//点击某一个商品的item之后的处理逻辑
+	void ClickFoodAction();
+
 	//点击加号之后的逻辑
 	void ClickAdd();
 
@@ -85,9 +97,6 @@ public:
 	//点击取单之后的逻辑
 	void ClickQudan();
 
-	//点击整单备注之后的逻辑
-	void ClickZhengdanMemo();
-
 	//点击更多支付之后的逻辑
 	void ClickGengduoPay();
 
@@ -163,6 +172,12 @@ public:
 	//判断是不是标签秤的条码,并进行处理,返回true表示是标签秤的条码,返回false表示不是
 	bool BiaoqianchengSaomaBarcode(std::string barcode);
 
+	//开始搜索某个商品名字
+	void StartSearchFood(std::string foodname);
+
+	//停止搜索商品
+	void StopSerachFood();
+
 	//执行付款成功后的所有操作逻辑
 	void StartWorkAfterShoukuan(std::string kucunstring, std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance = "", std::string member_number = "");