|
@@ -631,7 +631,7 @@
|
|
|
sysMchData = sysData.list;
|
|
|
}
|
|
|
|
|
|
- const tableData = deepCloneData(merchantList);
|
|
|
+ let tableData = deepCloneData(merchantList);
|
|
|
tableData.forEach(item => {
|
|
|
const amountsItem = sysMchData.find(aItem => aItem.mch_id === item.mch_id);
|
|
|
if (amountsItem !== undefined) {
|
|
@@ -654,6 +654,8 @@
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ tableData = sortBySubjectContinuity(tableData);
|
|
|
+
|
|
|
layui.table.render({
|
|
|
elem: '#' + this.tableId,
|
|
|
data: tableData,
|
|
@@ -927,7 +929,7 @@
|
|
|
|
|
|
let item = merchantData[index];
|
|
|
item.total_invoiced = total_invoiced || "0";
|
|
|
- item.last_invoice_date = last_invoice_date || "0";
|
|
|
+ item.last_invoice_date = last_invoice_date || "";
|
|
|
item.month_opened = month_opened || "0";
|
|
|
item.remark = remark;
|
|
|
|
|
@@ -973,7 +975,7 @@
|
|
|
sysChanData = sysData.list;
|
|
|
}
|
|
|
|
|
|
- const tableData = deepCloneData(channelList);
|
|
|
+ let tableData = deepCloneData(channelList);
|
|
|
tableData.forEach(item => {
|
|
|
const amountsItem = sysChanData.find(aItem => aItem.store_id === item.store_id);
|
|
|
if (amountsItem !== undefined) {
|
|
@@ -996,6 +998,8 @@
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ tableData = sortBySubjectContinuity(tableData);
|
|
|
+
|
|
|
layui.table.render({
|
|
|
elem: '#' + this.tableId,
|
|
|
data: tableData,
|
|
@@ -1256,7 +1260,7 @@
|
|
|
let item = channelData[index];
|
|
|
item.total_invoiced = total_invoiced || "0";
|
|
|
item.month_opened = month_opened || "0";
|
|
|
- item.last_invoice_date = last_invoice_date || "0";
|
|
|
+ item.last_invoice_date = last_invoice_date || "";
|
|
|
item.remark = remark;
|
|
|
|
|
|
await dataHelper.addOrUpdateData(CONSTANTS.KEY_QUOTA_CHANNEL, item, 2);
|
|
@@ -1292,6 +1296,10 @@
|
|
|
|
|
|
const summaryData = dataHelper.getSummaryList().find(item => item.subject === that.subject);
|
|
|
const invoice_remaining_amount = summaryData === undefined || summaryData.invoice_remaining_amount === '' ? '0' : summaryData.invoice_remaining_amount;
|
|
|
+ const remaining_tickets = summaryData === undefined || summaryData.remaining_tickets === '' ? '0' : summaryData.remaining_tickets;
|
|
|
+ const invoice_needed_amount = summaryData === undefined || summaryData.invoice_needed_amount === '' ? '0' : summaryData.invoice_needed_amount;
|
|
|
+ const ticket_difference = summaryData === undefined || summaryData.ticket_difference === '' ? '0' : summaryData.ticket_difference;
|
|
|
+ const adjustment_value = summaryData === undefined || summaryData.adjustment_value === '' ? '0' : summaryData.adjustment_value;
|
|
|
|
|
|
const receivable_ticket = channelData.reduce((total, item) => {
|
|
|
return total + parseFloat(item.total_amounts);
|
|
@@ -1305,7 +1313,7 @@
|
|
|
const total_issued_tickets = merchantData.reduce((total, item) => {
|
|
|
return total + parseFloat(item.total_invoiced);
|
|
|
}, 0);
|
|
|
- const remaining_tickets = total_received_tickets - total_issued_tickets;
|
|
|
+ // const remaining_tickets = total_received_tickets - total_issued_tickets;
|
|
|
const pending_tickets = merchantData.reduce((total, item) => {
|
|
|
const estimated_invoice_amount = parseFloat(item.estimated_invoice_amount);
|
|
|
if (estimated_invoice_amount > 0) {
|
|
@@ -1313,12 +1321,12 @@
|
|
|
}
|
|
|
return total;
|
|
|
}, 0);
|
|
|
- const ticket_difference = remaining_tickets - pending_tickets;
|
|
|
- const ch_estimated_invoice_amount = channelData.reduce((total, item) => {
|
|
|
+ // const ticket_difference = remaining_tickets - pending_tickets;
|
|
|
+ this.ch_estimated_invoice_amount = channelData.reduce((total, item) => {
|
|
|
return total + parseFloat(item.estimated_invoice_amount);
|
|
|
}, 0);
|
|
|
- let invoice_needed_amount = pending_tickets - ch_estimated_invoice_amount - parseFloat(invoice_remaining_amount);
|
|
|
- for (const chan of channelData) {
|
|
|
+ // let invoice_needed_amount = pending_tickets - ch_estimated_invoice_amount - parseFloat(invoice_remaining_amount);
|
|
|
+ for (const chan of channelData) { //合并的单元格属性,合并项的数值保持一致
|
|
|
chan.invoice_remaining_amount = formatDecimals(invoice_remaining_amount);
|
|
|
chan.invoice_needed_amount = formatDecimals(invoice_needed_amount);
|
|
|
chan.receivable_ticket = formatDecimals(receivable_ticket);
|
|
@@ -1328,6 +1336,7 @@
|
|
|
chan.remaining_tickets = formatDecimals(remaining_tickets);
|
|
|
chan.pending_tickets = formatDecimals(pending_tickets);
|
|
|
chan.ticket_difference = formatDecimals(ticket_difference);
|
|
|
+ chan.adjustment_value = formatDecimals(adjustment_value);
|
|
|
}
|
|
|
|
|
|
layui.table.render({
|
|
@@ -1346,6 +1355,7 @@
|
|
|
{field: 'pending_tickets', title: '待开票', width: 150},
|
|
|
{field: 'ticket_difference', title: '差额', width: 150},
|
|
|
{field: 'invoice_remaining_amount', title: '现有多少票', width: 150},
|
|
|
+ {field: 'adjustment_value', title: '矫正值', width: 150},
|
|
|
{field: 'invoice_needed_amount', title: '需进票', width: 150},
|
|
|
]],
|
|
|
done: function (res, curr, count) {
|
|
@@ -1357,6 +1367,39 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ calcTicketDifference() {
|
|
|
+ const that = this;
|
|
|
+ const tbRoot = $('#' + this.tableId);
|
|
|
+ const trs = tbRoot.next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
+ trs.each(function(i, tr) {
|
|
|
+ const pending_tickets = $(tr).find('td[data-field="pending_tickets"]').not('.layui-hide').find('.layui-table-cell').text().trim();
|
|
|
+ const remaining_tickets = $(tr).find('td[data-field="remaining_tickets"]').not('.layui-hide').find('.layui-table-cell').text().trim();
|
|
|
+
|
|
|
+ const $ticketDifferenceEl = $(tr).find('td[data-field="ticket_difference"]').not('.layui-hide').find('.layui-table-cell');
|
|
|
+ if ($ticketDifferenceEl.length > 0) {
|
|
|
+ const ticket_difference = parseFloat(remaining_tickets) - parseFloat(pending_tickets);
|
|
|
+ $ticketDifferenceEl.html(formatDecimals(ticket_difference));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ calcInvoiceNeededAmount() {
|
|
|
+ const that = this;
|
|
|
+ const tbRoot = $('#' + this.tableId);
|
|
|
+ const trs = tbRoot.next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
+ trs.each(function(i, tr) {
|
|
|
+ const pending_tickets = $(tr).find('td[data-field="pending_tickets"]').not('.layui-hide').find('.layui-table-cell').text().trim();
|
|
|
+ const invoice_remaining_amount = $(tr).find('td[data-field="invoice_remaining_amount"]').not('.layui-hide').find('.layui-table-cell').text().trim();
|
|
|
+ const adjustment_value = $(tr).find('td[data-field="adjustment_value"]').not('.layui-hide').find('.layui-table-cell').text().trim();
|
|
|
+
|
|
|
+ const $invoiceNeededAmountEl = $(tr).find('td[data-field="invoice_needed_amount"]').not('.layui-hide').find('.layui-table-cell');
|
|
|
+ if ($invoiceNeededAmountEl.length > 0) {
|
|
|
+ const invoice_needed_amount = parseFloat(pending_tickets) - that.ch_estimated_invoice_amount - parseFloat(invoice_remaining_amount) + parseFloat(adjustment_value);
|
|
|
+ $invoiceNeededAmountEl.html(formatDecimals(invoice_needed_amount));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
updateTable() {
|
|
|
this.setValueClass(['total_amounts', 'receivable_ticket', 'total_invoiced', 'total_received_tickets', 'issuable_ticket', 'total_issued_tickets', 'remaining_tickets', 'pending_tickets', 'ticket_difference', 'invoice_needed_amount']);
|
|
|
}
|
|
@@ -1365,7 +1408,7 @@
|
|
|
const tbRoot = $('#' + this.tableId);
|
|
|
const trs = tbRoot.next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
|
|
|
- const mergeColumns = ['receivable_ticket', 'total_received_tickets', 'issuable_ticket', 'total_issued_tickets', 'remaining_tickets', 'pending_tickets', 'ticket_difference', 'invoice_remaining_amount', 'invoice_needed_amount'];
|
|
|
+ const mergeColumns = ['receivable_ticket', 'total_received_tickets', 'issuable_ticket', 'total_issued_tickets', 'remaining_tickets', 'pending_tickets', 'ticket_difference', 'invoice_remaining_amount', 'adjustment_value', 'invoice_needed_amount'];
|
|
|
for (let col of mergeColumns) {
|
|
|
trs.eq(0).find('td[data-field="' + col + '"]').attr('rowspan', this.lines);
|
|
|
for (let j = 1; j < this.lines; j++) {
|
|
@@ -1379,7 +1422,7 @@
|
|
|
const tbRoot = $('#' + this.tableId);
|
|
|
const trs = tbRoot.next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
trs.each(function (i, tr) {
|
|
|
- const editNumberColumns = ['invoice_remaining_amount'];
|
|
|
+ const editNumberColumns = ['remaining_tickets', 'ticket_difference', 'invoice_remaining_amount', 'adjustment_value', 'invoice_needed_amount'];
|
|
|
|
|
|
for (let col of editNumberColumns) {
|
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
@@ -1402,6 +1445,14 @@
|
|
|
}
|
|
|
val = normalizeAmount(val);//过滤,比如前导 0
|
|
|
valDiv.html(formatDecimals(val));
|
|
|
+
|
|
|
+ if (col === 'invoice_remaining_amount' || col === 'adjustment_value') {
|
|
|
+ that.calcInvoiceNeededAmount();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (col === 'remaining_tickets') {
|
|
|
+ that.calcTicketDifference();
|
|
|
+ }
|
|
|
|
|
|
const index = $(this).parent().parent().data('index');
|
|
|
await that.saveEdit(index);
|
|
@@ -1421,16 +1472,28 @@
|
|
|
|
|
|
const tr = $('#' + this.tableId).next('.layui-table-view').find('.layui-table-body tbody tr[data-index="' + index + '"]');
|
|
|
const invoice_remaining_amount = tr.find('td[data-field="invoice_remaining_amount"]').find('div').not('.layui-hide').text().trim();
|
|
|
+ const remaining_tickets = tr.find('td[data-field="remaining_tickets"]').find('div').not('.layui-hide').text().trim();
|
|
|
+ const invoice_needed_amount = tr.find('td[data-field="invoice_needed_amount"]').find('div').not('.layui-hide').text().trim();
|
|
|
+ const ticket_difference = tr.find('td[data-field="ticket_difference"]').find('div').not('.layui-hide').text().trim();
|
|
|
+ const adjustment_value = tr.find('td[data-field="adjustment_value"]').find('div').not('.layui-hide').text().trim();
|
|
|
|
|
|
let item = dataHelper.getSummaryList().find(item => item.subject === this.subject);
|
|
|
if (item === undefined) {
|
|
|
item = {
|
|
|
sort: 0,
|
|
|
subject: this.subject,
|
|
|
- invoice_remaining_amount: invoice_remaining_amount
|
|
|
+ invoice_remaining_amount: invoice_remaining_amount,
|
|
|
+ remaining_tickets: remaining_tickets,
|
|
|
+ invoice_needed_amount: invoice_needed_amount,
|
|
|
+ ticket_difference: ticket_difference,
|
|
|
+ adjustment_value: adjustment_value
|
|
|
};
|
|
|
} else {
|
|
|
item.invoice_remaining_amount = invoice_remaining_amount;
|
|
|
+ item.remaining_tickets = remaining_tickets;
|
|
|
+ item.invoice_needed_amount = invoice_needed_amount;
|
|
|
+ item.ticket_difference = ticket_difference;
|
|
|
+ item.adjustment_value = adjustment_value;
|
|
|
}
|
|
|
|
|
|
await dataHelper.addOrUpdateData(CONSTANTS.KEY_QUOTA_SUMMARY, item, 1);
|