Procházet zdrojové kódy

完成微信支付

张洋 před 4 roky
rodič
revize
91e8fcc38d
73 změnil soubory, kde provedl 2104 přidání a 29 odebrání
  1. binární
      bin/Win32/Debug/zhipuzi_pos_windows/dump/2021-11-19-17-43-42.dmp
  2. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/0.wav
  3. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/1.wav
  4. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/2.wav
  5. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/3.wav
  6. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/4.wav
  7. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/5.wav
  8. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/6.wav
  9. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/7.wav
  10. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/8.wav
  11. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/9.wav
  12. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/hundred.wav
  13. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/pay_cancel.wav
  14. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/pay_fail.wav
  15. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/pay_password.wav
  16. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/pay_success.wav
  17. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/point.wav
  18. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/refund_fail.wav
  19. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/refund_query.wav
  20. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/refund_success.wav
  21. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/shi.wav
  22. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/ten.wav
  23. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/tenthousand.wav
  24. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/thousand.wav
  25. binární
      bin/Win32/Debug/zhipuzi_pos_windows/music/yuan.wav
  26. 1 1
      bin/Win32/Debug/zhipuzi_pos_windows/skin/main.xml
  27. binární
      bin/Win32/Debug/zhipuzi_pos_windows/skin/pay_fail.png
  28. binární
      bin/Win32/Debug/zhipuzi_pos_windows/skin/shoukuan_bkg.png
  29. 92 0
      bin/Win32/Debug/zhipuzi_pos_windows/skin/weixinzhifu_shoukuan_wnd.xml
  30. binární
      bin/Win32/Debug/zhipuzi_pos_windows/skin/wx_logo.png
  31. binární
      bin/Win32/Debug/zhipuzi_pos_windows/skin/zhifubao_logo.png
  32. binární
      res/music/0.wav
  33. binární
      res/music/1.wav
  34. binární
      res/music/2.wav
  35. binární
      res/music/3.wav
  36. binární
      res/music/4.wav
  37. binární
      res/music/5.wav
  38. binární
      res/music/6.wav
  39. binární
      res/music/7.wav
  40. binární
      res/music/8.wav
  41. binární
      res/music/9.wav
  42. binární
      res/music/hundred.wav
  43. binární
      res/music/pay_cancel.wav
  44. binární
      res/music/pay_fail.wav
  45. binární
      res/music/pay_password.wav
  46. binární
      res/music/pay_success.wav
  47. binární
      res/music/point.wav
  48. binární
      res/music/refund_fail.wav
  49. binární
      res/music/refund_query.wav
  50. binární
      res/music/refund_success.wav
  51. binární
      res/music/shi.wav
  52. binární
      res/music/ten.wav
  53. binární
      res/music/tenthousand.wav
  54. binární
      res/music/thousand.wav
  55. binární
      res/music/yuan.wav
  56. 1 1
      zhipuzi_pos_windows/control/CDiandanNatureItemUI.h
  57. 73 2
      zhipuzi_pos_windows/helper/CLewaimaiJson.cpp
  58. 10 1
      zhipuzi_pos_windows/helper/CLewaimaiJson.h
  59. 34 0
      zhipuzi_pos_windows/helper/CRandomHelper.h
  60. 312 0
      zhipuzi_pos_windows/helper/CSpeech.cpp
  61. 33 0
      zhipuzi_pos_windows/helper/CSpeech.h
  62. 11 3
      zhipuzi_pos_windows/helper/define.h
  63. 17 17
      zhipuzi_pos_windows/network/CZhipuziHttpClient.cpp
  64. 198 0
      zhipuzi_pos_windows/page/CDiandanPageUI.cpp
  65. 19 0
      zhipuzi_pos_windows/page/CDiandanPageUI.h
  66. 939 0
      zhipuzi_pos_windows/wnd/CWeixinzhifuShoukuanWnd.cpp
  67. 120 0
      zhipuzi_pos_windows/wnd/CWeixinzhifuShoukuanWnd.h
  68. 48 0
      zhipuzi_pos_windows/zhipuzi/CDiandanOrder.cpp
  69. 8 0
      zhipuzi_pos_windows/zhipuzi/CDiandanOrder.h
  70. 161 2
      zhipuzi_pos_windows/zhipuzi/CDiandanOrderItem.cpp
  71. 11 2
      zhipuzi_pos_windows/zhipuzi/CDiandanOrderItem.h
  72. 4 0
      zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj
  73. 12 0
      zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

binární
bin/Win32/Debug/zhipuzi_pos_windows/dump/2021-11-19-17-43-42.dmp


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/0.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/1.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/2.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/3.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/4.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/5.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/6.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/7.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/8.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/9.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/hundred.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/pay_cancel.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/pay_fail.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/pay_password.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/pay_success.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/point.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/refund_fail.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/refund_query.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/refund_success.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/shi.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/ten.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/tenthousand.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/thousand.wav


binární
bin/Win32/Debug/zhipuzi_pos_windows/music/yuan.wav


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/main.xml


binární
bin/Win32/Debug/zhipuzi_pos_windows/skin/pay_fail.png


binární
bin/Win32/Debug/zhipuzi_pos_windows/skin/shoukuan_bkg.png


+ 92 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/weixinzhifu_shoukuan_wnd.xml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window size="520,410" caption="0,0,0,44" roundcorner="4,4" >
+	<Font id="0" name="微软雅黑" size="24" />
+	<Font id="1" name="微软雅黑" size="40" />
+	<Font id="2" name="微软雅黑" size="18" />
+	<Font id="3" name="微软雅黑" size="32" />
+	<VerticalLayout bkimage="shoukuan_bkg.png" >
+		<HorizontalLayout name="shoukuan_title_bkg" height="44" bkcolor="0xFF3CB371">
+			<Label name="shoukuan_version" text="收款" height="44" align="center" valign="center" padding="0,0,0,0" textcolor="#FFFFFFFF" font="2"/>
+		</HorizontalLayout>
+		
+		<VerticalLayout visible="true" name="shoukuan_before_pay_layout" height="290" padding="0,20,0,0">
+			<HorizontalLayout name="shoukuan_money_input_layout" height="60" padding="0,15,0,0">
+				<Label height="40" padding="190,20,0,10" name="shoukuan_before_pay_huobi" text="¥" font="0" textcolor="0xFF3CB371"></Label>
+				<Edit name="money_edit" float="true" pos="223,0,400,60" font="1" textcolor="0xFF3CB371" bkcolor="0xFFFCFCFC" nativebkcolor="0xFFFCFCFC"/>
+			</HorizontalLayout>
+			
+			<HorizontalLayout name="shoukuan_money_show_layout" height="50" padding="0,15,0,15" visible="false">
+				<Label text="¥" font="0" textcolor="0xFF3CB371" float="true" pos="200,24,215,50"/>
+				<Label name="shoukuan_money_show_money" font="1" textcolor="0xFF3CB371" float="true" pos="225,12,500,48"/>
+			</HorizontalLayout>
+			
+			<HorizontalLayout height="50" padding="0,15,0,0">
+				<Label text="付款码:" font="2" float="true" pos="100,12,180,40"/>
+				<Edit name="fukuanma_edit" float="true" pos="183,12,400,48" normalimage="file='Chat_InputBox_BG.png' corner='4,4,4,4'" hotimage="file='Chat_InputBox_BG_Hover.png' corner='4,4,4,4'" />
+			</HorizontalLayout>
+			
+			<HorizontalLayout height="60" padding="0,30,0,0">
+				<Control></Control>
+				<Button name="shoukuanBtn" text="确认" font="2" textcolor="#FFFFFFFF" height="50" width="150" padding="0,0,0,0" tooltip="点击这里确认收款" normalimage="file='Btn_Green.png' corner='5,5,5,5'" hotimage="file='Btn_Green_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" />
+				<Button name="closebtn" text="关闭" font="2" textcolor="#FFFFFFFF" height="50" width="150" padding="20,0,0,0" tooltip="点击这里取消收款" normalimage="file='Btn_Red.png' corner='5,5,5,5'" hotimage="file='Btn_Red_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" />
+				<Control></Control>
+			</HorizontalLayout>	
+
+			<HorizontalLayout height="50" padding="0,20,0,0">
+				<Control></Control>
+				<Label name="shoukuanresult" font="2" width="400" height="50" multiline="true" text="" visible="false" textcolor="#FF0000" align="center" />
+				<Control></Control>
+			</HorizontalLayout>			
+		</VerticalLayout>
+		
+		<VerticalLayout name="shoukuan_paying_layout" visible="false">
+			<HorizontalLayout name="shoukuan_paying_loading" height="24" padding="0, 20, 0, 20">
+				<Control></Control>
+				<VerticalLayout width="24">
+					<Control></Control>
+					<HorizontalLayout height="24">
+						<GifAnim bkimage="loading.gif" autosize="true"></GifAnim>
+					</HorizontalLayout>
+					<Control></Control>
+				</VerticalLayout>
+				<Control></Control>
+			</HorizontalLayout>
+			
+			<Label height="40" padding="0,10,0,10" name="shoukuan_paying_money" text="收款金额:" font="3" textcolor="0xFF3CB371" align="center"></Label>
+			
+			<Label height="32" padding="0,10,0,10" name="shoukuan_paying_status" text="请求支付中..." font="2" textcolor="0xFF3CB371" align="center"></Label>
+			
+			<Label height="60" padding="20,30,20,0" name="shouyin_paying_attention" text="如果用户没有支付成功,则请确认客户不再进行支付时再关闭此窗口,按【Esc】取消本次支付" font="2" textcolor="0xFF808080" multiline="true" align="center" />
+		</VerticalLayout>
+		
+		<VerticalLayout name="shoukuan_pay_success_layout" visible="false">
+			<HorizontalLayout name="shoukuan_pay_success_logo_wx" height="100" padding="0,20,0,0" visible="false">
+				<Control></Control>
+				<Control bkimage="wx_logo.png" width="100" height="100" align="center"></Control>
+				<Control></Control>
+			</HorizontalLayout>
+			
+			<HorizontalLayout name="shoukuan_pay_success_logo_zhifubao" height="100" padding="0,20,0,0" visible="false">
+				<Control></Control>
+				<Control bkimage="zhifubao_logo.png"  width="100" height="100" align="center"></Control>
+				<Control></Control>
+			</HorizontalLayout>
+			
+			<Label height="40" padding="0,20,0,20" name="shoukuan_pay_success_money" text="成功收款:" font="3" textcolor="0xFF3CB371" align="center"></Label>
+			
+			<Label height="60" padding="20,30,20,0" name="shouyin_pay_success_attention" text="按任意键关闭窗口" font="2" textcolor="0xFF808080" multiline="true" align="center" />
+		</VerticalLayout>
+		
+		<VerticalLayout name="shoukuan_pay_fail_layout" visible="false">
+			<HorizontalLayout height="100" padding="0,20,0,0">
+				<Control></Control>
+				<Control bkimage="pay_fail.png" width="100" height="100" align="center"></Control>
+				<Control></Control>
+			</HorizontalLayout>
+			
+			<Label height="40" padding="0,20,0,20" name="shoukuan_pay_fail_money" text="订单支付失败" font="3" textcolor="0xFFD33E3A" align="center"></Label>
+			
+			<Label height="60" padding="20,30,20,0" name="shouyin_pay_fail_attention" text="" font="2" textcolor="0xFF808080" multiline="true" align="center" />
+		</VerticalLayout>
+    </VerticalLayout>
+</Window>

binární
bin/Win32/Debug/zhipuzi_pos_windows/skin/wx_logo.png


binární
bin/Win32/Debug/zhipuzi_pos_windows/skin/zhifubao_logo.png


binární
res/music/0.wav


binární
res/music/1.wav


binární
res/music/2.wav


binární
res/music/3.wav


binární
res/music/4.wav


binární
res/music/5.wav


binární
res/music/6.wav


binární
res/music/7.wav


binární
res/music/8.wav


binární
res/music/9.wav


binární
res/music/hundred.wav


binární
res/music/pay_cancel.wav


binární
res/music/pay_fail.wav


binární
res/music/pay_password.wav


binární
res/music/pay_success.wav


binární
res/music/point.wav


binární
res/music/refund_fail.wav


binární
res/music/refund_query.wav


binární
res/music/refund_success.wav


binární
res/music/shi.wav


binární
res/music/ten.wav


binární
res/music/tenthousand.wav


binární
res/music/thousand.wav


binární
res/music/yuan.wav


+ 1 - 1
zhipuzi_pos_windows/control/CDiandanNatureItemUI.h

@@ -20,7 +20,7 @@ public:
 	int nNameIndex; //属性名字在所有属性中的顺序
 	std::string nature_select_name; //选中的属性值名字
 	int nature_select_index; //选中的属性值属于第几个属性
-	int nature_select_value; //选中的属性值的价格
+	double nature_select_value; //选中的属性值的价格
 };
 
 //这个对应的是属性弹框里面的一个属性

+ 73 - 2
zhipuzi_pos_windows/helper/CLewaimaiJson.cpp

@@ -18,9 +18,9 @@ std::string CLewaimaiJson::JsonToString(const rapidjson::Value& valObj)
 	return std::string(sbBuf.GetString());
 }
 
-rapidjson::Document CLewaimaiJson::StringToJson(std::string jsonString)
+rapidjson::Document CLewaimaiJson::StringToJson(std::string jsonString, rapidjson::Document::AllocatorType &allocator)
 {
-	rapidjson::Document document;
+	rapidjson::Document document(&allocator);
 	document.Parse(jsonString.c_str());
 
 	if (document.HasParseError())
@@ -30,3 +30,74 @@ rapidjson::Document CLewaimaiJson::StringToJson(std::string jsonString)
 
 	return document;
 }
+
+//把一个数组转化成json变量,数组的每个元素是一个map,map的key是json的名字,map的value是json的value
+rapidjson::Document CLewaimaiJson::ParamArrayToJson(std::vector<std::map<string, string>> paramArray, rapidjson::Document::AllocatorType &allocator)
+{
+	rapidjson::Document doc(&allocator);
+
+	doc.SetArray();
+
+	for (std::vector<std::map<string, string>>::iterator it = paramArray.begin(); it != paramArray.end(); it++)
+	{
+		rapidjson::Value array_object(rapidjson::kObjectType);
+
+		for (std::map<string, string>::iterator m_it = it->begin(); m_it != it->end(); m_it++)
+		{
+			Value key;
+			Value value;
+			key.SetString(m_it->first.c_str(), m_it->first.length(), allocator);
+			value.SetString(m_it->second.c_str(), m_it->second.length(), allocator);
+
+			array_object.AddMember(key, value, allocator);
+		}
+
+		doc.PushBack(array_object, allocator);
+	}
+
+	return doc;
+}
+
+//把一个数组转化成json字符串,数组的每个元素是一个map,map的key是json的名字,map的value是json的value
+std::string CLewaimaiJson::ParamArrayToJsonstring(std::vector<std::map<string, string>> paramArray)
+{
+	rapidjson::Document doc;
+	rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //获取分配器
+
+	Value& data = CLewaimaiJson::ParamArrayToJson(paramArray, allocator);
+
+	rapidjson::StringBuffer buffer;
+	rapidjson::Writer<StringBuffer> writer(buffer);
+	data.Accept(writer);
+
+	std::string result = buffer.GetString();
+
+	return result;
+}
+
+//把一个map转化成json字符串,map的key是json的名字,map的value是json的value
+std::string CLewaimaiJson::ParamMapToJsonstring(std::map<string, string> param)
+{
+	rapidjson::Document doc;
+	rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //获取分配器
+
+	doc.SetObject();
+
+	for (std::map<string, string>::iterator m_it = param.begin(); m_it != param.end(); m_it++)
+	{
+		Value key;
+		Value value;
+		key.SetString(m_it->first.c_str(), m_it->first.length(), allocator);
+		value.SetString(m_it->second.c_str(), m_it->second.length(), allocator);
+
+		doc.AddMember(key, value, allocator);
+	}
+
+	rapidjson::StringBuffer buffer;
+	rapidjson::Writer<StringBuffer> writer(buffer);
+	doc.Accept(writer);
+
+	std::string result = buffer.GetString();
+
+	return result;
+}

+ 10 - 1
zhipuzi_pos_windows/helper/CLewaimaiJson.h

@@ -22,6 +22,15 @@ public:
 
 	static std::string JsonToString(const rapidjson::Value& valObj);
 
-	static rapidjson::Document StringToJson(std::string jsonString);
+	static rapidjson::Document StringToJson(std::string jsonString, rapidjson::Document::AllocatorType &allocator);
+
+	//把一个数组转化成json变量,数组的每个元素是一个map,map的key是json的名字,map的value是json的value
+	static rapidjson::Document ParamArrayToJson(std::vector<std::map<string, string>> paramArray, rapidjson::Document::AllocatorType &allocator);
+
+	//把一个数组转化成json字符串,数组的每个元素是一个map,map的key是json的名字,map的value是json的value
+	static std::string ParamArrayToJsonstring(std::vector<std::map<string,string>> paramArray);
+
+	//把一个map转化成json字符串,map的key是json的名字,map的value是json的value
+	static std::string ParamMapToJsonstring(std::map<string, string> param);
 };
 

+ 34 - 0
zhipuzi_pos_windows/helper/CRandomHelper.h

@@ -35,6 +35,40 @@ public:
 		next_seed = seed;
 	}
 
+	static std::string GetRandString(int nLength, bool isOnlyShuzi = false)
+	{
+		const char CCH[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+		const char CCH_SHUZI[] = "0123456789";
+
+		srand((unsigned)time(NULL));
+
+		char* ch = new char[nLength + 1];
+		memset(ch, 0, nLength + 1);
+
+		for (int i = 0; i < nLength; i++)
+		{
+			if (isOnlyShuzi == false)
+			{
+				int x = rand() / (RAND_MAX / (sizeof(CCH) - 1));
+
+				ch[i] = CCH[x];
+			}
+			else
+			{
+				int x = rand() / (RAND_MAX / (sizeof(CCH_SHUZI) - 1));
+
+				ch[i] = CCH_SHUZI[x];
+			}
+		}
+
+		std::string res = ch;
+
+		delete[] ch;
+
+		return res;
+	}
+
 private:
 	unsigned long next_seed = 1;
 };

+ 312 - 0
zhipuzi_pos_windows/helper/CSpeech.cpp

@@ -0,0 +1,312 @@
+#include "../pch/pch.h"
+#include "CSpeech.h"
+
+
+
+CSpeech::CSpeech()
+{
+}
+
+
+CSpeech::~CSpeech()
+{
+}
+
+void CSpeech::MSSSpeak(LPCTSTR speakContent)// speakContent为LPCTSTR型的字符串,调用此函数即可将文字转为语音
+{
+	ISpVoice* pVoice = NULL;
+
+	//初始化COM接口
+
+	if (FAILED(::CoInitialize(NULL)))
+	{
+		MessageBox(NULL, (LPCWSTR)L"COM接口初始化失败!", (LPCWSTR)L"提示", MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2);
+	}
+
+	//获取SpVoice接口
+
+	HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void**)&pVoice);
+
+
+	if (SUCCEEDED(hr))
+	{
+		pVoice->SetVolume((USHORT)100); //设置音量,范围是 0 -100
+		pVoice->SetRate(2); //设置速度,范围是 -10 - 10
+		hr = pVoice->Speak(speakContent, 0, NULL);
+
+		pVoice->Release();
+
+		pVoice = NULL;
+	}
+
+	//释放com资源
+	::CoUninitialize();
+}
+
+/*
+ *如果只是一个0,读不读
+ **/
+void CSpeech::SpeakIntXiaoyuWan(int new_num, bool is_after_wan)
+{
+	std::wstring path;
+
+	if (new_num < 10)
+	{
+		if (is_after_wan == true)
+		{
+			if (new_num == 0)
+			{
+
+			}
+			else
+			{
+				path = CSystem::GetProgramDir() + L"\\music\\0.wav";
+				PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+
+				path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(new_num) + L".wav";
+				PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+			}
+		}
+		else
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(new_num) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}		
+	}
+	else if (new_num >= 10 && new_num <= 99)
+	{
+		int shi_wei = new_num / 10;
+		int ge_wei = new_num % 10;
+
+		if (is_after_wan == true && (shi_wei > 0 || ge_wei > 0))
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\0.wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+
+		if (shi_wei > 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(shi_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+		else if (is_after_wan == true && shi_wei == 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(shi_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+
+		path = CSystem::GetProgramDir() + L"\\music\\shi.wav";
+		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+
+		if (ge_wei >= 1)
+		{
+			//如果个位数为0,就不读
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(ge_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+	}
+	else if (new_num >= 100 && new_num <= 999)
+	{
+		int bai_wei = new_num / 100;
+		int shi_wei = (new_num / 10) % 10;
+		int ge_wei = new_num % 10;
+
+		if (is_after_wan == true && (bai_wei > 0 || shi_wei > 0 || ge_wei > 0))
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\0.wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+
+		if (bai_wei >= 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(bai_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+
+		path = CSystem::GetProgramDir() + L"\\music\\hundred.wav";
+		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+
+		if (shi_wei == 0)
+		{
+			if (ge_wei >= 1)
+			{
+				path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(shi_wei) + L".wav";
+				PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+			}
+		}
+		else
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(shi_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+
+		if (shi_wei >= 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\shi.wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+
+		if (ge_wei >= 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(ge_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+	}
+	else if (new_num >= 1000 && new_num <= 9999)
+	{
+		int qian_wei = new_num / 1000;
+
+		if (qian_wei >= 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(qian_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+
+		path = CSystem::GetProgramDir() + L"\\music\\thousand.wav";
+		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+
+		int bai_wei = (new_num / 100) % 10;
+		int shi_wei = (new_num / 10) % 10;
+		int ge_wei = new_num % 10;
+
+		if (bai_wei >= 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(bai_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+
+			path = CSystem::GetProgramDir() + L"\\music\\hundred.wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+		else
+		{
+			if (shi_wei >= 1 || ge_wei >= 1)
+			{
+				path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(bai_wei) + L".wav";
+				PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+			}
+		}
+
+		if (shi_wei == 0)
+		{
+			if (ge_wei >= 1 && bai_wei >= 1)
+			{
+				path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(shi_wei) + L".wav";
+				PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+			}
+		}
+		else
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(shi_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+
+		if (shi_wei >= 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\shi.wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}		
+
+		if (ge_wei >= 1)
+		{
+			path = CSystem::GetProgramDir() + L"\\music\\" + to_wstring(ge_wei) + L".wav";
+			PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+		}
+	}
+}
+
+/*
+ *读一个整数
+ **/
+void CSpeech::SpeakInt(int num)
+{
+	wstring path;
+
+	if (num > 99999999)
+	{
+		return;
+	}
+
+	if (num >= 10000)
+	{
+		//大于1万的
+		int new_num = num / 10000;
+
+		CSpeech::SpeakIntXiaoyuWan(new_num);
+
+		path = CSystem::GetProgramDir() + L"\\music\\tenthousand.wav";
+		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+
+		new_num = num % 10000;
+
+		CSpeech::SpeakIntXiaoyuWan(new_num, true);
+	}
+	else
+	{
+		//小于1万的
+		CSpeech::SpeakIntXiaoyuWan(num);
+	}
+}
+
+/*
+ *把数字拆解成一个个的读音,调用wav文件播放
+ *voice_type 1:收款成功 2:退款成功
+ *num 金额,比如18.23
+ **/
+void CSpeech::SpeakNum(int voice_type, std::string num)
+{
+	wstring path;
+
+	if (voice_type == 1)
+	{
+		path = CSystem::GetProgramDir() + L"\\music\\pay_success.wav";
+		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+	}
+	else if (voice_type == 2)
+	{
+		path = CSystem::GetProgramDir() + L"\\music\\refund_success.wav";
+		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+	}
+
+	if (num.find(".") == std::string::npos)
+	{
+		//当整数处理
+		int n_num = atoi(num.c_str());
+		if (n_num == 0)
+		{
+			return;
+		}
+
+		CSpeech::SpeakInt(n_num);
+	}
+	else
+	{
+		//当小数处理
+		double d_num = atof(num.c_str());
+		if (d_num < 0.00001)
+		{
+			//无效的转换
+			return;
+		}
+
+		int n_num = (int)d_num;
+
+		CSpeech::SpeakInt(n_num);
+
+		path = CSystem::GetProgramDir() + L"\\music\\point.wav";
+		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+
+		//准备读小数部分
+		int nPos = num.find(".");
+		std::string s_xiaoshu = num.substr(nPos + 1);
+
+		for (size_t i = 0; i < s_xiaoshu.length(); i++)
+		{
+			int n = atoi(s_xiaoshu.substr(i, 1).c_str());
+
+			CSpeech::SpeakInt(n);
+		}
+	}
+
+	path = CSystem::GetProgramDir() + L"\\music\\yuan.wav";
+	PlaySound(path.c_str(), NULL, SND_FILENAME | SND_SYNC);
+}

+ 33 - 0
zhipuzi_pos_windows/helper/CSpeech.h

@@ -0,0 +1,33 @@
+#pragma once
+
+#define _ATL_APARTMENT_THREADED
+#include <stdio.h>
+#include <atlbase.h>
+#include <atlcom.h>
+
+#include <sapi.h>
+
+class CSpeech
+{
+public:
+    CSpeech();
+    ~CSpeech();
+
+	// speakContent为LPCTSTR型的字符串,调用此函数即可将文字转为语音
+	static void MSSSpeak(LPCTSTR speakContent);
+
+	static void SpeakIntXiaoyuWan(int new_num, bool is_after_wan = false);
+
+	/*
+	 *读一个整数
+	 **/
+	static void SpeakInt(int num);
+
+    /*
+     *把数字拆解成一个个的读音,调用wav文件播放
+     *voice_type 1:收款成功 2:退款成功
+     *num 金额,比如18.23
+     **/
+	static void SpeakNum(int voice_type, std::string num);
+};
+

+ 11 - 3
zhipuzi_pos_windows/helper/define.h

@@ -14,8 +14,16 @@
 #define WM_LOGIN_AGAIN_OUT 10009
 #define WM_LOGIN_START_INIT_DATA 10010
 
-//会员相关消息
-#define WM_MEMBER_CHECK_FAIL 10011
-#define WM_MEMBER_CHECK_SUCCESS 10012
+//收款支付相关
+#define WM_SHOUKUAN_STATUS_NEEDPASSWORD 10100
+#define WM_SHOUKUAN_STATUS_SUCCESS 10101
+#define WM_SHOUKUAN_STATUS_FAIL 10102
+
+#define WM_TUIKUAN_STATUS_SUCCESS 10103
+#define WM_TUIKUAN_STATUS_FAIL 10104
+#define WM_TUIKUAN_STATUS_NEEDPASSWORD 10105
 
+//会员相关消息
+#define WM_MEMBER_CHECK_FAIL 10200
+#define WM_MEMBER_CHECK_SUCCESS 10201
 

+ 17 - 17
zhipuzi_pos_windows/network/CZhipuziHttpClient.cpp

@@ -88,7 +88,7 @@ bool CZhipuziHttpClient::Login(std::string& errmsg)
 		return false;
 	}
 
-	LOG_INFO("response:" << response.c_str());
+	//LOG_INFO("response:" << response.c_str());
 
     rapidjson::Document document;
     document.Parse(response.c_str());
@@ -170,7 +170,7 @@ bool CZhipuziHttpClient::Request(std::string url, std::map<string, string> param
 		}
 	}
 
-	LOG_INFO("postString:" << postString.c_str());
+	//LOG_INFO("postString:" << postString.c_str());
 
 	//用于计算签名的临时变量
 	std::string password = md5(m_client.m_password);
@@ -180,7 +180,7 @@ bool CZhipuziHttpClient::Request(std::string url, std::map<string, string> param
 
 	std::string sign = md5(tmp);
 	transform(sign.begin(), sign.end(), sign.begin(), ::toupper);
-	LOG_INFO("sign:" << sign.c_str());
+	//LOG_INFO("sign:" << sign.c_str());
 
 	//加上签名,去掉url,计算post
 	params["sign"] = sign;
@@ -200,12 +200,12 @@ bool CZhipuziHttpClient::Request(std::string url, std::map<string, string> param
 		}
 	}
 
-	LOG_INFO("postString:" << postString.c_str());
+	//LOG_INFO("postString:" << postString.c_str());
 
 	CHttpClient m_httpClient;
 	int ret = m_httpClient.Posts(m_client.m_yewu_url + url, postString, response, NULL, m_client.m_http_proxy);
 
-	LOG_INFO("response:" << response.c_str());
+	//LOG_INFO("response:" << response.c_str());
 
 	if (ret == 0)
 	{
@@ -247,7 +247,7 @@ bool CZhipuziHttpClient::RequestNew(std::string url, std::map<string, string> pa
 		}
 	}
 
-	LOG_INFO("postString:" << postString.c_str());
+	//LOG_INFO("postString:" << postString.c_str());
 
 	//用于计算签名的临时变量
 	string tmp = md5(postString);
@@ -255,7 +255,7 @@ bool CZhipuziHttpClient::RequestNew(std::string url, std::map<string, string> pa
 
 	std::string sign = md5(tmp);
 	transform(sign.begin(), sign.end(), sign.begin(), ::toupper);
-	LOG_INFO("sign:" << sign.c_str());
+	//LOG_INFO("sign:" << sign.c_str());
 
 	//加上签名,去掉url,计算post
 	params["sign"] = sign;
@@ -273,12 +273,12 @@ bool CZhipuziHttpClient::RequestNew(std::string url, std::map<string, string> pa
 		}
 	}
 
-	LOG_INFO("postString:" << postString.c_str());
+	//LOG_INFO("postString:" << postString.c_str());
 
 	CHttpClient m_httpClient;
 	int ret = m_httpClient.Posts(m_client.m_yewu_url + url, postString, response, NULL, m_client.m_http_proxy);
 
-	LOG_INFO("response:" << response.c_str());
+	//LOG_INFO("response:" << response.c_str());
 
 	if (ret == 0)
 	{
@@ -314,7 +314,7 @@ bool CZhipuziHttpClient::RequestPingtai(std::string url, std::map<string, string
 		}
 	}
 
-	LOG_INFO("postString:" << postString.c_str());
+	//LOG_INFO("postString:" << postString.c_str());
 
 	//用于计算签名的临时变量
 	std::string password = md5(m_client.m_password);
@@ -324,7 +324,7 @@ bool CZhipuziHttpClient::RequestPingtai(std::string url, std::map<string, string
 
 	std::string sign = md5(tmp);
 	transform(sign.begin(), sign.end(), sign.begin(), ::toupper);
-	LOG_INFO("sign:" << sign.c_str());
+	//LOG_INFO("sign:" << sign.c_str());
 
 	//加上签名,去掉url,计算post
 	params["sign"] = sign;
@@ -344,12 +344,12 @@ bool CZhipuziHttpClient::RequestPingtai(std::string url, std::map<string, string
 		}
 	}
 
-	LOG_INFO("postString:" << postString.c_str());
+	//LOG_INFO("postString:" << postString.c_str());
 
 	CHttpClient m_httpClient;
 	int ret = m_httpClient.Posts(m_client.m_pingtai_url + url, postString, response, NULL, m_client.m_http_proxy);
 
-	LOG_INFO("response:" << response.c_str());
+	//LOG_INFO("response:" << response.c_str());
 
 	if (ret == 0)
 	{
@@ -389,7 +389,7 @@ bool CZhipuziHttpClient::RequestPingtaiNew(std::string url, std::map<string, str
 		}
 	}
 
-	LOG_INFO("postString:" << postString.c_str());
+	//LOG_INFO("postString:" << postString.c_str());
 
 	//用于计算签名的临时变量
 	string tmp = md5(postString);
@@ -397,7 +397,7 @@ bool CZhipuziHttpClient::RequestPingtaiNew(std::string url, std::map<string, str
 
 	std::string sign = md5(tmp);
 	transform(sign.begin(), sign.end(), sign.begin(), ::toupper);
-	LOG_INFO("sign:" << sign.c_str());
+	//LOG_INFO("sign:" << sign.c_str());
 
 	//加上签名,去掉url,计算post
 	params["sign"] = sign;
@@ -415,12 +415,12 @@ bool CZhipuziHttpClient::RequestPingtaiNew(std::string url, std::map<string, str
 		}
 	}
 
-	LOG_INFO("postString:" << postString.c_str());
+	//LOG_INFO("postString:" << postString.c_str());
 
 	CHttpClient m_httpClient;
 	int ret = m_httpClient.Posts(m_client.m_pingtai_url + url, postString, response, NULL, m_client.m_http_proxy);
 
-	LOG_INFO("response:" << response.c_str());
+	//LOG_INFO("response:" << response.c_str());
 
 	if (ret == 0)
 	{

+ 198 - 0
zhipuzi_pos_windows/page/CDiandanPageUI.cpp

@@ -17,6 +17,7 @@
 #include "../wnd/CSaomaCikaWnd.h"
 #include "../wnd/CSaomaQuanyikaWnd.h"
 #include "../wnd/CCanpaiWnd.h"
+#include "../wnd/CWeixinzhifuShoukuanWnd.h"
 
 CDiandanPageUI::CDiandanPageUI()
 {
@@ -73,6 +74,11 @@ void CDiandanPageUI::InitJiesuanInfo()
 {
 	CShopinfo shopinfo = CShopinfo::m_shopinfo;
 
+	//清空购物车
+	m_cur_diandan_order.Clear();
+
+	this->ClearDiandanOrderItemShow();
+
 	//先清空会员登录状态
 	m_is_member = false;
 
@@ -82,6 +88,9 @@ void CDiandanPageUI::InitJiesuanInfo()
 	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 = "";
 
@@ -432,6 +441,11 @@ void CDiandanPageUI::HandleClickMsg(TNotifyUI& msg)
 		//点击餐牌号
 		this->ClickCanpai();
 	}
+	else if (name == L"btn_diandan_weixinzhifu_pay")
+	{
+		//点击微信支付
+		this->StartWeixinzhifuShoukuan();
+	}
 }
 
 //处理option切换事件
@@ -788,6 +802,9 @@ void CDiandanPageUI::UpdateJiesuanInfo()
 
 	cur_price = (double)(cur_price * zhekouValue) / 100.00;
 
+	//保留2位小数
+	cur_price = (int)(cur_price * 100) / 100.00;
+
 	m_zhekou_youhui = old_cur_price - cur_price;
 
 	totol_youhui += m_zhekou_youhui;
@@ -805,6 +822,9 @@ void CDiandanPageUI::UpdateJiesuanInfo()
 		{
 			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());
 
 				//这里最多是10折
@@ -812,6 +832,9 @@ void CDiandanPageUI::UpdateJiesuanInfo()
 
 				cur_price = (double)(cur_price * member_discount) / 10.00;
 
+				//保留2位小数
+				cur_price = (int)(cur_price * 100) / 100.00;
+
 				m_member_zhekou_youhui = old_cur_price_member_discount - cur_price;
 
 				totol_youhui += m_member_zhekou_youhui;
@@ -833,6 +856,9 @@ void CDiandanPageUI::UpdateJiesuanInfo()
 
 		cur_price = (double)(cur_price * quanyika_zhekou) / 10.00;
 
+		//保留2位小数
+		cur_price = (int)(cur_price * 100) / 100.00;
+
 		m_quanyika_youhui = old_cur_price_quanyika_discount - cur_price;
 
 		totol_youhui += m_quanyika_youhui;
@@ -851,6 +877,9 @@ void CDiandanPageUI::UpdateJiesuanInfo()
 
 			cur_price = (double)(cur_price * cika_zhekou) / 10.00;
 
+			//保留2位小数
+			cur_price = (int)(cur_price * 100) / 100.00;
+
 			m_cika_youhui = old_cur_price_cika_discount - cur_price;
 
 			totol_youhui += m_cika_youhui;
@@ -986,6 +1015,10 @@ void CDiandanPageUI::UpdateJiesuanInfo()
 		cur_price = 0;
 	}
 
+	m_cur_total_price = cur_price;
+
+	m_total_youhui = totol_youhui;
+
 	//至此优惠全部处理完了,开始刷新各个地方的展示
 
 	//先刷新优惠展示
@@ -2023,4 +2056,169 @@ void CDiandanPageUI::ClickCanpai()
 			return;
 		}
 	}
+}
+
+void CDiandanPageUI::StartWeixinzhifuShoukuan()
+{
+	if (m_is_show_shoukuan == true)
+	{
+		return;
+	}
+
+	CWeixinzhifuShoukuanWnd* pShoukuanWnd = new CWeixinzhifuShoukuanWnd;
+	if (pShoukuanWnd != NULL)
+	{
+		pShoukuanWnd->Create(NULL, _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
+		pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
+		pShoukuanWnd->CenterWindow();
+
+		m_is_show_shoukuan = true;
+
+		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)
+		{
+			//说明收款成功了,需要进行一些后续的处理
+
+			//初始化页面信息
+			InitJiesuanInfo();
+
+			//处理打印
+
+		}
+
+		delete pShoukuanWnd;
+	}
+}
+
+//获取通用参数,任何支付方式都要用到的参数,个性化参数在弹框里面处理
+//参考文档 http://apidoc.zhipuzi.com/index.php/home/item/show?item_id=4
+std::map<string, string> CDiandanPageUI::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;
+	}
+
+	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;
 }

+ 19 - 0
zhipuzi_pos_windows/page/CDiandanPageUI.h

@@ -114,6 +114,13 @@ public:
 	//点击餐牌号按钮
 	void ClickCanpai();
 
+	//开始进行微信支付收款
+	void StartWeixinzhifuShoukuan();
+
+private:
+	//获取用于提交订单的参数结构
+	std::map<string, string> GetSendorderParams();
+
 private:
 	CTileLayoutUI* m_foodLayout;
 	CHorizontalLayoutUI* m_foodtypeLayout;
@@ -134,6 +141,10 @@ private:
 	CDiandanOrder m_cur_diandan_order;
 
 	//下面是结算相关信息
+
+	//总的优惠
+	double m_total_youhui;
+
 	double m_zhekou_youhui;
 
 	//人工加价
@@ -196,12 +207,20 @@ private:
 	std::string m_member_level_id;
 
 	double m_total_member_youhui; //会员商品优惠
+
+	bool m_is_member_zhekou = false;
+	std::string m_member_zhekou_value; //具体会员打几折
 	double m_member_zhekou_youhui; //会员店铺折扣优惠
 
 	//满减
 	double m_manjian_youhui;
 
+	//当前应收总价
+	double m_cur_total_price;
+
 	//餐牌
 	std::string m_canpai;
+
+	bool m_is_show_shoukuan = false;
 };
 

+ 939 - 0
zhipuzi_pos_windows/wnd/CWeixinzhifuShoukuanWnd.cpp

@@ -0,0 +1,939 @@
+#include "../pch/pch.h"
+#include "CWeixinzhifuShoukuanWnd.h"
+
+#include "CMessageboxWnd.h"
+
+#include "../helper/CSpeech.h"
+
+#define WM_TIMER_WND_CLOSE 200001
+
+void CWeixinzhifuShoukuanWnd::Init()
+{
+	//::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
+}
+
+void CWeixinzhifuShoukuanWnd::Notify(TNotifyUI& msg)
+{
+	if (msg.sType == _T("click"))
+	{
+		if (msg.pSender->GetName() == _T("closebtn"))
+		{
+			Close(IDCANCEL);
+			return;
+		}
+		else if (msg.pSender->GetName() == _T("shoukuanBtn"))
+		{
+			StartShoukuan();
+		}
+	}
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
+	styleValue &= ~WS_CAPTION;
+	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
+
+	// 把自己的窗口句柄与窗口绘制管理器挂接在一起
+	m_pm.Init(m_hWnd);
+	m_pm.AddPreMessageFilter(this);
+
+	CDialogBuilder builder;
+
+	CControlUI* pRoot = builder.Create(_T("weixinzhifu_shoukuan_wnd.xml"), (UINT)0, NULL, &m_pm);
+	ASSERT(pRoot && "Failed to parse XML");
+
+	// 把这些控件绘制到本窗口上
+	m_pm.AttachDialog(pRoot);
+
+	// 把自己加入到CPaintManagerUI的m_aNotifiers数组中,用于处理Notify函数
+	m_pm.AddNotifier(this);
+
+	Init();
+
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	//销毁定时器
+	KillTimer(m_hWnd, WM_TIMER_WND_CLOSE);
+
+	bHandled = FALSE;
+	return 0;
+}
+
+/*
+ *这个是窗口被销毁的时候调用的
+ **/
+LRESULT CWeixinzhifuShoukuanWnd::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	bHandled = FALSE;
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	if (::IsIconic(*this))
+	{
+		bHandled = FALSE;
+	}
+
+	return (wParam == 0) ? TRUE : FALSE;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	UpdateFocus();
+
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	POINT pt;
+	pt.x = GET_X_LPARAM(lParam);
+	pt.y = GET_Y_LPARAM(lParam);
+	::ScreenToClient(*this, &pt);
+
+	RECT rcClient;
+	::GetClientRect(*this, &rcClient);
+
+	RECT rcCaption = m_pm.GetCaptionRect();
+	if (pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
+		&& pt.y >= rcCaption.top && pt.y < rcCaption.bottom)
+	{
+		CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(pt));
+		if (pControl && _tcscmp(pControl->GetClass(), DUI_CTR_BUTTON) != 0)
+		{
+			return HTCAPTION;
+		}
+	}
+
+	return HTCLIENT;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	SIZE szRoundCorner = m_pm.GetRoundCorner();
+	if (!::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0))
+	{
+		CDuiRect rcWnd;
+		::GetWindowRect(*this, &rcWnd);
+		rcWnd.Offset(-rcWnd.left, -rcWnd.top);
+		rcWnd.right++;
+		rcWnd.bottom++;
+		HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
+		::SetWindowRgn(*this, hRgn, TRUE);
+		::DeleteObject(hRgn);
+	}
+
+	bHandled = FALSE;
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	bHandled = TRUE;
+
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	if (wParam != WM_TIMER_WND_CLOSE)
+	{
+		bHandled = FALSE;
+		return 0;
+	}
+
+	if (m_shoukuan_status == 0 || m_shoukuan_status == 1)
+	{
+	}
+	else if (m_shoukuan_status == 2)
+	{
+	}
+	else if (m_shoukuan_status == 3)
+	{
+		m_timer_now--;
+
+		if (m_timer_now > 0)
+		{
+			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());
+		}
+		else
+		{
+			Close(IDOK);
+		}
+	}
+	else if (m_shoukuan_status == 4)
+	{
+		m_timer_now--;
+
+		if (m_timer_now > 0)
+		{
+			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());
+		}
+		else
+		{
+			Close(IDCANCEL);
+		}
+	}
+
+	bHandled = TRUE;
+
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+	LRESULT lRes = 0;
+	BOOL bHandled = TRUE;
+	switch (uMsg)
+	{
+	case WM_CREATE:
+		lRes = OnCreate(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_CLOSE:
+		lRes = OnClose(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_DESTROY:
+		lRes = OnDestroy(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCACTIVATE:
+		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCCALCSIZE:
+		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCPAINT:
+		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCHITTEST:
+		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_SIZE:
+		lRes = OnSize(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_MOUSEHOVER:
+		lRes = OnMouseMove(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_SHOUKUAN_STATUS_NEEDPASSWORD:
+		lRes = OnShoukuanNeedPassword(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_SHOUKUAN_STATUS_SUCCESS:
+		lRes = OnShoukuanSuccess(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_SHOUKUAN_STATUS_FAIL:
+		lRes = OnShoukuanFail(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_TIMER:
+		lRes = OnTimer(uMsg, wParam, lParam, bHandled);
+		break;
+	default:
+		bHandled = FALSE;
+	}
+
+	if (bHandled)
+	{	
+		return lRes;
+	}
+	if (m_pm.MessageHandler(uMsg, wParam, lParam, lRes))
+	{
+		return lRes;
+	}
+
+	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
+{
+	if (uMsg == WM_KEYDOWN)
+	{
+		if (wParam == VK_RETURN)
+		{
+			if (m_shoukuan_status == 0)
+			{
+				StartShoukuan();
+			}
+			else if (m_shoukuan_status == 1 || m_shoukuan_status == 2 || m_shoukuan_status == 5)
+			{
+				//正在支付的过程中,这个时候按Enter键,不做任何处理
+			}
+			else if (m_shoukuan_status == 3)
+			{
+				//已经明确成功或者失败了,那么久直接关闭就可以了
+				Close(IDOK);
+			}
+			else if (m_shoukuan_status == 4)
+			{
+				Close(IDCANCEL);
+			}
+
+			return true;
+		}
+		else if (wParam == VK_ESCAPE)
+		{
+			if (m_shoukuan_status == 0)
+			{
+				//还没开始支付,按Esc直接退出
+				Close(IDCANCEL);
+			}
+			else if (m_shoukuan_status == 1 || m_shoukuan_status == 5)
+			{
+				//不能做任何处理
+			}
+			else if (m_shoukuan_status == 2)
+			{
+				//查询密码的过程中,取消付款
+				CancelShoukuanPassword();
+			}
+			else if (m_shoukuan_status == 3)
+			{
+				Close(IDOK);
+			}
+			else if (m_shoukuan_status == 4)
+			{
+				Close(IDCANCEL);
+			}
+
+			return true;
+		}
+
+		if (m_shoukuan_status == 3)
+		{
+			Close(IDOK);
+
+			return true;
+		}
+		else if (m_shoukuan_status == 4)
+		{
+			Close(IDCANCEL);
+
+			return true;
+		}
+	}
+
+	return false;
+}
+
+void CWeixinzhifuShoukuanWnd::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 CWeixinzhifuShoukuanWnd::InitFukuanma(std::string fukuanma)
+{
+	std::wstring ws_fukuanma = CLewaimaiString::UTF8ToUnicode(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();
+		}
+	}
+}
+
+void CWeixinzhifuShoukuanWnd::SetCommonParams(std::map<string, string> params)
+{
+	m_commonParams = params;
+}
+
+void CWeixinzhifuShoukuanWnd::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 CWeixinzhifuShoukuanWnd::OnShoukuanNeedPassword(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	wstring path = CSystem::GetProgramDir() + L"\\music\\pay_password.wav";
+
+	if (CSetting::GetParam("shoukuan_setting_yuyinbobao") == "1")
+	{
+		PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
+	}
+
+	CLabelUI* pFukuanEdit = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuan_paying_status")));
+	pFukuanEdit->SetText(L"用户支付中,需要输入密码");
+
+	//需要用户输入密码,开始查询状态
+	std::thread(&CWeixinzhifuShoukuanWnd::HandleShoukuanPassword, this).detach();
+
+	bHandled = TRUE;
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::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)
+	{
+		m_valueWnd->PrintZhifu(m_out_trade_no);
+	}
+	}*/
+
+	//播放收款成功的金额
+	//if (CSetting::GetParam("shoukuan_setting_yuyinbobao") == "1")
+	//{
+		std::thread(&CWeixinzhifuShoukuanWnd::ReadShoukuanValue, this).detach();
+	//}
+
+	CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_paying_layout")));
+	paying_layout->SetVisible(false);
+
+	CVerticalLayoutUI* pay_success_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_pay_success_layout")));
+	pay_success_layout->SetVisible(true);
+
+	CLabelUI* pMoneyPaySuccess = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuan_pay_success_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_fukuanma_type == 1)
+	{
+		wx_logo->SetVisible(true);
+		zhifubao_logo->SetVisible(false);
+	}
+	else if (m_fukuanma_type == 2 || m_fukuanma_type == 3)
+	{
+		wx_logo->SetVisible(false);
+		zhifubao_logo->SetVisible(true);
+	}
+
+	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());
+
+	SetTimer(m_hWnd, WM_TIMER_WND_CLOSE, 1000, NULL);
+
+	SetFocus(m_hWnd);
+
+	bHandled = TRUE;
+	return 0;
+}
+
+LRESULT CWeixinzhifuShoukuanWnd::OnShoukuanFail(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	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);
+	//}
+
+	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());
+
+	SetTimer(m_hWnd, WM_TIMER_WND_CLOSE, 1000, NULL);
+
+	SetFocus(m_hWnd);
+
+	bHandled = TRUE;
+	return 0;
+}
+
+void CWeixinzhifuShoukuanWnd::StartShoukuan()
+{
+	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")));
+		m_money = pMoneyEdit->GetText();
+
+		if (m_money == L"")
+		{
+			pLabel->SetText(L"收款金额不能为空,请重新输入!");
+			pLabel->SetVisible(true);
+
+			return;
+		}
+
+		if (m_money == L"0.00")
+		{
+			pLabel->SetText(L"收款金额不能为 0 元,请重新输入!");
+			pLabel->SetVisible(true);
+
+			return;
+		}
+
+		double money_value = atof(CLewaimaiString::UnicodeToUTF8(m_money).c_str());
+		if (!money_value || money_value < 0.01)
+		{
+			pLabel->SetText(L"收款金额错误,请重新输入!");
+			pLabel->SetVisible(true);
+
+			return;
+		}
+	}
+
+	//先判断收款码的格式是否正确
+	CEditUI* pFukuanmaEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("fukuanma_edit")));
+	std::wstring ws_Fukuanma = pFukuanmaEdit->GetText();
+	std::string s_Fukuanma = CLewaimaiString::UnicodeToUTF8(ws_Fukuanma);
+
+	int length = s_Fukuanma.size();
+	if (length != 18 && length != 19)
+	{
+		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_fukuanma_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_fukuanma_type = 2;
+	}
+	else if (s_Fukuanma.find("62") == 0)
+	{
+		//云闪付付款码
+		m_fukuanma_type = 3;
+	}
+	else
+	{
+		pLabel->SetText(L"收款码格式不对,请检查后重新输入!");
+		pLabel->SetVisible(true);
+
+		return;
+	}
+
+	m_fukuanma = ws_Fukuanma;
+
+	//全部验证通过,就可以开始修改状态了
+	m_shoukuan_status = 1;
+
+	//不加这个的话,edit按回车之后样式有问题
+	SetFocus(m_hWnd);
+
+	CVerticalLayoutUI* before_pay_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_before_pay_layout")));
+	before_pay_layout->SetVisible(false);
+
+	CVerticalLayoutUI* paying_layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(_T("shoukuan_paying_layout")));
+	paying_layout->SetVisible(true);
+
+	CLabelUI* pMoneyPaying = static_cast<CLabelUI*>(m_pm.FindControl(_T("shoukuan_paying_money")));
+
+	std::wstring valueInfo = L"付款金额:¥" + m_money;
+	pMoneyPaying->SetText(valueInfo.c_str());
+
+	//开启一个线程,开始处理登录
+	std::thread(&CWeixinzhifuShoukuanWnd::HandleShoukuan, this).detach();
+}
+
+void CWeixinzhifuShoukuanWnd::HandleShoukuan()
+{
+	//生成随机的order_no
+
+	m_commonParams["zhifu_type"] = to_string(7);
+	m_commonParams["zhifu_code"] = CLewaimaiString::UnicodeToUTF8(m_fukuanma);
+
+	std::string response;
+
+	std::string url = "/diancan/sendorder";
+	bool ret = CZhipuziHttpClient::Request(url.c_str(), m_commonParams, response);
+	if (ret == false)
+	{
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"请求服务器失败,请检查网络设置!";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		LOG_INFO("parse response error!");
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"服务器错误";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
+	{
+		LOG_INFO("json error!");
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"服务器错误";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	rapidjson::Value& v_errcode = document["errcode"];
+	int errcode = v_errcode.GetInt();
+	if (errcode != 0)
+	{
+		LOG_INFO("response failed! message:" << document["errmsg"].GetString());
+		m_shoukuan_status = 4;
+
+		std::string errmsg = document["errmsg"].GetString();
+		m_fail_message = CLewaimaiString::UTF8ToUnicode(errmsg);
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	if (!document.HasMember("data"))
+	{
+		LOG_INFO("json error!");
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"服务器错误";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	rapidjson::Value& data = document["data"];
+	rapidjson::Value& status = data["status"];
+
+	std::string s_status = status.GetString();
+
+	if (s_status == "success")
+	{
+		//支付成功
+		m_shoukuan_status = 3;
+
+		m_out_trade_no = data["trade_no"].GetString();
+
+		SendMessage(WM_SHOUKUAN_STATUS_SUCCESS, 0, 0);
+	}
+	else if (s_status == "fail")
+	{
+		//支付失败
+		m_shoukuan_status = 4;
+
+		m_fail_message = CLewaimaiString::UTF8ToUnicode(data["message"].GetString());
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+	}
+	else if (s_status == "password")
+	{
+		m_shoukuan_status = 2;
+
+		m_out_trade_no = data["out_trade_no"].GetString();
+
+		//需要查询支付状态
+		SendMessage(WM_SHOUKUAN_STATUS_NEEDPASSWORD, 0, 0);
+	}
+	else
+	{
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"服务器错误";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+	}
+}
+
+void CWeixinzhifuShoukuanWnd::HandleShoukuanPassword()
+{
+	std::map<string, string> params;
+
+	params["trade_no"] = m_out_trade_no;
+
+	while (m_shoukuan_status == 2)
+	{
+		std::string response;
+
+		std::string url = "/diancan/queryorderstatus";
+		bool ret = CZhipuziHttpClient::Request(url.c_str(), params, response);
+		if (ret == false)
+		{
+			m_shoukuan_status = 4;
+
+			m_fail_message = L"请求服务器失败,请检查网络设置!";
+
+			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+			return;
+		}
+
+		rapidjson::Document document;
+		document.Parse(response.c_str());
+
+		if (document.HasParseError())
+		{
+			LOG_INFO("parse response error!");
+			m_shoukuan_status = 4;
+
+			m_fail_message = L"服务器错误";
+
+			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+			return;
+		}
+
+		if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+		{
+			LOG_INFO("json error!");
+			m_shoukuan_status = 4;
+
+			m_fail_message = L"服务器错误";
+
+			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+			return;
+		}
+
+		rapidjson::Value& v_errcode = document["errcode"];
+		int errcode = v_errcode.GetInt();
+		if (errcode != 0)
+		{
+			LOG_INFO("response failed! message:" << document["errmsg"].GetString());
+			m_shoukuan_status = 4;
+
+			m_fail_message = L"服务器错误";
+
+			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+			return;
+		}
+
+		rapidjson::Value& data = document["data"];
+		rapidjson::Value& status = data["status"];
+
+		std::string s_status = status.GetString();
+
+		if (s_status == "success")
+		{
+			//支付成功
+			m_shoukuan_status = 3;
+
+			m_out_trade_no = data["out_trade_no"].GetString();
+
+			SendMessage(WM_SHOUKUAN_STATUS_SUCCESS, 0, 0);
+
+			break;
+		}
+		else if (s_status == "closed")
+		{
+			//表示顾客那边出问题,已经失败了
+			m_shoukuan_status = 4;
+
+			m_fail_message = L"顾客取消支付,请重新扫码收款";
+
+			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+
+			break;
+		}
+		else if (s_status == "fail")
+		{
+			//这个只是表示状态未知
+			Sleep(1000);
+		}
+		else
+		{
+			m_shoukuan_status = 4;
+
+			m_fail_message = L"服务器错误";
+
+			SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+			break;
+		}
+	}
+}
+
+void CWeixinzhifuShoukuanWnd::CancelShoukuanPassword()
+{
+	m_shoukuan_status = 5;
+
+	std::thread(&CWeixinzhifuShoukuanWnd::HandleCancelShoukuan, this).detach();
+}
+
+void CWeixinzhifuShoukuanWnd::HandleCancelShoukuan()
+{
+	std::map<string, string> params;
+
+	params["trade_no"] = m_out_trade_no;
+
+	std::string response;
+
+	std::string url = "/diancan/closeorder";
+	bool ret = CZhipuziHttpClient::Request(url.c_str(), params, response);
+	if (ret == false)
+	{
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"请求服务器失败,请检查网络设置!";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	rapidjson::Document document;
+	document.Parse(response.c_str());
+
+	if (document.HasParseError())
+	{
+		LOG_INFO("parse response error!");
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"服务器错误";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+	{
+		LOG_INFO("json error!");
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"服务器错误";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	rapidjson::Value& v_errcode = document["errcode"];
+	int errcode = v_errcode.GetInt();
+	if (errcode != 0)
+	{
+		LOG_INFO("response failed! message:" << document["errmsg"].GetString());
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"服务器错误";
+
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+		return;
+	}
+
+	rapidjson::Value& data = document["data"];
+	rapidjson::Value& status = data["status"];
+
+	std::string s_status = status.GetString();
+
+	if (s_status == "success")
+	{
+		//取消成功,订单变为失败状态
+		m_shoukuan_status = 4;
+
+		m_fail_message = L"商家取消收款";
+		SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+	}
+
+	m_shoukuan_status = 4;
+
+	m_fail_message = L"服务器错误";
+
+	SendMessage(WM_SHOUKUAN_STATUS_FAIL, 0, 0);
+}
+
+bool CWeixinzhifuShoukuanWnd::IsCanClose()
+{
+	if (m_shoukuan_status == 0 || m_shoukuan_status == 3 || m_shoukuan_status == 4)
+	{
+		return true;
+	}
+
+	return false;
+}
+
+void CWeixinzhifuShoukuanWnd::ReadShoukuanValue()
+{
+	CSpeech::SpeakNum(1, CLewaimaiString::UnicodeToUTF8(m_money));
+}

+ 120 - 0
zhipuzi_pos_windows/wnd/CWeixinzhifuShoukuanWnd.h

@@ -0,0 +1,120 @@
+#pragma once
+
+#include "../pch/pch.h"
+
+class CValueWnd;
+
+class CWeixinzhifuShoukuanWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
+{
+public:
+	CWeixinzhifuShoukuanWnd()
+	{
+
+	}
+
+	LPCTSTR GetWindowClassName() const
+	{
+		return _T("UIShoukuanFrame");
+	};
+
+	UINT GetClassStyle() const
+	{
+		return UI_CLASSSTYLE_DIALOG;
+	};
+
+	void OnFinalMessage(HWND /*hWnd*/)
+	{
+		m_pm.RemovePreMessageFilter(this);
+	};
+
+	void setValueWnd(CValueWnd* valueWnd)
+	{
+		m_valueWnd = valueWnd;
+	}
+
+	void Init();
+
+	void Notify(TNotifyUI& msg);
+
+	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnShoukuanNeedPassword(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnShoukuanSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnShoukuanFail(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+	LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
+
+	void InitMoney(std::wstring value);
+
+	void InitFukuanma(std::string fukuanma);
+
+	void SetCommonParams(std::map<string, string> params);
+
+	void UpdateFocus();
+
+	//点击确认,开始执行收款
+	void StartShoukuan();
+
+	//处理收款
+	void HandleShoukuan();
+
+	//处理收款的密码查询
+	void HandleShoukuanPassword();
+
+	//取消查询密码
+	void CancelShoukuanPassword();
+
+	//处理取消收款
+	void HandleCancelShoukuan();
+
+	bool IsCanClose();
+
+	void ReadShoukuanValue();
+
+public:
+	CPaintManagerUI m_pm;
+
+	CValueWnd* m_valueWnd;
+
+	bool m_is_money_init = false;
+	std::wstring m_money;
+
+	std::wstring m_fukuanma;
+	int m_fukuanma_type; //付款码类型 1:微信支付 2:支付宝 3:其他的
+
+	std::string m_order_no;
+	std::string m_out_trade_no;
+
+	//收款状态 0:未开始 1:请求发给服务器了,但是暂时还没得到反馈 2:查询密码中 3:成功 4:失败 5:正在取消支付
+	int m_shoukuan_status = 0;
+
+	std::wstring m_fail_message;
+
+	//窗口关闭的定时器时间
+	int m_timer_now = 4;
+
+	std::map<string, string> m_commonParams;
+};
+

+ 48 - 0
zhipuzi_pos_windows/zhipuzi/CDiandanOrder.cpp

@@ -182,6 +182,11 @@ void CDiandanOrder::SetMemo(std::string memo)
 	m_memo = memo;
 }
 
+std::string CDiandanOrder::GetMemo()
+{
+	return m_memo;
+}
+
 bool CDiandanOrder::UseShangpinquan(std::string shangpinquan_food_id, double& youhui_value)
 {
 	for (std::vector<CDiandanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
@@ -290,4 +295,47 @@ double CDiandanOrder::getDabaoMoney()
 	}
 
 	return total_dabao;
+}
+
+//获取点单相关的参数(仅用于非套餐)
+std::string CDiandanOrder::getDiandanFoodlistParam()
+{
+	std::vector<std::map<string, string>> params;
+
+	for (std::vector<CDiandanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		if (it->m_is_taocan)
+		{
+			continue;
+		}
+
+		params.push_back(it->getDiandanParam());
+	}
+
+	std::string s_params = CLewaimaiJson::ParamArrayToJsonstring(params);
+
+	return s_params;
+}
+
+//获取点单相关的套餐参数(仅用于套餐)
+std::string CDiandanOrder::getDiandanTaocanParam()
+{
+	rapidjson::Document doc;
+	doc.SetArray();
+	rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //获取分配器
+
+	for (std::vector<CDiandanOrderItem>::iterator it = m_items.begin(); it != m_items.end(); it++)
+	{
+		if (it->m_is_taocan == false)
+		{
+			continue;
+		}
+
+		Value& data = it->getDiandanTaocanParam(allocator);
+		doc.PushBack(data, allocator);
+	}
+
+	std::string paramString = CLewaimaiJson::JsonToString(doc);
+
+	return paramString;
 }

+ 8 - 0
zhipuzi_pos_windows/zhipuzi/CDiandanOrder.h

@@ -61,6 +61,8 @@ public:
 
 	void SetMemo(std::string memo);
 
+	std::string GetMemo();
+
 	//判断某个商品券是否能使用,如果可以返回true,如果不行返回false,youhui_value是对应的商品券优惠金额
 	bool UseShangpinquan(std::string shangpinquan_food_id, double& youhui_value);
 
@@ -73,4 +75,10 @@ public:
 
 	//计算所有商品的总的打包费
 	double getDabaoMoney();
+
+	//获取点单相关的参数(仅用于非套餐)
+	std::string getDiandanFoodlistParam();
+
+	//获取点单相关的套餐参数(仅用于套餐)
+	std::string getDiandanTaocanParam();
 };

+ 161 - 2
zhipuzi_pos_windows/zhipuzi/CDiandanOrderItem.cpp

@@ -108,7 +108,7 @@ bool CDiandanOrderItem::GetIsTaocan()
 	return m_is_taocan;
 }
 
-//根据当前选中的商品属性、是否打包、会员价、是否使用商品券等,计算商品的展示价格
+//根据当前选中的商品属性、份数,计算商品的展示价格
 void CDiandanOrderItem::UpdateShowPrice()
 {
 	if (m_is_taocan == true)
@@ -123,7 +123,7 @@ void CDiandanOrderItem::UpdateShowPrice()
 		}
 		else
 		{
-			int nature_price = 0;
+			double nature_price = 0;
 			for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 			{
 				nature_price += (*it).nature_select_value;
@@ -136,6 +136,35 @@ void CDiandanOrderItem::UpdateShowPrice()
 	}
 }
 
+std::string CDiandanOrderItem::getSinglePrice()
+{
+	if (m_is_taocan == true)
+	{
+		return price;
+	}
+	else
+	{
+		if (!is_nature)
+		{
+			return price;
+		}
+		else
+		{
+			double nature_price = 0;
+			for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
+			{
+				nature_price += (*it).nature_select_value;
+			}
+
+			double new_price = std::stod(price) + nature_price;
+
+			show_price = CLewaimaiString::DoubleToString(new_price, 2);
+
+			return show_price;
+		}
+	}
+}
+
 std::string CDiandanOrderItem::getNameShow()
 {
 	if (m_is_taocan)
@@ -240,4 +269,134 @@ double CDiandanOrderItem::getDabaoMoney()
 	}
 
 	return 0;
+}
+
+//获取点单相关的参数(仅用于非套餐)
+std::map<string, string> CDiandanOrderItem::getDiandanParam()
+{
+	std::map<string, string> param;
+
+	if (m_is_taocan)
+	{
+		return param;
+	}
+
+	param["food_id"] = food_id;
+
+	if (is_nature)
+	{
+		param["food_name"] = food_name + CLewaimaiString::UnicodeToUTF8(L"【") + getNatureShow() + CLewaimaiString::UnicodeToUTF8(L"】");
+	}
+	else
+	{
+		param["food_name"] = food_name;
+	}
+
+	param["food_price"] = getSinglePrice();
+
+	if (is_dabao)
+	{
+		param["is_dabao"] = "1";
+	}
+	else
+	{
+		param["is_dabao"] = "0";
+	}
+
+	param["quantity"] = num;
+	param["type_id"] = m_foodinfo.type_id;
+	param["foodpackage_id"] = "0";
+	param["is_foodpackage"] = "0";
+
+	return param;
+}
+
+//获取点单相关的套餐参数(仅用于套餐)
+rapidjson::Document CDiandanOrderItem::getDiandanTaocanParam(rapidjson::Document::AllocatorType &allocator)
+{
+	rapidjson::Document doc(&allocator);
+
+	doc.SetObject();
+
+	if (m_is_taocan == false)
+	{
+		return doc;
+	}
+
+	Value v_foodpackage_id;
+	v_foodpackage_id.SetString(foodpackage_id.c_str(), foodpackage_id.length(), allocator);
+	doc.AddMember("foodpackage_id", v_foodpackage_id, allocator);
+
+	std::string show_name = foodpackage_name;
+	Value v_show_name;
+	v_show_name.SetString(show_name.c_str(), show_name.length(), allocator);
+	doc.AddMember("food_name", v_show_name, allocator);
+
+	std::string single_price = getSinglePrice();
+	Value v_single_price;
+	v_single_price.SetString(single_price.c_str(), single_price.length(), allocator);
+	doc.AddMember("food_price", v_single_price, allocator);
+
+	if (is_dabao)
+	{
+		doc.AddMember("is_dabao", "0", allocator);
+	}
+	else
+	{
+		doc.AddMember("is_dabao", "1", allocator);
+	}
+
+	Value v_num;
+	v_num.SetString(num.c_str(), num.length(), allocator);
+	doc.AddMember("quantity", v_num, allocator);
+
+	std::vector<std::map<string, string>> item;
+
+	//遍历套餐的每个商品
+	for (std::vector<FoodNatureSelectValue>::iterator it = natureSelectedArray.begin(); it != natureSelectedArray.end(); it++)
+	{
+		std::map<string, string> curFood;
+
+		FoodNatureSelectValue curNature = *it;
+
+		std::string foodpackage_nature = m_foodpackageinfo.nature;
+
+		rapidjson::Document doc_tmp = CLewaimaiJson::StringToJson(foodpackage_nature, allocator);
+
+		std::string food_id = doc_tmp[curNature.nNameIndex]["value"][curNature.nature_select_index].GetString();
+
+		curFood["food_id"] = food_id;
+
+		CFood foodinfo;
+		CSqlite3 sqlite;
+		bool is_found = sqlite.GetFoodById(food_id, foodinfo);
+		if (!is_found)
+		{
+			continue;
+		}
+
+		curFood["food_name"] = foodinfo.name;
+		curFood["food_price"] = foodinfo.price;
+		if (is_dabao)
+		{
+			curFood["is_dabao"] = "1";
+		}
+		else
+		{
+			curFood["is_dabao"] = "0";
+		}
+		
+		curFood["quantity"] = num;
+		curFood["type_id"] = foodinfo.type_id;
+		curFood["foodpackage_id"] = foodpackage_id;
+		curFood["is_foodpackage"] = "1";
+
+		item.push_back(curFood);
+	}
+
+	Value& data = CLewaimaiJson::ParamArrayToJson(item, allocator);
+
+	doc.AddMember("item", data, allocator);
+
+	return doc;
 }

+ 11 - 2
zhipuzi_pos_windows/zhipuzi/CDiandanOrderItem.h

@@ -47,7 +47,7 @@ public:
 	//这个用来存储所有属性选择的信息,每个属性选择的是第几个,什么价格等等
 	std::vector<FoodNatureSelectValue> natureSelectedArray;
 
-	//这个是商品对外展示的价格,根据数量和属性来计算的
+	//这个是商品对外展示的价格,根据数量和属性来计算的,不包含打包费
 	std::string show_price;
 
 private:
@@ -72,9 +72,12 @@ public:
 
 	bool GetIsTaocan();
 
-	//根据当前选中的商品属性、是否打包,计算商品的展示价格
+	//根据当前选中的商品属性、份数,计算商品的展示价格
 	void UpdateShowPrice();
 
+	//这个是单价,包含属性价格,不考虑数量,也就是“1份”的价格
+	std::string getSinglePrice();
+
 	//获取用户展示的商品名字,如果有打包会在前面显示【打包】
 	std::string getNameShow();
 
@@ -86,4 +89,10 @@ public:
 
 	//计算当前这个商品的打包费
 	double getDabaoMoney();
+
+	//获取点单相关的参数(仅用于非套餐)
+	std::map<string, string> getDiandanParam();
+
+	//获取点单相关的套餐参数(仅用于套餐)
+	rapidjson::Document getDiandanTaocanParam(rapidjson::Document::AllocatorType &allocator);
 };

+ 4 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -225,6 +225,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClInclude Include="helper\CSpeech.h" />
     <ClInclude Include="wnd\CCanpaiWnd.h" />
     <ClInclude Include="wnd\CSaomaCikaWnd.h" />
     <ClInclude Include="wnd\CSaomaQuanyikaWnd.h" />
@@ -232,6 +233,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="wnd\CSaomaYouhuiquanWnd.h" />
     <ClInclude Include="wnd\CJiajiaWnd.h" />
     <ClInclude Include="wnd\CRengongYouhuiWnd.h" />
+    <ClInclude Include="wnd\CWeixinzhifuShoukuanWnd.h" />
     <ClInclude Include="wnd\CZhekouWnd.h" />
     <ClInclude Include="wnd\CMemberLoginWnd.h" />
     <ClInclude Include="wnd\CYouhuiShowWnd.h" />
@@ -283,6 +285,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CSystem.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="helper\CSpeech.cpp" />
     <ClCompile Include="wnd\CCanpaiWnd.cpp" />
     <ClCompile Include="wnd\CSaomaCikaWnd.cpp" />
     <ClCompile Include="wnd\CSaomaQuanyikaWnd.cpp" />
@@ -290,6 +293,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClCompile Include="wnd\CSaomaYouhuiquanWnd.cpp" />
     <ClCompile Include="wnd\CJiajiaWnd.cpp" />
     <ClCompile Include="wnd\CRengongYouhuiWnd.cpp" />
+    <ClCompile Include="wnd\CWeixinzhifuShoukuanWnd.cpp" />
     <ClCompile Include="wnd\CZhekouWnd.cpp" />
     <ClCompile Include="wnd\CMemberLoginWnd.cpp" />
     <ClCompile Include="wnd\CYouhuiShowWnd.cpp" />

+ 12 - 0
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj.filters

@@ -183,6 +183,12 @@
     <ClInclude Include="wnd\CCanpaiWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="wnd\CWeixinzhifuShoukuanWnd.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="helper\CSpeech.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -329,6 +335,12 @@
     <ClCompile Include="wnd\CCanpaiWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="wnd\CWeixinzhifuShoukuanWnd.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="helper\CSpeech.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">