teamManage.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813
  1. <template>
  2. <div class="form-wrap">
  3. <el-tabs v-model="activeTab">
  4. <el-tab-pane label="团队管理" name="teamManage">
  5. <el-form
  6. class="search-box"
  7. ref="form"
  8. :model="form"
  9. :inline="true"
  10. >
  11. <div class="block-title">
  12. 查询条件
  13. </div>
  14. <el-form-item
  15. label="团队名称"
  16. prop="name">
  17. <el-input v-model="form.name" clearable></el-input>
  18. </el-form-item>
  19. <el-form-item
  20. label="联系人"
  21. prop="contactName">
  22. <el-input v-model="form.contactName" clearable></el-input>
  23. </el-form-item>
  24. <el-form-item
  25. label="联系方式"
  26. prop="contactPhone">
  27. <el-input v-model="form.contactPhone" clearable></el-input>
  28. </el-form-item>
  29. <el-form-item
  30. label="备注"
  31. prop="remark">
  32. <el-input v-model="form.remark" clearable></el-input>
  33. </el-form-item>
  34. <div class="btn-wrap">
  35. <el-button
  36. @click="reset">
  37. 重置
  38. </el-button>
  39. <el-button
  40. type="primary"
  41. @click="getList(true)">
  42. 搜索
  43. </el-button>
  44. <el-button
  45. type="primary"
  46. @click="openAddDialog">
  47. 新增团队
  48. </el-button>
  49. <el-button
  50. type="primary"
  51. @click="reportExport">
  52. 导出
  53. </el-button>
  54. </div>
  55. </el-form>
  56. <div class="table-box">
  57. <el-table
  58. border
  59. v-loading="loading"
  60. :data="tableData">
  61. <el-table-column
  62. prop="name"
  63. label="团队名称">
  64. </el-table-column>
  65. <el-table-column
  66. prop="contactName"
  67. label="联系人">
  68. </el-table-column>
  69. <el-table-column
  70. prop="contactPhone"
  71. label="联系方式">
  72. </el-table-column>
  73. <el-table-column
  74. prop="balance"
  75. label="余额">
  76. </el-table-column>
  77. <el-table-column
  78. prop="creditLimit"
  79. label="授信额度">
  80. </el-table-column>
  81. <el-table-column
  82. prop="debtAmount"
  83. width="130">
  84. <template slot="header">
  85. 当前总欠款
  86. <Tip msg="授信支付未还总额"></Tip>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. prop="debtNums"
  91. width="130">
  92. <template slot="header">
  93. 当前总欠款单数
  94. <Tip msg="授信支付未还总数"></Tip>
  95. </template>
  96. </el-table-column>
  97. <el-table-column
  98. prop="remark"
  99. label="备注">
  100. </el-table-column>
  101. <el-table-column
  102. width="350px"
  103. label="操作">
  104. <template slot-scope="scope">
  105. <div v-if="hasPermission('team-money-manage')">
  106. <el-link
  107. type="primary"
  108. @click="openRechargeDialog(scope.row)"
  109. >
  110. 充值
  111. </el-link>
  112. <el-link
  113. type="primary"
  114. @click="openDeductDialog(scope.row)"
  115. >
  116. 扣款
  117. </el-link>
  118. <el-link
  119. type="primary"
  120. @click="openRepaymentDialog(scope.row)"
  121. >
  122. 还款
  123. </el-link>
  124. <el-link
  125. type="primary"
  126. @click="openAdjustDialog(scope.row)"
  127. >
  128. 调整授信额度
  129. </el-link>
  130. </div>
  131. <div>
  132. <el-link
  133. type="primary"
  134. @click="gotoRecord(scope.row)"
  135. >
  136. 账户记录
  137. </el-link>
  138. <el-link
  139. type="primary"
  140. @click="openEditDialog(scope.row)"
  141. >
  142. 编辑
  143. </el-link>
  144. <el-link
  145. type="primary"
  146. @click="deleteGroup(scope.row)"
  147. >
  148. 删除
  149. </el-link>
  150. </div>
  151. </template>
  152. </el-table-column>
  153. </el-table>
  154. <el-pagination
  155. background
  156. layout="total, sizes, prev, pager, next, jumper"
  157. :current-page.sync="form.pageNum"
  158. :page-sizes="[10, 20, 50, 100]"
  159. :page-size="form.pageSize"
  160. @size-change="handleSizeChange"
  161. @current-change="getList()"
  162. :total="total"
  163. >
  164. </el-pagination>
  165. </div>
  166. </el-tab-pane>
  167. <el-tab-pane label="账户记录" name="accountFlow">
  168. <TeamAccountFlow v-if="activeTab === 'accountFlow'" :teamId="selectedTeamId" :teamName="selectedTeamName" />
  169. </el-tab-pane>
  170. </el-tabs>
  171. <!-- 新增/编辑团队弹框 -->
  172. <ElDialog
  173. :title="`${currentItem.id ? '编辑' : '新增'}团队`"
  174. width="500px"
  175. v-model="dialogVisible"
  176. >
  177. <el-form
  178. inline
  179. :model="currentItem"
  180. ref="editForm"
  181. class="form-wrap"
  182. label-width="150px"
  183. style="margin-top: 20px">
  184. <el-form-item
  185. label="团队名称"
  186. verify
  187. prop="name">
  188. <el-input v-model="currentItem.name"></el-input>
  189. </el-form-item>
  190. <el-form-item
  191. label="联系人"
  192. prop="contactName">
  193. <el-input v-model="currentItem.contactName"></el-input>
  194. </el-form-item>
  195. <el-form-item
  196. label="联系方式"
  197. prop="contactPhone">
  198. <el-input v-model="currentItem.contactPhone"></el-input>
  199. </el-form-item>
  200. <el-form-item
  201. v-if="!currentItem.id"
  202. label="余额"
  203. prop="balance">
  204. <el-input-number v-model="currentItem.balance" :precision="2" :step="1" :controls="false" style="width: 200px"></el-input-number>
  205. </el-form-item>
  206. <el-form-item
  207. v-if="!currentItem.id"
  208. label="授信额度"
  209. prop="creditLimit">
  210. <el-input-number v-model="currentItem.creditLimit" :min="0" :precision="2" :step="100" :controls="false" style="width: 200px"></el-input-number>
  211. </el-form-item>
  212. <el-form-item
  213. label="备注"
  214. prop="remark">
  215. <el-input v-model="currentItem.remark"></el-input>
  216. </el-form-item>
  217. </el-form>
  218. <div style="margin: 20px; float: right;">
  219. <el-button @click="dialogVisible = false">取消</el-button>
  220. <el-button type="primary" @click="confirmOptGroup">确定</el-button>
  221. </div>
  222. </ElDialog>
  223. <!-- 充值弹框 -->
  224. <ElDialog
  225. title="充值"
  226. width="500px"
  227. v-model="rechargeDialogVisible"
  228. >
  229. <el-form
  230. inline
  231. :model="moneyForm"
  232. ref="moneyForm"
  233. class="form-wrap"
  234. label-width="150px"
  235. style="margin-top: 20px">
  236. <el-form-item
  237. label="充值金额"
  238. verify
  239. prop="amount">
  240. <el-input-number v-model="moneyForm.amount" :min="undefined" :precision="2" :step="1"></el-input-number>
  241. </el-form-item>
  242. <el-form-item
  243. label="备注"
  244. prop="remark">
  245. <el-input v-model="moneyForm.remark"></el-input>
  246. </el-form-item>
  247. </el-form>
  248. <div style="margin: 20px; float: right;">
  249. <el-button @click="rechargeDialogVisible = false">取消</el-button>
  250. <el-button type="primary" @click="confirmRecharge">确定</el-button>
  251. </div>
  252. </ElDialog>
  253. <!-- 扣款弹框 -->
  254. <ElDialog
  255. title="扣款"
  256. width="500px"
  257. v-model="deductDialogVisible"
  258. >
  259. <el-form
  260. inline
  261. :model="moneyForm"
  262. ref="deductForm"
  263. class="form-wrap"
  264. label-width="150px"
  265. style="margin-top: 20px">
  266. <el-form-item
  267. label="扣款金额"
  268. verify
  269. prop="amount">
  270. <el-input-number v-model="moneyForm.amount" :min="0.01" :precision="2" :step="1"></el-input-number>
  271. </el-form-item>
  272. <el-form-item
  273. label="备注"
  274. prop="remark">
  275. <el-input v-model="moneyForm.remark"></el-input>
  276. </el-form-item>
  277. </el-form>
  278. <div style="margin: 20px; float: right;">
  279. <el-button @click="deductDialogVisible = false">取消</el-button>
  280. <el-button type="primary" @click="confirmDeduct">确定</el-button>
  281. </div>
  282. </ElDialog>
  283. <!-- 调整授信额度弹框 -->
  284. <ElDialog
  285. title="调整授信额度"
  286. width="500px"
  287. v-model="adjustDialogVisible"
  288. >
  289. <el-form
  290. inline
  291. :model="adjustForm"
  292. ref="adjustForm"
  293. class="form-wrap"
  294. label-width="150px"
  295. style="margin-top: 20px">
  296. <el-form-item
  297. label="调整后额度"
  298. verify
  299. prop="amount">
  300. <el-input-number v-model="adjustForm.amount" :min="0" :precision="2" :step="100"></el-input-number>
  301. </el-form-item>
  302. <el-form-item
  303. label="备注"
  304. prop="remark">
  305. <el-input v-model="adjustForm.remark"></el-input>
  306. </el-form-item>
  307. </el-form>
  308. <div style="margin: 20px; float: right;">
  309. <el-button @click="adjustDialogVisible = false">取消</el-button>
  310. <el-button type="primary" @click="confirmAdjust">确定</el-button>
  311. </div>
  312. </ElDialog>
  313. <!-- 还款弹框 -->
  314. <ElDialog
  315. title="还款"
  316. width="1300px"
  317. v-model="repaymentDialogVisible"
  318. @close="handleRepaymentClose"
  319. >
  320. <div class="dialog-body-scroll">
  321. <div class="transfer-container">
  322. <div class="transfer-left">
  323. <div class="transfer-header">
  324. 欠款记录
  325. <el-button
  326. type="primary"
  327. size="small"
  328. :disabled="!leftCheckedList.length"
  329. @click="addToSelected"
  330. style="float: right;"
  331. >
  332. 添加至已选 &gt;&gt;
  333. </el-button>
  334. </div>
  335. <el-table
  336. border
  337. ref="debtTableRef"
  338. :data="debtList"
  339. v-loading="debtLoading"
  340. @selection-change="onDebtSelectionChange"
  341. size="small"
  342. >
  343. <el-table-column type="selection" width="40" />
  344. <el-table-column prop="operateTime" label="操作时间" width="140" />
  345. <el-table-column prop="teamName" label="团队名称" width="110" show-overflow-tooltip />
  346. <el-table-column label="交易类型" width="120">
  347. <template slot-scope="scope">
  348. {{ formatTransactionType(scope.row.transactionType) }}
  349. </template>
  350. </el-table-column>
  351. <el-table-column prop="amount" label="交易金额" width="100" />
  352. <el-table-column prop="remainingDebt" label="剩余欠款" width="100" />
  353. <el-table-column prop="balanceBefore" label="交易前余额" width="100" />
  354. <el-table-column prop="balanceAfter" label="交易后余额" width="100" />
  355. <el-table-column prop="debtAmountBefore" label="欠款调整前" width="100" />
  356. <el-table-column prop="debtAmountAfter" label="欠款调整后" width="100" />
  357. <el-table-column prop="creditLimitBefore" label="额度调整前" width="100" />
  358. <el-table-column prop="creditLimitAfter" label="额度调整后" width="100" />
  359. <el-table-column prop="ticketCheckNum" label="票总人数" width="80" />
  360. <el-table-column prop="price" label="订单总额" width="100" />
  361. <el-table-column prop="ticketCancelCheckNum" label="退票人数" width="80" />
  362. <el-table-column prop="cancelPrice" label="退票总额" width="100" />
  363. <el-table-column prop="operatorName" label="操作员" width="90" />
  364. <el-table-column prop="linkOrderId" label="关联订单" width="80">
  365. <template slot-scope="scope">
  366. <el-link
  367. v-if="scope.row.linkOrderId"
  368. type="primary"
  369. @click="showOrderDetail(scope.row.linkOrderId)"
  370. >
  371. 查看
  372. </el-link>
  373. <span v-else>-</span>
  374. </template>
  375. </el-table-column>
  376. <el-table-column prop="remark" label="备注" min-width="120" show-overflow-tooltip />
  377. </el-table>
  378. <el-pagination
  379. background
  380. small
  381. layout="total, prev, pager, next"
  382. :current-page="debtPageNum"
  383. :page-size="debtPageSize"
  384. @current-change="handleDebtPageChange"
  385. :total="debtTotal"
  386. >
  387. </el-pagination>
  388. </div>
  389. <div class="transfer-right">
  390. <div class="transfer-header">
  391. 已选记录
  392. <el-button
  393. size="small"
  394. :disabled="!rightSelectedList.length"
  395. @click="clearSelected"
  396. style="float: right;"
  397. >
  398. 清除已选
  399. </el-button>
  400. </div>
  401. <el-table
  402. border
  403. :data="rightSelectedList"
  404. size="small"
  405. >
  406. <el-table-column type="index" label="序号" width="50" />
  407. <el-table-column prop="createTime" label="创建时间" width="140" />
  408. <el-table-column prop="teamName" label="团队名称" width="110" show-overflow-tooltip />
  409. <el-table-column label="交易类型" width="120">
  410. <template slot-scope="scope">
  411. {{ formatTransactionType(scope.row.transactionType) }}
  412. </template>
  413. </el-table-column>
  414. <el-table-column prop="amount" label="交易金额" width="100" />
  415. <el-table-column prop="remainingDebt" label="剩余欠款" width="100" />
  416. <el-table-column prop="balanceBefore" label="交易前余额" width="100" />
  417. <el-table-column prop="balanceAfter" label="交易后余额" width="100" />
  418. <el-table-column prop="debtAmountBefore" label="欠款调整前" width="100" />
  419. <el-table-column prop="debtAmountAfter" label="欠款调整后" width="100" />
  420. <el-table-column prop="creditLimitBefore" label="额度调整前" width="100" />
  421. <el-table-column prop="creditLimitAfter" label="额度调整后" width="100" />
  422. <el-table-column prop="ticketCheckNum" label="票总人数" width="80" />
  423. <el-table-column prop="price" label="订单总额" width="100" />
  424. <el-table-column prop="ticketCancelCheckNum" label="退票人数" width="80" />
  425. <el-table-column prop="cancelPrice" label="退票总额" width="100" />
  426. <el-table-column prop="operatorName" label="操作员" width="90" />
  427. <el-table-column prop="operateTime" label="操作时间" width="140" />
  428. <el-table-column prop="linkOrderId" label="关联订单" width="80">
  429. <template slot-scope="scope">
  430. <el-link
  431. v-if="scope.row.linkOrderId"
  432. type="primary"
  433. @click="showOrderDetail(scope.row.linkOrderId)"
  434. >
  435. 查看
  436. </el-link>
  437. <span v-else>-</span>
  438. </template>
  439. </el-table-column>
  440. <el-table-column prop="remark" label="备注" min-width="120" show-overflow-tooltip />
  441. <el-table-column label="操作" width="60" fixed="right">
  442. <template slot-scope="scope">
  443. <el-link type="danger" @click="removeSelectedItem(scope.row)">移除</el-link>
  444. </template>
  445. </el-table-column>
  446. </el-table>
  447. <div class="transfer-total">
  448. 还款总额:<span class="total-amount">¥ {{ totalRepaymentAmount }}</span>
  449. </div>
  450. </div>
  451. </div>
  452. <el-form class="form-wrap" label-width="80px" style="margin-top: 16px;">
  453. <el-form-item label="备注">
  454. <el-input v-model="repaymentForm.remark" placeholder="请输入还款备注" />
  455. </el-form-item>
  456. </el-form>
  457. </div>
  458. <div style="margin: 16px 0 0; float: right;">
  459. <el-button @click="repaymentDialogVisible = false">取消</el-button>
  460. <el-button type="primary" :disabled="!rightSelectedList.length" @click="confirmRepayment">确定还款</el-button>
  461. </div>
  462. </ElDialog>
  463. <OrderDetail ref="orderDetail"></OrderDetail>
  464. </div>
  465. </template>
  466. <script>
  467. import { getTeamList, addTeam, updateTeam, deleteTeam, teamRecharge, teamDeduct, teamAdjust, getDebtList, teamRepayment } from '@/api/checker'
  468. import ElDialog from '@/components/Dialog'
  469. const TeamAccountFlow = () => import('./TeamAccountFlow.vue')
  470. export default {
  471. data () {
  472. return {
  473. activeTab: 'teamManage',
  474. form: {
  475. name: '',
  476. pageNum: 1,
  477. pageSize: 10,
  478. contactName: '',
  479. contactPhone: '',
  480. remark: ''
  481. },
  482. loading: false,
  483. selectedTeamId: null,
  484. selectedTeamName: '',
  485. tableData: [],
  486. total: 0,
  487. dialogVisible: false,
  488. currentItem: {},
  489. rechargeDialogVisible: false,
  490. moneyForm: {
  491. teamId: null,
  492. amount: 0,
  493. remark: ''
  494. },
  495. deductDialogVisible: false,
  496. adjustDialogVisible: false,
  497. adjustForm: {
  498. teamId: null,
  499. amount: 0,
  500. remark: ''
  501. },
  502. repaymentDialogVisible: false,
  503. debtList: [],
  504. debtTotal: 0,
  505. debtPageNum: 1,
  506. debtPageSize: 10,
  507. debtLoading: false,
  508. leftCheckedList: [],
  509. rightSelectedList: [],
  510. repaymentForm: {
  511. teamId: null,
  512. remark: ''
  513. }
  514. }
  515. },
  516. computed: {
  517. scenicList () {
  518. return this.$store.state.app.scenicList
  519. },
  520. permissionList () {
  521. return this.$store.state.user.menuList || []
  522. },
  523. totalRepaymentAmount () {
  524. return this.rightSelectedList.reduce((sum, item) => sum + (item.remainingDebt || 0), 0)
  525. }
  526. },
  527. created () {
  528. this.getList()
  529. },
  530. components: {
  531. ElDialog,
  532. TeamAccountFlow
  533. },
  534. methods: {
  535. hasPermission (key) {
  536. return !!this.permissionList.some(item => item.code === key)
  537. },
  538. reset () {
  539. this.$refs.form.resetFields()
  540. },
  541. handleSizeChange (size) {
  542. this.form.pageSize = size
  543. this.getList()
  544. },
  545. getList (goFirst) {
  546. let params = { ...this.form }
  547. goFirst && (params.pageNum = 1)
  548. this.loading = true
  549. getTeamList(params).then(res => {
  550. const list = res.data?.records || []
  551. this.total = res.data?.total || 0
  552. this.tableData = list
  553. this.loading = false
  554. })
  555. },
  556. openAddDialog () {
  557. this.currentItem = {
  558. id: '',
  559. name: '',
  560. contactName: '',
  561. contactPhone: '',
  562. balance: 0,
  563. creditLimit: 0,
  564. remark: ''
  565. }
  566. this.dialogVisible = true
  567. },
  568. openEditDialog (item) {
  569. this.currentItem = Object.assign({}, item)
  570. this.dialogVisible = true
  571. },
  572. deleteGroup (data) {
  573. this.$confirm('确定删除团队吗?', '提示', {
  574. confirmButtonText: '确定',
  575. cancelButtonText: '取消',
  576. type: 'warning'
  577. }).then(() => {
  578. deleteTeam(data.id).then(res => {
  579. this.$message.success('操作成功')
  580. this.getList()
  581. })
  582. }).catch(() => {})
  583. },
  584. confirmOptGroup () {
  585. const opt = this.currentItem.id ? updateTeam : addTeam
  586. opt(this.currentItem).then(res => {
  587. this.$message.success('操作成功')
  588. this.dialogVisible = false
  589. this.getList()
  590. })
  591. },
  592. openRechargeDialog (row) {
  593. Object.assign(this.moneyForm, {
  594. teamId: row.id,
  595. amount: 0,
  596. remark: ''
  597. })
  598. this.rechargeDialogVisible = true
  599. },
  600. confirmRecharge () {
  601. teamRecharge(this.moneyForm).then(() => {
  602. this.$message.success('充值成功')
  603. this.rechargeDialogVisible = false
  604. this.getList()
  605. })
  606. },
  607. openDeductDialog (row) {
  608. Object.assign(this.moneyForm, {
  609. teamId: row.id,
  610. amount: 0,
  611. remark: ''
  612. })
  613. this.deductDialogVisible = true
  614. },
  615. confirmDeduct () {
  616. teamDeduct(this.moneyForm).then(() => {
  617. this.$message.success('扣款成功')
  618. this.deductDialogVisible = false
  619. this.getList()
  620. })
  621. },
  622. openAdjustDialog (row) {
  623. Object.assign(this.adjustForm, {
  624. teamId: row.id,
  625. amount: row.creditLimit || 0,
  626. remark: ''
  627. })
  628. this.adjustDialogVisible = true
  629. },
  630. confirmAdjust () {
  631. teamAdjust(this.adjustForm).then(() => {
  632. this.$message.success('调整授信额度成功')
  633. this.adjustDialogVisible = false
  634. this.getList()
  635. })
  636. },
  637. gotoRecord (row) {
  638. this.selectedTeamId = row.id
  639. this.selectedTeamName = row.name
  640. this.activeTab = 'accountFlow'
  641. },
  642. reportExport () {
  643. const params = {
  644. ...this.form,
  645. export: true
  646. }
  647. getTeamList(params).then(() => {
  648. this.$message.success('导出成功。')
  649. this.goToDownload()
  650. }).catch(() => {
  651. this.$message.error('导出失败。')
  652. })
  653. },
  654. openRepaymentDialog (row) {
  655. this.repaymentForm = {
  656. teamId: row.id,
  657. remark: ''
  658. }
  659. this.rightSelectedList = []
  660. this.leftCheckedList = []
  661. this.debtPageNum = 1
  662. this.debtList = []
  663. this.debtTotal = 0
  664. this.repaymentDialogVisible = true
  665. this.loadDebtList()
  666. },
  667. loadDebtList () {
  668. this.debtLoading = true
  669. const params = {
  670. id: 0,
  671. teamId: this.repaymentForm.teamId,
  672. pageNum: this.debtPageNum,
  673. pageSize: this.debtPageSize,
  674. export: false,
  675. exportDetail: false,
  676. removeSubtotal: false,
  677. remark: ''
  678. }
  679. getDebtList(params).then(res => {
  680. this.debtList = res.data?.records || []
  681. this.debtTotal = res.data?.total || 0
  682. }).finally(() => {
  683. this.debtLoading = false
  684. })
  685. },
  686. handleDebtPageChange (num) {
  687. this.debtPageNum = num
  688. this.loadDebtList()
  689. },
  690. onDebtSelectionChange (selection) {
  691. this.leftCheckedList = selection
  692. },
  693. formatTransactionType (type) {
  694. const map = {
  695. 'RECHARGE': '充值',
  696. 'DEDUCT': '扣款',
  697. 'PREPAY_PAY': '预付款支付',
  698. 'PREPAY_REFUND': '预付款退款',
  699. 'CREDIT_PAY': '授信支付',
  700. 'CREDIT_REFUND': '授信退款',
  701. 'REPAYMENT': '还款',
  702. 'ADJUST': '调整授信额度'
  703. }
  704. return map[type] || type || '-'
  705. },
  706. addToSelected () {
  707. const existingIds = this.rightSelectedList.map(item => item.id)
  708. const newItems = this.leftCheckedList.filter(item => !existingIds.includes(item.id))
  709. this.rightSelectedList = [...this.rightSelectedList, ...newItems]
  710. this.$message.success(`已添加 ${newItems.length} 条欠款记录`)
  711. this.$refs.debtTableRef && this.$refs.debtTableRef.clearSelection()
  712. },
  713. removeSelectedItem (row) {
  714. this.rightSelectedList = this.rightSelectedList.filter(item => item.id !== row.id)
  715. },
  716. clearSelected () {
  717. this.rightSelectedList = []
  718. },
  719. handleRepaymentClose () {
  720. this.$refs.debtTableRef && this.$refs.debtTableRef.clearSelection()
  721. this.leftCheckedList = []
  722. },
  723. async showOrderDetail (orderId) {
  724. const { getSingleOrder } = await import('@/api/order')
  725. const res = await getSingleOrder(orderId)
  726. this.$refs.orderDetail.show(res.data)
  727. },
  728. confirmRepayment () {
  729. if (!this.rightSelectedList.length) {
  730. this.$message.warning('请先选择欠款记录')
  731. return
  732. }
  733. const debtList = this.rightSelectedList.map(item => ({
  734. flowId: item.id,
  735. amount: item.remainingDebt
  736. }))
  737. const params = {
  738. teamId: this.repaymentForm.teamId,
  739. amount: this.totalRepaymentAmount,
  740. remark: this.repaymentForm.remark,
  741. debtList
  742. }
  743. teamRepayment(params).then(() => {
  744. this.$message.success('还款成功')
  745. this.repaymentDialogVisible = false
  746. this.getList()
  747. })
  748. }
  749. }
  750. }
  751. </script>
  752. <style scoped>
  753. .dialog-body-scroll {
  754. max-height: 60vh;
  755. overflow-y: auto;
  756. padding-right: 4px;
  757. }
  758. .transfer-container {
  759. display: block;
  760. }
  761. .transfer-left,
  762. .transfer-right {
  763. border: 1px solid #ebeef5;
  764. border-radius: 4px;
  765. padding: 12px;
  766. margin-bottom: 16px;
  767. }
  768. .transfer-right {
  769. margin-bottom: 0;
  770. }
  771. .transfer-header {
  772. font-weight: bold;
  773. margin-bottom: 10px;
  774. padding-bottom: 8px;
  775. border-bottom: 1px solid #ebeef5;
  776. font-size: 14px;
  777. color: #303133;
  778. overflow: hidden;
  779. }
  780. .transfer-total {
  781. margin-top: 12px;
  782. text-align: right;
  783. font-size: 14px;
  784. font-weight: bold;
  785. color: #303133;
  786. padding: 8px 4px;
  787. border-top: 1px solid #ebeef5;
  788. }
  789. .total-amount {
  790. color: #f56c6c;
  791. font-size: 18px;
  792. }
  793. </style>