order-outlog.vue 19.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
<!--出库登录:列表-->
<template>
  <div class="container resource close-left-menu contaNEW">
    <div class="pop-banner clearfix">
      <div class="operate-btns"></div>
      <h3 class="current-module">出库登录</h3>
    </div>
    <!--start-->
    <div class="operation-list clearfix">
      <div class="search-result mt-0">
        <div class="statistics">
          您共有 <em class="fW">{{medList.length}}</em>
          家医院有 <em class="fW">{{totalNum}}</em>
          张订单等待出库
        </div>
      </div>
      <div>
        <!--滚动-->
        <div class="ctable ct-parent mb-20" v-for="med in medList">
          <div class="ct-row table-no-border active">
            <div class="operation-list-top clearfix">
              <div class="unit-img fl">
                <!--
                <img src="">
                -->
                <imagebox v-bind:imgarr="med.pictcontent | original">
                  <span class="pic-max blue-search">
                    <img v-bind:src="med.pictcontent | thumbnail">
                  </span>
                </imagebox>
                <h3>{{med.name}}</h3>
                <span class="tips-count">

                  <em class="fW">{{med.search.total}}</em>
                  张订单待出库
                </span>
              </div>
            </div>
            <div class="row-launch">
              <table class="itable itable-td-long-text itable-thead-13px">
                <thead>
                  <tr>
                    <th class="w50">序号</th>
                    <th class="w80">采购订单</th>
                    <th class="w60">是否优先</th>
                    <th class="w100">要求到货日期</th>
                    <th class="w80">订单类型</th>
                    <th class="w80">订单状态</th>
                    <th class="w70">操作人</th>
                    <th class="w60">品规数</th>
                    <th class="w60">备注</th>
                    <th class="w160">操作</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td colspan="20" v-if="med.supplierpos==null || med.supplierpos.length==0">
                      暂无符合条件的记录
                    </td>
                  </tr>
                  <tr v-for="trpo in med.supplierpos" class="txt_v">
                    <td>{{$index+1}}</td>
                    <td class="t-left pr10">{{trpo.billno}}</td>
                    <td>{{trpo.firstflag | firstflag}}</td>
                    <td>{{trpo.planenddate | getYMD}}</td>
                    <td>{{trpo.billtype | billtype}}</td>
                    <td>{{trpo.billstate | billstate_trpo}}</td>
                    <td>{{trpo.operatername}}</td>
                    <td>{{trpo.countsum}}</td>
                    <td>{{trpo.memo}}</td>
                    <td>
                    <!--   <a v-on:click="goTRDetail(trpo.billno)" 
                        class="btn-d btn-d-activate">本次出库</a><br>
                      <a v-on:click="closeTrsupplier(trpo.billno)" 
                        v-if="'/supplier/trpo:closeTrsupplier' | myqx"
                        class="btn-d-red lh-25">关闭订单</a>   -->

                        <div class="from-button"> 
                         <a v-on:click="goTRDetail(trpo.billno)" class="green-button p-lr-10">本次出库<i>|</i></a>
                         <a v-on:click="closeTrs(trpo.billno,trpo.medname)" 
                        v-if="'/supplier/trpo:closeTrsupplier' | myqx" class="red-button p-lr-10">关闭订单</a>  
                     </div>
                    </td>
                  </tr>
                </tbody>
              </table>
              <div class="pagination page-line">
                <pagination  v-if="med.supplierpos!=null"
                   @page-change="getTrsupplierByMed($index)"
                   :page-no.sync="med.search.page"
                   :total-pages.sync="med.search.totalPages">          
                </pagination>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!--新加提示信息-->
        <div class="modal " v-show="divbgShow2">
          <div class="container resource">
            <div class="audit-detail" style="width:550px; margin:220px auto; min-height: 150px; border:0; padding: 15px 0 0px; border-radius: 2px;"> 
                <div class="sdiv-9-9b t-center text-color-gray f-size18" style="margin-left: 0; margin-right: 0; ">            
                  提示
                </div> 
                <div class="sdiv-9-9b t-center text-color-gray f-size18" style="margin-left: 0; margin-right: 0; padding-bottom: 0; height: 100px;  padding:20px 90px 0px 90px">            
                  该订单还未完成出库,关闭后将生成缺货信息,需要<b class="text-color-red">慎重操作</b>,请确认是否继续关闭!
                </div> 
                <a v-on:click="closeDialog()">
                <div class="sdiv-9-9b t-center text-color-gray f-size18" style="margin-left: 0; margin-right: 0; padding-bottom: 0; height: 50px; line-height: 50px; cursor: pointer;">            
                  取消
                </div> 
                </a>  
                 <div class="t-right text-color-gray f-size14" style="margin-left: 0; margin-right: 0; padding-bottom: 0; padding-right: 20px; height: 30px; line-height: 30px; ">    
                 <a v-on:click="closeTrsupplier()">        
                  继续
                  </a> 
                </div> 
                 
            </div>
          </div>
        </div>
        <!--新加提示信息 end-->

        <!--star 9-9 提示缺货信息列表-->
        <div class="modal " :class="backMessage2.showDialog=='Y'?'':'hide'" >  
          <div class="container resource"> 
            <div class="audit-detail ml-0 w1003">
              <span class="close-win"  v-on:click="closeDialog()"></span> 
                <div class="sdiv-9-9b no-border pb0">            
                  <p class="t-center">检测到您有<b class="text-color-yellow">{{listHZ.sl}}</b>个品种出库数量不满足订单数量,依据【{{listHZ.medname}}】医院政策,请填写缺货原因!</p>
                </div> 
              <div class="status-process wbe-0 clearfix pd20">
                <p style="color:#606f7a;font-size:14px;">
                </p> 
                <div class="sp-head sp-headb mb-0"  > 
     <div class="ctable ct-parentr mt-10" style="padding-top:0px; max-height: 350px; overflow-y: auto;">
          <div class="ct-head">
            <span class="ct-col w50">序号</span>
            <span class="ct-col w270">商品</span>
            <span class="ct-col w30"></span>
            <span class="ct-col w80 t-right">订货数</span>
            <span class="ct-col w100 t-right">本次出库数</span>
            <span class="ct-col w100 t-right">缺货</span>
            <span class="ct-col w120 t-center ml-20">请选择原因</span> 
            <span class="ct-col w120  ml-20"></span>
          </div>
          <div class="ct-row" v-for="mx in backMessage2.mList">
            <div class="row-line">
              <span class="ct-col w50  v-top">
                {{$index+1 | getIndex}} 
              </span>
              <span class="ct-col w270 t-left break-it  v-top">  
                <div class="p-lr-10 break fl  w160">
                  {{mx.supplierGoodscode}}
                  <br>
                  <span class="p-tit-green">{{mx.supplierGoodsname}}</span>
                  <br>
                  {{mx.supplierGoodsspec}}
                  <br>
                  {{mx.manufacturer}}
                  <br>{{mx.registkey}}</div>
              </span>
              <span class="ct-col w30">
                <span class="table-detail-icon icon-green"></span>
                <span class="table-detail-icon icon-green"></span>
              </span>

              <!--订货数-->
              <span class="ct-col w80 t-right  v-top">
                <span class="table-detail-text">
                  {{mx.purchaserPoqty==null ?'0':mx.purchaserPoqty}}
                  <br>{{mx.purchaserUnit}}</span>
                <span class="table-detail-text">
                  {{mx.supplierPoqty==null ?'0':mx.supplierPoqty}}
                  <br>{{mx.supplierUnit}}</span>
              </span>
              <!--本次出库数-->
              <span class="ct-col w100 t-right  v-top">
                <span class="table-detail-text">
                  {{mx.purchaserPesentqty==null ?'0':mx.purchaserPesentqty}}
                  <br>{{mx.purchaserUnit}}</span>
                <span class="table-detail-text">
                {{mx.supplierPesentqty==null ?'0':mx.supplierPesentqty}}
                  <br>{{mx.supplierUnit}}</span> 
              </span>
              <!--缺货数-->
              <span class="ct-col w100 t-right">
                <span class="table-detail-text">
                  {{mx.purchaserArrivalqty==null ?'0':mx.purchaserArrivalqty}}
                  <br>{{mx.purchaserUnit}}</span>
                <span class="table-detail-text">
                  {{mx.supplierArrivalqty==null ?'0':mx.supplierArrivalqty}}
                  <br>{{mx.supplierUnit}}</span>
              </span>
              <!-- 缺货原因 -->
              <span class="ct-col w120 t-right  ml-20">
                    <select v-model="mx.memo" @change="selectname($index,mx.memo)">   
                      <option v-for="option in shortageselectlist" v-bind:value="option.datavalue">
                        {{option.dataintroduction}}
                      </option>
                    </select>
              </span>
              <span class="ct-col w120 t-right  ml-20">
              <input type="text" class="edit-number" v-show="sh[$index]"  v-model="mx.varchar1"> 
              </span> 
            </div>

             
          </div>
        </div>
                  <div class="w240" style="margin:0 auto;">
                  <button class="btn button-green fl mt-15" v-on:click="closeDialog()">取 消</button>
                  <button class="btn button-green fr mt-15" v-on:click="commitOsList()">提 交</button>
                  </div>
                </div> 
              </div> 

            </div>
          </div>
        </div>
        <!--star 9-9 受理弹出-->
</template>
<!--供应商端 - 出库登录页面-->
<script>

  module.exports = {
    data: function () {
      return {
        // 明细数据
        medList: [],
        // 订单总数量
        totalNum:0,
        divbgShow2:false,
        billno:'',
        backMessage2:{
            showDialog:'N',
            mList:[],// 提示信息
          },
          listHZ:{
            sl:'',
            medname:'',
            }, 
            sh:[],
            TrsupplierDoListVO:{
          billno:'',
          trsupplierosList:[],
        },
            medname:'',
          shortageselectlist:[],
        // 查询条件
        search: {
          billstate:this.ctns.pobillstatep03, 
          page:50
        },
      };
    },
    methods: {
      // 获取数据
      getData:function(){
        var self = this;
        self.totalNum = 0;
        Ajax.get('/trpo/listMed', this.search)
          .then(function (response){
            var data = response.data.data;
            self.$set('medList',data);


            // 循环加载明细
            for(var index=0;index<self.medList.length;index++){
              // 查看医院的采购订单
              self.getTrsupplierByMed(index);
            }

        })
      },
      // 医院的采购订单
      getTrsupplierByMed:function(index){
        var self = this;
        var medObj = self.medList[index];
        var medguid = medObj.guid;
        if(medObj.search==null){
          // 设置每组的查询条件
          medObj.search = {
            search_EQ_billstate:this.ctns.pobillstatep03,
            search_EQ_medguid:medguid,
            pageSize:50,
            page: 1,
            totalPages: 0,
          };
        }
        Ajax.get('/trpo/listTrsupplier', medObj.search)
          .then(function (response){
            var data = response.data;
            if(data.errorCode==0){ 
              self.$set('medList['+index+'].supplierpos',data.data.list);  
              medObj.search.pageno = data.data.pageno;
              medObj.search.totalPages = data.data.totalPages;
              medObj.search.total = data.data.total;
              self.$set('medList['+index+'].search',medObj.search);
              // 总计数量
              // self.$set('totalNum',data.data.total);
              self.calNum();
            }else{
              return ;
            }
        });
      },
        // 计算总的明细数目
        calNum: function() {
            var self = this,sum = 0,flag = true;
            self.totalNum = 0;
            for(var index = 0; index < self.medList.length; index++) {
                var item = this.medList[index];
                //存在没有值的情况
                if(!(item && item.search && item.search.total)){
                    flag = false;
                }
            }
            for(var index = 0; index < self.medList.length; index++) {
                if(flag){
                    sum += this.medList[index].search.total;
                }
            }
            self.$set('totalNum', sum);
        },
      //缺货原因
      selectname:function(index,memo){
        var self = this;   
        if(memo=="OS8"){
          self.sh.splice(index,1,true); 
        }else{
         self.sh.splice(index,1,false);
        }  
      },
      // 跳转到订单受理详情页面
      goTRDetail:function(billno){
        var self = this;
        self.$route.router.go('/trpo/orderOutlog2/'+billno);
        // 未提交    billtype==self.ctns.billtype02 暂时注释   判断单据类型为高值
          // if(billtype=='02' && (billno!=null || billno!='') || billtype=='03' && (billno!=null || billno!='')){
          //   //进入高值页面 未提交页面
          //   self.$route.router.go('/trdo/orderOutall2-3/'+((billno||'')+"@"+(billno||'')));
          // }else{
          //   //进入非高值页面 未提交页面
          //   self.$route.router.go('/trpo/orderOutlog2/'+billno); 
          // }
      },
        // 关闭订单
      closeTrs:function(billno,medname){
        var self = this;
        self.medname = medname; 
        self.divbgShow2 = true;
        self.billno = billno;
      },
      // 关闭信息提示弹出框
        closeDialog:function(){
          var self = this; 
          self.divbgShow2 = false;
          this.$set('backMessage2.showDialog','N'); 
          this.$set('backMessage2.mList',[]);   
        },
      // 关闭订单 
      closeTrsupplier:function(){
        var self = this;
        self.MessageBox({
          title: '提示',
          message: "您确认要关闭订单吗?",
          type: 'success',
          showCancelButton: true
        },function(action) {
          if(action=='confirm'){
            Ajax.get('/trpo/closeTrsupplier', {billno:self.billno})
              .then(function (response) {
                var data = response.data.data;  
                if(response.data.errorCode==0){  
                  if(data.split("@")[0]=="1"){// 删除成功的情况 
                      self.MessageBox({title:'提示', message:'采购单不存在!', type: 'alert'},function(action){
                          self.closeDialog();
                       });
                  }else if(data.split("@")[0]=="-1"){ 
                      self.MessageBox({title:'提示', message:'已生成出库单,无法关闭采购单!', type: 'alert'},function(action){
                          self.closeDialog();
                       });
                  }else if(data.split("@")[0]=="-2"){ 
                      //未生成出库单,关闭订单给医院发消息
                       self.sendcloseMsg();
                  }else if(data.split("@")[0]=="-3"){
                    //未生成出库单,将采购单走缺货发给医院
                        self.divbgShow2 = false;
                        self.$set('backMessage2.showDialog','Y');   
                        self.closeTrsupplierList();
                        self.listostypelist();
                  }else{
                    // 提交出库单失败!
                    layer.msg('删除失败!');
                  }                    
                }else{
                  layer.msg('操作异常!');
                }
            });
            return ;
          } else{
              self.divbgShow2 = false;
          } 
        }); 
      },
       sendcloseMsg:function(){
        var self = this;    
        var billno = self.billno;
        Ajax.get('/trpo/sendcloseMsg/'+billno) 
          .then(function (response){   
          window.location.reload();
        }) 
      },   
      closeTrsupplierList:function(){
        var self = this;    
        var billno = self.billno;
        Ajax.get('/trpo/listsupplieros/'+billno) 
          .then(function (response){  
            var data = response.data.data; 
            if(response.data.errorCode == 0){   
                self.$set('backMessage2.mList',data);     
                self.listHZ.sl = self.backMessage2.mList.length;
                self.listHZ.medname = self.medname;
                for (var i = 0; i<self.backMessage2.mList.length;i++) {
                    self.sh.push(false);
                }
            }else{   
              layer.msg(response.data.message);
            } 
        }) 
      },   
      // 提交
      commitOsList:function(){
        var self = this; 
        self.TrsupplierDoListVO.billno = self.billno; 
        for (var i = 0;  i < self.backMessage2.mList.length; i++) { 
              if(self.backMessage2.mList[i].memo==null || self.backMessage2.mList[i].memo==""){
                  layer.msg("请填写缺货原因!");
                  return;
              }
        }
        self.$set('TrsupplierDoListVO.trsupplierosList', self.backMessage2.mList);
        // 出库信息 立继武  
          Ajax.post('/trpo/commitOsList', self.TrsupplierDoListVO)
          .then(function (response){ 
            var data = response.data.data; 
            if(response.data.errorCode==0){   
              if(data.split("@")[0]=="1"){// 删除成功的情况  
                    self.MessageBox({
                          title:'提示',
                          message:'将这'+self.listHZ.sl+'个品种缺货信息通知给医院!',
                          type:'alert',
                          showCancelButton: true
                        },function(action){  
                          if(action == 'cancel'){ 
                               self.closeDialog();
                               window.location.reload();
                          }else{ 
                              var billno = self.billno;
                              Ajax.get('/trdo/sendOsMsg/'+billno)
                                .then(function (response){ 
                                  self.closeDialog();
                                  window.location.reload();
                                })
                            }
                        });        
                    
                  }else{
                    layer.msg(data.message);
                  }    
               }else{
                layer.msg(data.message);
               }   
        })  
      },
      listostypelist:function(){
        var self = this;     
        Ajax.get('/trdo/listostype') 
          .then(function (response){  
            var data = response.data.data; 
            if(response.data.errorCode == 0){   
                self.$set('shortageselectlist',data);    
            }else{   
              layer.msg(response.data.message);
            } 
        })
      },


    },
    route: {
      activate: function () {
        this.getData();
      }
    }
  };
</script>