| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768 |
- #include "pch.h"
- #include "CWaimaiOrderInfoPageUI.h"
- #include "../control/ControlEx.h"
- #include "../wnd/CWaimaiOrderFailReasonWnd.h"
- #include "../print/CPosPrinter.h"
- // =====================================================================
- // R76d · 字段行辅助
- // 字段行 = 80px 灰标签(#8A9099) + 深色值(#1F2329),用两个纯文本 Label 实现。
- // 原因:DuiLib 富文本 <c #xxxxxx> / <x i> 在本项目中渲染为空(全代码库仅本页使用),
- // 因此改用与 MakeFeeRow 同构的“双 Label”方案,完全不走 DrawHtmlText。
- // =====================================================================
- static CHorizontalLayoutUI* MakeFieldRow(const std::wstring& wsLabel, const std::wstring& wsValue, LPCTSTR pszValueColor = _T("#FF1F2329"))
- {
- CHorizontalLayoutUI* pRow = new CHorizontalLayoutUI;
- pRow->SetFixedHeight(31);
- CLabelUI* pLab = new CLabelUI;
- pLab->SetAttribute(_T("font"), _T("13"));
- pLab->SetAttribute(_T("textcolor"), _T("#FF8A9099"));
- pLab->SetFixedHeight(31);
- pLab->SetFixedWidth(80);
- pLab->SetText(wsLabel.c_str());
- CLabelUI* pVal = new CLabelUI;
- pVal->SetAttribute(_T("font"), _T("13"));
- pVal->SetAttribute(_T("textcolor"), pszValueColor);
- pVal->SetFixedHeight(31);
- pVal->SetText(wsValue.empty() ? L"-" : wsValue.c_str());
- pRow->Add(pLab);
- pRow->Add(pVal);
- return pRow;
- }
- // 费用行:标签靠左(灰) + 金额靠右(深),两端对齐
- static CHorizontalLayoutUI* MakeFeeRow(const std::wstring& wsLabel, const std::wstring& wsValue)
- {
- CHorizontalLayoutUI* pRow = new CHorizontalLayoutUI;
- pRow->SetFixedHeight(30);
- CLabelUI* pLab = new CLabelUI;
- pLab->SetAttribute(_T("font"), _T("13"));
- pLab->SetAttribute(_T("textcolor"), _T("#FF8A9099"));
- pLab->SetAttribute(_T("align"), _T("left"));
- pLab->SetFixedWidth(160);
- pLab->SetText(wsLabel.c_str());
- CLabelUI* pVal = new CLabelUI;
- pVal->SetAttribute(_T("font"), _T("13"));
- pVal->SetAttribute(_T("textcolor"), _T("#FF1F2329"));
- pVal->SetAttribute(_T("align"), _T("right"));
- pVal->SetText(wsValue.c_str());
- pRow->Add(pLab);
- pRow->Add(pVal);
- return pRow;
- }
- CWaimaiOrderInfoPageUI::CWaimaiOrderInfoPageUI()
- {
- }
- CWaimaiOrderInfoPageUI::~CWaimaiOrderInfoPageUI()
- {
- }
- void CWaimaiOrderInfoPageUI::InitControl()
- {
- }
- //初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
- void CWaimaiOrderInfoPageUI::InitShow()
- {
- //请求服务器,获取订单数据
- CWaimaiOrder order;
- order.InitData(m_order_id, m_order_no);
- //刷新订单详情页数据
- this->SetDate(order);
- this->Refresh(order);
- }
- //处理按钮点击类事件
- void CWaimaiOrderInfoPageUI::HandleClickMsg(TNotifyUI& msg)
- {
- CDuiString name = msg.pSender->GetName();
- if (name == _T("waimai_order_info_page_return"))
- {
- m_pMainWnd->SwitchPage(CMainWnd::DINGDAN);
- }
- else if (name == _T("waimai_order_info_page_print"))
- {
- CPosPrinter printer;
- printer.PrintWaimaiOrder(this->m_order.m_order_id, this->m_order.m_order_no);
- }
- else if (name == _T("waimai_order_info_page_confirme"))
- {
- std::string waimai_order_id = this->m_order.m_order_id;
- std::string waimai_order_no = this->m_order.m_order_no;
- CWaimaiOrder order;
- bool ret = order.ConfirmeOrder(waimai_order_id);
- if (ret)
- {
- //确认成功,这里怎么处理
- //请求服务器,获取订单数据
- CWaimaiOrder new_order;
- new_order.InitData(waimai_order_id, waimai_order_no);
- //刷新订单详情页数据
- this->SetDate(new_order);
- this->Refresh(new_order);
- }
- }
- else if (name == _T("waimai_order_info_page_success"))
- {
- std::string waimai_order_id = this->m_order.m_order_id;
- std::string waimai_order_no = this->m_order.m_order_no;
- CWaimaiOrder order;
- bool ret = order.SuccessOrder(waimai_order_id);
- if (ret)
- {
- //订单设为成功,这里怎么处理
- //请求服务器,获取订单数据
- CWaimaiOrder new_order;
- new_order.InitData(waimai_order_id, waimai_order_no);
- //刷新订单详情页数据
- this->SetDate(new_order);
- this->Refresh(new_order);
- }
- }
- else if (name == _T("waimai_order_info_page_fail"))
- {
- std::string waimai_order_id = this->m_order.m_order_id;
- std::string waimai_order_no = this->m_order.m_order_no;
- CWaimaiOrderFailReasonWnd* pWaimaiFailFrame = new CWaimaiOrderFailReasonWnd();
- pWaimaiFailFrame->Create(m_pMainWnd->GetHWND(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
- pWaimaiFailFrame->SetIcon(IDI_ICON_DUILIB);
- pWaimaiFailFrame->CenterWindow();
- UINT ret = pWaimaiFailFrame->ShowModal();
- if (ret == IDOK)
- {
- std::string sReason = pWaimaiFailFrame->getReason();
- CWaimaiOrder order;
- bool ret = order.FailOrder(waimai_order_id, sReason);
- if (ret)
- {
- //订单设为失败,这里怎么处理
- //请求服务器,获取订单数据
- CWaimaiOrder new_order;
- new_order.InitData(waimai_order_id, waimai_order_no);
- //刷新订单详情页数据
- this->SetDate(new_order);
- this->Refresh(new_order);
- }
- }
- delete pWaimaiFailFrame;
- }
- else if (name == _T("waimai_order_info_page_agree"))
- {
- std::string waimai_order_id = this->m_order.m_order_id;
- std::string waimai_order_no = this->m_order.m_order_no;
- CWaimaiOrder order;
- bool ret = order.AgreeRefund(waimai_order_id);
- if (ret)
- {
- //订单设为成功,这里怎么处理
- //请求服务器,获取订单数据
- CWaimaiOrder new_order;
- new_order.InitData(waimai_order_id, waimai_order_no);
- //刷新订单详情页数据
- this->SetDate(new_order);
- this->Refresh(new_order);
- }
- }
- else if (name == _T("waimai_order_info_page_disagree"))
- {
- std::string waimai_order_id = this->m_order.m_order_id;
- std::string waimai_order_no = this->m_order.m_order_no;
- CWaimaiOrder order;
- bool ret = order.DisagreeRefund(waimai_order_id);
- if (ret)
- {
- //订单设为成功,这里怎么处理
- //请求服务器,获取订单数据
- CWaimaiOrder new_order;
- new_order.InitData(waimai_order_id, waimai_order_no);
- //刷新订单详情页数据
- this->SetDate(new_order);
- this->Refresh(new_order);
- }
- }
- else if (name == _T("waimai_order_info_page_refund"))
- {
- std::string waimai_order_id = this->m_order.m_order_id;
- std::string waimai_order_no = this->m_order.m_order_no;
- CWaimaiOrder order;
- bool ret = order.Refund(waimai_order_id);
- if (ret)
- {
- //订单设为成功,这里怎么处理
- //请求服务器,获取订单数据
- CWaimaiOrder new_order;
- new_order.InitData(waimai_order_id, waimai_order_no);
- //刷新订单详情页数据
- this->SetDate(new_order);
- this->Refresh(new_order);
- }
- }
- }
- //处理option切换事件
- void CWaimaiOrderInfoPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
- {
- }
- //处理下拉框、radio的切换事件
- void CWaimaiOrderInfoPageUI::HandleItemSelectMsg(TNotifyUI& msg)
- {
- }
- //处理编辑框输入内容改变事件
- void CWaimaiOrderInfoPageUI::HandleTextChangedMsg(TNotifyUI& msg)
- {
- }
- //处理扫码枪捕捉到的扫码信息
- void CWaimaiOrderInfoPageUI::HandleTextCapture(std::string content)
- {
- }
- //刷新当前页面的内容,注意这个函数不会改变当前的订单状态以及“页数”
- void CWaimaiOrderInfoPageUI::SetDate(CWaimaiOrder& order)
- {
- m_order = order;
- }
- void CWaimaiOrderInfoPageUI::Refresh(CWaimaiOrder& order)
- {
- std::wstring liushuihao_show = L"#" + CLewaimaiString::UTF8ToUnicode(order.m_restaurant_number);
- this->FindSubControl(_T("waimai_order_info_page_liushuihao"))->SetText(liushuihao_show.c_str());
- std::wstring order_no_show = L"订单号:" + CLewaimaiString::UTF8ToUnicode(order.m_order_no);
- this->FindSubControl(_T("waimai_order_info_page_order_num"))->SetText(order_no_show.c_str());
- //商品详情的渲染
- CListUI* pFoodList = static_cast<CListUI*>(this->FindSubControl(_T("waimai_order_info_page_foodlist")));
- pFoodList->RemoveAll();
- int show_num = 0;
- for (std::vector<CWaimaiOrderItem>::iterator it = order.m_order_items.begin(); it != order.m_order_items.end(); it++)
- {
- if (it->is_taocan_item == true)
- {
- //套餐的详情不展示
- continue;
- }
- 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("waimai_order_info_page_listitem.xml"), (UINT)0, NULL, m_pManager));
- CLabelUI *pName = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_foodname")));
- pName->SetText(CLewaimaiString::UTF8ToUnicode(food_name).c_str());
- CLabelUI *pQuantity = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_quantity")));
- pQuantity->SetText(CLewaimaiString::UTF8ToUnicode(quantity).c_str());
- CLabelUI *pPrice = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_price")));
- pPrice->SetText(CLewaimaiString::UTF8ToUnicode(food_price).c_str());
- pFoodList->Add(pEle);
- show_num++;
- }
- //重设商品列表的高度
- //R76:表头 35 + 每行 34(33 文本 + 1px 底部分隔线)
- int order_item_height = 35 + show_num * 34;
- pFoodList->SetFixedHeight(order_item_height);
- {
- std::wstring memo = CLewaimaiString::UTF8ToUnicode(order.m_memo);
- this->FindSubControl(_T("waimaorder_info_page_memo_val"))->SetText(memo.empty() ? _T("-") : memo.c_str());
- }
- //开始展示各种费用
- CVerticalLayoutUI* pFeesLayout = static_cast<CVerticalLayoutUI *>(this->FindSubControl(_T("waimai_order_info_page_fees")));
- pFeesLayout->RemoveAll();
- int fees_num = 0;
- if (order.m_delivery > 0)
- {
- pFeesLayout->Add(MakeFeeRow(L"配送费", CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_delivery, 2))));
- fees_num++;
- }
- if (order.m_is_dabao == "1")
- {
- pFeesLayout->Add(MakeFeeRow(L"打包费", CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_delivery, 2))));
- fees_num++;
- }
- //增值服务费
- if (order.m_addservie.size() > 0)
- {
- for (std::vector<CWaimaiOrderField>::iterator it = order.m_addservie.begin(); it != order.m_addservie.end(); it++)
- {
- pFeesLayout->Add(MakeFeeRow(CLewaimaiString::UTF8ToUnicode((*it).name), CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)atof((*it).value.c_str()), 2))));
- fees_num++;
- }
- }
- //店铺折扣
- if (order.m_discount < 10)
- {
- pFeesLayout->Add(MakeFeeRow(L"店铺折扣", CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_discount, 2)) + L"折"));
- fees_num++;
- }
- //会员优惠
- if (order.m_is_member_discount == "1")
- {
- pFeesLayout->Add(MakeFeeRow(L"会员优惠", L"-" + CLewaimaiString::UTF8ToUnicode(order.m_member_discount)));
- fees_num++;
- }
- //首单优惠
- if (order.m_is_firstcut == "1")
- {
- pFeesLayout->Add(MakeFeeRow(L"首单优惠", L"-" + CLewaimaiString::UTF8ToUnicode(order.m_firstcut_value)));
- fees_num++;
- }
- //满减
- std::string::size_type position = order.m_promotion.find(":");
- if (position != order.m_promotion.npos)
- {
- std::string promotion_value;
- promotion_value.assign(order.m_promotion, position + 1);
- pFeesLayout->Add(MakeFeeRow(L"满减优惠", L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)(atof(promotion_value.c_str())), 2))));
- fees_num++;
- }
- //优惠券
- if (order.m_coupon > 0)
- {
- pFeesLayout->Add(MakeFeeRow(L"优惠券", L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_coupon, 2))));
- fees_num++;
- }
- //商品券
- if (atof(order.m_goods_coupon_value.c_str()) > 0.0001)
- {
- pFeesLayout->Add(MakeFeeRow(L"商品券", L"-" + CLewaimaiString::UTF8ToUnicode(order.m_goods_coupon_value)));
- fees_num++;
- }
- int fees_height;
- if (fees_num == 0)
- {
- pFeesLayout->SetVisible(false);
- this->FindSubControl(_T("waimai_order_info_page_fees_line"))->SetVisible(false);
- fees_height = 0;
- }
- else
- {
- pFeesLayout->SetVisible(true);
- this->FindSubControl(_T("waimai_order_info_page_fees_line"))->SetVisible(true);
- pFeesLayout->SetFixedHeight(fees_num * 30);
- fees_height = fees_num * 30;
- }
- //R76d:总计 = 「总计:」+ 绿色加粗金额(两个纯文本 Label)
- {
- std::wstring price = CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(order.m_price, 2));
- this->FindSubControl(_T("waimai_order_info_page_totalprice_val"))->SetText(price.c_str());
- }
- //R76:卡1 = 标题41 + 线1 + 空12 + List + 空12 + 备注30 + 费用 + 线1 + 总计36 + 底8
- int nTotalHeight = order_item_height + fees_height + 141;
- this->FindSubControl(_T("waimai_order_info_page_layout_1"))->SetFixedHeight(nTotalHeight);
- //开始显示顾客信息
- {
- std::wstring v = CLewaimaiString::UTF8ToUnicode(order.m_customer_name);
- this->FindSubControl(_T("waimai_order_info_page_name_val"))->SetText(v.empty() ? _T("-") : v.c_str());
- }
- {
- std::wstring v = CLewaimaiString::UTF8ToUnicode(order.m_phone);
- this->FindSubControl(_T("waimai_order_info_page_phone_val"))->SetText(v.empty() ? _T("-") : v.c_str());
- }
- {
- std::wstring v = CLewaimaiString::UTF8ToUnicode(order.m_address);
- this->FindSubControl(_T("waimai_order_info_page_address_val"))->SetText(v.empty() ? _T("-") : v.c_str());
- }
- {
- std::wstring v = CLewaimaiString::UTF8ToUnicode(order.m_order_date);
- this->FindSubControl(_T("waimai_order_info_page_init_date_val"))->SetText(v.empty() ? _T("-") : v.c_str());
- }
- //开始处理骑手信息 R76:卡片常显,无骑手时值为 "-"(与设计稿一致)
- this->FindSubControl(_T("waimai_order_info_page_qishouinfo"))->SetVisible(true);
- {
- std::wstring wsCourierName;
- std::wstring wsCourierPhone;
- std::wstring wsCourierType;
- if (atoi(order.m_courier_id.c_str()) > 0)
- {
- //有人接单了
- wsCourierName = CLewaimaiString::UTF8ToUnicode(order.m_courier_name);
- wsCourierPhone = CLewaimaiString::UTF8ToUnicode(order.m_courier_phone);
- if (order.m_courier_type == "3")
- {
- wsCourierType = L"快服务骑手";
- }
- else if (order.m_courier_type == "5")
- {
- wsCourierType = L"达达骑手";
- }
- else
- {
- wsCourierType = L"商家自配送骑手";
- }
- }
- this->FindSubControl(_T("waimai_order_info_page_qishou_name_val"))->SetText(wsCourierName.empty() ? _T("-") : wsCourierName.c_str());
- this->FindSubControl(_T("waimai_order_info_page_qishou_phone_val"))->SetText(wsCourierPhone.empty() ? _T("-") : wsCourierPhone.c_str());
- this->FindSubControl(_T("waimai_order_info_page_qishou_type_val"))->SetText(wsCourierType.empty() ? _T("-") : wsCourierType.c_str());
- }
- //开始处理订单信息
- if (order.m_is_selftake == "1")
- {
- CLabelUI *pDeliveryType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_type_val")));
- std::wstring wsDeliveryType = std::wstring(L"到店自取(取餐号:") + CLewaimaiString::UTF8ToUnicode(order.m_take_food_code) + L")";
- pDeliveryType->SetText(wsDeliveryType.c_str());
- }
- else
- {
- CLabelUI *pDeliveryType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_type_val")));
- pDeliveryType->SetText(_T("外卖配送"));
- }
- CLabelUI *pShopname = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_shopname_val")));
- {
- std::wstring wsShopname = CLewaimaiString::UTF8ToUnicode(order.m_shop_name);
- pShopname->SetText(wsShopname.empty() ? _T("-") : wsShopname.c_str());
- }
- //R76:取餐号常显,非自取订单值为 "-"(与设计稿一致)
- int nTakeFoodCodeHeight = 0;
- CControlUI *pTakeFoodCode = this->FindSubControl(_T("waimai_order_info_page_take_food_code"));
- {
- std::wstring wsTakeLabel;
- std::wstring wsTakeVal;
- if (CShopinfo::GetInstance()->m_version_type == "1")
- {
- wsTakeLabel = L"取餐号";
- }
- else
- {
- wsTakeLabel = L"取单号";
- }
- if (order.m_is_selftake == "1")
- {
- //自取订单,显示取餐号
- wsTakeVal = CLewaimaiString::UTF8ToUnicode(order.m_take_food_code);
- }
- this->FindSubControl(_T("waimai_order_info_page_take_food_code_lab"))->SetText(wsTakeLabel.c_str());
- this->FindSubControl(_T("waimai_order_info_page_take_food_code_val"))->SetText(wsTakeVal.empty() ? _T("-") : wsTakeVal.c_str());
- pTakeFoodCode->SetVisible(true);
- nTakeFoodCodeHeight = 31;
- }
- CLabelUI *pStatus = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_status_val")));
- std::wstring wsStatusVal = CLewaimaiString::UTF8ToUnicode(order.m_order_status);
- if (CLewaimaiString::UTF8ToUnicode(order.m_order_status) == _T("交易失败"))
- {
- wsStatusVal += L",失败原因:" + CLewaimaiString::UTF8ToUnicode(order.m_failed_reason);
- }
- //R76d:订单状态 = 灰标签 + 绿色值(纯文本,无富文本、无背景胶囊)
- pStatus->SetText(wsStatusVal.empty() ? _T("-") : wsStatusVal.c_str());
- CLabelUI *pType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_type_val")));
- {
- std::wstring wsType = CLewaimaiString::UTF8ToUnicode(order.m_from_type);
- pType->SetText(wsType.empty() ? _T("-") : wsType.c_str());
- }
- //预设选项
- CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI *>(this->FindSubControl(_T("waimai_order_info_page_field")));
- pLayout->RemoveAll();
- int order_filed_height;
- if (order.m_order_field.size() > 1)
- {
- for (std::vector<CWaimaiOrderField>::iterator it = order.m_order_field.begin(); it != order.m_order_field.end() - 1; it++)
- {
- pLayout->Add(MakeFieldRow(CLewaimaiString::UTF8ToUnicode((*it).name), CLewaimaiString::UTF8ToUnicode((*it).value)));
- }
- //这里预设选项默认有一个配送时间,所以要减1
- pLayout->SetFixedHeight((order.m_order_field.size() - 1) * 31);
- order_filed_height = (order.m_order_field.size() - 1) * 31;
- pLayout->SetVisible(true);
- }
- else
- {
- order_filed_height = 0;
- pLayout->SetVisible(false);
- }
- //配送时间
- this->FindSubControl(_T("waimai_order_info_page_delivery_time_lab"))->SetText(order.m_is_selftake == "1" ? _T("自取时间") : _T("配送时间"));
- {
- std::wstring delivery_date = CLewaimaiString::UTF8ToUnicode(order.m_delivery_date);
- this->FindSubControl(_T("waimai_order_info_page_delivery_time_val"))->SetText(delivery_date.empty() ? _T("-") : delivery_date.c_str());
- }
- CLabelUI *pPayType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_pay_type_val")));
- {
- std::wstring wsPayType = CLewaimaiString::UTF8ToUnicode(order.m_pay_type);
- pPayType->SetText(wsPayType.empty() ? _T("-") : wsPayType.c_str());
- }
- if (CLewaimaiString::UTF8ToUnicode(order.m_pay_type) == L"货到付款")
- {
- this->FindSubControl(_T("waimai_order_info_page_huodaofukuan"))->SetVisible(true);
- }
- else
- {
- this->FindSubControl(_T("waimai_order_info_page_huodaofukuan"))->SetVisible(false);
- }
- //右侧按钮的控制
- CButtonUI* confirm_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_confirme")));
- CButtonUI* success_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_success")));
- CButtonUI* fail_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_fail")));
- CButtonUI* agree_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_agree")));
- CButtonUI* disagree_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_disagree")));
- CButtonUI* refund_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_refund")));
- CControlUI *pRefundStatus = this->FindSubControl(_T("waimai_order_info_page_refund_status"));
- int refundHeight = 0;
- if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("未处理")) == 0)
- {
- confirm_button->SetVisible(true);
- success_button->SetVisible(false);
- fail_button->SetVisible(true);
- agree_button->SetVisible(false);
- disagree_button->SetVisible(false);
- refund_button->SetVisible(false);
- pRefundStatus->SetVisible(false);
- }
- else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("已确认")) == 0)
- {
- confirm_button->SetVisible(false);
- success_button->SetVisible(true);
- fail_button->SetVisible(true);
- agree_button->SetVisible(false);
- disagree_button->SetVisible(false);
- refund_button->SetVisible(false);
- pRefundStatus->SetVisible(false);
- }
- else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("交易成功")) == 0)
- {
- confirm_button->SetVisible(false);
- success_button->SetVisible(false);
- fail_button->SetVisible(false);
- agree_button->SetVisible(false);
- disagree_button->SetVisible(false);
- refund_button->SetVisible(false);
- pRefundStatus->SetVisible(false);
- }
- else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("交易失败")) == 0)
- {
- confirm_button->SetVisible(false);
- success_button->SetVisible(false);
- fail_button->SetVisible(false);
- agree_button->SetVisible(false);
- disagree_button->SetVisible(false);
- std::string refund_status = m_order.m_refund_status;
- if (CLewaimaiString::UTF8ToUnicode(order.m_pay_type) != L"货到付款")
- {
- pRefundStatus->SetVisible(true);
- refundHeight = 31;
- std::wstring refund_status_text = L"";
- if (refund_status == "0")
- {
- refund_button->SetVisible(true);
- refund_status_text += L"未处理";
- }
- else if (refund_status == "10")
- {
- refund_button->SetVisible(false);
- refund_status_text += L"退款处理中,等待退款结果";
- }
- else if (refund_status == "11")
- {
- refund_button->SetVisible(false);
- refund_status_text += L"退款已完成";
- }
- else if (refund_status == "12")
- {
- refund_button->SetVisible(false);
- refund_status_text += L"退款失败,原因:" + CLewaimaiString::UTF8ToUnicode(order.m_refund_failed_reason);
- }
- this->FindSubControl(_T("waimai_order_info_page_refund_status_val"))->SetText(refund_status_text.empty() ? _T("-") : refund_status_text.c_str());
- }
- else
- {
- refund_button->SetVisible(false);
- pRefundStatus->SetVisible(false);
- }
- }
- else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("已取消")) == 0)
- {
- confirm_button->SetVisible(false);
- success_button->SetVisible(false);
- fail_button->SetVisible(false);
- agree_button->SetVisible(false);
- disagree_button->SetVisible(false);
- refund_button->SetVisible(false);
- pRefundStatus->SetVisible(false);
- }
- else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("退款中")) == 0)
- {
- confirm_button->SetVisible(false);
- success_button->SetVisible(false);
- fail_button->SetVisible(false);
- std::string refund_status = m_order.m_refund_status;
- if (refund_status == "1")
- {
- agree_button->SetVisible(true);
- disagree_button->SetVisible(true);
- }
- else if (refund_status == "5")
- {
- agree_button->SetVisible(true);
- disagree_button->SetVisible(false);
- }
- else
- {
- agree_button->SetVisible(false);
- disagree_button->SetVisible(false);
- }
- refund_button->SetVisible(false);
- pRefundStatus->SetVisible(true);
- refundHeight = 31;
- std::wstring refund_status_text = L"";
- if (refund_status == "1")
- {
- refund_status_text += L"顾客申请退款,等待商家处理";
- }
- else if (refund_status == "2")
- {
- refund_status_text += L"退款成功,订单失败";
- }
- else if (refund_status == "3")
- {
- refund_status_text += L"商家已拒绝退款,等待顾客受理";
- }
- else if (refund_status == "4")
- {
- refund_status_text += L"退款失败,订单变为已确认";
- }
- else if (refund_status == "5")
- {
- refund_status_text += L"顾客再次发起退款,等待客服介入处理中";
- }
- this->FindSubControl(_T("waimai_order_info_page_refund_status_val"))->SetText(refund_status_text.empty() ? _T("-") : refund_status_text.c_str());
- }
- int configMemoHeight = 0;
- CControlUI *pConfigmemo = this->FindSubControl(_T("waimai_order_info_page_configmemo"));
- if (m_order.m_configmemo != "")
- {
- configMemoHeight = 31;
- std::wstring configMemo = CLewaimaiString::UTF8ToUnicode(order.m_configmemo);
- this->FindSubControl(_T("waimai_order_info_page_configmemo_val"))->SetText(configMemo.c_str());
- pConfigmemo->SetVisible(true);
- }
- else
- {
- configMemoHeight = 0;
- pConfigmemo->SetVisible(false);
- }
- //R76:卡4 = 标题41 + 线1 + 空12 + 底16 + 31×字段数(固定 6 项 = 186)
- this->FindSubControl(_T("waimai_order_info_page_layout_3"))->SetFixedHeight(nTakeFoodCodeHeight + order_filed_height + refundHeight + configMemoHeight + 256);
- }
|