pickup_print.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="detail-container">
  3. <div class="top-container">
  4. <el-radio-group v-model="currentType" size="medium" @change="changeType()">
  5. <el-radio-button v-for="(item, index) in typeList" :key="index" :label="item.value">{{item.label}}</el-radio-button>
  6. </el-radio-group>
  7. </div>
  8. <div id="printMe">
  9. <PrintFoshan :detailData="detailData" v-if="currentType === 1" />
  10. <PrintGuangzhou :detailData="detailData" v-if="currentType === 2" />
  11. </div>
  12. <div class="page-footer">
  13. <div class="footer">
  14. <el-button type="primary" icon="el-icon-printer" v-print="printObj">打 印</el-button>
  15. <el-button @click="goBack">关 闭</el-button>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import print from 'vue-print-nb'
  22. import { getDetail, addPrint } from "@/api/supply/pickup";
  23. import PrintFoshan from "@/components/Common/print-foshan";
  24. import PrintGuangzhou from "@/components/Common/print-guangzhou";
  25. export default {
  26. name: 'ReturnDetail',
  27. componentName: 'ReturnDetail',
  28. props: ['listItem'],
  29. components: {
  30. PrintFoshan,
  31. PrintGuangzhou,
  32. },
  33. directives: {
  34. print
  35. },
  36. data() {
  37. return {
  38. currentType: 1,
  39. typeList: [
  40. { label: '佛山', value: 1 },
  41. { label: '广州', value: 2 },
  42. { label: '韶关', value: 3 },
  43. ],
  44. printObj: {
  45. id: 'printMe',
  46. closeCallback: () => {
  47. this.addPrint();
  48. }
  49. },
  50. detailData: {},
  51. }
  52. },
  53. created() {
  54. this.getDetail();
  55. },
  56. methods: {
  57. // 返回列表
  58. goBack() {
  59. this.$emit('backListFormDetail');
  60. },
  61. changeType() {
  62. },
  63. // 获取详情
  64. getDetail() {
  65. getDetail({id: this.listItem[0].id}).then(res => {
  66. this.detailData = res.data;
  67. })
  68. },
  69. // 添加次数
  70. addPrint() {
  71. let ids = this.listItem.map(item => {
  72. return item.invoiceOrderId;
  73. });
  74. addPrint({ids: ids.join(',')}).then(res => {
  75. // this.$successMsg('提交成功');
  76. this.$parent.getList();
  77. })
  78. }
  79. }
  80. }
  81. </script>
  82. <style scoped lang="scss">
  83. .detail-container {
  84. width: 100%;
  85. height: 100%;
  86. }
  87. .top-container {
  88. margin-bottom: 20px;
  89. }
  90. </style>