duhongyu 5 yıl önce
ebeveyn
işleme
24eb407ca3

+ 14 - 5
代码/System.Model/Bus/T_Bus_Order.cs

@@ -72,7 +72,7 @@ namespace System.Model
72 72
 
73 73
         private string _f_membernotes = "";
74 74
         private string _f_recommendName = "";
75
-      
75
+        private string _f_recommendertel = "";
76 76
 
77 77
         /// <summary>
78 78
         /// 推荐人姓名
@@ -416,10 +416,19 @@ namespace System.Model
416 416
 			set { _f_totleprice = value; }
417 417
 			get { return _f_totleprice; }
418 418
 		}
419
-		/// <summary>
420
-		/// 使用营销活动
421
-		/// </summary>
422
-		public string F_UseActivity
419
+        /// <summary>
420
+        /// 推荐人手机号
421
+        /// </summary>
422
+        public string F_RecommenderTel
423
+        {
424
+            set { _f_recommendertel = value; }
425
+            get { return _f_recommendertel; }
426
+
427
+        }
428
+        /// <summary>
429
+        /// 使用营销活动
430
+        /// </summary>
431
+        public string F_UseActivity
423 432
 		{
424 433
 			set { _f_useactivity = value; }
425 434
 			get { return _f_useactivity; }

+ 25 - 0
代码/System.Model/Cus/T_Cus_VipInfo.cs

@@ -25,6 +25,7 @@ namespace System.Model
25 25
         private string _f_nickname;
26 26
         private string _f_address;
27 27
         private string _f_address1;
28
+        private string _f_address2;
28 29
         /// <summary>
29 30
         /// id标识,自增
30 31
         /// </summary>
@@ -147,6 +148,16 @@ namespace System.Model
147 148
             get { return _f_address1; }
148 149
         }
149 150
         /// <summary>
151
+        /// 地址备用
152
+        /// </summary>
153
+        public string F_Address2
154
+        {
155
+            set { _f_address2 = value; }
156
+            get { return _f_address2; }
157
+        }
158
+        public int F_RecommenderID
159
+        { get; set; }
160
+        /// <summary>
150 161
         /// 添加时间
151 162
         /// </summary>
152 163
         public DateTime? F_CreateOn { get; set; }
@@ -264,6 +275,20 @@ namespace System.Model
264 275
         { get; set; }
265 276
        
266 277
         public string F_Mobile2 { get; set; }
278
+        /// <summary>
279
+        /// 省
280
+        /// </summary>				
281
+        public string F_Province2 { get; set; }
282
+        /// <summary>
283
+        /// 县、区
284
+        /// </summary>				
285
+        public string F_Area2 { get; set; }
286
+        /// <summary>
287
+        /// 乡镇
288
+        /// </summary>				
289
+        public string F_Town2 { get; set; }
290
+        public string F_City2 { get; set; }
291
+        public int F_ParentID { get; set; }
267 292
         #endregion Model
268 293
     }
269 294
 }

+ 35 - 0
代码/System.Model/Cus/V_Cus_VipInfo.cs

@@ -166,6 +166,41 @@ namespace System.Model
166 166
         /// 备用邮编
167 167
         /// </summary>				
168 168
         public string F_Postcode1 { get; set; }
169
+        /// <summary>
170
+        /// 推荐人手机号
171
+        /// </summary>
172
+        public string F_RecommenderTel
173
+        { get; set; }
174
+        /// <summary>
175
+        /// 第一次通话时间
176
+        /// </summary>
177
+        public DateTime? F_Firstcalltime
178
+        { get; set; }
179
+        /// <summary>
180
+        /// 最后一次通话时间
181
+        /// </summary>
182
+        public DateTime? F_Lastholetime
183
+        { get; set; }
184
+        public int F_RecommenderID
185
+        { get; set; }
186
+        /// 省
187
+        /// </summary>				
188
+        public string F_Province2 { get; set; }
189
+        /// <summary>
190
+        /// 县、区
191
+        /// </summary>				
192
+        public string F_Area2 { get; set; }
193
+        /// <summary>
194
+        /// 乡镇
195
+        /// </summary>				
196
+        public string F_Town2 { get; set; }
197
+        public string F_City2 { get; set; }
198
+        /// <summary>
199
+        /// 地址备用
200
+        /// </summary>
201
+        public string F_Address2
202
+        { get; set; }
203
+      
169 204
         #endregion Model
170 205
     }
171 206
 }

+ 275 - 88
代码/TVShoppingCallCenter_ZLJ/Controllers/Customer/VIPInfoController.cs

@@ -18,10 +18,11 @@ using System.Text.RegularExpressions;
18 18
 using System.IRepositories.Call;
19 19
 using System.Model.Call;
20 20
 using System.Utility.Encrypt;
21
+using System.IRepositories.Bus;
21 22
 
22 23
 namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
23 24
 {
24
-    [Authorize]
25
+  //  [Authorize]
25 26
     [Produces("application/json")]
26 27
     [Route("api/[controller]")]
27 28
     public class VipInfoController : BaseController
@@ -33,8 +34,9 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
33 34
         private readonly ISMS_InternalMessagesReposytory _sys_internalMessagesrepository;
34 35
         private readonly ICall_CallRecordsRepository busCallRecordsRepository;
35 36
         private readonly Ipoint_agentRepository _point_agentrepository;
37
+        private readonly IBus_OrderRepository busOrderRepository;
36 38
         public VipInfoController(ICus_VipInfoRepository cus_vip_infoRepository, ISys_UserAccountRepository sys_user_accountRepository, ICus_MsgRepository cus_msgRepository,IConfiguration configuration,
37
-            ISMS_InternalMessagesReposytory sys_internalMessagesrepository, ICall_CallRecordsRepository _busCallRecordsRepository, Ipoint_agentRepository point_agentrepository)
39
+            ISMS_InternalMessagesReposytory sys_internalMessagesrepository, ICall_CallRecordsRepository _busCallRecordsRepository, Ipoint_agentRepository point_agentrepository, IBus_OrderRepository _busOrderRepository)
38 40
         {
39 41
             _cus_vip_infoRepository = cus_vip_infoRepository;
40 42
             _sys_user_accountRepository = sys_user_accountRepository;
@@ -43,6 +45,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
43 45
             _sys_internalMessagesrepository = sys_internalMessagesrepository;
44 46
             busCallRecordsRepository = _busCallRecordsRepository;
45 47
             _point_agentrepository = point_agentrepository;
48
+            busOrderRepository = _busOrderRepository;
46 49
         }
47 50
 
48 51
         [HttpGet]
@@ -139,6 +142,9 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
139 142
             return Content(obj.ToJson());
140 143
         }
141 144
 
145
+
146
+
147
+
142 148
         /// <summary>
143 149
         /// 获取会员信息详情
144 150
         /// </summary>
@@ -157,7 +163,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
157 163
             if (model != null)
158 164
             {
159 165
                 var modellist = await _cus_msgRepository.GetListALL(x => x.F_VipInfoID == model.F_ID);
160
-                var viplist = await _cus_vip_infoRepository.GetListALL(x => x.F_State == 1&& x.F_Recommender == model.F_Name&&(x .F_RecommenderTel ==model .F_Phone || x.F_RecommenderTel == model.F_Mobile &&x.F_RecommenderTel == model.F_Mobile1));
166
+                var viplist = await _cus_vip_infoRepository.GetListALL(x => x.F_State == 1&& x.F_RecommenderID  == model.F_ID  );
161 167
                 var obj =new 
162 168
                 {
163 169
                     model,
@@ -174,7 +180,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
174 180
         /// 号码加密
175 181
         /// </summary>
176 182
         /// <param name="id"></param>
177
-        /// <param name="type"></param>
183
+        /// <param name="type"></  param>
178 184
         /// <returns></returns>
179 185
         [HttpGet("encryptphone")]
180 186
         public async Task<IActionResult> GetEncrypt(int id,int type=0)
@@ -201,6 +207,218 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
201 207
             return Error("加密失败!");
202 208
 
203 209
         }
210
+
211
+        /// <summary>
212
+        /// 档案合并
213
+        /// </summary>
214
+        /// <param name="input"></param>
215
+        /// <returns></returns>
216
+        [HttpPost("Merge")]
217
+        public async Task<IActionResult> Merge(int MainID=0,int  ViceID=0)
218
+        {
219
+            if (MainID<=0)
220
+                return Error("请选择主档案");
221
+            if (ViceID<=0)
222
+                return Error("请选择副档案");
223
+
224
+            var model = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == MainID && x.F_State == (int)EnumDelState.Enabled);
225
+            if (model == null)
226
+                return Error("操作失败,主档案不存在");
227
+            var model1 = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == ViceID && x.F_State == (int)EnumDelState.Enabled);
228
+            if (model1 == null)
229
+                return Error("操作失败,副档案不存在");
230
+
231
+
232
+            string user = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
233
+            var modelInfo = new T_Cus_VipInfo();
234
+            //model.F_VIPCode = input.vipcode;//会员卡号
235
+            modelInfo.F_Name = model.F_Name;
236
+            modelInfo.F_Birthday = model.F_Birthday;
237
+            modelInfo.F_Phone = model.F_Phone;
238
+            modelInfo.F_RecommenderID = model.F_RecommenderID;
239
+            modelInfo.F_Recommender = model.F_Recommender;
240
+            modelInfo.F_RecommenderTel = model.F_RecommenderTel;
241
+            modelInfo.F_Sex = model.F_Sex;
242
+            modelInfo.F_Label = model.F_Label;
243
+            modelInfo.F_Note = model.F_Note;
244
+            modelInfo.F_City = model.F_City;
245
+            modelInfo.F_Nickname = model.F_Nickname;
246
+            modelInfo.F_Address = model.F_Address;
247
+            modelInfo.F_Address1 = model.F_Address1;
248
+            modelInfo.F_Age = model.F_Age;
249
+
250
+            if (!string.IsNullOrEmpty(model.F_Mobile))
251
+            {
252
+                if (!string.IsNullOrEmpty(model1.F_Mobile))
253
+                {
254
+                    modelInfo.F_Mobile += "," + model1.F_Mobile;
255
+                   string [] Mobile = modelInfo.F_Mobile.Split(',');
256
+                   var Mobilelist= Mobile.Distinct().ToList();
257
+                    string phone = "";
258
+                    foreach (var it in Mobilelist)
259
+                    {
260
+                        if (phone == "")
261
+                            phone += it;
262
+                        else
263
+                            phone += "," + it;
264
+                    }
265
+                    modelInfo.F_Mobile = phone;
266
+                }
267
+
268
+            }
269
+            else
270
+            {
271
+                if (!string.IsNullOrEmpty(model1.F_Mobile))
272
+                {
273
+                    modelInfo.F_Mobile = model1.F_Mobile;
274
+                }
275
+
276
+            }
277
+
278
+            modelInfo.F_Province = model.F_Province;
279
+            modelInfo.F_Area = model.F_Area;
280
+            modelInfo.F_Town = model.F_Town;
281
+            modelInfo.F_Postcode = model.F_Postcode;
282
+            modelInfo.F_Province1 = model.F_Province1;
283
+            modelInfo.F_Area1 = model.F_Area1;
284
+            modelInfo.F_Town1 = model.F_Town1;
285
+            modelInfo.F_City1 = model.F_City1;
286
+            modelInfo.F_Address1 = model.F_Address1;
287
+            modelInfo.F_Province2 = model.F_Province2;
288
+            modelInfo.F_Area2 = model.F_Area2;
289
+            modelInfo.F_Town2 = model.F_Town2;
290
+            modelInfo.F_City2 = model.F_City2;
291
+            modelInfo.F_Address2 = model.F_Address2;
292
+            modelInfo.F_Postcode1 = model.F_Postcode1;
293
+            modelInfo.F_ShoeSize = model.F_ShoeSize;
294
+            modelInfo.F_Score = model .F_Score + model1.F_Score;
295
+            modelInfo.F_Money = model.F_Money + model1.F_Money;
296
+            modelInfo.F_TotalScore = model.F_TotalScore + model1.F_TotalScore;
297
+            modelInfo.F_Saleperson = user;
298
+            modelInfo.F_Type = model.F_Type;
299
+            modelInfo.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value; //"8000";
300
+            modelInfo.F_CreateOn = model.F_CreateOn;
301
+            modelInfo.F_State = (int)EnumDelState.Enabled;
302
+            modelInfo.F_GiftYear = model.F_GiftYear;
303
+            modelInfo.F_Firstcalltime = model.F_Firstcalltime;
304
+            modelInfo.F_Lastholetime = model.F_Lastholetime;
305
+            var res = await _cus_vip_infoRepository.Add(modelInfo);
306
+            if (res > 0)
307
+            {
308
+                model .F_State = (int)EnumDelState.Delete;
309
+                model.F_ParentID = res;
310
+                await _cus_vip_infoRepository.Update(model);
311
+                model1.F_State = (int)EnumDelState.Delete;
312
+                model1.F_ParentID = res;
313
+                await _cus_vip_infoRepository.Update(model1);
314
+                return Success("合并成功");
315
+            }
316
+            else
317
+            {
318
+                return Error("合并失败");
319
+            }
320
+        }
321
+        /// <summary>
322
+        /// 档案拆分
323
+        /// </summary>
324
+        /// <param name="input"></param>
325
+        /// <returns></returns>
326
+        [HttpPost("SplitvIP")]
327
+        public async Task<IActionResult> SplitvIP(int id)
328
+        {
329
+            if (id <= 0)
330
+                return Error("请选择要拆分档案");
331
+            var model = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == id && x.F_State == (int)EnumDelState.Enabled);
332
+            if (model == null)
333
+                return Error("操作失败,档案不存在");
334
+            var call = await busCallRecordsRepository.GetListALL(x => x.CusId==model .F_ID );
335
+            if (call!=null && call.Count >0)
336
+                return Error("操作失败,该档案已产生新的信息,不可拆分");
337
+            var order = await busOrderRepository.GetListALL(x => x.F_VipId   == model.F_ID);
338
+            if (order != null && order.Count > 0)
339
+                return Error("操作失败,该档案已产生新的信息,不可拆分");
340
+            var modellist = await _cus_vip_infoRepository.GetListALL (x => x.F_ParentID  == id && x.F_State == (int)EnumDelState.Delete );
341
+            if (modellist == null|| modellist.Count <=0)
342
+                return Error("操作失败,该档案未进行过合并");
343
+
344
+            string user = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
345
+            int res = 0;
346
+           foreach (var it in modellist)
347
+            {
348
+               // var ml = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == item);
349
+                it.F_State = (int)EnumDelState.Enabled ;
350
+                if (_cus_vip_infoRepository.Update(it).Result)
351
+                    res += 1;
352
+            }
353
+            if (res == modellist.Count)
354
+            {
355
+                model .F_State = (int)EnumDelState.Delete ;
356
+                await _cus_vip_infoRepository.Update(model);
357
+                return Success("拆分成功");
358
+               
359
+            }
360
+                
361
+            else
362
+                return Error ("部分档案拆分成功");
363
+        }
364
+
365
+
366
+        /// <summary>
367
+        /// 获取会员所有手机号
368
+        /// </summary>
369
+        /// <param name="input"></param>
370
+        /// <returns></returns>
371
+        [HttpGet("getVipMobie")]
372
+        public async Task<IActionResult> GetVipMobie(int id)
373
+        {
374
+            if (id <= 0)
375
+                return Error("请选择会员");
376
+            var model = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == id && x.F_State == (int)EnumDelState.Enabled);
377
+            if (model == null)
378
+                return Error("操作失败,会员不存在");
379
+            List<string> Mobile = new List<string>();
380
+            Mobile.Add(model.F_Phone);
381
+            if (!string.IsNullOrEmpty (model.F_Mobile) )
382
+            {
383
+                var modellist = model.F_Mobile.Split(',');
384
+                foreach (var it in modellist)
385
+                {
386
+                    Mobile.Add(it);
387
+                }
388
+            }
389
+                return Success("获取成功", Mobile);
390
+           
391
+        }
392
+        /// <summary>
393
+        /// 通过手机号获取会员列表
394
+        /// </summary>
395
+        /// <param name="id"></param>
396
+        /// <param name="type"></param>
397
+        /// <returns></returns>
398
+        [HttpGet("getphone")]
399
+        public async Task<IActionResult> Getphone(string phone)
400
+        {
401
+            List<IConditionalModel> conModels = new List<IConditionalModel>();
402
+            #region 条件筛选
403
+            conModels.Add(new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = ((int)EnumDelState.Enabled).ToString() });
404
+            if (string.IsNullOrEmpty(phone))
405
+                return Error("请输入号码");
406
+         
407
+                conModels.Add(new ConditionalCollections()
408
+                {
409
+                    ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
410
+                    {
411
+                        new  KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel() { FieldName = "F_Phone", ConditionalType = ConditionalType.Like, FieldValue = phone }),
412
+                        new  KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_Mobile", ConditionalType = ConditionalType.Like, FieldValue = phone }),
413
+                    }
414
+                });
415
+            #endregion
416
+
417
+            var list = await _cus_vip_infoRepository.GetListALL (conModels, "F_CreateOn desc");
418
+            return Success ("获取成功", list);
419
+
420
+        }
421
+
204 422
         /// <summary>
205 423
         /// 号码解密
206 424
         /// </summary>
@@ -251,7 +469,6 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
251 469
             };
252 470
             return Content(obj.ToJson());
253 471
         }
254
-
255 472
         /// <summary>
256 473
         /// 添加会员
257 474
         /// </summary>
@@ -291,16 +508,14 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
291 508
                 point_Agent.agent = user;
292 509
                 var phone = _point_agentrepository.Add(point_Agent);
293 510
             }
511
+            model.F_RecommenderID = input.F_RecommenderID;
294 512
             model.F_Recommender = input.recommender;
295
-            if (!string .IsNullOrEmpty (input.recommendertel))
513
+            if (!string.IsNullOrEmpty(input.recommendertel))
296 514
             {
297 515
                 if (!valtel(input.recommendertel))
298 516
                     return Error("手机号必须为11位数字");
299 517
                 model.F_RecommenderTel = input.recommendertel;
300 518
             }
301
-
302
-
303
-           
304 519
             model.F_Sex = input.sex;
305 520
             model.F_Label = input.label;
306 521
             model.F_Note = input.note;
@@ -311,47 +526,26 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
311 526
             model.F_Age = input.age;
312 527
             if (!string .IsNullOrEmpty (input .mobile ))
313 528
             {
314
-                if (!valtel(input.mobile))
315
-                    return Error("手机号必须为11位数字");
316
-                model.F_Mobile = input.mobile;
317
-                var _point = await _point_agentrepository.GetListALL(x => x.caller == input.mobile);
318
-                if (_point == null && _point.Count() <= 0)
529
+                string[] mobile1 = input.mobile.TrimEnd(',').Split(',');
530
+                foreach (var it in mobile1)
319 531
                 {
320
-                    point_agent point_Agent = new point_agent();
321
-                    point_Agent.caller = input.mobile;
322
-                    point_Agent.agent = user;
323
-                    var phone = _point_agentrepository.Add(point_Agent);
324
-                }
325
-            }
326
-            if (!string.IsNullOrEmpty(input.mobile1))
327
-            {
328
-                if (!valtel(input.mobile1))
329
-                    return Error("手机号必须为11位数字");
330
-                model.F_Mobile1 = input.mobile1;
331
-                var _point = await _point_agentrepository.GetListALL(x => x.caller == input.mobile1);
332
-                if (_point == null && _point.Count() <= 0)
333
-                {
334
-                    point_agent point_Agent = new point_agent();
335
-                    point_Agent.caller = input.mobile1;
336
-                    point_Agent.agent = user;
337
-                    var phone = _point_agentrepository.Add(point_Agent);
338
-                }
339
-            }
340
-            if (!string.IsNullOrEmpty(input.mobile2))
341
-            {
342
-                if (!valtel(input.mobile2))
343
-                    return Error("手机号必须为11位数字");
344
-                model.F_Mobile2 = input.mobile2;
345
-                var _point = await _point_agentrepository.GetListALL(x => x.caller == input.mobile2);
346
-                if (_point == null && _point.Count() <= 0)
347
-                {
348
-                    point_agent point_Agent = new point_agent();
349
-                    point_Agent.caller = input.mobile2;
350
-                    point_Agent.agent = user;
351
-                    var phone = _point_agentrepository.Add(point_Agent);
532
+                    if (!valtel(it))
533
+                        return Error("手机号必须为11位数字");
534
+                  
535
+                    var _point = await _point_agentrepository.GetListALL(x => x.caller == it);
536
+                    if (_point == null && _point.Count() <= 0)
537
+                    {
538
+                        point_agent point_Agent = new point_agent();
539
+                        point_Agent.caller = it;
540
+                        point_Agent.agent = user;
541
+                        var phone = _point_agentrepository.Add(point_Agent);
542
+                    }
352 543
                 }
544
+                model.F_Mobile = input.mobile.TrimEnd(',');
353 545
             }
354 546
             
547
+           
548
+            
355 549
             model.F_Province = input.province;
356 550
             model.F_Area = input.area;
357 551
             model.F_Town = input.town;
@@ -359,8 +553,17 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
359 553
             model.F_Province1 = input.province1;
360 554
             model.F_Area1 = input.area1;
361 555
             model.F_Town1 = input.town1;
362
-            model.F_Postcode1 = input.postcode1;
363 556
             model.F_City1 = input.city1;
557
+            model.F_Address1 = input.address1;
558
+
559
+
560
+            model.F_Province2 = input.province2;
561
+            model.F_Area2 = input.area2;
562
+            model.F_Town2 = input.town2;
563
+            model.F_City2= input.city2;
564
+            model.F_Address2 = input.address2;
565
+
566
+            model.F_Postcode1 = input.postcode1;
364 567
             model.F_ShoeSize = input.shoesize;
365 568
             model.F_Score = input.score;
366 569
             model.F_Money = input.money;
@@ -379,7 +582,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
379 582
                     model.F_GiftYear = DateTime.Now.Year.ToString();
380 583
                 }
381 584
             }
382
-            var call = await busCallRecordsRepository.GetListALL(x => x.CallState == 1 || (x.Caller == input.phone || x.Caller == input.mobile  || x.Caller == input.mobile1 || x.Caller == input.mobile2) || (x.Callee == input.phone || x.Callee == input.mobile || x.Callee == input.mobile1 || x.Callee == input.mobile2));
585
+            var call = await busCallRecordsRepository.GetListALL(x => x.CallState == 1 || x.Caller == input.phone);
383 586
             if (call!=null && call.Count >0)
384 587
             {
385 588
                 model.F_Firstcalltime = call[0].BeginTime;
@@ -388,7 +591,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
388 591
            
389 592
            
390 593
                
391
-            if (await _cus_vip_infoRepository.GetCount(x => x.F_Mobile == model.F_Mobile && x.F_Name == input.name) > 0)
594
+            if (await _cus_vip_infoRepository.GetCount(x => x.F_Mobile == model.F_Mobile && x.F_Name == input.name&&x.F_State ==1) > 0)
392 595
             {
393 596
                 return Error("添加失败,存在相同会员信息");
394 597
             }
@@ -402,7 +605,6 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
402 605
                 return Error("添加失败");
403 606
             }
404 607
         }
405
-
406 608
         /// <summary>
407 609
         /// 修改会员信息
408 610
         /// </summary>
@@ -444,6 +646,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
444 646
                 point_Agent.agent = user;
445 647
                 var phone = _point_agentrepository.Add(point_Agent);
446 648
             }
649
+            model.F_RecommenderID = input.F_RecommenderID;
447 650
             model.F_Recommender = input.recommender;
448 651
             if (!string.IsNullOrEmpty(input.recommendertel))
449 652
             {
@@ -464,45 +667,24 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
464 667
             model.F_Age = input.age;
465 668
             if (!string.IsNullOrEmpty(input.mobile))
466 669
             {
467
-                if (!valtel(input.mobile))
468
-                    return Error("手机号必须为11位数字");
469
-                model.F_Mobile = input.mobile;
470
-                var _point = await _point_agentrepository.GetListALL(x => x.caller == input.mobile);
471
-                if (_point == null && _point.Count() <= 0)
670
+                string[] mobile1 = input.mobile.TrimEnd(',').Split(',');
671
+                foreach (var it in mobile1)
472 672
                 {
473
-                    point_agent point_Agent = new point_agent();
474
-                    point_Agent.caller = input.mobile;
475
-                    point_Agent.agent = user;
476
-                    var phone = _point_agentrepository.Add(point_Agent);
477
-                }
478
-            }
479
-            if (!string.IsNullOrEmpty(input.mobile1))
480
-            {
481
-                if (!valtel(input.mobile1))
482
-                    return Error("手机号必须为11位数字");
483
-                model.F_Mobile1 = input.mobile1; var _point = await _point_agentrepository.GetListALL(x => x.caller == input.mobile1);
484
-                if (_point == null && _point.Count() <= 0)
485
-                {
486
-                    point_agent point_Agent = new point_agent();
487
-                    point_Agent.caller = input.mobile1;
488
-                    point_Agent.agent = user;
489
-                    var phone = _point_agentrepository.Add(point_Agent);
490
-                }
491
-            }
492
-            if (!string.IsNullOrEmpty(input.mobile2))
493
-            { 
494
-                if (!valtel(input.mobile2))
495
-                    return Error("手机号必须为11位数字");
496
-                model.F_Mobile2 = input.mobile2;
497
-                model.F_Mobile1 = input.mobile1; var _point = await _point_agentrepository.GetListALL(x => x.caller == input.mobile2);
498
-                if (_point == null && _point.Count() <= 0)
499
-                {
500
-                    point_agent point_Agent = new point_agent();
501
-                    point_Agent.caller = input.mobile2;
502
-                    point_Agent.agent = user;
503
-                    var phone = _point_agentrepository.Add(point_Agent);
673
+                    if (!valtel(it))
674
+                        return Error("手机号必须为11位数字");
675
+
676
+                    var _point = await _point_agentrepository.GetListALL(x => x.caller == it);
677
+                    if (_point == null && _point.Count() <= 0)
678
+                    {
679
+                        point_agent point_Agent = new point_agent();
680
+                        point_Agent.caller = it;
681
+                        point_Agent.agent = user;
682
+                        var phone = _point_agentrepository.Add(point_Agent);
683
+                    }
504 684
                 }
685
+                model.F_Mobile = input.mobile.TrimEnd(',');
505 686
             }
687
+
506 688
             model.F_Province = input.province;
507 689
             model.F_Area = input.area;
508 690
             model.F_Town = input.town;
@@ -516,6 +698,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
516 698
             model.F_Score = input.score;
517 699
             model.F_Money = input.money;
518 700
             model.F_TotalScore = input.totalscore;
701
+            model.F_Province2 = input.province2;
702
+            model.F_Area2 = input.area2;
703
+            model.F_Town2 = input.town2;
704
+            model.F_City2 = input.city2;
705
+            model.F_Address2 = input.address2;
519 706
             //model.F_Saleperson = input.saleperson;
520 707
             //model.F_Contact = input.contact;
521 708
             model.F_Type = input.type;
@@ -531,7 +718,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
531 718
                     }
532 719
                 }
533 720
             }
534
-            var call = await busCallRecordsRepository.GetListALL(x => x.CallState == 1 || (x.Caller == input.phone || x.Caller == input.mobile || x.Caller == input.mobile1 || x.Caller == input.mobile2) || (x.Callee == input.phone || x.Callee == input.mobile || x.Callee == input.mobile1 || x.Callee == input.mobile2));
721
+            var call = await busCallRecordsRepository.GetListALL(x => x.CallState == 1 || x.Caller == input.phone);
535 722
             if (call != null && call.Count > 0)
536 723
             {
537 724
                 model.F_Firstcalltime = call[0].BeginTime;
@@ -543,7 +730,6 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
543 730
                 return Success("修改成功");
544 731
             return Error("修改失败");
545 732
         }
546
-
547 733
         /// <summary>
548 734
         /// 删除会员信息 by ids
549 735
         /// </summary>
@@ -574,6 +760,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
574 760
             else
575 761
                 return Error("请选择要删除的记录");
576 762
         }
763
+        
577 764
         /// <summary>
578 765
         /// 判断号码必须为十一位数字
579 766
         /// </summary>

Dosya farkı çok büyük olduğundan ihmal edildi
+ 17 - 3
代码/TVShoppingCallCenter_ZLJ/Controllers/Order/KFOrderController.cs


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

@@ -525,8 +525,8 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
525 525
                             return Error("请输入打款人");
526 526
                         if (string.IsNullOrEmpty(input.F_PayType))
527 527
                             return Error("请选择付款方式");
528
-                        if (string.IsNullOrEmpty(input.OrderMoney.F_RemarkKF))
529
-                            input.OrderMoney.F_RemarkKF = "";
528
+                      //  if (string.IsNullOrEmpty(input.OrderMoney.F_RemarkKF))
529
+                          //  input.OrderMoney.F_RemarkKF = "";
530 530
                         if (string.IsNullOrEmpty(input.OrderMoney.F_RemarkXS))
531 531
                             input.OrderMoney.F_RemarkXS = "";
532 532
                         if (input.OrderMoney.F_PayTime == null)
@@ -639,6 +639,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
639 639
                         T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId);
640 640
                         if (modelProduct == null)
641 641
                             return Error("商品不存在:" + m.F_ProductId);
642
+                       if (modelProduct.F_OnSaleEnd<DateTime .Now &&UserLogin.RoleCode != "SH")
643
+                        {
644
+                            return Error ("商品已下架:" + m.F_ProductId);
645
+                        }
642 646
                         T_Bus_OrderDetail modelDetail = new T_Bus_OrderDetail();
643 647
                         modelDetail.F_ProductName = modelProduct.F_ProductName;
644 648
                         modelDetail.F_ProductId = modelProduct.F_ProductId;
@@ -702,7 +706,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
702 706
 
703 707
 
704 708
                 modelOrder.F_TotlePrice += input.F_ExpressFee;//订单总额(包括快递费)
705
-
709
+                modelOrder.F_RecommenderTel = input.F_RecommenderTel;
706 710
                 modelOrder.F_PayState = 0;
707 711
 
708 712
                 if (input .F_State ==1)
@@ -795,7 +799,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
795 799
         /// <returns></returns>
796 800
         [HttpPost("getPrice")]
797 801
         public async Task<IActionResult> GetPrice(List<OrderDetailInput> OrderDetailList
798
-            , List<UseActInput> UseActList,int F_ExpressFee=0)
802
+            , List<UseActInput> UseActList, decimal F_ExpressFee =0)
799 803
         {
800 804
             decimal totle = 0.00M;
801 805
             decimal ActivityMoney = 0.00M;
@@ -838,6 +842,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
838 842
                     T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId);
839 843
                     if (modelProduct == null)
840 844
                         return Error("商品不存在:" + m.F_ProductId);
845
+                    if (modelProduct.F_OnSaleEnd < DateTime.Now && UserLogin.RoleCode != "SH")
846
+                    {
847
+                        return Error("商品已下架:" + m.F_ProductId);
848
+                    }
841 849
                     T_Bus_OrderDetail modelDetail = new T_Bus_OrderDetail();
842 850
                     //参加活动特价
843 851
                     if (UseActivity4.Contains("," + modelProduct.F_ProductId + ","))
@@ -850,6 +858,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
850 858
                         modelDetail.F_DealPrice = 0.00M;
851 859
                         modelDetail.F_Remark = "生日赠品-活动:";
852 860
                     }
861
+                    modelDetail.F_Count = m.F_Count;
853 862
                     modelDetail.F_TotlePrice = modelDetail.F_DealPrice * modelDetail.F_Count;
854 863
                     totle += modelDetail.F_TotlePrice;
855 864
                     n++;
@@ -912,8 +921,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
912 921
                         foreach (var it in detaillist)
913 922
                         {
914 923
                             T_Bus_Product t_Bus_Product = await bus_productRepository.GetSingle(x => x.F_ProductId == it.F_ProductId);
915
-                          
916
-                            if (t_Bus_Product!=null )
924
+                        if (t_Bus_Product.F_OnSaleEnd < DateTime.Now && UserLogin.RoleCode != "SH")
925
+                        {
926
+                            return Error("商品已下架:" + t_Bus_Product.F_ProductId);
927
+                        }
928
+                        if (t_Bus_Product!=null )
917 929
                             {
918 930
                                 List<EBossStock> listStock = await busOrderFunctionController.GetStock(it.F_ProductId, "山西仓");
919 931
                                 List<EBossStock> listStock1 = await busOrderFunctionController.GetStock(it.F_ProductId, "新乡仓");
@@ -1030,11 +1042,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
1030 1042
                     Expression<Func<T_Bus_OrderMoney, bool>> eq = a => a.F_OrderId == it;
1031 1043
                     T_Bus_OrderMoney modelOrderMoeny =  busOrderMoneyRepository.GetListALL(eq, o => o.F_AddTime, OrderByType.Asc).Result .FirstOrDefault ();
1032 1044
                     T_Bus_Order modelOrder = await bus_OrderRepository.GetSingle(q => q.F_Id == modelOrderMoeny.F_OrderId);
1033
-                    modelOrderMoeny.F_CheckUserId = UserLogin.UserId.ObjToInt();
1034
-                    modelOrderMoeny.F_CheckUserName = UserLogin.UserName;
1035
-                  //  modelOrderMoeny.F_Money = modelOrderMoeny.F_Money;
1036 1045
                     modelOrderMoeny.F_State = state;
1037
-                //    modelOrderMoeny.F_RemarkKF = it.F_RemarkKF;
1038 1046
                     if (modelOrderMoeny.F_State == 1)
1039 1047
                     {
1040 1048
                         if (modelOrder.F_PayState == 1 || modelOrder.F_PayState == 3)
@@ -1074,6 +1082,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
1074 1082
                                 T_Bus_Product t_Bus_Product = await bus_productRepository.GetSingle(x => x.F_ProductId == iv.F_ProductId);
1075 1083
                                 if (t_Bus_Product != null)
1076 1084
                                 {
1085
+                                    if (t_Bus_Product.F_OnSaleEnd < DateTime.Now && UserLogin.RoleCode != "SH")
1086
+                                    {
1087
+                                        return Error("商品已下架:" + t_Bus_Product.F_ProductId);
1088
+                                    }
1077 1089
                                     t_Bus_Product.F_UseNumber -= iv.F_Count;
1078 1090
                                     Productlist.Add(t_Bus_Product);
1079 1091
                                 }
@@ -1971,6 +1983,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
1971 1983
                 T_Bus_Product modelProduct = await bus_productRepository.GetSingle(b => b.F_ProductId == m.F_ProductId);
1972 1984
                 if (modelProduct != null)
1973 1985
                 {
1986
+                    if (modelProduct.F_OnSaleEnd < DateTime.Now && UserLogin.RoleCode != "SH")
1987
+                    {
1988
+                        return Error("商品已下架:" + modelProduct.F_ProductId);
1989
+                    }
1974 1990
                     //是否有活动标签
1975 1991
                     if (modelProduct.F_Tag.IndexOf(".") > -1)
1976 1992
                     {
@@ -2134,9 +2150,17 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
2134 2150
                 modelreturn.UseActList = actlist;
2135 2151
 
2136 2152
             }
2137
-
2138
-
2139
-            return Success("成功", modelreturn);
2153
+            else
2154
+                return Error("订单不存在");
2155
+            Expression<Func<T_Bus_Orderlogs , bool>> eq = a => a.F_WoID == orderid;
2156
+            var ItemList = await busOrderlogsRepository.GetListALL(eq, o => o.F_CreateTime , OrderByType.Asc);
2157
+           
2158
+            var obj = new
2159
+            {
2160
+                modelreturn,
2161
+                ItemList
2162
+            };
2163
+            return Content(obj.ToJson());
2140 2164
 
2141 2165
 
2142 2166
         }
@@ -2313,61 +2337,74 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Order
2313 2337
                 string[] orderid = orderids.Split(',');
2314 2338
                 string msg = "";
2315 2339
                 #endregion
2340
+                List<T_Bus_Orderlogs> logs = new List<T_Bus_Orderlogs>();
2316 2341
                 List<T_Bus_Order> orders = new List<T_Bus_Order>();
2317 2342
                 foreach (var it in orderid)
2318 2343
                 {
2319
-                    T_Bus_Order modelOrder = await bus_OrderRepository.GetSingle(q => q.F_Id == it && new int[] { 1, 3, 4, 7 }.Contains(q.F_State));
2344
+                    T_Bus_Orderlogs t_Bus_Orderlogs = new T_Bus_Orderlogs();
2345
+                    T_Bus_Order modelOrder = await bus_OrderRepository.GetSingle(q => q.F_Id == it && new int[] { 3, 4, 7 }.Contains(q.F_State));
2320 2346
                     if (modelOrder == null)
2321 2347
                     {
2322 2348
                        msg +="订单"+ modelOrder .F_Id + "已审核";
2349
+                        continue;
2323 2350
                     }
2324 2351
                     else
2325 2352
                     {
2326
-                        List<T_Bus_OrderDetail> detaillist = await bus_OrderDetailRepository.GetListALL(q => q.F_OrderId == modelOrder.F_Id, o => o.F_Sort, OrderByType.Asc);
2327
-                        List<T_Bus_Product> Productlist = new List<T_Bus_Product>();
2328
-                        if (detaillist != null && detaillist.Count > 0)
2353
+                        if (modelOrder.F_State ==1)
2329 2354
                         {
2330
-                            foreach (var iv in detaillist)
2355
+                            List<T_Bus_OrderDetail> detaillist = await bus_OrderDetailRepository.GetListALL(q => q.F_OrderId == modelOrder.F_Id, o => o.F_Sort, OrderByType.Asc);
2356
+                            List<T_Bus_Product> Productlist = new List<T_Bus_Product>();
2357
+                            if (detaillist != null && detaillist.Count > 0)
2331 2358
                             {
2332
-                                T_Bus_Product t_Bus_Product = await bus_productRepository.GetSingle(x => x.F_ProductId == iv.F_ProductId);
2333
-                                if (t_Bus_Product != null)
2359
+                                foreach (var iv in detaillist)
2334 2360
                                 {
2335
-                                    t_Bus_Product.F_UseNumber -= iv.F_Count;
2336
-                                    Productlist.Add(t_Bus_Product);
2361
+                                    T_Bus_Product t_Bus_Product = await bus_productRepository.GetSingle(x => x.F_ProductId == iv.F_ProductId);
2362
+                                    if (t_Bus_Product != null)
2363
+                                    {
2364
+                                        t_Bus_Product.F_UseNumber -= iv.F_Count;
2365
+                                        Productlist.Add(t_Bus_Product);
2366
+                                    }
2367
+                                    else
2368
+                                    {
2369
+                                        msg += "订单" + modelOrder.F_Id + "退回失败,商品不存在.";
2370
+                                        continue;
2371
+                                    }
2337 2372
                                 }
2373
+                                if (Productlist != null && Productlist.Count > 0)
2374
+                                {
2375
+                                    if (!await bus_productRepository.UpdateList(Productlist))
2376
+                                    {
2377
+                                        msg += "订单" + modelOrder.F_Id + "退回失败";
2378
+                                        continue;
2379
+                                    }
2380
+                                 }
2338 2381
                                 else
2339 2382
                                 {
2340
-                                    msg += "订单" + modelOrder.F_Id + "提交失败,商品不存在.";
2383
+                                    msg += "订单" + modelOrder.F_Id + "退回失败,请选择商品";
2384
+                                    continue;
2385
+
2341 2386
                                 }
2342 2387
                             }
2343 2388
                         }
2344
-                        if (msg == "")
2345
-                        {
2346
-                            if (Productlist != null && Productlist.Count > 0)
2347
-                            {
2348
-                                if (!await bus_productRepository.UpdateList(Productlist))
2349
-                                    msg += "订单" + modelOrder.F_Id + "提交失败";
2350
-                                else
2351
-                                    modelOrder.F_State = state;
2352
-                            }
2353
-                            else
2354
-                                msg += "订单" + modelOrder.F_Id + "提交失败,请选择商品";
2355
-                        }
2356
-                      
2389
+                        modelOrder.F_State = state;
2390
+                        t_Bus_Orderlogs.F_WoID = modelOrder.F_Id;
2391
+                        t_Bus_Orderlogs.F_CreateUser = UserLogin.UserCode;
2392
+                        t_Bus_Orderlogs.F_CreateTime = DateTime.Now;
2393
+                        t_Bus_Orderlogs.F_OptContent = UserLogin.UserName + "撤回订单";
2394
+                        t_Bus_Orderlogs.F_WoState = modelOrder.F_State;
2395
+                        logs.Add(t_Bus_Orderlogs);
2357 2396
                         orders.Add(modelOrder);
2358 2397
                     }
2359 2398
                   
2360 2399
                 }
2361
-
2362
-
2363 2400
             //    string strStock = await busOrderFunctionController.ChangeStockOne(modelOrder, 0, null);
2364 2401
              //   if (strStock != "1")
2365 2402
                  //   return Error(strStock);
2366 2403
              //   modelOrder.F_State = 0;
2367 2404
            //     modelOrder.F_Score = 0.00M;
2368
-
2369 2405
                 if (msg =="")
2370 2406
                 {
2407
+                    await busOrderlogsRepository.AddAndUpdateList(logs);
2371 2408
                     if (await bus_OrderRepository.UpdateList(orders))
2372 2409
                         return Success("订单成功审核!");
2373 2410
                 }

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

@@ -72,6 +72,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
72 72
         private int _f_isExpress = -1;
73 73
         private int _f_ispayment = -1;
74 74
         private string _f_membernotes;
75
+        private string _f_recommendertel = "";
75 76
 
76 77
         /// <summary>
77 78
         /// 客服是否选择快递 1已分配 0未分配
@@ -559,6 +560,16 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
559 560
             get { return _f_membernotes; }
560 561
 
561 562
         }
563
+        /// <summary>
564
+        /// 推荐人手机号
565
+        /// </summary>
566
+        public string F_RecommenderTel
567
+        {
568
+            set { _f_recommendertel = value; }
569
+            get { return _f_recommendertel; }
570
+
571
+        }
572
+        
562 573
         public OrderMoneyInput OrderMoney { get; set; }
563 574
         #endregion Model
564 575
 

+ 16 - 1
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/Vip/VIPInfoInput.cs

@@ -100,5 +100,20 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
100 100
         public string city1 { get; set; } = "";
101 101
         public string belong { get; set; } = "";
102 102
         public string belongName { get; set; } = "";
103
-    }
103
+        /// <summary>
104
+        /// 省
105
+        /// </summary>				
106
+        public string province2 { get; set; } = "";
107
+        /// <summary>
108
+        /// 县、区
109
+        /// </summary>				
110
+        public string area2 { get; set; } = "";
111
+        public string city2 { get; set; } = "";
112
+        /// <summary>
113
+        /// 乡镇
114
+        /// </summary>				
115
+        public string town2 { get; set; } = "";
116
+        public string address2 { get; set; } = "";
117
+        public int F_RecommenderID { get; set; }
118
+}
104 119
 }