detailModal.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <a-modal
  3. centered
  4. class="inventoryQueryDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. :title="modalTit"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="960">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <!-- 基础信息 -->
  13. <a-card size="small" :bordered="false" class="purchaseReturnDetail-cont">
  14. <a-collapse :activeKey="['1']">
  15. <a-collapse-panel key="1" header="基础信息">
  16. <a-descriptions :column="3">
  17. <a-descriptions-item label="采购单号">{{ objItem&&objItem.purchaseBillNo || '--' }}</a-descriptions-item>
  18. </a-descriptions>
  19. </a-collapse-panel>
  20. </a-collapse>
  21. </a-card>
  22. <!-- 合计 -->
  23. <a-alert type="info" style="margin-bottom:10px" v-if="objItem">
  24. <div class="ftext" slot="message">
  25. 缺货总款数:<strong>{{ objItem.totalCategory || objItem.totalCategory==0 ? objItem.totalCategory : '--' }}</strong>;
  26. 缺货总数量:<strong>{{ objItem.totalQty || objItem.totalQty==0 ? objItem.totalQty : '--' }}</strong>;
  27. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  28. 缺货总售价:<strong>{{ objItem.totalAmount || objItem.totalAmount==0 ? toThousands(objItem.totalAmount) : '--' }}</strong>。
  29. </div>
  30. </div>
  31. </a-alert>
  32. <!-- 详情 -->
  33. <s-table
  34. class="sTable"
  35. ref="table"
  36. size="small"
  37. :rowKey="(record) => record.id"
  38. :columns="columns"
  39. :data="loadData"
  40. :scroll="{ y: 500 }"
  41. bordered>
  42. <!-- 产品编码 -->
  43. <template slot="code" slot-scope="text, record">
  44. <span>{{ record.productCode }}</span>
  45. <a-badge v-if="record.promotionFlag && record.promotionFlag=='GIFT'" count="促" :number-style="{ backgroundColor: '#52c41a', zoom:'80%',marginLeft:'5px' }"></a-badge>
  46. <a-badge v-if="record.promotionFlag && record.promotionFlag=='DISCOUNT'" count="特" :number-style="{ backgroundColor: '#faad14', zoom:'80%',marginLeft:'5px' }"></a-badge>
  47. </template>
  48. <!-- 缺货单价 -->
  49. <template slot="unitPrice" slot-scope="text, record">
  50. <span v-if="record.promotionFlag && (record.promotionFlag=='GIFT' || record.promotionFlag=='DISCOUNT')">{{ record.price||record.price==0? toThousands(record.price): '--' }}{{ record.origPrice ? '(' + toThousands(record.origPrice) + ')' : '' }}</span>
  51. <span v-else>{{ toThousands(record.price||0) }}</span>
  52. </template>
  53. </s-table>
  54. <div class="btn-cont">
  55. <a-button id="inventoryQueryDetail-detail-modal-back" @click="isShow = false">返回列表</a-button>
  56. </div>
  57. </a-spin>
  58. </a-modal>
  59. </template>
  60. <script>
  61. import { commonMixin } from '@/utils/mixin'
  62. import { STable } from '@/components'
  63. import { outOfStockDetailList } from '@/api/oos'
  64. export default {
  65. name: 'DetailModal',
  66. components: { STable },
  67. mixins: [commonMixin],
  68. props: {
  69. openModal: { // 弹框显示状态
  70. type: Boolean,
  71. default: false
  72. },
  73. objItem: {
  74. type: Object,
  75. default: () => {
  76. return {}
  77. }
  78. }
  79. },
  80. computed: {
  81. modalTit () {
  82. return '详情'
  83. },
  84. columns () {
  85. const _this = this
  86. const arr = [
  87. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  88. { title: '产品编码', dataIndex: 'productCode', scopedSlots: { customRender: 'code' }, width: '12%', align: 'center' },
  89. { title: '产品名称', dataIndex: 'productName', width: '17%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  90. { title: '原厂编码', dataIndex: 'origCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  91. { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  92. { title: '缺货数量', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  93. { title: '单价', dataIndex: 'price', width: '11%', align: 'right', scopedSlots: { customRender: 'unitPrice' } },
  94. { title: '缺货金额', dataIndex: 'totalAmount', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  95. ]
  96. return arr
  97. }
  98. },
  99. data () {
  100. return {
  101. spinning: false,
  102. isShow: this.openModal, // 是否打开弹框
  103. // 加载数据方法 必须为 Promise 对象
  104. loadData: parameter => {
  105. this.disabled = true
  106. this.spinning = true
  107. return outOfStockDetailList(Object.assign(parameter, { purchaseBillSn: this.objItem && this.objItem.purchaseBillSn || '' })).then(res => {
  108. let data
  109. if (res.status == 200) {
  110. data = res.data
  111. const no = (data.pageNo - 1) * data.pageSize
  112. for (var i = 0; i < data.list.length; i++) {
  113. data.list[i].no = no + i + 1
  114. }
  115. this.disabled = false
  116. }
  117. this.spinning = false
  118. return data
  119. })
  120. },
  121. disabled: false // 查询、重置按钮是否可操作
  122. }
  123. },
  124. methods: {
  125. // 获取表格数据
  126. pageInit () {
  127. this.$refs.table.refresh()
  128. }
  129. },
  130. watch: {
  131. // 父页面传过来的弹框状态
  132. openModal (newValue, oldValue) {
  133. this.isShow = newValue
  134. },
  135. // 重定义的弹框状态
  136. isShow (newValue, oldValue) {
  137. if (!newValue) {
  138. this.$emit('close')
  139. this.$refs.table.clearTable()
  140. }
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="less">
  146. .inventoryQueryDetail-modal{
  147. .btn-cont {
  148. text-align: center;
  149. margin: 5px 0 10px;
  150. }
  151. }
  152. </style>