|
|
@@ -13,7 +13,7 @@ define(['app/app'], function(app) {
|
|
|
var enIdFilter = $filter('EncryptionFilter');
|
|
|
|
|
|
//历史记录的状态
|
|
|
- var hiStatus= SessionService.get('vendorCenter');
|
|
|
+ var hiStatus= SessionService.getCookie('vendorCenter');
|
|
|
|
|
|
$scope.$payCenter = {};
|
|
|
$scope.param = {};
|
|
|
@@ -114,7 +114,21 @@ define(['app/app'], function(app) {
|
|
|
$scope.tradeRecordTableParams.reload();
|
|
|
};
|
|
|
|
|
|
+ var clearRecordParams = function () {
|
|
|
+ $scope.keyword = null;
|
|
|
+ $scope.startDate = null;
|
|
|
+ $scope.endDate = null;
|
|
|
+ };
|
|
|
+
|
|
|
$scope.search = function () {
|
|
|
+ if (!$scope.startDate && $scope.endDate){
|
|
|
+ toaster.pop("info", "请输入起始日期");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if ($scope.startDate && !$scope.endDate){
|
|
|
+ toaster.pop("info", "请输入结束日期");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
loadHistory();
|
|
|
};
|
|
|
|
|
|
@@ -125,6 +139,7 @@ define(['app/app'], function(app) {
|
|
|
loadHistory();
|
|
|
break;
|
|
|
case 'accountTab':
|
|
|
+ clearRecordParams();
|
|
|
loadAccountData();
|
|
|
break;
|
|
|
}
|
|
|
@@ -135,15 +150,20 @@ define(['app/app'], function(app) {
|
|
|
$scope.setTab = function (tab) {
|
|
|
if($scope.tab !== tab) {
|
|
|
$scope.tab = tab;
|
|
|
- SessionService.set('vendorCenter', tab);
|
|
|
+ SessionService.setCookie('vendorCenter', tab);
|
|
|
loadData();
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- $scope.condition = {
|
|
|
- startDateOpen: false,
|
|
|
- endDateOpen: false
|
|
|
+ $scope.condition = [];
|
|
|
+ var start = {
|
|
|
+ open : false
|
|
|
};
|
|
|
+ var end = {
|
|
|
+ open : false
|
|
|
+ };
|
|
|
+ $scope.condition.push(start);
|
|
|
+ $scope.condition.push(end);
|
|
|
|
|
|
// 打开日期选择框
|
|
|
$scope.openDatePicker = function($event, item, openParam, status) {
|
|
|
@@ -161,34 +181,66 @@ define(['app/app'], function(app) {
|
|
|
}
|
|
|
$event.preventDefault();
|
|
|
$event.stopPropagation();
|
|
|
- item[openParam] = !item[openParam];
|
|
|
+ openParam == 0 ? $scope.condition[1].open = false : $scope.condition[0].open = false;
|
|
|
+ item[openParam].open = !item[openParam].open;
|
|
|
};
|
|
|
|
|
|
$scope.onDateCondition = function (bool) {
|
|
|
- if (!$scope.startDate){
|
|
|
- $scope.startDate = null;
|
|
|
- toaster.pop("info", "请输入正确的日期格式");
|
|
|
- return;
|
|
|
- }
|
|
|
- console.log(bool);
|
|
|
- if (bool){
|
|
|
- console.log($scope.startDate);
|
|
|
+ var text = '';
|
|
|
+ var datePattern = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
|
+ if (bool == 1){
|
|
|
+ text = document.getElementById("start").value;
|
|
|
+ if (text != '' && !datePattern.test(text)){
|
|
|
+ // $scope.startDate = text;
|
|
|
+ toaster.pop("info", "请输入正确开始时间格式");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (text != '' && !validateDate(text)){
|
|
|
+ // $scope.startDate = text;
|
|
|
+ toaster.pop("info", "请输入正确开始时间格式");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!$scope.startDate && text != ''){
|
|
|
+ $scope.startDate = convertTextToDate(text);
|
|
|
+ }
|
|
|
+ if ($scope.startDate && !$scope.endDate){
|
|
|
+ var nowTime = new Date();
|
|
|
+ $scope.endDate = new Date(nowTime.getFullYear(), nowTime.getMonth(), nowTime.getDate());
|
|
|
+ }
|
|
|
+ if ($scope.endDate && $scope.startDate.getTime() > $scope.endDate.getTime()){
|
|
|
+ $scope.endDate = new Date($scope.startDate.getTime() + 86400000);
|
|
|
+ }
|
|
|
}else {
|
|
|
- console.log($scope.endDate);
|
|
|
- }
|
|
|
- // if (bool){
|
|
|
- // //验证开始日期格式
|
|
|
- // if(!validateDate($scope.startDate)){
|
|
|
- // $scope.startDate = null;
|
|
|
- // toaster.pop("info", "请输入正确的日期格式");
|
|
|
- // }
|
|
|
- // }else {
|
|
|
- // //验证结束日期格式
|
|
|
- // if(!validateDate($scope.endDate)){
|
|
|
- // $scope.endDate = null;
|
|
|
- // toaster.pop("info", "请输入正确的日期格式");
|
|
|
- // }
|
|
|
- // }
|
|
|
+ text = document.getElementById("end").value;
|
|
|
+ if (text != '' && !datePattern.test(text)){
|
|
|
+ // $scope.endDate = text;
|
|
|
+ toaster.pop("info", "请输入正确结束时间格式");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (text != '' && !validateDate(text)){
|
|
|
+ // $scope.endDate = text;
|
|
|
+ toaster.pop("info", "请输入正确结束时间格式");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!$scope.endDate && text != ''){
|
|
|
+ $scope.endDate = convertTextToDate(text);
|
|
|
+ }
|
|
|
+ if ($scope.startDate && $scope.startDate.getTime() > $scope.endDate.getTime()){
|
|
|
+ $scope.startDate = new Date($scope.endDate.getTime() - 86400000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将文本转化为日期
|
|
|
+ * @param value
|
|
|
+ * @returns {Date}
|
|
|
+ */
|
|
|
+ var convertTextToDate = function (value) {
|
|
|
+ var date = value;
|
|
|
+ var result = date.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
|
|
|
+
|
|
|
+ return new Date(result[1], result[3] - 1, result[4]);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -197,12 +249,6 @@ define(['app/app'], function(app) {
|
|
|
* @returns {boolean}
|
|
|
*/
|
|
|
var validateDate = function (value) {
|
|
|
- console.log($scope.startDate);
|
|
|
- if (value instanceof Date){
|
|
|
- console.log(value.getFullYear() + "=" + (value.getMonth() + 1) + "=" + value.getDate());
|
|
|
- return true;
|
|
|
- }
|
|
|
- alert(typeof (value));
|
|
|
var date = value;
|
|
|
var result = date.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
|
|
|
|
|
|
@@ -312,7 +358,7 @@ define(['app/app'], function(app) {
|
|
|
};
|
|
|
|
|
|
var validateRepeat = function (number) {
|
|
|
- bankInfoService.getCountByNumber({type:1062,number:number}, {}, function (data) {
|
|
|
+ bankInfoService.getCountByNumber({type:1063,number:number}, {}, function (data) {
|
|
|
if (data.success){
|
|
|
if (data.data != 0){
|
|
|
$scope.repeatError = true;
|
|
|
@@ -360,8 +406,8 @@ define(['app/app'], function(app) {
|
|
|
toaster.pop('error', '请按要求填写正确的信息');
|
|
|
return ;
|
|
|
}
|
|
|
- if ($scope.branchError || $scope.branchPattError || $scope.numberError || $scope.numberPattError ||
|
|
|
- $scope.nameError || $scope.fileError || $scope.fileLegError){
|
|
|
+ if (!$scope.matchData || $scope.branchError || $scope.branchPattError || $scope.numberError || $scope.numberPattError ||
|
|
|
+ $scope.nameError || $scope.repeatError || $scope.fileError || $scope.fileLegError){
|
|
|
toaster.pop('error', '请按要求填写正确的信息');
|
|
|
return ;
|
|
|
}
|
|
|
@@ -588,7 +634,8 @@ define(['app/app'], function(app) {
|
|
|
return ;
|
|
|
}
|
|
|
$scope.param.page = page;
|
|
|
- getData();
|
|
|
+ $scope.tradeRecordTableParams.page($scope.param.page);
|
|
|
+ $scope.tradeRecordTableParams.reload();
|
|
|
};
|
|
|
|
|
|
//当前页在前段的计算方式
|
|
|
@@ -636,6 +683,12 @@ define(['app/app'], function(app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ $rootScope.$on('$stateChangeStart',function(event,toState,toParams,fromState,fromParams){
|
|
|
+ if(fromState.name == 'pay_center' || toState.name == 'pay_center'){
|
|
|
+ SessionService.removeCookie("vendorCenter");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
//当前页在中间计算方式
|
|
|
$scope.middleSegment = function (currentPage) {
|
|
|
angular.forEach($scope.pages, function (page) {
|