detailModal.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <a-modal
  3. centered
  4. class="orderStatisticsDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="促销品明细"
  8. v-model="isShow"
  9. @cancle="isShow=false"
  10. width="80%">
  11. <div>
  12. <p>销售单号: {{ nowData.salesBillNo || '--' }}</p>
  13. <!-- 列表 -->
  14. <s-table
  15. class="sTable"
  16. ref="table"
  17. size="small"
  18. :rowKey="(record) => record.id"
  19. :columns="columns"
  20. :data="loadData"
  21. :defaultLoadData="false"
  22. :scroll="{ x: 1400, y: 400 }"
  23. bordered>
  24. </s-table>
  25. <div class="btn-cont"><a-button id="orderStatisticsDetail-back" @click="isShow = false">返回列表</a-button></div>
  26. </div>
  27. </a-modal>
  28. </template>
  29. <script>
  30. import { STable } from '@/components'
  31. import { salesDetailList } from '@/api/salesDetail'
  32. export default {
  33. name: 'OrderStatisticsDetailModal',
  34. components: { STable },
  35. props: {
  36. openModal: { // 弹框显示状态
  37. type: Boolean,
  38. default: false
  39. },
  40. itemSn: {
  41. type: [Number, String],
  42. default: ''
  43. },
  44. nowData: {
  45. type: Object,
  46. default: () => {
  47. return {}
  48. }
  49. }
  50. },
  51. data () {
  52. return {
  53. isShow: this.openModal, // 是否打开弹框
  54. // 表头
  55. columns: [
  56. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  57. { title: '产品编码', dataIndex: 'productEntity.code', width: 220, align: 'center' },
  58. { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  59. { title: '原价', dataIndex: 'origPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  60. { title: '促销价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  61. { title: '数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  62. { title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  63. { title: '原价小计', dataIndex: 'totalAmounts', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  64. { title: '促销价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  65. { title: '节省金额小计', dataIndex: 'totalEconomizeAmount', width: 130, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  66. { title: '促销类型', dataIndex: 'promotionRulesName', width: 150, align: 'center', customRender: function (text) { return text || '--' } }
  67. ],
  68. // 加载数据方法 必须为 Promise 对象
  69. loadData: parameter => {
  70. return salesDetailList(Object.assign(parameter, { salesBillSn: this.itemSn, promotionFlag: 1 })).then(res => {
  71. const data = res.data
  72. const no = (data.pageNo - 1) * data.pageSize
  73. for (var i = 0; i < data.list.length; i++) {
  74. data.list[i].no = no + i + 1
  75. // priceSubtotal
  76. }
  77. return data
  78. })
  79. }
  80. }
  81. },
  82. methods: {
  83. },
  84. watch: {
  85. // 父页面传过来的弹框状态
  86. openModal (newValue, oldValue) {
  87. this.isShow = newValue
  88. },
  89. // 重定义的弹框状态
  90. isShow (newValue, oldValue) {
  91. if (!newValue) {
  92. this.$emit('close')
  93. }
  94. },
  95. itemSn (newValue, oldValue) {
  96. if (this.isShow && newValue) {
  97. const _this = this
  98. setTimeout(() => {
  99. _this.$refs.table.refresh(true)
  100. }, 300)
  101. }
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="less">
  107. .orderStatisticsDetail-modal{
  108. .ant-modal-body {
  109. padding: 40px 40px 24px;
  110. }
  111. .btn-cont {
  112. text-align: center;
  113. margin: 35px 0 10px;
  114. }
  115. }
  116. </style>