| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- #include "CZhengcanTableItemUI.h"
- #include "../pch/pch.h"
- CZhengcanTableItemUI::CZhengcanTableItemUI()
- {
- }
- CZhengcanTableItemUI::~CZhengcanTableItemUI()
- {
- }
- void CZhengcanTableItemUI::DoEvent(TEventUI& event)
- {
- if (event.Type == UIEVENT_BUTTONUP)
- {
- m_pManager->SendNotify(this, DUI_MSGTYPE_CLICK);
- }
- else if (event.Type == UIEVENT_MOUSEENTER)
- {
- HCURSOR hcur = LoadCursor(NULL, IDC_HAND); //加载系统自带鼠标样式
- HWND hwnd = m_pManager->GetPaintWindow(); // 获取绘图窗口句柄
- SetClassLong(hwnd, GCL_HCURSOR, (long)hcur);
- }
- else if (event.Type == UIEVENT_MOUSELEAVE)
- {
- HCURSOR hcur = LoadCursor(NULL, IDC_ARROW); //加载系统自带鼠标样式
- HWND hwnd = m_pManager->GetPaintWindow(); // 获取绘图窗口句柄
- SetClassLong(hwnd, GCL_HCURSOR, (long)hcur);
- }
- CVerticalLayoutUI::DoEvent(event);
- }
- void CZhengcanTableItemUI::SetInfo(std::string table_id, std::string table_name, std::string type_id, std::string status, std::string order_init_time, std::string from_type, std::string order_status, std::string order_id, std::string limit_number, std::string person_num)
- {
- m_table_id = table_id;
- m_table_name = table_name;
- m_type_id = type_id;
- m_status = status;
- m_order_init_time = order_init_time;
- m_from_type = from_type;
- m_order_status = order_status;
- m_order_id = order_id;
- m_limit_number = limit_number;
- m_person_num = person_num;
- }
- void CZhengcanTableItemUI::UpdateShow()
- {
- CLabelUI* pName = static_cast<CLabelUI*>(this->FindSubControl(_T("tablename")));
- pName->SetText(CLewaimaiString::UTF8ToUnicode(m_table_name).c_str());
- CLabelUI* pStatus = static_cast<CLabelUI*>(this->FindSubControl(_T("status")));
- CLabelUI* pRenshu = static_cast<CLabelUI*>(this->FindSubControl(_T("renshu")));
- CLabelUI* pShijian = static_cast<CLabelUI*>(this->FindSubControl(_T("shijian")));
- CControlUI* pPeopleImage = static_cast<CControlUI*>(this->FindSubControl(_T("people_image")));
- CControlUI* pTimeImage = static_cast<CControlUI*>(this->FindSubControl(_T("time_image")));
- pRenshu->SetText(CLewaimaiString::UTF8ToUnicode(m_limit_number).c_str());
- if (m_status == "0")
- {
- //未开台
- pStatus->SetText(L"未开台");
- //隐藏时钟
- pTimeImage->SetVisible(false);
- pShijian->SetVisible(false);
- }
- else if (m_status == "1")
- {
- //预约中
- }
- else if (m_status == "2")
- {
- //已开台
- pRenshu->SetText((CLewaimaiString::UTF8ToUnicode(m_person_num) + L"人").c_str());
- pName->SetTextColor(0xFFFFFFFF);
- pStatus->SetTextColor(0xFFFFFFFF);
- pRenshu->SetTextColor(0xFFFFFFFF);
- pShijian->SetTextColor(0xFFFFFFFF);
- pPeopleImage->SetBkImage(L"zhengcan_people_1.png");
- pTimeImage->SetBkImage(L"zhengcan_time_1.png");
- time_t now = time(NULL);
- time_t init_time = CLewaimaiTime::StringToDatetime(m_order_init_time);
- time_t diff = now - init_time;
- int fenzhong = (int)(diff / 60);
-
- std::wstring ws_fenzhong;
- if (fenzhong > 999)
- {
- ws_fenzhong = L">999";
- }
- else
- {
- ws_fenzhong = to_wstring(fenzhong);
- }
- pShijian->SetText((ws_fenzhong + L"分钟").c_str());
- CHorizontalLayoutUI* pBottom = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(L"zhengcan_tableitem_bottom"));
- //区分待下单、待结账、待清台这3个状态
- if (m_order_id == "0")
- {
- //说明还未下单,处于待下单状态,用绿色
- this->SetBkColor(0xFF3CB371);
- pBottom->SetBkColor(0xFF28A25E);
- pStatus->SetText(L"待下单");
- }
- else if (m_order_status == "SUCCESS")
- {
- //待清台,用蓝色
- this->SetBkColor(0xFF497FC7);
- pBottom->SetBkColor(0xFF3A74C2);
- pStatus->SetText(L"待清台");
- }
- else
- {
- //包含OPEN PASSWORD CLOSE等,只要没支付成功,就是未支付状态
- //说明已下单,未支付,处于待支付状态,用红色
- this->SetBkColor(0xFFF95252);
- pBottom->SetBkColor(0xFFF73F3F);
- pStatus->SetText(L"待结账");
- }
- }
- }
- void CZhengcanTableItemUI::ShowZhuanchu(bool is_show)
- {
- CControlUI* zhuanchuControl = static_cast<CControlUI*>(this->FindSubControl(L"zhuantai_zhuanchu"));
- if (is_show == true)
- {
- zhuanchuControl->SetVisible(true);
- }
- else
- {
- zhuanchuControl->SetVisible(false);
- }
- }
- void CZhengcanTableItemUI::ShowZhuanru(bool is_show)
- {
- CControlUI* zhuanruControl = static_cast<CControlUI*>(this->FindSubControl(L"zhuantai_zhuanru"));
- if (is_show == true)
- {
- zhuanruControl->SetVisible(true);
- }
- else
- {
- zhuanruControl->SetVisible(false);
- }
- }
|