Browse Source

收银的基本功能完成

张洋 1 month ago
parent
commit
ed0f97c967

+ 19 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/saomashouyin_cart_item.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<Window> 
+	<ListContainerElement name="saomashouyin_cart_item" width="610" height="42">
+		<Label name="saomashouyin_cart_item_xuhao" width="50" height="42" align="center"/> 
+
+		<VerticalLayout width="200" height="84">
+			<Label name="saomashouyin_cart_item_name" width="200" height="42" align="left" valign="vcenter" padding="0,0,0,0"  endellipsis="true"/>
+
+			<Label name="saomashouyin_cart_item_nature" width="200" height="42" align="left" padding="0,0,10,0" textcolor="#FF808080" visiable="false" wordbreak="true" endellipsis="true" />
+		</VerticalLayout>
+		
+		<Label name="saomashouyin_cart_item_tiaoma" width="120" height="42" align="center"/> 
+
+		<Label name="saomashouyin_cart_item_danjia" width="80" height="42" align="center"/> 
+		<Label name="saomashouyin_cart_item_num" width="80" height="42" align="center"/> 
+		<Label name="saomashouyin_cart_item_price" width="80" height="42" align="center"/>
+	</ListContainerElement> 
+</Window>

+ 7 - 8
bin/Win32/Debug/zhipuzi_pos_windows/skin/saomashouyin_page.xml

@@ -33,9 +33,9 @@
 					<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">
-							<ListHeaderItem text="序号" width="30" align="center" />
-							<ListHeaderItem text="商品" width="200" align="center" />
+						<ListHeader inset="0,0,0,0" height="42">
+							<ListHeaderItem text="序号" width="50" align="center" />
+							<ListHeaderItem text="商品" width="200" align="left" />
 							<ListHeaderItem text="条码" width="120" align="center" />
 							<ListHeaderItem text="单价" width="80" align="center" />
 							<ListHeaderItem text="数量" width="80" align="center" />
@@ -56,14 +56,13 @@
 
 							<Control></Control>
 							
-							<HorizontalLayout width="200" height="50">
+							<HorizontalLayout width="310" 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>
+								<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'" />
+
+								<Label name="saomashouyin_page_qudan_num" text="10" mouse="false" width="19" height="19" align="center" float="true" pos="185,10,204,29" textcolor="#FFFFFFFF" bkimage="num_bkg.png" bordercolor="#FFFF0000" bordersize="0"></Label>
 							</HorizontalLayout>
-							
-							<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="70">

+ 26 - 63
zhipuzi_pos_windows/page/CSaomashouyinPageUI.cpp

@@ -526,11 +526,6 @@ void CSaomashouyinPageUI::HandleClickMsg(TNotifyUI& msg)
 	else if (name == L"btn_saomashouyin_jixujiacai")
 	{
 		
-	}
-	else if (name == L"btn_saomashouyin_chakanyouhui")
-	{
-		//点击查看优惠
-		this->ClickChakanYouhui();
 	}
 	else if (name == L"btn_saomashouyin_dabao")
 	{
@@ -877,11 +872,20 @@ void CSaomashouyinPageUI::UpdateShopcartShow(bool is_add_new)
 
 		pList->Add(pEle);
 
+		CLabelUI* pXuhao = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_xuhao")));
+		pXuhao->SetText(std::to_wstring(i + 1).c_str());
+
 		if (item.m_is_taocan)
 		{
 			CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_name")));
 			pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
 
+			CLabelUI* pTiaoma = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_tiaoma")));
+			pTiaoma->SetText(L"");
+
+			CLabelUI* pDanjia = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_danjia")));
+			pDanjia->SetText(CLewaimaiString::UTF8ToUnicode(item.price).c_str());
+
 			CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_num")));
 			pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
 
@@ -899,6 +903,12 @@ void CSaomashouyinPageUI::UpdateShopcartShow(bool is_add_new)
 			CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_name")));
 			pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
 
+			CLabelUI* pTiaoma = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_tiaoma")));
+			pTiaoma->SetText(L"abc");
+
+			CLabelUI* pDanjia = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_danjia")));
+			pDanjia->SetText(CLewaimaiString::UTF8ToUnicode(item.price).c_str());
+
 			CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("saomashouyin_cart_item_num")));
 			pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
 
@@ -1252,27 +1262,19 @@ void CSaomashouyinPageUI::UpdateJiesuanInfo()
 
 	//至此优惠全部处理完了,开始刷新各个地方的展示
 
-	//先刷新优惠展示
-	CHorizontalLayoutUI* pYouhuiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("saomashouyin_page_youhui_tishi_layout")));
-	CLabelUI* pYouhuiLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_youhui_tishi")));
+	//再刷新份数显示
+	CLabelUI* pFenshuLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("saomashouyin_page_fenshu")));
 
-	if (total_youhui > 0)
+	if (m_cur_diandan_order.getItemNum() > 0)
 	{
-		std::wstring youhuilabel = L"已优惠 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(total_youhui, 2)) + L" 元";
-		pYouhuiLabel->SetText(youhuilabel.c_str());
-
-		pYouhuiLayout->SetVisible(true);
+		std::wstring ws_fenshu = L"共" + std::to_wstring(m_cur_diandan_order.getItemNum()) + L"行," + std::to_wstring(m_cur_diandan_order.getTotalNum()) + L"份";
+		pFenshuLabel->SetText(ws_fenshu.c_str());
 	}
 	else
 	{
-		pYouhuiLayout->SetVisible(false);
+		pFenshuLabel->SetText(L"共0行,0份");
 	}
 
-	//再刷新打包费展示
-	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")));
 	pmingxiLayout->RemoveAll();
@@ -1732,7 +1734,7 @@ void CSaomashouyinPageUI::ClickFoodAction()
 
 void CSaomashouyinPageUI::ClickAdd()
 {
-	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();
 
@@ -1748,7 +1750,7 @@ void CSaomashouyinPageUI::ClickAdd()
 
 void CSaomashouyinPageUI::ClickDel()
 {
-	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();
 	if (nIndex == -1)
@@ -1763,7 +1765,7 @@ void CSaomashouyinPageUI::ClickDel()
 
 void CSaomashouyinPageUI::ClickRemove()
 {
-	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();
 	if (nIndex == -1)
@@ -1778,7 +1780,7 @@ void CSaomashouyinPageUI::ClickRemove()
 
 void CSaomashouyinPageUI::ClickGuige()
 {
-	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();
 	if (nIndex == -1)
@@ -1868,7 +1870,7 @@ void CSaomashouyinPageUI::ClickGuige()
 
 void CSaomashouyinPageUI::ClickDabao()
 {
-	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();
 
@@ -1980,45 +1982,6 @@ void CSaomashouyinPageUI::ClickGengduoPay()
 	}
 }
 
-void CSaomashouyinPageUI::ClickChakanYouhui()
-{
-	if (m_is_show_modal_wnd == true)
-	{
-		return;
-	}
-
-	//弹框展示所有的优惠
-	CYouhuiShowWnd* pYouhuiDlg = new CYouhuiShowWnd();
-
-	if (pYouhuiDlg != NULL)
-	{
-		m_is_show_modal_wnd = true;
-		m_curModalWnd = pYouhuiDlg;
-
-		pYouhuiDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
-		pYouhuiDlg->SetIcon(IDI_ICON_DUILIB);
-		pYouhuiDlg->CenterWindow();
-
-		pYouhuiDlg->SetYouhuiValue(m_shangpinquan_youhui, m_cika_youhui, m_total_member_youhui, m_zhekou_youhui, m_member_zhekou_youhui, m_quanyika_youhui, m_manjian_youhui, m_youhuiquan_youhui, m_rengong_youhui, m_moling_youhui);
-
-		UINT ret = pYouhuiDlg->ShowModal();
-
-		if (ret == IDOK)
-		{
-			m_is_show_modal_wnd = false;
-
-			delete pYouhuiDlg;
-		}
-		else
-		{
-			m_is_show_modal_wnd = false;
-			delete pYouhuiDlg;
-
-			return;
-		}
-	}
-}
-
 void CSaomashouyinPageUI::ClickMemberLogin()
 {
 	if (m_is_show_modal_wnd == true)

+ 0 - 3
zhipuzi_pos_windows/page/CSaomashouyinPageUI.h

@@ -100,9 +100,6 @@ public:
 	//点击更多支付之后的逻辑
 	void ClickGengduoPay();
 
-	//点击查看优惠
-	void ClickChakanYouhui();
-
 	//处理会员登录
 	void ClickMemberLogin();
 

+ 47 - 37
zhipuzi_pos_windows/zhipuzi/CDiandanOrder.cpp

@@ -1,4 +1,4 @@
-#include "../pch/pch.h"
+锘�#include "../pch/pch.h"
 #include "CDiandanOrder.h"
 
 void CDiandanOrder::RefreshDiandanInfo()
@@ -52,6 +52,16 @@ int CDiandanOrder::getItemNum()
 	return m_items.size();
 }
 
+int CDiandanOrder::getTotalNum()
+{
+	int total_num = 0;
+	for (std::vector<CDiandanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		total_num += std::stoi((*it).num);
+	}
+	return total_num;
+}
+
 std::string CDiandanOrder::getTotalPriceShow()
 {
 	double total_price_show = 0;
@@ -83,8 +93,8 @@ CDiandanOrderItem CDiandanOrder::getDiandanOrderItem(int index)
 	return m_items[index];
 }
 
-//这个函数的逻辑是选择一个新商品的时候,与已有商品进行对比,看看是加一个新的商品,还是对已有商品增加数量
-//返回值是表示新加的item,在第几个元素,方便刷新显示
+//杩欎釜鍑芥暟鐨勯€昏緫鏄�€夋嫨涓€涓�柊鍟嗗搧鐨勬椂鍊欙紝涓庡凡鏈夊晢鍝佽繘琛屽�姣旓紝鐪嬬湅鏄�姞涓€涓�柊鐨勫晢鍝侊紝杩樻槸瀵瑰凡鏈夊晢鍝佸�鍔犳暟閲�
+//杩斿洖鍊兼槸琛ㄧず鏂板姞鐨刬tem锛屽湪绗�嚑涓�厓绱狅紝鏂逛究鍒锋柊鏄剧ず
 int CDiandanOrder::AddItem(CDiandanOrderItem newitem, bool& is_add_new)
 {
 	int index = 0;
@@ -103,7 +113,7 @@ int CDiandanOrder::AddItem(CDiandanOrderItem newitem, bool& is_add_new)
 		index++;
 	}
 
-	//如果找到了,更新数量
+	//濡傛灉鎵惧埌浜嗭紝鏇存柊鏁伴噺
 	if (is_found)
 	{
 		std::string old_num = m_items[index].num;
@@ -111,7 +121,7 @@ int CDiandanOrder::AddItem(CDiandanOrderItem newitem, bool& is_add_new)
 		double d_old_num = std::stod(old_num);
 		double d_new_num = d_old_num + std::stod(newitem.num);
 
-		//如果新的数量是一个整数,那么展示的时候就把小数去掉
+		//濡傛灉鏂扮殑鏁伴噺鏄�竴涓�暣鏁帮紝閭d箞灞曠ず鐨勬椂鍊欏氨鎶婂皬鏁板幓鎺�
 		if (d_new_num - (int)d_new_num < 0.0001)
 		{
 			m_items[index].num = std::to_string((int)d_new_num);
@@ -127,7 +137,7 @@ int CDiandanOrder::AddItem(CDiandanOrderItem newitem, bool& is_add_new)
 	}
 	else
 	{
-		//如果没找到,直接加一个新的item
+		//濡傛灉娌℃壘鍒帮紝鐩存帴鍔犱竴涓�柊鐨刬tem
 		m_items.push_back(newitem);
 
 		m_items[index].UpdateShowPrice();
@@ -145,7 +155,7 @@ void CDiandanOrder::UpdateItemGuige(int index, std::vector<FoodNatureSelectValue
 	this->UpdateGuigePrice(index);
 }
 
-//给某一项添加一个数量
+//缁欐煇涓€椤规坊鍔犱竴涓�暟閲�
 void CDiandanOrder::AddNum(int index)
 {
 	std::string old_num = m_items[index].num;
@@ -153,7 +163,7 @@ void CDiandanOrder::AddNum(int index)
 	double d_old_num = std::stod(old_num);
 	double d_new_num = d_old_num + 1;
 
-	//如果新的数量是一个整数,那么展示的时候就把小数去掉
+	//濡傛灉鏂扮殑鏁伴噺鏄�竴涓�暣鏁帮紝閭d箞灞曠ず鐨勬椂鍊欏氨鎶婂皬鏁板幓鎺�
 	if (d_new_num - (int)d_new_num < 0.0001)
 	{
 		m_items[index].num = std::to_string((int)d_new_num);
@@ -166,7 +176,7 @@ void CDiandanOrder::AddNum(int index)
 	m_items[index].UpdateShowPrice();
 }
 
-//给某一项减少一个数量,返回值为true表示商品本删掉了,也就是为0份;如果为false表示没被删掉
+//缁欐煇涓€椤瑰噺灏戜竴涓�暟閲忥紝杩斿洖鍊间负true琛ㄧず鍟嗗搧鏈�垹鎺変簡锛屼篃灏辨槸涓�0浠斤紱濡傛灉涓篺alse琛ㄧず娌¤�鍒犳帀
 bool CDiandanOrder::DelNum(int index)
 {
 	std::string old_num = m_items[index].num;
@@ -176,14 +186,14 @@ bool CDiandanOrder::DelNum(int index)
 
 	if (d_new_num < 0.0001)
 	{
-		//已经减为0了,那么就删掉这个item
+		//宸茬粡鍑忎负0浜嗭紝閭d箞灏卞垹鎺夎繖涓猧tem
 		m_items.erase(m_items.begin() + index);
 
 		return true;
 	}
 	else
 	{
-		//如果新的数量是一个整数,那么展示的时候就把小数去掉
+		//濡傛灉鏂扮殑鏁伴噺鏄�竴涓�暣鏁帮紝閭d箞灞曠ず鐨勬椂鍊欏氨鎶婂皬鏁板幓鎺�
 		if (d_new_num - (int)d_new_num < 0.0001)
 		{
 			m_items[index].num = std::to_string((int)d_new_num);
@@ -199,14 +209,14 @@ bool CDiandanOrder::DelNum(int index)
 	return false;
 }
 
-//删除某一项
+//鍒犻櫎鏌愪竴椤�
 void CDiandanOrder::Remove(int index)
 {
-	//已经减为0了,那么就删掉这个item
+	//宸茬粡鍑忎负0浜嗭紝閭d箞灏卞垹鎺夎繖涓猧tem
 	m_items.erase(m_items.begin() + index);
 }
 
-//更新了某项的规格,那么重新刷新显示和价格
+//鏇存柊浜嗘煇椤圭殑瑙勬牸锛岄偅涔堥噸鏂板埛鏂版樉绀哄拰浠锋牸
 void CDiandanOrder::UpdateGuigePrice(int index)
 {
 	m_items[index].UpdateShowPrice();
@@ -217,7 +227,7 @@ void CDiandanOrder::SetDabao(int index)
 	m_items[index].SetDabao();
 }
 
-//清空商品
+//娓呯┖鍟嗗搧
 void CDiandanOrder::Clear()
 {
 	m_items.clear();
@@ -241,15 +251,15 @@ bool CDiandanOrder::UseShangpinquan(std::string shangpinquan_food_id, double& yo
 
 		if (curItem.m_is_taocan == false && curItem.food_id == shangpinquan_food_id)
 		{
-			//找到了可以使用的商品
+			//鎵惧埌浜嗗彲浠ヤ娇鐢ㄧ殑鍟嗗搧
 			if (atof(curItem.num.c_str()) > 0.99999)
 			{
-				//如果当前份数大于1,那么抵扣价格就是商品单价
+				//濡傛灉褰撳墠浠芥暟澶т簬1锛岄偅涔堟姷鎵d环鏍煎氨鏄�晢鍝佸崟浠�
 				youhui_value = atof(curItem.price.c_str());
 			}
 			else
 			{
-				//如果当前份数不足1份,那么就抵扣价格就是单价乘以数量
+				//濡傛灉褰撳墠浠芥暟涓嶈冻1浠斤紝閭d箞灏辨姷鎵d环鏍煎氨鏄�崟浠蜂箻浠ユ暟閲�
 				youhui_value = atof(curItem.price.c_str()) * atof(curItem.num.c_str());
 			}
 
@@ -268,22 +278,22 @@ bool CDiandanOrder::UseCikaDikou(std::string cika_food_id, double& youhui_value,
 
 		if (curItem.m_is_taocan == false && curItem.food_id == cika_food_id)
 		{
-			//找到了可以使用的商品
+			//鎵惧埌浜嗗彲浠ヤ娇鐢ㄧ殑鍟嗗搧
 			if (is_shangpinquan_dikou)
 			{
 				if (atof(curItem.num.c_str()) > 1.99999)
 				{
-					//如果当前份数大于2,那么抵扣价格就是商品单价
+					//濡傛灉褰撳墠浠芥暟澶т簬2锛岄偅涔堟姷鎵d环鏍煎氨鏄�晢鍝佸崟浠�
 					youhui_value = atof(curItem.price.c_str());
 				}
 				else if (atof(curItem.num.c_str()) > 0.99999)
 				{
-					//如果当前份数不足2份,但是大于1份,那么就抵扣价格就是单价乘以数量
+					//濡傛灉褰撳墠浠芥暟涓嶈冻2浠斤紝浣嗘槸澶т簬1浠斤紝閭d箞灏辨姷鎵d环鏍煎氨鏄�崟浠蜂箻浠ユ暟閲�
 					youhui_value = atof(curItem.price.c_str()) * (atof(curItem.num.c_str()) - 1);
 				}
 				else
 				{
-					//如果当前份数不足1份,那么已经被商品券抵扣了,次卡不再抵扣
+					//濡傛灉褰撳墠浠芥暟涓嶈冻1浠斤紝閭d箞宸茬粡琚�晢鍝佸埜鎶垫墸浜嗭紝娆″崱涓嶅啀鎶垫墸
 					youhui_value = 0;
 
 					return false;
@@ -293,12 +303,12 @@ bool CDiandanOrder::UseCikaDikou(std::string cika_food_id, double& youhui_value,
 			{
 				if (atof(curItem.num.c_str()) > 0.99999)
 				{
-					//如果当前份数大于1,那么抵扣价格就是商品单价
+					//濡傛灉褰撳墠浠芥暟澶т簬1锛岄偅涔堟姷鎵d环鏍煎氨鏄�晢鍝佸崟浠�
 					youhui_value = atof(curItem.price.c_str());
 				}
 				else
 				{
-					//如果当前份数不足1份,那么就抵扣价格就是单价乘以数量
+					//濡傛灉褰撳墠浠芥暟涓嶈冻1浠斤紝閭d箞灏辨姷鎵d环鏍煎氨鏄�崟浠蜂箻浠ユ暟閲�
 					youhui_value = atof(curItem.price.c_str()) * atof(curItem.num.c_str());
 				}
 			}
@@ -326,7 +336,7 @@ double CDiandanOrder::getTotalMemberYouhui(std::string member_level)
 	return total_youhui;
 }
 
-//计算所有商品的总的打包费
+//璁$畻鎵€鏈夊晢鍝佺殑鎬荤殑鎵撳寘璐�
 double CDiandanOrder::getDabaoMoney()
 {
 	double total_dabao = 0;
@@ -343,7 +353,7 @@ double CDiandanOrder::getDabaoMoney()
 	return total_dabao;
 }
 
-//获取点单相关的参数(仅用于非套餐)
+//鑾峰彇鐐瑰崟鐩稿叧鐨勫弬鏁帮紙浠呯敤浜庨潪濂楅�锛�
 std::string CDiandanOrder::getDiandanFoodlistParam()
 {
 	std::vector<std::map<std::string, std::string>> params;
@@ -363,12 +373,12 @@ std::string CDiandanOrder::getDiandanFoodlistParam()
 	return s_params;
 }
 
-//获取点单相关的套餐参数(仅用于套餐)
+//鑾峰彇鐐瑰崟鐩稿叧鐨勫�椁愬弬鏁帮紙浠呯敤浜庡�椁愶級
 std::string CDiandanOrder::getDiandanTaocanParam()
 {
 	rapidjson::Document doc;
 	doc.SetArray();
-	rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //获取分配器
+	rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //鑾峰彇鍒嗛厤鍣�
 
 	for (std::vector<CDiandanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
 	{
@@ -395,7 +405,7 @@ bool CDiandanOrder::InitData(std::string order_id)
 	bool ret = CZhipuziHttpClient::GetInstance()->Request("/diancan/getorderdetail", params, response);
 	if (!ret)
 	{
-		LOG_INFO("网络请求出错");
+		LOG_INFO("缃戠粶璇锋眰鍑洪敊");
 		return false;
 	}
 
@@ -423,7 +433,7 @@ bool CDiandanOrder::InitData(std::string order_id)
 			return false;
 		}
 
-		//获得数据成功
+		//鑾峰緱鏁版嵁鎴愬姛
 		rapidjson::Value& data = document["data"];
 
 		m_order_id = data["id"].GetString();
@@ -469,7 +479,7 @@ bool CDiandanOrder::InitData(std::string order_id)
 			order_from = 3;
 		}
 
-		//开始保存订单详情
+		//寮€濮嬩繚瀛樿�鍗曡�鎯�
 		rapidjson::Value& v_rows = data["order_item"];
 
 		for (rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
@@ -486,7 +496,7 @@ bool CDiandanOrder::InitData(std::string order_id)
 			m_items_print.push_back(itemPrint);
 		}
 
-		//保存套餐的
+		//淇濆瓨濂楅�鐨�
 		rapidjson::Value& foodpackage_array = data["foodpackage_array"];
 
 		for (rapidjson::SizeType i = 0; i < foodpackage_array.Size(); ++i)
@@ -504,9 +514,9 @@ bool CDiandanOrder::InitData(std::string order_id)
 
 			itemPrint.is_taocan = true;
 
-			taocan_name += CLewaimaiString::UnicodeToUTF8(L"【");
+			taocan_name += CLewaimaiString::UnicodeToUTF8(L"銆�");
 
-			//接着保存套餐的item
+			//鎺ョ潃淇濆瓨濂楅�鐨刬tem
 			rapidjson::Value& food_item = cur_foodpackage["food_item"];
 			for (rapidjson::SizeType j = 0; j < food_item.Size(); ++j)
 			{
@@ -525,11 +535,11 @@ bool CDiandanOrder::InitData(std::string order_id)
 				
 				if (j < food_item.Size() - 1)
 				{
-					taocan_name += CLewaimaiString::UnicodeToUTF8(L"、");
+					taocan_name += CLewaimaiString::UnicodeToUTF8(L"銆�");
 				}
 			}
 
-			taocan_name += CLewaimaiString::UnicodeToUTF8(L"】");
+			taocan_name += CLewaimaiString::UnicodeToUTF8(L"銆�");
 
 			itemPrint.m_food_name = taocan_name;
 
@@ -544,7 +554,7 @@ bool CDiandanOrder::Refund(std::string order_id)
 {
 	std::string url = "/diancan/refund";
 
-	//请求外卖的未处理订单
+	//璇锋眰澶栧崠鐨勬湭澶勭悊璁㈠崟
 	std::map<std::string, std::string> params;
 	params["id"] = order_id;
 	std::string response;

+ 41 - 37
zhipuzi_pos_windows/zhipuzi/CDiandanOrder.h

@@ -1,4 +1,4 @@
-#pragma once
+锘�#pragma once
 
 #include <string>
 #include <vector>
@@ -13,53 +13,53 @@
 class CDiandanOrderItemPrint
 {
 public:
-	std::string m_food_name; //这个是完整展示的名字
+	std::string m_food_name; //杩欎釜鏄�畬鏁村睍绀虹殑鍚嶅瓧
 	std::string m_quantity;
-	std::string m_item_price; //注意这个是单价,不是总价
+	std::string m_item_price; //娉ㄦ剰杩欎釜鏄�崟浠凤紝涓嶆槸鎬讳环
 	std::string m_type_id;
 
-	//表示这个Item是否是套餐的名字
+	//琛ㄧず杩欎釜Item鏄�惁鏄��椁愮殑鍚嶅瓧
 	bool is_taocan = false;
 
-	//表示这个是否是套餐下面的商品详情,主要用于厨房打印的时候,一个套餐下面的每个商品都会生成一个CDiandanOrderItemPrint对象
+	//琛ㄧず杩欎釜鏄�惁鏄��椁愪笅闈㈢殑鍟嗗搧璇︽儏锛屼富瑕佺敤浜庡帹鎴挎墦鍗扮殑鏃跺€欙紝涓€涓��椁愪笅闈㈢殑姣忎釜鍟嗗搧閮戒細鐢熸垚涓€涓狢DiandanOrderItemPrint瀵硅薄
 	bool is_taocan_item = false;
 };
 
 /**
- * 点单里面的一个“订单”,每个选中的商品被加入订单,通过订单数据来计算价格,渲染界面,提交订单也是通过这个数据来提交
- * 挂单、取单操作的也是订单
+ * 鐐瑰崟閲岄潰鐨勪竴涓�€滆�鍗曗€濓紝姣忎釜閫変腑鐨勫晢鍝佽�鍔犲叆璁㈠崟锛岄€氳繃璁㈠崟鏁版嵁鏉ヨ�绠椾环鏍硷紝娓叉煋鐣岄潰锛屾彁浜よ�鍗曚篃鏄�€氳繃杩欎釜鏁版嵁鏉ユ彁浜�
+ * 鎸傚崟銆佸彇鍗曟搷浣滅殑涔熸槸璁㈠崟
  */
 class CDiandanOrder
 {
 public:
 	std::vector<CDiandanOrderItem> m_items;
 
-	//这个是不包含其他费用的纯商品原价
+	//杩欎釜鏄�笉鍖呭惈鍏朵粬璐圭敤鐨勭函鍟嗗搧鍘熶环
 	std::string m_total_price_show;
 
 	std::string m_guadan_time;
 
-	//订单的整单备注
+	//璁㈠崟鐨勬暣鍗曞�娉�
 	std::string m_memo;
 
-	/******  下面这些是专门用于打印的参数,不作为其他用途,点单逻辑中用不到,点单成功后赋值用于打印而已  ***********/
+	/******  涓嬮潰杩欎簺鏄�笓闂ㄧ敤浜庢墦鍗扮殑鍙傛暟锛屼笉浣滀负鍏朵粬鐢ㄩ€旓紝鐐瑰崟閫昏緫涓�敤涓嶅埌锛岀偣鍗曟垚鍔熷悗璧嬪€肩敤浜庢墦鍗拌€屽凡  ***********/
 	std::string shopname;
 	std::string take_food_code;
 	std::string show_trade_no;
 
-	//会员余额和会员卡号,仅会员支付时有用
+	//浼氬憳浣欓�鍜屼細鍛樺崱鍙凤紝浠呬細鍛樻敮浠樻椂鏈夌敤
 	std::string balance;
 	std::string member_number;
 
 	std::string m_renshu;
 
-	//微信支付 会员支付 现金支付 福利卡支付 自定义支付
+	//寰�俊鏀�粯 浼氬憳鏀�粯 鐜伴噾鏀�粯 绂忓埄鍗℃敮浠� 鑷�畾涔夋敮浠�
 	std::string shoukuan_type;
 
-	int order_from; //1 收银机下单 2 商家app下单 3 扫码下单
+	int order_from; //1 鏀堕摱鏈轰笅鍗� 2 鍟嗗�app涓嬪崟 3 鎵�爜涓嬪崟
 	std::string init_time;
 
-	//各种优惠
+	//鍚勭�浼樻儬
 	std::string m_shangpinquan_youhui;
 	std::string m_cika_youhui;
 	std::string m_total_member_youhui;
@@ -71,16 +71,16 @@ public:
 	std::string m_rengong_youhui;
 	std::string m_moling_youhui;
 
-	//加价金额
+	//鍔犱环閲戦�
 	std::string m_jiajia;
 
 	std::string m_shishou_value;
 	std::string m_zhaoling_value;
 
-	//折扣值(1-100)
+	//鎶樻墸鍊硷紙1-100锛�
 	std::string m_zhekou_value;
 
-	//实际最终总价
+	//瀹為檯鏈€缁堟€讳环
 	std::string m_dabao_money;
 	std::string m_total_price;
 	
@@ -88,7 +88,7 @@ public:
 
 	std::vector<CDiandanOrderItemPrint> m_items_print;
 
-	//下面是从订单接口从服务端获取的参数,暂时存在这里
+	//涓嬮潰鏄�粠璁㈠崟鎺ュ彛浠庢湇鍔$�鑾峰彇鐨勫弬鏁帮紝鏆傛椂瀛樺湪杩欓噷
 	std::string m_order_id;
 	std::string is_refund;
 	std::string refund_time;
@@ -96,69 +96,73 @@ public:
 	std::string guazhang;
 
 public:
-	//刷新点单相关的参数,比如一个订单收银成功后准备开始收银下一个订单时,清空之前的信息
+	//鍒锋柊鐐瑰崟鐩稿叧鐨勫弬鏁帮紝姣斿�涓€涓��鍗曟敹閾舵垚鍔熷悗鍑嗗�寮€濮嬫敹閾朵笅涓€涓��鍗曟椂锛屾竻绌轰箣鍓嶇殑淇℃伅
 	void RefreshDiandanInfo();
 
+	//鑾峰彇鏈夊�灏戣�锛屽�灏戜釜涓嶅悓鐨勫晢鍝侊紝娉ㄦ剰杩欓噷鏄�笉鍚岀殑鍟嗗搧锛屼笉鏄�€讳唤鏁�
 	int getItemNum();
 
+	//鑾峰彇鍟嗗搧鐨勬€诲垎鏁�
+	int getTotalNum();
+
 	std::string getTotalPriceShow();
 
 	double getTotalPrice();
 
 	CDiandanOrderItem getDiandanOrderItem(int index);
 
-	//这个函数的逻辑是选择一个新商品的时候,与已有商品进行对比,看看是加一个新的商品,还是对已有商品增加数量
-	//返回值是表示新加的item,在第几个元素,方便刷新显示
+	//杩欎釜鍑芥暟鐨勯€昏緫鏄�€夋嫨涓€涓�柊鍟嗗搧鐨勬椂鍊欙紝涓庡凡鏈夊晢鍝佽繘琛屽�姣旓紝鐪嬬湅鏄�姞涓€涓�柊鐨勫晢鍝侊紝杩樻槸瀵瑰凡鏈夊晢鍝佸�鍔犳暟閲�
+	//杩斿洖鍊兼槸琛ㄧず鏂板姞鐨刬tem锛屽湪绗�嚑涓�厓绱狅紝鏂逛究鍒锋柊鏄剧ず
 	int AddItem(CDiandanOrderItem newitem, bool& is_add_new);
 
 	void UpdateItemGuige(int index, std::vector<FoodNatureSelectValue>& natureSelectedArray);
 
-	//给某一项添加一个数量
+	//缁欐煇涓€椤规坊鍔犱竴涓�暟閲�
 	void AddNum(int index);
 
-	//给某一项减少一个数量,返回值为true表示商品本删掉了,也就是为0份;如果为false表示没被删掉
+	//缁欐煇涓€椤瑰噺灏戜竴涓�暟閲忥紝杩斿洖鍊间负true琛ㄧず鍟嗗搧鏈�垹鎺変簡锛屼篃灏辨槸涓�0浠斤紱濡傛灉涓篺alse琛ㄧず娌¤�鍒犳帀
 	bool DelNum(int index);
 
-	//删除某一项
+	//鍒犻櫎鏌愪竴椤�
 	void Remove(int index);
 
-	//更新了某项的规格,那么重新刷新显示和价格
+	//鏇存柊浜嗘煇椤圭殑瑙勬牸锛岄偅涔堥噸鏂板埛鏂版樉绀哄拰浠锋牸
 	void UpdateGuigePrice(int index);
 
-	//打包
+	//鎵撳寘
 	void SetDabao(int index);
 
-	//清空商品
+	//娓呯┖鍟嗗搧
 	void Clear();
 
 	void SetMemo(std::string memo);
 
 	std::string GetMemo();
 
-	//判断某个商品券是否能使用,如果可以返回true,如果不行返回false,youhui_value是对应的商品券优惠金额
+	//鍒ゆ柇鏌愪釜鍟嗗搧鍒告槸鍚﹁兘浣跨敤锛屽�鏋滃彲浠ヨ繑鍥瀟rue锛屽�鏋滀笉琛岃繑鍥瀎alse锛寉ouhui_value鏄��搴旂殑鍟嗗搧鍒镐紭鎯犻噾棰�
 	bool UseShangpinquan(std::string shangpinquan_food_id, double& youhui_value);
 
-	//判断某个次卡是否能使用,如果可以返回true,如果不行返回false,youhui_value是对应的商品券优惠金额
-	//is_shangpinquan_dikou 同一个商品,是否被商品券抵扣过了,用于商品券和次卡抵扣同一个商品时候的处理
+	//鍒ゆ柇鏌愪釜娆″崱鏄�惁鑳戒娇鐢�紝濡傛灉鍙�互杩斿洖true锛屽�鏋滀笉琛岃繑鍥瀎alse锛寉ouhui_value鏄��搴旂殑鍟嗗搧鍒镐紭鎯犻噾棰�
+	//is_shangpinquan_dikou 鍚屼竴涓�晢鍝侊紝鏄�惁琚�晢鍝佸埜鎶垫墸杩囦簡锛岀敤浜庡晢鍝佸埜鍜屾�鍗℃姷鎵e悓涓€涓�晢鍝佹椂鍊欑殑澶勭悊
 	bool UseCikaDikou(std::string cika_food_id, double& youhui_value, bool is_shangpinquan_dikou);
 
-	//计算所有商品的总的会员优惠金额
+	//璁$畻鎵€鏈夊晢鍝佺殑鎬荤殑浼氬憳浼樻儬閲戦�
 	double getTotalMemberYouhui(std::string member_level);
 
-	//计算所有商品的总的打包费
+	//璁$畻鎵€鏈夊晢鍝佺殑鎬荤殑鎵撳寘璐�
 	double getDabaoMoney();
 
-	//获取点单相关的参数(仅用于非套餐)
+	//鑾峰彇鐐瑰崟鐩稿叧鐨勫弬鏁帮紙浠呯敤浜庨潪濂楅�锛�
 	std::string getDiandanFoodlistParam();
 
-	//获取点单相关的套餐参数(仅用于套餐)
+	//鑾峰彇鐐瑰崟鐩稿叧鐨勫�椁愬弬鏁帮紙浠呯敤浜庡�椁愶級
 	std::string getDiandanTaocanParam();
 
-	/****************************下面这里开始,用于与服务器交互的函数*/
+	/****************************涓嬮潰杩欓噷寮€濮嬶紝鐢ㄤ簬涓庢湇鍔″櫒浜や簰鐨勫嚱鏁�*/
 
-	//根据订单ID,从服务器获取订单的数据,主要用于打印和展示订单详情
+	//鏍规嵁璁㈠崟ID锛屼粠鏈嶅姟鍣ㄨ幏鍙栬�鍗曠殑鏁版嵁锛屼富瑕佺敤浜庢墦鍗板拰灞曠ず璁㈠崟璇︽儏
 	bool InitData(std::string order_id);
 
-	//根据订单ID,进行退款操作
+	//鏍规嵁璁㈠崟ID锛岃繘琛岄€€娆炬搷浣�
 	bool Refund(std::string order_id);
 };