flowIndex.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <a-drawer :title="title" :width="850" :open="visible" :destroy-on-close="true" @close="onClose">
  3. <a-card :bordered="false">
  4. <s-table
  5. ref="tableRef"
  6. :columns="columns"
  7. :data="loadData"
  8. bordered
  9. :row-key="(record) => record.id"
  10. >
  11. <template #operator class="table-operator">
  12. <a-space>
  13. <a-button type="primary" @click="rechargeFormRef.onOpen(null, serviceCustomerId, scAccountId)" v-if="hasPerm('bizServiceCustomerFlowRecharge')">
  14. <template #icon><plus-outlined /></template>
  15. 充值
  16. </a-button>
  17. <a-button type="primary" @click="consumeFormRef.onOpen(null, serviceCustomerId, scAccountId)" v-if="hasPerm('bizServiceCustomerFlowConsume')">
  18. <template #icon><minus-outlined /></template>
  19. 扣费
  20. </a-button>
  21. </a-space>
  22. </template>
  23. <template #bodyCell="{ column, record, index }">
  24. <template v-if="column.dataIndex === 'serial'">
  25. {{ index + 1 }}
  26. </template>
  27. <template v-if="column.dataIndex === 'action'">
  28. <a-space>
  29. <a @click="cancelRef.onOpen(record, serviceCustomerId, scAccountId)" v-if="hasPerm('bizServiceCustomerFlowCancel')">取消</a>
  30. </a-space>
  31. </template>
  32. </template>
  33. </s-table>
  34. </a-card>
  35. </a-drawer>
  36. <RechargeForm ref="rechargeFormRef" @successful="tableRef.refresh()" />
  37. <ConsumeForm ref="consumeFormRef" @successful="tableRef.refresh()" />
  38. <CancelForm ref="cancelRef" @successful="tableRef.refresh()" />
  39. </template>
  40. <script setup name="bizservicecustomeraccount">
  41. import { cloneDeep } from 'lodash-es'
  42. import RechargeForm from './flowRechargeForm.vue'
  43. import ConsumeForm from './flowConsumeForm.vue'
  44. import CancelForm from './flowCancelForm.vue'
  45. import bizServiceCustomerFlowApi from '@/api/biz/bizServiceCustomerFlowApi'
  46. import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
  47. import {Modal} from 'ant-design-vue';
  48. import {createVNode} from 'vue';
  49. const submitLoading = ref(false)
  50. const toolConfig = { refresh: true, height: false, columnSetting: false, striped: false }
  51. // 默认是关闭状态
  52. const visible = ref(false)
  53. const searchFormState = ref({})
  54. const tableRef = ref()
  55. const rechargeFormRef = ref()
  56. const consumeFormRef = ref()
  57. const cancelRef = ref()
  58. const recordData = ref()
  59. const title = ref()
  60. const serviceCustomerId = ref()
  61. const scAccountId = ref()
  62. const columns = [
  63. {
  64. title: '序号',
  65. width: 50,
  66. dataIndex: 'serial',
  67. align:'center'
  68. },
  69. {
  70. title: '操作类型',
  71. width: 100,
  72. dataIndex: 'operateType',
  73. align:'center'
  74. },
  75. {
  76. title: '操作前余额',
  77. width: 150,
  78. dataIndex: 'operateAmountBegin',
  79. align:'center'
  80. },
  81. {
  82. title: '操作金额',
  83. width: 150,
  84. dataIndex: 'operateAmount',
  85. align:'center'
  86. },
  87. {
  88. title: '操作后余额',
  89. width: 150,
  90. dataIndex: 'operateAmountAfter',
  91. align:'center'
  92. },
  93. {
  94. title: '操作时间',
  95. width: 180,
  96. dataIndex: 'createTime',
  97. align: 'center'
  98. },
  99. ]
  100. // 操作栏通过权限判断是否显示
  101. if (hasPerm(['bizServiceCustomerFlowCancel'])) {
  102. columns.push({
  103. title: '操作',
  104. dataIndex: 'action',
  105. align: 'center',
  106. width: 100
  107. })
  108. }
  109. // 打开抽屉
  110. const onOpen = (record, scId) => {
  111. recordData.value = record
  112. title.value = "【" + record.loginAccount + "】-账户流水管理"
  113. searchFormState.value = {
  114. serviceCustomerId: scId,
  115. scAccountId: record.id
  116. }
  117. serviceCustomerId.value = scId
  118. scAccountId.value = record.id
  119. visible.value = true
  120. }
  121. const loadData = (parameter) => {
  122. return bizServiceCustomerFlowApi.bizServiceCustomerFlowPage(Object.assign(parameter, searchFormState.value)).then((data) => {
  123. return data
  124. })
  125. }
  126. // 关闭抽屉
  127. const onClose = () => {
  128. visible.value = false
  129. }
  130. // 删除
  131. const deleteConfig = (record) => {
  132. Modal.confirm({
  133. title: '确定删除该数据吗?',
  134. icon: createVNode(ExclamationCircleOutlined),
  135. content: '',
  136. onOk() {
  137. submitLoading.value = true
  138. let params = [
  139. {
  140. id: record.id
  141. }
  142. ]
  143. bizServiceCustomerFlowApi
  144. .bizServiceCustomerFlowDelete(params)
  145. .then(() => {
  146. tableRef.value.refresh(true)
  147. })
  148. .finally(() => {
  149. submitLoading.value = false
  150. })
  151. },
  152. onCancel() {}
  153. })
  154. }
  155. // 调用这个函数将子组件的一些数据和方法暴露出去
  156. defineExpose({
  157. onOpen
  158. })
  159. </script>