Browse Source

优惠明细的UI优化完了。

张洋 1 month ago
parent
commit
88d4e113ca

BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/yh_card_green.png


BIN
bin/Win32/Debug/zhipuzi_pos_windows/skin/yh_card_white.png


+ 61 - 49
bin/Win32/Debug/zhipuzi_pos_windows/skin/youhui_show_dlg.xml

@@ -1,62 +1,74 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Window size="502,500" caption="0,0,0,36" roundcorner="4,4" shadowsize="3" showshadow="true">
-	
+<Window size="560,540" caption="0,0,0,44" roundcorner="4,4" shadowsize="3" showshadow="true">
 	<VerticalLayout bkimage="shoukuan_bkg.png" >
 		<HorizontalLayout name="shoukuan_title_bkg" height="44" bkcolor="0xFF60B177">
 			<Label name="memo_dlg_title" text="优惠明细" height="44" align="center" valign="center" padding="0,0,0,0" textcolor="#FFFFFFFF"/>
 			<Button name="closebtn" keyboard="false" padding="0,13,15,0" width="16" height="16" normalimage="file='close_normal.png'" hotimage="file='close_hover.png'" pushedimage="file='close_normal.png'"/>
 		</HorizontalLayout>
-		
-		<VerticalLayout padding="0,20,0,0">
-			<HorizontalLayout height="40">
-				<Label name="shangpinquan" text="商品券优惠:" width="250" align="right"></Label>
-				<Label name="shangpinquan_value" text="0元" width="230" align="left"></Label>
+
+		<VerticalLayout name="yh_body" padding="18,20,18,8" childpadding="12">
+			<HorizontalLayout height="44" childpadding="12">
+				<HorizontalLayout name="card_shangpinquan" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="shangpinquan" text="商品券优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="shangpinquan_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
+				<HorizontalLayout name="card_cika" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="cika" text="次卡优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="cika_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
 			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="cika" text="次卡优惠:" width="250" align="right"></Label>
-				<Label name="cika_value" text="0元" width="230" align="left"></Label>
+
+			<HorizontalLayout height="44" childpadding="12">
+				<HorizontalLayout name="card_shangpinhuiyuan" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="shangpinhuiyuan" text="商品会员价优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="shangpinhuiyuan_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
+				<HorizontalLayout name="card_zhengdanzhekou" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="zhengdanzhekou" text="整单折扣优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="zhengdanzhekou_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
 			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="shangpinhuiyuan" text="商品会员价优惠:" width="250" align="right"></Label>
-				<Label name="shangpinhuiyuan_value" text="0元" width="230" align="left"></Label>
+
+			<HorizontalLayout height="44" childpadding="12">
+				<HorizontalLayout name="card_huiyuanzhengdanzhekou" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="huiyuanzhengdanzhekou" text="会员整单折扣优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="huiyuanzhengdanzhekou_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
+				<HorizontalLayout name="card_quanyika" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="quanyika" text="权益卡优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="quanyika_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
 			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="zhengdanzhekou" text="整单折扣优惠:" width="250" align="right"></Label>
-				<Label name="zhengdanzhekou_value" text="0元" width="230" align="left"></Label>
+
+			<HorizontalLayout height="44" childpadding="12">
+				<HorizontalLayout name="card_manjian" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="manjian" text="满减优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="manjian_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
+				<HorizontalLayout name="card_youhuiquan" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="youhuiquan" text="优惠券优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="youhuiquan_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
 			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="huiyuanzhengdanzhekou" text="会员整单折扣优惠:" width="250" align="right"></Label>
-				<Label name="huiyuanzhengdanzhekou_value" text="0元" width="230" align="left"></Label>
-			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="quanyika" text="权益卡优惠:" width="250" align="right"></Label>
-				<Label name="quanyika_value" text="0元" width="230" align="left"></Label>
-			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="manjian" text="满减优惠:" width="250" align="right"></Label>
-				<Label name="manjian_value" text="0元" width="230" align="left"></Label>
-			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="youhuiquan" text="优惠券优惠:" width="250" align="right"></Label>
-				<Label name="youhuiquan_value" text="0元" width="230" align="left"></Label>
-			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="rengongyouhui" text="人工优惠:" width="250" align="right"></Label>
-				<Label name="rengongyouhui_value" text="0元" width="230" align="left"></Label>
-			</HorizontalLayout>
-			
-			<HorizontalLayout height="40">
-				<Label name="moling" text="抹零优惠:" width="250" align="right"></Label>
-				<Label name="moling_value" text="0元" width="230" align="left"></Label>
+
+			<HorizontalLayout height="44" childpadding="12">
+				<HorizontalLayout name="card_rengongyouhui" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="rengongyouhui" text="人工优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="rengongyouhui_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
+				<HorizontalLayout name="card_moling" width="254" height="44" bkimage="file='yh_card_white.png' corner='8,8,8,8'">
+					<Label name="moling" text="抹零优惠" width="150" height="44" align="left" valign="center" textpadding="14,0,0,0" font="13" textcolor="#FF1F2329"/>
+					<Label name="moling_value" width="104" height="44" align="right" valign="center" textpadding="0,0,14,0" font="15" textcolor="#FF5F6368" text="0元"/>
+				</HorizontalLayout>
 			</HorizontalLayout>
+
+			<Label name="yh_note" text="注:0.00元表示该优惠项本次未生效;浅绿卡片为已生效优惠。" font="12" textcolor="#FF8A9099" align="left" padding="2,4,2,0"/>
 		</VerticalLayout>
+
+		<HorizontalLayout height="78" padding="0,16,0,18" valign="center">
+			<Control />
+			<Button name="okbtn" align="center" width="280" height="44" text="知道了" textcolor="#FFFFFFFF" font="114" normalimage="file='gd_btn_green_n.png' corner='8,8,8,8'" hotimage="file='gd_btn_green_h.png' corner='8,8,8,8'" pushedimage="file='gd_btn_green_p.png' corner='8,8,8,8'" />
+			<Control />
+		</HorizontalLayout>
 	</VerticalLayout>
-</Window>
+</Window>

BIN
zhipuzi_pos_windows/resource/skin.zip


+ 63 - 26
zhipuzi_pos_windows/wnd/CYouhuiShowWnd.cpp

@@ -137,6 +137,11 @@ void CYouhuiShowWnd::Notify(TNotifyUI& msg)
 			Close(IDCANCEL);
 			return;
 		}
+		if (senderName == _T("okbtn"))
+		{
+			Close(IDOK);
+			return;
+		}
 	}
 }
 
@@ -145,36 +150,68 @@ void CYouhuiShowWnd::Init()
 
 }
 
-void CYouhuiShowWnd::SetYouhuiValue(double shangpinquan_youhui, double cika_youhui, double huiyiuan_shangpin_youhui, double zhekou_youhui, double huiyuan_zhekou_youhui, \
-	double quanyika_youhui, double manjian_youhui, double youhuiquan_youhui, double rengong_youhui, double moling_youhui)
+void CYouhuiShowWnd::SetItemState(LPCTSTR pszCardName, LPCTSTR pszNameLabelName, LPCTSTR pszValueName, double v)
 {
-	CLabelUI* pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("shangpinquan_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(shangpinquan_youhui, 2)) + L"元").c_str());
-
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("cika_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(cika_youhui, 2)) + L"元").c_str());
-
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("shangpinhuiyuan_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(huiyiuan_shangpin_youhui, 2)) + L"元").c_str());
+	bool active = v > 0.0001;
+	DWORD dwActiveColor = 0xFF60B177;
+	DWORD dwInactiveColor = 0xFF5F6368;
 
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("zhengdanzhekou_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(zhekou_youhui, 2)) + L"元").c_str());
-
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("huiyuanzhengdanzhekou_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(huiyuan_zhekou_youhui, 2)) + L"元").c_str());
-
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("quanyika_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(quanyika_youhui, 2)) + L"元").c_str());
+	// 卡片底:生效项浅绿卡,未生效项白底卡
+	CControlUI* pCard = m_pm.FindControl(pszCardName);
+	if (pCard)
+	{
+		pCard->SetBkImage(active
+			? _T("file='yh_card_green.png' corner='8,8,8,8'")
+			: _T("file='yh_card_white.png' corner='8,8,8,8'"));
+	}
 
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("manjian_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(manjian_youhui, 2)) + L"元").c_str());
+	// 名称:生效项主绿,未生效项灰阶
+	CLabelUI* pName = static_cast<CLabelUI*>(m_pm.FindControl(pszNameLabelName));
+	if (pName)
+	{
+		pName->SetTextColor(active ? dwActiveColor : dwInactiveColor);
+	}
 
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("youhuiquan_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(youhuiquan_youhui, 2)) + L"元").c_str());
+	// 金额:生效项主绿加粗(负数),未生效项灰阶常规
+	CLabelUI* pVal = static_cast<CLabelUI*>(m_pm.FindControl(pszValueName));
+	if (pVal)
+	{
+		std::wstring sValue;
+		if (active)
+		{
+			// 优惠金额以负数呈现(-15.00)
+			sValue = std::wstring(L"-") + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(v, 2));
+		}
+		else
+		{
+			sValue = CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(v, 2));
+		}
+		pVal->SetText(sValue.c_str());
 
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("rengongyouhui_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(rengong_youhui, 2)) + L"元").c_str());
+		if (active)
+		{
+			pVal->SetFont(115);
+			pVal->SetTextColor(dwActiveColor);
+		}
+		else
+		{
+			pVal->SetFont(15);
+			pVal->SetTextColor(dwInactiveColor);
+		}
+	}
+}
 
-	pContent = static_cast<CLabelUI*>(m_pm.FindControl(_T("moling_value")));
-	pContent->SetText((CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(moling_youhui, 2)) + L"元").c_str());
+void CYouhuiShowWnd::SetYouhuiValue(double shangpinquan_youhui, double cika_youhui, double huiyiuan_shangpin_youhui, double zhekou_youhui, double huiyuan_zhekou_youhui, \
+	double quanyika_youhui, double manjian_youhui, double youhuiquan_youhui, double rengong_youhui, double moling_youhui)
+{
+	SetItemState(_T("card_shangpinquan"), _T("shangpinquan"), _T("shangpinquan_value"), shangpinquan_youhui);
+	SetItemState(_T("card_cika"), _T("cika"), _T("cika_value"), cika_youhui);
+	SetItemState(_T("card_shangpinhuiyuan"), _T("shangpinhuiyuan"), _T("shangpinhuiyuan_value"), huiyiuan_shangpin_youhui);
+	SetItemState(_T("card_zhengdanzhekou"), _T("zhengdanzhekou"), _T("zhengdanzhekou_value"), zhekou_youhui);
+	SetItemState(_T("card_huiyuanzhengdanzhekou"), _T("huiyuanzhengdanzhekou"), _T("huiyuanzhengdanzhekou_value"), huiyuan_zhekou_youhui);
+	SetItemState(_T("card_quanyika"), _T("quanyika"), _T("quanyika_value"), quanyika_youhui);
+	SetItemState(_T("card_manjian"), _T("manjian"), _T("manjian_value"), manjian_youhui);
+	SetItemState(_T("card_youhuiquan"), _T("youhuiquan"), _T("youhuiquan_value"), youhuiquan_youhui);
+	SetItemState(_T("card_rengongyouhui"), _T("rengongyouhui"), _T("rengongyouhui_value"), rengong_youhui);
+	SetItemState(_T("card_moling"), _T("moling"), _T("moling_value"), moling_youhui);
 }

+ 3 - 0
zhipuzi_pos_windows/wnd/CYouhuiShowWnd.h

@@ -61,6 +61,9 @@ public:
 
 	LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
 
+	// 单项:根据金额 > 0 切换「浅绿生效卡」/「白底未生效卡」并刷新名称、金额文字与色值
+	void SetItemState(LPCTSTR pszCardName, LPCTSTR pszNameLabelName, LPCTSTR pszValueName, double v);
+
 	//处理键盘捕捉结果
 	void HandleTextCapture(std::string content)
 	{