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