|
|
@@ -312,7 +312,10 @@ LRESULT CFulikaShoukuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lPar
|
|
|
{
|
|
|
if (m_shoukuan_status == 0)
|
|
|
{
|
|
|
- StartShoukuan();
|
|
|
+ if (m_shoukuanModel == 2)
|
|
|
+ {
|
|
|
+ StartShoukuan();
|
|
|
+ }
|
|
|
}
|
|
|
else if (m_shoukuan_status == 1 || m_shoukuan_status == 2 || m_shoukuan_status == 5)
|
|
|
{
|
|
|
@@ -325,7 +328,11 @@ LRESULT CFulikaShoukuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lPar
|
|
|
}
|
|
|
else if (m_shoukuan_status == 4)
|
|
|
{
|
|
|
- Close(IDCANCEL);
|
|
|
+ //Close(IDCANCEL);
|
|
|
+ if (m_shoukuanModel == 2)
|
|
|
+ {
|
|
|
+ StartShoukuan();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
@@ -366,7 +373,7 @@ LRESULT CFulikaShoukuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lPar
|
|
|
}
|
|
|
else if (m_shoukuan_status == 4)
|
|
|
{
|
|
|
- Close(IDCANCEL);
|
|
|
+ //Close(IDCANCEL);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -377,41 +384,20 @@ LRESULT CFulikaShoukuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lPar
|
|
|
|
|
|
void CFulikaShoukuanWnd::InitMoney(std::wstring value)
|
|
|
{
|
|
|
- CHorizontalLayoutUI* pInputLayout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_money_input_layout")));
|
|
|
- pInputLayout->SetVisible(false);
|
|
|
-
|
|
|
- CHorizontalLayoutUI* pShowLayout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_money_show_layout")));
|
|
|
- pShowLayout->SetVisible(true);
|
|
|
-
|
|
|
CLabelUI* pMoneyLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuan_money_show_money")));
|
|
|
if (pMoneyLabel)
|
|
|
{
|
|
|
pMoneyLabel->SetText(value.c_str());
|
|
|
}
|
|
|
|
|
|
- m_is_money_init = true;
|
|
|
m_money = value;
|
|
|
}
|
|
|
|
|
|
void CFulikaShoukuanWnd::InitFukuanma(std::string fukuanma)
|
|
|
{
|
|
|
- std::wstring ws_fukuanma = CLewaimaiString::UTF8ToUnicode(fukuanma);
|
|
|
+ m_fukuanma = fukuanma;
|
|
|
|
|
|
- CLabelUI* pFukuanmaLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("fukuanma_edit")));
|
|
|
- if (pFukuanmaLabel)
|
|
|
- {
|
|
|
- pFukuanmaLabel->SetText(ws_fukuanma.c_str());
|
|
|
- }
|
|
|
-
|
|
|
- std::string shoukuan_setting_mianqueren = CSetting::GetParam("shoukuan_setting_mianqueren");
|
|
|
- if (shoukuan_setting_mianqueren == "1")
|
|
|
- {
|
|
|
- if (m_is_money_init)
|
|
|
- {
|
|
|
- //如果金额也是初始化好的,可以直接支付了
|
|
|
- this->StartShoukuan();
|
|
|
- }
|
|
|
- }
|
|
|
+ this->StartShoukuan();
|
|
|
}
|
|
|
|
|
|
void CFulikaShoukuanWnd::SetCommonParams(std::map<string, string> params)
|
|
|
@@ -421,25 +407,7 @@ void CFulikaShoukuanWnd::SetCommonParams(std::map<string, string> params)
|
|
|
|
|
|
void CFulikaShoukuanWnd::UpdateFocus()
|
|
|
{
|
|
|
- if (m_is_money_init == false)
|
|
|
- {
|
|
|
- //如果没初始化,这个时候有2个编辑框,不能抢焦点
|
|
|
- CEditUI* pMoneyEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("money_edit")));
|
|
|
-
|
|
|
- pMoneyEdit->SetFocus();
|
|
|
-
|
|
|
- //下一个焦点的,就设置为这个控件
|
|
|
- m_pm.SetFocusNeeded(pMoneyEdit);
|
|
|
-
|
|
|
- //这个干嘛的不知道,但是不加好像不行
|
|
|
- m_pm.SetNextTabControl(false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- CEditUI* pFukuanEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("fukuanma_edit")));
|
|
|
-
|
|
|
- pFukuanEdit->SetFocus();
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
LRESULT CFulikaShoukuanWnd::OnShoukuanNeedPassword(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
|
@@ -463,20 +431,11 @@ LRESULT CFulikaShoukuanWnd::OnShoukuanNeedPassword(UINT uMsg, WPARAM wParam, LPA
|
|
|
|
|
|
LRESULT CFulikaShoukuanWnd::OnShoukuanSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
|
{
|
|
|
- //判断是否要打印
|
|
|
- /*
|
|
|
- int dayinji_setting_auto_print = atoi(CSetting::GetParam("system_setting_dayinji_setting_auto_print").c_str());
|
|
|
- if (dayinji_setting_auto_print == 1)
|
|
|
+ //播放收款成功的金额
|
|
|
+ if (CSetting::GetParam("setting_is_new_diannei_voice") == "1")
|
|
|
{
|
|
|
- m_valueWnd->PrintZhifu(m_out_trade_no);
|
|
|
+ std::thread(&CFulikaShoukuanWnd::ReadShoukuanValue, this).detach();
|
|
|
}
|
|
|
- }*/
|
|
|
-
|
|
|
- //播放收款成功的金额
|
|
|
- //if (CSetting::GetParam("shoukuan_setting_yuyinbobao") == "1")
|
|
|
- //{
|
|
|
- std::thread(&CFulikaShoukuanWnd::ReadShoukuanValue, this).detach();
|
|
|
- //}
|
|
|
|
|
|
CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_paying_layout")));
|
|
|
paying_layout->SetVisible(false);
|
|
|
@@ -489,12 +448,6 @@ LRESULT CFulikaShoukuanWnd::OnShoukuanSuccess(UINT uMsg, WPARAM wParam, LPARAM l
|
|
|
std::wstring valueInfo = L"成功收款:¥" + m_money;
|
|
|
pMoneyPaySuccess->SetText(valueInfo.c_str());
|
|
|
|
|
|
- CHorizontalLayoutUI* wx_logo = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_pay_success_logo_wx")));
|
|
|
- CHorizontalLayoutUI* zhifubao_logo = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_pay_success_logo_zhifubao")));
|
|
|
-
|
|
|
- wx_logo->SetVisible(true);
|
|
|
- zhifubao_logo->SetVisible(false);
|
|
|
-
|
|
|
CLabelUI* attention = static_cast<CLabelUI*>(m_pm.FindControl(_T("shouyin_pay_success_attention")));
|
|
|
std::wstring ws_attention = L"按任意键关闭窗口," + to_wstring(m_timer_now) + L" 秒后自动关闭";
|
|
|
attention->SetText(ws_attention.c_str());
|
|
|
@@ -511,28 +464,20 @@ LRESULT CFulikaShoukuanWnd::OnShoukuanFail(UINT uMsg, WPARAM wParam, LPARAM lPar
|
|
|
{
|
|
|
wstring path = CSystem::GetProgramDir() + L"\\music\\pay_fail.wav";
|
|
|
|
|
|
- //if (CSetting::GetParam("shoukuan_setting_yuyinbobao") == "1")
|
|
|
- //{
|
|
|
- PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
|
|
|
- //}
|
|
|
+ if (CSetting::GetParam("setting_is_new_diannei_voice") == "1")
|
|
|
+ {
|
|
|
+ PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
|
|
|
+ }
|
|
|
|
|
|
CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_paying_layout")));
|
|
|
paying_layout->SetVisible(false);
|
|
|
|
|
|
- CVerticalLayoutUI* pay_fail_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_pay_fail_layout")));
|
|
|
- pay_fail_layout->SetVisible(true);
|
|
|
-
|
|
|
- CHorizontalLayoutUI* title_layout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_title_bkg")));
|
|
|
- title_layout->SetBkColor(0xFFD33E3A);
|
|
|
-
|
|
|
- CLabelUI* pFailMessage = static_cast<CLabelUI*>(m_pm.FindControl(_T("shouyin_pay_fail_attention")));
|
|
|
-
|
|
|
- std::wstring ws_fail_message = L"失败信息:" + m_fail_message + L",按任意键关闭窗口,";
|
|
|
- std::wstring ws_attention = ws_fail_message + to_wstring(m_timer_now) + L" 秒后自动关闭";
|
|
|
-
|
|
|
- pFailMessage->SetText(ws_attention.c_str());
|
|
|
+ CVerticalLayoutUI* before_pay_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_before_pay_layout")));
|
|
|
+ before_pay_layout->SetVisible(true);
|
|
|
|
|
|
- SetTimer(m_hWnd, WM_TIMER_WND_CLOSE, 1000, NULL);
|
|
|
+ CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuanresult")));
|
|
|
+ pLabel->SetText((L"收款失败:" + m_fail_message).c_str());
|
|
|
+ pLabel->SetVisible(true);
|
|
|
|
|
|
SetFocus(m_hWnd);
|
|
|
|
|
|
@@ -545,42 +490,40 @@ void CFulikaShoukuanWnd::StartShoukuan()
|
|
|
CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuanresult")));
|
|
|
|
|
|
//检查收款金额
|
|
|
- if (m_is_money_init == false)
|
|
|
+ if (m_money == L"")
|
|
|
{
|
|
|
- CEditUI* pMoneyEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("money_edit")));
|
|
|
- m_money = pMoneyEdit->GetText();
|
|
|
+ pLabel->SetText(L"收款金额不能为空,请重新输入!");
|
|
|
+ pLabel->SetVisible(true);
|
|
|
|
|
|
- if (m_money == L"")
|
|
|
- {
|
|
|
- pLabel->SetText(L"收款金额不能为空,请重新输入!");
|
|
|
- pLabel->SetVisible(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (m_money == L"0.00")
|
|
|
+ {
|
|
|
+ pLabel->SetText(L"收款金额不能为 0 元,请重新输入!");
|
|
|
+ pLabel->SetVisible(true);
|
|
|
|
|
|
- if (m_money == L"0.00")
|
|
|
- {
|
|
|
- pLabel->SetText(L"收款金额不能为 0 元,请重新输入!");
|
|
|
- pLabel->SetVisible(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- return;
|
|
|
- }
|
|
|
+ double money_value = atof(CLewaimaiString::UnicodeToUTF8(m_money).c_str());
|
|
|
+ if (!money_value || money_value < 0.01)
|
|
|
+ {
|
|
|
+ pLabel->SetText(L"收款金额错误,请重新输入!");
|
|
|
+ pLabel->SetVisible(true);
|
|
|
|
|
|
- double money_value = atof(CLewaimaiString::UnicodeToUTF8(m_money).c_str());
|
|
|
- if (!money_value || money_value < 0.01)
|
|
|
- {
|
|
|
- pLabel->SetText(L"收款金额错误,请重新输入!");
|
|
|
- pLabel->SetVisible(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (money_value > 50000)
|
|
|
+ {
|
|
|
+ pLabel->SetText(L"单笔收款金额不能大于5万,请重新输入!");
|
|
|
+ pLabel->SetVisible(true);
|
|
|
+
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
//先判断收款码的格式是否正确
|
|
|
- CEditUI* pFukuanmaEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("fukuanma_edit")));
|
|
|
- std::wstring ws_Fukuanma = pFukuanmaEdit->GetText();
|
|
|
- m_fukuanma = CLewaimaiString::UnicodeToUTF8(ws_Fukuanma);
|
|
|
-
|
|
|
CEditUI* pShoujihaoEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("shoujihao_edit")));
|
|
|
std::wstring ws_Shoujihao = pShoujihaoEdit->GetText();
|
|
|
m_shoujihao = CLewaimaiString::UnicodeToUTF8(ws_Shoujihao);
|
|
|
@@ -667,7 +610,17 @@ void CFulikaShoukuanWnd::HandleShoukuan()
|
|
|
}
|
|
|
|
|
|
rapidjson::Value& v_errcode = document["errcode"];
|
|
|
- int errcode = v_errcode.GetInt();
|
|
|
+
|
|
|
+ int errcode;
|
|
|
+ if (v_errcode.IsString())
|
|
|
+ {
|
|
|
+ errcode = atoi(v_errcode.GetString());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ errcode = v_errcode.GetInt();
|
|
|
+ }
|
|
|
+
|
|
|
if (errcode != 0)
|
|
|
{
|
|
|
LOG_INFO("response failed! message:" << document["errmsg"].GetString());
|
|
|
@@ -943,3 +896,14 @@ void CFulikaShoukuanWnd::ReadShoukuanValue()
|
|
|
{
|
|
|
CSpeech::SpeakNum(1, CLewaimaiString::UnicodeToUTF8(m_money));
|
|
|
}
|
|
|
+
|
|
|
+//处理键盘捕捉结果
|
|
|
+void CFulikaShoukuanWnd::HandleTextCapture(std::string content)
|
|
|
+{
|
|
|
+ if (m_shoukuanModel == 1)
|
|
|
+ {
|
|
|
+ m_fukuanma = content;
|
|
|
+
|
|
|
+ StartShoukuan();
|
|
|
+ }
|
|
|
+}
|