picking-confirm-detail.vue 14.3 KB
<template>
    <div class="container resource close-left-menu warp">

        <div class="pop-banner clearfix">
            <div class="operate-btns">
                <a @click="updTrmeddeptdo" class="fbtn fb-submit ml-10 mr-10" v-show="list[0].billstate=='YC1'">出库确认</a>
                <a @click="delTrmeddeptdo" class="fbtn fb-del" v-show="list[0].billstate=='YC1'">撤销</a>
            </div>
            <h3 class="current-module">拣货确认</h3>
        </div>

        <!--purchase-storage start-->
        <div class="purchase-storage">
            <div class="pd-form mb-40">
                <div class="group-row group-row-3">
                    <div class="form-group form-label">
                        <label for="cn1" class="label">单据单号</label>
                        <div class="control">
                            <input type="text" id='cn1' readonly="readonly" v-model="list[0].slbillno" class="inp4">
                        </div>
                    </div>
                    <div class="form-group form-label">
                        <label class="label" for='cn3'>申领日期</label>
                        <div class="control">
                            <input type="text" id='cn3' readonly="readonly" v-model="list[0].applydate|getYMD " class="inp4">
                        </div>
                    </div>
                    <div class="form-group form-label">
                        <label class="label" for='cn2'>销售单号</label>
                        <div class="control">
                            <input type="text" id='cn2' readonly="readonly" v-model="list[0].ckbillno" class="inp4">
                        </div>
                    </div>
                </div>
                <div class="group-row group-row-3">
                    <div class="form-group form-label">
                        <label for="cn4" class="label">执行状态</label>
                        <div class="control">
                            <input type="text" id='cn4' readonly="readonly" v-bind:value="list[0].billstate|ckstate" class="inp4">
                        </div>
                    </div>
                    <div class="form-group form-label">
                        <label class="label" for='cn5'>出库库房</label>
                        <div class="control">
                            <input type="text" id='cn5' readonly="readonly" v-model="list[0].medstorename" class="inp4">
                        </div>
                    </div>
                    <div class="form-group form-label">
                        <label class="label" for='cn6'>申领科室</label>
                        <div class="control">
                            <input type="text" id='cn6' readonly="readonly" v-model="list[0].meddeptname" class="inp4">
                        </div>
                    </div>
                </div>
                <div class="group-row group-row-3">
                    <div class="form-group form-label">
                        <label for="cn7" class="label">申领人</label>
                        <div class="control">
                            <input type="text" id="cn7" v-model="list[0].slr" readonly="readonly" class="inp3">
                        </div>
                    </div>
                    <div class="form-group form-label">
                        <label class="label" for="cn10">出库日期</label>
                        <div class="control">
                            <input type="text" id="cn10" v-model="list[0].ckdate|getYMD" readonly="readonly" class="inp4">
                        </div>
                    </div>

                    <div class="form-group form-label">
                        <label class="label">拣货员</label>
                        <div class="control">
                            <input type="text" v-model="list[0].jhy" readonly="readonly" class="inp3">
                        </div>
                    </div>

                </div>
                <div class="form-group form-label">
                    <label class="label">备注</label>
                    <div class="control">
                        <textarea id="cn9" readonly v-model="list[0].memo" class="inp2"></textarea>
                    </div>
                </div>
            </div>

            <table class="itable">
                <thead>
                <tr>
                    <th class="w70">序号</th>
                    <th class="w130">商品</th>
                    <th class="w80">出库单位</th>
                    <th class="w80">单价(元)</th>
                    <th class="w80">单位</th>
                    <th class="w80">分配数</th>
                    <th class="w80">拣货数</th>
                    <th class="w80">金额(元)</th>
                    <th class="w100">批号</th>
                    <th class="w100">批次号</th>
                    <th class="w100">有效期</th>
                </tr>
                </thead>
                <tbody class="txt_v">
                <tr v-if="list==null || list.length==0">
                    <td colspan="11">暂无符合条件的记录</td>
                </tr>
                <tr v-for="item in list" v-else>
                    <td class="w30 v-top">{{$index+1}}</td>
                    <td class="t-left v-top">{{item.goodscode}}<br><span class="text-color-blue">{{item.goodsname}}</span><br>{{item.goodsspec}}<br>{{item.producer}}<br>{{item.registkey}}</td>
                    <td class="v-top">{{item.medstorename}}</td>
                    <td class="v-top  t-right">{{item.taxprice | numDigit 2 | numFmt}}</td>
                    <td class="v-top">{{item.unit}}</td>
                    <td class="v-top">{{item.assignedqty}}</td>
                    <td class="v-top">
                        <input type="number" class="t-right" :value="item.outboundqty" disabled="disabled" v-if="list[0].billstate!='YC1'" />
                        <input type="number" class="t-right" v-model="item.outboundqty" @input="checkInfo(item.outboundqty,item.assignedqty,$index)" :value="item.assignedqty" v-else/>
                    </td>
                    <td class="v-top t-right">{{item.outboundqty * item.taxprice | numDigit 2 | numFmt}}</td>
                    <td class="v-top">{{item.lot}}</td>
                    <td class="t-left v-top">{{item.stockbatch}}</td>
                    <td class="v-top">
                        <span class="text-color-yellow" v-if="sh[$index]">{{item.expiredate|getYMD}}</span>
                        <span v-else>{{item.expiredate|getYMD}}</span>
                    </td>

                </tr>
                </tbody>
            </table>
            <pagination @page-change="getData" :class="['m-20-0']" :page-no.sync="search.page" :total-pages.sync="search.totalPages">
            </pagination>

        </div>
        <!-- 保存正在加载弹框 -->
        <div class="roll-bg" v-show='requestS'>
            <div class="w60" style="margin:0 auto;">
                <img src="/images/roll.gif">
            </div>
            <div class="container resource t-center text-color-red">
                正在处理中,请勿关闭!
            </div>
        </div>
        <!--purchase-storage end-->

    </div>
</template>
<style type="text/css" scoped="scoped">
    .warp {
        min-height: calc(100vh - 240px);
    }

    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none !important;
    }

    input[type="number"] {
        -moz-appearance: textfield;
    }
</style>
<script>
    module.exports = {
        data: function() {
            return {
                requestS:false,
                list: {},
                search: {
                    page: 1,
                    totalPages: 1,
                    pageSize: 50,
                    'guid': this.$route.params.guid,
                    'ckbillno': this.$route.params.ckbillno,
                },
                sh:[],
                showMsg:false,
            };
        },
        methods: {
            getData: function() {
                var self = this;
                //医院入库单明细列表
                Ajax.post('/procurment/stockGetApplyDetailList', self.search).
                then(function(response) {
                    if(response.data.errorCode == 0) {
                        var res = response.data.data;
                        var list = res.list;
                        self.$set('list', res.list);
                        self.search.totalPages = res.totalPages;
                        self.search.page = res.pageNo;

                        self.sh = [];
                        for(var a=0;a<res.list.length;a++){
                            self.sh.push(false);
                            var date1 = new Date();
                            var date2 = new Date(date1);
                            date2.setMonth(date1.getMonth()+6);
                            var times = date2.getFullYear()+"-"+(date2.getMonth()+1)+"-"+date2.getDate();

                            var mxListss = res.list[a];
                            //有效期
                            var mxLists = mxListss.expiredate;
                            var da1 = mxLists.replace(/\-/gi,"/");
                            var da2 = times.replace(/\-/gi,"/");
                            var time1 = new Date(da1).getTime();
                            var time2 = new Date(da2).getTime();
                            if(time1 <= time2){
                                self.sh.splice(a,1,true);
                            }
                        }
                    } else {
                        self.MessageBox({
                            title: '提示',
                            message: response.data.message,
                            type: 'alert'
                        }, function(action) {});
                    }
                })
            },
            updTrmeddeptdo: function() {
                var self = this;
                var param = {
                    'guid': this.$route.params.guid,
                    'ckbillno': this.$route.params.ckbillno,
                    'slbillno': this.list[0].slbillno,
                    'slguid': this.list[0].slguid,
                    'cklist': this.list,
                }
                for(let i = 0; i < this.list.length; i++) {
                    if(!this.list[i].outboundqty) {
                        self.MessageBox({
                            title: '提示',
                            message:'请输入拣货数',
                            type: 'alert'
                        }, function(action) {});
                        return;
                    }
                }
                self.requestS=true;
                Ajax.post('/procurment/updTrmeddeptdo', param).
                then(function(response) {
                    self.requestS=false;
                    if(response.data.errorCode == 0) {
                        self.MessageBox({
                            title: '提示',
                            message: '出库成功',
                            type: 'alert'
                        }, function(action) {
                            self.$router.go({
                                'path': '/pickingConfirm'
                            });

                        });
                    } else {
                        self.MessageBox({
                            title: '提示',
                            message: response.data.message,
                            type: 'alert'
                        }, function(action) {});
                    }
                })
            },
            //撤销
            delTrmeddeptdo: function() {
                var self = this;
                var param = {
                    'guid': this.$route.params.guid,
                    'ckbillno': this.$route.params.ckbillno,
                    'slbillno': this.list[0].slbillno,
                    'slguid': this.list[0].slguid,
                    'cklist': this.list,
                }
                self.MessageBox({
                    title: '提示',
                    message: "您确定要撤销该单据?",
                    type: 'success',
                    showCancelButton: true
                },function(action) {
                    if(action=='confirm'){
                        self.requestS=true;
                        Ajax.post('/procurment/cancelDeptApplyDo', param).
                        then(function(response) {
                            self.requestS=false;
                            if(response.data.errorCode == 0) {
                                self.MessageBox({
                                    title: '提示',
                                    message: '撤销成功',
                                    type: 'alert'
                                }, function(action) {
                                    self.$router.go({
                                        'path': '/pickingConfirm'
                                    });

                                });
                            } else {
                                self.MessageBox({
                                    title: '提示',
                                    message: response.data.message,
                                    type: 'alert'
                                }, function(action) {});
                            }
                        })
                    }
                });
            },

            checkInfo: function(curent, max, ind) {
                var self=this;
                if(curent > max || curent < 0) {
                    if (self.showMsg){
                        return;
                    }
                    self.showMsg = true;
                    this.MessageBox({
                        title: '提示',
                        message: '请输入大于0小于可分配数的正整数',
                        type: 'alert'
                    }, function(action) {
                        self.showMsg = false;
                        self.list[ind].outboundqty = '';

                    });
                }

            }
        },
        route: {
            activate: function() {
                var self = this;
                this.$set('search.guid', this.$route.params.guid);
                this.$set('search.ckbillno', this.$route.params.ckbillno);
                this.$set('list', '');
                this.getData();
            },
        }
    }
</script>