|
|
@@ -0,0 +1,380 @@
|
|
|
+#include "../pch/pch.h"
|
|
|
+#include "CDianneiOrderInfoPageUI.h"
|
|
|
+
|
|
|
+#include "../control/ControlEx.h"
|
|
|
+
|
|
|
+#include "../wnd/CMainWnd.h"
|
|
|
+
|
|
|
+#include "../network/CMessagePush.h"
|
|
|
+
|
|
|
+#include "../print/CPosPrinter.h"
|
|
|
+
|
|
|
+CDianneiOrderInfoPageUI::CDianneiOrderInfoPageUI()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+CDianneiOrderInfoPageUI::~CDianneiOrderInfoPageUI()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
|
|
|
+void CDianneiOrderInfoPageUI::InitShow()
|
|
|
+{
|
|
|
+ //请求服务器,获取订单数据
|
|
|
+ CDiandanOrder order;
|
|
|
+ order.InitData(m_order_id);
|
|
|
+
|
|
|
+ //刷新订单详情页数据
|
|
|
+ this->SetDate(order);
|
|
|
+ this->Refresh(order);
|
|
|
+}
|
|
|
+
|
|
|
+//处理按钮点击类事件
|
|
|
+void CDianneiOrderInfoPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+ CDuiString name = msg.pSender->GetName();
|
|
|
+
|
|
|
+ if (name == _T("diannei_order_info_page_return"))
|
|
|
+ {
|
|
|
+ m_pMainWnd->SwitchPage(CMainWnd::DIANNEIDINGDAN);
|
|
|
+ }
|
|
|
+ else if (name == _T("diannei_order_info_page_print"))
|
|
|
+ {
|
|
|
+ CPosPrinter printer;
|
|
|
+ printer.PrintDiandanOrder(this->m_order.m_order_id);
|
|
|
+ }
|
|
|
+ else if (name == _T("diannei_order_info_page_refund"))
|
|
|
+ {
|
|
|
+ std::string diannei_order_id = this->m_order.m_order_id;
|
|
|
+
|
|
|
+ CDiandanOrder order;
|
|
|
+ bool ret = order.Refund(diannei_order_id);
|
|
|
+
|
|
|
+ if (ret)
|
|
|
+ {
|
|
|
+ //订单设为成功,这里怎么处理
|
|
|
+ //请求服务器,获取订单数据
|
|
|
+ CDiandanOrder new_order;
|
|
|
+ new_order.InitData(diannei_order_id);
|
|
|
+
|
|
|
+ //刷新订单详情页数据
|
|
|
+ this->SetDate(new_order);
|
|
|
+ this->Refresh(new_order);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理option切换事件
|
|
|
+void CDianneiOrderInfoPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//处理下拉框、radio的切换事件
|
|
|
+void CDianneiOrderInfoPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//处理编辑框输入内容改变事件
|
|
|
+void CDianneiOrderInfoPageUI::HandleTextChangedMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//处理扫码枪捕捉到的扫码信息
|
|
|
+void CDianneiOrderInfoPageUI::HandleTextCapture(std::string content)
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//刷新当前页面的内容,注意这个函数不会改变当前的订单状态以及“页数”
|
|
|
+void CDianneiOrderInfoPageUI::SetDate(CDiandanOrder& order)
|
|
|
+{
|
|
|
+ m_order = order;
|
|
|
+}
|
|
|
+
|
|
|
+void CDianneiOrderInfoPageUI::Refresh(CDiandanOrder& order)
|
|
|
+{
|
|
|
+ std::wstring order_no_show = L"订单号:" + CLewaimaiString::UTF8ToUnicode(order.show_trade_no);
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_order_num"))->SetText(order_no_show.c_str());
|
|
|
+
|
|
|
+ //商品详情的渲染
|
|
|
+ CListUI* pFoodList = static_cast<CListUI*>(this->FindSubControl(_T("diannei_order_info_page_foodlist")));
|
|
|
+ pFoodList->RemoveAll();
|
|
|
+
|
|
|
+ for (std::vector<CDiandanOrderItemPrint>::iterator it = order.m_items_print.begin(); it != order.m_items_print.end(); it++)
|
|
|
+ {
|
|
|
+ std::string food_name = (*it).m_food_name;
|
|
|
+ std::string food_price = (*it).m_item_price;
|
|
|
+ std::string quantity = (*it).m_quantity;
|
|
|
+
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI *>(builder.Create(_T("diannei_order_info_page_listitem.xml"), (UINT)0, NULL, m_pManager));
|
|
|
+
|
|
|
+ CLabelUI *pName = static_cast<CLabelUI *>(pEle->FindSubControl(_T("diannei_order_info_page_listitem_foodname")));
|
|
|
+ pName->SetText(CLewaimaiString::UTF8ToUnicode(food_name).c_str());
|
|
|
+
|
|
|
+ CLabelUI *pQuantity = static_cast<CLabelUI *>(pEle->FindSubControl(_T("diannei_order_info_page_listitem_quantity")));
|
|
|
+ pQuantity->SetText(CLewaimaiString::UTF8ToUnicode(quantity).c_str());
|
|
|
+
|
|
|
+ CLabelUI *pPrice = static_cast<CLabelUI *>(pEle->FindSubControl(_T("diannei_order_info_page_listitem_price")));
|
|
|
+ pPrice->SetText(CLewaimaiString::UTF8ToUnicode(food_price).c_str());
|
|
|
+
|
|
|
+ pFoodList->Add(pEle);
|
|
|
+ }
|
|
|
+
|
|
|
+ //重设商品列表的高度
|
|
|
+ int order_item_height = (order.m_items_print.size() + 1) * 30;
|
|
|
+ pFoodList->SetFixedHeight(order_item_height);
|
|
|
+
|
|
|
+ CLabelUI *pMemo = static_cast<CLabelUI *>(this->FindSubControl(_T("dianneiorder_info_page_memo")));
|
|
|
+ wstring memo = _T("备注:") + CLewaimaiString::UTF8ToUnicode(order.m_memo);
|
|
|
+ pMemo->SetText(memo.c_str());
|
|
|
+
|
|
|
+ //开始展示各种费用
|
|
|
+ CVerticalLayoutUI* pFeesLayout = static_cast<CVerticalLayoutUI *>(this->FindSubControl(_T("diannei_order_info_page_fees")));
|
|
|
+ pFeesLayout->RemoveAll();
|
|
|
+
|
|
|
+ int fees_num = 0;
|
|
|
+
|
|
|
+ if (atof(order.m_shangpinquan_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"商品券优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_shangpinquan_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_cika_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"次卡优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_cika_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_total_member_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"商品会员价优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_total_member_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_zhekou_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"整单折扣优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_zhekou_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_member_zhekou_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"会员折扣优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_member_zhekou_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_quanyika_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"权益卡优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_quanyika_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_manjian_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"满减优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_manjian_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_youhuiquan_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"优惠券优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_youhuiquan_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_rengong_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"人工优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_rengong_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_dabao_money.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"打包费金额:" + CLewaimaiString::UTF8ToUnicode(order.m_dabao_money);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_jiajia.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"加价金额:" + CLewaimaiString::UTF8ToUnicode(order.m_jiajia);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (atof(order.m_moling_youhui.c_str()) > 0)
|
|
|
+ {
|
|
|
+ CLabelUI *pFee = new CLabelUI;
|
|
|
+ pFee->SetFixedHeight(38);
|
|
|
+
|
|
|
+ wstring delivery_fee = L"抹零优惠金额:" + CLewaimaiString::UTF8ToUnicode(order.m_moling_youhui);
|
|
|
+ pFee->SetText(delivery_fee.c_str());
|
|
|
+
|
|
|
+ pFeesLayout->Add(pFee);
|
|
|
+
|
|
|
+ fees_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ int fees_height;
|
|
|
+ if (fees_num == 0)
|
|
|
+ {
|
|
|
+ pFeesLayout->SetVisible(false);
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_fees_line"))->SetVisible(false);
|
|
|
+
|
|
|
+ fees_height = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pFeesLayout->SetVisible(true);
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_fees_line"))->SetVisible(true);
|
|
|
+ pFeesLayout->SetFixedHeight(fees_num * 38);
|
|
|
+
|
|
|
+ fees_height = fees_num * 38;
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI *pTotalPrice = static_cast<CLabelUI *>(this->FindSubControl(_T("diannei_order_info_page_totalprice")));
|
|
|
+ wstring price = L"总计:¥" + CLewaimaiString::UTF8ToUnicode(order.m_total_price);
|
|
|
+ pTotalPrice->SetText(price.c_str());
|
|
|
+
|
|
|
+ int nTotalHeight = order_item_height + fees_height + 173;
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_layout_1"))->SetFixedHeight(nTotalHeight);
|
|
|
+
|
|
|
+ //开始显示顾客信息
|
|
|
+ std::wstring qucanma_show = L"取餐码:" + CLewaimaiString::UTF8ToUnicode(order.take_food_code);
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_qucanma"))->SetText(qucanma_show.c_str());
|
|
|
+
|
|
|
+ std::wstring canpai_show = L"桌号:" + CLewaimaiString::UTF8ToUnicode(order.m_canpai);
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_zhuohao"))->SetText(canpai_show.c_str());
|
|
|
+
|
|
|
+ std::wstring renshu_show = L"人数:" + CLewaimaiString::UTF8ToUnicode(order.m_renshu);
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_renshu"))->SetText(renshu_show.c_str());
|
|
|
+
|
|
|
+ std::wstring order_date_show = L"下单时间:" + CLewaimaiString::UTF8ToUnicode(order.init_time);
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_init_date"))->SetText(order_date_show.c_str());
|
|
|
+
|
|
|
+ //开始处理订单信息
|
|
|
+ std::wstring laiyuan;
|
|
|
+ if (order.order_from == 1)
|
|
|
+ {
|
|
|
+ laiyuan = L"收银机下单";
|
|
|
+ }
|
|
|
+ else if (order.order_from == 2)
|
|
|
+ {
|
|
|
+ laiyuan = L"商家app下单";
|
|
|
+ }
|
|
|
+ else if (order.order_from == 3)
|
|
|
+ {
|
|
|
+ laiyuan = L"扫码下单";
|
|
|
+ }
|
|
|
+
|
|
|
+ CLabelUI *pType = static_cast<CLabelUI *>(this->FindSubControl(_T("diannei_order_info_page_type")));
|
|
|
+ wstring wsType = _T("订单来源:") + laiyuan;
|
|
|
+ pType->SetText(wsType.c_str());
|
|
|
+
|
|
|
+ CLabelUI *pPayType = static_cast<CLabelUI *>(this->FindSubControl(_T("diannei_order_info_page_pay_type")));
|
|
|
+ wstring wsPayType = _T("付款方式:") + CLewaimaiString::UTF8ToUnicode(order.shoukuan_type);
|
|
|
+ pPayType->SetText(wsPayType.c_str());
|
|
|
+
|
|
|
+ CLabelUI *pRefund = static_cast<CLabelUI *>(this->FindSubControl(_T("diannei_order_info_page_refund_status")));
|
|
|
+ if (order.is_refund == "1")
|
|
|
+ {
|
|
|
+ wstring wsPayType = _T("退款状态:已退款");
|
|
|
+ pRefund->SetText(wsPayType.c_str());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ wstring wsPayType = _T("退款状态:未退款");
|
|
|
+ pRefund->SetText(wsPayType.c_str());
|
|
|
+ }
|
|
|
+
|
|
|
+ this->FindSubControl(_T("diannei_order_info_page_layout_3"))->SetFixedHeight(211);
|
|
|
+
|
|
|
+ //退款按钮
|
|
|
+ CButtonUI* refund_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("diannei_order_info_page_refund")));
|
|
|
+
|
|
|
+ if (order.is_refund == "1")
|
|
|
+ {
|
|
|
+ refund_button->SetVisible(false);
|
|
|
+ }
|
|
|
+}
|