Просмотр исходного кода

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

zhengbingbing лет назад: 5
Родитель
Сommit
93393d063b

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

@@ -60,6 +60,16 @@ namespace System.Model
60 60
 		private string _f_stockusername = "";
61 61
 		private int _f_senduser = 0;
62 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 74
 		/// <summary>
65 75
 		/// 审核备注

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

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

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

@@ -97,6 +97,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
97 97
             modelOrder.F_Address = input.F_Address;
98 98
             modelOrder.F_PostalCode = input.F_PostalCode;
99 99
             modelOrder.F_Express = input.F_Express;
100
+            modelOrder.F_ExpressFee= input.F_ExpressFee;
100 101
 
101 102
             modelOrder.F_PayType = input.F_PayType;
102 103
             modelOrder.F_Stock = input.F_Stock;
@@ -114,7 +115,8 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
114 115
             modelOrder.F_AddTime = DateTime.Now;
115 116
             modelOrder.F_AddUser = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
116 117
             modelOrder.F_AddUserName = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name).Value;
117
-
118
+            modelOrder.F_Belong = 0;
119
+            modelOrder.F_BelongName = "";
118 120
             #endregion
119 121
 
120 122
             //计算属性  商品计算
@@ -132,6 +134,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
132 134
             {
133 135
                 int n = 1;
134 136
                 int n2 = input.OrderDetailList.Count + 1;
137
+                #region 活动核算
135 138
                 if (input.UseActList != null && input.UseActList.Count > 0)
136 139
                 {
137 140
                     //遍历所有选中的活动
@@ -185,6 +188,9 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
185 188
                     }
186 189
                     UseActivity = UseActivity.Trim(',');
187 190
                 }
191
+                #endregion
192
+
193
+                #region 商品核算
188 194
                 foreach (OrderDetailInput m in input.OrderDetailList)
189 195
                 {
190 196
                     T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId && b.F_IsSale == 1);
@@ -233,7 +239,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
233 239
 
234 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 248
             else
239 249
             {
@@ -330,20 +340,8 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
330 340
             }
331 341
 
332 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 346
             #region 核算是否支付完成
349 347
             if ((modelOrder.F_RealPrice + modelOrder.F_UseScore / modelscore.F_GetPercent) >= modelOrder.F_ShouldPrice)
@@ -572,10 +570,9 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
572 570
 
573 571
                     n++;
574 572
                 }
575
-                modelOrder.F_TotlePrice = totle;
576 573
 
577 574
                 #endregion
578
-
575
+                modelOrder.F_TotlePrice = totle;
579 576
                 modelOrder.F_ActivityMoney = ActivityMoney;
580 577
                 modelOrder.F_UseActivity = UseActivity;
581 578
             }
@@ -696,7 +693,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
696 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 698
             if ((modelOrder.F_RealPrice + modelOrder.F_UseScore / modelscore.F_GetPercent) >= modelOrder.F_ShouldPrice)
702 699
             {
@@ -742,9 +739,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
742 739
             if (input.Count < 1)
743 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 748
             Dictionary<int, string> chooseact = new Dictionary<int, string>();
750 749
             List<UseActInput> actlist = new List<UseActInput>();
@@ -756,10 +755,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
756 755
                     //是否有活动标签
757 756
                     if (modelProduct.F_Tag.IndexOf(".") > -1)
758 757
                     {
759
-                        string[] tagarry = m.Tags.Split(',');
758
+                        string[] tagarry = modelProduct.F_Tag.Split(',');
760 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 764
                         if (modelactive != null)
@@ -770,15 +769,15 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
770 769
                                 //判断此人是否有参与活动的资格  默认暂不筛选
771 770
                                 if (chooseact.ContainsKey(modelactive.F_ID))
772 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 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 782
                                     chooseact.Add(modelactive.F_ID, "1_" + modelactive.F_Gift);
784 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,24 +796,39 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
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 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 833
                             else if (modelactive.F_Type == 4)
820 834
                             {
@@ -823,7 +837,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
823 837
                                 if (chooseact.ContainsKey(modelactive.F_ID))
824 838
                                 {
825 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 842
                                 else
829 843
                                 {

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

@@ -230,7 +230,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
230 230
             {
231 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 234
                     if (count == 0)
235 235
                     {
236 236
                         listres.Add(t);

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

@@ -40,7 +40,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
40 40
         /// <summary>
41 41
         /// 金额
42 42
         /// </summary>
43
-        public int? F_Money { get; set; }
43
+        public string F_Money { get; set; } = "";
44 44
         /// <summary>
45 45
         /// 开始时间
46 46
         /// </summary>

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

@@ -61,6 +61,16 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
61 61
         private string _f_stockusername = "";
62 62
         private int _f_senduser = 0;
63 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 75
         /// <summary>
66 76
         /// 审核备注