stockOrderDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }">
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="signWarehousingDetail-back-btn" href="javascript:;" @click="handleBack" v-if="!outBizSn"><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) ? toThousands(detail.totalPutAmount, 2) : '--' }}</strong>,</div>
  55. 本次入库数量合计:<strong>{{ detail && (detail.totalRealPutQty || detail.totalRealPutQty==0) ? detail.totalRealPutQty : '--' }}</strong>,
  56. 本次入库金额合计:<strong>{{ detail && (detail.totalRealPutAmount || detail.totalRealPutAmount==0) ? toThousands(detail.totalRealPutAmount, 2) : '--' }}</strong>
  57. </div>
  58. </a-alert>
  59. <!-- 列表 -->
  60. <s-table
  61. class="sTable"
  62. ref="table"
  63. size="small"
  64. :rowKey="(record) => record.id"
  65. :columns="columns"
  66. :data="loadData"
  67. :defaultLoadData="false"
  68. bordered>
  69. <!-- 采购数量 -->
  70. <template slot="qty" slot-scope="text, record">
  71. <div>{{ record.qty }}</div>
  72. </template>
  73. <!-- 缺货数量 -->
  74. <template slot="outOfStockNum" slot-scope="text, record">
  75. <span>{{ record.outOfStockNum }}</span>
  76. </template>
  77. </s-table>
  78. </a-card>
  79. </a-spin>
  80. </div>
  81. </template>
  82. <script>
  83. import { commonMixin } from '@/utils/mixin'
  84. import { STable, VSelect } from '@/components'
  85. import { purchaseDetailPrint, purchaseDetailExport, purchaseExportDetail } from '@/api/purchase'
  86. import { receivingDetailSn, receivingDetailList, receivingExport } from '@/api/receiving'
  87. import Print from '@/views/common/print.vue'
  88. import { hdPrint } from '@/libs/JGPrint'
  89. export default {
  90. name: 'SignWareHousingStockOrderDetail',
  91. components: { STable, VSelect, Print },
  92. mixins: [commonMixin],
  93. props: {
  94. outBizSn: { // 有值则为弹框,无值则为页面
  95. type: [Number, String],
  96. default: ''
  97. }
  98. },
  99. data () {
  100. return {
  101. spinning: false,
  102. // 加载数据方法 必须为 Promise 对象
  103. loadData: parameter => {
  104. this.disabled = true
  105. return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.outBizSn || this.$route.params.sn })).then(res => {
  106. const data = res.data
  107. const no = (data.pageNo - 1) * data.pageSize
  108. for (var i = 0; i < data.list.length; i++) {
  109. data.list[i].no = no + i + 1
  110. }
  111. this.localDataSource = data.list
  112. this.disabled = false
  113. return data
  114. })
  115. },
  116. detail: null, // 详情数据
  117. localDataSource: [],
  118. printerType: 'NEEDLE' // 打印机类型
  119. }
  120. },
  121. computed: {
  122. columns () {
  123. const _this = this
  124. const arr = [
  125. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  126. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  128. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  129. { title: '采购数量', width: '6%', align: 'center', scopedSlots: { customRender: 'qty' } },
  130. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '本次发货数量', dataIndex: 'putQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  132. { title: '本次入库数量', dataIndex: 'realPutQty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  133. { title: '本次入库金额', dataIndex: 'realPutAmount', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } }
  134. ]
  135. if (this.$hasPermissions('M_ShowAllCost')) {
  136. arr.splice(4, 0, { title: '采购单价', dataIndex: 'discountedPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  137. arr.splice(8, 0, { title: '本次发货金额', dataIndex: 'discountedAmount', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  138. }
  139. return arr
  140. }
  141. },
  142. methods: {
  143. // 返回列表
  144. handleBack () {
  145. this.$router.push({ path: '/purchasingManagement/signWarehousing/list', query: { closeLastOldTab: true } })
  146. },
  147. // 详情
  148. getDetail () {
  149. receivingDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  150. if (res.status == 200) {
  151. this.detail = res.data
  152. } else {
  153. this.detail = null
  154. }
  155. })
  156. },
  157. // 打印预览/快捷打印
  158. handlePrint (type, printerType) {
  159. const _this = this
  160. _this.spinning = true
  161. let url = purchaseDetailPrint
  162. let params = { sn: this.outBizSn || this.$route.params.sn, type: printerType }
  163. if (type == 'export') { // 导出
  164. url = purchaseExportDetail
  165. params = { sn: this.outBizSn || this.$route.params.sn }
  166. }
  167. // 打印或导出
  168. hdPrint(printerType, type, url, params, '备货单', function () {
  169. _this.spinning = false
  170. })
  171. },
  172. // 导出产品
  173. handleExportProduct () {
  174. const _this = this
  175. _this.spinning = true
  176. // 打印或导出
  177. hdPrint('', 'export', receivingExport, { receivingBillSn: this.outBizSn || this.$route.params.sn }, '备货单', function () {
  178. _this.spinning = false
  179. })
  180. }
  181. },
  182. mounted () {
  183. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新时调用
  184. this.$refs.table.refresh(true)
  185. this.getDetail()
  186. }
  187. },
  188. activated () {
  189. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  190. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  191. this.$refs.table.refresh(true)
  192. this.getDetail()
  193. }
  194. },
  195. beforeRouteEnter (to, from, next) {
  196. next(vm => {})
  197. }
  198. }
  199. </script>
  200. <style lang="less">
  201. .signWarehousingDetail-cont{
  202. margin-bottom: 10px;
  203. .timeline-box{
  204. margin-top: 30px;
  205. .auxiliary-txt{
  206. color: #808695;
  207. }
  208. }
  209. }
  210. .signWarehousingDetail-wrap{
  211. .billno{
  212. font-size: 16px;
  213. font-weight: bold;
  214. margin: 0 15px;
  215. }
  216. }
  217. </style>