detail.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="storeTransferOutDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="storeTransferOutDetail-back" >
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="storeTransferOutDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. </template>
  8. <!-- 操作区,位于 title 行的行尾 -->
  9. <template slot="extra">
  10. <a-button key="2" id="storeTransferOutDetail-preview-btn">打印预览</a-button>
  11. <a-button key="1" type="primary" id="storeTransferOutDetail-print-btn">快速打印</a-button>
  12. </template>
  13. </a-page-header>
  14. <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
  15. <a-collapse :activeKey="['1']">
  16. <a-collapse-panel key="1" header="基础信息">
  17. <a-descriptions :column="3">
  18. <a-descriptions-item label="调往对象名称">{{ (basicInfoData&&basicInfoData.putPersonName) || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="店内调出单号">{{ (basicInfoData&&basicInfoData.storeCallOutNo) || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="财务状态">{{ (basicInfoData&&basicInfoData.settleStateDictValue) || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="调拨类型">{{ (basicInfoData&&basicInfoData.callOutTypeName) || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
  24. </a-descriptions>
  25. </a-collapse-panel>
  26. </a-collapse>
  27. </a-card>
  28. <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
  29. <!-- 总计 -->
  30. <a-alert type="info" showIcon style="margin-bottom:15px">
  31. <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
  32. </a-alert>
  33. <!-- 列表 -->
  34. <s-table
  35. class="sTable"
  36. ref="table"
  37. size="small"
  38. :rowKey="(record) => record.id"
  39. :columns="columns"
  40. :data="loadData"
  41. :scroll="{ x: 995 }"
  42. bordered>
  43. </s-table>
  44. </a-card>
  45. </div>
  46. </template>
  47. <script>
  48. import { STable, VSelect } from '@/components'
  49. import { getOperationalPrecision } from '@/libs/tools.js'
  50. import { storeCallOutDetailList, storeCallOutDetailCount, storeCallOutDetailSn } from '@/api/storeCallOut'
  51. export default {
  52. components: { STable, VSelect },
  53. data () {
  54. return {
  55. // 表头
  56. columns: [
  57. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  58. { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  59. { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
  60. { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  61. { title: '成本价(¥)', dataIndex: 'outCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  62. { title: '调出仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  63. { title: '调出数量', dataIndex: 'outQty', width: 100, align: 'center' },
  64. { title: '成本小计(¥)', dataIndex: 'costSubtotal', width: 115, align: 'center' }
  65. ],
  66. // 加载数据方法 必须为 Promise 对象
  67. loadData: parameter => {
  68. return storeCallOutDetailList(Object.assign(parameter, { storeCallOutSn: this.$route.params.sn })).then(res => {
  69. const data = res.data
  70. const no = (data.pageNo - 1) * data.pageSize
  71. for (var i = 0; i < data.list.length; i++) {
  72. data.list[i].no = no + i + 1
  73. // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  74. data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
  75. }
  76. return data
  77. })
  78. },
  79. basicInfoData: null, // 基本信息
  80. productTotal: null // 合计
  81. }
  82. },
  83. methods: {
  84. // 返回列表
  85. handleBack () {
  86. this.$router.push({ path: '/allocationManagement/storeTransferOut/list' })
  87. },
  88. // 基本信息
  89. getDetail () {
  90. storeCallOutDetailSn({ sn: this.$route.params.sn }).then(res => {
  91. if (res.status == 200) {
  92. this.basicInfoData = res.data
  93. } else {
  94. this.basicInfoData = null
  95. }
  96. })
  97. },
  98. // 合计
  99. getDetailCount () {
  100. storeCallOutDetailCount({ storeCallOutSn: this.$route.params.sn }).then(res => {
  101. if (res.status == 200) {
  102. this.productTotal = res.data
  103. } else {
  104. this.productTotal = null
  105. }
  106. })
  107. }
  108. },
  109. beforeRouteEnter (to, from, next) {
  110. next(vm => {
  111. vm.getDetail()
  112. vm.getDetailCount()
  113. })
  114. }
  115. }
  116. </script>
  117. <style lang="less">
  118. .storeTransferOutDetail-wrap{
  119. .storeTransferOutDetail-back{
  120. margin-bottom: 15px;
  121. }
  122. .storeTransferOutDetail-cont{
  123. margin-bottom: 15px;
  124. }
  125. }
  126. </style>