vaildPriceModal.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <a-modal
  3. centered
  4. :footer="null"
  5. :maskClosable="false"
  6. class="sales-print-type-modal"
  7. v-model="isShow"
  8. @cancel="isShow=false"
  9. :width="900">
  10. <div class="title">提示</div>
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <div class="tipModal-content">
  13. <a-table
  14. class="sTable"
  15. ref="table"
  16. size="small"
  17. :rowKey="(record) => record.id"
  18. :columns="columns"
  19. :dataSource="dataList"
  20. :scroll="{ y: 300 }"
  21. :pagination="false"
  22. bordered>
  23. </a-table>
  24. <div style="padding: 20px;text-align: center;" v-if="dataObj&&dataObj.message">
  25. {{ dataObj.message }}
  26. </div>
  27. <div style="margin-top:36px;text-align:center;" v-if="modalType==='0'">
  28. <!-- <a-button @click="handleCancel" style="margin-right: 15px" id="chooseCustom-btn-back">关闭</a-button> -->
  29. <a-button type="primary" style="margin-right: 15px" @click="handleSubmit('AUDIT_REJECT')" id="chooseCustom-btn-noPasss">审核不通过</a-button>
  30. <a-button type="primary" class="button-info" @click="handleSubmit('AUDIT_PASS')" id="chooseCustom-btn-Pass">审核通过</a-button>
  31. </div>
  32. <div style="margin-top:36px;text-align:center;" v-else>
  33. <a-button @click="handleCancel" style="margin-right: 15px" id="chooseCustom-btn-back">关闭</a-button>
  34. </div>
  35. </div>
  36. </a-spin>
  37. </a-modal>
  38. </template>
  39. <script>
  40. import { commonMixin } from '@/utils/mixin'
  41. export default {
  42. name: 'VaildPriceModal',
  43. mixins: [commonMixin],
  44. props: {
  45. openModal: { // 弹框显示状态
  46. type: Boolean,
  47. default: false
  48. },
  49. dataObj: {
  50. type: Object,
  51. default: () => {
  52. return null
  53. }
  54. },
  55. modalType: {// 0 来源审核页面 1来源提交页面
  56. type: String,
  57. default: '0'
  58. }
  59. },
  60. data () {
  61. return {
  62. isShow: this.openModal,
  63. spinning: false
  64. }
  65. },
  66. computed: {
  67. dataList () {
  68. const list = this.dataObj && this.dataObj.salesPromoDetailEntityList || []
  69. list.map(item => {
  70. item.totalAmount = this.modalType == 0 ? item.promotionPrice * item.qty : item.totalAmount
  71. item.totalCostAmount = item.showCost * item.qty
  72. item.totalKsAmount = item.totalAmount - item.totalCostAmount
  73. })
  74. return list
  75. },
  76. columns () {
  77. const _this = this
  78. const arr = [
  79. { title: '序号', dataIndex: 'no', width: '5%', align: 'center', customRender: function (text, row, index) { return index + 1 } },
  80. { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  81. { title: '销售数量', dataIndex: 'qty', width: '10%', align: 'center', isShow: false, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '售价小计', dataIndex: 'totalAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  83. ]
  84. if (_this.modalType == 0) {
  85. arr.splice(2, 0, { title: '参考成本价', dataIndex: 'showCost', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  86. arr.splice(3, 0, { title: '售价', dataIndex: 'promotionPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  87. arr.splice(5, 0, { title: '单位', dataIndex: 'product.unit', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  88. arr.push({ title: '参考成本价小计', dataIndex: 'totalCostAmount', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  89. arr.push({ title: '亏损金额', dataIndex: 'totalKsAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  90. } else {
  91. arr.splice(2, 0, { title: '售价', dataIndex: 'price', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  92. arr.splice(4, 0, { title: '单位', dataIndex: 'productEntity.unit', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  93. }
  94. return arr
  95. }
  96. },
  97. methods: {
  98. // 保存
  99. handleSubmit (type) {
  100. this.spinning = true
  101. this.$emit('ok', type)
  102. },
  103. // 关闭弹窗
  104. handleCancel () {
  105. this.isShow = false
  106. this.$emit('close')
  107. }
  108. },
  109. watch: {
  110. // 父页面传过来的弹框状态
  111. openModal (newValue, oldValue) {
  112. this.isShow = newValue
  113. },
  114. isShow (newValue, oldValue) {
  115. if (!newValue) {
  116. this.$emit('close')
  117. }
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less" scoped>
  123. .tipModal-content{
  124. width:87%;
  125. margin:30px auto 0;
  126. text-align:center;
  127. .tipModal-tit{
  128. font-size: 20px;
  129. }
  130. .sTable{
  131. margin:15px 0 25px;
  132. }
  133. .ant-radio-wrapper:first-child{
  134. margin-right:70px !important;
  135. }
  136. .redWord{
  137. color:#ed1c24;
  138. }
  139. }
  140. </style>