|
|
@@ -23,7 +23,7 @@ void CTuikuanWnd::Notify(TNotifyUI& msg)
|
|
|
Close();
|
|
|
return;
|
|
|
}
|
|
|
- else if (msg.pSender->GetName() == _T("shoukuanBtn"))
|
|
|
+ else if (msg.pSender->GetName() == _T("tuikuanBtn"))
|
|
|
{
|
|
|
StartTuikuan();
|
|
|
}
|
|
|
@@ -154,19 +154,19 @@ LRESULT CTuikuanWnd::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHan
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- if (m_shoukuan_status == 0 || m_shoukuan_status == 1)
|
|
|
+ if (m_tuikuan_status == 0 || m_tuikuan_status == 1)
|
|
|
{
|
|
|
}
|
|
|
- else if (m_shoukuan_status == 2)
|
|
|
+ else if (m_tuikuan_status == 2)
|
|
|
{
|
|
|
}
|
|
|
- else if (m_shoukuan_status == 3)
|
|
|
+ else if (m_tuikuan_status == 3)
|
|
|
{
|
|
|
m_timer_now--;
|
|
|
|
|
|
if (m_timer_now > 0)
|
|
|
{
|
|
|
- CLabelUI* attention = static_cast<CLabelUI*>(m_pm.FindControl(_T("shouyin_pay_success_attention")));
|
|
|
+ CLabelUI* attention = static_cast<CLabelUI*>(m_pm.FindControl(_T("tuikuan_pay_success_attention")));
|
|
|
std::wstring ws_attention = L"按任意键关闭窗口," + to_wstring(m_timer_now) + L" 秒后自动关闭";
|
|
|
attention->SetText(ws_attention.c_str());
|
|
|
}
|
|
|
@@ -175,13 +175,13 @@ LRESULT CTuikuanWnd::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHan
|
|
|
Close();
|
|
|
}
|
|
|
}
|
|
|
- else if (m_shoukuan_status == 4)
|
|
|
+ else if (m_tuikuan_status == 4)
|
|
|
{
|
|
|
m_timer_now--;
|
|
|
|
|
|
if (m_timer_now > 0)
|
|
|
{
|
|
|
- CLabelUI* pFailMessage = static_cast<CLabelUI*>(m_pm.FindControl(_T("shouyin_pay_fail_attention")));
|
|
|
+ CLabelUI* pFailMessage = static_cast<CLabelUI*>(m_pm.FindControl(_T("tuikuan_pay_fail_attention")));
|
|
|
|
|
|
std::wstring ws_fail_message = L"失败信息:" + CLewaimaiString::UTF8ToUnicode(m_fail_message) + L",按任意键关闭窗口,";
|
|
|
std::wstring ws_attention = ws_fail_message + to_wstring(m_timer_now) + L" 秒后自动关闭";
|
|
|
@@ -257,15 +257,15 @@ LRESULT CTuikuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, boo
|
|
|
{
|
|
|
if (wParam == VK_RETURN)
|
|
|
{
|
|
|
- if (m_shoukuan_status == 0)
|
|
|
+ if (m_tuikuan_status == 0)
|
|
|
{
|
|
|
StartTuikuan();
|
|
|
}
|
|
|
- else if (m_shoukuan_status == 1 || m_shoukuan_status == 2 || m_shoukuan_status == 5)
|
|
|
+ else if (m_tuikuan_status == 1 || m_tuikuan_status == 2 || m_tuikuan_status == 5)
|
|
|
{
|
|
|
//正在支付的过程中,这个时候按Enter键,不做任何处理
|
|
|
}
|
|
|
- else if (m_shoukuan_status == 3 || m_shoukuan_status == 4)
|
|
|
+ else if (m_tuikuan_status == 3 || m_tuikuan_status == 4)
|
|
|
{
|
|
|
//已经明确成功或者失败了,那么久直接关闭就可以了
|
|
|
Close();
|
|
|
@@ -275,20 +275,20 @@ LRESULT CTuikuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, boo
|
|
|
}
|
|
|
else if (wParam == VK_ESCAPE)
|
|
|
{
|
|
|
- if (m_shoukuan_status == 0)
|
|
|
+ if (m_tuikuan_status == 0)
|
|
|
{
|
|
|
//还没开始支付,按Esc直接退出
|
|
|
Close();
|
|
|
}
|
|
|
- else if (m_shoukuan_status == 1 || m_shoukuan_status == 5)
|
|
|
+ else if (m_tuikuan_status == 1 || m_tuikuan_status == 5)
|
|
|
{
|
|
|
//不能做任何处理
|
|
|
}
|
|
|
- else if (m_shoukuan_status == 2)
|
|
|
+ else if (m_tuikuan_status == 2)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
- else if (m_shoukuan_status == 3 || m_shoukuan_status == 4)
|
|
|
+ else if (m_tuikuan_status == 3 || m_tuikuan_status == 4)
|
|
|
{
|
|
|
//已经明确成功或者失败了,那么久直接关闭就可以了
|
|
|
Close();
|
|
|
@@ -297,7 +297,7 @@ LRESULT CTuikuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, boo
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- if (m_shoukuan_status == 3 || m_shoukuan_status == 4)
|
|
|
+ if (m_tuikuan_status == 3 || m_tuikuan_status == 4)
|
|
|
{
|
|
|
//已经明确成功或者失败了,那么久直接关闭就可以了
|
|
|
Close();
|
|
|
@@ -311,13 +311,13 @@ LRESULT CTuikuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, boo
|
|
|
|
|
|
void CTuikuanWnd::InitMoney(std::wstring value)
|
|
|
{
|
|
|
- CHorizontalLayoutUI* pInputLayout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_money_input_layout")));
|
|
|
+ CHorizontalLayoutUI* pInputLayout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("tuikuan_money_input_layout")));
|
|
|
pInputLayout->SetVisible(false);
|
|
|
|
|
|
- CHorizontalLayoutUI* pShowLayout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_money_show_layout")));
|
|
|
+ CHorizontalLayoutUI* pShowLayout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("tuikuan_money_show_layout")));
|
|
|
pShowLayout->SetVisible(true);
|
|
|
|
|
|
- CLabelUI* pMoneyLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuan_money_show_money")));
|
|
|
+ CLabelUI* pMoneyLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("tuikuan_money_show_money")));
|
|
|
if (pMoneyLabel)
|
|
|
{
|
|
|
pMoneyLabel->SetText(value.c_str());
|
|
|
@@ -355,31 +355,24 @@ LRESULT CTuikuanWnd::OnTuikuanSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam, B
|
|
|
wstring path = CSystem::GetProgramDir() + L"\\music\\pay_success.wav";
|
|
|
PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
|
|
|
|
|
|
- CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_paying_layout")));
|
|
|
+ CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("tuikuan_paying_layout")));
|
|
|
paying_layout->SetVisible(false);
|
|
|
|
|
|
- CVerticalLayoutUI* pay_success_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_pay_success_layout")));
|
|
|
+ CVerticalLayoutUI* pay_success_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("tuikuan_pay_success_layout")));
|
|
|
pay_success_layout->SetVisible(true);
|
|
|
|
|
|
- CLabelUI* pMoneyPaySuccess = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuan_pay_success_money")));
|
|
|
+ CLabelUI* pMoneyPaySuccess = static_cast<CLabelUI*>(m_pm.FindControl(_T("tuikuan_pay_success_money")));
|
|
|
|
|
|
- std::wstring valueInfo = L"成功收款:¥" + m_money;
|
|
|
+ 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")));
|
|
|
- if (m_tuikuanma_type == 1)
|
|
|
- {
|
|
|
- wx_logo->SetVisible(true);
|
|
|
- zhifubao_logo->SetVisible(false);
|
|
|
- }
|
|
|
- else if (m_tuikuanma_type == 2)
|
|
|
- {
|
|
|
- wx_logo->SetVisible(false);
|
|
|
- zhifubao_logo->SetVisible(true);
|
|
|
- }
|
|
|
+ CHorizontalLayoutUI* wx_logo = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("tuikuan_pay_success_logo_wx")));
|
|
|
+ CHorizontalLayoutUI* zhifubao_logo = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("tuikuan_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")));
|
|
|
+ CLabelUI* attention = static_cast<CLabelUI*>(m_pm.FindControl(_T("tuikuan_pay_success_attention")));
|
|
|
std::wstring ws_attention = L"按任意键关闭窗口," + to_wstring(m_timer_now) + L" 秒后自动关闭";
|
|
|
attention->SetText(ws_attention.c_str());
|
|
|
|
|
|
@@ -396,16 +389,16 @@ LRESULT CTuikuanWnd::OnTuikuanFail(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
|
|
|
wstring path = CSystem::GetProgramDir() + L"\\music\\pay_fail.wav";
|
|
|
PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
|
|
|
|
|
|
- CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_paying_layout")));
|
|
|
+ CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("tuikuan_paying_layout")));
|
|
|
paying_layout->SetVisible(false);
|
|
|
|
|
|
- CVerticalLayoutUI* pay_fail_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_pay_fail_layout")));
|
|
|
+ CVerticalLayoutUI* pay_fail_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("tuikuan_pay_fail_layout")));
|
|
|
pay_fail_layout->SetVisible(true);
|
|
|
|
|
|
- CHorizontalLayoutUI* title_layout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_title_bkg")));
|
|
|
+ CHorizontalLayoutUI* title_layout = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("tuikuan_title_bkg")));
|
|
|
title_layout->SetBkColor(0xFFD33E3A);
|
|
|
|
|
|
- CLabelUI* pFailMessage = static_cast<CLabelUI*>(m_pm.FindControl(_T("shouyin_pay_fail_attention")));
|
|
|
+ CLabelUI* pFailMessage = static_cast<CLabelUI*>(m_pm.FindControl(_T("tuikuan_pay_fail_attention")));
|
|
|
|
|
|
std::wstring ws_fail_message = L"失败信息:" + CLewaimaiString::UTF8ToUnicode(m_fail_message) + L",按任意键关闭窗口,";
|
|
|
std::wstring ws_attention = ws_fail_message + to_wstring(m_timer_now) + L" 秒后自动关闭";
|
|
|
@@ -424,7 +417,7 @@ void CTuikuanWnd::StartTuikuan()
|
|
|
{
|
|
|
CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuanresult")));
|
|
|
|
|
|
- //检查收款金额
|
|
|
+ //检查退款金额
|
|
|
if (m_is_money_init == false)
|
|
|
{
|
|
|
CEditUI* pMoneyEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("money_edit")));
|
|
|
@@ -432,7 +425,7 @@ void CTuikuanWnd::StartTuikuan()
|
|
|
|
|
|
if (m_money == L"")
|
|
|
{
|
|
|
- pLabel->SetText(L"收款金额不能为空,请重新输入!");
|
|
|
+ pLabel->SetText(L"退款金额不能为空,请重新输入!");
|
|
|
pLabel->SetVisible(true);
|
|
|
|
|
|
return;
|
|
|
@@ -440,7 +433,7 @@ void CTuikuanWnd::StartTuikuan()
|
|
|
|
|
|
if (m_money == L"0.00")
|
|
|
{
|
|
|
- pLabel->SetText(L"收款金额不能为 0 元,请重新输入!");
|
|
|
+ pLabel->SetText(L"退款金额不能为 0 元,请重新输入!");
|
|
|
pLabel->SetVisible(true);
|
|
|
|
|
|
return;
|
|
|
@@ -449,85 +442,35 @@ void CTuikuanWnd::StartTuikuan()
|
|
|
double money_value = atof(CLewaimaiString::UnicodeToUTF8(m_money).c_str());
|
|
|
if (!money_value || money_value < 0.01)
|
|
|
{
|
|
|
- pLabel->SetText(L"收款金额错误,请重新输入!");
|
|
|
+ pLabel->SetText(L"退款金额错误,请重新输入!");
|
|
|
pLabel->SetVisible(true);
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //先判断收款码的格式是否正确
|
|
|
+ //先判断退款码的格式是否正确
|
|
|
CEditUI* pFukuanmaEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("tuikuanma_edit")));
|
|
|
std::wstring ws_Fukuanma = pFukuanmaEdit->GetText();
|
|
|
std::string s_Fukuanma = CLewaimaiString::UnicodeToUTF8(ws_Fukuanma);
|
|
|
|
|
|
- int length = s_Fukuanma.size();
|
|
|
- if (length != 18)
|
|
|
- {
|
|
|
- pLabel->SetText(L"收款码格式不对,请检查后重新输入!");
|
|
|
- pLabel->SetVisible(true);
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < length; i++)
|
|
|
- {
|
|
|
- char c = *(s_Fukuanma.c_str() + i);
|
|
|
- if (isdigit(c) == 0)
|
|
|
- {
|
|
|
- //不是数字
|
|
|
- pLabel->SetText(L"收款码格式不对,请检查后重新输入!");
|
|
|
- pLabel->SetVisible(true);
|
|
|
-
|
|
|
- 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)
|
|
|
- {
|
|
|
- //微信付款码
|
|
|
- m_tuikuanma_type = 1;
|
|
|
- }
|
|
|
- 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)
|
|
|
- {
|
|
|
- //支付宝付款码
|
|
|
- m_tuikuanma_type = 2;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- pLabel->SetText(L"收款码格式不对,请检查后重新输入!");
|
|
|
- pLabel->SetVisible(true);
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
m_tuikuanma = ws_Fukuanma;
|
|
|
|
|
|
//全部验证通过,就可以开始修改状态了
|
|
|
- m_shoukuan_status = 1;
|
|
|
+ m_tuikuan_status = 1;
|
|
|
|
|
|
//不加这个的话,edit按回车之后样式有问题
|
|
|
SetFocus(m_hWnd);
|
|
|
|
|
|
- CVerticalLayoutUI* before_pay_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_before_pay_layout")));
|
|
|
+ CVerticalLayoutUI* before_pay_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("tuikuan_before_pay_layout")));
|
|
|
before_pay_layout->SetVisible(false);
|
|
|
|
|
|
- CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_paying_layout")));
|
|
|
+ CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("tuikuan_paying_layout")));
|
|
|
paying_layout->SetVisible(true);
|
|
|
|
|
|
- CLabelUI* pMoneyPaying = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuan_paying_money")));
|
|
|
+ CLabelUI* pMoneyPaying = static_cast<CLabelUI*>(m_pm.FindControl(_T("tuikuan_paying_money")));
|
|
|
|
|
|
- std::wstring valueInfo = L"付款金额:¥" + m_money;
|
|
|
+ std::wstring valueInfo = L"退款金额:¥" + m_money;
|
|
|
pMoneyPaying->SetText(valueInfo.c_str());
|
|
|
|
|
|
//开启一个线程,开始处理登录
|
|
|
@@ -539,19 +482,11 @@ void CTuikuanWnd::HandleTuikuan()
|
|
|
//生成随机的order_no
|
|
|
|
|
|
std::map<string, string> params;
|
|
|
-
|
|
|
- params["order_no"] = CRandomHelper::GetRandString(20);
|
|
|
- m_order_no = params["order_no"];
|
|
|
-
|
|
|
- params["yingshou_value"] = CLewaimaiString::UnicodeToUTF8(m_money);
|
|
|
- params["shishou_value"] = CLewaimaiString::UnicodeToUTF8(m_money);
|
|
|
- params["zhaoling_value"] = to_string(0);
|
|
|
- params["zhifu_type"] = to_string(7);
|
|
|
- params["zhifu_code"] = CLewaimaiString::UnicodeToUTF8(m_tuikuanma);
|
|
|
+ params["out_trade_no"] = CLewaimaiString::UnicodeToUTF8(m_tuikuanma);
|
|
|
|
|
|
std::string response;
|
|
|
|
|
|
- std::string url = "/shouyin/sendorder";
|
|
|
+ std::string url = "/shouyin/refund_out_trade_no";
|
|
|
CZhipuziHttpClient::Request(url.c_str(), params, response);
|
|
|
|
|
|
rapidjson::Document document;
|
|
|
@@ -585,27 +520,18 @@ void CTuikuanWnd::HandleTuikuan()
|
|
|
if (s_status == "success")
|
|
|
{
|
|
|
//支付成功
|
|
|
- m_shoukuan_status = 3;
|
|
|
+ m_tuikuan_status = 3;
|
|
|
|
|
|
- SendMessage(WM_SHOUKUAN_STATUS_SUCCESS, 0, 0);
|
|
|
+ SendMessage(WM_TUIKUAN_STATUS_SUCCESS, 0, 0);
|
|
|
}
|
|
|
else if (s_status == "fail")
|
|
|
{
|
|
|
//支付失败
|
|
|
- m_shoukuan_status = 4;
|
|
|
+ m_tuikuan_status = 4;
|
|
|
|
|
|
m_fail_message = data["message"].GetString();
|
|
|
|
|
|
- SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
|
|
|
- }
|
|
|
- else if (s_status == "password")
|
|
|
- {
|
|
|
- m_shoukuan_status = 2;
|
|
|
-
|
|
|
- m_trade_no = data["trade_no"].GetString();
|
|
|
-
|
|
|
- //需要查询支付状态
|
|
|
- SendMessage(WM_SHOUKUAN_STATUS_NEEDPASSWORD, 0, 0);
|
|
|
+ SendMessage(WM_TUIKUAN_STATUS_FAIL, 0, 0);
|
|
|
}
|
|
|
}
|
|
|
|