|
|
@@ -0,0 +1,3852 @@
|
|
|
+#include "../pch/pch.h"
|
|
|
+#include "CZhengcanDiandanPageUI.h"
|
|
|
+
|
|
|
+#include "../control/ControlEx.h"
|
|
|
+
|
|
|
+#include "../tool/CSqlite3.h"
|
|
|
+
|
|
|
+#include "../wnd/CDiandanNatureWnd.h"
|
|
|
+#include "../wnd/CMemoWnd.h"
|
|
|
+#include "../wnd/CYouhuiShowWnd.h"
|
|
|
+#include "../wnd/CMemberLoginWnd.h"
|
|
|
+#include "../wnd/CZhekouWnd.h"
|
|
|
+#include "../wnd/CRengongYouhuiWnd.h"
|
|
|
+#include "../wnd/CJiajiaWnd.h"
|
|
|
+#include "../wnd/CSaomaYouhuiquanWnd.h"
|
|
|
+#include "../wnd/CSaomaShangpinquanWnd.h"
|
|
|
+#include "../wnd/CSaomaCikaWnd.h"
|
|
|
+#include "../wnd/CSaomaQuanyikaWnd.h"
|
|
|
+#include "../wnd/CCanpaiWnd.h"
|
|
|
+#include "../wnd/CWeixinzhifuShoukuanWnd.h"
|
|
|
+#include "../wnd/CHuiyuanShoukuanWnd.h"
|
|
|
+#include "../wnd/CXianjinShoukuanWnd.h"
|
|
|
+#include "../wnd/CFulikaShoukuanWnd.h"
|
|
|
+#include "../wnd/CZidingyiShoukuanWnd.h"
|
|
|
+#include "../wnd/CChengzhongWnd.h"
|
|
|
+#include "../wnd/CGuadanWnd.h"
|
|
|
+
|
|
|
+#include "../print/CPosPrinter.h"
|
|
|
+
|
|
|
+#include "../tool/CShuangpingTool.h"
|
|
|
+
|
|
|
+CZhengcanDiandanPageUI::CZhengcanDiandanPageUI()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+CZhengcanDiandanPageUI::~CZhengcanDiandanPageUI()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+//初始化当前页面的展示,处理默认展示效果,在页面被加载的时候调用
|
|
|
+void CZhengcanDiandanPageUI::InitShow()
|
|
|
+{
|
|
|
+ //先检查桌子状态,获取桌子信息
|
|
|
+ GetTableInfo();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::InitTableShow()
|
|
|
+{
|
|
|
+ //先初始化商品分类
|
|
|
+ this->InitFoodtypeShow();
|
|
|
+
|
|
|
+ //再初始化商品显示
|
|
|
+ this->InitFoodShow();
|
|
|
+
|
|
|
+ //初始化结算页面相关的展示,把所有活动清零
|
|
|
+ this->InitJiesuanShow();
|
|
|
+
|
|
|
+ //计算所有活动优惠,并且调整所有与价格相关的展示
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ //展示选购页面
|
|
|
+ this->ShowXuangouPage();
|
|
|
+
|
|
|
+ if (m_is_zidingyizhifu_init == false)
|
|
|
+ {
|
|
|
+ //初始化结算页面的支付方式
|
|
|
+ this->InitJiesuanZhifu();
|
|
|
+
|
|
|
+ m_is_zidingyizhifu_init = true;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::RefreshShow()
|
|
|
+{
|
|
|
+ //清空当前订单的信息
|
|
|
+ m_cur_diandan_order.RefreshDiandanInfo();
|
|
|
+
|
|
|
+ //初始化商品显示(因为这里要刷新商品库存状态)
|
|
|
+ this->InitFoodShow();
|
|
|
+
|
|
|
+ //清空购物车
|
|
|
+ this->ClearDiandanOrderItemShow();
|
|
|
+
|
|
|
+ //初始化结算页面相关的展示,把所有活动清零
|
|
|
+ this->InitJiesuanShow();
|
|
|
+
|
|
|
+ //计算所有活动优惠,并且调整所有与价格相关的展示
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ //展示选购页面
|
|
|
+ this->ShowXuangouPage();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::GetTableInfo()
|
|
|
+{
|
|
|
+ //开始转菊花
|
|
|
+ CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("page_layout")));
|
|
|
+ pLayout->SetVisible(false);
|
|
|
+
|
|
|
+ this->FindSubControl(_T("loading"))->SetVisible(true);
|
|
|
+
|
|
|
+ //启动一个线程,进行网络请求操作
|
|
|
+
|
|
|
+ std::thread t(&CZhengcanDiandanPageUI::DoGetTableInfo, this);
|
|
|
+ t.detach();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::DoGetTableInfo()
|
|
|
+{
|
|
|
+ std::map<string, string> params;
|
|
|
+
|
|
|
+ params["table_id"] = m_table_id;
|
|
|
+
|
|
|
+ std::string response;
|
|
|
+
|
|
|
+ std::string url = "/dinnercash/getonetableinfo";
|
|
|
+ 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"];
|
|
|
+
|
|
|
+ std::string status = CLewaimaiJson::ToString(data["status"]);
|
|
|
+
|
|
|
+ if (status == "0")
|
|
|
+ {
|
|
|
+ //还没开台,说明桌子在别的地方被清台了
|
|
|
+ m_pMainWnd->SwitchPage(CMainWnd::ZHENGCAN);
|
|
|
+
|
|
|
+ this->m_pMainWnd->ShowToast(L"该桌子已被清台,请重新选择");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //桌子开台中,那么开始获取订单信息
|
|
|
+ std::string order_id = CLewaimaiJson::ToString(data["order_id"]);
|
|
|
+
|
|
|
+ std::string name = CLewaimaiJson::ToString(data["name"]);
|
|
|
+ CLabelUI* nameLabel = static_cast<CLabelUI*>(this->FindSubControl(L"diandan_page_table_name"));
|
|
|
+ nameLabel->SetText(CLewaimaiString::UTF8ToUnicode(name).c_str());
|
|
|
+
|
|
|
+ if (order_id == "" || order_id == "0")
|
|
|
+ {
|
|
|
+ //这个说明是只开台了,还没下单那么直接显示点餐页面就行
|
|
|
+ this->InitTableShow();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //这个说明是开过台,也下过单了,那么要先获取当前的订单信息
|
|
|
+
|
|
|
+
|
|
|
+ this->InitTableShow();
|
|
|
+ }
|
|
|
+
|
|
|
+ CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("page_layout")));
|
|
|
+ pLayout->SetVisible(true);
|
|
|
+
|
|
|
+ this->FindSubControl(_T("loading"))->SetVisible(false);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::InitFoodtypeShow()
|
|
|
+{
|
|
|
+ //初始化商品渲染相关的信息
|
|
|
+ m_foodtypeLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
|
|
|
+ m_foodtypeLayout->RemoveAll();
|
|
|
+
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ m_nFoodpackageNum = sqlite.GetFoodpackageNum();
|
|
|
+ m_types = sqlite.GetFoodtypes(); //只包含收银机显示的分类
|
|
|
+ if (m_nFoodpackageNum > 0)
|
|
|
+ {
|
|
|
+ //默认选中的分类是商品套餐
|
|
|
+ m_cur_type_id = "taocan";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //没有套餐,默认选中第一个商品分类
|
|
|
+ if (m_types.size() > 0)
|
|
|
+ {
|
|
|
+ m_cur_type_id = m_types[0].id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ m_curFoodtypeOption = NULL;
|
|
|
+
|
|
|
+ //先判断有没有套餐分类
|
|
|
+ if (m_nFoodpackageNum > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+
|
|
|
+ CFoodtypeOptionUI* pItem = static_cast<CFoodtypeOptionUI*>(builder.Create(_T("foodtype_option.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+
|
|
|
+ pItem->SetName(L"商品套餐");
|
|
|
+ pItem->SetTypeId("taocan");
|
|
|
+ pItem->SetTaocan();
|
|
|
+ pItem->SetGroup(L"diandan_foodtype");
|
|
|
+
|
|
|
+ m_foodtypeLayout->Add(pItem);
|
|
|
+
|
|
|
+ if (m_cur_type_id == "taocan")
|
|
|
+ {
|
|
|
+ m_curFoodtypeOption = pItem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //接下来开始处理商品分类
|
|
|
+ for (std::vector<CFoodType>::iterator it = m_types.begin(); it != m_types.end(); it++)
|
|
|
+ {
|
|
|
+ CFoodType type = *it;
|
|
|
+
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+
|
|
|
+ CFoodtypeOptionUI* pItem = static_cast<CFoodtypeOptionUI*>(builder.Create(_T("foodtype_option.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+
|
|
|
+ pItem->SetName(CLewaimaiString::UTF8ToUnicode(type.name));
|
|
|
+ pItem->SetTypeId(type.id);
|
|
|
+ pItem->SetGroup(L"diandan_foodtype");
|
|
|
+
|
|
|
+ m_foodtypeLayout->Add(pItem);
|
|
|
+
|
|
|
+ if (m_cur_type_id == type.id)
|
|
|
+ {
|
|
|
+ m_curFoodtypeOption = pItem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_curFoodtypeOption != NULL)
|
|
|
+ {
|
|
|
+ m_curFoodtypeOption->SetBkColor(0xFF3CB371);
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果不是一个分类都没有,选中第一个分类
|
|
|
+ if (m_cur_type_id != "")
|
|
|
+ {
|
|
|
+ CFoodtypeOptionUI* curTypeUI = static_cast<CFoodtypeOptionUI*>(m_foodtypeLayout->GetItemAt(0));
|
|
|
+
|
|
|
+ curTypeUI->Selected(true, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateFoodtypePos();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::UpdateFoodtypePos()
|
|
|
+{
|
|
|
+ int nFoodtypeNum = m_types.size();
|
|
|
+ if (m_nFoodpackageNum > 0)
|
|
|
+ {
|
|
|
+ nFoodtypeNum++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加支付方式
|
|
|
+ int nWidth = m_nPageWidth;
|
|
|
+ if (nWidth == 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据宽度计算每行显示的数量
|
|
|
+ int nMeihangNum = (nWidth - 491) / 135;
|
|
|
+
|
|
|
+ int num = 0;
|
|
|
+
|
|
|
+ CHorizontalLayoutUI* pFenleiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
|
|
|
+ for (int i = 0; i < nFoodtypeNum; i++)
|
|
|
+ {
|
|
|
+ CButtonUI* curItem = static_cast<CButtonUI*>(pFenleiLayout->GetItemAt(i));
|
|
|
+
|
|
|
+ int curRow = num / nMeihangNum + 1;
|
|
|
+ int curCol = num % nMeihangNum + 1;
|
|
|
+
|
|
|
+ RECT rect;
|
|
|
+ rect.left = (curCol - 1) * 135 + 15;
|
|
|
+ rect.right = rect.left + 120;
|
|
|
+ rect.top = (curRow - 1) * 61 + 19;
|
|
|
+ rect.bottom = rect.top + 42;
|
|
|
+
|
|
|
+ curItem->SetFloat(true);
|
|
|
+ curItem->SetPos(rect);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //调整区域高度
|
|
|
+ int lastRow = (num - 1) / nMeihangNum + 1;
|
|
|
+ pFenleiLayout->SetFixedHeight(lastRow * 61 + 19);
|
|
|
+
|
|
|
+ //处理滚动条问题
|
|
|
+ CVerticalLayoutUI* pFenleiScrollLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout_scrolllayout")));
|
|
|
+ if (lastRow > 2)
|
|
|
+ {
|
|
|
+ lastRow = 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ pFenleiScrollLayout->SetFixedHeight(lastRow * 61 + 19);
|
|
|
+
|
|
|
+ SIZE size;
|
|
|
+ size.cx = 0;
|
|
|
+ size.cy = 0;
|
|
|
+ pFenleiScrollLayout->SetScrollPos(size);
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::InitFoodShow()
|
|
|
+{
|
|
|
+ bool is_youtu;
|
|
|
+ if (CSetting::GetInstance()->GetParam("setting_xianshi_is_youtu") == "1")
|
|
|
+ {
|
|
|
+ is_youtu = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ is_youtu = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_foodLayout = static_cast<CTileLayoutUI*>(this->FindSubControl(_T("diandan_foodlist")));
|
|
|
+ m_foodLayout->RemoveAll();
|
|
|
+
|
|
|
+ std::wstring xml_name;
|
|
|
+
|
|
|
+ if (is_youtu)
|
|
|
+ {
|
|
|
+ SIZE itemsize;
|
|
|
+ itemsize.cx = 160;
|
|
|
+ itemsize.cy = 250;
|
|
|
+ m_foodLayout->SetItemSize(itemsize);
|
|
|
+
|
|
|
+ xml_name = _T("diandan_fooditem.xml");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SIZE itemsize;
|
|
|
+ itemsize.cx = 160;
|
|
|
+ itemsize.cy = 105;
|
|
|
+ m_foodLayout->SetItemSize(itemsize);
|
|
|
+
|
|
|
+ xml_name = _T("diandan_fooditem_wutu.xml");
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果当前一个分类都没有,那么就不处理了
|
|
|
+ if (m_cur_type_id == "")
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (m_cur_type_id == "taocan")
|
|
|
+ {
|
|
|
+ //选择的是套餐分类
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ std::vector<CFoodpackage> foodlist = sqlite.GetFoodpackages(true);
|
|
|
+
|
|
|
+ for (std::vector<CFoodpackage>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
|
|
|
+ {
|
|
|
+ CFoodpackage food = *it;
|
|
|
+
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+
|
|
|
+ CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
|
|
|
+
|
|
|
+ pItem->SetYoutuModel(is_youtu);
|
|
|
+ pItem->SetFoodpackageInfo(food);
|
|
|
+ pItem->UpdateShow();
|
|
|
+
|
|
|
+ m_foodLayout->Add(pItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (m_cur_type_id == "sousuo")
|
|
|
+ {
|
|
|
+ //展示的是商品搜索的结果
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ std::vector<CFood> foodlist = sqlite.GetFoodByFoodname(m_sousuo_foodname);
|
|
|
+
|
|
|
+ for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
|
|
|
+ {
|
|
|
+ CFood food = *it;
|
|
|
+
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+
|
|
|
+ CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
|
|
|
+
|
|
|
+ pItem->SetYoutuModel(is_youtu);
|
|
|
+ pItem->SetFoodInfo(food);
|
|
|
+ pItem->UpdateShow();
|
|
|
+
|
|
|
+ m_foodLayout->Add(pItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //选择的是普通商品分类
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ std::vector<CFood> foodlist = sqlite.GetFoodByTypeid(m_cur_type_id);
|
|
|
+
|
|
|
+ for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
|
|
|
+ {
|
|
|
+ CFood food = *it;
|
|
|
+
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+
|
|
|
+ CDiandanFoodItemUI* pItem = static_cast<CDiandanFoodItemUI*>(builder.Create(xml_name.c_str(), (UINT)0, &cb, m_pManager));
|
|
|
+
|
|
|
+ pItem->SetYoutuModel(is_youtu);
|
|
|
+ pItem->SetFoodInfo(food);
|
|
|
+ pItem->UpdateShow();
|
|
|
+
|
|
|
+ m_foodLayout->Add(pItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//仅仅初始化结算相关的显示(比如折扣、优惠、价格等)
|
|
|
+void CZhengcanDiandanPageUI::InitJiesuanShow()
|
|
|
+{
|
|
|
+ //先清空会员登录状态
|
|
|
+ m_is_member = false;
|
|
|
+
|
|
|
+ CButtonUI* pMemberLoginBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_member_login")));
|
|
|
+ pMemberLoginBtn->SetVisible(true);
|
|
|
+
|
|
|
+ CLabelUI* pMemberInfo = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_member_info")));
|
|
|
+ pMemberInfo->SetVisible(false);
|
|
|
+
|
|
|
+ m_is_member_zhekou = false;
|
|
|
+ m_member_zhekou_value = 10;
|
|
|
+
|
|
|
+ //再重新设置牌号
|
|
|
+ m_canpai = "";
|
|
|
+
|
|
|
+ CButtonUI* pCanpaiEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_canpaihao")));
|
|
|
+ pCanpaiEdit->SetText(L"输入餐牌号");
|
|
|
+
|
|
|
+ //整单备注
|
|
|
+ CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_label_zhengdanbeizhu")));
|
|
|
+ pLabel->SetText(L"整单备注:");
|
|
|
+
|
|
|
+ //再初始化取单数量
|
|
|
+ RefreshGuadanNum();
|
|
|
+
|
|
|
+ //先初始化折扣值
|
|
|
+ CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
|
|
|
+ pZhekouEdit->SetText(L"100");
|
|
|
+
|
|
|
+ //再初始化加价
|
|
|
+ m_jiajia = 0;
|
|
|
+ CEditUI* pJiajiaEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_jiajia_value")));
|
|
|
+ pJiajiaEdit->SetText(L"0");
|
|
|
+
|
|
|
+ //初始化优惠
|
|
|
+ m_rengong_youhui = 0;
|
|
|
+ CEditUI* pYouhuiEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_youhui_value")));
|
|
|
+ pYouhuiEdit->SetText(L"0");
|
|
|
+
|
|
|
+ //优惠券
|
|
|
+ m_is_youhuiquan = false;
|
|
|
+ CLabelUI* pYouhuiquanEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_status")));
|
|
|
+ pYouhuiquanEdit->SetText(L"未使用");
|
|
|
+
|
|
|
+ CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_btn_cancel")));
|
|
|
+ pYouhuiquanCancel->SetVisible(false);
|
|
|
+
|
|
|
+ //商品券
|
|
|
+ m_is_shangpinquan = false;
|
|
|
+ CLabelUI* pShangpinEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_status")));
|
|
|
+ pShangpinEdit->SetText(L"未使用");
|
|
|
+
|
|
|
+ CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_btn_cancel")));
|
|
|
+ pShangpinquanCancel->SetVisible(false);
|
|
|
+
|
|
|
+ //次卡
|
|
|
+ m_is_cika = false;
|
|
|
+ CLabelUI* pCikaEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_status")));
|
|
|
+ pCikaEdit->SetText(L"未使用");
|
|
|
+
|
|
|
+ CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_btn_cancel")));
|
|
|
+ pCikaCancel->SetVisible(false);
|
|
|
+
|
|
|
+ //权益卡
|
|
|
+ m_is_quanyika = false;
|
|
|
+ CLabelUI* pQuanyikaEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_status")));
|
|
|
+ pQuanyikaEdit->SetText(L"未使用");
|
|
|
+
|
|
|
+ CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_btn_cancel")));
|
|
|
+ pQuanyikaCancel->SetVisible(false);
|
|
|
+
|
|
|
+ //抹零
|
|
|
+ std::string diandan_moling_type = CSetting::GetInstance()->GetParam("diandan_moling_type");
|
|
|
+ m_moling_type = atoi(diandan_moling_type.c_str());
|
|
|
+
|
|
|
+ if (m_moling_type == 0)
|
|
|
+ {
|
|
|
+ CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("diandan_jiesuan_moling_bumoling")));
|
|
|
+ pMolingCheck->Selected(true, false);
|
|
|
+ }
|
|
|
+ else if (m_moling_type == 1)
|
|
|
+ {
|
|
|
+ CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("diandan_jiesuan_moling_molingdaojiao")));
|
|
|
+ pMolingCheck->Selected(true, false);
|
|
|
+ }
|
|
|
+ else if (m_moling_type == 2)
|
|
|
+ {
|
|
|
+ CCheckBoxUI* pMolingCheck = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("diandan_jiesuan_moling_molingdaoyuan")));
|
|
|
+ pMolingCheck->Selected(true, false);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::InitJiesuanZhifu()
|
|
|
+{
|
|
|
+ CHorizontalLayoutUI* pZhifufangshiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_layout")));
|
|
|
+
|
|
|
+ int num = 0;
|
|
|
+
|
|
|
+ CHorizontalLayoutUI* pWeixinLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_weixinzhifu")));
|
|
|
+ if (CShopinfo::GetInstance()->m_is_online_pay_open == "1")
|
|
|
+ {
|
|
|
+ //展示微信支付,并且调整位置
|
|
|
+ pWeixinLayout->SetVisible(true);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pZhifufangshiLayout->RemoveAt(num);
|
|
|
+ }
|
|
|
+
|
|
|
+ //会员支付
|
|
|
+ CHorizontalLayoutUI* pHuiyuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_huiyuan")));
|
|
|
+ if (CShopinfo::GetInstance()->m_is_vip_pay_open == "1")
|
|
|
+ {
|
|
|
+ pHuiyuanLayout->SetVisible(true);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pZhifufangshiLayout->RemoveAt(num);
|
|
|
+ }
|
|
|
+
|
|
|
+ //现金支付
|
|
|
+ CHorizontalLayoutUI* pXianjinLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_xianjin")));
|
|
|
+ if (CShopinfo::GetInstance()->m_is_cash_pay_open == "1")
|
|
|
+ {
|
|
|
+ pXianjinLayout->SetVisible(true);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pZhifufangshiLayout->RemoveAt(num);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ //购物卡
|
|
|
+ CHorizontalLayoutUI* pGouwukaLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_gouwuka")));
|
|
|
+ if (CShopinfo::GetInstance()->m_is_giftcard_pay_open == "1")
|
|
|
+ {
|
|
|
+ pGouwukaLayout->SetVisible(true);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pGouwukaLayout->SetVisible(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //美食城临时卡
|
|
|
+ CHorizontalLayoutUI* pMeishichengLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_meishicheng")));
|
|
|
+ if (CShopinfo::GetInstance()->m_is_food_town_card_pay_open == "1")
|
|
|
+ {
|
|
|
+ pMeishichengLayout->SetVisible(true);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pMeishichengLayout->SetVisible(false);
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
+ //福利卡
|
|
|
+ CHorizontalLayoutUI* pFulikaLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_fulika")));
|
|
|
+ if (CShopinfo::GetInstance()->m_is_open_fulika_pay == "1")
|
|
|
+ {
|
|
|
+ pFulikaLayout->SetVisible(true);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pZhifufangshiLayout->RemoveAt(num);
|
|
|
+ }
|
|
|
+
|
|
|
+ //接着添加自定义支付的
|
|
|
+ for (std::vector<SelfPay>::iterator it = CShopinfo::GetInstance()->m_self_pay.begin(); it != CShopinfo::GetInstance()->m_self_pay.end(); it++)
|
|
|
+ {
|
|
|
+ SelfPay selfpay = *it;
|
|
|
+
|
|
|
+ if (selfpay.is_open == "1")
|
|
|
+ {
|
|
|
+ CButtonUI* newButton = new CButtonUI();
|
|
|
+
|
|
|
+ newButton->SetFixedWidth(120);
|
|
|
+ newButton->SetFixedHeight(80);
|
|
|
+ newButton->SetText(CLewaimaiString::UTF8ToUnicode(selfpay.name).c_str());
|
|
|
+
|
|
|
+ newButton->SetBorderSize(1);
|
|
|
+ newButton->SetBorderColor(0xFFC1C1C1);
|
|
|
+ newButton->SetBkColor(0xFFF7F7F7);
|
|
|
+
|
|
|
+ //设置定义属性,在点击按钮的时候好区分
|
|
|
+ newButton->SetAttribute(L"name", L"diandan_jiesuan_zhifufangshi_zidingyi_btn");
|
|
|
+ newButton->AddCustomAttribute(L"selfpay_id", CLewaimaiString::UTF8ToUnicode(selfpay.id).c_str());
|
|
|
+ newButton->SetAttribute(L"float", L"true");
|
|
|
+
|
|
|
+ //必须先Add,才能调用下面的SetPos,否则无效
|
|
|
+ pZhifufangshiLayout->Add(newButton);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ m_nZhiufuNum = num;
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::UpdateJiesuanZhifuPos()
|
|
|
+{
|
|
|
+ //添加支付方式
|
|
|
+ int nWidth = m_nPageWidth;
|
|
|
+ if (nWidth == 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ int nZhangdanWidth = nWidth - 491 - 391 - 5;
|
|
|
+ if (nZhangdanWidth < 290)
|
|
|
+ {
|
|
|
+ nZhangdanWidth = 290;
|
|
|
+ }
|
|
|
+ CVerticalLayoutUI* pZhangdanLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(L"diandan_page_jiesuan_zhangdan_layout"));
|
|
|
+ pZhangdanLayout->SetFixedWidth(nZhangdanWidth);
|
|
|
+
|
|
|
+ //根据宽度计算每行显示的数量
|
|
|
+ int nMeihangNum = (nZhangdanWidth) / 144;
|
|
|
+ if (nMeihangNum < 1)
|
|
|
+ {
|
|
|
+ nMeihangNum = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ int num = 0;
|
|
|
+
|
|
|
+ CHorizontalLayoutUI* pZhifufangshiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_layout")));
|
|
|
+ for (int i = 0; i < m_nZhiufuNum; i++)
|
|
|
+ {
|
|
|
+ CButtonUI* curItem = static_cast<CButtonUI*>(pZhifufangshiLayout->GetItemAt(i));
|
|
|
+
|
|
|
+ int curRow = num / nMeihangNum + 1;
|
|
|
+ int curCol = num % nMeihangNum + 1;
|
|
|
+
|
|
|
+ RECT rect;
|
|
|
+ rect.left = (curCol - 1) * 140 + 20;
|
|
|
+ rect.right = rect.left + 120;
|
|
|
+ rect.top = (curRow - 1) * 100 + 20;
|
|
|
+ rect.bottom = rect.top + 80;
|
|
|
+
|
|
|
+ curItem->SetPos(rect);
|
|
|
+
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //调整区域高度
|
|
|
+ int lastRow = (num - 1) / nMeihangNum + 1;
|
|
|
+ pZhifufangshiLayout->SetFixedHeight(lastRow * 105);
|
|
|
+}
|
|
|
+
|
|
|
+//展示结算页面,隐藏选购页面
|
|
|
+void CZhengcanDiandanPageUI::ShowJiesuanPage()
|
|
|
+{
|
|
|
+ //先隐藏商品页面
|
|
|
+ CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_food_layout")));
|
|
|
+ pFoodLayout->SetVisible(false);
|
|
|
+
|
|
|
+ //隐藏结算按钮
|
|
|
+ CHorizontalLayoutUI* pPayLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_pay_layout")));
|
|
|
+ pPayLayout->SetVisible(false);
|
|
|
+
|
|
|
+ //再展示结算页面
|
|
|
+ CHorizontalLayoutUI* pJiesuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_layout")));
|
|
|
+ pJiesuanLayout->SetVisible(true);
|
|
|
+
|
|
|
+ //展示继续加菜的按钮
|
|
|
+ CButtonUI* pJiacaiBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_jixujiacai")));
|
|
|
+ pJiacaiBtn->SetVisible(true);
|
|
|
+
|
|
|
+ //更新结算按钮位置
|
|
|
+ UpdateJiesuanZhifuPos();
|
|
|
+}
|
|
|
+
|
|
|
+//展示选购页面,隐藏结算页面
|
|
|
+void CZhengcanDiandanPageUI::ShowXuangouPage()
|
|
|
+{
|
|
|
+ //先展示商品页面
|
|
|
+ CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_food_layout")));
|
|
|
+ pFoodLayout->SetVisible(true);
|
|
|
+
|
|
|
+ //展示结算按钮
|
|
|
+ CHorizontalLayoutUI* pPayLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_pay_layout")));
|
|
|
+ pPayLayout->SetVisible(true);
|
|
|
+
|
|
|
+ //再隐藏结算页面
|
|
|
+ CHorizontalLayoutUI* pJiesuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_layout")));
|
|
|
+ pJiesuanLayout->SetVisible(false);
|
|
|
+
|
|
|
+ //隐藏继续加菜的按钮
|
|
|
+ CButtonUI* pJiacaiBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_jixujiacai")));
|
|
|
+ pJiacaiBtn->SetVisible(false);
|
|
|
+}
|
|
|
+
|
|
|
+//只是刷新取单数量
|
|
|
+void CZhengcanDiandanPageUI::RefreshGuadanNum()
|
|
|
+{
|
|
|
+ size_t guadan_num = m_guadan_orders.size();
|
|
|
+ CLabelUI* pNum = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_qudan_num")));
|
|
|
+ if (guadan_num > 0)
|
|
|
+ {
|
|
|
+ //有挂单的
|
|
|
+ pNum->SetText(to_wstring(guadan_num).c_str());
|
|
|
+ pNum->SetVisible(true);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //没有挂单的
|
|
|
+ pNum->SetVisible(false);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理按钮点击类事件
|
|
|
+void CZhengcanDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+ CDuiString name = msg.pSender->GetName();
|
|
|
+
|
|
|
+ if (name == L"diandan_page_return")
|
|
|
+ {
|
|
|
+ m_pMainWnd->SwitchPage(CMainWnd::ZHENGCAN);
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_fooditem")
|
|
|
+ {
|
|
|
+ CDiandanFoodItemUI* fooditemUI = static_cast<CDiandanFoodItemUI*>(msg.pSender);
|
|
|
+
|
|
|
+ m_cur_click_food_item = fooditemUI;
|
|
|
+
|
|
|
+ this->ClickFoodAction();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_jia")
|
|
|
+ {
|
|
|
+ this->ClickAdd();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_jian")
|
|
|
+ {
|
|
|
+ this->ClickDel();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_shanchu")
|
|
|
+ {
|
|
|
+ this->ClickRemove();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_guige")
|
|
|
+ {
|
|
|
+ this->ClickGuige();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_qingkong")
|
|
|
+ {
|
|
|
+ this->ClickQingkong();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_zhengdanbeizhu")
|
|
|
+ {
|
|
|
+ this->ClickZhengdanMemo();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_gengduozhifu_pay")
|
|
|
+ {
|
|
|
+ //点击更多支付
|
|
|
+ this->ClickGengduoPay();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_jixujiacai")
|
|
|
+ {
|
|
|
+ //点击继续加菜
|
|
|
+ this->JixuJiacai();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_chakanyouhui")
|
|
|
+ {
|
|
|
+ //点击查看优惠
|
|
|
+ this->ClickChakanYouhui();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_dabao")
|
|
|
+ {
|
|
|
+ //点击打包
|
|
|
+ this->ClickDabao();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_member_login")
|
|
|
+ {
|
|
|
+ //点击会员登录
|
|
|
+ this->ClickMemberLogin();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_zhekou_value")
|
|
|
+ {
|
|
|
+ //点击整单折扣
|
|
|
+ this->ClickZhekou();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_jiajia_value")
|
|
|
+ {
|
|
|
+ //点击加价
|
|
|
+ this->ClickJiajia();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_youhui_value")
|
|
|
+ {
|
|
|
+ //点击人工优惠
|
|
|
+ this->ClickRengongyouhui();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_youhuiquan_btn")
|
|
|
+ {
|
|
|
+ //点击扫码优惠券
|
|
|
+ this->ClickSaomaYouhuiquan();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_shangpinquan_btn")
|
|
|
+ {
|
|
|
+ //点击扫码商品券
|
|
|
+ this->ClickSaomaShangpinquan();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_cika_btn")
|
|
|
+ {
|
|
|
+ //点击扫码次卡
|
|
|
+ this->ClickSaomaCika();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_quanyika_btn")
|
|
|
+ {
|
|
|
+ //点击扫码权益卡
|
|
|
+ this->ClickSaomaQuanyika();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_canpaihao")
|
|
|
+ {
|
|
|
+ //点击餐牌号
|
|
|
+ this->ClickCanpai();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_weixinzhifu_pay" || name == L"diandan_jiesuan_zhifufangshi_weixinzhifu_btn")
|
|
|
+ {
|
|
|
+ //点击微信支付
|
|
|
+ this->StartWeixinzhifuShoukuan();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_huiyuanzhifu_pay" || name == L"diandan_jiesuan_zhifufangshi_huiyuan_btn")
|
|
|
+ {
|
|
|
+ //点击会员收款
|
|
|
+ this->StartHuiyuanShoukuan();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_xianjinzhifu_pay" || name == L"diandan_jiesuan_zhifufangshi_xianjin_btn")
|
|
|
+ {
|
|
|
+ //点击现金收款
|
|
|
+ this->StartXianjinShoukuan();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_zhifufangshi_fulika_btn")
|
|
|
+ {
|
|
|
+ //福利卡收款
|
|
|
+ this->StartFulikaShoukuan();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_zhifufangshi_zidingyi_btn")
|
|
|
+ {
|
|
|
+ //自定义支付
|
|
|
+ std::wstring name = msg.pSender->GetText();
|
|
|
+ std::wstring selfpay_id = msg.pSender->GetCustomAttribute(L"selfpay_id");
|
|
|
+
|
|
|
+ this->StartZidingyiShoukuan(name, selfpay_id);
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_food_search_clear")
|
|
|
+ {
|
|
|
+ CEditUI* m_pEdit = static_cast<CEditUI*>(m_pManager->FindControl(_T("diandan_food_search_edit")));
|
|
|
+ m_pEdit->SetText(L"");
|
|
|
+
|
|
|
+ StopSerachFood();
|
|
|
+ }
|
|
|
+ else if (name == L"btn_diandan_qianxiang")
|
|
|
+ {
|
|
|
+ CPosPrinter printer;
|
|
|
+ printer.OpenQianxiang();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_youhuiquan_btn_cancel")
|
|
|
+ {
|
|
|
+ this->ClickQuxiaoYouhuiquan();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_shangpinquan_btn_cancel")
|
|
|
+ {
|
|
|
+ this->ClickQuxiaoShangpinquan();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_quanyika_btn_cancel")
|
|
|
+ {
|
|
|
+ this->ClickQuxiaoQuanyika();
|
|
|
+ }
|
|
|
+ else if (name == L"diandan_jiesuan_cika_btn_cancel")
|
|
|
+ {
|
|
|
+ this->ClickQuxiaoCika();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理option切换事件
|
|
|
+void CZhengcanDiandanPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+ CDuiString name = msg.pSender->GetName();
|
|
|
+
|
|
|
+ COptionUI* curOption = static_cast<COptionUI*>(msg.pSender);
|
|
|
+ std::wstring groupname = curOption->GetGroup();
|
|
|
+
|
|
|
+ if (groupname == L"diandan_foodtype")
|
|
|
+ {
|
|
|
+ //商品分类切换
|
|
|
+ CFoodtypeOptionUI* typeUI = static_cast<CFoodtypeOptionUI*>(curOption);
|
|
|
+ std::string id = typeUI->GetTypeId();
|
|
|
+
|
|
|
+ if (m_cur_type_id != id)
|
|
|
+ {
|
|
|
+ //切换了商品分类
|
|
|
+ m_curFoodtypeOption->SetBkColor(0xFFECECEC);
|
|
|
+
|
|
|
+ msg.pSender->SetBkColor(0xFF3CB371);
|
|
|
+
|
|
|
+ m_curFoodtypeOption = static_cast<CControlUI*>(msg.pSender);
|
|
|
+
|
|
|
+ m_cur_type_id = id;
|
|
|
+
|
|
|
+ this->InitFoodShow();
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (groupname == L"diandan_jiesuan_moling")
|
|
|
+ {
|
|
|
+ if (name == _T("diandan_jiesuan_moling_bumoling"))
|
|
|
+ {
|
|
|
+ m_moling_type = 0;
|
|
|
+
|
|
|
+ CSetting::GetInstance()->SetParam("diandan_moling_type", "0");
|
|
|
+
|
|
|
+ UpdateJiesuanInfo();
|
|
|
+ }
|
|
|
+ else if (name == _T("diandan_jiesuan_moling_molingdaojiao"))
|
|
|
+ {
|
|
|
+ m_moling_type = 1;
|
|
|
+
|
|
|
+ CSetting::GetInstance()->SetParam("diandan_moling_type", "1");
|
|
|
+
|
|
|
+ UpdateJiesuanInfo();
|
|
|
+ }
|
|
|
+ else if (name == _T("diandan_jiesuan_moling_molingdaoyuan"))
|
|
|
+ {
|
|
|
+ m_moling_type = 2;
|
|
|
+
|
|
|
+ CSetting::GetInstance()->SetParam("diandan_moling_type", "2");
|
|
|
+
|
|
|
+ UpdateJiesuanInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理下拉框、radio的切换事件
|
|
|
+void CZhengcanDiandanPageUI::HandleItemSelectMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//处理编辑框输入内容改变事件
|
|
|
+void CZhengcanDiandanPageUI::HandleTextChangedMsg(TNotifyUI& msg)
|
|
|
+{
|
|
|
+ CDuiString name = msg.pSender->GetName();
|
|
|
+
|
|
|
+ if (name == L"diandan_food_search_edit")
|
|
|
+ {
|
|
|
+ //商品搜索框的输入事件
|
|
|
+ CEditUI* m_pEdit = static_cast<CEditUI*>(m_pManager->FindControl(_T("diandan_food_search_edit")));
|
|
|
+ wstring ws_Value = m_pEdit->GetText();
|
|
|
+ string strValue = CLewaimaiString::UnicodeToUTF8(ws_Value);
|
|
|
+
|
|
|
+ if (strValue.length() == 0)
|
|
|
+ {
|
|
|
+ //搜索词被清空了,退出搜索
|
|
|
+ this->StopSerachFood();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //搜索词没清空,进入搜索
|
|
|
+ this->StartSearchFood(strValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理扫码枪捕捉到的扫码信息
|
|
|
+void CZhengcanDiandanPageUI::HandleTextCapture(std::string content)
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ m_curModalWnd->HandleTextCapture(content);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //没有任何弹框,那么就是按扫描商品条码来处理
|
|
|
+ bool ret = this->SaomiaoBarcode(content);
|
|
|
+ if (ret == true)
|
|
|
+ {
|
|
|
+ //已经找到了条码,那么就处理完了
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.length() != 12 && content.length() != 13 && content.length() != 17 && content.length() != 18)
|
|
|
+ {
|
|
|
+ //位数不对,那肯定不是称重条码
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //如果没有找到条码,就找一下是不是称重的标签秤的码,这个时候要对码进行各种分析了
|
|
|
+ ret = this->BiaoqianchengSaomaBarcode(content);
|
|
|
+ if (ret == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //代码走到这里,肯定不是条码了,也不是称重码,判断是不是付款码
|
|
|
+ std::string s_Fukuanma = content;
|
|
|
+
|
|
|
+ int length = s_Fukuanma.size();
|
|
|
+ if (length != 18 && length != 19)
|
|
|
+ {
|
|
|
+ //肯定不是付款码
|
|
|
+ m_pMainWnd->ShowToast(L"无效的条码!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < length; i++)
|
|
|
+ {
|
|
|
+ char c = *(s_Fukuanma.c_str() + i);
|
|
|
+ if (isdigit(c) == 0)
|
|
|
+ {
|
|
|
+ //不是数字
|
|
|
+ m_pMainWnd->ShowToast(L"无效的条码!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (s_Fukuanma.find("10") == 0 \
|
|
|
+ || s_Fukuanma.find("11") == 0 \
|
|
|
+ || s_Fukuanma.find("12") == 0 \
|
|
|
+ || s_Fukuanma.find("13") == 0 \
|
|
|
+ || s_Fukuanma.find("14") == 0 \
|
|
|
+ || s_Fukuanma.find("15") == 0)
|
|
|
+ {
|
|
|
+ //微信付款码
|
|
|
+ }
|
|
|
+ else if (s_Fukuanma.find("25") == 0 \
|
|
|
+ || s_Fukuanma.find("26") == 0 \
|
|
|
+ || s_Fukuanma.find("27") == 0 \
|
|
|
+ || s_Fukuanma.find("28") == 0 \
|
|
|
+ || s_Fukuanma.find("29") == 0 \
|
|
|
+ || s_Fukuanma.find("30") == 0)
|
|
|
+ {
|
|
|
+ //支付宝付款码
|
|
|
+ }
|
|
|
+ else if (s_Fukuanma.find("62") == 0)
|
|
|
+ {
|
|
|
+ //云闪付付款码
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_pMainWnd->ShowToast(L"无效的条码!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //代码能走到这里,说明肯定就是付款码了,默认唤起支付
|
|
|
+ this->StartWeixinzhifuShoukuan(content);
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::AddDiandanOrderItemShow(int index)
|
|
|
+{
|
|
|
+ CZhengcanOrderItem item = m_cur_diandan_order.getDiandanOrderItem(index);
|
|
|
+
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(builder.Create(_T("diandan_cart_item.xml"), (UINT)0, NULL, m_pManager));
|
|
|
+
|
|
|
+ pList->Add(pEle);
|
|
|
+
|
|
|
+ if (item.m_is_taocan)
|
|
|
+ {
|
|
|
+ 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());
|
|
|
+
|
|
|
+ CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
+
|
|
|
+ pEle->SetFixedHeight(84);
|
|
|
+ pNature->SetVisible(true);
|
|
|
+ pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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());
|
|
|
+
|
|
|
+ CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
+ if (item.is_nature)
|
|
|
+ {
|
|
|
+ pEle->SetFixedHeight(84);
|
|
|
+ pNature->SetVisible(true);
|
|
|
+ pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pEle->SetFixedHeight(42);
|
|
|
+ pNature->SetVisible(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新结算信息
|
|
|
+ UpdateJiesuanInfo();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::UpdateDiandanOrderItemShow(int index)
|
|
|
+{
|
|
|
+ CZhengcanOrderItem item = m_cur_diandan_order.getDiandanOrderItem(index);
|
|
|
+
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ CListContainerElementUI* pEle = static_cast<CListContainerElementUI*>(pList->GetItemAt(index));
|
|
|
+
|
|
|
+ if (item.m_is_taocan)
|
|
|
+ {
|
|
|
+ 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());
|
|
|
+
|
|
|
+ CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
+
|
|
|
+ pEle->SetFixedHeight(84);
|
|
|
+ pNature->SetVisible(true);
|
|
|
+ pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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());
|
|
|
+
|
|
|
+ CLabelUI* pNature = static_cast<CLabelUI*>(pEle->FindSubControl(_T("diandan_cart_item_nature")));
|
|
|
+ if (item.is_nature)
|
|
|
+ {
|
|
|
+ pEle->SetFixedHeight(84);
|
|
|
+ pNature->SetVisible(true);
|
|
|
+ pNature->SetText(CLewaimaiString::UTF8ToUnicode(item.getNatureShow()).c_str());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pEle->SetFixedHeight(42);
|
|
|
+ pNature->SetVisible(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新结算信息
|
|
|
+ UpdateJiesuanInfo();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::DelDiandanOrderItemShow(int index)
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ pList->RemoveAt(index);
|
|
|
+
|
|
|
+ //更新结算信息
|
|
|
+ UpdateJiesuanInfo();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClearDiandanOrderItemShow()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ pList->RemoveAll();
|
|
|
+
|
|
|
+ //更新结算信息
|
|
|
+ UpdateJiesuanInfo();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::UpdateJiesuanInfo()
|
|
|
+{
|
|
|
+ //先按所有的价格公式规则,计算一次价格
|
|
|
+ //(基础商品价格+属性价格-商品券-次卡(抵扣金额、抵扣商品)-会员商品优惠)*店铺折扣*分等级会员折扣*权益卡折扣*次卡折扣-满减优惠-次卡满减-优惠券+加价-优惠-抹零+开台费+打包费+茶位费
|
|
|
+
|
|
|
+ //先计算基础商品价格(不包含任何优惠活动等情况下的实际金额,已包含商品属性价格)
|
|
|
+ double jichu_price = m_cur_diandan_order.getTotalPrice();
|
|
|
+
|
|
|
+ //这个是临时变量,表示每次优惠过后的实时价格
|
|
|
+ double cur_price = jichu_price;
|
|
|
+
|
|
|
+ double total_youhui = 0;
|
|
|
+
|
|
|
+ //判断是否有商品券,如果有的话把金额抵扣掉
|
|
|
+ m_shangpinquan_youhui = 0;
|
|
|
+ if (m_is_shangpinquan)
|
|
|
+ {
|
|
|
+ //判断当前购物车商品,是否有满足对应商品券使用要求的
|
|
|
+ bool ret = m_cur_diandan_order.UseShangpinquan(m_shangpinquan_foodid, m_shangpinquan_youhui);
|
|
|
+
|
|
|
+ total_youhui += m_shangpinquan_youhui;
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断次卡
|
|
|
+ m_cika_youhui = 0;
|
|
|
+ if (m_is_cika)
|
|
|
+ {
|
|
|
+ //对次卡进行处理
|
|
|
+ if (m_cika_deduct_type == "0")
|
|
|
+ {
|
|
|
+ }
|
|
|
+ else if (m_cika_deduct_type == "1")
|
|
|
+ {
|
|
|
+ }
|
|
|
+ else if (m_cika_deduct_type == "2")
|
|
|
+ {
|
|
|
+ m_cika_youhui = atof(m_cika_offer_value.c_str());
|
|
|
+ }
|
|
|
+ else if (m_cika_deduct_type == "3")
|
|
|
+ {
|
|
|
+ //这种情况是次卡跟商品券一样抵扣商品\
|
|
|
+
|
|
|
+ bool ret;
|
|
|
+ if (m_is_shangpinquan && m_shangpinquan_foodid == m_cika_bind_foods_id)
|
|
|
+ {
|
|
|
+ ret = m_cur_diandan_order.UseCikaDikou(m_cika_bind_foods_id, m_cika_youhui, true);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ret = m_cur_diandan_order.UseCikaDikou(m_cika_bind_foods_id, m_cika_youhui, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ total_youhui += m_cika_youhui;
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断会员商品优惠
|
|
|
+ m_total_member_youhui = 0;
|
|
|
+
|
|
|
+ if (m_is_member)
|
|
|
+ {
|
|
|
+ m_total_member_youhui = m_cur_diandan_order.getTotalMemberYouhui(m_member_level);
|
|
|
+ }
|
|
|
+ total_youhui += m_total_member_youhui;
|
|
|
+
|
|
|
+ cur_price = jichu_price - total_youhui;
|
|
|
+
|
|
|
+ //再判断整单折扣
|
|
|
+ CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
|
|
|
+ wstring ws_zhekou = pZhekouEdit->GetText();
|
|
|
+ int zhekouValue = atoi(CLewaimaiString::UnicodeToUTF8(ws_zhekou).c_str());
|
|
|
+
|
|
|
+ m_zhekou_value = zhekouValue;
|
|
|
+
|
|
|
+ if (zhekouValue == 100)
|
|
|
+ {
|
|
|
+ m_zhekou_youhui = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_zhekou_youhui = (100 - zhekouValue) * cur_price / 100.00;
|
|
|
+ total_youhui += m_zhekou_youhui;
|
|
|
+
|
|
|
+ cur_price = cur_price - m_zhekou_youhui;
|
|
|
+ }
|
|
|
+
|
|
|
+ //再判断分等级会员折扣
|
|
|
+ m_member_zhekou_youhui = 0;
|
|
|
+
|
|
|
+ std::vector<DiscountInfo> member_discount_info = CShopinfo::GetInstance()->m_discount_info;
|
|
|
+
|
|
|
+ for (std::vector<DiscountInfo>::iterator it = member_discount_info.begin(); it != member_discount_info.end(); it++)
|
|
|
+ {
|
|
|
+ DiscountInfo info = *it;
|
|
|
+ if (info.member_level == m_member_level)
|
|
|
+ {
|
|
|
+ if (info.is_discount == "1")
|
|
|
+ {
|
|
|
+ m_is_member_zhekou = true;
|
|
|
+ m_member_zhekou_value = info.discount_value;
|
|
|
+
|
|
|
+ double member_discount = atof(info.discount_value.c_str());
|
|
|
+ if (abs(member_discount - 10) < 0.0001)
|
|
|
+ {
|
|
|
+ m_member_zhekou_youhui = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_member_zhekou_youhui = (10 - member_discount) * cur_price / 10.00;
|
|
|
+ total_youhui += m_member_zhekou_youhui;
|
|
|
+
|
|
|
+ cur_price -= m_member_zhekou_youhui;
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //再判断权益卡折扣
|
|
|
+ m_quanyika_youhui = 0;
|
|
|
+ if (m_is_quanyika == true)
|
|
|
+ {
|
|
|
+ double quanyika_zhekou = atof(m_quanyika_discount.c_str());
|
|
|
+ if (abs(quanyika_zhekou - 10) < 0.0001)
|
|
|
+ {
|
|
|
+ m_quanyika_youhui = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_quanyika_youhui = (10 - quanyika_zhekou) * cur_price / 10.00;
|
|
|
+ total_youhui += m_quanyika_youhui;
|
|
|
+
|
|
|
+ cur_price -= m_quanyika_youhui;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //次卡折扣
|
|
|
+ if (m_is_cika)
|
|
|
+ {
|
|
|
+ //对次卡进行处理
|
|
|
+ if (m_cika_deduct_type == "0")
|
|
|
+ {
|
|
|
+ double cika_zhekou = atof(m_cika_discount_value.c_str());
|
|
|
+ if (abs(cika_zhekou - 10) < 0.0001)
|
|
|
+ {
|
|
|
+ m_cika_youhui = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_cika_youhui = (10 - cika_zhekou) * cur_price / 10.00;
|
|
|
+ total_youhui += m_cika_youhui;
|
|
|
+
|
|
|
+ cur_price -= m_cika_youhui;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //满减优惠
|
|
|
+ m_manjian_youhui = 0;
|
|
|
+
|
|
|
+ if (CShopinfo::GetInstance()->m_open_promotion == "1")
|
|
|
+ {
|
|
|
+ //开启了满减,进行判断
|
|
|
+
|
|
|
+ std::vector<Promotion> promotion = CShopinfo::GetInstance()->m_promotion;
|
|
|
+
|
|
|
+ for (std::vector<Promotion>::iterator it = promotion.begin(); it != promotion.end(); it++)
|
|
|
+ {
|
|
|
+ Promotion cur = *it;
|
|
|
+
|
|
|
+ if (jichu_price >= cur.amount)
|
|
|
+ {
|
|
|
+ m_manjian_youhui = cur.discount;
|
|
|
+
|
|
|
+ total_youhui += m_manjian_youhui;
|
|
|
+
|
|
|
+ cur_price -= m_manjian_youhui;
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //次卡满减
|
|
|
+ if (m_is_cika)
|
|
|
+ {
|
|
|
+ //对次卡进行处理
|
|
|
+ if (m_cika_deduct_type == "1")
|
|
|
+ {
|
|
|
+ std::vector<std::string> manjian = CLewaimaiString::Split(m_cika_full_reduce_value, ",");
|
|
|
+
|
|
|
+ double amount = atof(manjian[0].c_str());
|
|
|
+ double value = atof(manjian[1].c_str());
|
|
|
+
|
|
|
+ if (jichu_price >= amount)
|
|
|
+ {
|
|
|
+ m_cika_youhui = value;
|
|
|
+
|
|
|
+ total_youhui += m_cika_youhui;
|
|
|
+
|
|
|
+ cur_price -= m_cika_youhui;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //优惠券
|
|
|
+ m_youhuiquan_youhui = 0;
|
|
|
+
|
|
|
+ if (m_is_youhuiquan)
|
|
|
+ {
|
|
|
+ time_t deadline = CLewaimaiTime::StringToDatetime(m_coupon_deadline);
|
|
|
+ time_t now = time(NULL);
|
|
|
+ if (deadline > now)
|
|
|
+ {
|
|
|
+ if (jichu_price >= atof(m_coupon_basic_price.c_str()))
|
|
|
+ {
|
|
|
+ m_youhuiquan_youhui = atof(m_coupon_value.c_str());
|
|
|
+
|
|
|
+ total_youhui += m_youhuiquan_youhui;
|
|
|
+
|
|
|
+ cur_price -= m_youhuiquan_youhui;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //加价
|
|
|
+ m_jiajia = 0;
|
|
|
+ CEditUI* pJiajiaEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_jiajia_value")));
|
|
|
+ wstring ws_jiajia = pJiajiaEdit->GetText();
|
|
|
+ m_jiajia = atof(CLewaimaiString::UnicodeToUTF8(ws_jiajia).c_str());
|
|
|
+
|
|
|
+ cur_price += m_jiajia;
|
|
|
+
|
|
|
+ //人工优惠
|
|
|
+ m_rengong_youhui = 0;
|
|
|
+
|
|
|
+ CEditUI* pYouhuiEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_youhui_value")));
|
|
|
+ wstring ws_rengong_youhui = pYouhuiEdit->GetText();
|
|
|
+ m_rengong_youhui = atof(CLewaimaiString::UnicodeToUTF8(ws_rengong_youhui).c_str());
|
|
|
+
|
|
|
+ total_youhui += m_rengong_youhui;
|
|
|
+
|
|
|
+ cur_price -= m_rengong_youhui;
|
|
|
+
|
|
|
+ //开台费
|
|
|
+ m_kaitai = 0;
|
|
|
+
|
|
|
+ //打包费
|
|
|
+ m_dabao = m_cur_diandan_order.getDabaoMoney();
|
|
|
+
|
|
|
+ cur_price += m_dabao;
|
|
|
+
|
|
|
+ //茶位费
|
|
|
+ m_chawei = 0;
|
|
|
+
|
|
|
+ //抹零
|
|
|
+ m_moling_youhui = 0;
|
|
|
+
|
|
|
+ if (m_moling_type == 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (m_moling_type == 1)
|
|
|
+ {
|
|
|
+ double new_price = (int)(cur_price * 10) / 10.0;
|
|
|
+
|
|
|
+ m_moling_youhui = cur_price - new_price;
|
|
|
+ total_youhui += m_moling_youhui;
|
|
|
+
|
|
|
+ cur_price = new_price;
|
|
|
+ }
|
|
|
+ else if (m_moling_type == 2)
|
|
|
+ {
|
|
|
+ double new_price = (int)(cur_price);
|
|
|
+
|
|
|
+ m_moling_youhui = cur_price - new_price;
|
|
|
+ total_youhui += m_moling_youhui;
|
|
|
+
|
|
|
+ cur_price = new_price;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cur_price < 0)
|
|
|
+ {
|
|
|
+ cur_price = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_total_price = cur_price;
|
|
|
+
|
|
|
+ m_total_youhui = total_youhui;
|
|
|
+
|
|
|
+ //至此优惠全部处理完了,开始刷新各个地方的展示
|
|
|
+
|
|
|
+ //先刷新优惠展示
|
|
|
+ CHorizontalLayoutUI* pYouhuiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_page_youhui_tishi_layout")));
|
|
|
+ CLabelUI* pYouhuiLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_youhui_tishi")));
|
|
|
+
|
|
|
+ if (total_youhui > 0)
|
|
|
+ {
|
|
|
+ wstring youhuilabel = L"已优惠 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(total_youhui, 2)) + L" 元";
|
|
|
+ pYouhuiLabel->SetText(youhuilabel.c_str());
|
|
|
+
|
|
|
+ pYouhuiLayout->SetVisible(true);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pYouhuiLayout->SetVisible(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //再刷新打包费展示
|
|
|
+ CLabelUI* pOtherPriceLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_otherprice")));
|
|
|
+ if (m_dabao > 0)
|
|
|
+ {
|
|
|
+ std::wstring ws_dabaofei = L"打包费 " + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_dabao, 2)) + L" 元";
|
|
|
+ pOtherPriceLabel->SetText(ws_dabaofei.c_str());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pOtherPriceLabel->SetText(L"");
|
|
|
+ }
|
|
|
+
|
|
|
+ //再刷新总价展示
|
|
|
+ CLabelUI* pTotalPrice = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_totalprice")));
|
|
|
+ pTotalPrice->SetText((L"总价:¥" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(cur_price, 2))).c_str());
|
|
|
+
|
|
|
+ //再刷新账单明细展示
|
|
|
+ CVerticalLayoutUI* pmingxiLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhangdanmingxi_jiage_layout")));
|
|
|
+ pmingxiLayout->RemoveAll();
|
|
|
+
|
|
|
+ int item_num = 0;
|
|
|
+
|
|
|
+ //先显示基础价格
|
|
|
+ if (true)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"商品原价:");
|
|
|
+ pValue->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(jichu_price, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //开始展示各种优惠
|
|
|
+ if (m_shangpinquan_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"商品券优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_shangpinquan_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_cika_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"次卡优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_cika_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_total_member_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"商品会员价优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_total_member_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_zhekou_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"整单折扣优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_zhekou_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_member_zhekou_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"会员整单折扣优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_member_zhekou_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_quanyika_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"权益卡优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_quanyika_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_manjian_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"满减优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_manjian_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_youhuiquan_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"优惠券优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_youhuiquan_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_rengong_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"人工优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_rengong_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_moling_youhui > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"抹零优惠:");
|
|
|
+ pValue->SetText((L"-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_moling_youhui, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //然后处理加价的各种
|
|
|
+ if (m_dabao > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"打包费:");
|
|
|
+ pValue->SetText((L"+" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_dabao, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_jiajia > 0)
|
|
|
+ {
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+ CHorizontalLayoutUI* pItem = static_cast<CHorizontalLayoutUI*>(builder.Create(_T("diandan_zhangdanmingxi_item.xml"), (UINT)0, &cb, m_pManager));
|
|
|
+ pmingxiLayout->Add(pItem);
|
|
|
+
|
|
|
+ CLabelUI* pName = static_cast<CLabelUI*>(pItem->FindSubControl(_T("name")));
|
|
|
+ CLabelUI* pValue = static_cast<CLabelUI*>(pItem->FindSubControl(_T("value")));
|
|
|
+
|
|
|
+ pName->SetText(L"人工加价:");
|
|
|
+ pValue->SetText((L"+" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(m_jiajia, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ item_num++;
|
|
|
+ }
|
|
|
+
|
|
|
+ pmingxiLayout->SetFixedHeight(item_num * 40);
|
|
|
+
|
|
|
+ CLabelUI* pYingshou = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_total_yingshou")));
|
|
|
+ pYingshou->SetText((L"应收金额:" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(cur_price, 2)) + L"元").c_str());
|
|
|
+
|
|
|
+ //同步更新副屏的显示内容
|
|
|
+ CShuangpingTool::GetInstance()->UpdateShow(m_cur_diandan_order, total_youhui, cur_price, m_dabao);
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickFoodAction()
|
|
|
+{
|
|
|
+ bool is_taocan = m_cur_click_food_item->GetIsTaocan();
|
|
|
+
|
|
|
+ if (is_taocan)
|
|
|
+ {
|
|
|
+ //点击套餐之后的处理逻辑
|
|
|
+ CFoodpackage foodpackageinfo = m_cur_click_food_item->GetFoodpackageInfo();
|
|
|
+
|
|
|
+ CZhengcanOrderItem clickItem;
|
|
|
+
|
|
|
+ clickItem.foodpackage_id = foodpackageinfo.id;
|
|
|
+ clickItem.foodpackage_name = foodpackageinfo.name;
|
|
|
+ clickItem.price = foodpackageinfo.price;
|
|
|
+ clickItem.is_dabao = false;
|
|
|
+ clickItem.dabao_money = foodpackageinfo.dabao_money;
|
|
|
+ clickItem.num = "1";
|
|
|
+
|
|
|
+ //把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
|
|
|
+ clickItem.SetFoodpackageInfo(m_cur_click_food_item->GetFoodpackageInfo());
|
|
|
+ clickItem.SetIsTaocan(true);
|
|
|
+
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //先弹框进行选择属性
|
|
|
+ CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(1);
|
|
|
+ pNatureFrame->SetFoodItemUI(m_cur_click_food_item);
|
|
|
+
|
|
|
+ if (pNatureFrame != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pNatureFrame;
|
|
|
+
|
|
|
+ pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pNatureFrame->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pNatureFrame->CenterWindow();
|
|
|
+ UINT ret = pNatureFrame->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //保存选择的属性
|
|
|
+ std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
|
|
|
+ clickItem.natureSelectedArray = natureSelectedArray;
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pNatureFrame;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pNatureFrame;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //商品没有商品属性
|
|
|
+ bool is_add_new = false;
|
|
|
+
|
|
|
+ int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
|
|
|
+
|
|
|
+ if (is_add_new)
|
|
|
+ {
|
|
|
+ //说明是新增了一项,要刷新一下购物车展示
|
|
|
+ this->AddDiandanOrderItemShow(index);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //没有新增,而是修改了一项
|
|
|
+ this->UpdateDiandanOrderItemShow(index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //点击普通商品之后的处理逻辑
|
|
|
+ CFood foodinfo = m_cur_click_food_item->GetFoodInfo();
|
|
|
+
|
|
|
+ if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < 0.001)
|
|
|
+ {
|
|
|
+ //库存为0了,不做任何处理
|
|
|
+ m_pMainWnd->ShowToast(L"该商品已售完");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CZhengcanOrderItem clickItem;
|
|
|
+
|
|
|
+ clickItem.food_id = foodinfo.id;
|
|
|
+ clickItem.food_name = foodinfo.name;
|
|
|
+ clickItem.type_id = foodinfo.type_id;
|
|
|
+ clickItem.price = foodinfo.price;
|
|
|
+ clickItem.is_dabao = false;
|
|
|
+ clickItem.dabao_money = foodinfo.dabao_money;
|
|
|
+ clickItem.num = "1";
|
|
|
+
|
|
|
+ if (foodinfo.member_price_used == "1")
|
|
|
+ {
|
|
|
+ clickItem.is_member_price_used = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clickItem.is_member_price_used = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理会员价的json
|
|
|
+ std::string member_price_json = foodinfo.member_price_json;
|
|
|
+
|
|
|
+ rapidjson::Document document;
|
|
|
+ document.Parse(member_price_json.c_str());
|
|
|
+
|
|
|
+ rapidjson::Value& member_price = document;
|
|
|
+ for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
|
|
|
+ {
|
|
|
+ rapidjson::Value& member_price_info = member_price[i];
|
|
|
+
|
|
|
+ MemberPrice newPirce;
|
|
|
+ newPirce.id = CLewaimaiJson::ToString(member_price_info["id"]);
|
|
|
+ newPirce.level = CLewaimaiJson::ToString(member_price_info["level"]);
|
|
|
+
|
|
|
+ if (member_price_info["price"].IsString())
|
|
|
+ {
|
|
|
+ newPirce.price = member_price_info["price"].GetString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ newPirce.price = to_string(member_price_info["price"].GetDouble());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ clickItem.m_member_price.push_back(newPirce);
|
|
|
+ }
|
|
|
+
|
|
|
+ //把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
|
|
|
+ clickItem.SetFoodInfo(m_cur_click_food_item->GetFoodInfo());
|
|
|
+ clickItem.SetIsTaocan(false);
|
|
|
+
|
|
|
+ if (foodinfo.is_weight == "1")
|
|
|
+ {
|
|
|
+ clickItem.is_weight = true;
|
|
|
+
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //这里要弹出称重框,不弹属性框
|
|
|
+ CChengzhongWnd* pChengzhongFrame = new CChengzhongWnd();
|
|
|
+
|
|
|
+ if (pChengzhongFrame != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pChengzhongFrame;
|
|
|
+
|
|
|
+ pChengzhongFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pChengzhongFrame->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pChengzhongFrame->CenterWindow();
|
|
|
+
|
|
|
+ pChengzhongFrame->SetTitle(CLewaimaiString::UTF8ToUnicode(foodinfo.name));
|
|
|
+
|
|
|
+ UINT ret = pChengzhongFrame->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ std::string weight = pChengzhongFrame->m_weight;
|
|
|
+ if (atof(weight.c_str()) < 0.001)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ clickItem.num = weight;
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pChengzhongFrame;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pChengzhongFrame;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clickItem.is_weight = false;
|
|
|
+
|
|
|
+ if (foodinfo.is_nature == "1")
|
|
|
+ {
|
|
|
+ //商品有商品属性
|
|
|
+ clickItem.is_nature = true;
|
|
|
+
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //先弹框进行选择属性
|
|
|
+ CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(1);
|
|
|
+ pNatureFrame->SetFoodItemUI(m_cur_click_food_item);
|
|
|
+
|
|
|
+ if (pNatureFrame != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pNatureFrame;
|
|
|
+
|
|
|
+ pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pNatureFrame->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pNatureFrame->CenterWindow();
|
|
|
+ UINT ret = pNatureFrame->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //保存选择的属性
|
|
|
+ std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
|
|
|
+ clickItem.natureSelectedArray = natureSelectedArray;
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pNatureFrame;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pNatureFrame;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //商品没有商品属性
|
|
|
+ bool is_add_new = false;
|
|
|
+
|
|
|
+ int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
|
|
|
+
|
|
|
+ if (is_add_new)
|
|
|
+ {
|
|
|
+ //说明是新增了一项,要刷新一下购物车展示
|
|
|
+ this->AddDiandanOrderItemShow(index);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //没有新增,而是修改了一项
|
|
|
+ this->UpdateDiandanOrderItemShow(index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickAdd()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_diandan_order.AddNum(nIndex);
|
|
|
+
|
|
|
+ //没有新增,而是修改了一项
|
|
|
+ this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickDel()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool is_del = m_cur_diandan_order.DelNum(nIndex);
|
|
|
+
|
|
|
+ //如果是删掉了,那么就刷新显示
|
|
|
+ if (is_del)
|
|
|
+ {
|
|
|
+ this->DelDiandanOrderItemShow(nIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
+ {
|
|
|
+ ShowXuangouPage();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickRemove()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_diandan_order.Remove(nIndex);
|
|
|
+
|
|
|
+ this->DelDiandanOrderItemShow(nIndex);
|
|
|
+
|
|
|
+ if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
+ {
|
|
|
+ ShowXuangouPage();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickGuige()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool is_taocan = m_cur_diandan_order.getDiandanOrderItem(nIndex).m_is_taocan;
|
|
|
+ if (is_taocan)
|
|
|
+ {
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //弹出属性框,开始重新选择属性
|
|
|
+ CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(2);
|
|
|
+ pNatureFrame->SetDiandanOrderItem(m_cur_diandan_order.getDiandanOrderItem(nIndex));
|
|
|
+
|
|
|
+ if (pNatureFrame != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pNatureFrame;
|
|
|
+
|
|
|
+ pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pNatureFrame->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pNatureFrame->CenterWindow();
|
|
|
+ UINT ret = pNatureFrame->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //保存选择的属性
|
|
|
+ std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
|
|
|
+ m_cur_diandan_order.UpdateItemGuige(nIndex, natureSelectedArray);
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pNatureFrame;
|
|
|
+
|
|
|
+ //然后要刷新这个item的显示
|
|
|
+ this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pNatureFrame;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bool is_nature = m_cur_diandan_order.getDiandanOrderItem(nIndex).is_nature;
|
|
|
+ if (!is_nature)
|
|
|
+ {
|
|
|
+ //当前商品没有商品属性
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //弹出属性框,开始重新选择属性
|
|
|
+ CDiandanNatureWnd* pNatureFrame = new CDiandanNatureWnd(2);
|
|
|
+ pNatureFrame->SetDiandanOrderItem(m_cur_diandan_order.getDiandanOrderItem(nIndex));
|
|
|
+
|
|
|
+ if (pNatureFrame != NULL)
|
|
|
+ {
|
|
|
+ pNatureFrame->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pNatureFrame->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pNatureFrame->CenterWindow();
|
|
|
+ UINT ret = pNatureFrame->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //保存选择的属性
|
|
|
+ std::vector<FoodNatureSelectValue> natureSelectedArray = pNatureFrame->GetNatureSelectedArray();
|
|
|
+ m_cur_diandan_order.UpdateItemGuige(nIndex, natureSelectedArray);
|
|
|
+
|
|
|
+ delete pNatureFrame;
|
|
|
+
|
|
|
+ //然后要刷新这个item的显示
|
|
|
+ this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickDabao()
|
|
|
+{
|
|
|
+ CListUI* pList = static_cast<CListUI*>(this->FindSubControl(_T("list_diandan_cart")));
|
|
|
+
|
|
|
+ int nIndex = pList->GetCurSel();
|
|
|
+
|
|
|
+ if (nIndex == -1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_diandan_order.SetDabao(nIndex);
|
|
|
+
|
|
|
+ //没有新增,而是修改了一项
|
|
|
+ this->UpdateDiandanOrderItemShow(nIndex);
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickQingkong()
|
|
|
+{
|
|
|
+ m_cur_diandan_order.Clear();
|
|
|
+
|
|
|
+ this->ClearDiandanOrderItemShow();
|
|
|
+
|
|
|
+ ShowXuangouPage();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickZhengdanMemo()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CMemoWnd* pMemoDlg = new CMemoWnd();
|
|
|
+
|
|
|
+ if (pMemoDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pMemoDlg;
|
|
|
+
|
|
|
+ pMemoDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pMemoDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pMemoDlg->CenterWindow();
|
|
|
+
|
|
|
+ pMemoDlg->SetTitle(L"整单备注");
|
|
|
+
|
|
|
+ UINT ret = pMemoDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //保存选择的属性
|
|
|
+ std::string sMemo = pMemoDlg->getContent();
|
|
|
+
|
|
|
+ //渲染整单备注的展示
|
|
|
+ CLabelUI* pLabel = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_label_zhengdanbeizhu")));
|
|
|
+ pLabel->SetText((L"整单备注:" + CLewaimaiString::UTF8ToUnicode(sMemo)).c_str());
|
|
|
+
|
|
|
+ //保存备注,提交订单的时候用
|
|
|
+ m_cur_diandan_order.SetMemo(sMemo);
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pMemoDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pMemoDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickGengduoPay()
|
|
|
+{
|
|
|
+ if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
+ {
|
|
|
+ m_pMainWnd->ShowToast(L"请先选择商品再支付");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ShowJiesuanPage();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::JixuJiacai()
|
|
|
+{
|
|
|
+ //先显示商品页面
|
|
|
+ CVerticalLayoutUI* pFoodLayout = static_cast<CVerticalLayoutUI*>(this->FindSubControl(_T("diandan_food_layout")));
|
|
|
+ pFoodLayout->SetVisible(true);
|
|
|
+
|
|
|
+ //显示结算按钮
|
|
|
+ CHorizontalLayoutUI* pPayLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_pay_layout")));
|
|
|
+ pPayLayout->SetVisible(true);
|
|
|
+
|
|
|
+ //再隐藏结算页面
|
|
|
+ CHorizontalLayoutUI* pJiesuanLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_layout")));
|
|
|
+ pJiesuanLayout->SetVisible(false);
|
|
|
+
|
|
|
+ //隐藏继续加菜的按钮
|
|
|
+ CButtonUI* pJiacaiBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_jixujiacai")));
|
|
|
+ pJiacaiBtn->SetVisible(false);
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickChakanYouhui()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //弹框展示所有的优惠
|
|
|
+ CYouhuiShowWnd* pYouhuiDlg = new CYouhuiShowWnd();
|
|
|
+
|
|
|
+ if (pYouhuiDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pYouhuiDlg;
|
|
|
+
|
|
|
+ pYouhuiDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pYouhuiDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pYouhuiDlg->CenterWindow();
|
|
|
+
|
|
|
+ pYouhuiDlg->SetYouhuiValue(m_shangpinquan_youhui, m_cika_youhui, m_total_member_youhui, m_zhekou_youhui, m_member_zhekou_youhui, m_quanyika_youhui, m_manjian_youhui, m_youhuiquan_youhui, m_rengong_youhui, m_moling_youhui);
|
|
|
+
|
|
|
+ UINT ret = pYouhuiDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+
|
|
|
+ delete pYouhuiDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pYouhuiDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickMemberLogin()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CMemberLoginWnd* pMemberLoginDlg = new CMemberLoginWnd();
|
|
|
+
|
|
|
+ if (pMemberLoginDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pMemberLoginDlg;
|
|
|
+
|
|
|
+ pMemberLoginDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pMemberLoginDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pMemberLoginDlg->CenterWindow();
|
|
|
+
|
|
|
+ pMemberLoginDlg->SetTitle(L"会员登录");
|
|
|
+
|
|
|
+ UINT ret = pMemberLoginDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明会员登录成功了
|
|
|
+ m_is_member = true;
|
|
|
+ m_member_name = pMemberLoginDlg->m_member_name;
|
|
|
+ m_member_level = pMemberLoginDlg->m_member_level;
|
|
|
+ m_member_level_name = pMemberLoginDlg->m_member_level_name;
|
|
|
+
|
|
|
+ CButtonUI* pMemberLoginBtn = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_member_login")));
|
|
|
+ pMemberLoginBtn->SetVisible(false);
|
|
|
+
|
|
|
+ CLabelUI* pMemberInfo = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_page_member_info")));
|
|
|
+ std::wstring memberInfo = CLewaimaiString::UTF8ToUnicode(m_member_name) + L"【" + CLewaimaiString::UTF8ToUnicode(m_member_level_name) + L"】";
|
|
|
+ pMemberInfo->SetText(memberInfo.c_str());
|
|
|
+ pMemberInfo->SetVisible(true);
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pMemberLoginDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pMemberLoginDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickZhekou()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CZhekouWnd* pZhekouDlg = new CZhekouWnd();
|
|
|
+
|
|
|
+ if (pZhekouDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pZhekouDlg;
|
|
|
+
|
|
|
+ pZhekouDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pZhekouDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pZhekouDlg->CenterWindow();
|
|
|
+
|
|
|
+ pZhekouDlg->SetTitle(L"输入折扣值");
|
|
|
+
|
|
|
+ UINT ret = pZhekouDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明折扣输入了
|
|
|
+ std::string zhekou = pZhekouDlg->getContent();
|
|
|
+
|
|
|
+ CButtonUI* pZhekouEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
|
|
|
+ pZhekouEdit->SetText(CLewaimaiString::UTF8ToUnicode(zhekou).c_str());
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pZhekouDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pZhekouDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickJiajia()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CjiajiaWnd* pJiajiaDlg = new CjiajiaWnd();
|
|
|
+
|
|
|
+ if (pJiajiaDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pJiajiaDlg;
|
|
|
+
|
|
|
+ pJiajiaDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pJiajiaDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pJiajiaDlg->CenterWindow();
|
|
|
+
|
|
|
+ pJiajiaDlg->SetTitle(L"输入加价金额");
|
|
|
+
|
|
|
+ UINT ret = pJiajiaDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明折扣输入了
|
|
|
+ std::string jiajia = pJiajiaDlg->getContent();
|
|
|
+
|
|
|
+ CButtonUI* pJiajiaEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_jiajia_value")));
|
|
|
+ pJiajiaEdit->SetText(CLewaimaiString::UTF8ToUnicode(jiajia).c_str());
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pJiajiaDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pJiajiaDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickRengongyouhui()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CRengongYouhuiWnd* pYouhuiDlg = new CRengongYouhuiWnd();
|
|
|
+
|
|
|
+ if (pYouhuiDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pYouhuiDlg;
|
|
|
+
|
|
|
+ pYouhuiDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pYouhuiDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pYouhuiDlg->CenterWindow();
|
|
|
+
|
|
|
+ pYouhuiDlg->SetTitle(L"输入优惠金额");
|
|
|
+
|
|
|
+ UINT ret = pYouhuiDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明折扣输入了
|
|
|
+ std::string youhui = pYouhuiDlg->getContent();
|
|
|
+
|
|
|
+ CButtonUI* pYouhuiEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_youhui_value")));
|
|
|
+ pYouhuiEdit->SetText(CLewaimaiString::UTF8ToUnicode(youhui).c_str());
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pYouhuiDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pYouhuiDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickSaomaYouhuiquan()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSaomaYouhuiquanWnd* pSaomaYouhuiquanDlg = new CSaomaYouhuiquanWnd();
|
|
|
+
|
|
|
+ if (pSaomaYouhuiquanDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pSaomaYouhuiquanDlg;
|
|
|
+
|
|
|
+ pSaomaYouhuiquanDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pSaomaYouhuiquanDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pSaomaYouhuiquanDlg->CenterWindow();
|
|
|
+
|
|
|
+ pSaomaYouhuiquanDlg->SetTitle(L"扫码使用优惠券");
|
|
|
+
|
|
|
+ UINT ret = pSaomaYouhuiquanDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明优惠券核销成功了
|
|
|
+ m_is_youhuiquan = true;
|
|
|
+ m_youhuiquan_id = pSaomaYouhuiquanDlg->m_coupon_id;
|
|
|
+ m_coupon_basic_price = pSaomaYouhuiquanDlg->m_coupon_basic_price;
|
|
|
+ m_coupon_deadline = pSaomaYouhuiquanDlg->m_coupon_deadline;
|
|
|
+ m_coupon_value = pSaomaYouhuiquanDlg->m_coupon_value;
|
|
|
+
|
|
|
+ CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_status")));
|
|
|
+ pYouhuiEdit->SetText(L"已使用");
|
|
|
+
|
|
|
+ CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_btn_cancel")));
|
|
|
+ pYouhuiquanCancel->SetVisible(true);
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pSaomaYouhuiquanDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pSaomaYouhuiquanDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//点击扫码商品券
|
|
|
+void CZhengcanDiandanPageUI::ClickSaomaShangpinquan()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSaomaShangpinquanWnd* pSaomaShangpinquanDlg = new CSaomaShangpinquanWnd();
|
|
|
+
|
|
|
+ if (pSaomaShangpinquanDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pSaomaShangpinquanDlg;
|
|
|
+
|
|
|
+ pSaomaShangpinquanDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pSaomaShangpinquanDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pSaomaShangpinquanDlg->CenterWindow();
|
|
|
+
|
|
|
+ pSaomaShangpinquanDlg->SetTitle(L"扫码使用商品券");
|
|
|
+
|
|
|
+ UINT ret = pSaomaShangpinquanDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明商品券核销成功了
|
|
|
+ m_is_shangpinquan = true;
|
|
|
+
|
|
|
+ m_shangpinquan_lewaimai_customer_id = pSaomaShangpinquanDlg->m_lewaimai_customer_id;
|
|
|
+ m_shangpinquan_id = pSaomaShangpinquanDlg->m_goodscoupon_id;
|
|
|
+ m_shangpinquan_name = pSaomaShangpinquanDlg->m_goods_coupon_name;
|
|
|
+ m_shangpinquan_foodid = pSaomaShangpinquanDlg->m_bind_foods_id;
|
|
|
+
|
|
|
+ CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_status")));
|
|
|
+ pYouhuiEdit->SetText(L"已使用");
|
|
|
+
|
|
|
+ CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_btn_cancel")));
|
|
|
+ pShangpinquanCancel->SetVisible(true);
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pSaomaShangpinquanDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pSaomaShangpinquanDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//点击扫码权益卡
|
|
|
+void CZhengcanDiandanPageUI::ClickSaomaQuanyika()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSaomaQuanyikaWnd* pSaomaQuanyikaDlg = new CSaomaQuanyikaWnd();
|
|
|
+
|
|
|
+ if (pSaomaQuanyikaDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pSaomaQuanyikaDlg;
|
|
|
+
|
|
|
+ pSaomaQuanyikaDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pSaomaQuanyikaDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pSaomaQuanyikaDlg->CenterWindow();
|
|
|
+
|
|
|
+ pSaomaQuanyikaDlg->SetTitle(L"扫码使用权益卡");
|
|
|
+
|
|
|
+ UINT ret = pSaomaQuanyikaDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明权益卡核销成功了
|
|
|
+ m_is_quanyika = true;
|
|
|
+
|
|
|
+ m_quanyika_discount = pSaomaQuanyikaDlg->m_discount;
|
|
|
+
|
|
|
+ CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_status")));
|
|
|
+ pYouhuiEdit->SetText(L"已使用");
|
|
|
+
|
|
|
+ CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_btn_cancel")));
|
|
|
+ pQuanyikaCancel->SetVisible(true);
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pSaomaQuanyikaDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pSaomaQuanyikaDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//点击取消使用优惠券
|
|
|
+void CZhengcanDiandanPageUI::ClickQuxiaoYouhuiquan()
|
|
|
+{
|
|
|
+ m_is_youhuiquan = false;
|
|
|
+
|
|
|
+ CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_status")));
|
|
|
+ pYouhuiEdit->SetText(L"未使用");
|
|
|
+
|
|
|
+ CButtonUI* pYouhuiquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_youhuiquan_btn_cancel")));
|
|
|
+ pYouhuiquanCancel->SetVisible(false);
|
|
|
+}
|
|
|
+
|
|
|
+//点击取消商品券
|
|
|
+void CZhengcanDiandanPageUI::ClickQuxiaoShangpinquan()
|
|
|
+{
|
|
|
+ m_is_shangpinquan = false;
|
|
|
+
|
|
|
+ CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_status")));
|
|
|
+ pYouhuiEdit->SetText(L"未使用");
|
|
|
+
|
|
|
+ CButtonUI* pShangpinquanCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_shangpinquan_btn_cancel")));
|
|
|
+ pShangpinquanCancel->SetVisible(false);
|
|
|
+}
|
|
|
+
|
|
|
+//点击取消权益卡
|
|
|
+void CZhengcanDiandanPageUI::ClickQuxiaoQuanyika()
|
|
|
+{
|
|
|
+ m_is_quanyika = false;
|
|
|
+
|
|
|
+ CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_status")));
|
|
|
+ pYouhuiEdit->SetText(L"未使用");
|
|
|
+
|
|
|
+ CButtonUI* pQuanyikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_quanyika_btn_cancel")));
|
|
|
+ pQuanyikaCancel->SetVisible(false);
|
|
|
+}
|
|
|
+
|
|
|
+//点击取消次卡
|
|
|
+void CZhengcanDiandanPageUI::ClickQuxiaoCika()
|
|
|
+{
|
|
|
+ m_is_cika = false;
|
|
|
+
|
|
|
+ CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_status")));
|
|
|
+ pYouhuiEdit->SetText(L"未使用");
|
|
|
+
|
|
|
+ CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_btn_cancel")));
|
|
|
+ pCikaCancel->SetVisible(false);
|
|
|
+}
|
|
|
+
|
|
|
+//点击扫码次卡
|
|
|
+void CZhengcanDiandanPageUI::ClickSaomaCika()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSaomaCikaWnd* pSaomaCikaDlg = new CSaomaCikaWnd();
|
|
|
+
|
|
|
+ if (pSaomaCikaDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pSaomaCikaDlg;
|
|
|
+
|
|
|
+ pSaomaCikaDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pSaomaCikaDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pSaomaCikaDlg->CenterWindow();
|
|
|
+
|
|
|
+ pSaomaCikaDlg->SetTitle(L"扫码使用次卡");
|
|
|
+
|
|
|
+ UINT ret = pSaomaCikaDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明商品券核销成功了
|
|
|
+ m_is_cika = true;
|
|
|
+
|
|
|
+ m_cika_lewaimai_customer_id = pSaomaCikaDlg->m_cika_lewaimai_customer_id;
|
|
|
+ m_cika_id = pSaomaCikaDlg->m_timescoupon_id;
|
|
|
+ m_cika_deduct_type = pSaomaCikaDlg->m_deduct_type;
|
|
|
+ m_cika_discount = pSaomaCikaDlg->m_discount;
|
|
|
+ m_cika_discount_value = pSaomaCikaDlg->m_discount_value;
|
|
|
+ m_cika_full_reduce = pSaomaCikaDlg->m_full_reduce;
|
|
|
+ m_cika_full_reduce_value = pSaomaCikaDlg->m_full_reduce_value;
|
|
|
+ m_cika_offer = pSaomaCikaDlg->m_offer;
|
|
|
+ m_cika_offer_value = pSaomaCikaDlg->m_offer_value;
|
|
|
+ m_cika_bind_foods_id = pSaomaCikaDlg->m_bind_foods_id;
|
|
|
+
|
|
|
+ CLabelUI* pYouhuiEdit = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_status")));
|
|
|
+ pYouhuiEdit->SetText(L"已使用");
|
|
|
+
|
|
|
+ CButtonUI* pCikaCancel = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_jiesuan_cika_btn_cancel")));
|
|
|
+ pCikaCancel->SetVisible(true);
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pSaomaCikaDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pSaomaCikaDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::ClickCanpai()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CCanpaiWnd* pCanpaiDlg = new CCanpaiWnd();
|
|
|
+
|
|
|
+ if (pCanpaiDlg != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pCanpaiDlg;
|
|
|
+
|
|
|
+ pCanpaiDlg->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
+ pCanpaiDlg->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pCanpaiDlg->CenterWindow();
|
|
|
+
|
|
|
+ pCanpaiDlg->SetTitle(L"输入餐牌号");
|
|
|
+
|
|
|
+ UINT ret = pCanpaiDlg->ShowModal();
|
|
|
+
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //这说明折扣输入了
|
|
|
+ std::string canpai = pCanpaiDlg->getContent();
|
|
|
+
|
|
|
+ m_canpai = canpai;
|
|
|
+
|
|
|
+ CButtonUI* pCanpaiEdit = static_cast<CButtonUI*>(this->FindSubControl(_T("btn_diandan_canpaihao")));
|
|
|
+ pCanpaiEdit->SetText((L"餐牌号 " + CLewaimaiString::UTF8ToUnicode(canpai)).c_str());
|
|
|
+
|
|
|
+ this->UpdateJiesuanInfo();
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pCanpaiDlg;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pCanpaiDlg;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//获取通用参数,任何支付方式都要用到的参数,个性化参数在弹框里面处理
|
|
|
+//参考文档 http://apidoc.zhipuzi.com/index.php/home/item/show?item_id=4
|
|
|
+std::map<string, string> CZhengcanDiandanPageUI::GetSendorderParams()
|
|
|
+{
|
|
|
+ std::map<string, string> params;
|
|
|
+
|
|
|
+ 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["person_num"] = "1";
|
|
|
+ params["table_name"] = m_canpai;
|
|
|
+ params["note"] = m_cur_diandan_order.GetMemo();
|
|
|
+ params["dabao_price"] = CLewaimaiString::DoubleToString(m_dabao, 2);
|
|
|
+ params["food_price"] = CLewaimaiString::DoubleToString(m_cur_diandan_order.getTotalPrice(), 2);
|
|
|
+ params["total_price"] = CLewaimaiString::DoubleToString(m_cur_diandan_order.getTotalPrice() + m_dabao, 2);
|
|
|
+
|
|
|
+ CEditUI* pZhekouEdit = static_cast<CEditUI*>(this->FindSubControl(_T("diandan_jiesuan_zhekou_value")));
|
|
|
+ wstring ws_zhekou = pZhekouEdit->GetText();
|
|
|
+ params["discount"] = CLewaimaiString::UnicodeToUTF8(ws_zhekou);
|
|
|
+
|
|
|
+ params["coupon"] = CLewaimaiString::DoubleToString(m_rengong_youhui, 2);
|
|
|
+ params["price_plus"] = CLewaimaiString::DoubleToString(m_jiajia, 2);
|
|
|
+ params["price_moling"] = CLewaimaiString::DoubleToString(m_moling_youhui, 2);
|
|
|
+ params["yingshou_value"] = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
|
|
|
+ params["shishou_value"] = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
|
|
|
+ params["zhaoling_value"] = "0";
|
|
|
+
|
|
|
+ params["zhifu_type"] = "";
|
|
|
+
|
|
|
+ if (m_is_youhuiquan)
|
|
|
+ {
|
|
|
+ params["coupon_id"] = m_youhuiquan_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_is_cika)
|
|
|
+ {
|
|
|
+ params["timescoupon_id"] = m_cika_id;
|
|
|
+ params["lewaimai_customer_id"] = m_cika_lewaimai_customer_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_is_shangpinquan)
|
|
|
+ {
|
|
|
+ params["goodscoupon_id"] = m_shangpinquan_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_is_quanyika)
|
|
|
+ {
|
|
|
+ params["is_eq_card_discount"] = "1";
|
|
|
+ params["eq_card_discount_value"] = m_quanyika_discount;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ params["is_eq_card_discount"] = "0";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_is_member)
|
|
|
+ {
|
|
|
+ params["member_level"] = m_member_level;
|
|
|
+
|
|
|
+ if (m_is_member_zhekou)
|
|
|
+ {
|
|
|
+ params["member_level_value"] = m_member_zhekou_value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ params["member_level_value"] = 10;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_is_cika == true)
|
|
|
+ {
|
|
|
+ params["time_coupon_type"] = m_cika_deduct_type;
|
|
|
+ params["time_coupon_discount_value"] = m_cika_discount_value;
|
|
|
+ params["time_coupon_full_reduce_value"] = m_cika_full_reduce_value;
|
|
|
+ params["time_coupon_offer_value"] = m_cika_offer_value;
|
|
|
+ params["time_coupon_band_food_value"] = CLewaimaiString::DoubleToString(m_cika_youhui, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_is_shangpinquan)
|
|
|
+ {
|
|
|
+ params["goods_coupon_band_food_value"] = CLewaimaiString::DoubleToString(m_shangpinquan_youhui, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_manjian_youhui > 0)
|
|
|
+ {
|
|
|
+ params["promotion_value"] = CLewaimaiString::DoubleToString(m_manjian_youhui, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_youhuiquan_youhui > 0)
|
|
|
+ {
|
|
|
+ params["coupon_value"] = CLewaimaiString::DoubleToString(m_youhuiquan_youhui, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_member_zhekou_youhui > 0)
|
|
|
+ {
|
|
|
+ params["member_discount_money"] = CLewaimaiString::DoubleToString(m_member_zhekou_youhui, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_zhekou_youhui > 0)
|
|
|
+ {
|
|
|
+ params["shop_discount_money"] = CLewaimaiString::DoubleToString(m_zhekou_youhui, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_cika_youhui > 0)
|
|
|
+ {
|
|
|
+ params["timescoupon_discount_money"] = CLewaimaiString::DoubleToString(m_cika_youhui, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_quanyika_youhui > 0)
|
|
|
+ {
|
|
|
+ params["eq_card_discount_money"] = CLewaimaiString::DoubleToString(m_quanyika_youhui, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ params["total_delete_money"] = CLewaimaiString::DoubleToString(m_total_youhui, 2);
|
|
|
+
|
|
|
+ return params;
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::StartWeixinzhifuShoukuan(std::string fukuanma)
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
+ {
|
|
|
+ m_pMainWnd->ShowToast(L"请先选择商品再支付");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CWeixinzhifuShoukuanWnd* pShoukuanWnd = new CWeixinzhifuShoukuanWnd;
|
|
|
+ if (pShoukuanWnd != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pShoukuanWnd;
|
|
|
+
|
|
|
+ pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
|
|
|
+ pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pShoukuanWnd->CenterWindow();
|
|
|
+
|
|
|
+ std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
|
|
|
+ std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
|
|
|
+ pShoukuanWnd->InitMoney(watchValue);
|
|
|
+
|
|
|
+ //这里要对提交订单的参数进行组装,然后方便请求
|
|
|
+ pShoukuanWnd->SetCommonParams(GetSendorderParams());
|
|
|
+
|
|
|
+ if (fukuanma != "")
|
|
|
+ {
|
|
|
+ pShoukuanWnd->InitFukuanma(fukuanma);
|
|
|
+ }
|
|
|
+
|
|
|
+ UINT ret = pShoukuanWnd->ShowModal();
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ int fukuanma_type = pShoukuanWnd->m_fukuanma_type;
|
|
|
+
|
|
|
+ std::string zhifu_type;
|
|
|
+ if (fukuanma_type == 1)
|
|
|
+ {
|
|
|
+ zhifu_type = "weixinzhifu";
|
|
|
+ }
|
|
|
+ else if (fukuanma_type == 2)
|
|
|
+ {
|
|
|
+ zhifu_type = "zhifubao";
|
|
|
+ }
|
|
|
+ else if (fukuanma_type == 3)
|
|
|
+ {
|
|
|
+ zhifu_type = "yunshanfu";
|
|
|
+ }
|
|
|
+
|
|
|
+ //说明收款成功了,需要进行一些后续的处理
|
|
|
+ this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, zhifu_type);
|
|
|
+
|
|
|
+ m_pMainWnd->ShowToast(L"收款成功!");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int a = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pShoukuanWnd;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::StartHuiyuanShoukuan()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
+ {
|
|
|
+ m_pMainWnd->ShowToast(L"请先选择商品再支付");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CHuiyuanShoukuanWnd* pShoukuanWnd = new CHuiyuanShoukuanWnd();
|
|
|
+ if (pShoukuanWnd != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pShoukuanWnd;
|
|
|
+
|
|
|
+ pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
|
|
|
+ pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pShoukuanWnd->CenterWindow();
|
|
|
+
|
|
|
+ std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
|
|
|
+ std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
|
|
|
+ pShoukuanWnd->InitMoney(watchValue);
|
|
|
+
|
|
|
+ //这里要对提交订单的参数进行组装,然后方便请求
|
|
|
+ pShoukuanWnd->SetCommonParams(GetSendorderParams());
|
|
|
+
|
|
|
+ /*
|
|
|
+ if (m_is_start_catch && m_catch_string.length() == 18)
|
|
|
+ {
|
|
|
+ pShoukuanWnd->InitFukuanma(m_catch_string);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ UINT ret = pShoukuanWnd->ShowModal();
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ std::string balance = pShoukuanWnd->m_balance;
|
|
|
+ std::string member_number = pShoukuanWnd->m_member_number;
|
|
|
+
|
|
|
+ //说明收款成功了,需要进行一些后续的处理
|
|
|
+ this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, "huiyuanzhifu", balance, member_number);
|
|
|
+
|
|
|
+ m_pMainWnd->ShowToast(L"收款成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pShoukuanWnd;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//开始进行现金收款
|
|
|
+void CZhengcanDiandanPageUI::StartXianjinShoukuan()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
+ {
|
|
|
+ m_pMainWnd->ShowToast(L"请先选择商品再支付");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CXianjinShoukuanWnd* pShoukuanWnd = new CXianjinShoukuanWnd();
|
|
|
+ if (pShoukuanWnd != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pShoukuanWnd;
|
|
|
+
|
|
|
+ pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
|
|
|
+ pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pShoukuanWnd->CenterWindow();
|
|
|
+
|
|
|
+ std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
|
|
|
+ std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
|
|
|
+ pShoukuanWnd->InitMoney(watchValue);
|
|
|
+
|
|
|
+ //这里要对提交订单的参数进行组装,然后方便请求
|
|
|
+ pShoukuanWnd->SetCommonParams(GetSendorderParams());
|
|
|
+
|
|
|
+ /*
|
|
|
+ if (m_is_start_catch && m_catch_string.length() == 18)
|
|
|
+ {
|
|
|
+ pShoukuanWnd->InitFukuanma(m_catch_string);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ UINT ret = pShoukuanWnd->ShowModal();
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ m_shishou_value = pShoukuanWnd->m_shishou;
|
|
|
+ m_zhaoling_value = pShoukuanWnd->m_zhaoling;
|
|
|
+
|
|
|
+ //说明收款成功了,需要进行一些后续的处理
|
|
|
+ this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, "xianjinzhifu");
|
|
|
+
|
|
|
+ m_pMainWnd->ShowToast(L"收款成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pShoukuanWnd;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::StartFulikaShoukuan()
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
+ {
|
|
|
+ m_pMainWnd->ShowToast(L"请先选择商品再支付");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CFulikaShoukuanWnd* pShoukuanWnd = new CFulikaShoukuanWnd();
|
|
|
+ if (pShoukuanWnd != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pShoukuanWnd;
|
|
|
+
|
|
|
+ pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
|
|
|
+ pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pShoukuanWnd->CenterWindow();
|
|
|
+
|
|
|
+ std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
|
|
|
+ std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
|
|
|
+ pShoukuanWnd->InitMoney(watchValue);
|
|
|
+
|
|
|
+ //这里要对提交订单的参数进行组装,然后方便请求
|
|
|
+ pShoukuanWnd->SetCommonParams(GetSendorderParams());
|
|
|
+
|
|
|
+ /*
|
|
|
+ if (m_is_start_catch && m_catch_string.length() == 18)
|
|
|
+ {
|
|
|
+ pShoukuanWnd->InitFukuanma(m_catch_string);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ UINT ret = pShoukuanWnd->ShowModal();
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //说明收款成功了,需要进行一些后续的处理
|
|
|
+ this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, "fulikazhifu");
|
|
|
+
|
|
|
+ m_pMainWnd->ShowToast(L"收款成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pShoukuanWnd;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::StartZidingyiShoukuan(std::wstring name, std::wstring selfpay_id)
|
|
|
+{
|
|
|
+ if (m_is_show_modal_wnd == true)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_cur_diandan_order.getItemNum() == 0)
|
|
|
+ {
|
|
|
+ m_pMainWnd->ShowToast(L"请先选择商品再支付");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CZidingyiShoukuanWnd* pShoukuanWnd = new CZidingyiShoukuanWnd();
|
|
|
+ if (pShoukuanWnd != NULL)
|
|
|
+ {
|
|
|
+ m_is_show_modal_wnd = true;
|
|
|
+ m_curModalWnd = pShoukuanWnd;
|
|
|
+
|
|
|
+ pShoukuanWnd->Create(m_pManager->GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
|
|
|
+ pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
|
|
|
+ pShoukuanWnd->CenterWindow();
|
|
|
+
|
|
|
+ std::string format_string = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
|
|
|
+ std::wstring watchValue = CLewaimaiString::UTF8ToUnicode(format_string);
|
|
|
+ pShoukuanWnd->InitMoney(watchValue);
|
|
|
+
|
|
|
+ //这里要对提交订单的参数进行组装,然后方便请求
|
|
|
+ pShoukuanWnd->SetCommonParams(GetSendorderParams());
|
|
|
+
|
|
|
+ /*
|
|
|
+ if (m_is_start_catch && m_catch_string.length() == 18)
|
|
|
+ {
|
|
|
+ pShoukuanWnd->InitFukuanma(m_catch_string);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ pShoukuanWnd->SetZidingyiName(name);
|
|
|
+ pShoukuanWnd->SetZidingyiId(selfpay_id);
|
|
|
+
|
|
|
+ UINT ret = pShoukuanWnd->ShowModal();
|
|
|
+ if (ret == IDOK)
|
|
|
+ {
|
|
|
+ //说明收款成功了,需要进行一些后续的处理
|
|
|
+ this->StartWorkAfterShoukuan(pShoukuanWnd->m_kucun_string, pShoukuanWnd->m_take_food_code, pShoukuanWnd->m_show_trade_no, "zidingyizhifu");
|
|
|
+
|
|
|
+ m_pMainWnd->ShowToast(L"收款成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ m_is_show_modal_wnd = false;
|
|
|
+ delete pShoukuanWnd;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::UpdateFoodStock(std::string food_stock)
|
|
|
+{
|
|
|
+ rapidjson::Document doc;
|
|
|
+ rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //获取分配器
|
|
|
+
|
|
|
+ Value& data = CLewaimaiJson::StringToJson(food_stock, allocator);
|
|
|
+
|
|
|
+ for (rapidjson::SizeType i = 0; i < data.Size(); ++i)
|
|
|
+ {
|
|
|
+ std::string food_id = data[i]["food_id"].GetString();
|
|
|
+ std::string stock = data[i]["stock"].GetString();
|
|
|
+
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ sqlite.UpdateFoodStock(food_id, stock);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//扫描了商品条码的逻辑处理
|
|
|
+bool CZhengcanDiandanPageUI::SaomiaoBarcode(std::string barcode)
|
|
|
+{
|
|
|
+ CSqlite3 sqlite;
|
|
|
+
|
|
|
+ CFood foodinfo;
|
|
|
+ bool ret = sqlite.GetFoodByBarcode(barcode, foodinfo);
|
|
|
+
|
|
|
+ if (ret == false)
|
|
|
+ {
|
|
|
+ //说明没找到对应的商品条码
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //这里说明找到了,那么处理添加购物车逻辑,扫码的情况下,这里不管有没有属性,都按没属性处理,不管有没有称重都按没称重处理(以后标签秤可能会修改)
|
|
|
+
|
|
|
+ if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < 1)
|
|
|
+ {
|
|
|
+ //库存为0了,不做任何处理
|
|
|
+ m_pMainWnd->ShowToast(L"该商品已售完");
|
|
|
+
|
|
|
+ //只要找到了就返回true
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ CZhengcanOrderItem clickItem;
|
|
|
+
|
|
|
+ clickItem.food_id = foodinfo.id;
|
|
|
+ clickItem.food_name = foodinfo.name;
|
|
|
+ clickItem.type_id = foodinfo.type_id;
|
|
|
+ clickItem.price = foodinfo.price;
|
|
|
+ clickItem.is_dabao = false;
|
|
|
+ clickItem.dabao_money = foodinfo.dabao_money;
|
|
|
+ clickItem.num = "1";
|
|
|
+
|
|
|
+ if (foodinfo.member_price_used == "1")
|
|
|
+ {
|
|
|
+ clickItem.is_member_price_used = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clickItem.is_member_price_used = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理会员价的json
|
|
|
+ std::string member_price_json = foodinfo.member_price_json;
|
|
|
+
|
|
|
+ rapidjson::Document document;
|
|
|
+ document.Parse(member_price_json.c_str());
|
|
|
+
|
|
|
+ rapidjson::Value& member_price = document;
|
|
|
+ for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
|
|
|
+ {
|
|
|
+ rapidjson::Value& member_price_info = member_price[i];
|
|
|
+
|
|
|
+ MemberPrice newPirce;
|
|
|
+ newPirce.id = CLewaimaiJson::ToString(member_price_info["id"]);
|
|
|
+ newPirce.level = CLewaimaiJson::ToString(member_price_info["level"]);
|
|
|
+ newPirce.price = CLewaimaiJson::ToString(member_price_info["price"]);
|
|
|
+
|
|
|
+ clickItem.m_member_price.push_back(newPirce);
|
|
|
+ }
|
|
|
+
|
|
|
+ //把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
|
|
|
+ clickItem.SetFoodInfo(foodinfo);
|
|
|
+ clickItem.SetIsTaocan(false);
|
|
|
+
|
|
|
+ clickItem.is_weight = false;
|
|
|
+ clickItem.is_nature = false;
|
|
|
+
|
|
|
+ //商品没有商品属性
|
|
|
+ bool is_add_new = false;
|
|
|
+
|
|
|
+ int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
|
|
|
+
|
|
|
+ if (is_add_new)
|
|
|
+ {
|
|
|
+ //说明是新增了一项,要刷新一下购物车展示
|
|
|
+ this->AddDiandanOrderItemShow(index);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //没有新增,而是修改了一项
|
|
|
+ this->UpdateDiandanOrderItemShow(index);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+bool CZhengcanDiandanPageUI::BiaoqianchengSaomaBarcode(std::string barcode)
|
|
|
+{
|
|
|
+ //先根据设置,分辨条码格式
|
|
|
+ std::string bianma;
|
|
|
+ std::string money;
|
|
|
+ std::string weight;
|
|
|
+ std::string jiaoyan;
|
|
|
+
|
|
|
+ std::string setting_tiaomacheng_geshi = CSetting::GetInstance()->GetParam("setting_tiaomacheng_geshi");
|
|
|
+ if (setting_tiaomacheng_geshi == "1")
|
|
|
+ {
|
|
|
+ if (barcode.length() != 12 && barcode.length() != 13)
|
|
|
+ {
|
|
|
+ //与该模式长度不匹配
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (barcode.length() == 12)
|
|
|
+ {
|
|
|
+ barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
|
|
|
+ }
|
|
|
+
|
|
|
+ //13位【FWWWWWWEEEEEC】
|
|
|
+ bianma = barcode.substr(1, 6);
|
|
|
+ money = barcode.substr(7, 5);
|
|
|
+ jiaoyan = barcode.substr(12, 1);
|
|
|
+ }
|
|
|
+ else if (setting_tiaomacheng_geshi == "2")
|
|
|
+ {
|
|
|
+ if (barcode.length() != 12 && barcode.length() != 13)
|
|
|
+ {
|
|
|
+ //与该模式长度不匹配
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (barcode.length() == 12)
|
|
|
+ {
|
|
|
+ barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
|
|
|
+ }
|
|
|
+
|
|
|
+ //13位【FWWWWWWNNNNNC】
|
|
|
+ bianma = barcode.substr(1, 6);
|
|
|
+ weight = barcode.substr(7, 5);
|
|
|
+ jiaoyan = barcode.substr(12, 1);
|
|
|
+ }
|
|
|
+ else if (setting_tiaomacheng_geshi == "3")
|
|
|
+ {
|
|
|
+ if (barcode.length() != 12 && barcode.length() != 13)
|
|
|
+ {
|
|
|
+ //与该模式长度不匹配
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (barcode.length() == 12)
|
|
|
+ {
|
|
|
+ barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
|
|
|
+ }
|
|
|
+
|
|
|
+ //13位【FFWWWWWEEEEEC】
|
|
|
+ bianma = barcode.substr(2, 5);
|
|
|
+ money = barcode.substr(7, 5);
|
|
|
+ jiaoyan = barcode.substr(12, 1);
|
|
|
+ }
|
|
|
+ else if (setting_tiaomacheng_geshi == "4")
|
|
|
+ {
|
|
|
+ if (barcode.length() != 12 && barcode.length() != 13)
|
|
|
+ {
|
|
|
+ //与该模式长度不匹配
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (barcode.length() == 12)
|
|
|
+ {
|
|
|
+ barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
|
|
|
+ }
|
|
|
+
|
|
|
+ //13位【FFWWWWWNNNNNC】
|
|
|
+ bianma = barcode.substr(2, 5);
|
|
|
+ weight = barcode.substr(7, 5);
|
|
|
+ jiaoyan = barcode.substr(12, 1);
|
|
|
+ }
|
|
|
+ else if (setting_tiaomacheng_geshi == "5")
|
|
|
+ {
|
|
|
+ if (barcode.length() != 17 && barcode.length() != 18)
|
|
|
+ {
|
|
|
+ //与该模式长度不匹配
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (barcode.length() == 17)
|
|
|
+ {
|
|
|
+ barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
|
|
|
+ }
|
|
|
+
|
|
|
+ //18位【FWWWWWWEEEEENNNNNC】
|
|
|
+ bianma = barcode.substr(1, 6);
|
|
|
+ money = barcode.substr(7, 5);
|
|
|
+ weight = barcode.substr(12, 5);
|
|
|
+ jiaoyan = barcode.substr(17, 1);
|
|
|
+ }
|
|
|
+ else if (setting_tiaomacheng_geshi == "6")
|
|
|
+ {
|
|
|
+ if (barcode.length() != 17 && barcode.length() != 18)
|
|
|
+ {
|
|
|
+ //与该模式长度不匹配
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (barcode.length() == 17)
|
|
|
+ {
|
|
|
+ barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
|
|
|
+ }
|
|
|
+
|
|
|
+ //18位【FWWWWWWNNNNNEEEEEC】
|
|
|
+ bianma = barcode.substr(1, 6);
|
|
|
+ weight = barcode.substr(7, 5);
|
|
|
+ money = barcode.substr(12, 5);
|
|
|
+ jiaoyan = barcode.substr(17, 1);
|
|
|
+ }
|
|
|
+ else if (setting_tiaomacheng_geshi == "7")
|
|
|
+ {
|
|
|
+ if (barcode.length() != 17 && barcode.length() != 18)
|
|
|
+ {
|
|
|
+ //与该模式长度不匹配
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (barcode.length() == 17)
|
|
|
+ {
|
|
|
+ barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
|
|
|
+ }
|
|
|
+
|
|
|
+ //18位【FFWWWWWEEEEENNNNNC】
|
|
|
+ bianma = barcode.substr(2, 5);
|
|
|
+ money = barcode.substr(7, 5);
|
|
|
+ weight = barcode.substr(12, 5);
|
|
|
+ jiaoyan = barcode.substr(17, 1);
|
|
|
+ }
|
|
|
+ else if (setting_tiaomacheng_geshi == "8")
|
|
|
+ {
|
|
|
+ if (barcode.length() != 17 && barcode.length() != 18)
|
|
|
+ {
|
|
|
+ //与该模式长度不匹配
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (barcode.length() == 17)
|
|
|
+ {
|
|
|
+ barcode = CLewaimaiString::BuZifuLeft(barcode, 1, '0');
|
|
|
+ }
|
|
|
+
|
|
|
+ //18位【FFWWWWWNNNNNEEEEEC】
|
|
|
+ bianma = barcode.substr(2, 5);
|
|
|
+ weight = barcode.substr(7, 5);
|
|
|
+ money = barcode.substr(12, 5);
|
|
|
+ jiaoyan = barcode.substr(17, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ //先检查编码是否存在,如果编码不存在直接返回false
|
|
|
+ int i_bianma = atoi(bianma.c_str());
|
|
|
+ if (i_bianma < 1)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ CFood foodinfo;
|
|
|
+
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ bool ret = sqlite.GetFoodByPluBianma(to_string(i_bianma), foodinfo);
|
|
|
+ if (ret == false)
|
|
|
+ {
|
|
|
+ //没找到这个商品
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //走到这里是找到商品了,那么就开始计算价格和重量
|
|
|
+ double d_money = 0;
|
|
|
+ double d_weight = 0;
|
|
|
+
|
|
|
+ //如果有价格,优先用价格
|
|
|
+ if (money.length() > 0)
|
|
|
+ {
|
|
|
+ //这个出来的单位是分,要把单位转成员
|
|
|
+ d_money = atof(money.c_str());
|
|
|
+
|
|
|
+ d_money = d_money / 100;
|
|
|
+
|
|
|
+ //根据价格计算重量
|
|
|
+ d_weight = d_money / atof(foodinfo.price.c_str());
|
|
|
+ }
|
|
|
+ else if (weight.length() > 0)
|
|
|
+ {
|
|
|
+ //这个单位是克,要转化成千克
|
|
|
+ d_weight = atof(weight.c_str());
|
|
|
+
|
|
|
+ d_weight = d_weight / 1000;
|
|
|
+
|
|
|
+ //有重量了,其实不需要计算价格,价格加到购物车的时候会自己计算
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //价格和重量都没有,这是异常情况
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (foodinfo.stockvalid == "1" && atof(foodinfo.stock.c_str()) < d_weight)
|
|
|
+ {
|
|
|
+ //库存为0了,不做任何处理
|
|
|
+ m_pMainWnd->ShowToast(L"该商品已售完");
|
|
|
+
|
|
|
+ //只要找到了就返回true
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ CZhengcanOrderItem clickItem;
|
|
|
+
|
|
|
+ clickItem.food_id = foodinfo.id;
|
|
|
+ clickItem.food_name = foodinfo.name;
|
|
|
+ clickItem.type_id = foodinfo.type_id;
|
|
|
+ clickItem.price = foodinfo.price;
|
|
|
+ clickItem.is_dabao = false;
|
|
|
+ clickItem.dabao_money = foodinfo.dabao_money;
|
|
|
+ clickItem.num = CLewaimaiString::DoubleToString(d_weight, 3); //重量保留3位小数
|
|
|
+
|
|
|
+ if (foodinfo.member_price_used == "1")
|
|
|
+ {
|
|
|
+ clickItem.is_member_price_used = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ clickItem.is_member_price_used = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理会员价的json
|
|
|
+ std::string member_price_json = foodinfo.member_price_json;
|
|
|
+
|
|
|
+ rapidjson::Document document;
|
|
|
+ document.Parse(member_price_json.c_str());
|
|
|
+
|
|
|
+ rapidjson::Value& member_price = document;
|
|
|
+ for (rapidjson::SizeType i = 0; i < member_price.Size(); ++i)
|
|
|
+ {
|
|
|
+ rapidjson::Value& member_price_info = member_price[i];
|
|
|
+
|
|
|
+ MemberPrice newPirce;
|
|
|
+ newPirce.id = member_price_info["id"].GetString();
|
|
|
+ newPirce.level = member_price_info["level"].GetString();
|
|
|
+ newPirce.price = member_price_info["price"].GetString();
|
|
|
+
|
|
|
+ clickItem.m_member_price.push_back(newPirce);
|
|
|
+ }
|
|
|
+
|
|
|
+ //把当前点击商品的信息,保存到orderitem里面,方便后面修改规格的时候使用
|
|
|
+ clickItem.SetFoodInfo(foodinfo);
|
|
|
+ clickItem.SetIsTaocan(false);
|
|
|
+
|
|
|
+ clickItem.is_weight = true;
|
|
|
+ clickItem.is_nature = false;
|
|
|
+
|
|
|
+ //商品没有商品属性
|
|
|
+ bool is_add_new = false;
|
|
|
+
|
|
|
+ int index = m_cur_diandan_order.AddItem(clickItem, is_add_new);
|
|
|
+
|
|
|
+ if (is_add_new)
|
|
|
+ {
|
|
|
+ //说明是新增了一项,要刷新一下购物车展示
|
|
|
+ this->AddDiandanOrderItemShow(index);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //没有新增,而是修改了一项
|
|
|
+ this->UpdateDiandanOrderItemShow(index);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+//开始搜索某个商品名字
|
|
|
+void CZhengcanDiandanPageUI::StartSearchFood(std::string foodname)
|
|
|
+{
|
|
|
+ //展示删除按钮
|
|
|
+ CButtonUI* pClear = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_food_search_clear")));
|
|
|
+ pClear->SetVisible(true);
|
|
|
+
|
|
|
+ //隐藏商品分类展示
|
|
|
+ CHorizontalLayoutUI* pFoodtype = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
|
|
|
+ pFoodtype->SetVisible(false);
|
|
|
+
|
|
|
+ if (m_cur_type_id != "sousuo")
|
|
|
+ {
|
|
|
+ m_type_id_before_sousuo = m_cur_type_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_type_id = "sousuo";
|
|
|
+
|
|
|
+ m_sousuo_foodname = foodname;
|
|
|
+
|
|
|
+ CLabelUI* pTishi = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_food_search_tishi")));
|
|
|
+ pTishi->SetVisible(false);
|
|
|
+
|
|
|
+ this->InitFoodShow();
|
|
|
+}
|
|
|
+
|
|
|
+//停止搜索商品
|
|
|
+void CZhengcanDiandanPageUI::StopSerachFood()
|
|
|
+{
|
|
|
+ //隐藏删除按钮
|
|
|
+ CButtonUI* pClear = static_cast<CButtonUI*>(this->FindSubControl(_T("diandan_food_search_clear")));
|
|
|
+ pClear->SetVisible(false);
|
|
|
+
|
|
|
+ //展示商品分类展示
|
|
|
+ CHorizontalLayoutUI* pFoodtype = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_fenlei_layout")));
|
|
|
+ pFoodtype->SetVisible(true);
|
|
|
+
|
|
|
+ m_cur_type_id = m_type_id_before_sousuo;
|
|
|
+
|
|
|
+ CLabelUI* pTishi = static_cast<CLabelUI*>(this->FindSubControl(_T("diandan_food_search_tishi")));
|
|
|
+ pTishi->SetVisible(true);
|
|
|
+
|
|
|
+ this->InitFoodShow();
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::StartWorkAfterShoukuan(std::string kucunstring, std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance, std::string member_number)
|
|
|
+{
|
|
|
+ //针对现金收款成功,单独做一个打开钱箱的判断处理
|
|
|
+ if (shoukuan_type == "xianjinzhifu")
|
|
|
+ {
|
|
|
+ std::string setting_is_diannei_xianjin_qianxiang = CSetting::GetInstance()->GetParam("setting_is_diannei_xianjin_qianxiang");
|
|
|
+ if (setting_is_diannei_xianjin_qianxiang == "1")
|
|
|
+ {
|
|
|
+ //打开钱箱
|
|
|
+ CPosPrinter printer;
|
|
|
+ printer.OpenQianxiang();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新商品库存
|
|
|
+ this->UpdateFoodStock(kucunstring);
|
|
|
+
|
|
|
+ //处理打印
|
|
|
+ CZhengcanOrder order = this->GetPrintOrderinfo(take_food_code, show_trade_no, shoukuan_type, balance, member_number);
|
|
|
+
|
|
|
+ CPosPrinter printer;
|
|
|
+ printer.PrintZhengcanOrder(order);
|
|
|
+
|
|
|
+ //最后才初始化页面信息
|
|
|
+ RefreshShow();
|
|
|
+}
|
|
|
+
|
|
|
+CZhengcanOrder CZhengcanDiandanPageUI::GetPrintOrderinfo(std::string take_food_code, std::string show_trade_no, std::string shoukuan_type, std::string balance, std::string member_number)
|
|
|
+{
|
|
|
+ m_cur_diandan_order.shopname = CShopinfo::GetInstance()->m_shop_name;
|
|
|
+ m_cur_diandan_order.take_food_code = take_food_code;
|
|
|
+ m_cur_diandan_order.show_trade_no = show_trade_no;
|
|
|
+ m_cur_diandan_order.balance = balance;
|
|
|
+ m_cur_diandan_order.member_number = member_number;
|
|
|
+
|
|
|
+ if (shoukuan_type == "weixinzhifu")
|
|
|
+ {
|
|
|
+ m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"微信支付");
|
|
|
+ }
|
|
|
+ else if (shoukuan_type == "zhifubao")
|
|
|
+ {
|
|
|
+ m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"支付宝");
|
|
|
+ }
|
|
|
+ else if (shoukuan_type == "yunshanfu")
|
|
|
+ {
|
|
|
+ m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"云闪付");
|
|
|
+ }
|
|
|
+ else if (shoukuan_type == "huiyuanzhifu")
|
|
|
+ {
|
|
|
+ m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"会员支付");
|
|
|
+ }
|
|
|
+ else if (shoukuan_type == "xianjinzhifu")
|
|
|
+ {
|
|
|
+ m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"现金支付");
|
|
|
+ }
|
|
|
+ else if (shoukuan_type == "fulikazhifu")
|
|
|
+ {
|
|
|
+ m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"福利卡支付");
|
|
|
+ }
|
|
|
+ else if (shoukuan_type == "zidingyizhifu")
|
|
|
+ {
|
|
|
+ m_cur_diandan_order.shoukuan_type = CLewaimaiString::UnicodeToUTF8(L"自定义支付");
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_diandan_order.order_from = 1;
|
|
|
+ m_cur_diandan_order.init_time = CLewaimaiTime::DatetimeToString(time(NULL));
|
|
|
+
|
|
|
+ m_cur_diandan_order.m_shangpinquan_youhui = CLewaimaiString::DoubleToString(m_shangpinquan_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_cika_youhui = CLewaimaiString::DoubleToString(m_cika_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_total_member_youhui = CLewaimaiString::DoubleToString(m_total_member_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_zhekou_youhui = CLewaimaiString::DoubleToString(m_zhekou_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_member_zhekou_youhui = CLewaimaiString::DoubleToString(m_member_zhekou_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_quanyika_youhui = CLewaimaiString::DoubleToString(m_quanyika_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_manjian_youhui = CLewaimaiString::DoubleToString(m_manjian_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_youhuiquan_youhui = CLewaimaiString::DoubleToString(m_youhuiquan_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_rengong_youhui = CLewaimaiString::DoubleToString(m_rengong_youhui, 2);
|
|
|
+ m_cur_diandan_order.m_moling_youhui = CLewaimaiString::DoubleToString(m_moling_youhui, 2);
|
|
|
+
|
|
|
+ m_cur_diandan_order.m_jiajia = CLewaimaiString::DoubleToString(m_jiajia, 2);
|
|
|
+
|
|
|
+ m_cur_diandan_order.m_shishou_value = m_shishou_value;
|
|
|
+ m_cur_diandan_order.m_zhaoling_value = m_zhaoling_value;
|
|
|
+
|
|
|
+ m_cur_diandan_order.m_zhekou_value = m_zhekou_value;
|
|
|
+
|
|
|
+ m_cur_diandan_order.m_dabao_money = CLewaimaiString::DoubleToString(m_cur_diandan_order.getDabaoMoney(), 2);
|
|
|
+ m_cur_diandan_order.m_total_price = CLewaimaiString::DoubleToString(m_cur_total_price, 2);
|
|
|
+
|
|
|
+ m_cur_diandan_order.m_canpai = m_canpai;
|
|
|
+
|
|
|
+ for (std::vector<CZhengcanOrderItem>::iterator it = m_cur_diandan_order.m_items.begin(); it != m_cur_diandan_order.m_items.end(); it++)
|
|
|
+ {
|
|
|
+ CZhengcanOrderItemPrint itemPrint;
|
|
|
+
|
|
|
+ itemPrint.m_food_name = it->getNameWanzhengShow();
|
|
|
+ itemPrint.m_quantity = it->num;
|
|
|
+ itemPrint.m_item_price = it->getSinglePrice();
|
|
|
+ itemPrint.m_type_id = it->type_id;
|
|
|
+
|
|
|
+ if (it->m_is_taocan == true)
|
|
|
+ {
|
|
|
+ itemPrint.is_taocan = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_cur_diandan_order.m_items_print.push_back(itemPrint);
|
|
|
+
|
|
|
+ if (it->m_is_taocan == true)
|
|
|
+ {
|
|
|
+ //开始保存套餐里面的商品详情,主要用于厨房打印
|
|
|
+ CFoodpackage foodpackageinfo;
|
|
|
+ foodpackageinfo = it->GetFoodpackageInfo();
|
|
|
+
|
|
|
+ std::string nature = foodpackageinfo.nature;
|
|
|
+
|
|
|
+ rapidjson::Document document;
|
|
|
+ document.Parse(nature.c_str());
|
|
|
+
|
|
|
+ if (document.HasParseError())
|
|
|
+ {
|
|
|
+ //属性json报错,直接不处理了
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ rapidjson::Value& data = document;
|
|
|
+
|
|
|
+ //接下来要把这个套餐的详情也保存下来
|
|
|
+ for (std::vector<FoodNatureSelectValue>::iterator it_2 = it->natureSelectedArray.begin(); it_2 != it->natureSelectedArray.end(); it_2++)
|
|
|
+ {
|
|
|
+ std::string food_id = data[it_2->nNameIndex]["value"][it_2->nature_select_index].GetString();
|
|
|
+
|
|
|
+ //要根据商品ID找出商品的名字
|
|
|
+ CFood foodinfo;
|
|
|
+ CSqlite3 sqlite;
|
|
|
+ bool is_found = sqlite.GetFoodById(food_id, foodinfo);
|
|
|
+ if (!is_found)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ CZhengcanOrderItemPrint foodpackageitemPrint;
|
|
|
+
|
|
|
+ foodpackageitemPrint.m_food_name = foodinfo.name;
|
|
|
+ foodpackageitemPrint.m_quantity = it->num;
|
|
|
+ foodpackageitemPrint.m_item_price = foodinfo.price;
|
|
|
+ foodpackageitemPrint.m_type_id = foodinfo.type_id;
|
|
|
+
|
|
|
+ foodpackageitemPrint.is_taocan = false;
|
|
|
+ foodpackageitemPrint.is_taocan_item = true;
|
|
|
+
|
|
|
+ m_cur_diandan_order.m_items_print.push_back(foodpackageitemPrint);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return m_cur_diandan_order;
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::SetPos(RECT rc, bool bNeedInvalidate)
|
|
|
+{
|
|
|
+ m_nPageWidth = rc.right - rc.left;
|
|
|
+
|
|
|
+ //拖动窗口的时候,更新位置
|
|
|
+ UpdateJiesuanZhifuPos();
|
|
|
+
|
|
|
+ //更新分类位置
|
|
|
+ UpdateFoodtypePos();
|
|
|
+
|
|
|
+ CContainerUI::SetPos(rc, bNeedInvalidate);
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanDiandanPageUI::SetTableId(std::string table_id)
|
|
|
+{
|
|
|
+ m_table_id = table_id;
|
|
|
+}
|