|
|
@@ -901,6 +901,14 @@ void CZhengcanDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
{
|
|
|
this->ClickZhengdanMemo();
|
|
|
}
|
|
|
+ else if (name == L"btn_diandan_chetai")
|
|
|
+ {
|
|
|
+ this->ClickChetai();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_tuicai")
|
|
|
+ {
|
|
|
+ this->ClickTuicai();
|
|
|
+ }
|
|
|
else if (name == L"btn_diandan_xiadan")
|
|
|
{
|
|
|
//点击更多支付
|
|
|
@@ -1305,8 +1313,22 @@ void CZhengcanDiandanPageUI::UpdateShopcartShow()
|
|
|
|
|
|
CZhengcanOrderItem item = *it1;
|
|
|
|
|
|
+ //保存item_id,后面选中点击退菜的时候有用
|
|
|
+ pEle->AddCustomAttribute(L"item_id", CLewaimaiString::UTF8ToUnicode(item.item_id).c_str());
|
|
|
+
|
|
|
CLabelUI * pName = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_name")));
|
|
|
- pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
|
|
|
+ if (item.is_tuicai == "1")
|
|
|
+ {
|
|
|
+ pName->SetText((L"【退菜】" + CLewaimaiString::UTF8ToUnicode(item.getNameShow())).c_str());
|
|
|
+
|
|
|
+ pEle->AddCustomAttribute(L"is_tuicai", L"1");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pName->SetText(CLewaimaiString::UTF8ToUnicode(item.getNameShow()).c_str());
|
|
|
+
|
|
|
+ pEle->AddCustomAttribute(L"is_tuicai", L"0");
|
|
|
+ }
|
|
|
|
|
|
CLabelUI* pNum = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_num")));
|
|
|
pNum->SetText(CLewaimaiString::UTF8ToUnicode(item.num).c_str());
|
|
|
@@ -2412,6 +2434,135 @@ void CZhengcanDiandanPageUI::ClickZhengdanMemo()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void CZhengcanDiandanPageUI::ClickChetai()
|
|
|
+{
|
|
|
+ std::map<string, string> params;
|
|
|
+
|
|
|
+ params["table_id"] = m_table_id;
|
|
|
+
|
|
|
+ std::string response;
|
|
|
+
|
|
|
+ std::string url = "/dinnercash/chetai";
|
|
|
+ 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"];
|
|
|
+
|
|
|
+ //如果走到这里说明撤台成功了
|
|
|
+ m_pMainWnd->SwitchPage(CMainWnd::ZHENGCAN);
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickTuicai()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(pList->GetItemAt(nIndex));
|
|
|
+ std::string item_id = CLewaimaiString::UnicodeToUTF8(pEle->GetCustomAttribute(L"item_id"));
|
|
|
+
|
|
|
+ std::string is_tuicai = CLewaimaiString::UnicodeToUTF8(pEle->GetCustomAttribute(L"is_tuicai"));
|
|
|
+ if (is_tuicai == "1")
|
|
|
+ {
|
|
|
+ //已经是退菜了
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ std::map<string, string> params;
|
|
|
+
|
|
|
+ params["order_id"] = m_order_id;
|
|
|
+
|
|
|
+ std::vector<std::map<string, string>> paramArray;
|
|
|
+
|
|
|
+ std::map<string, string> map_tmp;
|
|
|
+ map_tmp["id"] = item_id;
|
|
|
+ map_tmp["quantity"] = "1";
|
|
|
+
|
|
|
+ paramArray.push_back(map_tmp);
|
|
|
+
|
|
|
+ std::string item_json_string = CLewaimaiJson::ParamArrayToJsonstring(paramArray);
|
|
|
+
|
|
|
+ params["item"] = item_json_string;
|
|
|
+
|
|
|
+ std::string response;
|
|
|
+
|
|
|
+ std::string url = "/dinnercash/retreatfood";
|
|
|
+ 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"];
|
|
|
+
|
|
|
+ //如果走到这里说明退菜成功了,这个时候刷新显示
|
|
|
+ this->InitShow();
|
|
|
+}
|
|
|
+
|
|
|
void CZhengcanDiandanPageUI::ClickXidanBtn()
|
|
|
{
|
|
|
if (m_cur_diandan_order.getItemNum() == 0)
|