|
@@ -24,13 +24,32 @@
|
|
margin-top: 10px;
|
|
margin-top: 10px;
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
- align-items: center;
|
|
|
|
- /*border: 1px solid #ccc;*/
|
|
|
|
padding: 10px;
|
|
padding: 10px;
|
|
}
|
|
}
|
|
|
|
|
|
.btn-container div:last-child {
|
|
.btn-container div:last-child {
|
|
- text-align: right;
|
|
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ gap: 10px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .btn-container .layui-input,
|
|
|
|
+ .btn-container .layui-btn {
|
|
|
|
+ height: 40px;
|
|
|
|
+ line-height: 40px;
|
|
|
|
+ padding: 0 10px;
|
|
|
|
+ margin: 0;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .btn-container .layui-btn {
|
|
|
|
+ background-color: #1E9FFF;
|
|
|
|
+ color: white;
|
|
|
|
+ border: none;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: center;
|
|
}
|
|
}
|
|
|
|
|
|
.layui-btn-sm {
|
|
.layui-btn-sm {
|
|
@@ -42,7 +61,7 @@
|
|
.stats-panel {
|
|
.stats-panel {
|
|
margin-top: 40px;
|
|
margin-top: 40px;
|
|
margin-left: 30px;
|
|
margin-left: 30px;
|
|
- width: 1940px;
|
|
|
|
|
|
+ width: 2090px;
|
|
overflow-x: hidden;
|
|
overflow-x: hidden;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -228,9 +247,9 @@
|
|
width: 1210px;
|
|
width: 1210px;
|
|
}
|
|
}
|
|
|
|
|
|
- .reset-bar {
|
|
|
|
|
|
+ .reset-bar, .reset-bar-c {
|
|
margin: 0 10px;
|
|
margin: 0 10px;
|
|
- width: 1930px;
|
|
|
|
|
|
+ width: 2080px;
|
|
/*overflow-x: auto;*/
|
|
/*overflow-x: auto;*/
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
@@ -238,7 +257,7 @@
|
|
position: relative;
|
|
position: relative;
|
|
}
|
|
}
|
|
|
|
|
|
- .reset-bar button {
|
|
|
|
|
|
+ .reset-bar button, .reset-bar-c button {
|
|
height: 28px;
|
|
height: 28px;
|
|
line-height: 28px;
|
|
line-height: 28px;
|
|
display: inline-block;
|
|
display: inline-block;
|
|
@@ -246,6 +265,18 @@
|
|
width: 150px;
|
|
width: 150px;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ .reset-bar-c button:first-child {
|
|
|
|
+ margin-left: 600px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .reset-bar-c button:nth-child(2) {
|
|
|
|
+ margin-left: 150px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .reset-bar-c button:nth-child(3) {
|
|
|
|
+ margin-left: 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
.company-checkbox {
|
|
.company-checkbox {
|
|
display: inline-flex;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
@@ -337,6 +368,7 @@
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
|
|
+ <input class="layui-input query-input" type="text" readonly value="" name="query_month" id="query_month" autocomplete="off" />
|
|
<button type="button" class="layui-btn layui-bg-blue" id="btn-update-all">更新数据</button>
|
|
<button type="button" class="layui-btn layui-bg-blue" id="btn-update-all">更新数据</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -345,6 +377,14 @@
|
|
<!-- 主体 -->
|
|
<!-- 主体 -->
|
|
<div class="stats-panel layui-font-14">
|
|
<div class="stats-panel layui-font-14">
|
|
<company-set type="KEY_QUOTA_COMPANY" emit="updateCompany"></company-set>
|
|
<company-set type="KEY_QUOTA_COMPANY" emit="updateCompany"></company-set>
|
|
|
|
+ <div class="reset-bar-c">
|
|
|
|
+ <button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-company" data-col="corrected_used_quota">一键清零</button>
|
|
|
|
+ <button type="button" class="layui-btn layui-bg-orange ac-batch-invoice" data-table="tb-company">批量提交</button>
|
|
|
|
+ <button type="button" class="layui-btn layui-bg-red ac-approve" data-table="tb-company">
|
|
|
|
+ 审批
|
|
|
|
+ <span class="btn-badge" id="badge-approve-company">0</span>
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
<table class="layui-hide" id="tb-company"></table>
|
|
<table class="layui-hide" id="tb-company"></table>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -353,6 +393,7 @@
|
|
<merchant-set type="KEY_QUOTA_MERCHANT" emit="updateMerchant"></merchant-set>
|
|
<merchant-set type="KEY_QUOTA_MERCHANT" emit="updateMerchant"></merchant-set>
|
|
<div class="reset-bar">
|
|
<div class="reset-bar">
|
|
<button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-merchant" data-col="total_invoiced">一键清零</button>
|
|
<button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-merchant" data-col="total_invoiced">一键清零</button>
|
|
|
|
+ <button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-merchant" data-col="month_opened">一键清零</button>
|
|
<button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-merchant" data-col="actual_invoice_amount">一键清零</button>
|
|
<button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-merchant" data-col="actual_invoice_amount">一键清零</button>
|
|
<button type="button" class="layui-btn layui-bg-orange ac-batch-invoice" data-table="tb-merchant">批量提交</button>
|
|
<button type="button" class="layui-btn layui-bg-orange ac-batch-invoice" data-table="tb-merchant">批量提交</button>
|
|
<button type="button" class="layui-btn layui-bg-red ac-approve" data-table="tb-merchant">
|
|
<button type="button" class="layui-btn layui-bg-red ac-approve" data-table="tb-merchant">
|
|
@@ -368,6 +409,7 @@
|
|
<channel-set type="KEY_QUOTA_CHANNEL" emit="updateChannel"></channel-set>
|
|
<channel-set type="KEY_QUOTA_CHANNEL" emit="updateChannel"></channel-set>
|
|
<div class="reset-bar">
|
|
<div class="reset-bar">
|
|
<button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-channel" data-col="total_invoiced">一键清零</button>
|
|
<button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-channel" data-col="total_invoiced">一键清零</button>
|
|
|
|
+ <button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-channel" data-col="month_opened">一键清零</button>
|
|
<button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-channel" data-col="actual_invoice_amount">一键清零</button>
|
|
<button type="button" class="layui-btn layui-btn-light-yellow reset-col" data-table="tb-channel" data-col="actual_invoice_amount">一键清零</button>
|
|
<button type="button" class="layui-btn layui-bg-orange ac-batch-invoice" data-table="tb-channel">批量提交</button>
|
|
<button type="button" class="layui-btn layui-bg-orange ac-batch-invoice" data-table="tb-channel">批量提交</button>
|
|
<button type="button" class="layui-btn layui-bg-red ac-approve" data-table="tb-channel">
|
|
<button type="button" class="layui-btn layui-bg-red ac-approve" data-table="tb-channel">
|
|
@@ -441,6 +483,8 @@
|
|
item.total_quota = formatDecimals(item.total_quota);
|
|
item.total_quota = formatDecimals(item.total_quota);
|
|
item.used_quota = formatDecimals(item.used_quota);
|
|
item.used_quota = formatDecimals(item.used_quota);
|
|
item.left_quota = formatDecimals(item.total_quota - item.used_quota);
|
|
item.left_quota = formatDecimals(item.total_quota - item.used_quota);
|
|
|
|
+ item.corrected_used_quota = '0';
|
|
|
|
+ item.operator = '';
|
|
});
|
|
});
|
|
layui.table.render({
|
|
layui.table.render({
|
|
elem: '#' + this.tableId,
|
|
elem: '#' + this.tableId,
|
|
@@ -451,14 +495,20 @@
|
|
{field: 'total_quota', title: '总额度', width: 200},
|
|
{field: 'total_quota', title: '总额度', width: 200},
|
|
{field: 'used_quota', title: '已用额度', width: 110},
|
|
{field: 'used_quota', title: '已用额度', width: 110},
|
|
{field: 'left_quota', title: '剩余额度', width: 150},
|
|
{field: 'left_quota', title: '剩余额度', width: 150},
|
|
- {field: 'remark', title: '备注', width: 150}
|
|
|
|
|
|
+ {field: 'corrected_used_quota', title: '已用额度矫正', width: 150},
|
|
|
|
+ {field: 'operator', title: '操作人', width: 150},
|
|
|
|
+ {field: 'remark', title: '备注', width: 150},
|
|
|
|
+ {field: 'action', title: '操作', width: 150, templet: function(d){return '<button class="layui-btn layui-btn-sm invoice-apply-signle" style="margin: 0" data-index="'+d.LAY_TABLE_INDEX+'">矫正</button>';}}
|
|
]],
|
|
]],
|
|
done: function (res, curr, count) {
|
|
done: function (res, curr, count) {
|
|
const tableItem = $('#' + that.tableId);
|
|
const tableItem = $('#' + that.tableId);
|
|
const trs = tableItem.next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
const trs = tableItem.next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
|
|
|
trs.each(function(i, tr) {
|
|
trs.each(function(i, tr) {
|
|
- const editNumberColumns = ['total_quota', 'used_quota'];
|
|
|
|
|
|
+ const editNumberColumns = ['corrected_used_quota'];
|
|
|
|
+ if (isAdmin === true) {
|
|
|
|
+ editNumberColumns.push('total_quota', 'used_quota');
|
|
|
|
+ }
|
|
|
|
|
|
for(let col of editNumberColumns) {
|
|
for(let col of editNumberColumns) {
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
@@ -490,7 +540,7 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- const editTextColumns = ['remark'];
|
|
|
|
|
|
+ const editTextColumns = ['remark', 'operator'];
|
|
for(let col of editTextColumns) {
|
|
for(let col of editTextColumns) {
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
const valDiv = td.find('div');
|
|
const valDiv = td.find('div');
|
|
@@ -519,6 +569,11 @@
|
|
});
|
|
});
|
|
|
|
|
|
that.setValueClass(['left_quota']);
|
|
that.setValueClass(['left_quota']);
|
|
|
|
+
|
|
|
|
+ tableItem.next('.layui-table-view').off('click', '.invoice-apply-signle').on('click', '.invoice-apply-signle', function (){
|
|
|
|
+ const index = $(this).data('index');
|
|
|
|
+ that.applyOne(index);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -554,6 +609,10 @@
|
|
await dataHelper.addOrUpdateData(CONSTANTS.KEY_QUOTA_COMPANY, item, 1);
|
|
await dataHelper.addOrUpdateData(CONSTANTS.KEY_QUOTA_COMPANY, item, 1);
|
|
summaryTable.renderTable();
|
|
summaryTable.renderTable();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ applyOne(index) {
|
|
|
|
+ batchCorrected.doApplyOne(this.tableId, index);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
class MerchantTable extends LayuiTableBase {
|
|
class MerchantTable extends LayuiTableBase {
|
|
@@ -565,9 +624,13 @@
|
|
const that = this;
|
|
const that = this;
|
|
|
|
|
|
const merchantList = dataHelper.getMerchantList();
|
|
const merchantList = dataHelper.getMerchantList();
|
|
|
|
+ merchantList.forEach(mItem => {
|
|
|
|
+ setEmptyFieldsToZero(mItem, ['total_invoiced', 'month_opened']);
|
|
|
|
+ });
|
|
const mchIds = merchantList.map(item => item.mch_id).join(',')
|
|
const mchIds = merchantList.map(item => item.mch_id).join(',')
|
|
|
|
|
|
- const sysData = await statsApi.getSysMchAmounts(mchIds);
|
|
|
|
|
|
+ const currMonth = getCurrMonthCondition();
|
|
|
|
+ const sysData = await statsApi.getSysMchAmounts(mchIds, currMonth);
|
|
let sysMchData = [];
|
|
let sysMchData = [];
|
|
if (sysData.state === true) {
|
|
if (sysData.state === true) {
|
|
sysMchData = sysData.list;
|
|
sysMchData = sysData.list;
|
|
@@ -607,6 +670,7 @@
|
|
{field: 'last_invoice_date', title: '上次开票日期', width: 150, templet: function(d){
|
|
{field: 'last_invoice_date', title: '上次开票日期', width: 150, templet: function(d){
|
|
return '<input type="text" class="layui-input date-input" data-index="' + d.LAY_TABLE_INDEX + '" data-field="last_invoice_date" value="' + d.last_invoice_date + '">';
|
|
return '<input type="text" class="layui-input date-input" data-index="' + d.LAY_TABLE_INDEX + '" data-field="last_invoice_date" value="' + d.last_invoice_date + '">';
|
|
}},
|
|
}},
|
|
|
|
+ {field: 'month_opened', title: '本月已开票', width: 150},
|
|
{field: 'available_invoice_amount', title: '本月可开票总计', width: 150},
|
|
{field: 'available_invoice_amount', title: '本月可开票总计', width: 150},
|
|
{field: 'estimated_invoice_amount', title: '预计本月开票金额', width: 150},
|
|
{field: 'estimated_invoice_amount', title: '预计本月开票金额', width: 150},
|
|
{field: 'actual_invoice_amount', title: '实际本次开票', width: 150},
|
|
{field: 'actual_invoice_amount', title: '实际本次开票', width: 150},
|
|
@@ -615,7 +679,7 @@
|
|
}},
|
|
}},
|
|
{field: 'operator', title: '操作人', width: 150},
|
|
{field: 'operator', title: '操作人', width: 150},
|
|
{field: 'remark', title: '备注', width: 150},
|
|
{field: 'remark', title: '备注', width: 150},
|
|
- {field: 'delete', title: '操作', width: 100, templet: function(d){return '<button class="layui-btn layui-btn-sm invoice-apply-signle" style="margin: 0" data-index="'+d.LAY_TABLE_INDEX+'">申请</button>';}}
|
|
|
|
|
|
+ {field: 'action', title: '操作', width: 100, templet: function(d){return '<button class="layui-btn layui-btn-sm invoice-apply-signle" style="margin: 0" data-index="'+d.LAY_TABLE_INDEX+'">申请</button>';}}
|
|
]],
|
|
]],
|
|
done: function (res, curr, count) {
|
|
done: function (res, curr, count) {
|
|
const tableItem = $('#' + that.tableId);
|
|
const tableItem = $('#' + that.tableId);
|
|
@@ -629,11 +693,15 @@
|
|
|
|
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.updateAvailableInvoiceAmount();
|
|
that.updateAvailableInvoiceAmount();
|
|
- that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount']);
|
|
|
|
|
|
+ that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount', 'month_opened']);
|
|
that.updateColumnCnMoney(['total_invoiced']);
|
|
that.updateColumnCnMoney(['total_invoiced']);
|
|
|
|
|
|
trs.each(function (i, tr) {
|
|
trs.each(function (i, tr) {
|
|
const editNumberColumns = ['total_invoiced', 'actual_invoice_amount'];
|
|
const editNumberColumns = ['total_invoiced', 'actual_invoice_amount'];
|
|
|
|
+ if (isAdmin === true) {
|
|
|
|
+ editNumberColumns.push('month_opened');
|
|
|
|
+ }
|
|
|
|
+
|
|
for (let col of editNumberColumns) {
|
|
for (let col of editNumberColumns) {
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
const valDiv = td.find('div');
|
|
const valDiv = td.find('div');
|
|
@@ -659,14 +727,14 @@
|
|
const index = $(this).parent().parent().data('index');
|
|
const index = $(this).parent().parent().data('index');
|
|
await that.saveEdit(index);
|
|
await that.saveEdit(index);
|
|
|
|
|
|
- if (col === 'total_invoiced') {
|
|
|
|
|
|
+ if (col === 'month_opened') {
|
|
const subject = $(tr).find('td[data-field="subject"]').find('div').text();
|
|
const subject = $(tr).find('td[data-field="subject"]').find('div').text();
|
|
await that.updateCompanyUsedQuota(subject);
|
|
await that.updateCompanyUsedQuota(subject);
|
|
}
|
|
}
|
|
|
|
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.updateAvailableInvoiceAmount();
|
|
that.updateAvailableInvoiceAmount();
|
|
- that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount']);
|
|
|
|
|
|
+ that.setValueClass(['total_invoiced', 'month_opened', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount', 'month_opened']);
|
|
that.updateColumnCnMoney(['total_invoiced']);
|
|
that.updateColumnCnMoney(['total_invoiced']);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -695,7 +763,7 @@
|
|
|
|
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.updateAvailableInvoiceAmount();
|
|
that.updateAvailableInvoiceAmount();
|
|
- that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount']);
|
|
|
|
|
|
+ that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount', 'month_opened']);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -848,12 +916,14 @@
|
|
|
|
|
|
const tr = $('#' + this.tableId).next('.layui-table-view').find('.layui-table-body tbody tr[data-index="' + index + '"]');
|
|
const tr = $('#' + this.tableId).next('.layui-table-view').find('.layui-table-body tbody tr[data-index="' + index + '"]');
|
|
const total_invoiced = tr.find('td[data-field="total_invoiced"]').find('div').text().trim();
|
|
const total_invoiced = tr.find('td[data-field="total_invoiced"]').find('div').text().trim();
|
|
|
|
+ const month_opened = tr.find('td[data-field="month_opened"]').find('div').text().trim();
|
|
const last_invoice_date = tr.find('td[data-field="last_invoice_date"]').find('div').find('input').val().trim();
|
|
const last_invoice_date = tr.find('td[data-field="last_invoice_date"]').find('div').find('input').val().trim();
|
|
const remark = tr.find('td[data-field="remark"]').find('div').text().trim();
|
|
const remark = tr.find('td[data-field="remark"]').find('div').text().trim();
|
|
|
|
|
|
let item = merchantData[index];
|
|
let item = merchantData[index];
|
|
item.total_invoiced = total_invoiced || "0";
|
|
item.total_invoiced = total_invoiced || "0";
|
|
item.last_invoice_date = last_invoice_date || "0";
|
|
item.last_invoice_date = last_invoice_date || "0";
|
|
|
|
+ item.month_opened = month_opened || "0";
|
|
item.remark = remark;
|
|
item.remark = remark;
|
|
|
|
|
|
await dataHelper.addOrUpdateData(CONSTANTS.KEY_QUOTA_MERCHANT, item, 2);
|
|
await dataHelper.addOrUpdateData(CONSTANTS.KEY_QUOTA_MERCHANT, item, 2);
|
|
@@ -866,7 +936,7 @@
|
|
const merchantDataNew = dataHelper.getMerchantList();
|
|
const merchantDataNew = dataHelper.getMerchantList();
|
|
const total = merchantDataNew
|
|
const total = merchantDataNew
|
|
.filter(mItem => mItem.subject === subject)
|
|
.filter(mItem => mItem.subject === subject)
|
|
- .reduce((sum, item) => sum + parseFloat(item.total_invoiced), 0);
|
|
|
|
|
|
+ .reduce((sum, item) => sum + parseFloat(item.month_opened), 0);
|
|
activeCompany.used_quota = total.toString();
|
|
activeCompany.used_quota = total.toString();
|
|
}
|
|
}
|
|
await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_COMPANY, companyList);
|
|
await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_COMPANY, companyList);
|
|
@@ -891,9 +961,13 @@
|
|
const that = this;
|
|
const that = this;
|
|
|
|
|
|
const channelList = dataHelper.getChannelList();
|
|
const channelList = dataHelper.getChannelList();
|
|
|
|
+ channelList.forEach(cItem => {
|
|
|
|
+ setEmptyFieldsToZero(cItem, ['total_invoiced', 'month_opened']);
|
|
|
|
+ });
|
|
const storeIds = channelList.map(item => item.store_id).join(',')
|
|
const storeIds = channelList.map(item => item.store_id).join(',')
|
|
|
|
|
|
- const sysData = await statsApi.getSysChanAmounts(storeIds);
|
|
|
|
|
|
+ const currMonth = getCurrMonthCondition();
|
|
|
|
+ const sysData = await statsApi.getSysChanAmounts(storeIds, currMonth);
|
|
let sysChanData = [];
|
|
let sysChanData = [];
|
|
if (sysData.state === true) {
|
|
if (sysData.state === true) {
|
|
sysChanData = sysData.list;
|
|
sysChanData = sysData.list;
|
|
@@ -933,6 +1007,7 @@
|
|
{field: 'last_invoice_date', title: '上次开票日期', width: 150, templet: function(d){
|
|
{field: 'last_invoice_date', title: '上次开票日期', width: 150, templet: function(d){
|
|
return '<input type="text" class="layui-input date-input" data-index="' + d.LAY_TABLE_INDEX + '" data-field="last_invoice_date" value="' + d.last_invoice_date + '">';
|
|
return '<input type="text" class="layui-input date-input" data-index="' + d.LAY_TABLE_INDEX + '" data-field="last_invoice_date" value="' + d.last_invoice_date + '">';
|
|
}},
|
|
}},
|
|
|
|
+ {field: 'month_opened', title: '本月已开票', width: 150},
|
|
{field: 'available_invoice_amount', title: '本月可开票总计', width: 150},
|
|
{field: 'available_invoice_amount', title: '本月可开票总计', width: 150},
|
|
{field: 'estimated_invoice_amount', title: '预计本月开票金额', width: 150},
|
|
{field: 'estimated_invoice_amount', title: '预计本月开票金额', width: 150},
|
|
{field: 'actual_invoice_amount', title: '实际本次开票', width: 150},
|
|
{field: 'actual_invoice_amount', title: '实际本次开票', width: 150},
|
|
@@ -941,7 +1016,7 @@
|
|
}},
|
|
}},
|
|
{field: 'operator', title: '操作人', width: 150},
|
|
{field: 'operator', title: '操作人', width: 150},
|
|
{field: 'remark', title: '备注', width: 150},
|
|
{field: 'remark', title: '备注', width: 150},
|
|
- {field: 'delete', title: '操作', width: 100, templet: function(d){return '<button class="layui-btn layui-btn-sm invoice-apply-signle" style="margin: 0" data-index="'+d.LAY_TABLE_INDEX+'">申请</button>';}}
|
|
|
|
|
|
+ {field: 'action', title: '操作', width: 100, templet: function(d){return '<button class="layui-btn layui-btn-sm invoice-apply-signle" style="margin: 0" data-index="'+d.LAY_TABLE_INDEX+'">申请</button>';}}
|
|
]],
|
|
]],
|
|
done: function (res, curr, count) {
|
|
done: function (res, curr, count) {
|
|
const tableItem = $('#' + that.tableId);
|
|
const tableItem = $('#' + that.tableId);
|
|
@@ -955,11 +1030,15 @@
|
|
|
|
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.updateAvailableInvoiceAmount();
|
|
that.updateAvailableInvoiceAmount();
|
|
- that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount']);
|
|
|
|
|
|
+ that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount', 'month_opened']);
|
|
that.updateColumnCnMoney(['total_invoiced']);
|
|
that.updateColumnCnMoney(['total_invoiced']);
|
|
|
|
|
|
trs.each(function (i, tr) {
|
|
trs.each(function (i, tr) {
|
|
const editNumberColumns = ['total_invoiced', 'actual_invoice_amount'];
|
|
const editNumberColumns = ['total_invoiced', 'actual_invoice_amount'];
|
|
|
|
+ if (isAdmin === true) {
|
|
|
|
+ editNumberColumns.push('month_opened');
|
|
|
|
+ }
|
|
|
|
+
|
|
for (let col of editNumberColumns) {
|
|
for (let col of editNumberColumns) {
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
const td = $(tr).find('td[data-field="' + col + '"]').not('.layui-hide');
|
|
const valDiv = td.find('div');
|
|
const valDiv = td.find('div');
|
|
@@ -987,7 +1066,7 @@
|
|
|
|
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.updateAvailableInvoiceAmount();
|
|
that.updateAvailableInvoiceAmount();
|
|
- that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount']);
|
|
|
|
|
|
+ that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount', 'month_opened']);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1015,7 +1094,7 @@
|
|
|
|
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.deltaValue('amounts', 'total_invoiced', 'estimated_invoice_amount');
|
|
that.updateAvailableInvoiceAmount();
|
|
that.updateAvailableInvoiceAmount();
|
|
- that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount']);
|
|
|
|
|
|
+ that.setValueClass(['total_invoiced', 'available_invoice_amount', 'estimated_invoice_amount', 'actual_invoice_amount', 'month_opened']);
|
|
that.updateColumnCnMoney(['total_invoiced']);
|
|
that.updateColumnCnMoney(['total_invoiced']);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -1169,11 +1248,13 @@
|
|
|
|
|
|
const tr = $('#' + this.tableId).next('.layui-table-view').find('.layui-table-body tbody tr[data-index="' + index + '"]');
|
|
const tr = $('#' + this.tableId).next('.layui-table-view').find('.layui-table-body tbody tr[data-index="' + index + '"]');
|
|
const total_invoiced = tr.find('td[data-field="total_invoiced"]').find('div').text().trim();
|
|
const total_invoiced = tr.find('td[data-field="total_invoiced"]').find('div').text().trim();
|
|
|
|
+ const month_opened = tr.find('td[data-field="month_opened"]').find('div').text().trim();
|
|
const last_invoice_date = tr.find('td[data-field="last_invoice_date"]').find('div').find('input').val().trim();
|
|
const last_invoice_date = tr.find('td[data-field="last_invoice_date"]').find('div').find('input').val().trim();
|
|
const remark = tr.find('td[data-field="remark"]').find('div').text().trim();
|
|
const remark = tr.find('td[data-field="remark"]').find('div').text().trim();
|
|
|
|
|
|
let item = channelData[index];
|
|
let item = channelData[index];
|
|
item.total_invoiced = total_invoiced || "0";
|
|
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 || "0";
|
|
item.remark = remark;
|
|
item.remark = remark;
|
|
|
|
|
|
@@ -1251,9 +1332,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
const n_estimated_amount = parseFloat(estimated_amount);
|
|
const n_estimated_amount = parseFloat(estimated_amount);
|
|
- if (n_estimated_amount > 0) {
|
|
|
|
- channelQuota[subject].channel_invoice_quota += n_estimated_amount;
|
|
|
|
- }
|
|
|
|
|
|
+ channelQuota[subject].channel_invoice_quota += n_estimated_amount;
|
|
|
|
|
|
channelQuota[subject].channel_amounts += parseFloat(channel_amounts);
|
|
channelQuota[subject].channel_amounts += parseFloat(channel_amounts);
|
|
channelQuota[subject].channel_total_invoiced += parseFloat(total_invoiced);
|
|
channelQuota[subject].channel_total_invoiced += parseFloat(total_invoiced);
|
|
@@ -1439,8 +1518,7 @@
|
|
const targetRow = trs.eq(index);
|
|
const targetRow = trs.eq(index);
|
|
const taskData = this.lineData(targetRow);
|
|
const taskData = this.lineData(targetRow);
|
|
if (!isNumeric(taskData.actual_invoice_amount)
|
|
if (!isNumeric(taskData.actual_invoice_amount)
|
|
- || taskData.actual_invoice_amount === '0'
|
|
|
|
- || Number(taskData.actual_invoice_amount) < 0) {
|
|
|
|
|
|
+ || taskData.actual_invoice_amount === '0') {
|
|
showErr(`${taskData.type_name} 金额设置无效`);
|
|
showErr(`${taskData.type_name} 金额设置无效`);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -1456,15 +1534,14 @@
|
|
this.doApply([taskData]);
|
|
this.doApply([taskData]);
|
|
}
|
|
}
|
|
|
|
|
|
- doApplyMore(tableId, channelData) {
|
|
|
|
|
|
+ doApplyMore(tableId) {
|
|
const that = this;
|
|
const that = this;
|
|
const trs = $('#' + tableId).next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
const trs = $('#' + tableId).next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
const taskDatas = [], errs = [];
|
|
const taskDatas = [], errs = [];
|
|
trs.each(function(i, targetRow) {
|
|
trs.each(function(i, targetRow) {
|
|
const taskData = that.lineData($(targetRow));
|
|
const taskData = that.lineData($(targetRow));
|
|
if (!isNumeric(taskData.actual_invoice_amount)
|
|
if (!isNumeric(taskData.actual_invoice_amount)
|
|
- || taskData.actual_invoice_amount === '0'
|
|
|
|
- || Number(taskData.actual_invoice_amount) < 0) {
|
|
|
|
|
|
+ || taskData.actual_invoice_amount === '0') {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (!isValidDate(taskData.invoice_date)) {
|
|
if (!isValidDate(taskData.invoice_date)) {
|
|
@@ -1678,10 +1755,18 @@
|
|
if (that.type === 'mch') {
|
|
if (that.type === 'mch') {
|
|
await dataHelper.loadMerchant();
|
|
await dataHelper.loadMerchant();
|
|
typeData = dataHelper.getMerchantList();
|
|
typeData = dataHelper.getMerchantList();
|
|
|
|
+ typeData.forEach(tItem => {
|
|
|
|
+ setEmptyFieldsToZero(tItem, ['total_invoiced', 'month_opened']);
|
|
|
|
+ });
|
|
|
|
+
|
|
typeField = 'mch_id';
|
|
typeField = 'mch_id';
|
|
} else {
|
|
} else {
|
|
await dataHelper.loadChannel();
|
|
await dataHelper.loadChannel();
|
|
typeData = dataHelper.getChannelList();
|
|
typeData = dataHelper.getChannelList();
|
|
|
|
+ typeData.forEach(tItem => {
|
|
|
|
+ setEmptyFieldsToZero(tItem, ['total_invoiced', 'month_opened']);
|
|
|
|
+ });
|
|
|
|
+
|
|
typeField = 'store_id';
|
|
typeField = 'store_id';
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1698,8 +1783,10 @@
|
|
|
|
|
|
const typeItem = typeData.find(tItem => tItem[typeField] === aItem.type_id);
|
|
const typeItem = typeData.find(tItem => tItem[typeField] === aItem.type_id);
|
|
const total_invoiced = parseFloat(typeItem.total_invoiced) + parseFloat(aItem.actual_invoice_amount);
|
|
const total_invoiced = parseFloat(typeItem.total_invoiced) + parseFloat(aItem.actual_invoice_amount);
|
|
|
|
+ const month_opened = parseFloat(typeItem.month_opened) + parseFloat(aItem.actual_invoice_amount);
|
|
typeItem.total_invoiced = total_invoiced.toString();
|
|
typeItem.total_invoiced = total_invoiced.toString();
|
|
typeItem.last_invoice_date = aItem.invoice_date;
|
|
typeItem.last_invoice_date = aItem.invoice_date;
|
|
|
|
+ typeItem.month_opened = month_opened.toString();
|
|
|
|
|
|
const activeCompany = companyData.find(cItem => cItem.name === aItem.subject);
|
|
const activeCompany = companyData.find(cItem => cItem.name === aItem.subject);
|
|
if (activeCompany !== undefined) {
|
|
if (activeCompany !== undefined) {
|
|
@@ -1753,10 +1840,302 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ class BatchCorrected {
|
|
|
|
+ constructor() {
|
|
|
|
+ this.workflow = new BatchWorkflow('company');
|
|
|
|
+ this.dv = 1; //数据版本,作用:由于需求变化导致存储的缓存数据格式发生变化,由该字段标记,审核的时候如果数据版本与当前dv版本不一致,需要手动作废审核重新操作。
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ lineData(targetRow) {
|
|
|
|
+ const name = targetRow.find('td[data-field="name"]').find('div').text().trim();
|
|
|
|
+ const corrected_used_quota = targetRow.find('td[data-field="corrected_used_quota"]').find('div').text().trim();
|
|
|
|
+ const operator = targetRow.find('td[data-field="operator"]').find('div').text().trim();
|
|
|
|
+ const remark = targetRow.find('td[data-field="remark"]').find('div').text().trim();
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ name,
|
|
|
|
+ corrected_used_quota,
|
|
|
|
+ operator,
|
|
|
|
+ remark
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ doApplyOne(tableId, index) {
|
|
|
|
+ const trs = $('#' + tableId).next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
|
+ const targetRow = trs.eq(index);
|
|
|
|
+ const taskData = this.lineData(targetRow);
|
|
|
|
+ if (!isNumeric(taskData.corrected_used_quota)
|
|
|
|
+ || taskData.corrected_used_quota === '0') {
|
|
|
|
+ showErr(`${taskData.name} 矫正金额设置无效`);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (taskData.operator === '') {
|
|
|
|
+ showErr(`${taskData.name} 操作人 设置无效`);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.doApply([taskData]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ doApplyMore(tableId) {
|
|
|
|
+ const that = this;
|
|
|
|
+ const trs = $('#' + tableId).next('.layui-table-view').find('.layui-table-body tbody tr');
|
|
|
|
+ const taskDatas = [], errs = [];
|
|
|
|
+ trs.each(function(i, targetRow) {
|
|
|
|
+ const taskData = that.lineData($(targetRow));
|
|
|
|
+ if (!isNumeric(taskData.corrected_used_quota)
|
|
|
|
+ || taskData.corrected_used_quota === '0'
|
|
|
|
+ || Number(taskData.corrected_used_quota) < 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (taskData.operator === '') {
|
|
|
|
+ const err = `${taskData.type_name} 操作人 设置错误`;
|
|
|
|
+ if (!err.includes(err)) {
|
|
|
|
+ err.push(err);
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ taskDatas.push(taskData);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (errs.length > 0) {
|
|
|
|
+ showErr(errs.join('<br />'));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (taskDatas.length === 0) {
|
|
|
|
+ showErr('没有设置矫正项');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.doApply(taskDatas);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ async doApply(companyUnit) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let errsNormal = [];
|
|
|
|
+
|
|
|
|
+ await this.workflow.initializeGlobalTaskList();
|
|
|
|
+ const pendingTasks = this.workflow.getPendingTasksByApprover();
|
|
|
|
+ pendingTasks.forEach(taskItem => {
|
|
|
|
+ const currItems = taskItem.data.items || [];
|
|
|
|
+ currItems.forEach(currItem => {
|
|
|
|
+ const isPending = companyUnit.find(cItem => {
|
|
|
|
+ return currItem.name === cItem.name;
|
|
|
|
+ });
|
|
|
|
+ if (isPending !== undefined) {
|
|
|
|
+ const err = `${currItem.type_name} 存在处理中的矫正申请,审核后才能再次申请`;
|
|
|
|
+ if (!errsNormal.includes(err)) {
|
|
|
|
+ errsNormal.push(err);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (errsNormal.length > 0) {
|
|
|
|
+ showErr(errsNormal.join('<br />'));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const applyTrnasfer = () => {
|
|
|
|
+ const sortedCompanyUnit = sortByName(companyUnit, 'name');
|
|
|
|
+ layui.table.render({
|
|
|
|
+ elem: '#tb_apply',
|
|
|
|
+ data: sortedCompanyUnit,
|
|
|
|
+ limit: sortedCompanyUnit.length,
|
|
|
|
+ cols: [[
|
|
|
|
+ {field: 'name', title: '对应主体', width: 200},
|
|
|
|
+ {field: 'corrected_used_quota', title: '矫正金额', width: 200},
|
|
|
|
+ {field: 'operator', title: '操作人', width: 100},
|
|
|
|
+ {field: 'remark', title: '备注', width: 200},
|
|
|
|
+ ]],
|
|
|
|
+ done: function (res, curr, count) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ layer.open({
|
|
|
|
+ type: 1,
|
|
|
|
+ title: '已用额度矫正',
|
|
|
|
+ area: ['1150px', '500px'],
|
|
|
|
+ content: $('#rechargeManual'),
|
|
|
|
+ btn: ['确定', '取消'],
|
|
|
|
+ success: function (layero) {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ btn1: function () {
|
|
|
|
+ layer.closeAll();
|
|
|
|
+
|
|
|
|
+ const taskData = filterJsonFields(companyUnit, ["name", "corrected_used_quota", "operator", "remark"]);
|
|
|
|
+ const applyData = {
|
|
|
|
+ items: taskData,
|
|
|
|
+ dv: that.dv
|
|
|
|
+ };
|
|
|
|
+ that.workflow.addTask(applyData, systemUserName, 'admin')
|
|
|
|
+ .then(succ => {
|
|
|
|
+ if (succ === true) {
|
|
|
|
+ showSuccess('已发起已用额度矫正申请');
|
|
|
|
+ } else {
|
|
|
|
+ showErr('处理失败,请重试');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ applyTrnasfer();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ async doBatchCorrected() {
|
|
|
|
+ const that = this;
|
|
|
|
+ let sortedCompanyUnit = [], worklist = [], companyUnit = [], isCorrectVersion = true;
|
|
|
|
+
|
|
|
|
+ const loadCompanyUnit = async () => {
|
|
|
|
+ await this.workflow.initializeGlobalTaskList();
|
|
|
|
+ worklist = this.workflow.getPendingTasksByApprover();
|
|
|
|
+ for (const task of worklist) {
|
|
|
|
+ if (Number(task.data.dv) !== that.dv) {
|
|
|
|
+ isCorrectVersion = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ companyUnit = this.workflow.getPendingTaskDetails();
|
|
|
|
+ sortedCompanyUnit = sortByName(companyUnit, 'name');
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const loadIndex = layer.load(2, {shade: [0.2, '#000']});
|
|
|
|
+
|
|
|
|
+ await loadCompanyUnit();
|
|
|
|
+
|
|
|
|
+ if (isCorrectVersion === false) {
|
|
|
|
+ setTimeout(function() {
|
|
|
|
+ showErr('数据与当前程序版本不匹配,请作废当前数据后重新加款');
|
|
|
|
+ }, 500);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ layui.table.render({
|
|
|
|
+ elem: '#tb_approve',
|
|
|
|
+ data: sortedCompanyUnit,
|
|
|
|
+ limit: sortedCompanyUnit.length,
|
|
|
|
+ cols: [[
|
|
|
|
+ {field: 'name', title: '对应主体', width: 200},
|
|
|
|
+ {field: 'corrected_used_quota', title: '矫正金额', width: 200},
|
|
|
|
+ {field: 'operator', title: '操作人', width: 100},
|
|
|
|
+ {field: 'remark', title: '备注', width: 200},
|
|
|
|
+ {field: 'void_task', title: '', width: 100, templet: function(d){return '<button class="layui-btn layui-btn-sm layui-btn-primary task-void-btn" style="margin: 0" data-index="'+d.LAY_TABLE_INDEX+'">作废</button>';}}
|
|
|
|
+ ]],
|
|
|
|
+ done: function (res, curr, count) {
|
|
|
|
+ const tbRoot = $('#tb_approve');
|
|
|
|
+ const voidOneEvent = () => {
|
|
|
|
+ tbRoot.next('.layui-table-view').off('click', '.task-void-btn').on('click', '.task-void-btn', function () {
|
|
|
|
+ const index = $(this).data('index');
|
|
|
|
+ layer.confirm(`确认作废 ${sortedCompanyUnit[index].name} 的矫正申请吗?`, {
|
|
|
|
+ title: '提示',
|
|
|
|
+ btn: ['确定', '取消']
|
|
|
|
+ }, async (confirmIndex) => {
|
|
|
|
+ const loadIndex = layer.load(2, {shade: [0.2, '#000']});
|
|
|
|
+
|
|
|
|
+ await that.workflow.initializeGlobalTaskList();
|
|
|
|
+
|
|
|
|
+ const succ = await that.workflow.invalidateItem(sortedCompanyUnit[index].name);
|
|
|
|
+ if (succ === true) {
|
|
|
|
+ await loadCompanyUnit();
|
|
|
|
+ layui.table.reload('tb_approve', {
|
|
|
|
+ data: sortedCompanyUnit
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ showErr('作废失败');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ layer.close(loadIndex);
|
|
|
|
+ layer.close(confirmIndex);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ voidOneEvent();
|
|
|
|
+
|
|
|
|
+ layer.close(loadIndex);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ layer.open({
|
|
|
|
+ type: 1,
|
|
|
|
+ title: '已用额度矫正审核',
|
|
|
|
+ area: ['1280px', '500px'],
|
|
|
|
+ content: $('#rechargeManualApprove'),
|
|
|
|
+ btn: ['批准', '作废'],
|
|
|
|
+ success: function (layero) {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ btn1: async function () {
|
|
|
|
+ if (worklist.length === 0) {
|
|
|
|
+ showErr('没有待审核的矫正申请');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (isCorrectVersion === false) {
|
|
|
|
+ showErr('数据与当前程序版本不匹配,请作废当前数据后重新加款');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ layer.load(2, {shade: [0.2, '#000']});
|
|
|
|
+
|
|
|
|
+ await dataHelper.loadComapny();
|
|
|
|
+ const companyData = dataHelper.getCompanyList();
|
|
|
|
+
|
|
|
|
+ for (const task of worklist) {
|
|
|
|
+ await that.workflow.executeTask(task.id, async () => {
|
|
|
|
+ const applyItems = task.data.items;
|
|
|
|
+ applyItems.forEach(aItem => {
|
|
|
|
+ const activeCompany = companyData.find(cItem => cItem.name === aItem.name);
|
|
|
|
+ const used_quota = parseFloat(activeCompany.used_quota) + parseFloat(aItem.corrected_used_quota);
|
|
|
|
+ activeCompany.used_quota = used_quota.toString();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_COMPANY, companyData);
|
|
|
|
+ companyTable.renderTable();
|
|
|
|
+ summaryTable.renderTable();
|
|
|
|
+
|
|
|
|
+ layer.closeAll();
|
|
|
|
+ },
|
|
|
|
+ btn2: function () {
|
|
|
|
+ if (worklist.length === 0) {
|
|
|
|
+ showErr('没有可作废的申请');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ layer.confirm(`确认批量作废 已用额度矫正 申请吗?`, {
|
|
|
|
+ title: '提示',
|
|
|
|
+ btn: ['确定', '取消']
|
|
|
|
+ }, async () => {
|
|
|
|
+ layer.load(2, {shade: [0.2, '#000']});
|
|
|
|
+
|
|
|
|
+ for (const task of worklist) {
|
|
|
|
+ await that.workflow.executeTask(task.id, async () => {});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ layer.closeAll();
|
|
|
|
+ showSuccess('已用额度矫正 申请已作废');
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
function loadMsgBadge () {
|
|
function loadMsgBadge () {
|
|
|
|
+ const companyWorkflow = new BatchWorkflow('company');
|
|
const mchWorkflow = new BatchWorkflow('mch');
|
|
const mchWorkflow = new BatchWorkflow('mch');
|
|
const chanWorkflow = new BatchWorkflow('chan');
|
|
const chanWorkflow = new BatchWorkflow('chan');
|
|
|
|
|
|
|
|
+ const companyBadge = $('#badge-approve-company');
|
|
|
|
+ companyBadge.hide();
|
|
|
|
+
|
|
const mchBadge = $('#badge-approve-mch');
|
|
const mchBadge = $('#badge-approve-mch');
|
|
mchBadge.hide();
|
|
mchBadge.hide();
|
|
|
|
|
|
@@ -1764,6 +2143,17 @@
|
|
chanBadge.hide();
|
|
chanBadge.hide();
|
|
|
|
|
|
const refreshApprovalMessage = () => {
|
|
const refreshApprovalMessage = () => {
|
|
|
|
+ companyWorkflow.initializeGlobalTaskList();
|
|
|
|
+ const comMsg = companyWorkflow.getPendingTaskDetails();
|
|
|
|
+ const comNum = comMsg.length || 0;
|
|
|
|
+
|
|
|
|
+ companyBadge.html(comNum);
|
|
|
|
+ if (comNum === 0) {
|
|
|
|
+ companyBadge.hide();
|
|
|
|
+ } else {
|
|
|
|
+ companyBadge.show();
|
|
|
|
+ }
|
|
|
|
+
|
|
mchWorkflow.initializeGlobalTaskList();
|
|
mchWorkflow.initializeGlobalTaskList();
|
|
const mchMsg = mchWorkflow.getPendingTaskDetails();
|
|
const mchMsg = mchWorkflow.getPendingTaskDetails();
|
|
const mchNum = mchMsg.length || 0;
|
|
const mchNum = mchMsg.length || 0;
|
|
@@ -1802,6 +2192,23 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async function conditionSet() {
|
|
|
|
+ const conditionList = dataHelper.getConditionList();
|
|
|
|
+ if (conditionList.length === 0) {
|
|
|
|
+ const month = getCurrentMonth();
|
|
|
|
+ const condition = {
|
|
|
|
+ month
|
|
|
|
+ };
|
|
|
|
+ await dataHelper.addOrUpdateData(CONSTANTS.KEY_QUOTA_CONDITION, condition, 0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function getCurrMonthCondition() {
|
|
|
|
+ const conditionList = dataHelper.getConditionList();
|
|
|
|
+ const condition = conditionList[0];
|
|
|
|
+ return condition.month;
|
|
|
|
+ }
|
|
|
|
+
|
|
async function initPage() {
|
|
async function initPage() {
|
|
const loadIndex = layer.load(2, {shade: [0.2, '#000']});
|
|
const loadIndex = layer.load(2, {shade: [0.2, '#000']});
|
|
|
|
|
|
@@ -1809,6 +2216,11 @@
|
|
await dataHelper.loadMerchant();
|
|
await dataHelper.loadMerchant();
|
|
await dataHelper.loadChannel();
|
|
await dataHelper.loadChannel();
|
|
await dataHelper.loadSummary();
|
|
await dataHelper.loadSummary();
|
|
|
|
+ await dataHelper.loadCondition();
|
|
|
|
+
|
|
|
|
+ await conditionSet();
|
|
|
|
+ const currMonth = getCurrMonthCondition();
|
|
|
|
+ $('#query_month').val(currMonth);
|
|
|
|
|
|
companyTable.renderTable();
|
|
companyTable.renderTable();
|
|
await merchantTable.renderTable();
|
|
await merchantTable.renderTable();
|
|
@@ -1839,6 +2251,7 @@
|
|
|
|
|
|
const batchMchInvoice = new BatchInvoice('mch');
|
|
const batchMchInvoice = new BatchInvoice('mch');
|
|
const batchChanInvoice = new BatchInvoice('chan');
|
|
const batchChanInvoice = new BatchInvoice('chan');
|
|
|
|
+ const batchCorrected = new BatchCorrected();
|
|
const companyTable = new CompanyTable();
|
|
const companyTable = new CompanyTable();
|
|
const merchantTable = new MerchantTable();
|
|
const merchantTable = new MerchantTable();
|
|
const channelTable = new ChannelTable();
|
|
const channelTable = new ChannelTable();
|
|
@@ -1854,6 +2267,8 @@
|
|
batchMchInvoice.doBatchInvoice();
|
|
batchMchInvoice.doBatchInvoice();
|
|
} else if (tableId === 'tb-channel') {
|
|
} else if (tableId === 'tb-channel') {
|
|
batchChanInvoice.doBatchInvoice();
|
|
batchChanInvoice.doBatchInvoice();
|
|
|
|
+ } else if (tableId === 'tb-company') {
|
|
|
|
+ batchCorrected.doBatchCorrected();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -1863,6 +2278,8 @@
|
|
batchMchInvoice.doApplyMore(tableId);
|
|
batchMchInvoice.doApplyMore(tableId);
|
|
} else if (tableId === 'tb-channel') {
|
|
} else if (tableId === 'tb-channel') {
|
|
batchChanInvoice.doApplyMore(tableId);
|
|
batchChanInvoice.doApplyMore(tableId);
|
|
|
|
+ } else if (tableId === 'tb-company') {
|
|
|
|
+ batchCorrected.doApplyMore(tableId);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -1894,8 +2311,7 @@
|
|
return data;
|
|
return data;
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
- if (tableId === 'tb-merchant' && col === 'total_invoiced') {
|
|
|
|
|
|
+ const updateMerchant = async (field) => {
|
|
const activeList = activeData();
|
|
const activeList = activeData();
|
|
const companyReduce = {};
|
|
const companyReduce = {};
|
|
const merchantList = dataHelper.getMerchantList();
|
|
const merchantList = dataHelper.getMerchantList();
|
|
@@ -1905,41 +2321,51 @@
|
|
if (!companyReduce[item.subject]) {
|
|
if (!companyReduce[item.subject]) {
|
|
companyReduce[item.subject] = 0;
|
|
companyReduce[item.subject] = 0;
|
|
}
|
|
}
|
|
- companyReduce[item.subject] += parseFloat(item.total_invoiced);
|
|
|
|
|
|
+ companyReduce[item.subject] += parseFloat(item.month_opened);
|
|
|
|
|
|
- item.total_invoiced = '0';
|
|
|
|
|
|
+ item[field] = '0';
|
|
}
|
|
}
|
|
})
|
|
})
|
|
await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_MERCHANT, merchantList);
|
|
await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_MERCHANT, merchantList);
|
|
|
|
|
|
- const companyList = dataHelper.getCompanyList();
|
|
|
|
- companyList.forEach(item => {
|
|
|
|
- if (companyReduce[item.name] !== undefined) {
|
|
|
|
- const used_quota_up = parseFloat(item.used_quota) - companyReduce[item.name];
|
|
|
|
- if (item.used_quota < 0) {
|
|
|
|
- item.used_quota = 0;
|
|
|
|
|
|
+ if (field === 'month_opened') {
|
|
|
|
+ const companyList = dataHelper.getCompanyList();
|
|
|
|
+ companyList.forEach(item => {
|
|
|
|
+ if (companyReduce[item.name] !== undefined) {
|
|
|
|
+ const used_quota_up = parseFloat(item.used_quota) - companyReduce[item.name];
|
|
|
|
+ if (item.used_quota < 0) {
|
|
|
|
+ item.used_quota = 0;
|
|
|
|
+ }
|
|
|
|
+ item.used_quota = used_quota_up.toString();
|
|
}
|
|
}
|
|
- item.used_quota = used_quota_up.toString();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_COMPANY, companyList);
|
|
|
|
|
|
+ });
|
|
|
|
+ await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_COMPANY, companyList);
|
|
|
|
+ }
|
|
|
|
|
|
await merchantTable.renderTable();
|
|
await merchantTable.renderTable();
|
|
companyTable.renderTable();
|
|
companyTable.renderTable();
|
|
summaryTable.renderTable();
|
|
summaryTable.renderTable();
|
|
- } else if (tableId === 'tb-channel' && col === 'total_invoiced') {
|
|
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const updateChannel = async (field) => {
|
|
const activeList = activeData();
|
|
const activeList = activeData();
|
|
const channelList = dataHelper.getChannelList();
|
|
const channelList = dataHelper.getChannelList();
|
|
channelList.forEach(item => {
|
|
channelList.forEach(item => {
|
|
const ac = activeList.find(aItem => aItem.type_id === item.store_id);
|
|
const ac = activeList.find(aItem => aItem.type_id === item.store_id);
|
|
if (ac !== undefined) {
|
|
if (ac !== undefined) {
|
|
- item.total_invoiced = '0';
|
|
|
|
|
|
+ item[field] = '0';
|
|
}
|
|
}
|
|
})
|
|
})
|
|
await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_CHANNEL, channelList);
|
|
await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_CHANNEL, channelList);
|
|
|
|
|
|
await channelTable.renderTable();
|
|
await channelTable.renderTable();
|
|
summaryTable.renderTable();
|
|
summaryTable.renderTable();
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if (tableId === 'tb-merchant') {
|
|
|
|
+ await updateMerchant(col);
|
|
|
|
+ } else if (tableId === 'tb-channel') {
|
|
|
|
+ await updateChannel(col);
|
|
}
|
|
}
|
|
|
|
|
|
layer.close(loadIndex);
|
|
layer.close(loadIndex);
|
|
@@ -1951,22 +2377,38 @@
|
|
|
|
|
|
if (isAdmin === false) {
|
|
if (isAdmin === false) {
|
|
$('.reset-bar button:first-child').hide();
|
|
$('.reset-bar button:first-child').hide();
|
|
- $('.reset-bar button:nth-child(2)').css('margin-left', '750px');
|
|
|
|
|
|
+ $('.reset-bar button:nth-child(2)').css('margin-left', '900px');
|
|
$('.reset-bar button:nth-child(3)').css('margin-left', '150px');
|
|
$('.reset-bar button:nth-child(3)').css('margin-left', '150px');
|
|
$('.reset-bar button:nth-child(4)').css({
|
|
$('.reset-bar button:nth-child(4)').css({
|
|
'margin-left': '75px',
|
|
'margin-left': '75px',
|
|
'display': 'inline-block'
|
|
'display': 'inline-block'
|
|
});
|
|
});
|
|
|
|
+ $('.ac-approve').css('display', 'none');
|
|
} else {
|
|
} else {
|
|
$('.reset-bar button:first-child').css('margin-left', '595px');
|
|
$('.reset-bar button:first-child').css('margin-left', '595px');
|
|
- $('.reset-bar button:nth-child(2)').css('margin-left', '445px');
|
|
|
|
- $('.reset-bar button:nth-child(3)').css('margin-left', '150px');
|
|
|
|
|
|
+ $('.reset-bar button:nth-child(2)').css('margin-left', '150px');
|
|
|
|
+ $('.reset-bar button:nth-child(3)').css('margin-left', '300px');
|
|
$('.reset-bar button:nth-child(4)').css({
|
|
$('.reset-bar button:nth-child(4)').css({
|
|
'margin-left': '75px',
|
|
'margin-left': '75px',
|
|
'display': 'inline-block'
|
|
'display': 'inline-block'
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const tMonth = getCurrentMonth();
|
|
|
|
+ laydate.render({
|
|
|
|
+ elem: '#query_month',
|
|
|
|
+ type: 'month',
|
|
|
|
+ trigger: 'click',
|
|
|
|
+ max: tMonth,
|
|
|
|
+ done: async function (value, date, endDate) {
|
|
|
|
+ const condition = {
|
|
|
|
+ month: value
|
|
|
|
+ };
|
|
|
|
+ await dataHelper.updateAllData(CONSTANTS.KEY_QUOTA_CONDITION, [condition]);
|
|
|
|
+ await initPage();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
initPage();
|
|
initPage();
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|