|
|
@@ -329,6 +329,7 @@ angular.module('app.business')
|
|
329
|
329
|
jsglService.findBykey($stateParams.id).then(function(data){
|
|
330
|
330
|
$scope.jsgl = data;
|
|
331
|
331
|
$scope.jsgl.orgId = $rootScope.orgInfo.orgId;
|
|
|
332
|
+ $scope.sfkr_list = $scope.jsgl.khxxlist;
|
|
332
|
333
|
$scope.loadWare($scope.jsgl.houseId);
|
|
333
|
334
|
if ("" != id) {
|
|
334
|
335
|
if (butType != "show") {
|
|
|
@@ -418,16 +419,15 @@ angular.module('app.business')
|
|
418
|
419
|
});
|
|
419
|
420
|
}
|
|
420
|
421
|
|
|
421
|
|
- // 选择个人客户.
|
|
422
|
|
- $scope.getCustomer = function(id) {
|
|
423
|
|
- if (id == null) {
|
|
|
422
|
+ // 选择收款人信息.
|
|
|
423
|
+ $scope.getSkrData = function(id) {
|
|
|
424
|
+ if ($scope.jsgl.htbh != null) {
|
|
424
|
425
|
var params = [];
|
|
425
|
|
- params.type = "addBlacklist"; //不是黑名单人员
|
|
426
|
|
- params.classify = 3152;
|
|
|
426
|
+ params.tzdbh = $scope.jsgl.htbh; //通知单编号
|
|
427
|
427
|
var uibModalInstance = $uibModal.open({
|
|
428
|
428
|
size:'lg',
|
|
429
|
|
- templateUrl: 'app/business/util/views/customer-list-modal.html',
|
|
430
|
|
- controller: 'customerListModalCtrl',
|
|
|
429
|
+ templateUrl: 'app/business/jsgl/views/crkjl-model-list.html',
|
|
|
430
|
+ controller: 'selectCyrDataModalCtrl',
|
|
431
|
431
|
resolve: {
|
|
432
|
432
|
// items是一个回调函数
|
|
433
|
433
|
items: function () {
|
|
|
@@ -438,62 +438,80 @@ angular.module('app.business')
|
|
438
|
438
|
});
|
|
439
|
439
|
uibModalInstance.result.then(function (result) {
|
|
440
|
440
|
if (result != null) {
|
|
441
|
|
- // 客户表id.
|
|
442
|
|
- $scope.jsgl.customerId = result.id;
|
|
443
|
|
- // 收付款人赋值客户姓名.
|
|
444
|
|
- $scope.jsgl.sfkr = result.name;
|
|
445
|
|
- //开户行名称
|
|
446
|
|
- $scope.jsgl.khhmc = result.bankName;
|
|
447
|
|
- //开户行号
|
|
448
|
|
- $scope.jsgl.khhh = result.khhh;
|
|
449
|
|
- //银行账号
|
|
450
|
|
- $scope.jsgl.yhzh = result.accountNumber;
|
|
451
|
|
-
|
|
452
|
|
- if (result.classify == 3152) {
|
|
453
|
|
- // 个人.
|
|
454
|
|
- //收付款人身份证号
|
|
455
|
|
- $scope.jsgl.skrsfzh = result.identification;
|
|
456
|
|
- } else if (result.classify == 3153) {
|
|
457
|
|
- // 企业.
|
|
458
|
|
- //收付款人身份证号(社会信用代码)
|
|
459
|
|
- $scope.jsgl.skrsfzh = result.socialCreditCode;
|
|
460
|
|
- }
|
|
461
|
|
- //付款单位
|
|
462
|
|
- $scope.jsgl.fkdw = $rootScope.orgInfo.orgName;
|
|
|
441
|
+ $scope.sfkr_list = result;
|
|
|
442
|
+ $scope.jsgl.khxxlist = result;
|
|
|
443
|
+ $scope.jsgl.khxxlist.forEach(obj => {
|
|
|
444
|
+ delete obj.bizno;
|
|
|
445
|
+ delete obj.checked;
|
|
|
446
|
+ });
|
|
|
447
|
+ //计算本次结算数量
|
|
|
448
|
+ var bcjssl = 0;
|
|
|
449
|
+ bcjssl = $scope.sfkr_list.reduce((sum, slkhxx) => sum + slkhxx.crksl, 0);
|
|
|
450
|
+ $scope.jsgl.bcjssl = bcjssl/1000;
|
|
|
451
|
+ $scope.calculate();//计算本次结算金额
|
|
463
|
452
|
}
|
|
464
|
453
|
// 关闭模态框时刷新页面数据
|
|
465
|
454
|
}, function (reason) {
|
|
466
|
455
|
console.log(reason);
|
|
467
|
456
|
});
|
|
468
|
|
- } else {
|
|
469
|
|
- customerService.loadDataById(id).then(function(data){
|
|
470
|
|
- // 客户表id.
|
|
471
|
|
- $scope.jsgl.customerId = id;
|
|
472
|
|
- // 收付款人姓名.
|
|
473
|
|
- $scope.jsgl.sfkr = data.name;
|
|
474
|
|
- //开户行名称
|
|
475
|
|
- $scope.jsgl.khhmc = data.bankName;
|
|
476
|
|
- //开户行号
|
|
477
|
|
- $scope.jsgl.khhh = data.khhh;
|
|
478
|
|
- //银行账号
|
|
479
|
|
- $scope.jsgl.yhzh = data.accountNumber;
|
|
480
|
|
- if (data.classify == 3152) {
|
|
481
|
|
- // 个人.
|
|
482
|
|
- //身份证号
|
|
483
|
|
- $scope.jsgl.skrsfzh = data.identification;
|
|
484
|
|
- } else if (data.classify == 3153) {
|
|
485
|
|
- // 企业.
|
|
486
|
|
- //社会信用代码
|
|
487
|
|
- $scope.jsgl.skrsfzh = data.socialCreditCode;
|
|
488
|
|
- }
|
|
489
|
|
- //付款单位
|
|
490
|
|
- $scope.jsgl.fkdw = $rootScope.orgInfo.orgName;
|
|
491
|
|
- }, function (data) {
|
|
492
|
|
- console.log(data);
|
|
493
|
|
- });
|
|
494
|
457
|
}
|
|
495
|
458
|
}
|
|
496
|
459
|
|
|
|
460
|
+ $.validator.addMethod("checkKhhh",function(value,element, params) {
|
|
|
461
|
+ var checkNumber = /(^[0-9]{1,12}$)/g;
|
|
|
462
|
+ return this.optional(element)||(checkNumber.test(value));
|
|
|
463
|
+ },"请输入正确的开户行号");
|
|
|
464
|
+ $.validator.addMethod("checkSfzhm",function(value,element, params) {
|
|
|
465
|
+ var checkNumber = /(^\d{18}$)|(^\d{17}(\d|X)$)/g;
|
|
|
466
|
+ return this.optional(element)||(checkNumber.test(value));
|
|
|
467
|
+ },"请输入正确的身份证号码,且不能重复!");
|
|
|
468
|
+
|
|
|
469
|
+ $.validator.addMethod("checkYhzh",function(value,element, params) {
|
|
|
470
|
+ var checkNumber = /^[0-9]{1,30}$/g;
|
|
|
471
|
+ return this.optional(element)||(checkNumber.test(value));
|
|
|
472
|
+ },"请输入正确的银行账号!");
|
|
|
473
|
+
|
|
|
474
|
+ //散粮客户信息保存
|
|
|
475
|
+ $scope.saveKhxx = function(ite) {
|
|
|
476
|
+ if (ite.sfkr != null && ite.skrsfzh != null && ite.sfkr != undefined && ite.skrsfzh != undefined) {
|
|
|
477
|
+ var obj = {};
|
|
|
478
|
+ obj.khmc = ite.sfkr;
|
|
|
479
|
+ obj.sfzhm = ite.skrsfzh;
|
|
|
480
|
+ obj.khhmc = ite.khhmc;
|
|
|
481
|
+ obj.yhhbdm = ite.yhhbdm;
|
|
|
482
|
+ obj.khhh = ite.khhh;
|
|
|
483
|
+ obj.yhzh = ite.yhzh;
|
|
|
484
|
+ jsglService.saveOrUpdateSlkhxx(obj).then(function(data){
|
|
|
485
|
+ if (data.status == "200") {
|
|
|
486
|
+ alert("操作成功!");
|
|
|
487
|
+ } else {
|
|
|
488
|
+ alert("操作失败!");
|
|
|
489
|
+ }
|
|
|
490
|
+ },function(data){
|
|
|
491
|
+ console.log(data);
|
|
|
492
|
+ });
|
|
|
493
|
+ } else {
|
|
|
494
|
+ alert("收款人和身份证号不能为空");
|
|
|
495
|
+ }
|
|
|
496
|
+ }
|
|
|
497
|
+
|
|
|
498
|
+ //点击收款人或身份证号码带出散粮客户信息
|
|
|
499
|
+ $scope.checkSlKhxx = function(ite) {
|
|
|
500
|
+ if (ite.sfkr != null && ite.skrsfzh != null && ite.sfkr != undefined && ite.skrsfzh != undefined) {
|
|
|
501
|
+ jsglService.queryStorageSlkhxx(ite.sfkr, ite.skrsfzh).then(function(data){
|
|
|
502
|
+ if (data.status == "200") {
|
|
|
503
|
+ var slkhxx = data.msg;
|
|
|
504
|
+ ite.khhmc = slkhxx.khhmc;
|
|
|
505
|
+ ite.yhhbdm = slkhxx.yhhbdm;
|
|
|
506
|
+ ite.khhh = slkhxx.khhh;
|
|
|
507
|
+ ite.yhzh = slkhxx.yhzh;
|
|
|
508
|
+ }
|
|
|
509
|
+ },function(data){
|
|
|
510
|
+ console.log(data);
|
|
|
511
|
+ });
|
|
|
512
|
+ }
|
|
|
513
|
+ }
|
|
|
514
|
+
|
|
497
|
515
|
/**
|
|
498
|
516
|
* 计算本次结算金额 = 本次结算数量 * 本次结算单价
|
|
499
|
517
|
* 保留两位小数
|
|
|
@@ -538,25 +556,27 @@ angular.module('app.business')
|
|
538
|
556
|
//保存(0:保存,1:提交)
|
|
539
|
557
|
$scope.save = function(czlx) {
|
|
540
|
558
|
$scope.jsgl.dataStatus = czlx;
|
|
541
|
|
- var fp_s = $scope.jsgl.fpStart;
|
|
542
|
|
- var fp_e = $scope.jsgl.fpEnd;
|
|
543
|
|
- var fps = $scope.jsgl.fps;
|
|
544
|
|
- if (fp_s == null && fp_e == null && fps == null) {
|
|
545
|
|
- alert("连续发票号和不连续发票号至少要录入一种,不能都为空值!");
|
|
|
559
|
+ $scope.isCustomerEdit = $scope.jsgl.bcjsfs=='0'?false:true;
|
|
|
560
|
+ if (null === $scope.jsgl.khxxlist || $scope.jsgl.khxxlist == undefined) {
|
|
|
561
|
+ alert("至少要有一条客户信息!");
|
|
546
|
562
|
return;
|
|
547
|
|
- } else {
|
|
548
|
|
- if ((fp_s == null && fp_e != null) || (fp_s != null && fp_e == null)) {
|
|
549
|
|
- alert("连续发票号码不能只录入起始值或只录入终止值!");
|
|
|
563
|
+ }
|
|
|
564
|
+ let sfkr = $scope.jsgl.khxxlist.filter(item => !item.sfkr);
|
|
|
565
|
+ let skrsfzh = $scope.jsgl.khxxlist.filter(item => !item.skrsfzh);
|
|
|
566
|
+ let khhmc = $scope.jsgl.khxxlist.filter(item => !item.khhmc);
|
|
|
567
|
+ let yhzh = $scope.jsgl.khxxlist.filter(item => !item.yhzh);
|
|
|
568
|
+ if ($scope.isCustomerEdit) {//转账
|
|
|
569
|
+ if (sfkr.length != 0 || skrsfzh.length != 0 || khhmc.length != 0 || yhzh.length != 0) {
|
|
|
570
|
+ alert("收款人、身份证号、开户行名称、银行账号不能为空!");
|
|
550
|
571
|
return;
|
|
551
|
572
|
}
|
|
552
|
|
- }
|
|
553
|
|
- $scope.isCustomerEdit = $scope.jsgl.bcjsfs=='0'?false:true
|
|
554
|
|
- if ($scope.jsgl.bcjsfs == '1') {
|
|
555
|
|
- if ($scope.jsgl.yhzh == null || $scope.jsgl.khhmc == null || $scope.jsgl.khhh == null) {
|
|
556
|
|
- alert("请补全对应客户档案信息!");
|
|
|
573
|
+ } else {
|
|
|
574
|
+ if (sfkr.length != 0 || skrsfzh.length != 0) {
|
|
|
575
|
+ alert("收款人、身份证号不能为空!");
|
|
557
|
576
|
return;
|
|
558
|
577
|
}
|
|
559
|
578
|
}
|
|
|
579
|
+
|
|
560
|
580
|
var validator = $("#jsgl-sl-form").validate();
|
|
561
|
581
|
if (validator.form()) {
|
|
562
|
582
|
//本次结算时间
|
|
|
@@ -578,4 +598,45 @@ angular.module('app.business')
|
|
578
|
598
|
}
|
|
579
|
599
|
};
|
|
580
|
600
|
|
|
|
601
|
+})
|
|
|
602
|
+.controller("selectCyrDataModalCtrl", function($scope, $uibModalInstance, $filter, $http, $uibModal, $rootScope, jsglService, APP_CONFIG, items) {
|
|
|
603
|
+
|
|
|
604
|
+ $scope.search = {tzdbh: items.tzdbh, cph: null, startTime: null, endTime: null};
|
|
|
605
|
+ // 获取列表数据
|
|
|
606
|
+ $scope.loadData = function() {
|
|
|
607
|
+ var startTime = $("#startTime").val();
|
|
|
608
|
+ var endTime = $("#endTime").val();
|
|
|
609
|
+ $scope.search.startTime = startTime;
|
|
|
610
|
+ $scope.search.endTime = endTime;
|
|
|
611
|
+ jsglService.queryCrkywData($scope.search).then(function(data) {
|
|
|
612
|
+ $scope.list = data;
|
|
|
613
|
+ }).catch(function(data) {
|
|
|
614
|
+ if (data.status == 601) {
|
|
|
615
|
+ // session失效,关闭模态框.
|
|
|
616
|
+ $uibModalInstance.close();
|
|
|
617
|
+ }
|
|
|
618
|
+ });
|
|
|
619
|
+ }
|
|
|
620
|
+
|
|
|
621
|
+ $scope.loadData();
|
|
|
622
|
+
|
|
|
623
|
+ //勾选或取消勾选一条数据
|
|
|
624
|
+ $scope.selectData = function(index, obj) {
|
|
|
625
|
+ $scope.list[index].checked = obj.checked;
|
|
|
626
|
+ if (!obj.checked) {
|
|
|
627
|
+ $scope.checkeds = false;
|
|
|
628
|
+ }
|
|
|
629
|
+ }
|
|
|
630
|
+
|
|
|
631
|
+ // 关闭模态窗口
|
|
|
632
|
+ $scope.cancel = function() {
|
|
|
633
|
+ $uibModalInstance.close();
|
|
|
634
|
+ }
|
|
|
635
|
+
|
|
|
636
|
+ // 选择后点下一步.
|
|
|
637
|
+ $scope.closeModal = function() {
|
|
|
638
|
+ var arr = $scope.list.filter(item => item.checked); //检索被选中的数据
|
|
|
639
|
+ $uibModalInstance.close(arr);
|
|
|
640
|
+ }
|
|
|
641
|
+
|
|
581
|
642
|
});
|