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

+ 11 - 33
Areas/Admin/Controllers/MainServer/OrdersController.cs

@@ -248,7 +248,7 @@ namespace MySystem.Areas.Admin.Controllers
                 if (SendStatus == 2) dic["SendStatusName"] = "已退货";
                 if (SendStatus == 0)
                 {
-                    dic["SendInfo"] = dic["SendStatus"].ToString();
+                    dic["SendInfo"] = dic["SendStatusName"];
                 }
                 else
                 {
@@ -260,7 +260,10 @@ namespace MySystem.Areas.Admin.Controllers
                 //商品名称
                 int Id = int.Parse(function.CheckInt(dic["Id"].ToString()));
                 OrderProduct orderProducts = db.OrderProduct.FirstOrDefault(m => m.OrderId == Id) ?? new OrderProduct();
+                var product = db.Products.FirstOrDefault(m => m.Id == orderProducts.ProductId) ?? new Products();
                 dic["ProductName"] = orderProducts.ProductName;
+                if (product.ProductKind == 1) dic["ProductKind"] = "实物商品";
+                if (product.ProductKind == 2) dic["ProductKind"] = "虚拟商品";
 
                 //仓库归属创客
                 int StoreUserId = int.Parse(function.CheckInt(dic["StoreUserId"].ToString()));
@@ -274,11 +277,11 @@ namespace MySystem.Areas.Admin.Controllers
                 dic.Remove("TopUserId");
                 //支付状态
                 int PayStatus = int.Parse(dic["PayStatus"].ToString());
-                if (PayStatus == 0) dic["PayStatus"] = "未支付";
-                if (PayStatus == 1) dic["PayStatus"] = "支付成功";
-                if (PayStatus == 2) dic["PayStatus"] = "支付失败";
-                if (PayStatus == 3) dic["PayStatus"] = "支付锁定中";
-                if (PayStatus == 4) dic["PayStatus"] = "支付处理中";
+                if (PayStatus == 0) dic["PayStatusName"] = "未支付";
+                if (PayStatus == 1) dic["PayStatusName"] = "支付成功";
+                if (PayStatus == 2) dic["PayStatusName"] = "支付失败";
+                if (PayStatus == 3) dic["PayStatusName"] = "支付锁定中";
+                if (PayStatus == 4) dic["PayStatusName"] = "支付处理中";
 
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
@@ -507,41 +510,16 @@ namespace MySystem.Areas.Admin.Controllers
         #region 发货
 
         [HttpPost]
-        public string Send(Orders data, string IdList, string StoreIdList, string SnNosList)
+        public string Send(Orders data, string IdList)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
 
             Fields.Add("ErpName", data.ErpName); //物流名称
             Fields.Add("ErpCode", data.ErpCode); //运单号
-            Fields.Add("SnNos", SnNosList); //SN编号
             Fields.Add("SendStatus", 1); //发货状态
+            Fields.Add("Status", 3); //状态
             Fields.Add("SendDate", DateTime.Now); //发货时间
 
-            string[] Ids = IdList.TrimEnd('#').Split('#');
-            string[] StoreIds = StoreIdList.TrimEnd('#').Split('#');
-            string[] SnNoss = SnNosList.TrimEnd('#').Split('#');
-            int[] pIds = new int[] { 42, 41, 21, 20, 19, 18, 17, 16, 14, 13, 12, 9, 8, 7 };
-            for (int i = 0; i < Ids.Length; i++)
-            {
-                int Id = int.Parse(Ids[i]);
-                if (pIds.Contains(Id))
-                {
-                    Fields.Add("Status", 3);
-                }
-                int StoreId = int.Parse(StoreIds[i]);
-                string SnNos = SnNoss[i];
-                OrderProduct pro = db.OrderProduct.FirstOrDefault(m => m.Id == Id);
-                if (pro != null)
-                {
-                    pro.StoreId = StoreId;
-                    pro.SnNos = SnNos;
-                }
-                if (i == 0)
-                {
-                    Fields.Add("StoreId", StoreId);
-                }
-            }
-
             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Orders", Fields, data.Id);
             AddSysLog(data.Id.ToString(), "Orders", "Send");
             db.SaveChanges();

+ 2 - 2
Areas/Admin/Views/MainServer/Orders/Index.cshtml

@@ -257,13 +257,13 @@
                     <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail"><i class="layui-icon layui-icon-read"></i>详情</a>
                     @if (RightInfo.Contains("," + right + "_send,"))
                     {
-                        @Html.Raw("{{#if (d.SendStatus == 0 && d.RefundStatus == 0 && d.Sort == 0 && d.TotalPrice > 0){ }}")
+                        @Html.Raw("{{#if (d.SendStatus == 0 && d.RefundStatus == 0 && d.PayStatus == 1 && d.Sort == 0 && d.TotalPrice > 0){ }}")
                         <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="send"><i class="layui-icon layui-icon-edit"></i>发货</a>
                         @("{{#} }}")
                     }
                     @if (RightInfo.Contains("," + right + "_return,"))
                     {
-                        @("{{#if (d.RefundStatus == 0){ }}")
+                        @Html.Raw("{{#if (d.RefundStatus == 0 && d.PayStatus == 1){ }}")
                         <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="return"><i class="layui-icon layui-icon-edit"></i>退货</a>
                         @("{{#} }}")
                     }

+ 2 - 2
Areas/Admin/Views/MainServer/Orders/Send.cshtml

@@ -70,7 +70,7 @@
                                     <input class="layui-input" type="text" readonly id="ProductName" name="ProductNameList" value="@product.ProductName">
                                 </div>
                             </div>
-                            <div class="layui-form-item">
+                            @* <div class="layui-form-item">
                                 <label class="layui-form-label">发货仓库</label>
                                 <div class="layui-input-inline">
                                     <select id="StoreId" name="StoreIdList" lay-verify="required" lay-search="">
@@ -87,7 +87,7 @@
                                 <div class="layui-input-block">
                                     <textarea class="layui-textarea" id="SnNos" name="SnNosList" lay-verify="required" placeholder="请输入SN号,多个以逗号隔开"></textarea>
                                 </div>
-                            </div>
+                            </div> *@
                         }
                     </div>
 

+ 48 - 46
wwwroot/layuiadmin/modules_main/Orders_Admin.js

@@ -1,4 +1,4 @@
-var ExcelData,ExcelKind;
+var ExcelData, ExcelKind;
 function ConfirmImport() {
     $.ajax({
         type: "POST",
@@ -114,20 +114,20 @@ layui.config({
 
 
     //excel导入
-    excel = layui.excel;        
+    excel = layui.excel;
     $('#ExcelFile').change(function (e) {
         var files = e.target.files;
-        excel.importExcel(files, { }, function (data) {
+        excel.importExcel(files, {}, function (data) {
             ExcelData = data[0].sheet1;
         });
     });
 
     //监听单元格编辑
-    table.on('edit(LAY-list-manage)', function(obj){
+    table.on('edit(LAY-list-manage)', function (obj) {
         var value = obj.value //得到修改后的值
-        ,data = obj.data //得到所在行所有键值
-        ,field = obj.field; //得到字段
-        if(field == "Sort"){
+            , data = obj.data //得到所在行所有键值
+            , field = obj.field; //得到字段
+        if (field == "Sort") {
             $.ajax({
                 type: "POST",
                 url: "/Admin/Orders/Sort?r=" + Math.random(1),
@@ -138,7 +138,7 @@ layui.config({
             });
         }
     });
-    
+
     //列表数据
     table.render({
         elem: '#LAY-list-manage'
@@ -146,30 +146,32 @@ layui.config({
         , cols: [[
             { type: 'checkbox', fixed: 'left' }
             , { field: 'Id', fixed: 'left', title: 'ID', width: 80, sort: true, unresize: true }
-            ,{field:'OrderNo', width: 200, title:'平台订单号-渠道订单号', sort: true}
-            ,{field:'ProductName', width: 200, title:'商品名称', sort: true}
-            ,{field:'Store', width: 200, title:'发货仓库信息', sort: true}
-            ,{field:'StoreContact', width: 200, title:'仓库联系人信息', sort: true}
-            ,{field:'StoreFrom', width: 200, title:'仓库归属信息', sort: true}
-            ,{field:'UserInfo', width: 200, title:'创客信息', sort: true}
-            ,{field:'TopUserInfo', width: 200, title:'顶级创客信息', sort: true}
-            ,{field:'Address', width: 200, title:'收货地址', sort: true}
-            ,{field:'RecieveInfo', width: 200, title:'收件人姓名-联系电话', sort: true}
-            ,{field:'PayMode', width: 200, title:'支付渠道', sort: true}
-            ,{field:'TotalPrice', width: 200, title:'订单金额', sort: true}
-            ,{field:'PayStatus', width: 200, title:'支付状态', sort: true}
-            ,{field:'DeliveryType', width: 200, title:'提货类型', sort: true}
-            ,{field:'Remark', width: 200, title:'订单备注', sort: true}
-            ,{field:'SendInfo', width: 200, title:'发货状态-发货时间', sort: true}
-            ,{field:'RefundStatusName', width: 200, title:'退款状态', sort: true}
-            ,{field:'ErpInfo', width: 200, title:'快递单号-快递名称', sort: true}
-            ,{field:'CreateDate', width: 200, title:'下单时间', sort: true}
-            ,{field:'PayDate', width: 200, title:'支付时间', sort: true}
+            , { field: 'SendInfo', width: 200, title: '发货状态-发货时间', sort: true }
+            , { field: 'OrderNo', width: 200, title: '平台订单号-渠道订单号', sort: true }
+            , { field: 'ProductName', width: 200, title: '商品名称', sort: true }
+            , { field: 'ProductKind', width: 200, title: '商品类型', sort: true }
+            , { field: 'TotalPrice', width: 200, title: '订单金额', sort: true }
+            , { field: 'BuyCount', width: 200, title: '购买数量', sort: true }
+            , { field: 'Store', width: 200, title: '发货仓库信息', sort: true }
+            , { field: 'StoreContact', width: 200, title: '仓库联系人信息', sort: true }
+            , { field: 'StoreFrom', width: 200, title: '仓库归属信息', sort: true }
+            , { field: 'UserInfo', width: 200, title: '创客信息', sort: true }
+            , { field: 'TopUserInfo', width: 200, title: '顶级创客信息', sort: true }
+            , { field: 'Address', width: 200, title: '收货地址', sort: true }
+            , { field: 'RecieveInfo', width: 200, title: '收件人姓名-联系电话', sort: true }
+            , { field: 'PayMode', width: 200, title: '支付渠道', sort: true }
+            , { field: 'PayStatusName', width: 200, title: '支付状态', sort: true }
+            , { field: 'DeliveryType', width: 200, title: '提货类型', sort: true }
+            , { field: 'Remark', width: 200, title: '订单备注', sort: true }
+            , { field: 'RefundStatusName', width: 200, title: '退款状态', sort: true }
+            , { field: 'ErpInfo', width: 200, title: '快递单号-快递名称', sort: true }
+            , { field: 'CreateDate', width: 200, title: '下单时间', sort: true }
+            , { field: 'PayDate', width: 200, title: '支付时间', sort: true }
 
             , { title: '操作', align: 'center', width: 300, fixed: 'right', toolbar: '#table-list-tools' }
         ]]
         , where: {
-            
+
         }
         , page: true
         , limit: 30
@@ -235,7 +237,7 @@ layui.config({
                         }
                         //提交 Ajax 成功后,静态更新表格中的数据
                         //$.ajax({});
-                        
+
                         $.ajax({
                             type: "POST",
                             url: "/Admin/Orders/Edit?r=" + Math.random(1),
@@ -327,7 +329,7 @@ layui.config({
                         });
                         userdata += "&SnNosList=" + SnNosList;
 
-                        
+
                         $.ajax({
                             type: "POST",
                             url: "/Admin/Orders/Send?r=" + Math.random(1),
@@ -385,7 +387,7 @@ layui.config({
                         }
                         //提交 Ajax 成功后,静态更新表格中的数据
                         //$.ajax({});
-                        
+
                         $.ajax({
                             type: "POST",
                             url: "/Admin/Orders/Return?r=" + Math.random(1),
@@ -511,20 +513,20 @@ layui.config({
                         , submitID = 'LAY-list-front-submit'
                         , submit = layero.find('iframe').contents().find('#' + submitID);
 
-                    setTimeout(function () { 
+                    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) {
@@ -535,7 +537,7 @@ layui.config({
                         }
                         //提交 Ajax 成功后,静态更新表格中的数据
                         //$.ajax({});
-                        
+
                         $.ajax({
                             type: "POST",
                             url: "/Admin/Orders/Add?r=" + Math.random(1),
@@ -569,7 +571,7 @@ layui.config({
                 }
             });
             $("#excelTemp").html('<a href="/excelfile/模板文件.xlsx">点击下载模板文件</a>');
-        },ExportsExcel: function () {
+        }, ExportsExcel: function () {
             var userdata = '';
             $(".layuiadmin-card-header-auto input").each(function (i) {
                 console.log($(this).attr('name'));
@@ -608,7 +610,7 @@ layui.config({
                         'color': '#fff',
                         'text-align': 'center'
                     });
-                    var st = setInterval(function () { 
+                    var st = setInterval(function () {
                         $.ajax({
                             type: "GET",
                             url: "/Admin/Orders/CheckExport?r=" + Math.random(1),
@@ -616,7 +618,7 @@ layui.config({
                             success: function (data) {
                                 if (data == "finish") {
                                     clearInterval(st);
-                                } else { 
+                                } else {
                                     obj.text(data);
                                 }
                             }
@@ -634,7 +636,7 @@ layui.config({
                     if (data.indexOf("success|") > -1) {
                         var datalist = data.split('|');
                         window.location.href = datalist[1];
-                    } else { 
+                    } else {
                         layer.msg('导出失败');
                     }
                     // data.Obj.unshift(data.Fields);
@@ -645,9 +647,9 @@ layui.config({
         , Open: function () {
             var checkStatus = table.checkStatus('LAY-list-manage')
                 , data = checkStatus.data; //得到选中的数据
-            if(data.length < 1){
+            if (data.length < 1) {
                 parent.layer.msg("请选择要开启的项");
-            }else{
+            } else {
                 var ids = "";
                 $.each(data, function (index, value) {
                     ids += data[index].Id + ",";
@@ -674,9 +676,9 @@ layui.config({
         , Close: function () {
             var checkStatus = table.checkStatus('LAY-list-manage')
                 , data = checkStatus.data; //得到选中的数据
-            if(data.length < 1){
+            if (data.length < 1) {
                 parent.layer.msg("请选择要关闭的项");
-            }else{
+            } else {
                 var ids = "";
                 $.each(data, function (index, value) {
                     ids += data[index].Id + ",";