stockOrderDetail.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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.settleStyleSnDictValue) || '--' }}</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. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">本次发货金额合计:<strong>{{ detail && (detail.totalPutAmount || detail.totalPutAmount==0) ? '¥'+detail.totalPutAmount : '--' }}</strong></div>
  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 { commonMixin } from '@/utils/mixin'
  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. name: 'SignWareHousingStockOrderDetail',
  89. components: { STable, VSelect, Print },
  90. mixins: [commonMixin],
  91. data () {
  92. return {
  93. spinning: false,
  94. // 加载数据方法 必须为 Promise 对象
  95. loadData: parameter => {
  96. this.disabled = true
  97. return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.$route.params.sn })).then(res => {
  98. const data = res.data
  99. const no = (data.pageNo - 1) * data.pageSize
  100. for (var i = 0; i < data.list.length; i++) {
  101. data.list[i].no = no + i + 1
  102. data.list[i].receivingQty = data.list[i].putQty
  103. }
  104. this.localDataSource = data.list
  105. this.disabled = false
  106. return data
  107. })
  108. },
  109. detail: null, // 详情数据
  110. localDataSource: [],
  111. printerType: 'NEEDLE' // 打印机类型
  112. }
  113. },
  114. computed: {
  115. columns () {
  116. const arr = [
  117. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  118. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
  119. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '17%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  120. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  121. // { title: '采购单价', dataIndex: 'discountedPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  122. { title: '采购数量', width: '6%', align: 'center', scopedSlots: { customRender: 'qty' } },
  123. { title: '本次发货数量', dataIndex: 'receivingQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  124. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  125. // { title: '本次发货金额', dataIndex: 'discountedAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  126. { title: '本次入库数量', dataIndex: 'putQty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } }
  127. ]
  128. if (this.$hasPermissions('M_ShowAllCost')) {
  129. arr.splice(4, 0, { title: '采购单价', dataIndex: 'discountedPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  130. arr.splice(8, 0, { title: '本次发货金额', dataIndex: 'discountedAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  131. }
  132. return arr
  133. }
  134. },
  135. methods: {
  136. // 返回列表
  137. handleBack () {
  138. this.$router.push({ path: '/purchasingManagement/signWarehousing/list', query: { closeLastOldTab: true } })
  139. },
  140. // 详情
  141. getDetail () {
  142. receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
  143. if (res.status == 200) {
  144. this.detail = res.data
  145. } else {
  146. this.detail = null
  147. }
  148. })
  149. },
  150. // 打印预览/快捷打印
  151. handlePrint (type, printerType) {
  152. const _this = this
  153. _this.spinning = true
  154. let url = purchaseDetailPrint
  155. let params = { sn: this.$route.params.sn, type: printerType }
  156. if (type == 'export') { // 导出
  157. url = purchaseExportDetail
  158. params = { sn: this.$route.params.sn }
  159. }
  160. // 打印或导出
  161. hdPrint(printerType, type, url, params, '备货单', function () {
  162. _this.spinning = false
  163. })
  164. },
  165. // 导出产品
  166. handleExportProduct () {
  167. const _this = this
  168. _this.spinning = true
  169. // 打印或导出
  170. hdPrint('', 'export', receivingExport, { receivingBillSn: this.$route.params.sn }, '备货单', function () {
  171. _this.spinning = false
  172. })
  173. }
  174. },
  175. mounted () {
  176. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  177. this.$refs.table.refresh(true)
  178. this.getDetail()
  179. }
  180. },
  181. activated () {
  182. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  183. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  184. this.$refs.table.refresh(true)
  185. this.getDetail()
  186. }
  187. },
  188. beforeRouteEnter (to, from, next) {
  189. next(vm => {})
  190. }
  191. }
  192. </script>
  193. <style lang="less">
  194. .signWarehousingDetail-cont{
  195. margin-bottom: 10px;
  196. .timeline-box{
  197. margin-top: 30px;
  198. .auxiliary-txt{
  199. color: #808695;
  200. }
  201. }
  202. }
  203. .signWarehousingDetail-wrap{
  204. .billno{
  205. font-size: 16px;
  206. font-weight: bold;
  207. margin: 0 15px;
  208. }
  209. }
  210. </style>