lvhao 14 ساعت پیش
والد
کامیت
95739cc596
3فایلهای تغییر یافته به همراه90 افزوده شده و 4 حذف شده
  1. 50 3
      core/CoreApp/controllers/Beihuogl.php
  2. 38 1
      template/erp/beihuogl_dyapply.html
  3. 2 0
      template/erp/beihuogl_dyapplyadd.html

+ 50 - 3
core/CoreApp/controllers/Beihuogl.php

@@ -83,6 +83,8 @@ class Beihuogl extends Start_Controller {
             $this->_ccwlskucheck();
         }elseif($arg == 'printlabel'){
             $this->_printlabel();
+        }elseif($arg == 'deldyapply'){
+            $this->_deldyapply();
         }
 		else
 		{
@@ -96,6 +98,7 @@ class Beihuogl extends Start_Controller {
     //备货申请单的列表
     private function _dyapply(){
         if($this->input->method() === 'post'){
+            $vip_id = $this->input->post('vip_id',true);
             $page = $this->input->post('page',true);
 		    $perpage = $this->input->post('perpage',true);
             $sqr = $this->input->post('sqr',true);
@@ -116,7 +119,12 @@ class Beihuogl extends Start_Controller {
             if(!empty($shop_id)){
                 $where .= " and shop_id = ".$shop_id." ";
             }else{
-                $where .= " and shop_id in (".$shop_ids.") ";
+                if($vip_id == 1){
+
+                }else{
+                    $where .= " and shop_id in (".$shop_ids.") ";
+                }
+                
             }
             if(!empty($plat_id)){
                 $where .= " and plat_id = ".$plat_id." ";
@@ -145,8 +153,8 @@ class Beihuogl extends Start_Controller {
             $plat_list = array_column($plat_list,'title','id');
             $status_list = $this->bhsq->getSqStatus();
             foreach($list as $k=>$v){
-                $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:"";
-                $list[$k]['plat_id'] = isset($plat_list[$v['plat_id']])?$plat_list[$v['plat_id']]:"";
+                $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:"";
+                $list[$k]['plat_id'] = isset($plat_list[$v['plat_id']])?$plat_list[$v['plat_id']]:"";
                 $list[$k]['sq_status'] = isset($status_list[$v['sq_status']])?$status_list[$v['sq_status']]:"";
                 $list[$k]['add_time'] = date("Y-m-d",$v['add_time']);
                 $str = "";
@@ -158,6 +166,11 @@ class Beihuogl extends Start_Controller {
                     $str .=  "</div>";
 
                 }
+                if($v['sq_status'] == 0){
+                   $str .=  "<div style='text-align:center;'>";
+                   $str .= "<a href='javascript:void(0)' style='margin-right:4px;color: #fff;background-color: #DC143C;padding:4px 10px;border-radius:5px;font-size:15px' data-id='".$v['id']."' data-type='0' onclick='del_bhsq(this)'>删除</a>";
+                   $str .=  "</div>";
+                }
                 $list[$k]['update_time'] = $str;
             }
 
@@ -174,6 +187,11 @@ class Beihuogl extends Start_Controller {
             $user = $this->user->get_api($_SESSION['api']);
             $usersp = explode('|',trim($user['shop'],'|'));
             $this->data['usersp'] = implode(",",$usersp);
+            $vip_id = 0;
+            if(in_array($user['id'],[10,28])){
+                $vip_id = 1;
+            }
+            $this->data['vip_id'] = $vip_id;
             $this->_Template('beihuogl_dyapply',$this->data);
         }
     }
@@ -268,6 +286,15 @@ class Beihuogl extends Start_Controller {
            if($type == 2){
                 $update_arr['public_time'] = time();
            }
+           if($type == 3){
+                $update_arr['ccwl_status'] = 0;
+                $update_arr['ck_status'] = 0;
+                $update_arr['features'] = '';
+                $update_arr['jm'] = '';
+                $update_arr['public_time']  = 0;
+                $update_arr['bh_no'] = '';
+                $update_arr['u9sc_no'] = '';
+           }
            $r = $this->bhsq->save($update_arr,$id);
             if($r){
                 echo json_encode(['msg'=>'修改成功','success'=>true]);
@@ -279,6 +306,26 @@ class Beihuogl extends Start_Controller {
             echo json_encode(['success'=>false,'msg'=>'请求失败']);
         }
     }
+    private function _deldyapply(){
+        if($this->input->method() === 'post'){
+          $data = $this->input->post();
+          $id = $data['id'];
+          $info = $this->bhsq->read($id);
+          if($info['sq_status'] != 0){
+            echo json_encode(['msg'=>'此条记录不符合删除条件','success'=>false]);
+            exit;
+          }
+          $r = $this->bhsq->remove($id);
+          if($r){
+              echo json_encode(['msg'=>'删除成功','success'=>true]);
+          }else{
+              echo json_encode(['msg'=>'删除失败','success'=>false]);
+          }
+          exit;
+        }else{
+            echo json_encode(['success'=>false,'msg'=>'请求失败']);
+        }
+    }
     //备货申请单的 
     private function _dyapplysave(){
         if($this->input->method() === 'post'){

+ 38 - 1
template/erp/beihuogl_dyapply.html

@@ -29,7 +29,7 @@
         <input id="jtime" value="{date('Y-m-d',time()+24*3600)} 0:00" name="jtime" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})"  autocomplete="off">
     </li>
 
-
+    <input type="hidden" name="vip_id" value="{$vip_id}">    
     <input type="hidden" name="shop_ids" value="{$usersp}">
     <li><span>确 定</span></li>
 </ul>
@@ -243,6 +243,43 @@ function update_status(that){
             });
         }
     },'json')  
+}
+function del_bhsq(that){
+    let del_id = $(that).data('id')
+    layx.confirm('提示','确定要删除吗?',null,{
+        buttons:[
+            {
+                label:'确定',
+                callback:function(id, button, event){
+                    layx.destroy(id);
+                    $.post("/beihuogl/deldyapply",{id:del_id},function(a){
+                        if(a.success){
+                            $(".search span").click();
+                        }else{
+                            layx.confirm('错误提示',a.msg,null,{
+                                buttons:[
+                                    {
+                                        label:'确定',
+                                        callback:function(id, button, event){
+                                            layx.destroy(id);
+                                        }
+                                    }
+                                ],dialogIcon:'error',shadable:0.6
+                            });
+                        }
+                    },'json')  
+                }
+            },
+            {
+                label:'取消',
+                callback:function(id, button, event){
+                    layx.destroy(id);
+                }
+            }
+        ],dialogIcon:'success',shadable:0.6
+    });
+
+    
 }
 </script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>

+ 2 - 0
template/erp/beihuogl_dyapplyadd.html

@@ -125,6 +125,7 @@
 <li>
 <em>申请店铺:</em>
 <select name="shop_id" class="service select class" onChange="gradeChange()">
+<option value="0"  platid="0">无</option>
 {loop usershop() as $val}
 <option value="{$val['id']}" platid="{$val['type']}">{$val['shopname']}</option>
 {/loop}
@@ -133,6 +134,7 @@
 <li>
 <em>申请平台:</em>
 <select name="plat_id" class="service select class"  style="pointer-events: none;">
+<option value="0" >无</option>
 {loop $plat_list as $val}
 <option value="{$val['id']}" >{$val['title']}</option>
 {/loop}