info.vue 2.41 KB
<template>
   <layout-body>
          <div class="order-info">
              <div>物流单号:<span>{{id}}</span> 发货时间:<span>{{sendTime || '-'}}</span></div>
              <div>发往:<span>{{storeroomName || '-'}} &nbsp;{{address || '-'}} &nbsp;{{adminName || '-'}} </span></div>
          </div>

       <layout-action>
           <Button type="primary" @click="print">打印</Button>
           <Button @click="back">返回入库物流列表</Button>
       </layout-action>

      <layout-list>
         <Table border :columns="tableCols" :data="tableData"></Table>
      </layout-list>

   </layout-body>
</template>

<script>
    import ExpressService from 'services/repository/express-service';
    import moment from 'moment';
    import _ from 'lodash';
    import {info} from './store';

    export default {
        props: ['id'],
        created() {
            this.expressService = new ExpressService();
        },
        data() {
            return info.call(this);
        },
        mounted() {
            this.id = this.$route.params.id;
            this.time = this.$route.query.time;
            this.getExpress(this.id);
        },
        computed: {
            sendTime() {
                return moment.unix(this.time).format('YYYY-MM-DD HH:mm:ss');
            }
        },
        methods: {
            getExpress(id) {
                return this.expressService.show({expressNumber: id}).then((result) => {
                    if (result.code === 200) {
                        this.tableData = result.data;
                        this.storeroomName = _.first(this.tableData || {}).storeroomName;
                        this.address = _.first(this.tableData || {}).address;
                        this.adminName = _.first(this.tableData || {}).adminName;
                    }
                });
            },
            back() {
                this.$router.push({
                    name: 'repository.express.list'
                });
            },
            print() {
                const href = `/trade/printDetail.html?expressNo=${this.id}`;

                window.open(href, '_blank');
            }

        }
    };
</script>

<style lang="scss" scoped>
.order-info {
    div {
        display: block;
        margin-bottom: 10px;
    }

    span {
        padding: 5px;
        color: #f00;
        background-color: #f9f3f5;
        border-radius: 2px;
        margin-right: 5px;
    }
}
</style>