|
|
@@ -66,6 +66,18 @@ void CDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
|
|
|
this->ClickFoodAction();
|
|
|
}
|
|
|
+ else if (name == L"btn_diandan_jia")
|
|
|
+ {
|
|
|
+ this->ClickAdd();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_jian")
|
|
|
+ {
|
|
|
+ this->ClickDel();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_shanchu")
|
|
|
+ {
|
|
|
+ this->ClickRemove();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//处理option切换事件
|
|
|
@@ -254,6 +266,17 @@ void CDiandanPageUI::UpdateDiandanOrderItemShow(int index)
|
|
|
pTotalPrice->SetText((L"总价:¥" + CLewaimaiString::UTF8ToUnicode(m_cur_diandan_order.getTotalPriceShow())).c_str());
|
|
|
}
|
|
|
|
|
|
+void CDiandanPageUI::DelDiandanOrderItemShow(int index)
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ pList->RemoveAt(index);
|
|
|
+
|
|
|
+ //更新总价显示
|
|
|
+ CLabelUI* pTotalPrice = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_totalprice")));
|
|
|
+ pTotalPrice->SetText((L"总价:¥" + CLewaimaiString::UTF8ToUnicode(m_cur_diandan_order.getTotalPriceShow())).c_str());
|
|
|
+}
|
|
|
+
|
|
|
void CDiandanPageUI::ClickFoodAction()
|
|
|
{
|
|
|
bool is_taocan = m_cur_click_food_item->GetIsTaocan();
|
|
|
@@ -325,4 +348,59 @@ void CDiandanPageUI::ClickFoodAction()
|
|
|
this->UpdateDiandanOrderItemShow(index);
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+void CDiandanPageUI::ClickAdd()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_diandan_order.AddNum(nIndex);
|
|
|
+
|
|
|
+ //没有新增,而是修改了一项
|
|
|
+ this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+}
|
|
|
+
|
|
|
+void CDiandanPageUI::ClickDel()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool is_del = m_cur_diandan_order.DelNum(nIndex);
|
|
|
+
|
|
|
+ //如果是删掉了,那么就刷新显示
|
|
|
+ if (is_del)
|
|
|
+ {
|
|
|
+ this->DelDiandanOrderItemShow(nIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CDiandanPageUI::ClickRemove()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_diandan_order.Remove(nIndex);
|
|
|
+
|
|
|
+ this->DelDiandanOrderItemShow(nIndex);
|
|
|
+}
|