ソースを参照

完成自定义支付

zhangyang 4 年 前
コミット
b1485db230

+ 12 - 12
bin/Win32/Debug/zhipuzi_pos_windows/skin/diandan_page.xml

@@ -198,39 +198,39 @@
 					
 					<HorizontalLayout name="diandan_jiesuan_zhifufangshi_layout" height="300">
 						<HorizontalLayout name="diandan_jiesuan_zhifufangshi_weixinzhifu" width="180" hegiht="80" float="true" pos="20,20,200,100">
-							<Button name="" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF4242"></Button>
+							<Button name="diandan_jiesuan_zhifufangshi_weixinzhifu_btn" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF4242"></Button>
 							<Control name="zhifu_icon" bkimage="weixinzhifu_icon.png" width="24" height="22" float="true" pos="80,10,104,32" mouse="false"></Control>
-							<Label name="zhifu_name" text="微信支付/支付宝" width="180" height="35" font="1" float="true" pos="35,35,215,70" textcolor="#FFFFFFFF" mouse="false"></Label>
+							<Label name="zhifu_name" text="微信支付/支付宝" width="180" height="35" font="2" float="true" pos="35,35,215,70" textcolor="#FFFFFFFF" mouse="false"></Label>
 						</HorizontalLayout>
 						
 						<HorizontalLayout name="diandan_jiesuan_zhifufangshi_huiyuan" width="180" hegiht="80" float="true" pos="220,20,400,100">
-							<Button name="" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF8910"></Button>
+							<Button name="diandan_jiesuan_zhifufangshi_huiyuan_btn" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF8910"></Button>
 							<Control name="zhifu_icon" bkimage="huiyuanzhifu_icon.png" width="26" height="20" float="true" pos="80,10,106,30" mouse="false"></Control>
-							<Label name="zhifu_name" text="会员支付" width="180" height="35" font="1" float="true" pos="65,35,245,70" textcolor="#FFFFFFFF" mouse="false"></Label>
+							<Label name="zhifu_name" text="会员支付" width="180" height="35" font="2" float="true" pos="65,35,245,70" textcolor="#FFFFFFFF" mouse="false"></Label>
 						</HorizontalLayout>
 						
 						<HorizontalLayout name="diandan_jiesuan_zhifufangshi_xianjin" width="180" hegiht="80" float="true" pos="420,20,600,100">
-							<Button name="" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FF52CB4B"></Button>
+							<Button name="diandan_jiesuan_zhifufangshi_xianjin_btn" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FF52CB4B"></Button>
 							<Control name="zhifu_icon" bkimage="xianjinzhifu_icon.png" width="21" height="24" float="true" pos="85,10,106,34" mouse="false"></Control>
-							<Label name="zhifu_name" text="现金支付" width="180" height="35" font="1" float="true" pos="65,35,245,70" textcolor="#FFFFFFFF" mouse="false"></Label>
+							<Label name="zhifu_name" text="现金支付" width="180" height="35" font="2" float="true" pos="65,35,245,70" textcolor="#FFFFFFFF" mouse="false"></Label>
 						</HorizontalLayout>
 						
 						<HorizontalLayout name="diandan_jiesuan_zhifufangshi_gouwuka" width="182" hegiht="82" float="true" pos="20,120,200,200">
-							<Button name="" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
+							<Button name="diandan_jiesuan_zhifufangshi_gouwuka_btn" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
 							<Control name="zhifu_icon" bkimage="fulika_icon.png" width="30" height="30" float="true" pos="73,10,103,40" mouse="false"></Control>
-							<Label name="zhifu_name" text="购物卡" width="180" height="35" font="1" float="true" pos="65,35,245,70" mouse="false"></Label>
+							<Label name="zhifu_name" text="购物卡" width="180" height="35" font="2" float="true" pos="65,35,245,70" mouse="false"></Label>
 						</HorizontalLayout>
 						
 						<HorizontalLayout name="diandan_jiesuan_zhifufangshi_meishicheng" width="182" hegiht="82" float="true" pos="220,120,400,200">
-							<Button name="" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
+							<Button name="diandan_jiesuan_zhifufangshi_meishicheng_btn" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
 							<Control name="zhifu_icon" bkimage="fulika_icon.png" width="30" height="30" float="true" pos="73,10,103,40" mouse="false"></Control>
-							<Label name="zhifu_name" text="美食城临时卡" width="180" height="35" font="1" float="true" pos="45,35,225,70" mouse="false"></Label>
+							<Label name="zhifu_name" text="美食城临时卡" width="180" height="35" font="2" float="true" pos="45,35,225,70" mouse="false"></Label>
 						</HorizontalLayout>
 						
 						<HorizontalLayout name="diandan_jiesuan_zhifufangshi_fulika" width="182" hegiht="82" float="true" pos="420,120,600,200">
-							<Button name="" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
+							<Button name="diandan_jiesuan_zhifufangshi_fulika_btn" text="" heiht="80" width="180" padding="0,0,0,0" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="1" bordercolor="#FFC1C1C1" bkcolor="#FFF7F7F7"></Button>
 							<Control name="zhifu_icon" bkimage="fulika_icon.png" width="30" height="30" float="true" pos="73,10,103,40" mouse="false"></Control>
-							<Label name="zhifu_name" text="福利卡" width="180" height="35" font="1" float="true" pos="65,35,245,70" mouse="false"></Label>
+							<Label name="zhifu_name" text="福利卡" width="180" height="35" font="2" float="true" pos="65,35,245,70" mouse="false"></Label>
 						</HorizontalLayout>
 					</HorizontalLayout>
 				</VerticalLayout>

+ 0 - 10
bin/Win32/Debug/zhipuzi_pos_windows/skin/diandan_zhifufangshi_item.xml

@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Window>
-	<Font id="1" name="微软雅黑" size="16" />
-	
-	<DiandanZhifufangshiItem width="180" hegiht="80" padding="0,0,0,0" float="true">
-		<Button name="" text="" heiht="75" width="120" padding="14,0,0,15" textcolor="#FF999999" normalimage="" hotimage="" pushedimage="" bordersize="0" bkcolor="#FFFF4242"></Button>
-		<Control name="zhifu_icon" bkimage="" width="24" height="22" float="true" pos="60,10,84,32" mouse="false"></Control>
-		<Label name="zhifu_name" text="" width="180" height="35" font="1" float="true" pos="15,35,165,70" textcolor="#FFFFFFFF" mouse="false"></Label>
-	</DiandanZhifufangshiItem>
-</Window>

+ 0 - 56
zhipuzi_pos_windows/control/CDiandanZhifufangshiItemUI.cpp

@@ -1,56 +0,0 @@
-#include "CDiandanZhifufangshiItemUI.h"
-
-
-
-CDiandanZhifufangshiItemUI::CDiandanZhifufangshiItemUI()
-{
-}
-
-
-CDiandanZhifufangshiItemUI::~CDiandanZhifufangshiItemUI()
-{
-}
-
-void CDiandanZhifufangshiItemUI::setNum(int num)
-{
-	int curRow = num / 4 + 1;
-	int curCol = (num + 1) % 4;
-
-	RECT rect;
-	rect.left = (curCol - 1) * 200 + 20;
-	rect.right = rect.left + 180;
-	rect.top = (curRow - 1) * 100;
-	rect.bottom = rect.top + 80;
-
-	this->SetFloat(true);
-	this->SetPos(rect);
-}
-
-void CDiandanZhifufangshiItemUI::SetType(std::string typeName)
-{
-	CLabelUI* pName = static_cast<CLabelUI*>(this->FindSubControl(_T("zhifu_name")));
-	CControlUI* pImage = static_cast<CControlUI*>(this->FindSubControl(_T("zhifu_icon")));
-
-	if (typeName == "weixinzhifu")
-	{
-		
-	}
-	else if (typeName == "huiyuan")
-	{
-	}
-	else if (typeName == "xianjin")
-	{
-	}
-	else if (typeName == "gouwuka")
-	{
-	}
-	else if (typeName == "meishicheng")
-	{
-	}
-	else if (typeName == "fulika")
-	{
-	}
-	else if (typeName == "zidingyi")
-	{
-	}
-}

+ 0 - 18
zhipuzi_pos_windows/control/CDiandanZhifufangshiItemUI.h

@@ -1,18 +0,0 @@
-#pragma once
-
-#include "../pch/pch.h"
-
-class CDiandanZhifufangshiItemUI : public CHorizontalLayoutUI
-{
-public:
-	CDiandanZhifufangshiItemUI();
-	~CDiandanZhifufangshiItemUI();
-
-public:
-	//设置这个支付方式是第几个,根据数量来调整位置
-	void setNum(int num);
-
-	//设置是什么类型,根据类型来展示不同的内容
-	void SetType(std::string typeName);
-};
-

+ 0 - 5
zhipuzi_pos_windows/control/ControlEx.h

@@ -11,7 +11,6 @@
 #include "CDiandanFoodItemUI.h"
 #include "CFoodtypeOptionUI.h"
 #include "CDiandanNatureItemUI.h"
-#include "CDiandanZhifufangshiItemUI.h"
 
 class CDialogBuilderCallbackEx : public IDialogBuilderCallback
 {
@@ -53,10 +52,6 @@ public:
 		{
 			return new CDiandanNatureItemUI;
 		}
-		else if (_tcscmp(pstrClass, _T("DiandanZhifufangshiItem")) == 0)
-		{
-			return new CDiandanZhifufangshiItemUI;
-		}
 
 		return NULL;
 	}

+ 38 - 3
zhipuzi_pos_windows/page/CDiandanPageUI.cpp

@@ -89,9 +89,7 @@ void CDiandanPageUI::InitJiesuanInfo()
 	//抹零
 	m_moling_type = 0;
 
-	CDialogBuilder builder;
-	CDialogBuilderCallbackEx cb;
-	CDiandanZhifufangshiItemUI* pItem = static_cast<CDiandanZhifufangshiItemUI*>(builder.Create(_T("diandan_zhifufangshi_item.xml"), (UINT)0, &cb, m_pManager));
+	CHorizontalLayoutUI* pZhifufangshiLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_jiesuan_zhifufangshi_layout")));
 
 	//添加支付方式
 	int num = 0;
@@ -247,7 +245,44 @@ void CDiandanPageUI::InitJiesuanInfo()
 	}
 
 	//接着添加自定义支付的
+	for (std::vector<SelfPay>::iterator it = shopinfo.m_self_pay.begin(); it != shopinfo.m_self_pay.end(); it++)
+	{
+		SelfPay selfpay = *it;
+
+		if (selfpay.is_open == "1")
+		{
+			CButtonUI* newButton = new CButtonUI();
+
+			newButton->SetFixedWidth(180);
+			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());
 
+			//必须先Add,才能调用下面的SetPos,否则无效
+			pZhifufangshiLayout->Add(newButton);
+
+			int curRow = num / 3 + 1;
+			int curCol = num % 3 + 1;
+
+			RECT rect;
+			rect.left = (curCol - 1) * 200 + 20;
+			rect.right = rect.left + 180;
+			rect.top = (curRow - 1) * 100 + 20;
+			rect.bottom = rect.top + 80;
+
+			newButton->SetFloat(true);
+			newButton->SetPos(rect);
+
+			num++;
+		}
+	}
 }
 
 //处理按钮点击类事件

+ 0 - 2
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -225,7 +225,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClInclude Include="control\CDiandanZhifufangshiItemUI.h" />
     <ClInclude Include="zhipuzi\CShopinfo.h" />
     <ClInclude Include="wnd\CMemoWnd.h" />
     <ClInclude Include="control\CDiandanNatureItemUI.h" />
@@ -273,7 +272,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CSystem.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="control\CDiandanZhifufangshiItemUI.cpp" />
     <ClCompile Include="zhipuzi\CShopinfo.cpp" />
     <ClCompile Include="wnd\CMemoWnd.cpp" />
     <ClCompile Include="control\CDiandanNatureItemUI.cpp" />

+ 0 - 6
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -150,9 +150,6 @@
     <ClInclude Include="zhipuzi\CShopinfo.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="control\CDiandanZhifufangshiItemUI.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -266,9 +263,6 @@
     <ClCompile Include="zhipuzi\CShopinfo.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="control\CDiandanZhifufangshiItemUI.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">