75 lines
2.2 KiB
JavaScript
75 lines
2.2 KiB
JavaScript
$(function () {
|
|
|
|
$(".datepicker").datepicker({
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
showButtonPanel: true,
|
|
showOtherMonths: true,
|
|
selectOtherMonths: true
|
|
});
|
|
|
|
FastVue.numberInput('Credit');
|
|
|
|
changeForm($("#Credit").val());
|
|
|
|
$("#Credit").on("input", function (event) {
|
|
changeForm($("#Credit").val());
|
|
});
|
|
|
|
//客户输入控件
|
|
if (document.getElementById('ClientId')) {
|
|
clientInputCtrl = FastVue.autocomplete('ClientId', {
|
|
nameField: 'Name',
|
|
valueField: 'id',
|
|
searchField: ['Name', 'PinYin'],//如果不设置则只搜索nameField
|
|
lookup: pageObj.clients
|
|
});
|
|
let client = pageObj.clients[0];
|
|
if (pageObj.model.id) {
|
|
client = { id: pageObj.model.ClientId, Name: pageObj.model.ClientName };
|
|
}
|
|
clientInputCtrl.setData(client);
|
|
}
|
|
});
|
|
|
|
function saveCreditInner(data) {
|
|
data || (data = $("#creditEditForm").serialize());
|
|
main.post("/credit/AjaxSaveCreditFromClient", data).done(function (res) {
|
|
window.location.href = "/credit/creditFromClientView?enid=" + res.obj.EncryptId;
|
|
main.parentReload('reloadcredit');
|
|
});
|
|
}
|
|
|
|
function saveCredit() {
|
|
var postData = $("#creditEditForm").serializeObject();
|
|
if (!postData.ClientId) {
|
|
return main.message('请选择客户!');
|
|
}
|
|
if (!postData.CreditStartDate) {
|
|
return main.message('请输入授信起始日!');
|
|
}
|
|
if (!postData.CreditDeadLine) {
|
|
return main.message('请输入授信到期日!');
|
|
}
|
|
|
|
main.post("/client/GetClientStatus/", postData).done(function (res) {
|
|
if (res.obj === "已销户") {
|
|
main.confirm("该客户为“已销户”客户,确认拥有该客户授信?", saveCreditInner.bind(this, postData));
|
|
}
|
|
else {
|
|
saveCreditInner(postData);
|
|
}
|
|
});
|
|
}
|
|
|
|
function changeForm(s) {
|
|
s = (s || '').replace(/,/g, '');
|
|
var newArr = s ? main.toChineseCapital(s) : '';
|
|
var $parent = $("#Credit").parent();
|
|
var $chineseSpan = $parent.children("span.chinese");
|
|
if ($chineseSpan.length) {
|
|
$chineseSpan.html(newArr);
|
|
} else {
|
|
$parent.append(`<span class="chinese" >${newArr}</span>`);
|
|
}
|
|
} |