|
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+/* =============================================
|
|
|
2
|
+-- Author: <Author,,zhangkun>
|
|
|
3
|
+-- Create date: <Create Date,,20200713>
|
|
|
4
|
+-- Description: <Description,,订单售后操作)>
|
|
|
5
|
+-- ============================================*/
|
|
|
6
|
+
|
|
|
7
|
+using System;
|
|
|
8
|
+using System.Collections.Generic;
|
|
|
9
|
+using System.Common;
|
|
|
10
|
+using System.Common.Helpers;
|
|
|
11
|
+using System.Data;
|
|
|
12
|
+using System.IRepositories;
|
|
|
13
|
+using System.Linq;
|
|
|
14
|
+using System.Linq.Expressions;
|
|
|
15
|
+using System.Model;
|
|
|
16
|
+using System.Repositories;
|
|
|
17
|
+using System.Security.Claims;
|
|
|
18
|
+using System.Threading.Tasks;
|
|
|
19
|
+using System.Utility.Http;
|
|
|
20
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
21
|
+using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
|
|
|
22
|
+using Microsoft.Extensions.Configuration;
|
|
|
23
|
+using SqlSugar;
|
|
|
24
|
+using TVShoppingCallCenter_ZLJ.Models.Inputs;
|
|
|
25
|
+
|
|
|
26
|
+namespace TVShoppingCallCenter_ZLJ.Controllers.Order
|
|
|
27
|
+{
|
|
|
28
|
+ [Route("api/[controller]")]
|
|
|
29
|
+ public class AfterSaleController : BaseController
|
|
|
30
|
+ {
|
|
|
31
|
+ private readonly IBus_OrderDetailRepository bus_OrderDetailRepository;
|
|
|
32
|
+ private readonly IBus_OrderRepository bus_OrderRepository;
|
|
|
33
|
+ private readonly OrderController orderController;
|
|
|
34
|
+ private readonly IBus_ProductRepository bus_productRepository;
|
|
|
35
|
+ private readonly ICus_VipInfoRepository cus_vip_infoRepository;
|
|
|
36
|
+ private readonly IBus_OrderMergeRepository busOrderMergeRepository;
|
|
|
37
|
+ private readonly ICus_ScoreSetRepository cus_score_setRepository;
|
|
|
38
|
+ private readonly IBus_AfterSaleRepository busAfterSaleRepository;
|
|
|
39
|
+ public AfterSaleController(ICus_ScoreSetRepository _cus_score_setRepository, IBus_OrderMergeRepository _busOrderMergeRepository, IBus_OrderRepository _bus_OrderRepository, IBus_OrderDetailRepository _bus_OrderDetailRepository, OrderController _orderController, IBus_ProductRepository _productRepository, ICus_VipInfoRepository _cus_vip_infoRepository, IBus_AfterSaleRepository _busAfterSaleRepository)
|
|
|
40
|
+ {
|
|
|
41
|
+ bus_OrderDetailRepository = _bus_OrderDetailRepository;
|
|
|
42
|
+ bus_OrderRepository = _bus_OrderRepository;
|
|
|
43
|
+ orderController = _orderController;
|
|
|
44
|
+ bus_productRepository = _productRepository;
|
|
|
45
|
+ cus_vip_infoRepository = _cus_vip_infoRepository;
|
|
|
46
|
+ busOrderMergeRepository = _busOrderMergeRepository;
|
|
|
47
|
+ cus_score_setRepository = _cus_score_setRepository;
|
|
|
48
|
+ busAfterSaleRepository = _busAfterSaleRepository;
|
|
|
49
|
+ }
|
|
|
50
|
+
|
|
|
51
|
+ #region 销售操作
|
|
|
52
|
+
|
|
|
53
|
+ /// <summary>
|
|
|
54
|
+ /// 销售申请售后
|
|
|
55
|
+ /// </summary>
|
|
|
56
|
+ /// <param name="input"></param>
|
|
|
57
|
+ /// <returns></returns>
|
|
|
58
|
+ [HttpPost("addaftersalexs")]
|
|
|
59
|
+ public async Task<IActionResult> AddAfterSaleXS(AfterSaleInput input)
|
|
|
60
|
+ {
|
|
|
61
|
+ try
|
|
|
62
|
+ {
|
|
|
63
|
+ #region 验证参数 必填项
|
|
|
64
|
+
|
|
|
65
|
+ if (string.IsNullOrEmpty(input.F_OrderId))
|
|
|
66
|
+ return Error("请选择订单");
|
|
|
67
|
+
|
|
|
68
|
+ if (input.F_Type <=0)
|
|
|
69
|
+ return Error("申请类型不符合售后");
|
|
|
70
|
+
|
|
|
71
|
+ #endregion
|
|
|
72
|
+
|
|
|
73
|
+ #region 验证逻辑
|
|
|
74
|
+ if (input.F_Type == 1)
|
|
|
75
|
+ { }
|
|
|
76
|
+ else if (input.F_Type == 2)
|
|
|
77
|
+ { }
|
|
|
78
|
+ else if (input.F_Type == 3)
|
|
|
79
|
+ { }
|
|
|
80
|
+ else if (input.F_Type == 4)
|
|
|
81
|
+ { }
|
|
|
82
|
+ #endregion
|
|
|
83
|
+ T_Bus_Order modeOrder = await bus_OrderRepository.GetSingle(q => q.F_Id == input.F_OrderId);
|
|
|
84
|
+ if (modeOrder == null)
|
|
|
85
|
+ {
|
|
|
86
|
+ return Error("订单不存在");
|
|
|
87
|
+ }
|
|
|
88
|
+ else if (modeOrder.F_Status == -1)
|
|
|
89
|
+ {
|
|
|
90
|
+ //物流状态0 未发出 1物流运送中2签收3改代收4拒收
|
|
|
91
|
+ return Error("状态不符合售后");
|
|
|
92
|
+ }
|
|
|
93
|
+ T_Bus_AfterSale modelAfterSale = new T_Bus_AfterSale();
|
|
|
94
|
+ modelAfterSale.F_AddTime = DateTime.Now;
|
|
|
95
|
+ modelAfterSale.F_CheckTimeXS = DateTime.Now;
|
|
|
96
|
+ modelAfterSale.F_CheckStateXS = input.F_CheckStateXS;
|
|
|
97
|
+ modelAfterSale.F_CheckUserXS = UserLogin.UserId.ObjToInt();
|
|
|
98
|
+ modelAfterSale.F_CheckUserNameXS = UserLogin.UserName;
|
|
|
99
|
+
|
|
|
100
|
+ modelAfterSale.F_DetailList = input.F_DetailList;
|
|
|
101
|
+ modelAfterSale.F_Type = input.F_Type;
|
|
|
102
|
+ modelAfterSale.F_Money = input.F_Money;
|
|
|
103
|
+ modelAfterSale.F_OrderId = input.F_OrderId;
|
|
|
104
|
+ modelAfterSale.F_AboutOrderId = "";
|
|
|
105
|
+ modelAfterSale.F_Id = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
106
|
+ //modelAfterSale.F_OurTrackingNo = input.F_OurTrackingNo;
|
|
|
107
|
+ //modelAfterSale.F_OurTrackDes = input.F_OurTrackDes;
|
|
|
108
|
+ //modelAfterSale.F_TrackingNo = input.F_TrackingNo;
|
|
|
109
|
+ //modelAfterSale.F_TrackDes = input.F_TrackDes;
|
|
|
110
|
+ if(!string.IsNullOrEmpty(input.F_Remark))
|
|
|
111
|
+ modelAfterSale.F_Remark =" 销售:"+ input.F_Remark;
|
|
|
112
|
+
|
|
|
113
|
+
|
|
|
114
|
+ //modelAfterSale.F_AddUser = UserLogin.UserId.ObjToInt();
|
|
|
115
|
+ //modelAfterSale.F_AddUserName = UserLogin.UserName;
|
|
|
116
|
+ //modelAfterSale.F_State = input.F_State;
|
|
|
117
|
+ //modelAfterSale.F_Money = input.F_Money;
|
|
|
118
|
+ //modelAfterSale.F_Gift = input.F_Gift;
|
|
|
119
|
+ //modelAfterSale.F_Type = input.F_Type;
|
|
|
120
|
+ //modelAfterSale.F_OrderList = input.F_OrderList;
|
|
|
121
|
+ //modelAfterSale.F_Remark = input.F_Remark;
|
|
|
122
|
+ //modelAfterSale.F_Id = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
123
|
+ if (await busAfterSaleRepository.AddReturnCount(modelAfterSale))
|
|
|
124
|
+ {
|
|
|
125
|
+ if (input.F_State == 0)
|
|
|
126
|
+ return Success("售后申请已保存");
|
|
|
127
|
+ else if (input.F_State == 1)
|
|
|
128
|
+ { return Success("售后申请已提交审核"); }
|
|
|
129
|
+ }
|
|
|
130
|
+ return Error("申请失败,请重试!");
|
|
|
131
|
+ }
|
|
|
132
|
+ catch (Exception ex)
|
|
|
133
|
+ { return Error(ex.Message); }
|
|
|
134
|
+
|
|
|
135
|
+
|
|
|
136
|
+ }
|
|
|
137
|
+
|
|
|
138
|
+ /// <summary>
|
|
|
139
|
+ /// 销售编辑售后
|
|
|
140
|
+ /// </summary>
|
|
|
141
|
+ /// <param name="input"></param>
|
|
|
142
|
+ /// <returns></returns>
|
|
|
143
|
+ [HttpPost("editaftersalexs")]
|
|
|
144
|
+ public async Task<IActionResult> EditAfterSaleXS(AfterSaleInput input)
|
|
|
145
|
+ {
|
|
|
146
|
+ try
|
|
|
147
|
+ {
|
|
|
148
|
+ #region 验证参数 必填项
|
|
|
149
|
+
|
|
|
150
|
+ if (string.IsNullOrEmpty(input.F_Id))
|
|
|
151
|
+ return Error("参数缺失Id");
|
|
|
152
|
+
|
|
|
153
|
+ if (string.IsNullOrEmpty(input.F_OrderId))
|
|
|
154
|
+ return Error("请选择订单");
|
|
|
155
|
+
|
|
|
156
|
+ if (input.F_Type <= 0)
|
|
|
157
|
+ return Error("申请类型不符合售后");
|
|
|
158
|
+
|
|
|
159
|
+ #endregion
|
|
|
160
|
+
|
|
|
161
|
+ #region 验证逻辑
|
|
|
162
|
+ if (input.F_Type == 1)
|
|
|
163
|
+ { }
|
|
|
164
|
+ else if (input.F_Type == 2)
|
|
|
165
|
+ { }
|
|
|
166
|
+ else if (input.F_Type == 3)
|
|
|
167
|
+ { }
|
|
|
168
|
+ else if (input.F_Type == 4)
|
|
|
169
|
+ { }
|
|
|
170
|
+ #endregion
|
|
|
171
|
+
|
|
|
172
|
+ T_Bus_AfterSale modelAfterSale = await busAfterSaleRepository.GetSingle(q=>q.F_Id==input.F_Id);
|
|
|
173
|
+
|
|
|
174
|
+ if (modelAfterSale.F_CheckStateSH == 1 && modelAfterSale.F_CheckStateXS == 1)
|
|
|
175
|
+ {
|
|
|
176
|
+ return Error("双审核通过不能编辑");
|
|
|
177
|
+ }
|
|
|
178
|
+ modelAfterSale.F_CheckTimeXS = DateTime.Now;
|
|
|
179
|
+ modelAfterSale.F_CheckStateXS = input.F_CheckStateXS;
|
|
|
180
|
+ modelAfterSale.F_CheckUserXS = UserLogin.UserId.ObjToInt();
|
|
|
181
|
+ modelAfterSale.F_CheckUserNameXS = UserLogin.UserName;
|
|
|
182
|
+
|
|
|
183
|
+ modelAfterSale.F_DetailList = input.F_DetailList;
|
|
|
184
|
+ modelAfterSale.F_Type = input.F_Type;
|
|
|
185
|
+ modelAfterSale.F_Money = input.F_Money;
|
|
|
186
|
+
|
|
|
187
|
+ modelAfterSale.F_CheckStateSH = 0;//需要售后重新审核
|
|
|
188
|
+ //modelAfterSale.F_OurTrackingNo = input.F_OurTrackingNo;
|
|
|
189
|
+ //modelAfterSale.F_OurTrackDes = input.F_OurTrackDes;
|
|
|
190
|
+ //modelAfterSale.F_TrackingNo = input.F_TrackingNo;
|
|
|
191
|
+ //modelAfterSale.F_TrackDes = input.F_TrackDes;
|
|
|
192
|
+ if (!string.IsNullOrEmpty(input.F_Remark))
|
|
|
193
|
+ modelAfterSale.F_Remark = modelAfterSale.F_Remark+"\\r\\n 销售:"+input.F_Remark;
|
|
|
194
|
+
|
|
|
195
|
+
|
|
|
196
|
+ //modelAfterSale.F_AddUser = UserLogin.UserId.ObjToInt();
|
|
|
197
|
+ //modelAfterSale.F_AddUserName = UserLogin.UserName;
|
|
|
198
|
+ //modelAfterSale.F_State = input.F_State;
|
|
|
199
|
+ //modelAfterSale.F_Money = input.F_Money;
|
|
|
200
|
+ //modelAfterSale.F_Gift = input.F_Gift;
|
|
|
201
|
+ //modelAfterSale.F_Type = input.F_Type;
|
|
|
202
|
+ //modelAfterSale.F_OrderList = input.F_OrderList;
|
|
|
203
|
+ //modelAfterSale.F_Remark = input.F_Remark;
|
|
|
204
|
+ //modelAfterSale.F_Id = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
205
|
+ if (await busAfterSaleRepository.AddReturnCount(modelAfterSale))
|
|
|
206
|
+ {
|
|
|
207
|
+ if (input.F_State == 0)
|
|
|
208
|
+ return Success("售后申请已保存");
|
|
|
209
|
+ else if (input.F_State == 1)
|
|
|
210
|
+ { return Success("售后申请已提交审核"); }
|
|
|
211
|
+ }
|
|
|
212
|
+ return Error("申请失败,请重试!");
|
|
|
213
|
+ }
|
|
|
214
|
+ catch (Exception ex)
|
|
|
215
|
+ { return Error(ex.Message); }
|
|
|
216
|
+
|
|
|
217
|
+
|
|
|
218
|
+ }
|
|
|
219
|
+
|
|
|
220
|
+ /// <summary>
|
|
|
221
|
+ /// 销售删除
|
|
|
222
|
+ /// </summary>
|
|
|
223
|
+ /// <param name="input"></param>
|
|
|
224
|
+ /// <returns></returns>
|
|
|
225
|
+ [HttpPost("deleteaftersalexs")]
|
|
|
226
|
+ public async Task<IActionResult> DeleteAfterSaleXS(string ids)
|
|
|
227
|
+ {
|
|
|
228
|
+ try
|
|
|
229
|
+ {
|
|
|
230
|
+ if (string.IsNullOrEmpty(ids))
|
|
|
231
|
+ {
|
|
|
232
|
+ return Error("参数缺失:" + ids);
|
|
|
233
|
+ }
|
|
|
234
|
+ string[] idlist = ids.Split(',');
|
|
|
235
|
+
|
|
|
236
|
+ if (await busAfterSaleRepository.Delete(q => idlist.Contains(q.F_Id) && new[] { 0, 2 }.Contains(q.F_CheckStateXS)))
|
|
|
237
|
+ {
|
|
|
238
|
+ return Success("删除成功/已审核通过不能删除");
|
|
|
239
|
+ }
|
|
|
240
|
+ return Error("删除失败,请重试!");
|
|
|
241
|
+ }
|
|
|
242
|
+ catch (Exception ex)
|
|
|
243
|
+ { return Error(ex.Message); }
|
|
|
244
|
+ }
|
|
|
245
|
+
|
|
|
246
|
+ /// <summary>
|
|
|
247
|
+ /// 根据分页获取列表
|
|
|
248
|
+ /// </summary>
|
|
|
249
|
+ /// <param name="input"></param>
|
|
|
250
|
+ /// <returns></returns>
|
|
|
251
|
+ [HttpPost("getaftersalebypagexs")]
|
|
|
252
|
+ public async Task<IActionResult> GetAfterSaleByPageXS(AfterSaleInput input)
|
|
|
253
|
+ {
|
|
|
254
|
+
|
|
|
255
|
+ #region 拼接条件
|
|
|
256
|
+
|
|
|
257
|
+ Expression<Func<T_Bus_AfterSale, bool>> eq = a => a.F_CheckUserXS == UserLogin.UserId.ObjToInt();
|
|
|
258
|
+
|
|
|
259
|
+
|
|
|
260
|
+ if (input.F_CheckStateXS>-1)
|
|
|
261
|
+ {
|
|
|
262
|
+ eq = eq.And(a => a.F_CheckStateXS == input.F_CheckStateXS);
|
|
|
263
|
+ }
|
|
|
264
|
+ if (input.F_CheckStateSH > -1)
|
|
|
265
|
+ {
|
|
|
266
|
+ eq = eq.And(a => a.F_CheckStateSH == input.F_CheckStateSH);
|
|
|
267
|
+ }
|
|
|
268
|
+ if (input.F_Type > -1)
|
|
|
269
|
+ {
|
|
|
270
|
+ eq = eq.And(a => a.F_Type == input.F_Type);
|
|
|
271
|
+ }
|
|
|
272
|
+ if (!string.IsNullOrEmpty(input.F_Id))
|
|
|
273
|
+ {
|
|
|
274
|
+ eq = eq.And(a => a.F_Id == input.F_Id);
|
|
|
275
|
+ }
|
|
|
276
|
+ if (input.F_State >= -1)
|
|
|
277
|
+ {
|
|
|
278
|
+ eq = eq.And(a => a.F_State == input.F_State);
|
|
|
279
|
+ }
|
|
|
280
|
+
|
|
|
281
|
+ #endregion
|
|
|
282
|
+ RefAsync<int> count = 0;
|
|
|
283
|
+ PageData<T_Bus_AfterSale> list = await busAfterSaleRepository.GetListByPage(eq, new MyPageModel() { PageIndex = input.pageindex, PageSize = input.pagesize, PageCount = count }, " F_AddTime DESC");
|
|
|
284
|
+
|
|
|
285
|
+ return Success("成功", list);
|
|
|
286
|
+
|
|
|
287
|
+ }
|
|
|
288
|
+
|
|
|
289
|
+ #endregion
|
|
|
290
|
+
|
|
|
291
|
+ #region 售后操作
|
|
|
292
|
+
|
|
|
293
|
+ /// <summary>
|
|
|
294
|
+ /// 销售申请售后
|
|
|
295
|
+ /// </summary>
|
|
|
296
|
+ /// <param name="input"></param>
|
|
|
297
|
+ /// <returns></returns>
|
|
|
298
|
+ [HttpPost("addaftersalesh")]
|
|
|
299
|
+ public async Task<IActionResult> AddAfterSaleSH(AfterSaleInput input)
|
|
|
300
|
+ {
|
|
|
301
|
+ try
|
|
|
302
|
+ {
|
|
|
303
|
+ #region 验证参数 必填项
|
|
|
304
|
+
|
|
|
305
|
+ if (string.IsNullOrEmpty(input.F_OrderId))
|
|
|
306
|
+ return Error("请选择订单");
|
|
|
307
|
+
|
|
|
308
|
+ if (input.F_Type <= 0)
|
|
|
309
|
+ return Error("申请类型不符合售后");
|
|
|
310
|
+
|
|
|
311
|
+ #endregion
|
|
|
312
|
+
|
|
|
313
|
+ #region 验证逻辑
|
|
|
314
|
+ if (input.F_Type == 1)
|
|
|
315
|
+ { }
|
|
|
316
|
+ else if (input.F_Type == 2)
|
|
|
317
|
+ { }
|
|
|
318
|
+ else if (input.F_Type == 3)
|
|
|
319
|
+ { }
|
|
|
320
|
+ else if (input.F_Type == 4)
|
|
|
321
|
+ { }
|
|
|
322
|
+ #endregion
|
|
|
323
|
+ T_Bus_Order modeOrder =await bus_OrderRepository.GetSingle(q=>q.F_Id== input.F_OrderId);
|
|
|
324
|
+ if (modeOrder == null)
|
|
|
325
|
+ {
|
|
|
326
|
+ return Error("订单不存在");
|
|
|
327
|
+ }
|
|
|
328
|
+ else if (modeOrder.F_Status==-1)
|
|
|
329
|
+ {
|
|
|
330
|
+ //物流状态0 未发出 1物流运送中2签收3改代收4拒收
|
|
|
331
|
+ return Error("状态不符合售后");
|
|
|
332
|
+ }
|
|
|
333
|
+ T_Bus_AfterSale modelAfterSale = new T_Bus_AfterSale();
|
|
|
334
|
+ modelAfterSale.F_AddTime = DateTime.Now;
|
|
|
335
|
+ modelAfterSale.F_CheckTimeSH = DateTime.Now;
|
|
|
336
|
+ modelAfterSale.F_CheckStateSH = input.F_CheckStateXS;
|
|
|
337
|
+ modelAfterSale.F_CheckUserSH = UserLogin.UserId.ObjToInt();
|
|
|
338
|
+ modelAfterSale.F_CheckUserNameSH = UserLogin.UserName;
|
|
|
339
|
+
|
|
|
340
|
+ modelAfterSale.F_CheckUserXS = modeOrder.F_AddUser;
|
|
|
341
|
+
|
|
|
342
|
+ modelAfterSale.F_DetailList = input.F_DetailList;
|
|
|
343
|
+ modelAfterSale.F_Type = input.F_Type;
|
|
|
344
|
+ modelAfterSale.F_Money = input.F_Money;
|
|
|
345
|
+ modelAfterSale.F_OrderId = input.F_OrderId;
|
|
|
346
|
+ modelAfterSale.F_AboutOrderId = "";
|
|
|
347
|
+ modelAfterSale.F_Id = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
348
|
+ //modelAfterSale.F_OurTrackingNo = input.F_OurTrackingNo;
|
|
|
349
|
+ //modelAfterSale.F_OurTrackDes = input.F_OurTrackDes;
|
|
|
350
|
+ //modelAfterSale.F_TrackingNo = input.F_TrackingNo;
|
|
|
351
|
+ //modelAfterSale.F_TrackDes = input.F_TrackDes;
|
|
|
352
|
+ if (!string.IsNullOrEmpty(input.F_Remark))
|
|
|
353
|
+ modelAfterSale.F_Remark = " 售后:" + input.F_Remark;
|
|
|
354
|
+
|
|
|
355
|
+
|
|
|
356
|
+ //modelAfterSale.F_AddUser = UserLogin.UserId.ObjToInt();
|
|
|
357
|
+ //modelAfterSale.F_AddUserName = UserLogin.UserName;
|
|
|
358
|
+ //modelAfterSale.F_State = input.F_State;
|
|
|
359
|
+ //modelAfterSale.F_Money = input.F_Money;
|
|
|
360
|
+ //modelAfterSale.F_Gift = input.F_Gift;
|
|
|
361
|
+ //modelAfterSale.F_Type = input.F_Type;
|
|
|
362
|
+ //modelAfterSale.F_OrderList = input.F_OrderList;
|
|
|
363
|
+ //modelAfterSale.F_Remark = input.F_Remark;
|
|
|
364
|
+ //modelAfterSale.F_Id = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
365
|
+ if (await busAfterSaleRepository.AddReturnCount(modelAfterSale))
|
|
|
366
|
+ {
|
|
|
367
|
+ if (input.F_State == 0)
|
|
|
368
|
+ return Success("售后申请已保存");
|
|
|
369
|
+ else if (input.F_State == 1)
|
|
|
370
|
+ { return Success("售后申请已提交审核"); }
|
|
|
371
|
+ }
|
|
|
372
|
+ return Error("申请失败,请重试!");
|
|
|
373
|
+ }
|
|
|
374
|
+ catch (Exception ex)
|
|
|
375
|
+ { return Error(ex.Message); }
|
|
|
376
|
+
|
|
|
377
|
+
|
|
|
378
|
+ }
|
|
|
379
|
+
|
|
|
380
|
+ /// <summary>
|
|
|
381
|
+ /// 销售编辑售后
|
|
|
382
|
+ /// </summary>
|
|
|
383
|
+ /// <param name="input"></param>
|
|
|
384
|
+ /// <returns></returns>
|
|
|
385
|
+ [HttpPost("editaftersalesh")]
|
|
|
386
|
+ public async Task<IActionResult> EditAfterSaleSH(AfterSaleInput input)
|
|
|
387
|
+ {
|
|
|
388
|
+ try
|
|
|
389
|
+ {
|
|
|
390
|
+ #region 验证参数 必填项
|
|
|
391
|
+
|
|
|
392
|
+ if (string.IsNullOrEmpty(input.F_Id))
|
|
|
393
|
+ return Error("参数缺失Id");
|
|
|
394
|
+
|
|
|
395
|
+ if (string.IsNullOrEmpty(input.F_OrderId))
|
|
|
396
|
+ return Error("请选择订单");
|
|
|
397
|
+
|
|
|
398
|
+ if (input.F_Type <= 0)
|
|
|
399
|
+ return Error("申请类型不符合售后");
|
|
|
400
|
+
|
|
|
401
|
+ #endregion
|
|
|
402
|
+
|
|
|
403
|
+ #region 验证逻辑
|
|
|
404
|
+ if (input.F_Type == 1)
|
|
|
405
|
+ { }
|
|
|
406
|
+ else if (input.F_Type == 2)
|
|
|
407
|
+ { }
|
|
|
408
|
+ else if (input.F_Type == 3)
|
|
|
409
|
+ { }
|
|
|
410
|
+ else if (input.F_Type == 4)
|
|
|
411
|
+ { }
|
|
|
412
|
+ #endregion
|
|
|
413
|
+
|
|
|
414
|
+ T_Bus_AfterSale modelAfterSale = await busAfterSaleRepository.GetSingle(q => q.F_Id == input.F_Id);
|
|
|
415
|
+
|
|
|
416
|
+ if (modelAfterSale.F_CheckStateSH == 1 && modelAfterSale.F_CheckStateXS == 1)
|
|
|
417
|
+ {
|
|
|
418
|
+ return Error("双审核通过不能编辑");
|
|
|
419
|
+ }
|
|
|
420
|
+ modelAfterSale.F_CheckTimeXS = DateTime.Now;
|
|
|
421
|
+ modelAfterSale.F_CheckStateXS = input.F_CheckStateXS;
|
|
|
422
|
+ modelAfterSale.F_CheckUserXS = UserLogin.UserId.ObjToInt();
|
|
|
423
|
+ modelAfterSale.F_CheckUserNameXS = UserLogin.UserName;
|
|
|
424
|
+
|
|
|
425
|
+ modelAfterSale.F_DetailList = input.F_DetailList;
|
|
|
426
|
+ modelAfterSale.F_Type = input.F_Type;
|
|
|
427
|
+ modelAfterSale.F_Money = input.F_Money;
|
|
|
428
|
+
|
|
|
429
|
+ modelAfterSale.F_CheckStateSH = 0;//需要售后重新审核
|
|
|
430
|
+ //modelAfterSale.F_OurTrackingNo = input.F_OurTrackingNo;
|
|
|
431
|
+ //modelAfterSale.F_OurTrackDes = input.F_OurTrackDes;
|
|
|
432
|
+ //modelAfterSale.F_TrackingNo = input.F_TrackingNo;
|
|
|
433
|
+ //modelAfterSale.F_TrackDes = input.F_TrackDes;
|
|
|
434
|
+ if (!string.IsNullOrEmpty(input.F_Remark))
|
|
|
435
|
+ modelAfterSale.F_Remark = modelAfterSale.F_Remark + "\\r\\n 售后:" + input.F_Remark;
|
|
|
436
|
+
|
|
|
437
|
+
|
|
|
438
|
+ //modelAfterSale.F_AddUser = UserLogin.UserId.ObjToInt();
|
|
|
439
|
+ //modelAfterSale.F_AddUserName = UserLogin.UserName;
|
|
|
440
|
+ //modelAfterSale.F_State = input.F_State;
|
|
|
441
|
+ //modelAfterSale.F_Money = input.F_Money;
|
|
|
442
|
+ //modelAfterSale.F_Gift = input.F_Gift;
|
|
|
443
|
+ //modelAfterSale.F_Type = input.F_Type;
|
|
|
444
|
+ //modelAfterSale.F_OrderList = input.F_OrderList;
|
|
|
445
|
+ //modelAfterSale.F_Remark = input.F_Remark;
|
|
|
446
|
+ //modelAfterSale.F_Id = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
447
|
+ if (await busAfterSaleRepository.AddReturnCount(modelAfterSale))
|
|
|
448
|
+ {
|
|
|
449
|
+ if (input.F_State == 0)
|
|
|
450
|
+ return Success("售后申请已保存");
|
|
|
451
|
+ else if (input.F_State == 1)
|
|
|
452
|
+ { return Success("售后申请已提交审核"); }
|
|
|
453
|
+ }
|
|
|
454
|
+ return Error("申请失败,请重试!");
|
|
|
455
|
+ }
|
|
|
456
|
+ catch (Exception ex)
|
|
|
457
|
+ { return Error(ex.Message); }
|
|
|
458
|
+
|
|
|
459
|
+
|
|
|
460
|
+ }
|
|
|
461
|
+
|
|
|
462
|
+ /// <summary>
|
|
|
463
|
+ /// 销售删除
|
|
|
464
|
+ /// </summary>
|
|
|
465
|
+ /// <param name="input"></param>
|
|
|
466
|
+ /// <returns></returns>
|
|
|
467
|
+ [HttpPost("deleteaftersalesh")]
|
|
|
468
|
+ public async Task<IActionResult> DeleteAfterSaleSH(string ids)
|
|
|
469
|
+ {
|
|
|
470
|
+ try
|
|
|
471
|
+ {
|
|
|
472
|
+ if (string.IsNullOrEmpty(ids))
|
|
|
473
|
+ {
|
|
|
474
|
+ return Error("参数缺失:" + ids);
|
|
|
475
|
+ }
|
|
|
476
|
+ string[] idlist = ids.Split(',');
|
|
|
477
|
+
|
|
|
478
|
+ if (await busAfterSaleRepository.Delete(q => idlist.Contains(q.F_Id) && new[] { 0, 2 }.Contains(q.F_CheckStateXS)))
|
|
|
479
|
+ {
|
|
|
480
|
+ return Success("删除成功/已审核通过不能删除");
|
|
|
481
|
+ }
|
|
|
482
|
+ return Error("删除失败,请重试!");
|
|
|
483
|
+ }
|
|
|
484
|
+ catch (Exception ex)
|
|
|
485
|
+ { return Error(ex.Message); }
|
|
|
486
|
+ }
|
|
|
487
|
+
|
|
|
488
|
+ /// <summary>
|
|
|
489
|
+ /// 根据分页获取列表
|
|
|
490
|
+ /// </summary>
|
|
|
491
|
+ /// <param name="input"></param>
|
|
|
492
|
+ /// <returns></returns>
|
|
|
493
|
+ [HttpPost("getaftersalebypagesh")]
|
|
|
494
|
+ public async Task<IActionResult> GetAfterSaleByPageSH(AfterSaleInput input)
|
|
|
495
|
+ {
|
|
|
496
|
+
|
|
|
497
|
+ #region 拼接条件
|
|
|
498
|
+
|
|
|
499
|
+ Expression<Func<T_Bus_AfterSale, bool>> eq = a => a.F_CheckUserXS == UserLogin.UserId.ObjToInt();
|
|
|
500
|
+
|
|
|
501
|
+
|
|
|
502
|
+ if (input.F_CheckStateXS > -1)
|
|
|
503
|
+ {
|
|
|
504
|
+ eq = eq.And(a => a.F_CheckStateXS == input.F_CheckStateXS);
|
|
|
505
|
+ }
|
|
|
506
|
+ if (input.F_CheckStateSH > -1)
|
|
|
507
|
+ {
|
|
|
508
|
+ eq = eq.And(a => a.F_CheckStateSH == input.F_CheckStateSH);
|
|
|
509
|
+ }
|
|
|
510
|
+ if (input.F_Type > -1)
|
|
|
511
|
+ {
|
|
|
512
|
+ eq = eq.And(a => a.F_Type == input.F_Type);
|
|
|
513
|
+ }
|
|
|
514
|
+ if (!string.IsNullOrEmpty(input.F_Id))
|
|
|
515
|
+ {
|
|
|
516
|
+ eq = eq.And(a => a.F_Id == input.F_Id);
|
|
|
517
|
+ }
|
|
|
518
|
+ if (input.F_State >= -1)
|
|
|
519
|
+ {
|
|
|
520
|
+ eq = eq.And(a => a.F_State == input.F_State);
|
|
|
521
|
+ }
|
|
|
522
|
+
|
|
|
523
|
+ #endregion
|
|
|
524
|
+ RefAsync<int> count = 0;
|
|
|
525
|
+ PageData<T_Bus_AfterSale> list = await busAfterSaleRepository.GetListByPage(eq, new MyPageModel() { PageIndex = input.pageindex, PageSize = input.pagesize, PageCount = count }, " F_AddTime DESC");
|
|
|
526
|
+
|
|
|
527
|
+ return Success("成功", list);
|
|
|
528
|
+
|
|
|
529
|
+ }
|
|
|
530
|
+
|
|
|
531
|
+ #endregion
|
|
|
532
|
+
|
|
|
533
|
+
|
|
|
534
|
+
|
|
|
535
|
+
|
|
|
536
|
+
|
|
|
537
|
+
|
|
|
538
|
+ }
|
|
|
539
|
+}
|