StrikeBalanceModel.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. switchFullscreen
  7. @ok="handleOk"
  8. :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
  9. @cancel="handleCancel"
  10. cancelText="关闭"
  11. >
  12. <a-table
  13. :columns="columns"
  14. :data-source="feesList"
  15. :pagination="false"
  16. :scroll="{ y: 160 }"
  17. rowKey="id">
  18. <template slot="subjectType" slot-scope="text">
  19. {{ getSubjectTypeText(text) }}
  20. </template>
  21. <template slot="money" slot-scope="text, record">
  22. <a-input-number v-model=record.money @blur="handleBlur()"></a-input-number>
  23. </template>
  24. </a-table>
  25. </j-modal>
  26. </template>
  27. <script>
  28. import { postAction } from '@api/manage'
  29. const columns = [
  30. // {
  31. // title: "",
  32. // dataIndex: "key",
  33. // width: 20,
  34. // },
  35. {
  36. title: '费项',
  37. dataIndex: 'subjectType',
  38. width: 100,
  39. scopedSlots: { customRender: 'subjectType' }
  40. },
  41. {
  42. title: '日期',
  43. dataIndex: 'dayTime',
  44. width: 100
  45. },
  46. {
  47. title: '金额',
  48. dataIndex: 'oldPrice',
  49. width: 60
  50. },
  51. {
  52. title: '冲账金额',
  53. dataIndex: 'money',
  54. width: 60,
  55. scopedSlots: { customRender: 'money'}
  56. },
  57. ]
  58. export default {
  59. name: 'StrikeBalanceModel',
  60. components: {
  61. },
  62. data() {
  63. return {
  64. title: '',
  65. width: 800,
  66. visible: false,
  67. disableSubmit: false,
  68. showYinshou: true,
  69. columns: columns,
  70. feesList: []
  71. }
  72. },
  73. methods: {
  74. edit(record) {
  75. this.visible = true
  76. console.log(record)
  77. this.feesList = record
  78. this.feesList.forEach(e => {
  79. e.oldPrice = e.money
  80. })
  81. },
  82. close() {
  83. this.$emit('close')
  84. this.visible = false
  85. },
  86. handleOk() {
  87. let num = 0
  88. this.feesList.forEach(e => {
  89. if (e.money > e.oldPrice) {
  90. e.money = e.oldPrice
  91. num++
  92. }
  93. })
  94. if (num > 0) {
  95. this.$message.warning('冲账金额不能超过原金额')
  96. return
  97. }
  98. postAction('/business/busOrderFee/strike-balance', this.feesList).then(resp => {
  99. if (resp.result === true) {
  100. this.$message.success('冲账成功')
  101. this.$emit('ok')
  102. this.visible = false
  103. } else {
  104. this.$message.warning('冲账失败')
  105. }
  106. });
  107. },
  108. submitCallback() {
  109. },
  110. handleCancel() {
  111. this.close()
  112. },
  113. getSubjectTypeText(text) {
  114. var msg = ''
  115. if (text === 1) {
  116. msg = '押金'
  117. } else if (text === 2) {
  118. msg = '预收房费'
  119. } else if (text === 3) {
  120. msg = '每日房费'
  121. } else if (text === 4) {
  122. msg = '优惠金额'
  123. } else if (text === 5) {
  124. msg = '结账收款'
  125. } else if (text === 6) {
  126. msg = '商品'
  127. } else if (text === 7) {
  128. msg = '点餐'
  129. } else if (text === 8) {
  130. msg = '夜审房费'
  131. } else if (text === 9) {
  132. msg = '会议室'
  133. } else if (text === 10) {
  134. msg = '手工房费'
  135. } else if (text === 11) {
  136. msg = '水电煤抄表'
  137. } else if (text === 12) {
  138. msg = '赔偿费'
  139. } else if (text === 13) {
  140. msg = '退单结账'
  141. }
  142. return msg
  143. },
  144. handleBlur() {
  145. this.$forceUpdate()
  146. }
  147. }
  148. }
  149. </script>