account_list.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :getList="getList"
  5. :exportList="exportList"
  6. :operation="operation()"
  7. :optionsEvensGroup="optionsEvensGroup"
  8. :columnParsing="columnParsing"
  9. >
  10. <Popu v-if="visible">
  11. <AccountListDetail @close="handleClose" />
  12. </Popu>
  13. </template-page>
  14. </template>
  15. <script>
  16. import TemplatePage from '@/components/template/template-page-1.vue'
  17. import import_mixin from '@/components/template/import_mixin.js'
  18. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  19. import Popu from '@/components/template/popu.vue'
  20. import {
  21. getFinanceStandingBookList,
  22. getFinanceStandingBookListV2,
  23. getFinanceStandingBookCheck,
  24. getCustomerList,
  25. getWalletCustomerList
  26. } from '@/api/finance/account_list'
  27. import AccountListDetail from './components/account_list-detail'
  28. export default {
  29. components: { TemplatePage, Popu, AccountListDetail },
  30. mixins: [import_mixin, add_callback_mixin],
  31. data() {
  32. return {
  33. visible: false,
  34. // 事件组合
  35. optionsEvensGroup: [
  36. [
  37. [
  38. {
  39. name: '一键对账',
  40. click: this.reconciliationFn
  41. }
  42. ]
  43. ],
  44. [
  45. [
  46. {
  47. name: '记录',
  48. click: this.recordFn
  49. }
  50. ]
  51. ]
  52. ],
  53. // 表格属性
  54. tableAttributes: {
  55. // 启用勾选列
  56. selectColumn: true
  57. }, // 关闭新增弹窗
  58. // 表格事件
  59. tableEvents: {
  60. 'selection-change': this.selectionChange
  61. },
  62. recordSelected: []
  63. }
  64. },
  65. methods: {
  66. // 列表请求函数
  67. getList(...p) {
  68. this.recordSelected = []
  69. return getFinanceStandingBookListV2(...p)
  70. },
  71. // 列表导出函数
  72. exportList: ()=>{},
  73. // 表格列解析渲染数据更改
  74. columnParsing(item, defaultData) {
  75. return defaultData
  76. },
  77. // 监听勾选变化
  78. selectionChange(data) {
  79. this.recordSelected = data
  80. },
  81. operation() {
  82. return (h, { row, index, column }) => {
  83. return (
  84. <div class="operation-btns">
  85. {/* <el-button
  86. size="mini"
  87. type="text"
  88. onClick={() => {
  89. this.visible = true
  90. this.detailsId = row.id
  91. }}
  92. >
  93. 查看
  94. </el-button> */}
  95. </div>
  96. )
  97. }
  98. },
  99. handleClose() {
  100. this.addOff(() => {
  101. this.visible = false
  102. })()
  103. },
  104. //合计
  105. getSummaries(param) {
  106. const { columns, data } = param
  107. const sums = []
  108. columns.forEach((column, index) => {
  109. if (index === 0) {
  110. sums[index] = '合计'
  111. }
  112. if (index === 10) {
  113. let arr = []
  114. data.forEach(v => {
  115. if (v.amountType == 'OUT') {
  116. arr.push(-v.amount)
  117. } else {
  118. arr.push(v.amount)
  119. }
  120. })
  121. let a = arr.reduce((prev, curr) => {
  122. const value = Number(curr)
  123. if (!isNaN(value)) {
  124. return prev + curr
  125. } else {
  126. return prev
  127. }
  128. }, 0)
  129. sums[index] = numToFixed(a)
  130. }
  131. })
  132. return sums
  133. },
  134. //改变经销商
  135. async changeFn(v) {
  136. this.searchForm.customerWalletId = ''
  137. let res = await getWalletCustomerList({ customerId: v })
  138. this.walletList = res.data
  139. },
  140. //获取经销商数据
  141. async getCustomerDataList(data) {
  142. const res = await getCustomerList(data)
  143. this.customerList = res.data.records
  144. },
  145. //记录
  146. recordFn() {
  147. this.visible = true
  148. },
  149. //一键对账
  150. async reconciliationFn() {
  151. const res = await getFinanceStandingBookList({
  152. pageSize: -1,
  153. pageNum: 1
  154. })
  155. let arr = res.data.records
  156. let ids = arr.map(v => v.id)
  157. console.log(ids)
  158. await getFinanceStandingBookCheck({ ids: ids.toString() })
  159. this.$message.success('对账成功')
  160. },
  161. seeFN() {
  162. this.showDetail = false
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped></style>