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

Merge branch 'DuGuYang' of http://47.109.31.237:13000/kxs-end/admin-server into feature-dgy-后台优化

DuGuYang 3 лет назад
Родитель
Сommit
67eb6765c4

+ 10 - 5
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -179,11 +179,16 @@ namespace MySystem.Areas.Admin.Controllers
                 var ValidAmount = amount.ValidAmount;
                 var FixedAmount = amount.FixedAmount;
                 var TempAmount = amount.TempAmount;
-                // var LeaderBalanceAmount = amount.LeaderBalanceAmount;
+                var check = db.StoreHouseAmountPromiss.Any(m => m.ToUserId == UserId);
+                decimal PromissAmount = 0;
+                if (check)
+                {
+                    PromissAmount = db.StoreHouseAmountPromiss.Where(m => m.Status == 1 && m.ToUserId == UserId).Sum(m => m.PromissAmount);
+                }
                 dic["ValidAmount"] = ValidAmount.ToString();//可用额度
                 dic["FixedAmount"] = FixedAmount.ToString();//固定额度
                 dic["TempAmount"] = TempAmount.ToString();//临时额度
-                // dic["LeaderBalanceAmount"] = LeaderBalanceAmount.ToString();//担保金额
+                dic["PromissAmount"] = PromissAmount.ToString();//担保金额
             }
             return Json(obj);
         }
@@ -276,7 +281,7 @@ namespace MySystem.Areas.Admin.Controllers
                         RedisDbconn.Instance.Set("StoreForCode:" + No, Id);
                     }
                     StoreForName storeForName = db.StoreForName.FirstOrDefault(m => m.Name == data.StoreName);
-                    if(storeForName == null)
+                    if (storeForName == null)
                     {
                         db.StoreForName.Add(new StoreForName()
                         {
@@ -480,7 +485,7 @@ namespace MySystem.Areas.Admin.Controllers
                 RedisDbconn.Instance.Set("StoreForCode:" + No, Id);
             }
             StoreForName storeForName = db.StoreForName.FirstOrDefault(m => m.Name == data.StoreName);
-            if(storeForName == null)
+            if (storeForName == null)
             {
                 db.StoreForName.Add(new StoreForName()
                 {
@@ -735,7 +740,7 @@ namespace MySystem.Areas.Admin.Controllers
                         var user = db.Users.FirstOrDefault(m => m.Id == toStore.UserId) ?? new Users();
                         var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == toStore.UserId) ?? new UserAccount();
                         var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == Convert.ToInt32(BrandId)) ?? new KqProducts();
-                        var fuserMachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == userForMakerCode.UserId+ "_" + brandInfo.Id);
+                        var fuserMachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == userForMakerCode.UserId + "_" + brandInfo.Id);
                         if (brandInfo.Name.Contains("电签"))
                         {
                             amount = 200;

+ 9 - 4
Areas/Admin/Controllers/MainServer/StoreMachineApplyController.cs

@@ -468,11 +468,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 int num = Convert.ToInt32(ApplyList[i]["ApplyNum"].ToString());
                 int BrandIds = Convert.ToInt32(ApplyList[i]["BrandId"].ToString());
-                if (BrandIds == 1 || BrandIds == 2 || BrandIds == 4 || BrandIds == 6 || BrandIds == 7 || BrandIds == 8)
+                //自动匹配品牌
+                var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds);
+                if (brandInfo.Name.Contains("电签"))
                 {
                     ApplyAmount += num * 200;
                 }
-                if (BrandIds == 3 || BrandIds == 5 || BrandIds == 9)
+                if (brandInfo.Name.Contains("大POS"))
                 {
                     ApplyAmount += num * 300;
                 }
@@ -484,7 +486,10 @@ namespace MySystem.Areas.Admin.Controllers
             var BrandId = 0;
             var FromStoreId = 0;
             string error = "";
-
+            if (string.IsNullOrEmpty(ExcelData))
+            {
+                return "Warning|" + "请选择要导入的数据";
+            }
             ExcelData = HttpUtility.UrlDecode(ExcelData);
             JsonData list = JsonMapper.ToObject(ExcelData);
             List<string> PosSnList = new List<string>();
@@ -580,7 +585,7 @@ namespace MySystem.Areas.Admin.Controllers
                 PosMachinesTwo machine = db.PosMachinesTwo.FirstOrDefault(m => m.Id == machinefor.SnId && m.BuyUserId == 0 && m.UserId == 0) ?? new PosMachinesTwo();
                 if (machine.Id > 0)
                 {
-                    if(machine.BrandId != BrandId)
+                    if (machine.BrandId != BrandId)
                     {
                         return machine.PosSn + "与表格里填写的品牌不一致";
                     }

+ 6 - 0
wwwroot/layuiadmin/modules_main/StoreHouse_Admin.js

@@ -276,6 +276,12 @@ layui.config({
                 title: '临时额度',
                 sort: true
             }, {
+                field: 'PromissAmount',
+                width: 110,
+                title: '担保额度',
+                sort: true
+            }
+            , {
                 title: '操作',
                 width: 300,
                 align: 'center',

+ 218 - 216
wwwroot/layuiadmin/modules_main/StoreMachineApply_Admin.js

@@ -170,7 +170,7 @@ layui.config({
                         var BrandId = $(this).val();
                         var ApplyNum = ApplyNums.eq(i).val();
                         SendSn += '{"BrandId":' + BrandId + ',"ApplyNum":' + ApplyNum + '}';
-                        if(i < ApplyNums.length - 1) {
+                        if (i < ApplyNums.length - 1) {
                             SendSn += ',';
                         }
                     });
@@ -213,8 +213,7 @@ layui.config({
             });
             // layer.full(perContent);
         } else if (obj.event === 'Close') {
-            var index = layer.confirm('是否确定驳回?驳回后使用额度将返回该创客的可用额度', function (index)
-            {
+            var index = layer.confirm('是否确定驳回?驳回后使用额度将返回该创客的可用额度', function (index) {
                 $.ajax({
                     type: "POST",
                     url: "/Admin/StoreMachineApply/Close?r=" + Math.random(1),
@@ -257,260 +256,263 @@ layui.config({
                     }, 300);
 
                     //监听提交
+                    var clickflag = 0;
                     iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
-                        var field = data.field; //获取提交的字段
-                        var userdata = "";
-                        for (var prop in field) {
-                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
-                        }
-                        //提交 Ajax 成功后,静态更新表格中的数据
-                        //$.ajax({});
-
-                        $.ajax({
-                            type: "POST",
-                            url: "/Admin/StoreMachineApply/AuditSend?r=" + Math.random(1),
-                            data: userdata,
-                            dataType: "text",
-                            success: function (data) {
-                                if (data == "success") {
-                                    layer.close(index); //关闭弹层
-                                    layer.msg('发货成功', {
-                                        time: 1500
-                                    }, function () {
-                                        table.reload('LAY-list-manage'); //数据刷新
-                                    });
-                                } else if (data.indexOf("Warning") == 0) {
-                                    var datalist = data.split('|');
-                                    layer.alert(datalist[1], { time: 20000 }, function () {
-                                        window.location.reload();
-                                    });
-                                } else {
-                                    layer.close(index); //关闭弹层
-                                    layer.msg('审核完成', {
-                                        time: 1500
-                                    }, function () {
-                                        table.reload('LAY-list-manage'); //数据刷新
-                                    });
-                                }
+                        if(clickflag == 0) {
+                            clickflag = 1;
+                            var field = data.field; //获取提交的字段
+                            var userdata = "";
+                            for (var prop in field) {
+                                userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
                             }
-                        });
+                            //提交 Ajax 成功后,静态更新表格中的数据
+                            //$.ajax({});
+                            $.ajax({
+                                type: "POST",
+                                url: "/Admin/StoreMachineApply/AuditSend?r=" + Math.random(1),
+                                data: userdata,
+                                dataType: "text",
+                                success: function (data) {
+                                    clickflag = 0;
+                                    if (data == "success") {
+                                        layer.close(index); //关闭弹层
+                                        layer.msg('发货成功', {
+                                            time: 1500
+                                        }, function () {
+                                            table.reload('LAY-list-manage'); //数据刷新
+                                        });
+                                    } else if (data.indexOf("Warning") == 0) {
+                                        var datalist = data.split('|');
+                                        layer.alert(datalist[1], { time: 20000 }, function () {
+                                            window.location.reload();
+                                        });
+                                    } else {
+                                        layer.close(index); //关闭弹层
+                                        layer.msg('审核完成', {
+                                            time: 1500
+                                        }, function () {
+                                            table.reload('LAY-list-manage'); //数据刷新
+                                        });
+                                    }
+                                }
+                            });
+                        }
                     });
-
                     submit.trigger('click');
                 },
                 success: function (layero, index) {
 
                 }
             });
-        }
+}
     });
 
 
-    //监听搜索
-    form.on('submit(LAY-list-front-search)', function (data) {
-        var field = data.field;
+//监听搜索
+form.on('submit(LAY-list-front-search)', function (data) {
+    var field = data.field;
 
-        //执行重载
-        table.reload('LAY-list-manage', {
-            where: field,
-            page: {
-                curr: 1
-            }
-        });
+    //执行重载
+    table.reload('LAY-list-manage', {
+        where: field,
+        page: {
+            curr: 1
+        }
     });
-    form.on('submit(LAY-list-front-searchall)', function (data) {
-        table.reload('LAY-list-manage', {
-            where: null,
-            page: {
-                curr: 1
-            }
-        });
+});
+form.on('submit(LAY-list-front-searchall)', function (data) {
+    table.reload('LAY-list-manage', {
+        where: null,
+        page: {
+            curr: 1
+        }
     });
-
-    //事件
-    var active = {
-        batchdel: function () {
-            var checkStatus = table.checkStatus('LAY-list-manage')
-                , data = checkStatus.data; //得到选中的数据
-            if (data.length < 1) {
-                parent.layer.msg("请选择要删除的项");
-            } else {
-                var ids = "";
-                $.each(data, function (index, value) {
-                    ids += data[index].Id + ",";
-                });
-                ids = ids.substring(0, ids.length - 1);
-                var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
-                    $.ajax({
-                        type: "POST",
-                        url: "/Admin/StoreMachineApply/Delete?r=" + Math.random(1),
-                        data: "Id=" + ids,
-                        dataType: "text",
-                        success: function (data) {
-                            layer.close(index);
-                            if (data == "success") {
-                                table.reload('LAY-list-manage');
-                            } else {
-                                layer.msg(data);
-                            }
+});
+
+//事件
+var active = {
+    batchdel: function () {
+        var checkStatus = table.checkStatus('LAY-list-manage')
+            , data = checkStatus.data; //得到选中的数据
+        if (data.length < 1) {
+            parent.layer.msg("请选择要删除的项");
+        } else {
+            var ids = "";
+            $.each(data, function (index, value) {
+                ids += data[index].Id + ",";
+            });
+            ids = ids.substring(0, ids.length - 1);
+            var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/StoreMachineApply/Delete?r=" + Math.random(1),
+                    data: "Id=" + ids,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index);
+                        if (data == "success") {
+                            table.reload('LAY-list-manage');
+                        } else {
+                            layer.msg(data);
                         }
-                    });
+                    }
                 });
-            }
+            });
         }
-        , add: function () {
-            var perContent = layer.open({
-                type: 2
-                , title: '分仓机具申请记录-添加'
-                , content: 'Add'
-                , maxmin: true
-                , area: ['500px', '450px']
-                , btn: ['确定', '取消']
-                , yes: function (index, layero) {
-                    var iframeWindow = window['layui-layer-iframe' + index]
-                        , submitID = 'LAY-list-front-submit'
-                        , submit = layero.find('iframe').contents().find('#' + submitID);
+    }
+    , add: function () {
+        var perContent = layer.open({
+            type: 2
+            , title: '分仓机具申请记录-添加'
+            , content: 'Add'
+            , maxmin: true
+            , area: ['500px', '450px']
+            , btn: ['确定', '取消']
+            , yes: function (index, layero) {
+                var iframeWindow = window['layui-layer-iframe' + index]
+                    , submitID = 'LAY-list-front-submit'
+                    , submit = layero.find('iframe').contents().find('#' + submitID);
 
-                    setTimeout(function () {
-                        layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
-                            var errObj = $(this).find('.layui-form-danger');
-                            if (errObj.length > 0) {
-                                iframeWindow.element.tabChange('mytabbar', String(i + 1));
-                                submit.click();
-                            }
-                        });
-                    }, 300);
+                setTimeout(function () {
+                    layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
+                        var errObj = $(this).find('.layui-form-danger');
+                        if (errObj.length > 0) {
+                            iframeWindow.element.tabChange('mytabbar', String(i + 1));
+                            submit.click();
+                        }
+                    });
+                }, 300);
 
 
 
 
 
 
-                    //监听提交
-                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
-                        var field = data.field; //获取提交的字段
-                        var userdata = "";
-                        for (var prop in field) {
-                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
-                        }
-                        //提交 Ajax 成功后,静态更新表格中的数据
-                        //$.ajax({});
-
-                        $.ajax({
-                            type: "POST",
-                            url: "/Admin/StoreMachineApply/Add?r=" + Math.random(1),
-                            data: userdata,
-                            dataType: "text",
-                            success: function (data) {
-                                layer.close(index); //关闭弹层
-                                if (data == "success") {
-                                    table.reload('LAY-list-manage'); //数据刷新
-                                } else {
-                                    layer.msg(data);
-                                }
-                            }
-                        });
-                    });
+                //监听提交
+                iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                    var field = data.field; //获取提交的字段
+                    var userdata = "";
+                    for (var prop in field) {
+                        userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                    }
+                    //提交 Ajax 成功后,静态更新表格中的数据
+                    //$.ajax({});
 
-                    submit.trigger('click');
-                }
-            });
-            layer.full(perContent);
-        }
-        , ImportData: function () {
-            ExcelKind = 1;
-            layer.open({
-                type: 1,
-                title: '导入',
-                maxmin: false,
-                area: ['460px', '280px'],
-                content: $('#excelForm'),
-                cancel: function () {
-                }
-            });
-            $("#excelTemp").html('<a href="/excelfile/模板文件.xlsx">点击下载模板文件</a>');
-        }
-        , ExportExcel: function () {
-            var userdata = '';
-            $(".layuiadmin-card-header-auto input").each(function (i) {
-                userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
-            });
-            $(".layuiadmin-card-header-auto select").each(function (i) {
-                userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
-            });
-            $.ajax({
-                type: "GET",
-                url: "/Admin/StoreMachineApply/ExportExcel?r=" + Math.random(1),
-                data: userdata,
-                dataType: "json",
-                success: function (data) {
-                    data.Obj.unshift(data.Fields);
-                    excel.exportExcel(data.Obj, data.Info, 'xlsx');
-                }
-            });
-        }
-        , Open: function () {
-            var checkStatus = table.checkStatus('LAY-list-manage')
-                , data = checkStatus.data; //得到选中的数据
-            if (data.length < 1) {
-                parent.layer.msg("请选择要开启的项");
-            } else {
-                var ids = "";
-                $.each(data, function (index, value) {
-                    ids += data[index].Id + ",";
-                });
-                ids = ids.substring(0, ids.length - 1);
-                var index = layer.confirm('确定要开启吗?', function (index) {
                     $.ajax({
                         type: "POST",
-                        url: "/Admin/StoreMachineApply/Open?r=" + Math.random(1),
-                        data: "Id=" + ids,
+                        url: "/Admin/StoreMachineApply/Add?r=" + Math.random(1),
+                        data: userdata,
                         dataType: "text",
                         success: function (data) {
-                            layer.close(index);
+                            layer.close(index); //关闭弹层
                             if (data == "success") {
-                                table.reload('LAY-list-manage');
+                                table.reload('LAY-list-manage'); //数据刷新
                             } else {
                                 layer.msg(data);
                             }
                         }
                     });
                 });
+
+                submit.trigger('click');
             }
-        }
-        , Close: function () {
-            var checkStatus = table.checkStatus('LAY-list-manage')
-                , data = checkStatus.data; //得到选中的数据
-            if (data.length < 1) {
-                parent.layer.msg("请选择要关闭的项");
-            } else {
-                var ids = "";
-                $.each(data, function (index, value) {
-                    ids += data[index].Id + ",";
+        });
+        layer.full(perContent);
+    }
+    , ImportData: function () {
+        ExcelKind = 1;
+        layer.open({
+            type: 1,
+            title: '导入',
+            maxmin: false,
+            area: ['460px', '280px'],
+            content: $('#excelForm'),
+            cancel: function () {
+            }
+        });
+        $("#excelTemp").html('<a href="/excelfile/模板文件.xlsx">点击下载模板文件</a>');
+    }
+    , ExportExcel: function () {
+        var userdata = '';
+        $(".layuiadmin-card-header-auto input").each(function (i) {
+            userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
+        });
+        $(".layuiadmin-card-header-auto select").each(function (i) {
+            userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
+        });
+        $.ajax({
+            type: "GET",
+            url: "/Admin/StoreMachineApply/ExportExcel?r=" + Math.random(1),
+            data: userdata,
+            dataType: "json",
+            success: function (data) {
+                data.Obj.unshift(data.Fields);
+                excel.exportExcel(data.Obj, data.Info, 'xlsx');
+            }
+        });
+    }
+    , Open: function () {
+        var checkStatus = table.checkStatus('LAY-list-manage')
+            , data = checkStatus.data; //得到选中的数据
+        if (data.length < 1) {
+            parent.layer.msg("请选择要开启的项");
+        } else {
+            var ids = "";
+            $.each(data, function (index, value) {
+                ids += data[index].Id + ",";
+            });
+            ids = ids.substring(0, ids.length - 1);
+            var index = layer.confirm('确定要开启吗?', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/StoreMachineApply/Open?r=" + Math.random(1),
+                    data: "Id=" + ids,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index);
+                        if (data == "success") {
+                            table.reload('LAY-list-manage');
+                        } else {
+                            layer.msg(data);
+                        }
+                    }
                 });
-                ids = ids.substring(0, ids.length - 1);
-                var index = layer.confirm('确定要关闭吗?', function (index) {
-                    $.ajax({
-                        type: "POST",
-                        url: "/Admin/StoreMachineApply/Close?r=" + Math.random(1),
-                        data: "Id=" + ids,
-                        dataType: "text",
-                        success: function (data) {
-                            layer.close(index);
-                            if (data == "success") {
-                                table.reload('LAY-list-manage');
-                            } else {
-                                layer.msg(data);
-                            }
+            });
+        }
+    }
+    , Close: function () {
+        var checkStatus = table.checkStatus('LAY-list-manage')
+            , data = checkStatus.data; //得到选中的数据
+        if (data.length < 1) {
+            parent.layer.msg("请选择要关闭的项");
+        } else {
+            var ids = "";
+            $.each(data, function (index, value) {
+                ids += data[index].Id + ",";
+            });
+            ids = ids.substring(0, ids.length - 1);
+            var index = layer.confirm('确定要关闭吗?', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/StoreMachineApply/Close?r=" + Math.random(1),
+                    data: "Id=" + ids,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index);
+                        if (data == "success") {
+                            table.reload('LAY-list-manage');
+                        } else {
+                            layer.msg(data);
                         }
-                    });
+                    }
                 });
-            }
+            });
         }
-    };
+    }
+};
 
-    $('.layui-btn').on('click', function () {
-        var type = $(this).data('type');
-        active[type] ? active[type].call(this) : '';
-    });
+$('.layui-btn').on('click', function () {
+    var type = $(this).data('type');
+    active[type] ? active[type].call(this) : '';
+});
 });