| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #pragma once
- #include "../zhipuzi/CFood.h"
- #include "../zhipuzi/CFoodpackage.h"
- #include "../control/CDiandanNatureItemUI.h"
- class MemberPrice
- {
- public:
- std::string id;
- std::string level;
- std::string price;
- };
- /**
- * 订单中的一个商品
- */
- class CDiandanOrderItem
- {
- public:
- //是否套餐的Item,因为目前套餐和普通商品都是用同一个Item类
- bool m_is_taocan = false;
- //普通商品才有的信息
- std::string food_id;
- std::string food_name;
- std::string type_id;
- bool is_weight = false;
- bool is_nature = false;
- //会员价
- bool is_member_price_used;
- std::vector<MemberPrice> m_member_price;
- //套餐才有的信息
- std::string foodpackage_id;
- std::string foodpackage_name;
- //这个是套餐和普通商品共有的信息
- std::string price;
- bool is_dabao = false;
- std::string dabao_money;
- std::string num;
- //这个用来存储所有属性选择的信息,每个属性选择的是第几个,什么价格等等
- std::vector<FoodNatureSelectValue> natureSelectedArray;
- //这个是商品对外展示的价格,根据数量和属性来计算的,不包含打包费
- std::string show_price;
- private:
- CFood m_foodinfo;
- CFoodpackage m_foodpackageinfo;
- public:
- bool operator==(CDiandanOrderItem& t);
- void SetFoodInfo(CFood info);
- void SetFoodpackageInfo(CFoodpackage info);
- void SetIsTaocan(bool is_taocan);
- void SetDabao();
- CFood GetFoodInfo();
- CFoodpackage GetFoodpackageInfo();
- bool GetIsTaocan();
- //根据当前选中的商品属性、份数,计算商品的展示价格
- void UpdateShowPrice();
- //这个是单价,包含属性价格,不考虑数量,也就是“1份”的价格
- std::string getSinglePrice();
- //获取用户展示的商品名字,如果有打包会在前面显示【打包】,不包含商品属性
- std::string getNameShow();
- //获取用于展示的属性名字,仅仅是属性名字,如“热、多糖、大杯”
- std::string getNatureShow();
- //获取用于完整展示的商品名字,包含商品本身的名字和属性,例如“【打包】珍珠奶茶【大杯、热、多糖】”
- std::string getNameWanzhengShow();
- //根据当前会员等级,计算该商品的会员优惠金额
- double getMemberYouhui(std::string member_level);
- //计算当前这个商品的打包费
- double getDabaoMoney();
- //获取点单相关的参数(仅用于非套餐)
- std::map<string, string> getDiandanParam();
- //获取点单相关的套餐参数(仅用于套餐)
- rapidjson::Document getDiandanTaocanParam(rapidjson::Document::AllocatorType &allocator);
- };
|