diff --git a/src/api/accounts.js b/src/api/accounts.js index 5ab94e1..6a066fa 100644 --- a/src/api/accounts.js +++ b/src/api/accounts.js @@ -100,134 +100,142 @@ export function capitalFlowExportApi(data) { /** * @description 转账记录 -- 导出 */ - export function transferRecordsExportApi(data) { +export function transferRecordsExportApi(data) { return request.get(`financial/export`, data) } /** * @description 资金记录 -- 导出 */ - export function fundingRecordsExportApi(data) { +export function fundingRecordsExportApi(data) { return request.get(`bill/export`, data) } /** * @description 提现管理 -- 导出 */ - export function extractManageExportApi(data) { +export function extractManageExportApi(data) { return request.get(`user/extract/export`, data) } /** * @description 获取版本号 */ export function getVersion() { - return request.get(`version`) + return request.get(`version`) } /** * @description 转账设置 */ export function transferSettingApi(key) { - return request.get(`config/${key}`) + return request.get(`config/${key}`) } /** * @description 转账记录 */ export function transferRecordApi(data) { - return request.get(`financial/lst`, data) + return request.get(`financial/lst`, data) } /** * @description 转账记录 -- 头部数据 */ export function transferHeaderDataApi() { - return request.get(`financial/title`) + return request.get(`financial/title`) } /** * @description 转账信息 */ export function transferDetailApi(id) { - return request.get(`financial/detail/${id}`) + return request.get(`financial/detail/${id}`) } /** * @description 申请转账 -- 审核 */ export function transferReviewApi(id, data) { - return request.post(`financial/status/${id}`, data) + return request.post(`financial/status/${id}`, data) } /** * @description 申请转账 -- 备注 */ export function transferMarkApi(id) { - return request.get(`financial/mark/${id}/form`) + return request.get(`financial/mark/${id}/form`) } /** * @description 申请转账 -- 转账 */ export function transferEditApi(id, data) { - return request.post(`financial/update/${id}`, data) + return request.post(`financial/update/${id}`, data) } /** * @description 财务账单 -- 列表 */ export function financialLstApi(data) { - return request.get(`financial_record/lst`, data) + return request.get(`financial_record/lst`, data) } /** * @description 财务账单 -- 详情 */ export function financialDetailApi(type, data) { - return request.get(`financial_record/detail/${type}`, data) + return request.get(`financial_record/detail/${type}`, data) } /** * @description 财务账单 -- 头部数据 */ export function finaHeaderDataApi(data) { - return request.get(`financial_record/title`, data) + return request.get(`financial_record/title`, data) } /** * @description 财务账单 -- 下载账单 */ export function downloadFinancialApi(type, data) { - return request.get(`financial_record/detail_export/${type}`, data) + return request.get(`financial_record/detail_export/${type}`, data) } + +/** + * @description 财务账单 -- 下载对账单 + */ +export function downloadFinancialBill(type, data) { + return request.get(`financial_record/detail_export2/${type}`, data) +} + /** * @description 资金流水 -- 统计数据 */ export function getStatisticsApi(data) { - return request.get(`financial_record/count`,data) + return request.get(`financial_record/count`, data) } /** * @description 发票 -- 获取发票说明 */ export function getReceiptApi(key) { - return request.get(`agreement/${key}`) + return request.get(`agreement/${key}`) } /** * @description 发票 -- 编辑发票说明 */ export function updateReceiptApi(type, data) { - return request.post(`agreement/${type}`, data) + return request.post(`agreement/${type}`, data) } /** * @description 发票 -- 列表 */ export function invoiceListApi(data) { - return request.get(`receipt/lst`, data) + return request.get(`receipt/lst`, data) } /** * @description 发票 -- 详情 */ - export function invoiceDetailApi(id) { - return request.get(`receipt/detail/${id}`) +export function invoiceDetailApi(id) { + return request.get(`receipt/detail/${id}`) } /** * @description 分账单 -- 获取配置 */ - export function getSettingApi() { - return request.get(`profitsharing/config`) +export function getSettingApi() { + return request.get(`profitsharing/config`) } /** * @description 分账单 -- 修改配置 */ - export function updateSettingApi(data) { - return request.post(`profitsharing/config`, data) +export function updateSettingApi(data) { + return request.post(`profitsharing/config`, data) } /** diff --git a/src/views/accounts/statement/index.vue b/src/views/accounts/statement/index.vue index 3f66e92..b151eee 100644 --- a/src/views/accounts/statement/index.vue +++ b/src/views/accounts/statement/index.vue @@ -5,161 +5,122 @@
- +
- + - + - + - - - + + + - + +
- +
- + - - - - {{accountDetails.date}} - - - - + + + + {{ accountDetails.date }} + + + + -
- {{accountDetails.income && accountDetails.income.title}} - {{accountDetails.income && accountDetails.income.number}}元 - {{accountDetails.income && accountDetails.income.count}} -
- - {{item['0']}} - - {{item['1']}} - {{item['2']}} - - -
+
+ {{ accountDetails.income && accountDetails.income.title }} + {{ accountDetails.income && accountDetails.income.number }}元 + {{ accountDetails.income && accountDetails.income.count }} +
+ + {{ item['0'] }} + + {{ item['1'] }} + {{ item['2'] }} + +
- +
+ -
- {{accountDetails.bill && accountDetails.bill.title}} - {{accountDetails.bill && accountDetails.bill.number}}元 - {{accountDetails.bill && accountDetails.bill.count}} -
- - {{item['0']}} - - {{item['1']}} - {{item['2']}} - - -
+
+ {{ accountDetails.bill && accountDetails.bill.title }} + {{ accountDetails.bill && accountDetails.bill.number }}元 + {{ accountDetails.bill && accountDetails.bill.count }} +
+ + {{ item['0'] }} + + {{ item['1'] }} + {{ item['2'] }} + +
- +
+ -
- {{accountDetails.expend && accountDetails.expend.title}} - {{accountDetails.expend && accountDetails.expend.number}}元 - {{accountDetails.expend && accountDetails.expend.count}} -
- - {{item['0']}} - - {{item['1']}} - {{item['2']}} - - -
+
+ {{ accountDetails.expend && accountDetails.expend.title }} + {{ accountDetails.expend && accountDetails.expend.number }}元 + {{ accountDetails.expend && accountDetails.expend.count }} +
+ + {{ item['0'] }} + + {{ item['1'] }} + {{ item['2'] }} + +
- +
+ -
- {{accountDetails.charge && accountDetails.charge.title}} - {{accountDetails.charge && accountDetails.charge.number}}元 -
+
+ {{ accountDetails.charge && accountDetails.charge.title }} + {{ accountDetails.charge && accountDetails.charge.number }}元 +
- - - - 我知道了 - + + + + 我知道了 +
@@ -174,7 +135,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -import { financialLstApi, financialDetailApi, finaHeaderDataApi, downloadFinancialApi } from '@/api/accounts' +import { financialLstApi, financialDetailApi, finaHeaderDataApi, downloadFinancialApi, downloadFinancialBill } from '@/api/accounts' import { roterPre } from '@/settings' import cardsData from "@/components/cards/index"; import createWorkBook from '@/utils/newToExcel.js'; @@ -201,8 +162,8 @@ export default { status: '0' }, headeNum: [ - {type: 1,title: "日账单"}, - {type: 2,title: "月账单"}, + { type: 1, title: "日账单" }, + { type: 2, title: "月账单" }, ], dialogVisible: false, rules: { @@ -229,50 +190,78 @@ export default { }, methods: { onDetails(date) { - financialDetailApi(this.tableForm.type,{date: date}).then(res => { + financialDetailApi(this.tableForm.type, { date: date }).then(res => { this.dialogVisible = true this.accountDetails = res.data }).catch(res => { this.$message.error(res.message) }) }, - getHeaderData(){ - finaHeaderDataApi({date:this.tableForm.date}).then(res => { - this.cardLists = res.data.stat - }).catch(res => { - this.$message.error(res.message) - }) + getHeaderData() { + finaHeaderDataApi({ date: this.tableForm.date }).then(res => { + this.cardLists = res.data.stat + }).catch(res => { + this.$message.error(res.message) + }) }, - async exports(time) { - let excelData = JSON.parse(JSON.stringify(this.tableForm)), data = [] + + async exports(time, type) { + let excelData = JSON.parse(JSON.stringify(this.tableForm)), data = [] excelData.page = 1 let pageCount = 1 let lebData = {}; for (let i = 0; i < pageCount; i++) { - lebData = await this.downData(excelData,time) - pageCount = Math.ceil(lebData.count/excelData.limit) + lebData = await this.downData(excelData, time, type) + pageCount = Math.ceil(lebData.count / excelData.limit) if (lebData.export.length) { data = data.concat(lebData.export) excelData.page++ - } + } } - createWorkBook(lebData.header, lebData.title, data, lebData.foot,lebData.filename); + createWorkBook(lebData.header, lebData.title, data, lebData.foot, lebData.filename); return }, + + // 下载对账单 + async exportBill(time, type) { + let excelData = JSON.parse(JSON.stringify(this.tableForm)), data = [] + excelData.page = 1 + let pageCount = 1 + let lebData = {}; + for (let i = 0; i < pageCount; i++) { + lebData = await this.downData(excelData, time, type) + pageCount = Math.ceil(lebData.count / excelData.limit) + if (lebData.export.length) { + data = data.concat(lebData.export) + excelData.page++ + } + } + createWorkBook(lebData.header, lebData.title, data, lebData.foot, lebData.filename); + return + }, + /**订单列表 */ - downData(excelData,time) { + downData(excelData, time, type) { excelData.date = time return new Promise((resolve, reject) => { - downloadFinancialApi(this.tableForm.type,excelData).then((res) => { - return resolve(res.data) - }) + if (type == 1) { + downloadFinancialApi(this.tableForm.type, excelData).then((res) => { + return resolve(res.data) + }) + } else { + downloadFinancialBill(this.tableForm.type, excelData).then((res) => { + return resolve(res.data) + }) + } }) }, + handleClose() { this.dialogVisible = false }, // 具体日期 onchangeTime(e) { + console.log(e) this.timeVal = e this.tableForm.date = this.timeVal ? this.timeVal.join('-') : '' this.getList('') @@ -305,87 +294,110 @@ export default {