detail.vue 14 KB

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