stockOrderDetail.vue 9.8 KB

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