stockOrderDetail.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div class="signWarehousingDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="signWarehousingDetail-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="signWarehousingDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span class="billno">
  9. 单号:{{ detail&&detail.purchaseBillNo }}
  10. <span v-if="detail&&detail.sendBillNo">(发货单号:{{ detail&&detail.sendBillNo || '--' }})</span>
  11. </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. type="primary"
  19. class="button-warning"
  20. v-if="$hasPermissions('B_signWarehousingExport')"
  21. id="signWarehousingDetail-export-btn"
  22. :disabled="localDataSource.length==0"
  23. @click="handleExportProduct()">导出Excel</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.purchaseBill&&detail.purchaseBill.settleStyleEntity&&detail.purchaseBill.settleStyleEntity.name) || '--' }}</a-descriptions-item>
  33. <a-descriptions-item label="采购员工" v-if="detail&&detail.purchaseBill&&detail.purchaseBill.purchaseBillSource=='PURCHASE'">{{ detail&&detail.purchaseBill&&detail.purchaseBill.operatorName || '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="收货人">{{ detail&&detail.purchaseBill&&detail.purchaseBill.consigneeName || '--' }}<span v-if="detail&&detail.purchaseBill&&detail.purchaseBill.consigneeTel">({{ detail&&detail.purchaseBill&&detail.purchaseBill.consigneeTel }})</span></a-descriptions-item>
  35. <a-descriptions-item label="收货地址">
  36. <div v-if="detail&&detail.purchaseBill&&(detail.purchaseBill.shippingAddressProvinceName || detail.purchaseBill.shippingAddressCityName || detail.purchaseBill.shippingAddressCountyName || detail.purchaseBill.shippingAddress)">
  37. {{ detail&&detail.purchaseBill&&detail.purchaseBill.shippingAddressProvinceName || '' }}
  38. {{ detail&&detail.purchaseBill&&detail.purchaseBill.shippingAddressCityName || '' }}
  39. {{ detail&&detail.purchaseBill&&detail.purchaseBill.shippingAddressCountyName || '' }}
  40. {{ detail&&detail.purchaseBill&&detail.purchaseBill.shippingAddress || '' }}
  41. </div>
  42. <span v-else>--</span>
  43. </a-descriptions-item>
  44. </a-descriptions>
  45. </a-collapse-panel>
  46. </a-collapse>
  47. </a-card>
  48. <a-card size="small" :bordered="false" class="signWarehousingDetail-cont">
  49. <!-- 总计 -->
  50. <a-alert type="info" style="margin-bottom:10px">
  51. <div slot="message">
  52. 产品款数:<strong>{{ detail && (detail.totalPutCategory || detail.totalPutCategory==0) ? detail.totalPutCategory : '--' }}</strong>,
  53. 本次发货数量合计:<strong>{{ detail && (detail.totalPutQty || detail.totalPutQty==0) ? detail.totalPutQty : '--' }}</strong>,
  54. 本次发货金额合计:<strong>{{ detail && (detail.totalPutAmount || detail.totalPutAmount==0) ? '¥'+detail.totalPutAmount : '--' }}</strong>,
  55. </div>
  56. </a-alert>
  57. <!-- 列表 -->
  58. <s-table
  59. class="sTable"
  60. ref="table"
  61. size="small"
  62. :rowKey="(record) => record.id"
  63. :columns="columns"
  64. :data="loadData"
  65. :defaultLoadData="false"
  66. bordered>
  67. <!-- 采购数量 -->
  68. <template slot="qty" slot-scope="text, record">
  69. <div>{{ record.qty }}</div>
  70. </template>
  71. <!-- 缺货数量 -->
  72. <template slot="outOfStockNum" slot-scope="text, record">
  73. <span>{{ record.outOfStockNum }}</span>
  74. </template>
  75. </s-table>
  76. </a-card>
  77. </a-spin>
  78. </div>
  79. </template>
  80. <script>
  81. import moment from 'moment'
  82. import { STable, VSelect } from '@/components'
  83. import { purchaseDetailPrint, purchaseDetailExport, purchaseExportDetail } from '@/api/purchase'
  84. import { receivingDetailSn, receivingDetailList, receivingExport } from '@/api/receiving'
  85. import Print from '@/views/common/print.vue'
  86. import { hdPrint } from '@/libs/JGPrint'
  87. export default {
  88. components: { STable, VSelect, Print },
  89. data () {
  90. return {
  91. spinning: false,
  92. // 表头
  93. columns: [
  94. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  95. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
  96. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '17%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  97. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  98. { title: '采购单价', dataIndex: 'discountedPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  99. { title: '采购数量', width: '6%', align: 'center', scopedSlots: { customRender: 'qty' } },
  100. { title: '本次发货数量', dataIndex: 'receivingQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  101. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  102. { title: '本次发货金额', dataIndex: 'discountedAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  103. { title: '本次入库数量', dataIndex: 'putQty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } }
  104. ],
  105. // 加载数据方法 必须为 Promise 对象
  106. loadData: parameter => {
  107. this.disabled = true
  108. return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.$route.params.sn })).then(res => {
  109. const data = res.data
  110. const no = (data.pageNo - 1) * data.pageSize
  111. for (var i = 0; i < data.list.length; i++) {
  112. data.list[i].no = no + i + 1
  113. data.list[i].receivingQty = data.list[i].putQty
  114. }
  115. this.localDataSource = data.list
  116. this.disabled = false
  117. return data
  118. })
  119. },
  120. detail: null, // 详情数据
  121. localDataSource: [],
  122. printerType: 'NEEDLE' // 打印机类型
  123. }
  124. },
  125. methods: {
  126. // 返回列表
  127. handleBack () {
  128. this.$router.push({ path: '/purchasingManagement/signWarehousing/list', query: { closeLastOldTab: true } })
  129. },
  130. // 详情
  131. getDetail () {
  132. receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
  133. if (res.status == 200) {
  134. this.detail = res.data
  135. } else {
  136. this.detail = null
  137. }
  138. })
  139. },
  140. // 打印预览/快捷打印
  141. handlePrint (type, printerType) {
  142. const _this = this
  143. _this.spinning = true
  144. let url = purchaseDetailPrint
  145. let params = { sn: this.$route.params.sn, type: printerType }
  146. if (type == 'export') { // 导出
  147. url = purchaseExportDetail
  148. params = { sn: this.$route.params.sn }
  149. }
  150. // 打印或导出
  151. hdPrint(printerType, type, url, params, '备货单', function () {
  152. _this.spinning = false
  153. })
  154. },
  155. // 导出产品
  156. handleExportProduct () {
  157. const _this = this
  158. _this.spinning = true
  159. // 打印或导出
  160. hdPrint('', 'export', receivingExport, { receivingBillSn: this.$route.params.sn }, '备货单', function () {
  161. _this.spinning = false
  162. })
  163. }
  164. },
  165. mounted () {
  166. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  167. this.$refs.table.refresh(true)
  168. this.getDetail()
  169. }
  170. },
  171. activated () {
  172. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  173. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  174. this.$refs.table.refresh(true)
  175. this.getDetail()
  176. }
  177. },
  178. beforeRouteEnter (to, from, next) {
  179. next(vm => {})
  180. }
  181. }
  182. </script>
  183. <style lang="less">
  184. .signWarehousingDetail-cont{
  185. margin-bottom: 10px;
  186. .timeline-box{
  187. margin-top: 30px;
  188. .auxiliary-txt{
  189. color: #808695;
  190. }
  191. }
  192. }
  193. .signWarehousingDetail-wrap{
  194. .billno{
  195. font-size: 16px;
  196. font-weight: bold;
  197. margin: 0 15px;
  198. }
  199. }
  200. </style>