|
|
@@ -44,12 +44,16 @@ void CZhengcanDiandanPageUI::InitShow()
|
|
|
//先清空旧的订单信息,如果该桌子有订单关联后面会重新获取
|
|
|
m_cur_diandan_order.RefreshDiandanInfo();
|
|
|
|
|
|
+ this->UpdateShopcartShow();
|
|
|
+
|
|
|
//先检查桌子状态,获取桌子信息
|
|
|
GetTableInfo();
|
|
|
}
|
|
|
|
|
|
void CZhengcanDiandanPageUI::InitTableShow()
|
|
|
{
|
|
|
+ //开始执行这个函数,说明如果订单之前下过单,也已经获取到数据了,需要进行渲染
|
|
|
+
|
|
|
//先初始化商品分类
|
|
|
this->InitFoodtypeShow();
|
|
|
|
|
|
@@ -59,8 +63,8 @@ void CZhengcanDiandanPageUI::InitTableShow()
|
|
|
//初始化结算页面相关的展示,把所有活动清零
|
|
|
this->InitJiesuanShow();
|
|
|
|
|
|
- //计算所有活动优惠,并且调整所有与价格相关的展示
|
|
|
- this->UpdateJiesuanInfo();
|
|
|
+ //渲染左侧购物车(包含了调用UpdateJiesuanInfo重新计算价格)
|
|
|
+ this->UpdateShopcartShow();
|
|
|
|
|
|
//展示选购页面
|
|
|
this->ShowXuangouPage();
|
|
|
@@ -82,14 +86,11 @@ void CZhengcanDiandanPageUI::RefreshShow()
|
|
|
//初始化商品显示(因为这里要刷新商品库存状态)
|
|
|
this->InitFoodShow();
|
|
|
|
|
|
- //清空购物车
|
|
|
- this->UpdateShopcartShow();
|
|
|
-
|
|
|
//初始化结算页面相关的展示,把所有活动清零
|
|
|
this->InitJiesuanShow();
|
|
|
|
|
|
- //计算所有活动优惠,并且调整所有与价格相关的展示
|
|
|
- this->UpdateJiesuanInfo();
|
|
|
+ //渲染左侧购物车(包含了调用UpdateJiesuanInfo重新计算价格)
|
|
|
+ this->UpdateShopcartShow();
|
|
|
|
|
|
//展示选购页面
|
|
|
this->ShowXuangouPage();
|
|
|
@@ -792,10 +793,15 @@ void CZhengcanDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
{
|
|
|
this->ClickZhengdanMemo();
|
|
|
}
|
|
|
- else if (name == L"btn_diandan_gengduozhifu_pay")
|
|
|
+ else if (name == L"btn_diandan_xiadan")
|
|
|
{
|
|
|
//点击更多支付
|
|
|
- this->ClickGengduoPay();
|
|
|
+ this->ClickXidanBtn();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_pay")
|
|
|
+ {
|
|
|
+ //点击更多支付
|
|
|
+ this->ClickPayBtn();
|
|
|
}
|
|
|
else if (name == L"btn_diandan_jixujiacai")
|
|
|
{
|
|
|
@@ -1166,6 +1172,44 @@ void CZhengcanDiandanPageUI::UpdateShopcartShow()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ int xiadan_cishu = m_cur_diandan_order.m_order_history_array.size();
|
|
|
+
|
|
|
+ //开始处理历史的订单数据渲染
|
|
|
+ for (int i = xiadan_cishu - 1; i >= 0 ; i--)
|
|
|
+ {
|
|
|
+ CLabelUI* attention = new CLabelUI();
|
|
|
+ attention->SetText((L"--------------------- 第" + to_wstring(m_cur_diandan_order.m_order_history_array[i].xiadanNum + 1) + L"次下单 --------------------").c_str());
|
|
|
+ attention->SetTextColor(0xFFBBBBBB);
|
|
|
+
|
|
|
+ pList->Add(attention);
|
|
|
+
|
|
|
+ for (std::vector<CZhengcanOrderItem>::iterator it1 = m_cur_diandan_order.m_order_history_array[i].m_items.begin(); it1 != m_cur_diandan_order.m_order_history_array[i].m_items.end(); it1++)
|
|
|
+ {
|
|
|
+ //添加item
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("diandan_cart_item.xml"), (UINT)0, NULL, m_pManager));
|
|
|
+
|
|
|
+ pList->Add(pEle);
|
|
|
+
|
|
|
+ CZhengcanOrderItem item = *it1;
|
|
|
+
|
|
|
+ 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());
|
|
|
+
|
|
|
+ pName->SetTextColor(0xFFBBBBBB);
|
|
|
+ pNum->SetTextColor(0xFFBBBBBB);
|
|
|
+ pPrice->SetTextColor(0xFFBBBBBB);
|
|
|
+
|
|
|
+ pEle->SetFixedHeight(42);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//更新结算信息
|
|
|
UpdateJiesuanInfo();
|
|
|
}
|
|
|
@@ -2179,11 +2223,73 @@ void CZhengcanDiandanPageUI::ClickZhengdanMemo()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void CZhengcanDiandanPageUI::ClickGengduoPay()
|
|
|
+void CZhengcanDiandanPageUI::ClickXidanBtn()
|
|
|
{
|
|
|
if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
{
|
|
|
- m_pMainWnd->ShowToast(L"请先选择商品再支付");
|
|
|
+ m_pMainWnd->ShowToast(L"请先选择菜品再下单");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理下单加菜逻辑
|
|
|
+ std::map<string, string> params;
|
|
|
+
|
|
|
+ params["order_id"] = m_order_id;
|
|
|
+ params["order_no"] = CRandomHelper::GetRandString(20);
|
|
|
+
|
|
|
+ //构建food_list参数
|
|
|
+ params["food_list"] = m_cur_diandan_order.getDiandanFoodlistParam();
|
|
|
+ params["foodpackage_array"] = m_cur_diandan_order.getDiandanTaocanParam();
|
|
|
+ params["persion_num"] = "1";
|
|
|
+ params["note"] = m_cur_diandan_order.GetMemo();
|
|
|
+ params["table_id"] = m_table_id;
|
|
|
+
|
|
|
+ std::string response;
|
|
|
+
|
|
|
+ std::string url = "/dinnercash/sendorder";
|
|
|
+ bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
+ if (ret == false)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ rapidjson::Document document;
|
|
|
+ document.Parse(response.c_str());
|
|
|
+
|
|
|
+ if (document.HasParseError())
|
|
|
+ {
|
|
|
+ LOG_INFO("parse response error!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
+ {
|
|
|
+ LOG_INFO("json error!");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ rapidjson::Value& v_errcode = document["errcode"];
|
|
|
+ int errcode = v_errcode.GetInt();
|
|
|
+ if (errcode != 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!document.HasMember("data"))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ rapidjson::Value& data = document["data"];
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickPayBtn()
|
|
|
+{
|
|
|
+ if (m_cur_diandan_order.getItemNum() > 0)
|
|
|
+ {
|
|
|
+ m_pMainWnd->ShowToast(L"您还有未下单的商品,请先下单再结账");
|
|
|
|
|
|
return;
|
|
|
}
|