detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div class="purchaseOrderDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="purchaseOrderDetail-cont" >
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="purchaseOrderDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. <span class="billno">单号:{{ detail&&detail.purchaseBillNo }}</span>
  8. <a-tag color="blue">{{ detail&&detail.billStatusDictValue }}</a-tag>
  9. <a-tag color="orange">{{ detail&&detail.financialStatusDictValue }}</a-tag>
  10. </template>
  11. <!-- 操作区,位于 title 行的行尾 -->
  12. <template slot="extra">
  13. <a-radio-group key="3" v-model="printerType">
  14. <a-radio value="INK">针式</a-radio>
  15. <a-radio value="NEEDLE">喷墨</a-radio>
  16. </a-radio-group>
  17. <a-button key="2" id="purchaseOrderDetail-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
  18. <a-button key="1" type="primary" id="purchaseOrderDetail-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
  19. </template>
  20. </a-page-header>
  21. <!-- 基础信息 -->
  22. <a-card size="small" :bordered="false" class="purchaseOrderDetail-cont">
  23. <a-collapse :activeKey="['1']">
  24. <a-collapse-panel key="1" header="基础信息">
  25. <a-descriptions :column="3">
  26. <a-descriptions-item label="供应商">{{ (detail&&detail.dealerName) || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="支付方式">{{ detail&&detail.settleStyleEntity.name }}</a-descriptions-item>
  28. <a-descriptions-item label="采购员工">{{ detail&&detail.operatorName }}</a-descriptions-item>
  29. <a-descriptions-item label="收货人">{{ detail&&detail.consigneeName }}<span v-if="detail&&detail.consigneeTel">({{ detail&&detail.consigneeTel }})</span></a-descriptions-item>
  30. <a-descriptions-item label="收货地址">
  31. {{ detail&&detail.shippingAddressProvinceName }}
  32. {{ detail&&detail.shippingAddressCityName }}
  33. {{ detail&&detail.shippingAddressCountyName }}
  34. {{ detail&&detail.shippingAddress }}
  35. </a-descriptions-item>
  36. </a-descriptions>
  37. </a-collapse-panel>
  38. </a-collapse>
  39. </a-card>
  40. <!-- 产品详情 -->
  41. <a-card size="small" :bordered="false" class="purchaseOrderDetail-cont">
  42. <a-collapse :activeKey="['1']">
  43. <a-collapse-panel key="1" header="产品详情">
  44. <!-- 总计 -->
  45. <a-alert type="info" showIcon style="margin-bottom:15px">
  46. <div slot="message">
  47. 产品款数:<strong>{{ detail ? ((detail.totalCategory || detail.totalCategory==0) ? detail.totalCategory : '--') : '--' }}</strong>,
  48. 采购数量合计:<strong>{{ detail ? ((detail.totalQty || detail.totalQty==0) ? detail.totalQty : '--') : '--' }}</strong>,
  49. 已收货数量:<strong>{{ detail ? ((detail.totalPutQty || detail.totalPutQty==0) ? detail.totalPutQty : '--') : '--' }}</strong>,
  50. 待收货数量:<strong>{{ detail ? ((detail.totalWaitPutQty || detail.totalWaitPutQty==0) ? detail.totalWaitPutQty : '--') : '--' }}</strong>,
  51. 取消数量:<strong>{{ detail ? ((detail.totalCancelQty || detail.totalCancelQty==0) ? detail.totalCancelQty : '--') : '--' }}</strong>,
  52. 采购金额合计:¥<strong>{{ detail ? ((detail.discountedAmount || detail.discountedAmount==0) ? detail.discountedAmount : '--') : '--' }}</strong>,
  53. 已收货金额:¥<strong>{{ detail ? ((detail.totalPutAmount || detail.totalPutAmount==0) ? detail.totalPutAmount : '--') : '--' }}</strong>,
  54. 待收货金额:¥<strong>{{ detail ? ((detail.totalWaitPutAmount || detail.totalWaitPutAmount==0) ? detail.totalWaitPutAmount : '--') : '--' }}</strong>,
  55. 取消金额:¥<strong>{{ detail ? ((detail.totalCancelAmount || detail.totalCancelAmount==0) ? detail.totalCancelAmount : '--') : '--' }}</strong>
  56. </div>
  57. </a-alert>
  58. <!-- 列表 -->
  59. <s-table
  60. class="sTable"
  61. ref="table"
  62. size="small"
  63. :rowKey="(record) => record.id"
  64. :columns="columns"
  65. :data="loadData"
  66. :scroll="{ x: 1480 }"
  67. bordered>
  68. <!-- 采购数量 -->
  69. <template slot="origqty" slot-scope="text, record">
  70. <div>{{ text }}</div>
  71. <div v-if="record.origqty">原采购数量:{{ record.origqty }}</div>
  72. </template>
  73. <!-- 缺货数量 -->
  74. <template slot="outOfStockNum" slot-scope="text, record">
  75. <span>{{ record.outOfStockNum }}</span>
  76. </template>
  77. </s-table>
  78. </a-collapse-panel>
  79. </a-collapse>
  80. </a-card>
  81. <!-- 促销品详情 -->
  82. <a-card size="small" v-if="false" :bordered="false" class="purchaseOrderDetail-cont">
  83. <a-collapse :activeKey="['1']">
  84. <a-collapse-panel key="1" header="促销品详情">
  85. <!-- 总计 -->
  86. <a-alert type="info" showIcon style="margin-bottom:15px">
  87. <div slot="message">产品款数 <strong>{{ detail&&detail.totalCategory }}</strong> ,
  88. 采购数量合计 <strong>{{ detail&&detail.totalQty }}</strong> ,
  89. 采购金额合计¥<strong>{{ detail&&detail.totalAmount }}</strong></div>
  90. </a-alert>
  91. <!-- 列表 -->
  92. <s-table
  93. class="sTable"
  94. ref="table-1"
  95. size="small"
  96. :rowKey="(record) => record.id"
  97. :columns="columns"
  98. :data="loadData"
  99. :scroll="{ x: 1060 }"
  100. bordered>
  101. <!-- 采购数量 -->
  102. <template slot="origqty" slot-scope="text, record">
  103. <div>{{ text }}</div>
  104. <div v-if="record.origqty">原采购数量:{{ record.origqty }}</div>
  105. </template>
  106. <!-- 缺货数量 -->
  107. <template slot="outOfStockNum" slot-scope="text, record">
  108. <span>{{ record.outOfStockNum }}</span>
  109. </template>
  110. </s-table>
  111. </a-collapse-panel>
  112. </a-collapse>
  113. </a-card>
  114. <!-- 单据记录 -->
  115. <a-card size="small" v-show="false" :bordered="false" class="purchaseOrderDetail-cont">
  116. <a-collapse :activeKey="['1']">
  117. <a-collapse-panel key="1" header="单据记录">
  118. <a-timeline class="timeline-box">
  119. <a-timeline-item>2021-02-01 15:22:38 王凯 审核通过</a-timeline-item>
  120. <a-timeline-item>
  121. <p>2021-02-01 15:22:38 王凯 审核通过</p>
  122. <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
  123. <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
  124. </a-timeline-item>
  125. <a-timeline-item>Technical testing 2015-09-01</a-timeline-item>
  126. <a-timeline-item>Network problems being solved 2015-09-01</a-timeline-item>
  127. </a-timeline>
  128. </a-collapse-panel>
  129. </a-collapse>
  130. </a-card>
  131. <!-- 打印 -->
  132. <div id="print"></div>
  133. </div>
  134. </template>
  135. <script>
  136. import { STable, VSelect } from '@/components'
  137. import { purchaseDetailBySn, purchaseDetailPrint } from '@/api/purchase'
  138. import { purchaseDetailList } from '@/api/purchaseDetail'
  139. export default {
  140. components: { STable, VSelect },
  141. data () {
  142. return {
  143. // 表头
  144. columns: [
  145. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  146. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  147. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
  148. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 220, align: 'center', customRender: function (text) { return text = ' ' ? '--' : text } },
  149. { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  150. { title: '采购单价', dataIndex: 'discountedPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  151. { title: '采购金额', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? '¥' + text : '--') } },
  152. { title: '采购数量', dataIndex: 'qty', width: 100, align: 'center', scopedSlots: { customRender: 'origqty' } },
  153. { title: '取消数量', dataIndex: 'cancelQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  154. { title: '已收货数量', dataIndex: 'putQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  155. { title: '待收货数量', dataIndex: 'waitPutQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  156. ],
  157. // 加载数据方法 必须为 Promise 对象
  158. loadData: parameter => {
  159. this.disabled = true
  160. return purchaseDetailList(Object.assign(parameter, { purchaseBillSn: this.$route.params.sn })).then(res => {
  161. const data = res.data
  162. const no = (data.pageNo - 1) * data.pageSize
  163. for (var i = 0; i < data.list.length; i++) {
  164. data.list[i].no = no + i + 1
  165. }
  166. this.localDataSource = data.list
  167. this.disabled = false
  168. return data
  169. })
  170. },
  171. detail: null, // 详情数据
  172. localDataSource: [],
  173. printerType: 'INK' // 打印机类型
  174. }
  175. },
  176. methods: {
  177. // 返回列表
  178. handleBack () {
  179. this.$router.push({ path: '/purchasingManagement/purchaseOrder/list' })
  180. },
  181. // 详情
  182. getDetail () {
  183. purchaseDetailBySn({ sn: this.$route.params.sn }).then(res => {
  184. if (res.status == 200) {
  185. this.detail = res.data
  186. } else {
  187. this.detail = null
  188. }
  189. })
  190. },
  191. // 打印预览/快捷打印
  192. handlePrint (type) {
  193. const _this = this
  194. purchaseDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
  195. if (res.type == 'application/json') {
  196. var reader = new FileReader()
  197. reader.addEventListener('loadend', function () {
  198. const obj = JSON.parse(reader.result)
  199. _this.$notification.error({
  200. message: '提示',
  201. description: obj.message
  202. })
  203. })
  204. reader.readAsText(res)
  205. } else {
  206. this.print(res, type)
  207. }
  208. })
  209. },
  210. print (data, type) {
  211. if (!data) {
  212. return
  213. }
  214. const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
  215. document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>'
  216. if (type == 'preview') { // 预览
  217. window.open(url)
  218. } else if (type == 'print') { // 打印
  219. window.frames['printf'].focus()
  220. window.frames['printf'].print()
  221. }
  222. }
  223. },
  224. mounted () {
  225. this.getDetail()
  226. }
  227. }
  228. </script>
  229. <style lang="less">
  230. .purchaseOrderDetail-cont{
  231. margin-bottom: 15px;
  232. .timeline-box{
  233. margin-top: 30px;
  234. .auxiliary-txt{
  235. color: #808695;
  236. }
  237. }
  238. }
  239. .purchaseOrderDetail-wrap{
  240. .billno{
  241. font-size: 16px;
  242. font-weight: bold;
  243. margin: 0 15px;
  244. }
  245. }
  246. </style>