This commit is contained in:
faiz 2024-09-19 11:34:28 +08:00
parent 0af602352e
commit b06dc4a03a
1 changed files with 98 additions and 87 deletions

View File

@ -27,13 +27,16 @@
type="month"
clearable
@change="getList(1)"
placeholder="选择日期">
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
</el-form>
</div>
<el-card class="mt14">
<el-button class="mb10" type="primary" size="small" @click="exports">导出列表</el-button>
<el-button class="mb10" type="primary" size="small" @click="exports"
>导出列表</el-button
>
<el-table
v-loading="listLoading"
:data="tableData.data"
@ -43,40 +46,27 @@
>
<el-table-column label="序号" min-width="90">
<template scope="scope">
<span>{{ scope.$index+(tableForm.page - 1) * tableForm.limit + 1 }}</span>
<span>{{
scope.$index + (tableForm.page - 1) * tableForm.limit + 1
}}</span>
</template>
</el-table-column>
<el-table-column
prop="mer_name"
label="商户名称"
min-width="150"
/>
<el-table-column
prop="date"
label="账单日期"
min-width="150"
/>
<el-table-column
prop="order_amount"
label="货款金额"
min-width="150"
/>
<el-table-column prop="mer_name" label="商户名称" min-width="150" />
<el-table-column prop="date" label="账单日期" min-width="150" />
<el-table-column prop="order_amount" label="货款金额" min-width="150" />
<el-table-column
prop="postage_amount"
label="邮费金额"
min-width="150"
/>
<el-table-column prop="discount" label="折扣" min-width="150" />
<el-table-column
prop="refund_amount"
label="退款金额"
min-width="150"
/>
<el-table-column
prop="amount"
label="可提现金额"
min-width="150"
/>
<el-table-column prop="amount" label="可提现金额" min-width="150" />
<el-table-column
prop="invoice_amount"
label="开票金额"
@ -84,10 +74,19 @@
/>
<el-table-column label="操作" min-width="100" fixed="right">
<template slot-scope="scope">
<router-link :to="{path: roterPre + '/accounts/billDetails/' + scope.row.mer_id}">
<el-button type="text" size="small" >账单详情</el-button>
<router-link
:to="{
path: roterPre + '/accounts/billDetails/' + scope.row.mer_id,
}"
>
<el-button type="text" size="small">账单详情</el-button>
</router-link>
<el-button type="text" size="small" @click="exports('download',scope.row.mer_id,scope.row.date)">下载</el-button>
<el-button
type="text"
size="small"
@click="exports('download', scope.row.mer_id, scope.row.date)"
>下载</el-button
>
</template>
</el-table-column>
</el-table>
@ -103,18 +102,20 @@
/>
</div>
</el-card>
</div>
</template>
<script>
import { merchantBillList,exportInancialRecordApi,exportmerDetailExportApi } from '@/api/accounts'
import {
merchantBillList,
exportInancialRecordApi,
exportmerDetailExportApi,
} from "@/api/accounts";
import { merSelectApi } from "@/api/product";
import { roterPre } from '@/settings'
import createWorkBook from '@/utils/newToExcel.js'
import { roterPre } from "@/settings";
import createWorkBook from "@/utils/newToExcel.js";
export default {
name: 'MerchantBill',
name: "MerchantBill",
data() {
return {
loading: false,
@ -123,37 +124,37 @@ export default {
listLoading: true,
tableData: {
data: [],
total: 0
total: 0,
},
tableForm: {
page: 1,
limit: 10,
mer_id: '',
date:''
mer_id: "",
date: "",
},
merSelect: [],
ruleForm: {
status: '0'
status: "0",
},
dialogVisible: false,
rules: {
status: [
{ required: true, message: '请选择对账状态', trigger: 'change' }
]
{ required: true, message: "请选择对账状态", trigger: "change" },
],
},
reconciliationId: 0,
accountDetails: {
date: '',
date: "",
charge: {},
expend: {},
income: {}
}
}
income: {},
},
};
},
computed: {},
mounted() {
this.getMerSelect()
this.getList('')
mounted() {
this.getMerSelect();
this.getList("");
},
methods: {
//
@ -166,72 +167,82 @@ export default {
this.$message.error(res.message);
});
},
async exports(type,id,date) {
async exports(type, id, date) {
let params = {
mer_id: id,
page:1,
limit:500,
date
}
const excelData = JSON.parse(JSON.stringify(this.tableForm)); let data = []
excelData.page = 1
excelData.limit = 200
page: 1,
limit: 500,
date,
};
const excelData = JSON.parse(JSON.stringify(this.tableForm));
let data = [];
excelData.page = 1;
excelData.limit = 200;
// excelData.ids = this.checkedIds.toString()
let pageCount = 1
let lebData = {}
let pageCount = 1;
let lebData = {};
for (let i = 0; i < pageCount; i++) {
lebData = type=='download'?await this.exportmerDetailExportApi(params):await this.downOrderData(excelData)
pageCount = Math.ceil(lebData.count / excelData.limit)
lebData =
type == "download"
? await this.exportmerDetailExportApi(params)
: await this.downOrderData(excelData);
pageCount = Math.ceil(lebData.count / excelData.limit);
if (lebData.export.length) {
data = data.concat(lebData.export)
excelData.page++
data = data.concat(lebData.export);
excelData.page++;
}
}
createWorkBook(lebData.header, lebData.title, data, lebData.foot, lebData.filename)
return
createWorkBook(
lebData.header,
lebData.title,
data,
lebData.foot,
lebData.filename
);
return;
},
/** 订单 */
downOrderData(excelData) {
return new Promise((resolve, reject) => {
exportInancialRecordApi(excelData).then((res) => {
return resolve(res.data)
})
})
return resolve(res.data);
});
});
},
/** 下载订单 */
exportmerDetailExportApi(excelData) {
return new Promise((resolve, reject) => {
exportmerDetailExportApi(excelData).then((res) => {
return resolve(res.data)
})
})
return resolve(res.data);
});
});
},
//
getList(num) {
this.listLoading = true
this.listLoading = true;
this.tableForm.page = num ? num : this.tableForm.page;
merchantBillList(this.tableForm).then(res => {
this.tableData.data = res.data.list
this.tableData.total = res.data.count
this.listLoading = false
}).catch(res => {
this.listLoading = false
this.$message.error(res.message)
})
merchantBillList(this.tableForm)
.then((res) => {
this.tableData.data = res.data.list;
this.tableData.total = res.data.count;
this.listLoading = false;
})
.catch((res) => {
this.listLoading = false;
this.$message.error(res.message);
});
},
pageChange(page) {
this.tableForm.page = page
this.getList('')
this.tableForm.page = page;
this.getList("");
},
handleSizeChange(val) {
this.tableForm.limit = val
this.chkName = ''
this.getList('')
}
}
}
this.tableForm.limit = val;
this.chkName = "";
this.getList("");
},
},
};
</script>
<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>