Commit bb9e9a49 by 前端

Merge branch 'SAAS+V5.8.2.1' into 'SAAS+V5.8.3'

上线合并

See merge request !782
2 parents 6b055b32 3184ac02
...@@ -112,9 +112,33 @@ export function onlinePaymentDetailPage(data) { ...@@ -112,9 +112,33 @@ export function onlinePaymentDetailPage(data) {
} }
/** /**
* 分页查询银盛线上对账单汇总-分账记录
*/
export function onlineDivisionMonthTotalPage(data) {
data.method = "dj.api.smartcarlife.onlineStatementAccount.divisionMonthTotalPage";
return request(data, "post");
}
/**
* 分页查询银盛线上对账单汇总-收款记录 * 分页查询银盛线上对账单汇总-收款记录
*/ */
export function onlinePaymentMonthTotalPage(data) { export function onlinePaymentMonthTotalPage(data) {
data.method = "dj.api.smartcarlife.onlineStatementAccount.paymentMonthTotalPage"; data.method = "dj.api.smartcarlife.onlineStatementAccount.paymentMonthTotalPage";
return request(data, "post"); return request(data, "post");
} }
/**
* 查询银盛线上对账单收款统计信息
*/
export function paymentCountTotal(data) {
data.method = "dj.api.smartcarlife.onlineStatementAccount.paymentCountTotal";
return request(data, "post");
}
/**
* 查询银盛线上对账单分账统计记录
*/
export function divisionCountTotal(data) {
data.method = "dj.api.smartcarlife.onlineStatementAccount.divisionCountTotal";
return request(data, "post");
}
...@@ -854,7 +854,7 @@ export const routerName = { ...@@ -854,7 +854,7 @@ export const routerName = {
path: "/ysprepaymentManage", path: "/ysprepaymentManage",
name: "ysprepaymentManage", name: "ysprepaymentManage",
meta: { meta: {
title: "银盛线上对账单", title: "银盛线上对账单(广联)",
authId: "90517", authId: "90517",
parentId: "905", parentId: "905",
cache: false, cache: false,
......
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
formatter: row => formatThousand(row.dayEndBalance), formatter: row => formatThousand(row.dayEndBalance),
}, },
{ {
label: "待补录订单", label: "待补录未分账订单",
prop: "waitInputMoney", prop: "waitInputMoney",
minWidth: "90px", minWidth: "90px",
formatter: row => formatThousand(row.waitInputMoney), formatter: row => formatThousand(row.waitInputMoney),
...@@ -391,11 +391,11 @@ export default { ...@@ -391,11 +391,11 @@ export default {
}); });
}, },
handleOnlineDetail(row) { handleOnlineDetail(row) {
const { merchantId, merchantName, yqMerchantId, yqMerchantName } = row; const { yqMerchantId, yqMerchantName } = row;
const { startTradeTime: startTime, endTradeTime: endTime } = this.getParams(); const { startTradeTime: startTime, endTradeTime: endTime } = this.getParams();
this.$router.push({ this.$router.push({
name: "ysprepaymentDetail", name: "ysprepaymentDetail",
params: { merchantId, merchantName, yqMerchantId, yqMerchantName, startTime, endTime }, params: { yqMerchantId, yqMerchantName, startTime, endTime },
}); });
}, },
handleExport() { handleExport() {
......
const mockDivisionCountTotal = jest.fn();
const mockPaymentCountTotal = jest.fn();
jest.mock("@api/prepaymentManage", () => ({
divisionCountTotal: mockDivisionCountTotal,
onlineDivisionDetailPage: jest.fn(),
onlineDivisionMonthTotalPage: jest.fn(),
onlinePaymentDetailPage: jest.fn(),
onlinePaymentMonthTotalPage: jest.fn(),
paymentCountTotal: mockPaymentCountTotal,
}), { virtual: true });
jest.mock("@/mixins/reportTrackPageMixin", () => ({}));
const { shallowMount } = require("@vue/test-utils");
const OnlineDetail = require("./onlineDetail.vue").default;
const { ONLINE_DETAIL_TAB } = require("./onlineDetail.constant");
describe("onlineDetail summary", () => {
let wrapper;
const mountComponent = () => {
wrapper = shallowMount(OnlineDetail, {
mocks: {
$route: {
params: {
yqMerchantId: "merchant-1",
},
},
$router: {
push: jest.fn(),
},
$store: {
state: {
d2admin: {
user: {
dowloadList: [],
},
},
},
dispatch: jest.fn(),
},
},
stubs: [
"d2-container",
"el-tabs",
"el-tab-pane",
"d2-table-header",
"d2-table",
"el-button",
],
});
};
beforeEach(() => {
jest.clearAllMocks();
mockDivisionCountTotal.mockResolvedValue({
lightChangeAmount: 1000,
equityAmount: 2000,
extendedWarrantyAmount: 3000,
});
mockPaymentCountTotal.mockResolvedValue({});
mountComponent();
});
afterEach(() => {
wrapper && wrapper.destroy();
});
it("loads summary data before table search", async () => {
wrapper.setData({
activeName: ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION,
});
await wrapper.vm.beforeSearchFn();
expect(mockPaymentCountTotal).toHaveBeenCalledWith({
yqMerchantId: "merchant-1",
});
expect(wrapper.vm.summaries).toEqual({});
});
it("returns summary row synchronously from cached summary data", () => {
wrapper.setData({
activeName: ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION,
summaries: {
lightChangeAmount: 1000,
equityAmount: 2000,
extendedWarrantyAmount: 3000,
},
});
const result = wrapper.vm.getSummaries({
columns: [
{ property: "ownSerialNum" },
{ property: "lightChangeAmount" },
{ property: "equityAmount" },
{ property: "extendedWarrantyAmount" },
],
});
expect(Array.isArray(result)).toBe(true);
expect(result).toEqual(["合计", "1,000.00", "2,000.00", "3,000.00"]);
});
});
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
</div> </div>
</d2-table-header> </d2-table-header>
<d2-table ref="usedCarFundWarningManageTable" <d2-table :key="tableKey"
:key="tableKey" ref="usedCarFundWarningManageTable"
show-summary
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
:get-list-api="getListApi" :get-list-api="getListApi"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:summary-method="getSummaries"
:table-params="tableParams"> :table-params="tableParams">
</d2-table> </d2-table>
</div> </div>
...@@ -35,17 +37,26 @@ ...@@ -35,17 +37,26 @@
</template> </template>
<script> <script>
import { onlineDivisionDetailPage, onlinePaymentDetailPage, onlinePaymentMonthTotalPage } from "@api/prepaymentManage"; import { divisionCountTotal, onlineDivisionDetailPage, onlineDivisionMonthTotalPage, onlinePaymentDetailPage, onlinePaymentMonthTotalPage, paymentCountTotal } from "@api/prepaymentManage";
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { formatThousand } from "@/common/format";
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"; import reportTrackPageMixin from "@/mixins/reportTrackPageMixin";
import { ONLINE_DETAIL_TAB, ONLINE_DETAIL_TABLE_COLUMNS } from "./onlineDetail.constant"; import { ONLINE_DETAIL_TAB, ONLINE_DETAIL_TABLE_COLUMNS } from "./onlineDetail.constant";
const ONLINE_DETAIL_API_MAP = { const ONLINE_DETAIL_API_MAP = {
[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION]: onlinePaymentMonthTotalPage, [ONLINE_DETAIL_TAB.SUMMARY_COLLECTION]: onlinePaymentMonthTotalPage,
[ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: onlinePaymentDetailPage, [ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: onlinePaymentDetailPage,
[ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION]: onlineDivisionMonthTotalPage,
[ONLINE_DETAIL_TAB.DETAIL_ALLOCATION]: onlineDivisionDetailPage, [ONLINE_DETAIL_TAB.DETAIL_ALLOCATION]: onlineDivisionDetailPage,
}; };
const TOTAL_API_MAP = {
[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION]: paymentCountTotal,
[ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: paymentCountTotal,
[ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION]: divisionCountTotal,
[ONLINE_DETAIL_TAB.DETAIL_ALLOCATION]: divisionCountTotal,
};
export default { export default {
name: "UsedCarPaymentManage", name: "UsedCarPaymentManage",
components: { components: {
...@@ -65,6 +76,10 @@ export default { ...@@ -65,6 +76,10 @@ export default {
name: ONLINE_DETAIL_TAB.DETAIL_COLLECTION, name: ONLINE_DETAIL_TAB.DETAIL_COLLECTION,
}, },
{ {
label: "汇总-分账",
name: ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION,
},
{
label: "明细-分账", label: "明细-分账",
name: ONLINE_DETAIL_TAB.DETAIL_ALLOCATION, name: ONLINE_DETAIL_TAB.DETAIL_ALLOCATION,
}, },
...@@ -77,9 +92,10 @@ export default { ...@@ -77,9 +92,10 @@ export default {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000), btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list", listName: "list",
tableOption: false, tableOption: false,
tableColumns: ONLINE_DETAIL_TABLE_COLUMNS[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION], tableColumns: ONLINE_DETAIL_TABLE_COLUMNS[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION].tableColumns,
}, },
detailInfo: {}, detailInfo: {},
summaries: {},
}; };
}, },
computed: { computed: {
...@@ -87,11 +103,10 @@ export default { ...@@ -87,11 +103,10 @@ export default {
dowloadList: state => state.d2admin.user.dowloadList, dowloadList: state => state.d2admin.user.dowloadList,
}), }),
routerInfo() { routerInfo() {
console.log(this.$route.params);
return this.$route.params; return this.$route.params;
}, },
}, },
mounted() { created() {
this.searchFormSearch = { this.searchFormSearch = {
...this.routerInfo, ...this.routerInfo,
}; };
...@@ -103,11 +118,8 @@ export default { ...@@ -103,11 +118,8 @@ export default {
close: "d2admin/page/close", close: "d2admin/page/close",
}), }),
...mapActions("d2admin/user", ["actionSetDownloadList"]), ...mapActions("d2admin/user", ["actionSetDownloadList"]),
beforeSearchFn() { async beforeSearchFn() {
return new Promise((resolve) => { await this.getSummaryData();
// this.searchFormSearch = this.getParams()
resolve();
});
}, },
goBack() { goBack() {
this.$router.push({ this.$router.push({
...@@ -118,10 +130,11 @@ export default { ...@@ -118,10 +130,11 @@ export default {
return this.searchFormSearch; return this.searchFormSearch;
}, },
handleClick() { handleClick() {
this.summaries = {};
this.getListApi = ONLINE_DETAIL_API_MAP[this.activeName]; this.getListApi = ONLINE_DETAIL_API_MAP[this.activeName];
this.tableParams = { this.tableParams = {
...this.tableParams, ...this.tableParams,
tableColumns: ONLINE_DETAIL_TABLE_COLUMNS[this.activeName], tableColumns: ONLINE_DETAIL_TABLE_COLUMNS[this.activeName].tableColumns,
}; };
this.tableKey = this.activeName; this.tableKey = this.activeName;
}, },
...@@ -147,6 +160,31 @@ export default { ...@@ -147,6 +160,31 @@ export default {
]; ];
this.actionSetDownloadList({ list, type: "dowloadList" }); this.actionSetDownloadList({ list, type: "dowloadList" });
}, },
async getSummaryData() {
const res = await TOTAL_API_MAP[this.activeName]({ ...this.getParams() });
this.summaries = res || {};
},
getSummaries(param) {
const { columns } = param;
const { summaries } = this;
const sums = [];
const keyList = ONLINE_DETAIL_TABLE_COLUMNS[this.activeName].tableSummary;
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return;
}
const key = column.property;
if (keyList.includes(key)) {
const value = summaries[key];
sums[index]
= value != null || value != undefined ? formatThousand(value) : 0;
} else {
sums[index] = "";
}
});
return sums;
},
}, },
}; };
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!