xiaoyu 3 лет назад
Родитель
Сommit
ad7310f8ac
2 измененных файлов с 66 добавлено и 42 удалено
  1. 10 5
      admin/control/refill_detail.php
  2. 56 37
      admin/templates/default/refill.detail.php

+ 10 - 5
admin/control/refill_detail.php

@@ -141,29 +141,34 @@ class refill_detailControl extends SystemControl
     {
         $id = $_GET['id'];
         $type = $_GET['type'];
-        $condition['id'] = ['in',$id];
+        $condition['detail_id'] = ['in',$id];
         $condition['order_state'] = ORDER_STATE_QUEUE;
-var_dump($_GET);die;
+
         $refill_detail = Model('refill_detail')->where($condition)->select();
         $mod = Model('refill_order');
         foreach ($refill_detail as $detail) {
             $mchid = $detail['mchid'];
             $mch_order = $detail['mch_order'];
+            Log::record("mchid: {$mchid} , mch_order: {$mch_order}", Log::DEBUG);
             $refill_order = $mod->getOrderInfo(['mchid' => $mchid,'mch_order' => $mch_order]);
             if (empty($refill_order)) {
+                Log::record("order dispose type:{$type}, params:{$detail['params']}",Log::DEBUG);
                 $params = json_decode($detail['params'],true);
                 if ($type == 'cancel') {
                     //零元订单失败
-//                    util::push_add_zero($params);
+                    Log::record("cancel",Log::DEBUG);
+                    util::push_add_zero($params);
                 } elseif ($type == 'anew') {
                     //重新补充
-//                    util::push_add($params);
+                    Log::record("anew",Log::DEBUG);
+                    util::push_add($params);
                 } else {
                     continue;
                 }
             } else {
-//                util::pop_queue_order($mchid,$mch_order);
+                util::pop_queue_order($mchid,$mch_order);
             }
         }
+        showMessage('操作成功');
     }
 }

+ 56 - 37
admin/templates/default/refill.detail.php

@@ -136,7 +136,7 @@
                     <a href="#" class="btns"  id="hFail">
                         <span><i class="icon-edit"></i>批量失败</span>
                     </a>
-                    <a href="#" class="btns" onclick="hSupplement(event)">
+                    <a href="#" class="btns" id="hSupplement">
                         <span><i class="icon-edit"></i>批量补充</span>
                     </a>
                 </td>
@@ -176,12 +176,11 @@
                         <!-- <a href="#">
                                 回调</a>
                         | -->
-                        <a href="#">
+                        <a href="index.php?act=refill_detail&op=order_dispose&type=cancel&id=<?php echo $order['detail_id']; ?>" id="hdFail">
                         回调失败</a>
                         |
-                        <a href="#">
-                        回调补充</a>
-
+                        <a href="index.php?act=refill_detail&op=order_dispose&type=anew&id=<?php echo $order['detail_id']; ?>">
+                        重新补充</a>
                     </td>
                 </tr>
             <?php } ?>
@@ -228,59 +227,79 @@
             elem: '#endTime',
             type: 'datetime'
         });
-            //批量失败
-    // function hFail(e) {
-    //     layer.confirm('您确定要批量失败', {
-    //     btn: ['确定','取消'],
-    //     title:'批量失败'
-    // }, function(){
-    //     $('#selectAll' ).click ( function () {
  
 
-            
-
-    //         })
-    //     }, function(){
-    // });
-    // }
         //全选
         $('#selectAll' ).click ( function () {
             $(":checkbox[name='checkbox']").each(function(){
             $(this).attr("checked", !$(this).attr("checked"));
 		});
-        let arr = [];
+        // let arr = [];
+        //     $("input:checkbox:checked").each(function (i) {
+        //         arr[i] = $(this).val();
+        //     })
+        //     let str = arr.join(",");
+        //     console.log(str);
+
+            
+
+            })
+            //批量
+            $('#hFail').click(function () {
+                layer.confirm('您确定要批量失败', {
+                btn: ['确定','取消'],
+                title:'批量失败'
+            }, function(){
+
+
+             let arr = [];
             $("input:checkbox:checked").each(function (i) {
                 arr[i] = $(this).val();
             })
             let str = arr.join(",");
+            if (str != '') {
+            window.location.href =`index.php?act=refill_detail&op=order_dispose&id= ${str ? str : ''}&type=cancel `
             console.log(str);
+            layer.msg('批量成功', {icon: 1});
 
-            
+            } else {
+                layer.msg('请还没有任何操作,请先选择');
+            }
+
+		
 
+            }, function(){
+            });
             })
-            //批量
-            $('#hFail').click(function () {
-                layer.confirm('您确定要批量失败', {
+
+                        //批量
+                $('#hSupplement').click(function () {
+                layer.confirm('您确定要批量补充', {
                 btn: ['确定','取消'],
                 title:'批量失败'
             }, function(){
-        if ($('#checkBoxList').attr('checked') == true) {
+
+
              let arr = [];
             $("input:checkbox:checked").each(function (i) {
                 arr[i] = $(this).val();
             })
             let str = arr.join(",");
-            window.location.href =`index.php?act=refill_detail&op=order_dispose&id= ${str ? str : ''}`
+            if (str != '') {
+            window.location.href =`index.php?act=refill_detail&op=order_dispose&id= ${str ? str : ''}&type=anew `
             console.log(str);
             layer.msg('批量成功', {icon: 1});
-        }  else {
-            layer.msg('您还没有进行任何操作,请先选择');
-        }
+
+            } else {
+                layer.msg('请还没有任何操作,请先选择');
+            }
+
 		
 
             }, function(){
             });
             })
+      
 
         // 表格hover时背景
         $('.trFlex').each(function () {
@@ -326,13 +345,13 @@
     }
 
     //批量补充
-    function hSupplement(e) {
-        layer.confirm('您确定要批量补充', {
-        btn: ['确定','取消'],
-        title:'批量补充'
-    }, function(){
-        layer.msg('1', {icon: 1});
-    }, function(){
-    });
-    }
+    // function hSupplement(e) {
+    //     layer.confirm('您确定要批量补充', {
+    //     btn: ['确定','取消'],
+    //     title:'批量补充'
+    // }, function(){
+    //     layer.msg('1', {icon: 1});
+    // }, function(){
+    // });
+    // }
 </script>