Explorar el Código

提交订单活动的计算

zhangkun %!s(int64=5) %!d(string=hace) años
padre
commit
bb25fa4c73

+ 35 - 12
代码/System.Model/T_Bus_Order.cs

25
 		private string _f_customerphone = "";
25
 		private string _f_customerphone = "";
26
 		private int _f_vipid;
26
 		private int _f_vipid;
27
 		private decimal _f_score = 0.00M;
27
 		private decimal _f_score = 0.00M;
28
+		private decimal _f_usescore = 0.00M;
28
 		private int _f_state = 0;
29
 		private int _f_state = 0;
29
 		private int _f_status = 0;
30
 		private int _f_status = 0;
30
-		private DateTime _f_addtime = DateTime.Now;
31
+		private DateTime _f_addtime=DateTime.Now;
31
 		private DateTime? _f_submittime;
32
 		private DateTime? _f_submittime;
32
 		private DateTime? _f_checktime;
33
 		private DateTime? _f_checktime;
33
 		private DateTime? _f_stocktime;
34
 		private DateTime? _f_stocktime;
38
 		private string _f_addusername;
39
 		private string _f_addusername;
39
 		private int _f_belong;
40
 		private int _f_belong;
40
 		private string _f_belongname;
41
 		private string _f_belongname;
41
-		private decimal? _f_totleprice;
42
+		private decimal _f_totleprice;
42
 		private string _f_useactivity = "";
43
 		private string _f_useactivity = "";
43
-		private decimal? _f_shouldprice;
44
-		private decimal? _f_realprice;
44
+		private string _f_useactivitydes = "";
45
+		private decimal _f_activitymoney;
46
+		private decimal _f_shouldprice;
47
+		private decimal _f_realprice;
45
 		private string _f_paytype = "";
48
 		private string _f_paytype = "";
46
 		private string _f_stock = "";
49
 		private string _f_stock = "";
47
 		private string _f_express = "";
50
 		private string _f_express = "";
48
 		private string _f_remark = "";
51
 		private string _f_remark = "";
49
 		private string _f_adfrom = "";
52
 		private string _f_adfrom = "";
50
 		private string _f_type = "";
53
 		private string _f_type = "";
51
-
52
-
53
 		/// <summary>
54
 		/// <summary>
54
 		/// 订单编号 BJ员工工号+T+时间
55
 		/// 订单编号 BJ员工工号+T+时间
55
 		/// </summary>
56
 		/// </summary>
171
 			get { return _f_score; }
172
 			get { return _f_score; }
172
 		}
173
 		}
173
 		/// <summary>
174
 		/// <summary>
175
+		/// 使用积分
176
+		/// </summary>
177
+		public decimal F_UseScore
178
+		{
179
+			set { _f_usescore = value; }
180
+			get { return _f_usescore; }
181
+		}
182
+		/// <summary>
174
 		/// 订单状态 -1无效 0暂存 其他待定
183
 		/// 订单状态 -1无效 0暂存 其他待定
175
 		/// </summary>
184
 		/// </summary>
176
 		public int F_State
185
 		public int F_State
277
 		/// <summary>
286
 		/// <summary>
278
 		/// 订单总额
287
 		/// 订单总额
279
 		/// </summary>
288
 		/// </summary>
280
-		public decimal? F_TotlePrice
289
+		public decimal F_TotlePrice
281
 		{
290
 		{
282
 			set { _f_totleprice = value; }
291
 			set { _f_totleprice = value; }
283
 			get { return _f_totleprice; }
292
 			get { return _f_totleprice; }
291
 			get { return _f_useactivity; }
300
 			get { return _f_useactivity; }
292
 		}
301
 		}
293
 		/// <summary>
302
 		/// <summary>
303
+		/// 使用活动描述
304
+		/// </summary>
305
+		public string F_UseActivityDes
306
+		{
307
+			set { _f_useactivitydes = value; }
308
+			get { return _f_useactivitydes; }
309
+		}
310
+		/// <summary>
311
+		/// 活动优惠金额    一般指满减
312
+		/// </summary>
313
+		public decimal F_ActivityMoney
314
+		{
315
+			set { _f_activitymoney = value; }
316
+			get { return _f_activitymoney; }
317
+		}
318
+		/// <summary>
294
 		/// 应收金额 交易金额
319
 		/// 应收金额 交易金额
295
 		/// </summary>
320
 		/// </summary>
296
-		public decimal? F_ShouldPrice
321
+		public decimal F_ShouldPrice
297
 		{
322
 		{
298
 			set { _f_shouldprice = value; }
323
 			set { _f_shouldprice = value; }
299
 			get { return _f_shouldprice; }
324
 			get { return _f_shouldprice; }
301
 		/// <summary>
326
 		/// <summary>
302
 		/// 实收金额
327
 		/// 实收金额
303
 		/// </summary>
328
 		/// </summary>
304
-		public decimal? F_RealPrice
329
+		public decimal F_RealPrice
305
 		{
330
 		{
306
 			set { _f_realprice = value; }
331
 			set { _f_realprice = value; }
307
 			get { return _f_realprice; }
332
 			get { return _f_realprice; }
338
 			set { _f_remark = value; }
363
 			set { _f_remark = value; }
339
 			get { return _f_remark; }
364
 			get { return _f_remark; }
340
 		}
365
 		}
341
-
342
 		/// <summary>
366
 		/// <summary>
343
 		/// 广告来源
367
 		/// 广告来源
344
 		/// </summary>
368
 		/// </summary>
347
 			set { _f_adfrom = value; }
371
 			set { _f_adfrom = value; }
348
 			get { return _f_adfrom; }
372
 			get { return _f_adfrom; }
349
 		}
373
 		}
350
-
351
 		/// <summary>
374
 		/// <summary>
352
-		/// 订单类型
375
+		/// 订单类型  回访订单,热线订单==
353
 		/// </summary>
376
 		/// </summary>
354
 		public string F_Type
377
 		public string F_Type
355
 		{
378
 		{

+ 8 - 8
代码/System.Model/T_Bus_Product.cs

23
 		private string _f_factory="";
23
 		private string _f_factory="";
24
 		private string _f_address="";
24
 		private string _f_address="";
25
 		private string _f_supplier="";
25
 		private string _f_supplier="";
26
-		private decimal? _f_score=0.00M;
27
-		private decimal? _f_marketprice=0.00M;
28
-		private decimal? _f_memberprice = 0.00M;
29
-		private decimal? _f_specialprice = 0.00M;
26
+		private decimal _f_score=0.00M;
27
+		private decimal _f_marketprice=0.00M;
28
+		private decimal _f_memberprice = 0.00M;
29
+		private decimal _f_specialprice = 0.00M;
30
 		private int? _f_isdelete=0;
30
 		private int? _f_isdelete=0;
31
 		private string _f_des="";
31
 		private string _f_des="";
32
 		private string _f_attribute;
32
 		private string _f_attribute;
154
 		/// <summary>
154
 		/// <summary>
155
 		/// 兑换积分
155
 		/// 兑换积分
156
 		/// </summary>
156
 		/// </summary>
157
-		public decimal? F_Score
157
+		public decimal F_Score
158
 		{
158
 		{
159
 			set { _f_score = value; }
159
 			set { _f_score = value; }
160
 			get { return _f_score; }
160
 			get { return _f_score; }
162
 		/// <summary>
162
 		/// <summary>
163
 		/// 市场价
163
 		/// 市场价
164
 		/// </summary>
164
 		/// </summary>
165
-		public decimal? F_MarketPrice
165
+		public decimal F_MarketPrice
166
 		{
166
 		{
167
 			set { _f_marketprice = value; }
167
 			set { _f_marketprice = value; }
168
 			get { return _f_marketprice; }
168
 			get { return _f_marketprice; }
170
 		/// <summary>
170
 		/// <summary>
171
 		/// 会员价
171
 		/// 会员价
172
 		/// </summary>
172
 		/// </summary>
173
-		public decimal? F_MemberPrice
173
+		public decimal F_MemberPrice
174
 		{
174
 		{
175
 			set { _f_memberprice = value; }
175
 			set { _f_memberprice = value; }
176
 			get { return _f_memberprice; }
176
 			get { return _f_memberprice; }
178
 		/// <summary>
178
 		/// <summary>
179
 		/// 特价/优惠价
179
 		/// 特价/优惠价
180
 		/// </summary>
180
 		/// </summary>
181
-		public decimal? F_SpecialPrice
181
+		public decimal F_SpecialPrice
182
 		{
182
 		{
183
 			set { _f_specialprice = value; }
183
 			set { _f_specialprice = value; }
184
 			get { return _f_specialprice; }
184
 			get { return _f_specialprice; }

+ 105 - 47
代码/TVShoppingCallCenter_ZLJ/Controllers/Order/OrderController.cs

80
             modelOrder.F_Stock = input.F_Stock;
80
             modelOrder.F_Stock = input.F_Stock;
81
             modelOrder.F_Remark = input.F_Remark;
81
             modelOrder.F_Remark = input.F_Remark;
82
 
82
 
83
+            modelOrder.F_RealPrice = input.F_RealPrice;
84
+
83
             //选填 关联属性
85
             //选填 关联属性
84
             modelOrder.F_VipId = input.F_VipId;
86
             modelOrder.F_VipId = input.F_VipId;
85
 
87
 
86
             modelOrder.F_Type = input.F_Type;
88
             modelOrder.F_Type = input.F_Type;
87
             modelOrder.F_State = input.F_State;
89
             modelOrder.F_State = input.F_State;
88
             modelOrder.F_Status = input.F_Status;
90
             modelOrder.F_Status = input.F_Status;
89
-            modelOrder.F_UseActivity = input.F_UseActivity;
91
+
90
             //必须属性 系统生成
92
             //必须属性 系统生成
91
             modelOrder.F_AddTime = DateTime.Now;
93
             modelOrder.F_AddTime = DateTime.Now;
92
             modelOrder.F_AddUser = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
94
             modelOrder.F_AddUser = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
95
             //计算属性  商品计算
97
             //计算属性  商品计算
96
             decimal F_Score = 0.00M;
98
             decimal F_Score = 0.00M;
97
             decimal totle = 0.00M;
99
             decimal totle = 0.00M;
98
-            decimal F_ShouldPrice = 0.00M; 
99
-            decimal F_RealPrice = 0.00M;
100
+            decimal ActivityMoney = 0.00M;
101
+            string UseActivity = "";
102
+            string UseActivity4 = ",";
100
             List<T_Bus_OrderDetail> modelDetailList = new List<T_Bus_OrderDetail>();
103
             List<T_Bus_OrderDetail> modelDetailList = new List<T_Bus_OrderDetail>();
101
-            if (input.OrderDetail != null && input.OrderDetail.Count > 0)
104
+
105
+
106
+            modelOrder.F_UseActivity = input.F_UseActivity;
107
+
108
+            if (input.OrderDetailList != null && input.OrderDetailList.Count > 0)
102
             {
109
             {
103
                 int n = 1;
110
                 int n = 1;
104
-                foreach (OrderDetailInput m in input.OrderDetail)
111
+                int n2 = input.OrderDetailList.Count + 1;
112
+                if (input.UseActList != null && input.UseActList.Count > 0)
113
+                {
114
+                    //遍历所有选中的活动
115
+                    foreach (UseActInput act in input.UseActList)
116
+                    {
117
+                        UseActivity += act + ",";
118
+                        //满赠,生日赠
119
+                        if (act.type == 1 || act.type == 2)
120
+                        {
121
+                            T_Bus_Product m = await bus_productRepository.GetSingle(b => b.F_ProductId == act.gift.ObjToInt()); ;
122
+
123
+                            T_Bus_OrderDetail modelDetail = new T_Bus_OrderDetail();
124
+                            modelDetail.F_ProductName = m.F_ProductName;
125
+                            modelDetail.F_ProductId = m.F_ProductId;
126
+                            modelDetail.F_Id = Guid.NewGuid().ToString().Replace("-", "");
127
+                            modelDetail.F_OrderId = input.F_Id;
128
+                            modelDetail.F_Count = 1;
129
+                            modelDetail.F_Price = 0.00M;
130
+                            modelDetail.F_DealPrice = 0.00M;
131
+                            modelDetail.F_Sort = n2;
132
+                            modelDetail.F_Remark = "赠品-活动:" + act.id;
133
+                            modelDetail.F_AddUser = modelOrder.F_AddUser;
134
+                            modelDetail.F_AddUserName = modelOrder.F_AddUserName;
135
+                            modelDetail.F_TotlePrice = 0.00M;
136
+                            modelDetail.F_Activity = act.id;
137
+
138
+                            modelDetailList.Add(modelDetail);
139
+
140
+                            n2++;
141
+                        }
142
+                        //满减
143
+                        else if (act.type == 3)
144
+                        {
145
+                            ActivityMoney += act.money;
146
+                        }
147
+                        else if (act.type == 4)
148
+                        {
149
+                            UseActivity4 += act.gift + ",";
150
+                        }
151
+                    }
152
+                    UseActivity = UseActivity.Trim(',');
153
+                }
154
+                foreach (OrderDetailInput m in input.OrderDetailList)
105
                 {
155
                 {
106
-                    T_Bus_Product modelProduct=await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId);
156
+                    T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId);
107
 
157
 
108
                     T_Bus_OrderDetail modelDetail = new T_Bus_OrderDetail();
158
                     T_Bus_OrderDetail modelDetail = new T_Bus_OrderDetail();
109
-                    modelDetail.F_ProductName = m.F_ProductName;
110
-                    modelDetail.F_ProductId = m.F_ProductId;
159
+                    modelDetail.F_ProductName = modelProduct.F_ProductName;
160
+                    modelDetail.F_ProductId = modelProduct.F_ProductId;
111
                     modelDetail.F_Id = Guid.NewGuid().ToString().Replace("-", "");
161
                     modelDetail.F_Id = Guid.NewGuid().ToString().Replace("-", "");
112
                     modelDetail.F_OrderId = input.F_Id;
162
                     modelDetail.F_OrderId = input.F_Id;
113
                     modelDetail.F_Count = m.F_Count;
163
                     modelDetail.F_Count = m.F_Count;
114
-                    modelDetail.F_Price = m.F_Price;
115
-                    modelDetail.F_DealPrice = m.F_DealPrice;                   
164
+                    modelDetail.F_Price = modelProduct.F_MemberPrice;
165
+                    //参加活动特价
166
+                    if (UseActivity4.Contains("," + modelProduct.F_ProductId + ","))
167
+                        modelDetail.F_DealPrice = modelProduct.F_SpecialPrice;
168
+                    else
169
+                        modelDetail.F_DealPrice = modelProduct.F_MemberPrice;
116
                     modelDetail.F_Sort = n;
170
                     modelDetail.F_Sort = n;
117
                     modelDetail.F_Remark = m.F_Remark;
171
                     modelDetail.F_Remark = m.F_Remark;
118
                     modelDetail.F_AddUser = modelOrder.F_AddUser;
172
                     modelDetail.F_AddUser = modelOrder.F_AddUser;
119
                     modelDetail.F_AddUserName = modelOrder.F_AddUserName;
173
                     modelDetail.F_AddUserName = modelOrder.F_AddUserName;
120
                     modelDetail.F_TotlePrice = modelDetail.F_DealPrice * modelDetail.F_Count;
174
                     modelDetail.F_TotlePrice = modelDetail.F_DealPrice * modelDetail.F_Count;
121
-                    modelDetail.F_Activity = 0; 
175
+                    modelDetail.F_Activity = 0;
122
                     //是否有活动标签
176
                     //是否有活动标签
123
                     if (m.Tags.IndexOf(".") > -1)
177
                     if (m.Tags.IndexOf(".") > -1)
124
                     {
178
                     {
125
                         string[] tagarry = m.Tags.Split(',');
179
                         string[] tagarry = m.Tags.Split(',');
126
-                        string tag=tagarry.First(a => a.StartsWith(".")).ToString();
180
+                        string tag = tagarry.First(a => a.StartsWith(".")).ToString();
127
                         T_Sys_Marketing modelactive = await bus_MarketingRepository.GetSingle(b => string.Format(",{0},", b.F_Commodity).Contains(string.Format(",{0},", tag)));
181
                         T_Sys_Marketing modelactive = await bus_MarketingRepository.GetSingle(b => string.Format(",{0},", b.F_Commodity).Contains(string.Format(",{0},", tag)));
128
 
182
 
129
                         //此商品参加活动
183
                         //此商品参加活动
132
                             modelDetail.F_Activity = modelactive.F_ID;
186
                             modelDetail.F_Activity = modelactive.F_ID;
133
                         }
187
                         }
134
                     }
188
                     }
135
-                   
189
+
136
                     totle += modelDetail.F_TotlePrice;
190
                     totle += modelDetail.F_TotlePrice;
191
+                    modelDetailList.Add(modelDetail);
137
 
192
 
138
                     n++;
193
                     n++;
139
                 }
194
                 }
140
 
195
 
141
 
196
 
142
             }
197
             }
143
-            F_ShouldPrice = totle;
144
-            //计算活动  单独写个方法
145
-            if (modelOrder.F_UseActivity.Length>0)
146
-            {
147
-                //详细活动规则
148
-            }
198
+
149
 
199
 
150
             //计算结果
200
             //计算结果
151
             modelOrder.F_Score = F_Score;
201
             modelOrder.F_Score = F_Score;
152
             modelOrder.F_TotlePrice = totle;
202
             modelOrder.F_TotlePrice = totle;
153
-            modelOrder.F_ShouldPrice = F_ShouldPrice;
154
-            modelOrder.F_RealPrice = F_RealPrice;
155
-            //Expression<Func<T_Bus_Product, bool>> eq = a => a.F_ProductName == input.ProductName;
156
-            //eq = eq.Or(b => b.F_PinyinShort == input.PinyinShort);
157
-            //eq = eq.Or(b => b.F_ProductId == input.ProductId);
158
-            //eq = eq.Or(b => b.F_ProductShortName == input.ProductShortName);
159
-            //if (await _productRepository.GetCount(eq) > 0)
160
-            //{
161
-            //    return Error("名称/条形码/简称 有重复");
162
-            //}
163
-
164
-            //List<ProductInput> inputlist = new List<ProductInput>();
165
-            //inputlist.Add(input);
203
+            modelOrder.F_ShouldPrice = modelOrder.F_TotlePrice- ActivityMoney;
204
+            modelOrder.F_ActivityMoney = ActivityMoney;
205
+            modelOrder.F_UseActivity = UseActivity;
206
+
207
+
166
             if (await bus_OrderRepository.Add(modelOrder) > 0)
208
             if (await bus_OrderRepository.Add(modelOrder) > 0)
167
             {
209
             {
168
-                return Success("订单保存成功");
210
+                if (await bus_OrderDetailRepository.AddMany(modelDetailList))
211
+                   return Success("订单添加成功");
212
+                else
213
+                    return Error("订单添加失败,请重试!");
169
             }
214
             }
170
             else
215
             else
171
             {
216
             {
172
-                return Error("订单保存失败,请重试!");
217
+                return Error("订单添加失败,请重试!");
173
             }
218
             }
174
 
219
 
175
         }
220
         }
182
         [HttpPost("getact")]
227
         [HttpPost("getact")]
183
         public async Task<IActionResult> GetAct([FromBody]List<OrderDetailInput> input)
228
         public async Task<IActionResult> GetAct([FromBody]List<OrderDetailInput> input)
184
         {
229
         {
185
-            if(input.Count<1)
230
+            decimal def = 0.00M;
231
+            if (input.Count < 1)
186
                 return Error("请选择商品/数量");
232
                 return Error("请选择商品/数量");
187
 
233
 
188
             //统计活动金额是否符合条件
234
             //统计活动金额是否符合条件
190
 
236
 
191
             //选择活动
237
             //选择活动
192
             Dictionary<int, string> chooseact = new Dictionary<int, string>();
238
             Dictionary<int, string> chooseact = new Dictionary<int, string>();
239
+            List<UseActInput> actlist = new List<UseActInput>();
193
             foreach (OrderDetailInput m in input)
240
             foreach (OrderDetailInput m in input)
194
             {
241
             {
195
                 T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId);
242
                 T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId);
200
                     string[] tagarry = m.Tags.Split(',');
247
                     string[] tagarry = m.Tags.Split(',');
201
                     string tag = tagarry.First(a => a.StartsWith(".")).ToString();
248
                     string tag = tagarry.First(a => a.StartsWith(".")).ToString();
202
                     //标签内有效期
249
                     //标签内有效期
203
-                    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);
250
+                    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);
204
 
251
 
205
                     //此商品参加活动
252
                     //此商品参加活动
206
                     if (modelactive != null)
253
                     if (modelactive != null)
209
                         {
256
                         {
210
                             //满赠
257
                             //满赠
211
                             //判断此人是否有参与活动的资格  默认暂不筛选
258
                             //判断此人是否有参与活动的资格  默认暂不筛选
259
+                            if (chooseact.ContainsKey(modelactive.F_ID))
260
+                                continue;
212
                             if (totleact.ContainsKey(modelactive.F_ID))
261
                             if (totleact.ContainsKey(modelactive.F_ID))
213
                             {
262
                             {
214
                                 totleact[modelactive.F_ID] = (decimal)modelProduct.F_MemberPrice * m.F_Count + totleact[modelactive.F_ID].ObjToDecimal();
263
                                 totleact[modelactive.F_ID] = (decimal)modelProduct.F_MemberPrice * m.F_Count + totleact[modelactive.F_ID].ObjToDecimal();
215
                             }
264
                             }
216
                             else
265
                             else
217
                             {
266
                             {
218
-                                totleact.Add(modelactive.F_ID, (decimal)modelProduct.F_MemberPrice * m.F_Count);                               
267
+                                totleact.Add(modelactive.F_ID, (decimal)modelProduct.F_MemberPrice * m.F_Count);
219
                             }
268
                             }
220
                             if ((decimal)modelactive.F_Money <= (decimal)totleact[modelactive.F_ID])
269
                             if ((decimal)modelactive.F_Money <= (decimal)totleact[modelactive.F_ID])
221
-                                chooseact.Add(modelactive.F_ID, modelactive.F_Gift);
270
+                            {
271
+                                chooseact.Add(modelactive.F_ID, "1_" + modelactive.F_Gift);
272
+                                actlist.Add(new UseActInput { id = modelactive.F_ID, type = 1, gift = modelactive.F_Gift, money = def });
273
+                            }
222
                         }
274
                         }
223
                         else if (modelactive.F_Type == 2)
275
                         else if (modelactive.F_Type == 2)
224
                         {
276
                         {
226
                             //TODO 判断此人是否有参与活动的资格  默认暂不筛选  
278
                             //TODO 判断此人是否有参与活动的资格  默认暂不筛选  
227
                             if (chooseact.ContainsKey(modelactive.F_ID))
279
                             if (chooseact.ContainsKey(modelactive.F_ID))
228
                                 continue;
280
                                 continue;
229
-                            chooseact.Add(modelactive.F_ID, modelactive.F_Commodity);                           
281
+                            chooseact.Add(modelactive.F_ID, "2_" + modelactive.F_Commodity);
282
+                            actlist.Add(new UseActInput { id = modelactive.F_ID, type = 2, gift = modelactive.F_Gift, money = def });
230
                         }
283
                         }
231
                         else if (modelactive.F_Type == 3)
284
                         else if (modelactive.F_Type == 3)
232
                         {
285
                         {
243
                                 totleact.Add(modelactive.F_ID, (decimal)modelProduct.F_MemberPrice * m.F_Count);
296
                                 totleact.Add(modelactive.F_ID, (decimal)modelProduct.F_MemberPrice * m.F_Count);
244
                             }
297
                             }
245
                             if ((decimal)modelactive.F_Money <= (decimal)totleact[modelactive.F_ID])
298
                             if ((decimal)modelactive.F_Money <= (decimal)totleact[modelactive.F_ID])
246
-                                chooseact.Add(modelactive.F_ID, modelactive.F_AmountRange.ToString());
299
+                            {
300
+                                chooseact.Add(modelactive.F_ID, "3_" + modelactive.F_AmountRange.ToString());
301
+
302
+                                decimal.TryParse(modelactive.F_AmountRange, out def);
303
+                                actlist.Add(new UseActInput { id = modelactive.F_ID, type = 3, gift = "", money = def });
304
+                                def = 0.00M;
305
+                            }
247
                         }
306
                         }
248
                         else if (modelactive.F_Type == 4)
307
                         else if (modelactive.F_Type == 4)
249
                         {
308
                         {
251
                             //判断此人是否有参与活动的资格  默认暂不筛选
310
                             //判断此人是否有参与活动的资格  默认暂不筛选
252
                             if (chooseact.ContainsKey(modelactive.F_ID))
311
                             if (chooseact.ContainsKey(modelactive.F_ID))
253
                             {
312
                             {
254
-                                chooseact[modelactive.F_ID]= chooseact[modelactive.F_ID]+","+ m.F_ProductId.ToString();
313
+                                chooseact[modelactive.F_ID] = chooseact[modelactive.F_ID] + "," + m.F_ProductId.ToString();
314
+                                actlist.First(cc => cc.id == modelactive.F_ID).gift += "," + m.F_ProductId.ToString();
255
                             }
315
                             }
256
                             else
316
                             else
257
                             {
317
                             {
258
-                                chooseact.Add(modelactive.F_ID, m.F_ProductId.ToString());
318
+                                chooseact.Add(modelactive.F_ID, "4_" + m.F_ProductId.ToString());
319
+                                actlist.Add(new UseActInput { id = modelactive.F_ID, type = 4, gift = m.F_ProductId.ToString(), money = def });
259
                             }
320
                             }
260
-                            
261
-                        }
262
-
263
 
321
 
264
 
322
 
323
+                        }
265
                     }
324
                     }
266
                 }
325
                 }
267
 
326
 
268
             }
327
             }
269
 
328
 
270
-
271
-                return Success("订单保存成功", chooseact);
329
+            return Success("参与活动", actlist);
272
 
330
 
273
 
331
 
274
         }
332
         }

+ 21 - 16
代码/TVShoppingCallCenter_ZLJ/Controllers/Product/TagController.cs

28
 
28
 
29
 
29
 
30
         private readonly IBus_TagRepository _tagRepository;
30
         private readonly IBus_TagRepository _tagRepository;
31
-        public TagController( IBus_TagRepository tagRepository)
31
+        public TagController(IBus_TagRepository tagRepository)
32
         {
32
         {
33
 
33
 
34
             _tagRepository = tagRepository;
34
             _tagRepository = tagRepository;
50
 
50
 
51
             if (string.IsNullOrEmpty(input.TagName))
51
             if (string.IsNullOrEmpty(input.TagName))
52
                 return Error("请输入分类名称");
52
                 return Error("请输入分类名称");
53
-            if (input.CLass<1)
53
+            if (input.CLass < 1)
54
                 return Error("请输入标签分类");
54
                 return Error("请输入标签分类");
55
             if (input.Type < 0)
55
             if (input.Type < 0)
56
                 input.Type = 1;
56
                 input.Type = 1;
101
                 return Error("请输入标签名称");
101
                 return Error("请输入标签名称");
102
             if (input.Type < 0)
102
             if (input.Type < 0)
103
                 input.Type = 1;
103
                 input.Type = 1;
104
-            if (input.Sort <1)
104
+            if (input.Sort < 1)
105
                 return Error("请输入标签排序序号");
105
                 return Error("请输入标签排序序号");
106
 
106
 
107
             #endregion
107
             #endregion
108
 
108
 
109
             Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_TagName == input.TagName;
109
             Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_TagName == input.TagName;
110
 
110
 
111
-            T_Bus_Tag T_Bus_TagModel = await _tagRepository.GetSingle(eq.And(b=>b.F_Type== input.Type));
111
+            T_Bus_Tag T_Bus_TagModel = await _tagRepository.GetSingle(eq.And(b => b.F_Type == input.Type));
112
             //除非某固定权限 定之后再加
112
             //除非某固定权限 定之后再加
113
             if (T_Bus_TagModel.F_CLass == 1)
113
             if (T_Bus_TagModel.F_CLass == 1)
114
             {
114
             {
122
             T_Bus_TagModel.F_UserId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
122
             T_Bus_TagModel.F_UserId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
123
             T_Bus_TagModel.F_UpdateTime = DateTime.Now;
123
             T_Bus_TagModel.F_UpdateTime = DateTime.Now;
124
 
124
 
125
-            if (await _tagRepository.Update(T_Bus_TagModel))
125
+            
126
+            if (await _tagRepository.Delete(eq))
126
             {
127
             {
127
-                return Success("更新标签成功");
128
-            }
129
-            else
130
-            {
131
-                return Error("标签重复或失败,请重试!");
128
+                if (await _tagRepository.Add(T_Bus_TagModel) > 0)
129
+                {
130
+                    return Success("更新标签成功");
131
+                }
132
+                else
133
+                {
134
+                    return Success("更新标签成功。");
135
+                }
132
             }
136
             }
137
+            return Error("更新标签失败");
138
+
133
         }
139
         }
134
 
140
 
135
         /// <summary>
141
         /// <summary>
144
 
150
 
145
             if (string.IsNullOrEmpty(input.TagName))
151
             if (string.IsNullOrEmpty(input.TagName))
146
                 return Error("请选择标签");
152
                 return Error("请选择标签");
147
-            if (input.CLass<2)
153
+            if (input.CLass < 2)
148
                 return Error("系统标签不能删除");
154
                 return Error("系统标签不能删除");
149
 
155
 
150
 
156
 
151
             Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_TagName == input.TagName;
157
             Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_TagName == input.TagName;
152
             //非系统标签可以随意删除,与商品没有关联
158
             //非系统标签可以随意删除,与商品没有关联
153
-            if (await _tagRepository.Delete(eq.And(b=>b.F_Type==input.Type)))
159
+            if (await _tagRepository.Delete(eq.And(b => b.F_Type == input.Type)))
154
             {
160
             {
155
                 return Success("删除标签成功");
161
                 return Success("删除标签成功");
156
             }
162
             }
169
         public async Task<IActionResult> GetTagAll(TagInput input)
175
         public async Task<IActionResult> GetTagAll(TagInput input)
170
         {
176
         {
171
 
177
 
172
-
173
             #region  拼接条件
178
             #region  拼接条件
174
 
179
 
175
             Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_Type == 1;
180
             Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_Type == 1;
180
             {
185
             {
181
                 eq = eq.And(a => a.F_CLass == input.CLass);
186
                 eq = eq.And(a => a.F_CLass == input.CLass);
182
             }
187
             }
183
-            if (! string.IsNullOrEmpty(input.TagName))
188
+            if (!string.IsNullOrEmpty(input.TagName))
184
             {
189
             {
185
                 eq = eq.And(a => a.F_TagName.Contains(input.TagName));
190
                 eq = eq.And(a => a.F_TagName.Contains(input.TagName));
186
             }
191
             }
189
             #endregion
194
             #endregion
190
 
195
 
191
 
196
 
192
-            List<T_Bus_Tag> list = await _tagRepository.GetListALL(eq,c=>c.F_Sort,OrderByType.Asc);
197
+            List<T_Bus_Tag> list = await _tagRepository.GetListALL(eq, c => c.F_Sort, OrderByType.Asc);
193
 
198
 
194
             return Success("成功", list);
199
             return Success("成功", list);
195
 
200
 
196
         }
201
         }
197
 
202
 
198
         #endregion
203
         #endregion
199
- 
204
+
200
     }
205
     }
201
 }
206
 }

+ 12 - 1
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/OrderDetailInput.cs

5
 	/// 订单详情表
5
 	/// 订单详情表
6
 	/// </summary>
6
 	/// </summary>
7
 	[Serializable]
7
 	[Serializable]
8
-	public partial class OrderDetailInput:BaseInput
8
+	public partial class OrderDetailInput : BaseInput
9
 	{
9
 	{
10
 		public OrderDetailInput()
10
 		public OrderDetailInput()
11
 		{ }
11
 		{ }
142
 		#endregion Model
142
 		#endregion Model
143
 
143
 
144
 	}
144
 	}
145
+	[Serializable]
146
+	public class UseActInput
147
+	{
148
+		public int id { get; set; }
149
+
150
+		public decimal money { get; set; }
151
+
152
+		public int type { get; set; }
153
+
154
+		public string gift { get; set; }
155
+	}
145
 }
156
 }
146
 
157
 

+ 4 - 4
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/OrderInput.cs

43
 		private decimal? _f_totleprice;
43
 		private decimal? _f_totleprice;
44
 		private string _f_useactivity = "";
44
 		private string _f_useactivity = "";
45
 		private decimal? _f_shouldprice;
45
 		private decimal? _f_shouldprice;
46
-		private decimal? _f_realprice;
46
+		private decimal _f_realprice;
47
 		private string _f_paytype = "";
47
 		private string _f_paytype = "";
48
 		private string _f_stock = "";
48
 		private string _f_stock = "";
49
 		private string _f_express = "";
49
 		private string _f_express = "";
50
 		private string _f_remark = "";
50
 		private string _f_remark = "";
51
 		private string _f_adfrom = "";
51
 		private string _f_adfrom = "";
52
 		private string _f_type = "";
52
 		private string _f_type = "";
53
-		public List<OrderDetailInput> OrderDetail { get; set; }
53
+		public List<OrderDetailInput> OrderDetailList { get; set; }
54
+		public List<UseActInput> UseActList { get; set; }
54
 
55
 
55
-	
56
 		/// <summary>
56
 		/// <summary>
57
 		/// 订单编号 BJ员工工号+T+时间
57
 		/// 订单编号 BJ员工工号+T+时间
58
 		/// </summary>
58
 		/// </summary>
304
 		/// <summary>
304
 		/// <summary>
305
 		/// 实收金额
305
 		/// 实收金额
306
 		/// </summary>
306
 		/// </summary>
307
-		public decimal? F_RealPrice
307
+		public decimal F_RealPrice
308
 		{
308
 		{
309
 			set { _f_realprice = value; }
309
 			set { _f_realprice = value; }
310
 			get { return _f_realprice; }
310
 			get { return _f_realprice; }

+ 0 - 22
代码/TVShoppingCallCenter_ZLJ/Properties/PublishProfiles/FolderProfile.pubxml

1
-<?xml version="1.0" encoding="utf-8"?>
2
-<!--
3
-此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
4
-自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。 
5
--->
6
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
7
-  <PropertyGroup>
8
-    <WebPublishMethod>FileSystem</WebPublishMethod>
9
-    <PublishProvider>FileSystem</PublishProvider>
10
-    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
11
-    <LastUsedPlatform>Any CPU</LastUsedPlatform>
12
-    <SiteUrlToLaunchAfterPublish />
13
-    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
14
-    <ExcludeApp_Data>False</ExcludeApp_Data>
15
-    <ProjectGuid>5227bf8a-c03f-40d4-b5b6-18a891c1e474</ProjectGuid>
16
-    <publishUrl>E:\项目-6.0\ZLJ足力健\发布\WebSite</publishUrl>
17
-    <DeleteExistingFiles>True</DeleteExistingFiles>
18
-    <TargetFramework>netcoreapp2.2</TargetFramework>
19
-    <SelfContained>false</SelfContained>
20
-    <_IsPortable>true</_IsPortable>
21
-  </PropertyGroup>
22
-</Project>