Quellcode durchsuchen

商品属性多选可以了

张洋 vor 2 Jahren
Ursprung
Commit
98bc340fc8

+ 127 - 36
zhipuzi_pos_windows/control/CDiandanNatureItemUI.cpp

@@ -1,7 +1,7 @@
 #include "../pch/pch.h"
 #include "CDiandanNatureItemUI.h"
 
-
+#include "../wnd/CDiandanNatureWnd.h"
 
 CDiandanNatureItemUI::CDiandanNatureItemUI()
 {
@@ -20,6 +20,11 @@ void CDiandanNatureItemUI::SetNatureName(std::string name)
 	pName->SetText(CLewaimaiString::UTF8ToUnicode(name).c_str());
 }
 
+void CDiandanNatureItemUI::SetNatureLimitChoose(std::string limit_choose)
+{
+	m_nLimitChoose = atoi(CLewaimaiString::UTF8ToANSI(limit_choose).c_str());
+}
+
 void CDiandanNatureItemUI::SetNatureNameNum(int nNum)
 {
 	m_nNatureNameNum = nNum;
@@ -30,7 +35,7 @@ void CDiandanNatureItemUI::addNatureValue(FoodNatureValue value)
 	m_nature_value.push_back(value);
 }
 
-void CDiandanNatureItemUI::ShowNatureValue(int nSelected)
+void CDiandanNatureItemUI::ShowNatureValue()
 {
 	CHorizontalLayoutUI* pValueLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_nature_layout_value")));
 
@@ -85,40 +90,120 @@ void CDiandanNatureItemUI::ShowNatureValue(int nSelected)
 		newButton->SetFloat(true);
 		newButton->SetPos(rect);
 
-		//找到了选中的属性
-		if (value_num == nSelected)
+		value_num++;
+	}
+
+	//初始化选中
+
+	//如果是点击商品的,默认选中第一个
+	if (m_InitFoodNatureSelectValue.m_nature_selects.size() == 0)
+	{
+		m_nature_value[0].is_select = true;
+
+		CButtonUI* newButton = static_cast<CButtonUI*>(pValueLayout->GetItemAt(0));
+		newButton->SetBorderColor(0xFFFF4500);
+		newButton->SetTextColor(0xFFFF4500);
+
+		m_nSelectNum = 1;
+	}
+	else
+	{
+		m_nSelectNum = 0;
+
+		//可能有1到多个商品属性值被选中
+		for (std::vector< FoodNatureSelectValueInfo>::iterator it = m_InitFoodNatureSelectValue.m_nature_selects.begin(); it != m_InitFoodNatureSelectValue.m_nature_selects.end(); it++)
 		{
-			m_nSelectIndex = nSelected;
-			m_nature_value[nSelected].is_select = true;
+			int index = (*it).nature_select_index;
+
+			m_nature_value[index].is_select = true;
+
+			CButtonUI* newButton = static_cast<CButtonUI*>(pValueLayout->GetItemAt(index));
 			newButton->SetBorderColor(0xFFFF4500);
 			newButton->SetTextColor(0xFFFF4500);
-		}
 
-		value_num++;
+			m_nSelectNum++;
+		}
 	}
 }
 
 void CDiandanNatureItemUI::SetNatureSelected(int index)
 {
-	if (m_nSelectIndex == index)
+	CHorizontalLayoutUI* pValueLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_nature_layout_value")));
+
+	if (m_nature_value[index].is_select == true)
 	{
-		return;
+		//点击的这个当前是选中状态
+		if (m_nLimitChoose == 1)
+		{
+			//如果最多就只能选一个属性值的,点了选中状态的就没变化
+		}
+		else
+		{
+			//如果是可以选多个值的,点了选中状态就改为非选中状态
+			if (m_nSelectNum == 1)
+			{
+				m_pNatureWnd->ShowToast(L"最少选择1个属性");
+
+				return;
+			}
+
+			m_nature_value[index].is_select = false;
+
+			CButtonUI* old_btn = static_cast<CButtonUI*>(pValueLayout->GetItemAt(index));
+			old_btn->SetBorderColor(0xFFA9A9A9);
+			old_btn->SetTextColor(0xFFA9A9A9);
+
+			m_nSelectNum--;
+		}
 	}
+	else
+	{
+		//点击的这个是非选中状态
+		if (m_nLimitChoose == 1)
+		{
+			//如果最大限制就是1个,点击非选中状态的,就自动选中这个
+			int num = 0;
+			for (std::vector<FoodNatureValue>::iterator it = m_nature_value.begin(); it != m_nature_value.end(); it++)
+			{
+				if (it->is_select == true)
+				{
+					//把旧的选中的设为非选中
+					m_nature_value[num].is_select = false;
+
+					CButtonUI* old_btn = static_cast<CButtonUI*>(pValueLayout->GetItemAt(num));
+					old_btn->SetBorderColor(0xFFA9A9A9);
+					old_btn->SetTextColor(0xFFA9A9A9);
+				}
+
+				num++;
+			}
+
+			//再把刚点击的设为选中
+			m_nature_value[index].is_select = true;
+
+			CButtonUI* new_btn = static_cast<CButtonUI*>(pValueLayout->GetItemAt(index));
+			new_btn->SetBorderColor(0xFFFF4500);
+			new_btn->SetTextColor(0xFFFF4500);
+		}
+		else
+		{
+			if (m_nSelectNum >= m_nLimitChoose)
+			{
+				m_pNatureWnd->ShowToast(L"最多选择" + to_wstring(m_nLimitChoose) + L"个属性");
 
-	CHorizontalLayoutUI* pValueLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("diandan_nature_layout_value")));
+				return;
+			}
+
+			//否则进行选中
+			m_nature_value[index].is_select = true;
 
-	//先取消旧的选中
-	m_nature_value[m_nSelectIndex].is_select = false;
-	CButtonUI* old_btn = static_cast<CButtonUI*>(pValueLayout->GetItemAt(m_nSelectIndex));
-	old_btn->SetBorderColor(0xFFA9A9A9);
-	old_btn->SetTextColor(0xFFA9A9A9);
-
-	//再选中新的
-	m_nSelectIndex = index;
-	m_nature_value[m_nSelectIndex].is_select = true;
-	CButtonUI* new_btn = static_cast<CButtonUI*>(pValueLayout->GetItemAt(m_nSelectIndex));
-	new_btn->SetBorderColor(0xFFFF4500);
-	new_btn->SetTextColor(0xFFFF4500);
+			CButtonUI* new_btn = static_cast<CButtonUI*>(pValueLayout->GetItemAt(index));
+			new_btn->SetBorderColor(0xFFFF4500);
+			new_btn->SetTextColor(0xFFFF4500);
+
+			m_nSelectNum++;
+		}
+	}
 }
 
 std::string CDiandanNatureItemUI::GetNatureName()
@@ -131,20 +216,26 @@ int CDiandanNatureItemUI::GetNatureNameNum()
 	return m_nNatureNameNum;
 }
 
-//获取当前被选中的属性值的名字
-std::string CDiandanNatureItemUI::GetSelectedNatureValueName()
+std::vector<FoodNatureSelectValueInfo> CDiandanNatureItemUI::GetSelectedNatureInfo()
 {
-	return m_nature_value[m_nSelectIndex].name;
-}
+	std::vector<FoodNatureSelectValueInfo> infoArray;
 
-//获取当前被选中的属性值的索引
-int CDiandanNatureItemUI::GetSelectedNatureValueNum()
-{
-	return m_nSelectIndex;
-}
+	int num = 0;
+	for (std::vector<FoodNatureValue>::iterator it = m_nature_value.begin(); it != m_nature_value.end(); it++)
+	{
+		if (it->is_select == true)
+		{
+			FoodNatureSelectValueInfo newInfo;
 
-//获取当前被选中属性的值
-int CDiandanNatureItemUI::GetSelectedNatureValuePrice()
-{
-	return m_nature_value[m_nSelectIndex].value;
+			newInfo.nature_select_name = (*it).name;
+			newInfo.nature_select_value = (*it).value;
+			newInfo.nature_select_index = num;
+
+			infoArray.push_back(newInfo);
+		}
+
+		num++;
+	}
+
+	return infoArray;
 }

+ 87 - 20
zhipuzi_pos_windows/control/CDiandanNatureItemUI.h

@@ -2,28 +2,79 @@
 
 #include <string>
 
+class CDiandanNatureWnd;
+
 //这个对应的是一个属性值
 class FoodNatureValue
 {
 public:
-	std::string name;
-	int value;
+	std::string name; //属性值的名字
+	int value; //属性值对应的价格
 
 	bool is_select = false;;
 };
 
-//这个用来记录每个被选中的属性信息
-class FoodNatureSelectValue
+//这个用来记录每个被选中的属性信息里面的属性值信息,以为属性值可以多选
+class FoodNatureSelectValueInfo
 {
 public:
-	std::string nature_name; //属性名字
-	int nNameIndex; //属性名字在所有属性中的顺序
 	std::string nature_select_name; //选中的属性值名字
 	int nature_select_index; //选中的属性值属于第几个属性
 	double nature_select_value; //选中的属性值的价格
+
+	bool operator == (const FoodNatureSelectValueInfo& t) const
+	{
+		if (this->nature_select_name != t.nature_select_name)
+		{
+			return false;
+		}
+
+		if (this->nature_select_index != t.nature_select_index)
+		{
+			return false;
+		}
+
+		return true;
+	}
+};
+
+//这个用来记录每个被选中的属性信息,一个对象对应一个属性,多个属性就是多个对象
+class FoodNatureSelectValue
+{
+public:
+	std::string nature_name; //属性名字
+	int nNameIndex; //属性名字在所有属性中的顺序
+
+	//std::string nature_select_name; //选中的属性值名字
+	//int nature_select_index; //选中的属性值属于第几个属性
+	//double nature_select_value; //选中的属性值的价格
+
+	//商品属性可以多选,这个是多选的属性
+	std::vector<FoodNatureSelectValueInfo> m_nature_selects;
+
+	//获取多选属性的名字,中间用、隔开
+	std::string GetNatureSelectName()
+	{
+		size_t i = 0;
+		std::string show = "";
+
+		for (std::vector<FoodNatureSelectValueInfo>::iterator it = m_nature_selects.begin(); it != m_nature_selects.end(); it++)
+		{
+			show += (*it).nature_select_name;
+
+			if (i < m_nature_selects.size() - 1)
+			{
+				show += CLewaimaiString::UnicodeToUTF8(L"、");
+			}
+
+			i++;
+		}
+
+		return show;
+	}
 };
 
-//这个对应的是属性弹框里面的一个属性
+//这个对应的是属性弹框里面的一个属性展示控件(包含属性名和属性值,不同属性是不同的对象)
 class CDiandanNatureItemUI : public CVerticalLayoutUI
 {
 public:
@@ -32,29 +83,36 @@ public:
 
 	void SetNatureName(std::string name);
 
+	void SetNatureLimitChoose(std::string limit_choose);
+
 	//设置这个属性在所有属性中的顺序
 	void SetNatureNameNum(int nNum);
 
 	//添加属性值
 	void addNatureValue(FoodNatureValue value);
 
-	//刷新属性值的位置,nSelected表示选中第几个属性
-	void ShowNatureValue(int nSelected = 0);
+	//刷新属性值的位置和选中状态
+	void ShowNatureValue();
 
-	//选中第1几个属性
+	//点击第几个属性,如果当前是选中状态就改为未选中状态,如果是非选中状态就改为选中状态(要判断是否超过数量)
 	void SetNatureSelected(int index);
 
 	std::string GetNatureName();
 	int GetNatureNameNum();
 
-	//获取当前被选中的属性值的名字
-	std::string GetSelectedNatureValueName();
+	//获取多选的属性值信息
+	std::vector<FoodNatureSelectValueInfo> GetSelectedNatureInfo();
 
-	//获取当前被选中的属性值的索引
-	int GetSelectedNatureValueNum();
+	void SetDiandanNatureWnd(CDiandanNatureWnd* pWnd)
+	{
+		m_pNatureWnd = pWnd;
+	}
 
-	//获取当前被选中属性的值
-	int GetSelectedNatureValuePrice();
+	//如果是修改规格,这里设置当前属性默认选中的N个属性值
+	void SetFoodNatureSelectValue(FoodNatureSelectValue v)
+	{
+		m_InitFoodNatureSelectValue = v;
+	}
 
 private:
 	//属性名
@@ -63,10 +121,19 @@ private:
 	//属性值
 	std::vector<FoodNatureValue> m_nature_value;
 
-	//表示哪个属性是被选中的,默认-1表示没有任何属性被选中
-	int m_nSelectIndex = -1;
-
 	//属性在所有属性中的顺序
 	int m_nNatureNameNum = 0;
-};
 
+	//属性最大可选属性值的数量
+	int m_nLimitChoose;
+
+	//当前被选中的属性值属性
+	int m_nSelectNum = 0;
+
+	CDiandanNatureWnd* m_pNatureWnd;
+
+	//如果是修改规格,这里表示当前属性默认选中的N个属性值
+	FoodNatureSelectValue m_InitFoodNatureSelectValue;
+
+	//int m_nSelectIndex = 0;
+};

+ 0 - 6
zhipuzi_pos_windows/network/CZhipuziHttpClient.cpp

@@ -15,15 +15,9 @@ CZhipuziHttpClient::CZhipuziHttpClient()
 
 	if (m_env == DEV)
 	{
-		/*
 		m_pingtai_url = "https://pf-api-dev3.zhipuzi.com/pos";
 		m_canyin_yewu_url = "https://cyapi-dev3.zhipuzi.com/pos";
 		m_lingshou_yewu_url = "https://lsapi-dev3.zhipuzi.com/pos";
-		*/
-
-		m_pingtai_url = "https://pf-api.zhipuzi.com/pos";
-		m_canyin_yewu_url = "https://cyapi.zhipuzi.com/pos";
-		m_lingshou_yewu_url = "https://lsapi.zhipuzi.com/pos";
 	}
 	else if (m_env == TEST)
 	{

+ 2 - 11
zhipuzi_pos_windows/page/CDiandanPageUI.cpp

@@ -1763,16 +1763,7 @@ void CDiandanPageUI::ClickFoodAction()
 			MemberPrice newPirce;
 			newPirce.id = CLewaimaiJson::ToString(member_price_info["id"]);
 			newPirce.level = CLewaimaiJson::ToString(member_price_info["level"]);
-
-			if (member_price_info["price"].IsString())
-			{
-				newPirce.price = member_price_info["price"].GetString();
-			}
-			else
-			{
-				newPirce.price = to_string(member_price_info["price"].GetDouble());
-			}
-			
+			newPirce.price = CLewaimaiJson::ToString(member_price_info["price"]);			
 
 			clickItem.m_member_price.push_back(newPirce);
 		}
@@ -3767,7 +3758,7 @@ CDiandanOrder CDiandanPageUI::GetPrintOrderinfo(std::string take_food_code, std:
 			//接下来要把这个套餐的详情也保存下来
 			for (std::vector<FoodNatureSelectValue>::iterator it_2 = it->natureSelectedArray.begin(); it_2 != it->natureSelectedArray.end(); it_2++)
 			{
-				std::string food_id = data[it_2->nNameIndex]["value"][it_2->nature_select_index].GetString();
+				std::string food_id = data[it_2->nNameIndex]["value"][it_2->m_nature_selects[0].nature_select_index].GetString();
 
 				//要根据商品ID找出商品的名字
 				CFood foodinfo;

+ 1 - 1
zhipuzi_pos_windows/page/CZhengcanDiandanPageUI.cpp

@@ -4396,7 +4396,7 @@ CZhengcanOrder CZhengcanDiandanPageUI::GetPrintOrderinfoXiadan(std::string show_
 			//接下来要把这个套餐的详情也保存下来
 			for (std::vector<FoodNatureSelectValue>::iterator it_2 = it->natureSelectedArray.begin(); it_2 != it->natureSelectedArray.end(); it_2++)
 			{
-				std::string food_id = data[it_2->nNameIndex]["value"][it_2->nature_select_index].GetString();
+				std::string food_id = data[it_2->nNameIndex]["value"][it_2->m_nature_selects[0].nature_select_index].GetString();
 
 				//要根据商品ID找出商品的名字
 				CFood foodinfo;

+ 27 - 7
zhipuzi_pos_windows/wnd/CDiandanNatureWnd.cpp

@@ -6,6 +6,8 @@
 
 #include "../tool/CSqlite3.h"
 
+#include "../wnd/CToastWnd.h"
+
 void CDiandanNatureWnd::Init()
 {
 	bool is_taocan;
@@ -75,6 +77,7 @@ void CDiandanNatureWnd::Init()
 			CDialogBuilder builder;
 			CDialogBuilderCallbackEx cb;
 			CDiandanNatureItemUI* pItem = static_cast<CDiandanNatureItemUI*>(builder.Create(_T("diandan_nature_item.xml"), (UINT)0, &cb, &m_pm));
+			pItem->SetDiandanNatureWnd(this);
 
 			//要先Add,子控件才能调用SetPos
 			pNatureLayout->Add(pItem);
@@ -113,15 +116,17 @@ void CDiandanNatureWnd::Init()
 			}
 
 			pItem->SetNatureName(name);
+			pItem->SetNatureLimitChoose("1");
 			pItem->SetNatureNameNum(i);
 
 			if (m_mode == 1)
 			{
-				pItem->ShowNatureValue(0);
+				pItem->ShowNatureValue();
 			}
 			else
 			{
-				pItem->ShowNatureValue(natureSelectedArray[i].nature_select_index);
+				pItem->SetFoodNatureSelectValue(natureSelectedArray[i]);
+				pItem->ShowNatureValue();
 			}
 		}
 	}
@@ -163,6 +168,7 @@ void CDiandanNatureWnd::Init()
 			CDialogBuilder builder;
 			CDialogBuilderCallbackEx cb;
 			CDiandanNatureItemUI* pItem = static_cast<CDiandanNatureItemUI*>(builder.Create(_T("diandan_nature_item.xml"), (UINT)0, &cb, &m_pm));
+			pItem->SetDiandanNatureWnd(this);
 
 			//要先Add,子控件才能调用SetPos
 			pNatureLayout->Add(pItem);
@@ -188,15 +194,19 @@ void CDiandanNatureWnd::Init()
 			}
 
 			pItem->SetNatureName(name);
+			pItem->SetNatureLimitChoose(limit_choose);
 			pItem->SetNatureNameNum(i);
 
 			if (m_mode == 1)
 			{
-				pItem->ShowNatureValue(0);
+				//点击商品选择属性,初始化展示
+				pItem->ShowNatureValue();
 			}
 			else
 			{
-				pItem->ShowNatureValue(natureSelectedArray[i].nature_select_index);
+				//点击购物车修改规格
+				pItem->SetFoodNatureSelectValue(natureSelectedArray[i]);
+				pItem->ShowNatureValue();
 			}
 		}
 	}
@@ -247,9 +257,7 @@ void CDiandanNatureWnd::Notify(TNotifyUI& msg)
 				FoodNatureSelectValue curSelect;
 				curSelect.nature_name = curNatureItem->GetNatureName();
 				curSelect.nNameIndex = curNatureItem->GetNatureNameNum();
-				curSelect.nature_select_name = curNatureItem->GetSelectedNatureValueName();
-				curSelect.nature_select_index = curNatureItem->GetSelectedNatureValueNum();
-				curSelect.nature_select_value = curNatureItem->GetSelectedNatureValuePrice();
+				curSelect.m_nature_selects = curNatureItem->GetSelectedNatureInfo();
 
 				m_NatureSelectedArray.push_back(curSelect);
 			}
@@ -414,6 +422,18 @@ LRESULT CDiandanNatureWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lPara
 	return false;
 }
 
+void CDiandanNatureWnd::ShowToast(std::wstring toast_value)
+{
+	CToastWnd* pYouhuiDlg = new CToastWnd();
 
+	if (pYouhuiDlg != NULL)
+	{
+		pYouhuiDlg->Create(m_pm.GetPaintWindow(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
+		pYouhuiDlg->SetIcon(IDI_ICON_DUILIB);
+		pYouhuiDlg->CenterWindow();
 
+		pYouhuiDlg->SetToast(toast_value);
 
+		pYouhuiDlg->ShowWindow();
+	}
+}

+ 3 - 0
zhipuzi_pos_windows/wnd/CDiandanNatureWnd.h

@@ -69,6 +69,9 @@ public:
 
 	}
 
+	//չʾtoast
+	void ShowToast(std::wstring toast_value);
+
 public:
 	CPaintManagerUI m_pm;
 

+ 17 - 7
zhipuzi_pos_windows/zhipuzi/CDiandanOrderItem.cpp

@@ -30,7 +30,7 @@ bool CDiandanOrderItem::operator==(CDiandanOrderItem& t)
 				return false;
 			}
 
-			if ((*it).nature_select_index != t.natureSelectedArray[i].nature_select_index)
+			if ((*it).m_nature_selects != t.natureSelectedArray[i].m_nature_selects)
 			{
 				return false;
 			}
@@ -60,7 +60,7 @@ bool CDiandanOrderItem::operator==(CDiandanOrderItem& t)
 					return false;
 				}
 
-				if ((*it).nature_select_index != t.natureSelectedArray[i].nature_select_index)
+				if ((*it).m_nature_selects != t.natureSelectedArray[i].m_nature_selects)
 				{
 					return false;
 				}
@@ -128,7 +128,12 @@ void CDiandanOrderItem::UpdateShowPrice()
 			double nature_price = 0;
 			for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 			{
-				nature_price += (*it).nature_select_value;
+				std::vector<FoodNatureSelectValueInfo> infoArray = (*it).m_nature_selects;
+
+				for (std::vector<FoodNatureSelectValueInfo>::iterator it2 = infoArray.begin(); it2 != infoArray.end(); it2++)
+				{
+					nature_price += it2->nature_select_value;
+				}
 			}
 
 			double new_price = std::stod(price) + nature_price;
@@ -155,7 +160,12 @@ std::string CDiandanOrderItem::getSinglePrice()
 			double nature_price = 0;
 			for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 			{
-				nature_price += (*it).nature_select_value;
+				std::vector<FoodNatureSelectValueInfo> infoArray = (*it).m_nature_selects;
+
+				for (std::vector<FoodNatureSelectValueInfo>::iterator it2 = infoArray.begin(); it2 != infoArray.end(); it2++)
+				{
+					nature_price += it2->nature_select_value;
+				}
 			}
 
 			double new_price = std::stod(price) + nature_price;
@@ -203,7 +213,7 @@ std::string CDiandanOrderItem::getNatureShow()
 		size_t i = 0;
 		for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 		{
-			show += (*it).nature_select_name;
+			show += (*it).GetNatureSelectName();
 
 			if (i < natureSelectedArray.size() - 1)
 			{
@@ -223,7 +233,7 @@ std::string CDiandanOrderItem::getNatureShow()
 		size_t i = 0;
 		for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 		{
-			show += (*it).nature_select_name;
+			show += (*it).GetNatureSelectName();
 
 			if (i < natureSelectedArray.size() - 1)
 			{
@@ -394,7 +404,7 @@ rapidjson::Document CDiandanOrderItem::getDiandanTaocanParam(rapidjson::Document
 
 		rapidjson::Document doc_tmp = CLewaimaiJson::StringToJson(foodpackage_nature, allocator);
 
-		std::string food_id = doc_tmp[curNature.nNameIndex]["value"][curNature.nature_select_index].GetString();
+		std::string food_id = doc_tmp[curNature.nNameIndex]["value"][curNature.m_nature_selects[0].nature_select_index].GetString();
 
 		curFood["food_id"] = food_id;
 

+ 17 - 7
zhipuzi_pos_windows/zhipuzi/CZhengcanOrderItem.cpp

@@ -30,7 +30,7 @@ bool CZhengcanOrderItem::operator==(CZhengcanOrderItem& t)
 				return false;
 			}
 
-			if ((*it).nature_select_index != t.natureSelectedArray[i].nature_select_index)
+			if ((*it).m_nature_selects != t.natureSelectedArray[i].m_nature_selects)
 			{
 				return false;
 			}
@@ -60,7 +60,7 @@ bool CZhengcanOrderItem::operator==(CZhengcanOrderItem& t)
 					return false;
 				}
 
-				if ((*it).nature_select_index != t.natureSelectedArray[i].nature_select_index)
+				if ((*it).m_nature_selects != t.natureSelectedArray[i].m_nature_selects)
 				{
 					return false;
 				}
@@ -128,7 +128,12 @@ void CZhengcanOrderItem::UpdateShowPrice()
 			double nature_price = 0;
 			for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 			{
-				nature_price += (*it).nature_select_value;
+				std::vector<FoodNatureSelectValueInfo> infoArray = (*it).m_nature_selects;
+
+				for (std::vector<FoodNatureSelectValueInfo>::iterator it2 = infoArray.begin(); it2 != infoArray.end(); it2++)
+				{
+					nature_price += it2->nature_select_value;
+				}
 			}
 
 			double new_price = std::stod(price) + nature_price;
@@ -155,7 +160,12 @@ std::string CZhengcanOrderItem::getSinglePrice()
 			double nature_price = 0;
 			for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 			{
-				nature_price += (*it).nature_select_value;
+				std::vector<FoodNatureSelectValueInfo> infoArray = (*it).m_nature_selects;
+
+				for (std::vector<FoodNatureSelectValueInfo>::iterator it2 = infoArray.begin(); it2 != infoArray.end(); it2++)
+				{
+					nature_price += it2->nature_select_value;
+				}
 			}
 
 			double new_price = std::stod(price) + nature_price;
@@ -203,7 +213,7 @@ std::string CZhengcanOrderItem::getNatureShow()
 		size_t i = 0;
 		for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 		{
-			show += (*it).nature_select_name;
+			show += (*it).GetNatureSelectName();
 
 			if (i < natureSelectedArray.size() - 1)
 			{
@@ -223,7 +233,7 @@ std::string CZhengcanOrderItem::getNatureShow()
 		size_t i = 0;
 		for (std::vector<FoodNatureSelectValue>::iterator it = this->natureSelectedArray.begin(); it != this->natureSelectedArray.end(); it++)
 		{
-			show += (*it).nature_select_name;
+			show += (*it).GetNatureSelectName();
 
 			if (i < natureSelectedArray.size() - 1)
 			{
@@ -450,7 +460,7 @@ rapidjson::Document CZhengcanOrderItem::getDiandanTaocanParam(rapidjson::Documen
 
 		rapidjson::Document doc_tmp = CLewaimaiJson::StringToJson(foodpackage_nature, allocator);
 
-		std::string food_id = doc_tmp[curNature.nNameIndex]["value"][curNature.nature_select_index].GetString();
+		std::string food_id = doc_tmp[curNature.nNameIndex]["value"][curNature.m_nature_selects[0].nature_select_index].GetString();
 
 		curFood["food_id"] = food_id;