detail.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="warehousingAuditDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="warehousingAuditDetail-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="warehousingAuditDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.receivingBillNo) || '--' }}</p>
  9. </template>
  10. <!-- 操作区,位于 title 行的行尾 -->
  11. <template v-if="$hasPermissions('B_warehousingDetail_print')" slot="extra">
  12. <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
  13. </template>
  14. </a-page-header>
  15. <!-- 基础信息 -->
  16. <a-card size="small" :bordered="false" class="warehousingAuditDetail-cont">
  17. <a-collapse :activeKey="['1']">
  18. <a-collapse-panel key="1" header="基础信息">
  19. <a-descriptions :column="4">
  20. <a-descriptions-item label="供应商">{{ basicInfoData&&basicInfoData.purchaseTargetName ? basicInfoData.purchaseTargetName : '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="入库时间">{{ basicInfoData&&basicInfoData.stockPutTime ? basicInfoData.stockPutTime : '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="采购单号">{{ basicInfoData&&basicInfoData.purchaseBillNo ? basicInfoData.purchaseBillNo : '--' }}</a-descriptions-item>
  23. </a-descriptions>
  24. <a-descriptions :column="4" size="small">
  25. <a-descriptions-item label="采购总款数">{{ basicInfoData&&(basicInfoData.totalCategory || basicInfoData.totalCategory==0) ? basicInfoData.totalCategory : '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="采购总数量">{{ basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0) ? basicInfoData.totalQty : '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="采购总成本" v-if="$hasPermissions('M_ShowAllCost')">{{ basicInfoData&&(basicInfoData.totalAmount || basicInfoData.totalAmount==0) ? toThousands(basicInfoData.totalAmount) : '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="入库总款数">{{ basicInfoData&&(basicInfoData.totalPutCategory || basicInfoData.totalPutCategory==0) ? basicInfoData.totalPutCategory : '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="入库总数量">{{ basicInfoData&&(basicInfoData.totalRealPutQty || basicInfoData.totalRealPutQty==0) ? basicInfoData.totalRealPutQty : '--' }}</a-descriptions-item>
  30. <a-descriptions-item label="入库总成本" v-if="$hasPermissions('M_ShowAllCost')">{{ basicInfoData&&(basicInfoData.totalRealPutAmount || basicInfoData.totalRealPutAmount==0) ? toThousands(basicInfoData.totalRealPutAmount) : '--' }}</a-descriptions-item>
  31. </a-descriptions>
  32. </a-collapse-panel>
  33. </a-collapse>
  34. </a-card>
  35. <!-- 入库明细 -->
  36. <a-card size="small" :bordered="false" class="warehousingAuditDetail-cont">
  37. <a-collapse :activeKey="['1']">
  38. <a-collapse-panel key="1" header="入库明细">
  39. <!-- 列表 -->
  40. <s-table
  41. class="sTable"
  42. ref="table"
  43. size="small"
  44. :rowKey="(record) => record.id"
  45. :columns="columns"
  46. :data="loadData"
  47. :defaultLoadData="false"
  48. bordered>
  49. <!-- 产品编码 -->
  50. <template slot="code" slot-scope="text, record">
  51. <span>{{ record.dealerProductEntity.code }}</span>
  52. <a-badge v-if="record.promotionFlag && record.promotionFlag=='GIFT'" count="促" :number-style="{ backgroundColor: '#52c41a', zoom:'80%',marginLeft:'5px' }"></a-badge>
  53. <a-badge v-if="record.promotionFlag && record.promotionFlag=='DISCOUNT'" count="特" :number-style="{ backgroundColor: '#faad14', zoom:'80%',marginLeft:'5px' }"></a-badge>
  54. </template>
  55. <!-- 成本价 -->
  56. <template slot="unitPrice" slot-scope="text, record">
  57. <span v-if="record.promotionFlag && (record.promotionFlag=='GIFT' || record.promotionFlag=='DISCOUNT')">{{ record.discountedPrice||record.discountedPrice==0? toThousands(record.discountedPrice): '--' }}{{ record.origPrice ? '(' + toThousands(record.origPrice) + ')' : '' }}</span>
  58. <span v-else>{{ toThousands(record.discountedPrice||0) }}</span>
  59. </template>
  60. </s-table>
  61. </a-collapse-panel>
  62. </a-collapse>
  63. </a-card>
  64. </a-spin>
  65. </div>
  66. </template>
  67. <script>
  68. import { commonMixin } from '@/utils/mixin'
  69. import { STable, VSelect } from '@/components'
  70. import { receivingDetailList, receivingDetailSn, receivingDetailPrint } from '@/api/receiving'
  71. import Print from '@/views/common/print.vue'
  72. import { hdPrint } from '@/libs/JGPrint'
  73. export default {
  74. name: 'WarehousingAuditDetail',
  75. components: { STable, VSelect, Print },
  76. mixins: [commonMixin],
  77. data () {
  78. return {
  79. spinning: false,
  80. // 加载数据方法 必须为 Promise 对象
  81. loadData: parameter => {
  82. this.disabled = true
  83. this.spinning = true
  84. return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.$route.params.sn })).then(res => {
  85. let data
  86. if (res.status == 200) {
  87. data = res.data
  88. const no = (data.pageNo - 1) * data.pageSize
  89. for (var i = 0; i < data.list.length; i++) {
  90. data.list[i].no = no + i + 1
  91. }
  92. this.localDataSource = data.list
  93. this.disabled = false
  94. }
  95. this.spinning = false
  96. return data
  97. })
  98. },
  99. localDataSource: [],
  100. basicInfoData: null, // 基本信息
  101. printerType: 'NEEDLE' // 打印机类型
  102. }
  103. },
  104. computed: {
  105. columns () {
  106. const _this = this
  107. const arr = [
  108. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  109. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '15%', align: 'center', scopedSlots: { customRender: 'code' } },
  110. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  111. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  112. { title: '采购数量', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  113. { title: '入库数量', dataIndex: 'realPutQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  114. // { title: '成本价', dataIndex: 'discountedPrice', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  115. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  116. // { title: '入库小计', dataIndex: 'realPutAmount', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  117. { title: '仓库', dataIndex: 'warehouseEntity.name', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  118. { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  119. ]
  120. if (this.$hasPermissions('M_ShowAllCost')) {
  121. arr.splice(7, 0, { title: '成本价', dataIndex: 'discountedPrice', width: '7%', align: 'right', scopedSlots: { customRender: 'unitPrice' } })
  122. arr.splice(8, 0, { title: '入库小计', dataIndex: 'realPutAmount', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  123. }
  124. return arr
  125. }
  126. },
  127. methods: {
  128. // 返回列表
  129. handleBack () {
  130. this.$router.push({ path: '/financialManagement/warehousingAudit/list' })
  131. },
  132. // 打印预览/快捷打印
  133. handlePrint (type, printerType) {
  134. const _this = this
  135. _this.spinning = true
  136. const url = receivingDetailPrint
  137. const params = { sn: this.$route.params.sn, type: printerType }
  138. // 打印或导出
  139. hdPrint(printerType, type, url, params, '入库审核', function () {
  140. _this.spinning = false
  141. })
  142. },
  143. getDetail () {
  144. receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
  145. if (res.status == 200) {
  146. this.basicInfoData = res.data
  147. } else {
  148. this.basicInfoData = null
  149. }
  150. })
  151. }
  152. },
  153. mounted () {
  154. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  155. this.$refs.table.refresh(true)
  156. this.getDetail()
  157. }
  158. },
  159. activated () {
  160. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  161. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  162. this.$refs.table.refresh(true)
  163. this.getDetail()
  164. }
  165. },
  166. beforeRouteEnter (to, from, next) {
  167. next(vm => {})
  168. }
  169. }
  170. </script>
  171. <style lang="less">
  172. .warehousingAuditDetail-cont{
  173. margin-bottom: 10px;
  174. }
  175. </style>