|
|
@@ -80,7 +80,7 @@ void CZhengcanDiandanPageUI::RefreshShow()
|
|
|
this->InitFoodShow();
|
|
|
|
|
|
//清空购物车
|
|
|
- this->ClearDiandanOrderItemShow();
|
|
|
+ this->UpdateShopcartShow();
|
|
|
|
|
|
//初始化结算页面相关的展示,把所有活动清零
|
|
|
this->InitJiesuanShow();
|
|
|
@@ -466,9 +466,6 @@ void CZhengcanDiandanPageUI::InitJiesuanShow()
|
|
|
CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_label_zhengdanbeizhu")));
|
|
|
pLabel->SetText(L"整单备注:");
|
|
|
|
|
|
- //再初始化取单数量
|
|
|
- RefreshGuadanNum();
|
|
|
-
|
|
|
//先初始化折扣值
|
|
|
CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
|
|
|
pZhekouEdit->SetText(L"100");
|
|
|
@@ -747,24 +744,6 @@ void CZhengcanDiandanPageUI::ShowXuangouPage()
|
|
|
pJiacaiBtn->SetVisible(false);
|
|
|
}
|
|
|
|
|
|
-//只是刷新取单数量
|
|
|
-void CZhengcanDiandanPageUI::RefreshGuadanNum()
|
|
|
-{
|
|
|
- size_t guadan_num = m_guadan_orders.size();
|
|
|
- CLabelUI* pNum = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_qudan_num")));
|
|
|
- if (guadan_num > 0)
|
|
|
- {
|
|
|
- //有挂单的
|
|
|
- pNum->SetText(to_wstring(guadan_num).c_str());
|
|
|
- pNum->SetVisible(true);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //没有挂单的
|
|
|
- pNum->SetVisible(false);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
//处理按钮点击类事件
|
|
|
void CZhengcanDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
{
|
|
|
@@ -1105,110 +1084,78 @@ void CZhengcanDiandanPageUI::HandleTextCapture(std::string content)
|
|
|
this->StartWeixinzhifuShoukuan(content);
|
|
|
}
|
|
|
|
|
|
-void CZhengcanDiandanPageUI::AddDiandanOrderItemShow(int index)
|
|
|
+void CZhengcanDiandanPageUI::UpdateShopcartShow()
|
|
|
{
|
|
|
- CZhengcanOrderItem item = m_cur_diandan_order.getDiandanOrderItem(index);
|
|
|
-
|
|
|
+ //先保留选中
|
|
|
CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
|
|
|
- CDialogBuilder builder;
|
|
|
- CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("diandan_cart_item.xml"), (UINT)0, NULL, m_pManager));
|
|
|
-
|
|
|
- pList->Add(pEle);
|
|
|
+ //先清空
|
|
|
+ pList->RemoveAll();
|
|
|
|
|
|
- if (item.m_is_taocan)
|
|
|
+ int nItemNum = m_cur_diandan_order.getItemNum();
|
|
|
+ for (int i = 0; i < nItemNum; i++)
|
|
|
{
|
|
|
- CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
|
|
|
- pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
|
|
|
+ CZhengcanOrderItem item = m_cur_diandan_order.getDiandanOrderItem(i);
|
|
|
|
|
|
- CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
|
|
|
- pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("diandan_cart_item.xml"), (UINT)0, NULL, m_pManager));
|
|
|
|
|
|
- CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
|
|
|
- pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
|
|
|
+ pList->Add(pEle);
|
|
|
|
|
|
- CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
+ if (item.m_is_taocan)
|
|
|
+ {
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
|
|
|
+ pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
|
|
|
|
|
|
- pEle->SetFixedHeight(84);
|
|
|
- pNature->SetVisible(true);
|
|
|
- pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
|
|
|
- pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
|
|
|
+ CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
|
|
|
+ pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
|
|
|
|
|
|
- CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
|
|
|
- pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
|
|
|
+ CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
|
|
|
+ pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
|
|
|
|
|
|
- CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
|
|
|
- pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
|
|
|
+ CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
|
|
|
- CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
- if (item.is_nature)
|
|
|
- {
|
|
|
pEle->SetFixedHeight(84);
|
|
|
pNature->SetVisible(true);
|
|
|
pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- pEle->SetFixedHeight(42);
|
|
|
- pNature->SetVisible(false);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //更新结算信息
|
|
|
- UpdateJiesuanInfo();
|
|
|
-}
|
|
|
-
|
|
|
-void CZhengcanDiandanPageUI::UpdateDiandanOrderItemShow(int index)
|
|
|
-{
|
|
|
- CZhengcanOrderItem item = m_cur_diandan_order.getDiandanOrderItem(index);
|
|
|
-
|
|
|
- CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
|
|
|
+ pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
|
|
|
|
|
|
- CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(pList->GetItemAt(index));
|
|
|
+ CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
|
|
|
+ pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
|
|
|
|
|
|
- if (item.m_is_taocan)
|
|
|
- {
|
|
|
- CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
|
|
|
- pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
|
|
|
-
|
|
|
- CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
|
|
|
- pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
|
|
|
-
|
|
|
- CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
|
|
|
- pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
|
|
|
+ CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
|
|
|
+ pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
|
|
|
|
|
|
- CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
-
|
|
|
- pEle->SetFixedHeight(84);
|
|
|
- pNature->SetVisible(true);
|
|
|
- pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
+ CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
+ if (item.is_nature)
|
|
|
+ {
|
|
|
+ pEle->SetFixedHeight(84);
|
|
|
+ pNature->SetVisible(true);
|
|
|
+ pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pEle->SetFixedHeight(42);
|
|
|
+ pNature->SetVisible(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- CLabelUI* pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
|
|
|
- pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
|
|
|
|
|
|
- CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
|
|
|
- pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
|
|
|
-
|
|
|
- CLabelUI* pPrice = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_price")));
|
|
|
- pPrice->SetText(CLewaimaiString::UTF8ToUnicode(item.show_price).c_str());
|
|
|
-
|
|
|
- CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
- if (item.is_nature)
|
|
|
+ //保留选中
|
|
|
+ if (nIndex != -1 && pList->GetCount() > 0)
|
|
|
+ {
|
|
|
+ if (nIndex <= pList->GetCount() - 1)
|
|
|
{
|
|
|
- pEle->SetFixedHeight(84);
|
|
|
- pNature->SetVisible(true);
|
|
|
- pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
+ pList->SelectItem(nIndex, false);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- pEle->SetFixedHeight(42);
|
|
|
- pNature->SetVisible(false);
|
|
|
+ pList->SelectItem(pList->GetCount() - 1, false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1216,26 +1163,6 @@ void CZhengcanDiandanPageUI::UpdateDiandanOrderItemShow(int index)
|
|
|
UpdateJiesuanInfo();
|
|
|
}
|
|
|
|
|
|
-void CZhengcanDiandanPageUI::DelDiandanOrderItemShow(int index)
|
|
|
-{
|
|
|
- CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
-
|
|
|
- pList->RemoveAt(index);
|
|
|
-
|
|
|
- //更新结算信息
|
|
|
- UpdateJiesuanInfo();
|
|
|
-}
|
|
|
-
|
|
|
-void CZhengcanDiandanPageUI::ClearDiandanOrderItemShow()
|
|
|
-{
|
|
|
- CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
-
|
|
|
- pList->RemoveAll();
|
|
|
-
|
|
|
- //更新结算信息
|
|
|
- UpdateJiesuanInfo();
|
|
|
-}
|
|
|
-
|
|
|
void CZhengcanDiandanPageUI::UpdateJiesuanInfo()
|
|
|
{
|
|
|
//先按所有的价格公式规则,计算一次价格
|
|
|
@@ -1852,16 +1779,7 @@ void CZhengcanDiandanPageUI::ClickFoodAction()
|
|
|
|
|
|
int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
|
|
|
|
|
|
- if (is_add_new)
|
|
|
- {
|
|
|
- //说明是新增了一项,要刷新一下购物车展示
|
|
|
- this->AddDiandanOrderItemShow(index);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //没有新增,而是修改了一项
|
|
|
- this->UpdateDiandanOrderItemShow(index);
|
|
|
- }
|
|
|
+ this->UpdateShopcartShow();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1918,7 +1836,6 @@ void CZhengcanDiandanPageUI::ClickFoodAction()
|
|
|
newPirce.price = to_string(member_price_info["price"].GetDouble());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
clickItem.m_member_price.push_back(newPirce);
|
|
|
}
|
|
|
|
|
|
@@ -2026,16 +1943,9 @@ void CZhengcanDiandanPageUI::ClickFoodAction()
|
|
|
|
|
|
int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
|
|
|
|
|
|
- if (is_add_new)
|
|
|
- {
|
|
|
- //说明是新增了一项,要刷新一下购物车展示
|
|
|
- this->AddDiandanOrderItemShow(index);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //没有新增,而是修改了一项
|
|
|
- this->UpdateDiandanOrderItemShow(index);
|
|
|
- }
|
|
|
+ UpdateShopcartShow();
|
|
|
+
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2053,7 +1963,7 @@ void CZhengcanDiandanPageUI::ClickAdd()
|
|
|
m_cur_diandan_order.AddNum(nIndex);
|
|
|
|
|
|
//没有新增,而是修改了一项
|
|
|
- this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+ this->UpdateShopcartShow();
|
|
|
}
|
|
|
|
|
|
void CZhengcanDiandanPageUI::ClickDel()
|
|
|
@@ -2069,14 +1979,7 @@ void CZhengcanDiandanPageUI::ClickDel()
|
|
|
bool is_del = m_cur_diandan_order.DelNum(nIndex);
|
|
|
|
|
|
//如果是删掉了,那么就刷新显示
|
|
|
- if (is_del)
|
|
|
- {
|
|
|
- this->DelDiandanOrderItemShow(nIndex);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
- }
|
|
|
+ this->UpdateShopcartShow();
|
|
|
|
|
|
if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
{
|
|
|
@@ -2096,7 +1999,7 @@ void CZhengcanDiandanPageUI::ClickRemove()
|
|
|
|
|
|
m_cur_diandan_order.Remove(nIndex);
|
|
|
|
|
|
- this->DelDiandanOrderItemShow(nIndex);
|
|
|
+ this->UpdateShopcartShow();
|
|
|
|
|
|
if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
{
|
|
|
@@ -2146,7 +2049,7 @@ void CZhengcanDiandanPageUI::ClickGuige()
|
|
|
delete pNatureFrame;
|
|
|
|
|
|
//然后要刷新这个item的显示
|
|
|
- this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+ this->UpdateShopcartShow();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -2186,7 +2089,7 @@ void CZhengcanDiandanPageUI::ClickGuige()
|
|
|
delete pNatureFrame;
|
|
|
|
|
|
//然后要刷新这个item的显示
|
|
|
- this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+ this->UpdateShopcartShow();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -2210,14 +2113,14 @@ void CZhengcanDiandanPageUI::ClickDabao()
|
|
|
m_cur_diandan_order.SetDabao(nIndex);
|
|
|
|
|
|
//没有新增,而是修改了一项
|
|
|
- this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+ this->UpdateShopcartShow();
|
|
|
}
|
|
|
|
|
|
void CZhengcanDiandanPageUI::ClickQingkong()
|
|
|
{
|
|
|
m_cur_diandan_order.Clear();
|
|
|
|
|
|
- this->ClearDiandanOrderItemShow();
|
|
|
+ this->UpdateShopcartShow();
|
|
|
|
|
|
ShowXuangouPage();
|
|
|
}
|
|
|
@@ -3339,16 +3242,7 @@ bool CZhengcanDiandanPageUI::SaomiaoBarcode(std::string barcode)
|
|
|
|
|
|
int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
|
|
|
|
|
|
- if (is_add_new)
|
|
|
- {
|
|
|
- //说明是新增了一项,要刷新一下购物车展示
|
|
|
- this->AddDiandanOrderItemShow(index);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //没有新增,而是修改了一项
|
|
|
- this->UpdateDiandanOrderItemShow(index);
|
|
|
- }
|
|
|
+ this->UpdateShopcartShow();
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -3617,16 +3511,7 @@ bool CZhengcanDiandanPageUI::BiaoqianchengSaomaBarcode(std::string barcode)
|
|
|
|
|
|
int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
|
|
|
|
|
|
- if (is_add_new)
|
|
|
- {
|
|
|
- //说明是新增了一项,要刷新一下购物车展示
|
|
|
- this->AddDiandanOrderItemShow(index);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //没有新增,而是修改了一项
|
|
|
- this->UpdateDiandanOrderItemShow(index);
|
|
|
- }
|
|
|
+ this->UpdateShopcartShow();
|
|
|
|
|
|
return true;
|
|
|
}
|