DuGuYang 3 years ago
parent
commit
21dc729fec

+ 4 - 2
AppStart/Helper/TimeOutPosChargeService.cs

@@ -163,12 +163,14 @@ namespace MySystem
                     if (record.ChargeType == 1)//普通预扣款
                     {
                         ChangeType = 202;
-                        Remark = "普通扣款";
+                        // Remark = "普通扣款";
+                        Remark = "扣款";
                     }
                     if (record.ChargeType == 2)//分期预扣款
                     {
                         ChangeType = 201;
-                        Remark = "分期扣款";
+                        // Remark = "分期扣款";
+                        Remark = "扣款";
                     }
                     var userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord
                     {

+ 13 - 8
Areas/Admin/Controllers/MainServer/ToChargeBackRecordController.cs

@@ -196,15 +196,20 @@ namespace MySystem.Areas.Admin.Controllers
         public string Edit(ToChargeBackRecord data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-
-            Fields.Add("UserId", data.UserId); //创客
+            var info = db.ToChargeBackRecord.FirstOrDefault(m => m.Id == data.Id) ?? new ToChargeBackRecord();
+            if (info.ChargeAmount != data.ChargeAmount)
+            {
+                var userAccount =db.UserAccount.FirstOrDefault(m => m.Id == info.UserId) ?? new UserAccount();
+                if (info.ChargeAmount > data.ChargeAmount)
+                {
+                    userAccount.ToChargeAmount -= info.ChargeAmount - data.ChargeAmount;
+                }
+                if (info.ChargeAmount < data.ChargeAmount)
+                {
+                    userAccount.ToChargeAmount += data.ChargeAmount - info.ChargeAmount;
+                }
+            }
             Fields.Add("ChargeAmount", data.ChargeAmount); //待扣金额
-            Fields.Add("ChargeType", data.ChargeType); //待扣类型
-            Fields.Add("Remark", data.Remark); //备注
-            Fields.Add("Field1", data.Field1); //备用字段
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecord", Fields, data.Id);
             AddSysLog(data.Id.ToString(), "ToChargeBackRecord", "update");

+ 4 - 1
Areas/Admin/Controllers/MainServer/ToChargeBackRecordSubController.cs

@@ -198,13 +198,16 @@ namespace MySystem.Areas.Admin.Controllers
             }
             if (toChargeBackRecordSub.ChargeAmount != data.ChargeAmount)
             {
+                var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == toChargeByStage.UserId) ?? new UserAccount();
                 if (toChargeBackRecordSub.ChargeAmount > data.ChargeAmount)
                 {
                     toChargeByStage.TotalAmount -= toChargeBackRecordSub.ChargeAmount - data.ChargeAmount;
+                    userAccount.ToChargeAmount -= toChargeBackRecordSub.ChargeAmount - data.ChargeAmount;
                 }
                 if (toChargeBackRecordSub.ChargeAmount < data.ChargeAmount)
                 {
-                    toChargeByStage.TotalAmount += toChargeBackRecordSub.ChargeAmount - data.ChargeAmount;
+                    toChargeByStage.TotalAmount += data.ChargeAmount - toChargeBackRecordSub.ChargeAmount;
+                    userAccount.ToChargeAmount += data.ChargeAmount - toChargeBackRecordSub.ChargeAmount;
                 }
             }
             Fields.Add("ChargeAmount", data.ChargeAmount); //待扣金额

+ 2 - 2
Areas/Admin/Views/MainServer/ToChargeBackRecord/Edit.cshtml

@@ -38,7 +38,7 @@
                             <div class="layui-form-item">
                                 <label class="layui-form-label">创客编号</label>
                                 <div class="layui-input-inline">
-                                    <input class="layui-input" type="text" id="ChargeAmount" name="ChargeAmount"
+                                    <input class="layui-input" type="text" id="ChargeAmount" name="ChargeAmount" readonly
                                         value="@ViewBag.MakerCode" maxlength="20" lay-verify="required|"
                                         autocomplete="off" placeholder="请输入待扣金额">
                                 </div>
@@ -54,7 +54,7 @@
                             <div class="layui-form-item">
                                 <label class="layui-form-label">待扣类型</label>
                                 <div class="layui-input-inline">
-                                    <select id="ChargeType" name="ChargeType" lay-search="">
+                                    <select id="ChargeType" name="ChargeType" lay-search="" readonly>
                                         <option value="">请选择</option>
                                         <option value="124">过期机具扣款</option>
                                         <option value="1">普通预扣</option>