detail.vue 13 KB

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