vaildPriceModal.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 == 'wait_up_audit_price_less_cost'||modalType == 'audit_price_less_cost'">
  28. <a-button type="primary" style="margin-right: 15px" @click="handleSubmit('AUDIT_REJECT')" id="chooseCustom-btn-noPasss">审核不通过</a-button>
  29. <a-button type="primary" class="button-info" @click="handleSubmit('AUDIT_PASS')" id="chooseCustom-btn-Pass">审核通过</a-button>
  30. </div>
  31. <div style="margin-top:36px;text-align:center;" v-if="modalType == 'price_less_cost'">
  32. <a-button @click="handleCancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
  33. <a-button type="primary" class="button-info" @click="handleSubmit('confirm')" id="chooseCustom-btn-Pass">确定</a-button>
  34. </div>
  35. <div style="margin-top:36px;text-align:center;" v-if="modalType == 'price_less_0'">
  36. <a-button @click="handleCancel" style="margin-right: 15px" id="chooseCustom-btn-back">关闭</a-button>
  37. </div>
  38. </div>
  39. </a-spin>
  40. </a-modal>
  41. </template>
  42. <script>
  43. import { commonMixin } from '@/utils/mixin'
  44. export default {
  45. name: 'VaildPriceModal',
  46. mixins: [commonMixin],
  47. props: {
  48. openModal: { // 弹框显示状态
  49. type: Boolean,
  50. default: false
  51. },
  52. dataObj: {
  53. type: Object,
  54. default: () => {
  55. return null
  56. }
  57. }
  58. },
  59. data () {
  60. return {
  61. isShow: this.openModal,
  62. spinning: false
  63. }
  64. },
  65. computed: {
  66. modalType () {
  67. return this.dataObj && this.dataObj.type
  68. },
  69. dataList () {
  70. const list = this.dataObj && this.dataObj.data || []
  71. list.map(item => {
  72. item.totalKsAmount = item.totalShowCost - item.totalAmount
  73. })
  74. return list
  75. },
  76. columns () {
  77. const _this = this
  78. // 特价产品,销售价小于等于0
  79. if (this.modalType == 'price_less_0') {
  80. return [
  81. { title: '序号', dataIndex: 'no', width: '5%', align: 'center', customRender: function (text, row, index) { return index + 1 } },
  82. { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  83. { title: '售价', dataIndex: 'price', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  84. { title: '销售数量', dataIndex: 'qty', width: '10%', align: 'center', isShow: false, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  85. { title: '单位', dataIndex: 'productEntity.unit', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  86. { title: '售价小计', dataIndex: 'totalAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  87. ]
  88. }
  89. // 特价产品,销售价是否低于成本价
  90. if (this.modalType == 'price_less_cost' || _this.modalType == 'wait_up_audit_price_less_cost' || _this.modalType == 'audit_price_less_cost') {
  91. return [
  92. { title: '序号', dataIndex: 'no', width: '5%', align: 'center', customRender: function (text, row, index) { return index + 1 } },
  93. { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  94. { title: '参考成本价', dataIndex: 'showCost', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  95. { title: '售价', dataIndex: 'promotionPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  96. { title: '销售数量', dataIndex: 'qty', width: '10%', align: 'center', isShow: false, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  97. { title: '单位', dataIndex: 'productEntity.unit', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  98. { title: '售价小计', dataIndex: 'totalAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  99. { title: '参考成本价小计', dataIndex: 'totalShowCost', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  100. { title: '亏损金额', dataIndex: 'totalKsAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  101. ]
  102. }
  103. return []
  104. }
  105. },
  106. methods: {
  107. // 保存
  108. handleSubmit (type) {
  109. this.spinning = true
  110. this.$emit('ok', type)
  111. },
  112. // 关闭弹窗
  113. handleCancel () {
  114. this.isShow = false
  115. this.$emit('close')
  116. }
  117. },
  118. watch: {
  119. // 父页面传过来的弹框状态
  120. openModal (newValue, oldValue) {
  121. this.isShow = newValue
  122. },
  123. isShow (newValue, oldValue) {
  124. if (!newValue) {
  125. this.$emit('close')
  126. }
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="less" scoped>
  132. .tipModal-content{
  133. width:87%;
  134. margin:30px auto 0;
  135. text-align:center;
  136. .tipModal-tit{
  137. font-size: 20px;
  138. }
  139. .sTable{
  140. margin:15px 0 25px;
  141. }
  142. .ant-radio-wrapper:first-child{
  143. margin-right:70px !important;
  144. }
  145. .redWord{
  146. color:#ed1c24;
  147. }
  148. }
  149. </style>