You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

834 lines
26 KiB

3 months ago
3 months ago
16 hours ago
3 months ago
7 days ago
7 days ago
3 months ago
3 months ago
7 days ago
7 days ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 weeks ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 weeks ago
2 weeks ago
16 hours ago
2 weeks ago
2 weeks ago
16 hours ago
2 weeks ago
16 hours ago
2 weeks ago
16 hours ago
2 weeks ago
2 weeks ago
16 hours ago
16 hours ago
2 weeks ago
16 hours ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
16 hours ago
2 weeks ago
16 hours ago
2 weeks ago
2 weeks ago
2 weeks ago
7 days ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 weeks ago
2 weeks ago
3 months ago
3 months ago
3 months ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 weeks ago
1 week ago
2 weeks ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 weeks ago
1 week ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
3 months ago
  1. <script setup>
  2. import { ref, reactive, onMounted, toRefs, nextTick, computed, watch, onBeforeUnmount } from 'vue'
  3. import { ElMessage, ElMessageBox } from 'element-plus'
  4. import request from '@/util/http.js'
  5. import dayjs from 'dayjs'
  6. import Decimal from 'decimal.js'
  7. import { useI18n } from 'vue-i18n'
  8. import { refundOnline, performanceSelect, exportPerformance, adjustment } from '@/api/cash/financialAccount.js'
  9. import { getUserInfo } from '@/api/common/common.js'
  10. import { useAdminStore } from '@/store/index.js'
  11. import { permissionMapping, hasMenuPermission } from "@/utils/menuTreePermission.js"
  12. import { storeToRefs } from 'pinia'
  13. const adminStore = useAdminStore()
  14. const { menuTree, flag } = storeToRefs(adminStore)
  15. const adminData = ref({})
  16. const { t } = useI18n()
  17. const paytypeList = [
  18. t('cash.payMethods.stripe'),
  19. t('cash.payMethods.paymentAsia'),
  20. t('cash.payMethods.ipay88'),
  21. t('cash.payMethods.bankTransfer'),
  22. t('cash.payMethods.card'),
  23. t('cash.payMethods.cash'),
  24. t('cash.payMethods.check'),
  25. t('cash.payMethods.grabpay'),
  26. t('cash.payMethods.nets'),
  27. t('cash.payMethods.transfer'),
  28. t('cash.payMethods.iotPay'),
  29. t('cash.payMethods.stripe3'),
  30. t('cash.payMethods.paypal'),
  31. ]
  32. const hasperformanceAdjustment = ref(false)
  33. // 初始化权限状态
  34. const initPermissions = async () => {
  35. if (!menuTree.value || !menuTree.value.length) return;
  36. // 业绩调整
  37. hasperformanceAdjustment.value = hasMenuPermission(menuTree.value, permissionMapping.performance_adjustment);
  38. console.log('业绩调整权限', hasperformanceAdjustment.value);
  39. };
  40. const payPlatformOptions = ref([...paytypeList])
  41. const statusOptions = [
  42. { label: t('cash.statusList.received'), value: 4 },
  43. { label: t('cash.statusList.refunded'), value: 6 }
  44. ]
  45. // 地区树
  46. const marketOptions = ref([])
  47. // 查询参数
  48. const queryParams = reactive({
  49. jwcode: '',
  50. adminMarket: [], // 下拉多选
  51. timeRange: [], // [startTime, endTime]
  52. customerMarket: [], // 客户地区
  53. pageNum: 1,
  54. pageSize: 20
  55. })
  56. const total = ref(0)
  57. const tableData = ref([])
  58. const tableRef = ref(null)
  59. const scrollTableTop = () => {
  60. tableRef.value?.setScrollTop?.(0)
  61. }
  62. const loading = ref(false)
  63. // 转换树形结构(参考 coinConsumeDetail.vue)
  64. const transformTree = (nodes) => {
  65. const allChildren = nodes.flatMap(node => node.children || []);
  66. return allChildren.map(child => {
  67. const grandchildren = child.children && child.children.length
  68. ? transformTree([child])
  69. : null;
  70. return {
  71. value: child.id,
  72. label: child.name,
  73. children: grandchildren
  74. };
  75. });
  76. };
  77. // 获取地区数据
  78. const getMarket = async () => {
  79. try {
  80. const result = await request({ url: '/market/selectMarket' });
  81. if (result && result.data) {
  82. marketOptions.value = transformTree(result.data)
  83. console.log('地区树:', marketOptions.value)
  84. }
  85. } catch (error) {
  86. console.error('获取地区失败', error)
  87. }
  88. }
  89. // 递归遍历地区树寻找匹配的 ID
  90. const findIdsByNames = (nodes, names, resultIds) => {
  91. if (!nodes || nodes.length === 0) return;
  92. nodes.forEach(node => {
  93. if (names.includes(node.label)) {
  94. resultIds.push(node.value);
  95. }
  96. if (node.children) {
  97. findIdsByNames(node.children, names, resultIds);
  98. }
  99. });
  100. };
  101. // 查询列表
  102. const fetchData = async () => {
  103. loading.value = true
  104. try {
  105. // 将 adminData 中的名称列表转换为 ID 列表
  106. const adminMarketNames = adminData.value.marketName?.split(',').map(item => item.trim()).filter(Boolean) || [];
  107. const adminMarketIds = [];
  108. findIdsByNames(marketOptions.value, adminMarketNames, adminMarketIds);
  109. // 构建请求参数
  110. console.log('adminData.value.markets:', adminData.value.markets)
  111. const params = {
  112. pageNum: queryParams.pageNum,
  113. pageSize: queryParams.pageSize,
  114. performanceDTO: {
  115. jwcode: queryParams.jwcode,
  116. adminMarket: adminMarketIds,
  117. customerMarket: queryParams.customerMarket,
  118. startTime: queryParams.timeRange?.[0] ? dayjs(queryParams.timeRange[0]).format('YYYY-MM-DD HH:mm:ss') : '',
  119. endTime: queryParams.timeRange?.[1] ? dayjs(queryParams.timeRange[1]).format('YYYY-MM-DD HH:mm:ss') : '',
  120. }
  121. }
  122. console.log('查询参数:', params)
  123. const res = await performanceSelect(params)
  124. if (res.code == 200) {
  125. tableData.value = res.data.list || []
  126. await nextTick()
  127. scrollTableTop()
  128. total.value = res.data.total || 0
  129. loading.value = false
  130. } else {
  131. ElMessage.error(res.msg || t('elmessage.getDataFailed'))
  132. loading.value = false
  133. }
  134. } catch (error) {
  135. console.error(error)
  136. loading.value = false
  137. ElMessage.error(t('elmessage.getDataFailed'))
  138. }
  139. }
  140. const handleAdminInfo = async () => {
  141. try {
  142. const res = await getUserInfo()
  143. adminData.value = res || {}
  144. console.log('adminData.value:', adminData.value);
  145. } catch (error) {
  146. console.error(error)
  147. ElMessage.error(t('elmessage.getDataFailed'))
  148. }
  149. }
  150. const handleSearch = () => {
  151. queryParams.pageNum = 1
  152. fetchData()
  153. }
  154. const handleReset = () => {
  155. queryParams.jwcode = ''
  156. queryParams.adminMarket = []
  157. queryParams.timeRange = null
  158. queryParams.customerMarket = []
  159. handleSearch()
  160. }
  161. const handlePageSizeChange = (val) => {
  162. queryParams.pageSize = val
  163. fetchData()
  164. }
  165. const handleCurrentChange = (val) => {
  166. queryParams.pageNum = val
  167. fetchData()
  168. }
  169. // 退款操作
  170. const handleRefund = (row) => {
  171. ElMessageBox.confirm(t('elmessage.refundConfirmContent', { orderNo: row.systemTradeNo }), t('elmessage.refundConfirmTitle'), {
  172. confirmButtonText: t('common.confirm'),
  173. cancelButtonText: t('common.cancel'),
  174. type: 'warning'
  175. }).then(() => {
  176. ElMessage.success(t('elmessage.refundSubmitSuccess'))
  177. // 刷新列表
  178. fetchData()
  179. }).catch(() => { })
  180. }
  181. // ==================== 导出相关逻辑 ====================
  182. const exportListVisible = ref(false)
  183. const EXPORT_LIST_POLL_INTERVAL = 3000
  184. let exportListPollingTimer = null
  185. const exportList = ref([])
  186. const exportListLoading = ref(false)
  187. const exportListRequesting = ref(false)
  188. const sortExportList = (list = []) => {
  189. return [...list].sort((a, b) => {
  190. return dayjs(b.createTime).valueOf() - dayjs(a.createTime).valueOf()
  191. })
  192. }
  193. const hasPendingExportTask = (list = []) => {
  194. const latestTask = sortExportList(list)[0]
  195. return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
  196. }
  197. const stopExportListPolling = () => {
  198. if (exportListPollingTimer) {
  199. clearInterval(exportListPollingTimer)
  200. exportListPollingTimer = null
  201. }
  202. }
  203. const startExportListPolling = () => {
  204. if (exportListPollingTimer) {
  205. return
  206. }
  207. exportListPollingTimer = setInterval(() => {
  208. if (!exportListVisible.value) {
  209. stopExportListPolling()
  210. return
  211. }
  212. getExportList({ showLoading: false, silentError: true })
  213. }, EXPORT_LIST_POLL_INTERVAL)
  214. }
  215. // 导出Excel
  216. const handleExport = async () => {
  217. try {
  218. const adminMarketNames = adminData.value.marketName?.split(',').map(item => item.trim()).filter(Boolean) || [];
  219. const adminMarketIds = [];
  220. findIdsByNames(marketOptions.value, adminMarketNames, adminMarketIds);
  221. const params = {
  222. pageNum: queryParams.pageNum,
  223. pageSize: queryParams.pageSize,
  224. performanceDTO: {
  225. jwcode: queryParams.jwcode,
  226. adminMarket: adminMarketIds,
  227. customerMarket: queryParams.customerMarket,
  228. startTime: queryParams.timeRange?.[0] ? dayjs(queryParams.timeRange[0]).format('YYYY-MM-DD HH:mm:ss') : '',
  229. endTime: queryParams.timeRange?.[1] ? dayjs(queryParams.timeRange[1]).format('YYYY-MM-DD HH:mm:ss') : '',
  230. }
  231. }
  232. // TODO: 确认导出接口 URL
  233. const res = await exportPerformance(params)
  234. if (res.code == 200) {
  235. console.log('导出参数', params)
  236. ElMessage.success(t('elmessage.exportSuccess'))
  237. }
  238. } catch (error) {
  239. console.error(error)
  240. ElMessage.error(t('elmessage.exportError'))
  241. }
  242. }
  243. // 打开导出列表弹窗
  244. const openExportList = () => {
  245. exportListVisible.value = true
  246. }
  247. // 获取导出列表
  248. const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
  249. if (exportListRequesting.value) {
  250. return
  251. }
  252. if (showLoading) {
  253. exportListLoading.value = true
  254. }
  255. exportListRequesting.value = true
  256. try {
  257. const result = await request({ url: '/export/export' })
  258. if (result.code === 200) {
  259. const filteredData = result.data.filter(item => item.type == 14);
  260. exportList.value = sortExportList(filteredData || [])
  261. if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
  262. startExportListPolling()
  263. } else {
  264. stopExportListPolling()
  265. }
  266. } else {
  267. stopExportListPolling()
  268. if (!silentError) {
  269. ElMessage.error(result.msg || t('elmessage.getExportListError'))
  270. }
  271. }
  272. } catch (error) {
  273. console.error('获取导出列表出错:', error)
  274. stopExportListPolling()
  275. if (!silentError) {
  276. ElMessage.error(t('elmessage.getExportListError'))
  277. }
  278. } finally {
  279. exportListRequesting.value = false
  280. if (showLoading) {
  281. exportListLoading.value = false
  282. }
  283. }
  284. }
  285. // 下载导出文件
  286. const downloadExportFile = (item) => {
  287. if (item.state === 2) {
  288. const link = document.createElement('a')
  289. link.href = item.url
  290. link.download = item.fileName
  291. link.click()
  292. } else {
  293. ElMessage.warning(t('elmessage.exportingInProgress'))
  294. }
  295. }
  296. // 根据状态返回对应的标签类型
  297. const getTagType = (state) => {
  298. switch (state) {
  299. case 0: return 'info';
  300. case 1: return 'primary';
  301. case 2: return 'success';
  302. case 3: return 'danger';
  303. default: return 'info';
  304. }
  305. }
  306. // 根据状态返回对应的标签文案
  307. const getTagText = (state) => {
  308. switch (state) {
  309. case 0: return t('elmessage.pendingExecution');
  310. case 1: return t('elmessage.executing');
  311. case 2: return t('elmessage.executed');
  312. case 3: return t('elmessage.errorExecution');
  313. default: return t('elmessage.unknownStatus');
  314. }
  315. }
  316. // ==================== 业绩调整弹窗相关逻辑 ====================
  317. const adjustVisible = ref(false)
  318. const adjustTime = ref('')
  319. const adjustCoefficient = ref('')
  320. const matrixMarkets = computed(() => [
  321. { key: 'sg', label: t('cash.markets.Singapore') },
  322. { key: 'my', label: t('cash.markets.Malaysia') },
  323. { key: 'hk', label: t('cash.markets.HongKong') },
  324. { key: 'th', label: t('cash.markets.Thailand') },
  325. { key: 'vn', label: t('clientCount.market.vnGold') },
  326. { key: 'ca', label: t('cash.markets.Canada') }
  327. ])
  328. const adjustData = ref([])
  329. const isEmptyAdjustValue = (value) => {
  330. return value === '' || value === undefined || value === null || value === '-'
  331. }
  332. const toSafeDecimal = (value) => {
  333. if (isEmptyAdjustValue(value)) {
  334. return new Decimal(0)
  335. }
  336. const normalized = formatNumber(value)
  337. if (!normalized || normalized === '-' || normalized === '.' || normalized === '-.') {
  338. return new Decimal(0)
  339. }
  340. try {
  341. return new Decimal(normalized)
  342. } catch (error) {
  343. return new Decimal(0)
  344. }
  345. }
  346. const formatDecimalValue = (value) => {
  347. const decimalValue = Decimal.isDecimal(value) ? value : toSafeDecimal(value)
  348. return decimalValue.toFixed().replace(/\.0+$/, '').replace(/(\.\d*?[1-9])0+$/, '$1')
  349. }
  350. const initAdjustData = () => {
  351. adjustData.value = matrixMarkets.value.map(rowMarket => {
  352. const row = { inMarket: rowMarket.label + t('common.customer') }
  353. matrixMarkets.value.forEach(colMarket => {
  354. row[colMarket.key] = '' // 默认空
  355. })
  356. return row
  357. })
  358. }
  359. const handleAdjustment = () => {
  360. adjustTime.value = dayjs().format('YYYY-MM-DD HH:mm:ss')
  361. adjustCoefficient.value = ''
  362. initAdjustData()
  363. adjustVisible.value = true
  364. }
  365. const computedAdjustData = computed(() => {
  366. const data = [...adjustData.value]
  367. const sumRow = { inMarket: t('cash.cashFlow.total'), isSum: true }
  368. matrixMarkets.value.forEach(colMarket => {
  369. let colSum = new Decimal(0)
  370. adjustData.value.forEach(row => {
  371. colSum = colSum.plus(toSafeDecimal(row[colMarket.key]))
  372. })
  373. sumRow[colMarket.key] = formatDecimalValue(colSum)
  374. })
  375. data.push(sumRow)
  376. return data
  377. })
  378. const getRowTotal = (row) => {
  379. let sum = new Decimal(0)
  380. matrixMarkets.value.forEach(colMarket => {
  381. sum = sum.plus(toSafeDecimal(row[colMarket.key]))
  382. })
  383. return formatDecimalValue(sum)
  384. }
  385. const formatNumber = (val) => {
  386. if (val === '' || val === '-' || val === undefined || val === null) return val;
  387. val = String(val);
  388. let formatted = val.replace(/[^\d.-]/g, ''); // 移除非数字、点和负号
  389. formatted = formatted.replace(/(?!^)-/g, ''); // 负号只能在开头
  390. formatted = formatted.replace(/(\..*?)\..*/g, '$1'); // 只能有一个点
  391. return formatted;
  392. }
  393. const submitAdjustment = async () => {
  394. if (!adjustTime.value) {
  395. ElMessage.warning(t('cash.cashFlow.time'))
  396. return
  397. }
  398. if (!adjustCoefficient.value) {
  399. ElMessage.warning(t('cash.cashFlow.coefficientPlaceholder'))
  400. return
  401. }
  402. // 组装矩阵数据 matrix (二维数组,6行6列)
  403. // 如果单元格为空或者非数字,默认为 0
  404. const matrix = adjustData.value.map(row => {
  405. return matrixMarkets.value.map(colMarket => {
  406. return toSafeDecimal(row[colMarket.key]).toNumber()
  407. })
  408. })
  409. // 构造最终提交的数据结构
  410. const payload = {
  411. matrix: matrix,
  412. weight: toSafeDecimal(adjustCoefficient.value).toNumber(), // 系数
  413. time: adjustTime.value,
  414. submitterId: adminData.value.id || 1000063, // 从全局 adminData 获取
  415. submitterMarket: adminData.value.marketName || '总部' // 如果为空默认传总部
  416. }
  417. console.log('提交的封装数据:', JSON.stringify(payload, null, 2))
  418. await adjustment(payload)
  419. ElMessage.success(t('elmessage.submitSuccess'))
  420. adjustVisible.value = false
  421. fetchData()
  422. }
  423. onMounted(async () => {
  424. await initPermissions()
  425. await handleAdminInfo()
  426. await getMarket()
  427. await fetchData()
  428. })
  429. watch(exportListVisible, (visible) => {
  430. if (visible) {
  431. getExportList()
  432. } else {
  433. stopExportListPolling()
  434. }
  435. })
  436. onBeforeUnmount(() => {
  437. stopExportListPolling()
  438. })
  439. </script>
  440. <template>
  441. <div class="cash-flow-container">
  442. <!-- 搜索区域 -->
  443. <el-card class="search-card">
  444. <div class="search-bar">
  445. <!-- 第一行 -->
  446. <div class="search-row">
  447. <div class="search-item">
  448. <span class="label">{{ t('common.jwcode') }}</span>
  449. <el-input v-model="queryParams.jwcode" :placeholder="t('common.jwcodePlaceholder')" clearable />
  450. </div>
  451. <div class="search-item">
  452. <span class="label">{{ t('common_list.market') }}</span>
  453. <!-- 下拉多选使用 el-cascader 匹配地区树结构 -->
  454. <el-cascader v-model="queryParams.customerMarket" :options="marketOptions"
  455. :props="{ multiple: true, emitPath: false }" collapse-tags collapse-tags-tooltip
  456. :placeholder="t('common_list.marketPlaceholder')" clearable style="width: 8vw;" />
  457. </div>
  458. <div class="search-item" style="width: auto;">
  459. <span class="label">{{ t('common.payTime2') }}</span>
  460. <el-date-picker v-model="queryParams.timeRange" type="datetimerange" :range-separator="t('common.to')"
  461. :start-placeholder="t('common.startTime')" :end-placeholder="t('common.endTime')"
  462. :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]" style="width: 18vw;" />
  463. </div>
  464. </div>
  465. <div class="search-row">
  466. <el-button type="primary" @click="handleSearch">{{ t('common.search') }}</el-button>
  467. <el-button type="primary" @click="handleExport">{{ t('common.exportExcel') }}</el-button>
  468. <el-button type="primary" @click="openExportList">{{ t('common.viewExportList') }}</el-button>
  469. <el-button type="success" @click="handleReset">{{ t('common.reset') }}</el-button>
  470. <button v-if="hasperformanceAdjustment" class="adjust-btn" @click="handleAdjustment">{{
  471. t('cash.cashFlow.performanceAdjustment') }}</button>
  472. </div>
  473. </div>
  474. </el-card>
  475. <!-- 表格区域 -->
  476. <el-card class="table-card">
  477. <el-table ref="tableRef" :data="tableData" v-loading="loading" style="width: 100%; flex: 1;"
  478. :cell-style="{ textAlign: 'center' }"
  479. :header-cell-style="{ background: '#F3FAFE', color: '#333', textAlign: 'center' }">
  480. <el-table-column type="index" :label="t('common_list.id')" min-width="60" align="center" fixed="left">
  481. <template #default="scope">
  482. <span>{{ scope.$index + 1 + (queryParams.pageNum - 1) * queryParams.pageSize }}</span>
  483. </template>
  484. </el-table-column>
  485. <el-table-column prop="payTime" :label="t('cash.cashFlow.payTime')" min-width="180" />
  486. <el-table-column prop="orderCode" :label="t('cash.cashFlow.orderCode')" min-width="350" show-overflow-tooltip />
  487. <el-table-column prop="receivedMarketName" :label="t('cash.cashFlow.receivedMarketName')" min-width="120"
  488. show-overflow-tooltip />
  489. <el-table-column prop="performanceMarketName" :label="t('cash.cashFlow.performanceMarket')" min-width="120"
  490. show-overflow-tooltip />
  491. <el-table-column prop="name" :label="t('common_list.name')" min-width="150" show-overflow-tooltip />
  492. <el-table-column prop="jwcode" :label="t('common_list.jwcode')" min-width="120" />
  493. <el-table-column prop="goodsName" :label="t('cash.cashFlow.goodsName')" min-width="120" show-overflow-tooltip />
  494. <el-table-column prop="remark" :label="t('common_list.remark')" min-width="120" show-overflow-tooltip />
  495. <el-table-column prop="goodNum" :label="t('cash.cashFlow.goodNum')" min-width="120" show-overflow-tooltip />
  496. <el-table-column prop="payType" :label="t('cash.cashFlow.payType')" min-width="120" show-overflow-tooltip />
  497. <el-table-column prop="receivedCurrency" :label="t('common_list.receiveCurrency')" min-width="180"
  498. show-overflow-tooltip />
  499. <el-table-column prop="paymentAmount" :label="t('common_list.payAmount')" min-width="150" />
  500. <el-table-column prop="handlingCharge" :label="t('common_list.fee')" min-width="100" />
  501. <el-table-column prop="receivedAmount" :label="t('common_list.receiveAmount')" min-width="150" />
  502. </el-table>
  503. <!-- 分页 -->
  504. <div class="pagination-container">
  505. <el-pagination background layout="total, sizes, prev, pager, next, jumper" :total="total"
  506. :current-page="queryParams.pageNum" :page-size="queryParams.pageSize" :page-sizes="[10, 20, 50, 100]"
  507. @size-change="handlePageSizeChange" @current-change="handleCurrentChange" />
  508. </div>
  509. </el-card>
  510. <!-- 导出列表弹窗 -->
  511. <el-dialog v-model="exportListVisible" :title="t('common_export.exportList')" width="80%">
  512. <el-table :data="exportList" style="width: 100% ;height: 60vh;" :loading="exportListLoading">
  513. <el-table-column prop="fileName" :label="t('common_export.fileName')" />
  514. <el-table-column prop="state" :label="t('common_export.status')">
  515. <template #default="scope">
  516. <el-tag :type="getTagType(scope.row.state)" :effect="scope.row.state === 3 ? 'light' : 'plain'">
  517. {{ getTagText(scope.row.state) }}
  518. </el-tag>
  519. </template>
  520. </el-table-column>
  521. <el-table-column prop="createTime" :label="t('common_export.createTime')">
  522. <template #default="scope">
  523. {{ dayjs(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
  524. </template>
  525. </el-table-column>
  526. <el-table-column :label="t('common_export.operation')">
  527. <template #default="scope">
  528. <el-button type="primary" size="small" @click="downloadExportFile(scope.row)"
  529. :disabled="scope.row.state !== 2">
  530. {{ t('common_export.download') }}
  531. </el-button>
  532. </template>
  533. </el-table-column>
  534. </el-table>
  535. <template #footer>
  536. <div class="dialog-footer">
  537. <el-button text @click="exportListVisible = false">{{ t('common_export.close') }}</el-button>
  538. </div>
  539. </template>
  540. </el-dialog>
  541. <!-- 业绩调整弹窗 -->
  542. <el-dialog v-model="adjustVisible" :title="t('cash.cashFlow.marketConsumption')" width="95vw" top="5vh" align-center
  543. class="custom-adjust-dialog">
  544. <template #header="{ titleId, titleClass }">
  545. <div style="text-align: center; font-weight: bold; font-size: 18px;" :id="titleId" :class="titleClass">{{
  546. t('cash.cashFlow.marketConsumption') }}</div>
  547. </template>
  548. <div style="display: flex; gap: 40px; margin-bottom: 20px; align-items: center;">
  549. <div style="display: flex; align-items: center;">
  550. <span style="margin-right: 10px; font-weight: bold;">{{ t('cash.cashFlow.time') }}</span>
  551. <el-date-picker style="width: 220px" v-model="adjustTime" type="datetime" :placeholder="t('cash.cashFlow.time')"
  552. value-format="YYYY-MM-DD HH:mm:ss" />
  553. </div>
  554. <div style="display: flex; align-items: center;">
  555. <span style="margin-right: 10px; font-weight: bold;">{{ t('cash.cashFlow.coefficient') }}</span>
  556. <el-input v-model="adjustCoefficient" :placeholder="t('cash.cashFlow.coefficientPlaceholder')"
  557. style="width: 260px;" @input="adjustCoefficient = formatNumber(adjustCoefficient)" />
  558. </div>
  559. </div>
  560. <el-table class="adjust-table" :data="computedAdjustData" border style="width: 100%" :cell-style="{ textAlign: 'center' }"
  561. :header-cell-style="{ background: '#F3FAFE', color: '#333', textAlign: 'center', padding: '0' }">
  562. <el-table-column width="180" align="center" fixed="left">
  563. <template #header>
  564. <div class="diagonal-header">
  565. <span class="top-right">{{ t('cash.cashFlow.adjustment') }}</span>
  566. <span class="bottom-left">{{ t('cash.cashFlow.adjustmentOut') }}</span>
  567. </div>
  568. </template>
  569. <template #default="{ row }">
  570. <span style="font-weight: bold;">{{ row.inMarket }}</span>
  571. </template>
  572. </el-table-column>
  573. <el-table-column v-for="col in matrixMarkets" :key="col.key"
  574. :label="col.label + ' ' + t('cash.cashFlow.marketTeam')" min-width="120" align="center">
  575. <template #default="{ row }">
  576. <span v-if="row.isSum">{{ row[col.key] }}</span>
  577. <el-input v-else v-model="row[col.key]" @input="row[col.key] = formatNumber($event)" placeholder=""
  578. class="seamless-input" />
  579. </template>
  580. </el-table-column>
  581. <el-table-column :label="t('cash.cashFlow.total')" min-width="120" align="center" fixed="right">
  582. <template #default="{ row }">
  583. {{ getRowTotal(row) }}
  584. </template>
  585. </el-table-column>
  586. </el-table>
  587. <template #footer>
  588. <div class="dialog-footer" style="text-align: center;">
  589. <el-button type="primary" plain @click="adjustVisible = false" style="width: 100px;">{{ t('common.cancel')
  590. }}</el-button>
  591. <el-button type="primary" @click="submitAdjustment" style="width: 100px;">{{ t('common.submit') }}</el-button>
  592. </div>
  593. </template>
  594. </el-dialog>
  595. </div>
  596. </template>
  597. <style scoped lang="scss">
  598. :deep(.adjust-table .el-table__header-wrapper th .cell) {
  599. white-space: normal;
  600. word-break: keep-all;
  601. overflow-wrap: break-word;
  602. line-height: 1.3;
  603. padding: 8px 6px;
  604. }
  605. .cash-flow-container {
  606. display: flex;
  607. flex-direction: column;
  608. height: 100%;
  609. }
  610. .search-card {
  611. margin-bottom: 10px;
  612. background: #F3FAFE; // 浅蓝背景
  613. border: none;
  614. :deep(.el-card__body) {
  615. padding: 15px;
  616. }
  617. }
  618. .search-bar {
  619. display: flex;
  620. flex-direction: column;
  621. gap: 15px;
  622. }
  623. .search-row {
  624. display: flex;
  625. flex-wrap: wrap;
  626. gap: 20px;
  627. align-items: center;
  628. }
  629. .search-item {
  630. display: flex;
  631. align-items: center;
  632. .label {
  633. font-size: 15px; // 参考 coinConsumeDetail 的 .text size="large"
  634. color: #000; // 或 #606266
  635. white-space: nowrap;
  636. margin-right: 8px;
  637. min-width: 60px;
  638. text-align: right;
  639. }
  640. .el-input,
  641. .el-select {
  642. width: 8vw;
  643. }
  644. }
  645. .search-btn-group {
  646. margin-left: 2vw;
  647. display: flex;
  648. gap: 10px;
  649. }
  650. .adjust-btn {
  651. color: #fff;
  652. padding: 8px 15px;
  653. border-radius: 4px;
  654. cursor: pointer;
  655. border: none;
  656. background-color: #7349ad;
  657. margin-left: auto;
  658. }
  659. .table-card {
  660. background: #E7F4FD;
  661. flex: 1;
  662. border: none;
  663. display: flex;
  664. flex-direction: column;
  665. :deep(.el-card__body) {
  666. padding: 20px;
  667. flex: 1;
  668. display: flex;
  669. flex-direction: column;
  670. overflow: hidden;
  671. }
  672. }
  673. .pagination-container {
  674. margin-top: 15px;
  675. display: flex;
  676. justify-content: flex-start;
  677. }
  678. // 表格样式覆盖 (参考 coinConsumeDetail)
  679. :deep(.el-table__header-wrapper),
  680. :deep(.el-table__body-wrapper),
  681. :deep(.el-table__cell),
  682. :deep(.el-table__body td) {
  683. background-color: #F3FAFE !important; // 如果想完全一致可以加这个,但有时候会影响阅读,暂保留头部颜色
  684. }
  685. :deep(.el-table__row:hover > .el-table__cell) {
  686. background-color: #E5EBFE !important;
  687. }
  688. .diagonal-header {
  689. position: relative;
  690. width: 100%;
  691. height: 50px;
  692. /* Set a fixed height to make diagonal line work well */
  693. background: linear-gradient(to top right, transparent 49.5%, #dcdfe6 49.5%, #dcdfe6 50.5%, transparent 50.5%);
  694. }
  695. .diagonal-header .top-right {
  696. position: absolute;
  697. top: 5px;
  698. right: 15px;
  699. font-weight: bold;
  700. }
  701. .diagonal-header .bottom-left {
  702. position: absolute;
  703. bottom: 5px;
  704. left: 15px;
  705. font-weight: bold;
  706. }
  707. /* 业绩调整弹窗全局样式 */
  708. :deep(.custom-adjust-dialog) {
  709. background-color: #f3fafe !important;
  710. /* 统一淡蓝色背景 */
  711. border-radius: 8px;
  712. }
  713. :deep(.custom-adjust-dialog .el-dialog__header) {
  714. padding-bottom: 20px;
  715. border-bottom: 1px solid #EBEEF5;
  716. margin-right: 0;
  717. }
  718. :deep(.custom-adjust-dialog .el-dialog__body) {
  719. padding-top: 20px;
  720. }
  721. /* 无缝输入框样式(去除边框和背景) */
  722. .seamless-input :deep(.el-input__wrapper) {
  723. box-shadow: none !important;
  724. background-color: transparent !important;
  725. padding: 0;
  726. }
  727. .seamless-input :deep(.el-input__inner) {
  728. text-align: center;
  729. font-size: 14px;
  730. height: 100%;
  731. }
  732. .seamless-input :deep(.el-input__inner:focus) {
  733. outline: none;
  734. }
  735. </style>