Browse Source

Merge branch 'master' of http://192.168.1.222:3000/zhengbingbing/ZLJ_API_V6.0

zhengbingbing 5 years ago
parent
commit
93393d063b

+ 10 - 0
代码/System.Model/T_Bus_Order.cs

60
 		private string _f_stockusername = "";
60
 		private string _f_stockusername = "";
61
 		private int _f_senduser = 0;
61
 		private int _f_senduser = 0;
62
 		private string _f_sendusername = "";
62
 		private string _f_sendusername = "";
63
+		private decimal _f_expressfee = 10;
64
+
65
+		/// <summary>
66
+		/// 快递费
67
+		/// </summary>
68
+		public decimal F_ExpressFee
69
+		{
70
+			set { _f_expressfee = value; }
71
+			get { return _f_expressfee; }
72
+		}
63
 
73
 
64
 		/// <summary>
74
 		/// <summary>
65
 		/// 审核备注
75
 		/// 审核备注

+ 2 - 2
代码/System.Model/T_Sys_Marketing.cs

19
         private string _f_commodity;
19
         private string _f_commodity;
20
         private string _f_describe;
20
         private string _f_describe;
21
         private string _f_gift;
21
         private string _f_gift;
22
-        private int? _f_money;
22
+        private string _f_money="";
23
         private DateTime? _f_starttime;
23
         private DateTime? _f_starttime;
24
         private DateTime? _f_endtime;
24
         private DateTime? _f_endtime;
25
         private string _f_member;
25
         private string _f_member;
94
         /// <summary>
94
         /// <summary>
95
         /// 金额
95
         /// 金额
96
         /// </summary>
96
         /// </summary>
97
-        public int? F_Money
97
+        public string F_Money
98
         {
98
         {
99
             set { _f_money = value; }
99
             set { _f_money = value; }
100
             get { return _f_money; }
100
             get { return _f_money; }

+ 53 - 39
代码/TVShoppingCallCenter_ZLJ/Controllers/Order/OrderController.cs

97
             modelOrder.F_Address = input.F_Address;
97
             modelOrder.F_Address = input.F_Address;
98
             modelOrder.F_PostalCode = input.F_PostalCode;
98
             modelOrder.F_PostalCode = input.F_PostalCode;
99
             modelOrder.F_Express = input.F_Express;
99
             modelOrder.F_Express = input.F_Express;
100
+            modelOrder.F_ExpressFee= input.F_ExpressFee;
100
 
101
 
101
             modelOrder.F_PayType = input.F_PayType;
102
             modelOrder.F_PayType = input.F_PayType;
102
             modelOrder.F_Stock = input.F_Stock;
103
             modelOrder.F_Stock = input.F_Stock;
114
             modelOrder.F_AddTime = DateTime.Now;
115
             modelOrder.F_AddTime = DateTime.Now;
115
             modelOrder.F_AddUser = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
116
             modelOrder.F_AddUser = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
116
             modelOrder.F_AddUserName = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name).Value;
117
             modelOrder.F_AddUserName = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name).Value;
117
-
118
+            modelOrder.F_Belong = 0;
119
+            modelOrder.F_BelongName = "";
118
             #endregion
120
             #endregion
119
 
121
 
120
             //计算属性  商品计算
122
             //计算属性  商品计算
132
             {
134
             {
133
                 int n = 1;
135
                 int n = 1;
134
                 int n2 = input.OrderDetailList.Count + 1;
136
                 int n2 = input.OrderDetailList.Count + 1;
137
+                #region 活动核算
135
                 if (input.UseActList != null && input.UseActList.Count > 0)
138
                 if (input.UseActList != null && input.UseActList.Count > 0)
136
                 {
139
                 {
137
                     //遍历所有选中的活动
140
                     //遍历所有选中的活动
185
                     }
188
                     }
186
                     UseActivity = UseActivity.Trim(',');
189
                     UseActivity = UseActivity.Trim(',');
187
                 }
190
                 }
191
+                #endregion
192
+
193
+                #region 商品核算
188
                 foreach (OrderDetailInput m in input.OrderDetailList)
194
                 foreach (OrderDetailInput m in input.OrderDetailList)
189
                 {
195
                 {
190
                     T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId && b.F_IsSale == 1);
196
                     T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId && b.F_IsSale == 1);
233
 
239
 
234
                     n++;
240
                     n++;
235
                 }
241
                 }
242
+                #endregion
236
 
243
 
244
+                modelOrder.F_TotlePrice = totle;
245
+                modelOrder.F_ActivityMoney = ActivityMoney;
246
+                modelOrder.F_UseActivity = UseActivity;
237
             }
247
             }
238
             else
248
             else
239
             {
249
             {
330
             }
340
             }
331
 
341
 
332
             #endregion
342
             #endregion
333
-            //计算结果  积分有规则
334
-
335
-
336
-
337
-            modelOrder.F_TotlePrice = totle;
338
-            modelOrder.F_ShouldPrice = modelOrder.F_TotlePrice - ActivityMoney;
339
-            modelOrder.F_ActivityMoney = ActivityMoney;
340
-            modelOrder.F_UseActivity = UseActivity;
341
-            modelOrder.F_Belong = 0;
342
-            modelOrder.F_BelongName = "";
343
-
344
-
345
-
346
-
343
+            //计算结果  积分有规则            
344
+            modelOrder.F_ShouldPrice = modelOrder.F_TotlePrice - ActivityMoney+ modelOrder.F_ExpressFee;
347
 
345
 
348
             #region 核算是否支付完成
346
             #region 核算是否支付完成
349
             if ((modelOrder.F_RealPrice + modelOrder.F_UseScore / modelscore.F_GetPercent) >= modelOrder.F_ShouldPrice)
347
             if ((modelOrder.F_RealPrice + modelOrder.F_UseScore / modelscore.F_GetPercent) >= modelOrder.F_ShouldPrice)
572
 
570
 
573
                     n++;
571
                     n++;
574
                 }
572
                 }
575
-                modelOrder.F_TotlePrice = totle;
576
 
573
 
577
                 #endregion
574
                 #endregion
578
-
575
+                modelOrder.F_TotlePrice = totle;
579
                 modelOrder.F_ActivityMoney = ActivityMoney;
576
                 modelOrder.F_ActivityMoney = ActivityMoney;
580
                 modelOrder.F_UseActivity = UseActivity;
577
                 modelOrder.F_UseActivity = UseActivity;
581
             }
578
             }
696
             #endregion
693
             #endregion
697
 
694
 
698
 
695
 
699
-            modelOrder.F_ShouldPrice = modelOrder.F_TotlePrice - modelOrder.F_ActivityMoney;
696
+            modelOrder.F_ShouldPrice = modelOrder.F_TotlePrice - modelOrder.F_ActivityMoney + modelOrder.F_ExpressFee;
700
 
697
 
701
             if ((modelOrder.F_RealPrice + modelOrder.F_UseScore / modelscore.F_GetPercent) >= modelOrder.F_ShouldPrice)
698
             if ((modelOrder.F_RealPrice + modelOrder.F_UseScore / modelscore.F_GetPercent) >= modelOrder.F_ShouldPrice)
702
             {
699
             {
742
             if (input.Count < 1)
739
             if (input.Count < 1)
743
                 return Error("请选择商品/数量");
740
                 return Error("请选择商品/数量");
744
 
741
 
745
-            //统计活动金额是否符合条件
746
-            Dictionary<int, decimal> totleact = new Dictionary<int, decimal>();
747
-
742
+            //统计活动金额是否符合条件 满减
743
+            Dictionary<int, decimal> acttype3 = new Dictionary<int, decimal>();
744
+            //内部计算
745
+            Dictionary<int, decimal> innerCompute = new Dictionary<int, decimal>();
746
+            
748
             //选择活动
747
             //选择活动
749
             Dictionary<int, string> chooseact = new Dictionary<int, string>();
748
             Dictionary<int, string> chooseact = new Dictionary<int, string>();
750
             List<UseActInput> actlist = new List<UseActInput>();
749
             List<UseActInput> actlist = new List<UseActInput>();
756
                     //是否有活动标签
755
                     //是否有活动标签
757
                     if (modelProduct.F_Tag.IndexOf(".") > -1)
756
                     if (modelProduct.F_Tag.IndexOf(".") > -1)
758
                     {
757
                     {
759
-                        string[] tagarry = m.Tags.Split(',');
758
+                        string[] tagarry = modelProduct.F_Tag.Split(',');
760
                         string tag = tagarry.First(a => a.StartsWith(".")).ToString();
759
                         string tag = tagarry.First(a => a.StartsWith(".")).ToString();
761
                         //标签内有效期
760
                         //标签内有效期
762
-                        T_Sys_Marketing modelactive = await bus_MarketingRepository.GetSingle(b => string.Format(",{0},", b.F_Commodity).Contains(string.Format(",{0},", tag)) && b.F_StartTime <= DateTime.Now && b.F_EndTime >= DateTime.Now);
761
+                        T_Sys_Marketing modelactive = await bus_MarketingRepository.GetSingle(b => (","+ b.F_Commodity + "," ).Contains(","+ tag + ",") && b.F_StartTime <= DateTime.Now && b.F_EndTime >= DateTime.Now);
763
 
762
 
764
                         //此商品参加活动
763
                         //此商品参加活动
765
                         if (modelactive != null)
764
                         if (modelactive != null)
770
                                 //判断此人是否有参与活动的资格  默认暂不筛选
769
                                 //判断此人是否有参与活动的资格  默认暂不筛选
771
                                 if (chooseact.ContainsKey(modelactive.F_ID))
770
                                 if (chooseact.ContainsKey(modelactive.F_ID))
772
                                     continue;
771
                                     continue;
773
-                                if (totleact.ContainsKey(modelactive.F_ID))
772
+                                if (innerCompute.ContainsKey(modelactive.F_ID))
774
                                 {
773
                                 {
775
-                                    totleact[modelactive.F_ID] = (decimal)modelProduct.F_MemberPrice * m.F_Count + totleact[modelactive.F_ID].ObjToDecimal();
774
+                                    innerCompute[modelactive.F_ID] = (decimal)modelProduct.F_MemberPrice * m.F_Count + innerCompute[modelactive.F_ID].ObjToDecimal();
776
                                 }
775
                                 }
777
                                 else
776
                                 else
778
                                 {
777
                                 {
779
-                                    totleact.Add(modelactive.F_ID, (decimal)modelProduct.F_MemberPrice * m.F_Count);
778
+                                    innerCompute.Add(modelactive.F_ID, (decimal)modelProduct.F_MemberPrice * m.F_Count);
780
                                 }
779
                                 }
781
-                                if ((decimal)modelactive.F_Money <= (decimal)totleact[modelactive.F_ID])
780
+                                if (modelactive.F_Money.ObjToDecimal() <= (decimal)innerCompute[modelactive.F_ID])
782
                                 {
781
                                 {
783
                                     chooseact.Add(modelactive.F_ID, "1_" + modelactive.F_Gift);
782
                                     chooseact.Add(modelactive.F_ID, "1_" + modelactive.F_Gift);
784
                                     actlist.Add(new UseActInput { id = modelactive.F_ID, type = 1, gift = modelactive.F_Gift, money = def, actname = modelactive.F_Name, actdes = modelactive.F_PromotionRules });
783
                                     actlist.Add(new UseActInput { id = modelactive.F_ID, type = 1, gift = modelactive.F_Gift, money = def, actname = modelactive.F_Name, actdes = modelactive.F_PromotionRules });
797
                             {
796
                             {
798
                                 //满减
797
                                 //满减
799
                                 //判断此人是否有参与活动的资格  默认暂不筛选
798
                                 //判断此人是否有参与活动的资格  默认暂不筛选
800
-                                if (chooseact.ContainsKey(modelactive.F_ID))
801
-                                    continue;
802
-                                if (totleact.ContainsKey(modelactive.F_ID))
799
+
800
+                                if (innerCompute.ContainsKey(modelactive.F_ID))
803
                                 {
801
                                 {
804
-                                    totleact[modelactive.F_ID] = (decimal)modelProduct.F_MemberPrice * m.F_Count + totleact[modelactive.F_ID].ObjToDecimal();
802
+                                    innerCompute[modelactive.F_ID] = (decimal)modelProduct.F_MemberPrice * m.F_Count + innerCompute[modelactive.F_ID];
805
                                 }
803
                                 }
806
                                 else
804
                                 else
807
                                 {
805
                                 {
808
-                                    totleact.Add(modelactive.F_ID, (decimal)modelProduct.F_MemberPrice * m.F_Count);
806
+                                    innerCompute.Add(modelactive.F_ID, (decimal)modelProduct.F_MemberPrice * m.F_Count);
809
                                 }
807
                                 }
810
-                                if ((decimal)modelactive.F_Money <= (decimal)totleact[modelactive.F_ID])
808
+                                string[] AmountRange = modelactive.F_AmountRange.Split(',');
809
+                                for (int i=0;i< AmountRange.Length;i++)
811
                                 {
810
                                 {
812
-                                    chooseact.Add(modelactive.F_ID, "3_" + modelactive.F_AmountRange.ToString());
813
-
814
-                                    decimal.TryParse(modelactive.F_AmountRange, out def);
815
-                                    actlist.Add(new UseActInput { id = modelactive.F_ID, type = 3, gift = "", money = def, actname = modelactive.F_Name, actdes = modelactive.F_PromotionRules });
816
-                                    def = 0.00M;
811
+                                    //符合满减某个条件
812
+                                    if (innerCompute[modelactive.F_ID] >= AmountRange[i].ObjToDecimal())
813
+                                    {
814
+                                        if (acttype3.ContainsKey(modelactive.F_ID))
815
+                                        {
816
+                                            //当前减免金额大于之前发赋值,替换掉
817
+                                            if (modelactive.F_Money.Split(',')[i].ObjToDecimal() > acttype3[modelactive.F_ID])
818
+                                            {
819
+                                                acttype3[modelactive.F_ID] = modelactive.F_Money.Split(',')[i].ObjToDecimal();
820
+                                                actlist.ForEach(q => { if (q.id == modelactive.F_ID) { q.money = modelactive.F_Money.Split(',')[i].ObjToDecimal(); } });
821
+                                            }
822
+                                        }
823
+                                        else
824
+                                        {
825
+                                            //满足条件,赋值满减金额 减的金额
826
+                                            acttype3.Add(modelactive.F_ID, modelactive.F_Money.Split(',')[i].ObjToDecimal());
827
+                                            actlist.Add(new UseActInput { id = modelactive.F_ID, type = 3, gift = "", money = modelactive.F_Money.Split(',')[i].ObjToDecimal(), actname = modelactive.F_Name, actdes = modelactive.F_PromotionRules });
828
+                                        }
829
+                                    }
817
                                 }
830
                                 }
831
+                                
818
                             }
832
                             }
819
                             else if (modelactive.F_Type == 4)
833
                             else if (modelactive.F_Type == 4)
820
                             {
834
                             {
823
                                 if (chooseact.ContainsKey(modelactive.F_ID))
837
                                 if (chooseact.ContainsKey(modelactive.F_ID))
824
                                 {
838
                                 {
825
                                     chooseact[modelactive.F_ID] = chooseact[modelactive.F_ID] + "," + m.F_ProductId.ToString();
839
                                     chooseact[modelactive.F_ID] = chooseact[modelactive.F_ID] + "," + m.F_ProductId.ToString();
826
-                                    actlist.First(cc => cc.id == modelactive.F_ID).gift += "," + m.F_ProductId.ToString();
840
+                                    actlist.ForEach(q => { if (q.id == modelactive.F_ID){ q.gift = q.gift + m.F_ProductId.ToString(); } });
827
                                 }
841
                                 }
828
                                 else
842
                                 else
829
                                 {
843
                                 {

+ 1 - 1
代码/TVShoppingCallCenter_ZLJ/Controllers/Product/TagController.cs

230
             {
230
             {
231
                 foreach (T_Bus_Tag t in list)
231
                 foreach (T_Bus_Tag t in list)
232
                 {
232
                 {
233
-                    int count = await bus_MarketingRepository.GetCount(q => string.Format(",{0},", q.F_Commodity).Contains(string.Format(",{0},", t.F_TagName)));
233
+                    int count = await bus_MarketingRepository.GetCount(q => (","+ q.F_Commodity + ",").Contains("," + t.F_TagName + ",")&&q.F_StartTime<=DateTime.Now&& q.F_EndTime >= DateTime.Now );
234
                     if (count == 0)
234
                     if (count == 0)
235
                     {
235
                     {
236
                         listres.Add(t);
236
                         listres.Add(t);

+ 1 - 1
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/MarketingInput.cs

40
         /// <summary>
40
         /// <summary>
41
         /// 金额
41
         /// 金额
42
         /// </summary>
42
         /// </summary>
43
-        public int? F_Money { get; set; }
43
+        public string F_Money { get; set; } = "";
44
         /// <summary>
44
         /// <summary>
45
         /// 开始时间
45
         /// 开始时间
46
         /// </summary>
46
         /// </summary>

+ 10 - 0
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/OrderInput.cs

61
         private string _f_stockusername = "";
61
         private string _f_stockusername = "";
62
         private int _f_senduser = 0;
62
         private int _f_senduser = 0;
63
         private string _f_sendusername = "";
63
         private string _f_sendusername = "";
64
+        private decimal _f_expressfee = 10;
65
+        
66
+        /// <summary>
67
+        /// 快递费
68
+        /// </summary>
69
+        public decimal F_ExpressFee
70
+        {
71
+            set { _f_expressfee = value; }
72
+            get { return _f_expressfee; }
73
+        }
64
 
74
 
65
         /// <summary>
75
         /// <summary>
66
         /// 审核备注
76
         /// 审核备注