Browse Source

添加辅助工具-设置商户信息

DuGuYang 3 years ago
parent
commit
a247cfad5c

+ 57 - 2
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -2482,7 +2482,7 @@ namespace MySystem.Areas.Admin.Controllers
             else
             {
                 var stattime = pos.RecycStartDate == null ? "" : pos.RecycStartDate.Value.ToString("yyyy-MM-dd hh:mm:ss");
-                var endtime = pos.RecycEndDate== null ? "" : pos.RecycEndDate.Value.ToString("yyyy-MM-dd hh:mm:ss");
+                var endtime = pos.RecycEndDate == null ? "" : pos.RecycEndDate.Value.ToString("yyyy-MM-dd hh:mm:ss");
                 result += "循环开始时间:" + stattime + "\n";
                 result += "循环结束时间:" + endtime + "\n";
                 result += "来源机具/券:" + pos.SourcePosSn + "\n";
@@ -3741,7 +3741,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 return "商户" + MerchantNo + "不存在";
             }
-            if (pos.Id == 0)
+            else if (pos.Id == 0)
             {
                 return "机具" + PosSn + "不存在";
             }
@@ -3757,6 +3757,61 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
 
+        #region 设置商户信息
+
+        public IActionResult SetMerchantInfo(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        [HttpPost]
+        public string SetMerchantInfoDo(string PosSn, string MerchantNo, string MerchantName, string MerIdcardNo, string MerchantMobile)
+        {
+            if (string.IsNullOrEmpty(PosSn))
+            {
+                return "请输入机具SN";
+            }
+            if (string.IsNullOrEmpty(MerchantNo))
+            {
+                return "请输入商户编号";
+            }
+            if (string.IsNullOrEmpty(MerchantName))
+            {
+                return "请输入商户姓名";
+            }
+            if (string.IsNullOrEmpty(MerIdcardNo))
+            {
+                return "请输入商户身份证号";
+            }
+            if (string.IsNullOrEmpty(MerchantMobile))
+            {
+                return "请输入商户手机号";
+            }
+            var posMerchant = db.PosMerchantInfo.FirstOrDefault(m => m.MerchantNo == MerchantNo && m.KqSnNo == PosSn) ?? new PosMerchantInfo();
+            var query = "";
+            query += "修改前:" + posMerchant.KqSnNo + "," + posMerchant.MerchantNo + "," + posMerchant.MerchantName + "," + posMerchant.MerIdcardNo + "," + posMerchant.MerchantMobile;
+            query += "修改后:" + PosSn + "," + MerchantNo + "," + MerchantName + "," + MerIdcardNo + "," + MerchantMobile;
+            if (posMerchant.Id == 0)
+            {
+                return "商户" + MerchantNo + "不存在";
+            }
+            else
+            {
+                posMerchant.MerIdcardNo = MerIdcardNo;
+                posMerchant.MerchantName = MerchantName;
+                posMerchant.MerchantMobile = MerchantMobile;
+                db.SaveChanges();
+                function.WriteLog(DateTime.Now.ToString() + ":请求参数," + query + ":" + SysUserName + "-" + SysRealName, "设置商户信息");
+            }
+
+            return "success";
+        }
+        #endregion
+
+
         #region 认证创客
 
         public IActionResult AuthMaker(string right)

+ 298 - 0
Areas/Admin/Views/MainServer/SysTools/SetMerchantInfo.cshtml

@@ -0,0 +1,298 @@
+@{
+    string RightInfo = ViewBag.RightInfo as string;
+    string right = ViewBag.right as string;
+
+}
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>设置商户信息</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
+    <script src="/admin/js/jquery-1.10.1.min.js"></script>
+    <script src="/admin/js/LAreaData2.js"></script>
+</head>
+
+<body>
+
+    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
+        <form class="layui-form" id="confirmFrm">
+            <div class="layui-card">
+                <div class="layui-card-body">
+                    <div class="layui-tab" lay-filter="mytabbar">
+                        <ul class="layui-tab-title">
+                            <li class="layui-this" lay-id="1">基本信息</li>
+                        </ul>
+                        <div class="layui-tab-content mt20">
+                            <div class="layui-tab-item layui-show">
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">机具SN</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="PosSn" name="PosSn" maxlength="50"
+                                            lay-verify="required|" autocomplete="off" placeholder="请输入机具SN">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">商户编号</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="MerchantNo" name="MerchantNo"
+                                            maxlength="50" lay-verify="required|" autocomplete="off"
+                                            placeholder="请输入商户编号">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">商户姓名</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="MerchantName" name="MerchantName"
+                                            maxlength="50" lay-verify="required|" autocomplete="off"
+                                            placeholder="请输入商户姓名">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">商户身份证号</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="MerIdcardNo" name="MerIdcardNo"
+                                            maxlength="50" lay-verify="required|" autocomplete="off"
+                                            placeholder="请输入商户身份证号">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">商户手机号</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="MerchantMobile" name="MerchantMobile"
+                                            maxlength="50" lay-verify="required|" autocomplete="off"
+                                            placeholder="请输入商户手机号">
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="layui-form-item ml10">
+                        <div class="layui-input-block">
+                            <button type="button" class="layui-btn" onclick="save()">提交</button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script
+        src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script src="/other/mybjq/kindeditor-min.js"></script>
+    <script src="/other/mybjq/lang/zh_CN.js"></script>
+    <script>
+        function save() {
+            var PosSn = $('#PosSn').val();
+            var MerchantNo = $('#MerchantNo').val();
+            var MerchantName = $('#MerchantName').val();
+            var MerIdcardNo = $('#MerIdcardNo').val();
+            var MerchantMobile = $('#MerchantMobile').val();
+            if (PosSn == '') {
+                layer.msg('请输入机具SN');
+            }
+            else if (MerchantNo == '') {
+                layer.msg('请输入商户编号');
+            }
+            else if (MerchantName == '') {
+                layer.msg('请输入商户姓名');
+            }
+            else if (MerIdcardNo == '') {
+                layer.msg('请输入商户姓名');
+            }
+            else if (MerchantMobile == '') {
+                layer.msg('请输入商户姓名');
+            }
+            else {
+                var index = layer.confirm('确定要设置吗?', function (index) {
+                    var indexs = layer.load(1, {
+                        shade: [0.5, '#000']
+                    });
+                    var userdata = $("#confirmFrm").serialize();
+                    $.ajax({
+                        type: "POST",
+                        url: "/Admin/SysTools/SetMerchantInfoDo?r=" + Math.random(1),
+                        data: userdata,
+                        dataType: "text",
+                        success: function (data) {
+                            layer.close(index); //关闭弹层
+                            if (data == "success") {
+                                layer.close(indexs); //关闭弹层
+                                layer.msg('设置成功', {
+                                    time: 1000
+                                }, function () {
+                                    window.location.reload();
+                                });
+                            } else {
+                                layer.close(indexs); //关闭弹层
+                                layer.msg(data);
+                            }
+                        }
+                    });
+                });
+            }
+        }
+
+
+        //编辑器
+        KindEditor.ready(function (K) {
+
+        });
+
+        var ids = "";
+        function getChildren(obj) {
+            $.each(obj, function (index, value) {
+                var id = obj[index].id;
+                ids += id + ",";
+                var children = obj[index].children;
+                if (children) {
+                    getChildren(children);
+                }
+            });
+        }
+
+        function AreasProvinceInit(tagId, areasVal, form) {
+            for (var i = 0; i < provs_data.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(provs_data[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' + provs_data[i].text + '</option>');
+            }
+            form.render();
+        }
+
+        function AreasProvinceSelected(tagId, areasVal, form, value) {
+            $("#" + tagId + "City").html('<option value="">市</option>');
+            var list = citys_data[value];
+            for (var i = 0; i < list.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(list[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
+            }
+            $("#" + tagId + "Area").html('<option value="">县/区</option>');
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+
+        function AreasCitySelected(tagId, areasVal, form, value) {
+            $("#" + tagId + "Area").html('<option value="">县/区</option>');
+            var list = dists_data[value];
+            for (var i = 0; i < list.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(list[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
+            }
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+
+        function AreasAreaSelected(tagId, form) {
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+        function movePrev(obj, tagId) {
+            $(obj).parent().prev().insertAfter($(obj).parent());
+            checkPics(tagId);
+        }
+        function moveNext(obj, tagId) {
+            $(obj).parent().next().insertBefore($(obj).parent());
+            checkPics(tagId);
+        }
+        function deletePic(obj, tagId) {
+            $(obj).parent().remove();
+            checkPics(tagId);
+        }
+        function checkPics(tagId) {
+            var pics = "";
+            var texts = "";
+            $("#" + tagId + "Image div img").each(function (i) {
+                pics += $(this).attr("src").replace(osshost, '') + "|";
+            });
+            $("#" + tagId + "Image div input").each(function (i) {
+                texts += $(this).val() + "|";
+            });
+            if (pics == "") {
+                $("#" + tagId).val("");
+            } else {
+                pics = pics.substring(0, pics.length - 1);
+                texts = texts.substring(0, pics.length - 1);
+                $("#" + tagId).val(pics + "#cut#" + texts);
+            }
+        }
+        function checkBox(tagId) {
+            var text = "";
+            $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
+                text += $(this).val() + ",";
+            });
+            $("#" + tagId).val(text);
+        }
+        function showBigPic(picpath) {
+            parent.layer.open({
+                type: 1,
+                title: false,
+                closeBtn: 0,
+                shadeClose: true,
+                area: ['auto', 'auto'],
+                content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
+            });
+        }
+
+
+        var tree;
+        var element;
+        var upload;
+        layui.config({
+            base: '/layuiadmin/' //静态资源所在路径
+        }).extend({
+            index: 'lib/index' //主入口模块
+        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
+            var $ = layui.$
+                , form = layui.form
+                , layer = layui.layer
+                , layedit = layui.layedit
+                , laydate = layui.laydate
+                , croppers = layui.croppers
+                , transfer = layui.transfer
+                , util = layui.util;
+            tree = layui.tree;
+            element = layui.element;
+            upload = layui.upload;
+
+            //Hash地址的定位
+            var layid = location.hash.replace(/^#test=/, '');
+            element.tabChange('test', layid);
+            element.on('tab(test)', function (elem) {
+                location.hash = 'test=' + $(this).attr('lay-id');
+            });
+
+            //日期
+
+
+            //上传文件
+
+
+            //穿梭框
+
+
+            //TreeView,比如权限管理
+
+
+            //省市区
+
+        })
+
+    </script>
+</body>
+
+</html>