CZhengcanOrderItem.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #pragma once
  2. #include "../zhipuzi/CFood.h"
  3. #include "../zhipuzi/CFoodpackage.h"
  4. #include "../control/CDiandanNatureItemUI.h"
  5. #include "CDiandanOrderItem.h"
  6. /**
  7. * 订单中的一个商品
  8. */
  9. class CZhengcanOrderItem
  10. {
  11. public:
  12. //是否是历史订单记录里面的item
  13. bool m_is_history_item = false;
  14. std::string item_id; //如果是历史订单里面的item,那么这个对应着item_id
  15. //是否套餐的Item,因为目前套餐和普通商品都是用同一个Item类
  16. bool m_is_taocan = false;
  17. //普通商品才有的信息
  18. std::string food_id;
  19. std::string food_name;
  20. std::string type_id;
  21. bool is_weight = false;
  22. bool is_nature = false;
  23. //会员价
  24. bool is_member_price_used;
  25. std::vector<MemberPrice> m_member_price;
  26. //套餐才有的信息
  27. std::string foodpackage_id;
  28. std::string foodpackage_name;
  29. //这个是套餐和普通商品共有的信息
  30. std::string price;
  31. bool is_dabao = false;
  32. std::string dabao_money;
  33. std::string num; //份数
  34. std::string is_jiacai;
  35. std::string jiacai_no;
  36. std::string is_tuicai = "0";
  37. //这个用来存储所有属性选择的信息,每个属性选择的是第几个,什么价格等等
  38. std::vector<FoodNatureSelectValue> natureSelectedArray;
  39. //这个是商品对外展示的价格,根据数量和属性来计算的,不包含打包费
  40. std::string show_price;
  41. private:
  42. CFood m_foodinfo;
  43. CFoodpackage m_foodpackageinfo;
  44. public:
  45. bool operator==(CZhengcanOrderItem& t);
  46. void SetFoodInfo(CFood info);
  47. void SetFoodpackageInfo(CFoodpackage info);
  48. void SetIsTaocan(bool is_taocan);
  49. void SetDabao();
  50. CFood GetFoodInfo();
  51. CFoodpackage GetFoodpackageInfo();
  52. bool GetIsTaocan();
  53. //根据当前选中的商品属性、份数,计算商品的展示价格
  54. void UpdateShowPrice();
  55. //这个是单价,包含属性价格,不考虑数量,也就是“1份”的价格
  56. std::string getSinglePrice();
  57. //获取用户展示的商品名字,如果有打包会在前面显示【打包】,不包含商品属性
  58. std::string getNameShow();
  59. //获取用于展示的属性名字,仅仅是属性名字,如“热、多糖、大杯”
  60. std::string getNatureShow();
  61. //获取用于完整展示的商品名字,包含商品本身的名字和属性,例如“【打包】珍珠奶茶【大杯、热、多糖】”
  62. std::string getNameWanzhengShow();
  63. //根据当前会员等级,计算该商品的会员优惠金额
  64. double getMemberYouhui(std::string member_level);
  65. //计算当前这个商品的打包费
  66. double getDabaoMoney();
  67. //获取点单相关的参数(仅用于非套餐)
  68. std::map<string, string> getDiandanParam();
  69. //获取点单相关的套餐参数(仅用于套餐)
  70. rapidjson::Document getDiandanTaocanParam(rapidjson::Document::AllocatorType &allocator);
  71. };