|
|
@@ -1,10 +1,9 @@
|
|
|
define([ 'app/app' ], function(app) {
|
|
|
//品牌审批
|
|
|
- app.register.controller('AuditRegulpicListCtrl', ['$scope', '$anchorScroll', '$location', '$modal', 'BaseService', 'SessionService', 'toaster', 'ngTableParams', 'StoreInfo', 'StoreCms', '$state', function ($scope, $anchorScroll, $location, $modal, BaseService, SessionService, toaster, ngTableParams, StoreInfo, StoreCms, $state) {
|
|
|
+ app.register.controller('AuditRegulpicListCtrl', ['$scope', '$modal', 'BaseService', 'toaster', 'ngTableParams', 'StoreInfo', function ($scope, $modal, BaseService, toaster, ngTableParams, StoreInfo) {
|
|
|
|
|
|
$scope.storeType = 'ALL';
|
|
|
$scope.isShow = 'ALL';
|
|
|
-
|
|
|
$scope.storeTableParams = new ngTableParams({
|
|
|
page : 1,
|
|
|
count : 10,
|
|
|
@@ -65,18 +64,18 @@ define([ 'app/app' ], function(app) {
|
|
|
/**
|
|
|
* 通过
|
|
|
*/
|
|
|
- $scope.passBtnFn = function() {}
|
|
|
-
|
|
|
- /**
|
|
|
- * 不通过
|
|
|
- */
|
|
|
- $scope.cancelBtnFn = auditUnpass
|
|
|
-
|
|
|
+ $scope.passBtnFn = function(item) {
|
|
|
+ openPassModal(item).then(function (data) {
|
|
|
+ passAudit(data, item)
|
|
|
+ }, function (error) {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 审核未通过开铺申请
|
|
|
*/
|
|
|
- function auditUnpass(list) {
|
|
|
+ $scope.cancelBtnFn = function() {
|
|
|
openReasonModal().then(function (reason) {
|
|
|
NopassAudit(list, reason)
|
|
|
}, function (error) {
|
|
|
@@ -95,11 +94,61 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 审核不通过
|
|
|
+ * 审核不通过 回调
|
|
|
*/
|
|
|
function NopassAudit(list, reason) {
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核通过 回调
|
|
|
+ */
|
|
|
+ function passAudit(data, item) {
|
|
|
+ // 是否需要打开规格书选择项
|
|
|
+ openRegulChooseModal(data, item).then(function (reason) {
|
|
|
+ // 刷新页面
|
|
|
+ $scope.storeTableParams.page(1);
|
|
|
+ $scope.storeTableParams.reload();
|
|
|
+ }, function (error) {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打开审核通过模态框
|
|
|
+ */
|
|
|
+ function openPassModal(item) {
|
|
|
+ return $modal.open({
|
|
|
+ templateUrl: 'static/view/admin/modal/auditRegulpicpass_modal.html',
|
|
|
+ controller: 'auditRegulpicpassController',
|
|
|
+ size : 'md',
|
|
|
+ resolve : {
|
|
|
+ item : function() {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打开规格书选择模态框
|
|
|
+ */
|
|
|
+ function openRegulChooseModal(data,item) {
|
|
|
+ return $modal.open({
|
|
|
+ templateUrl: 'static/view/admin/modal/auditRegulpic_choose_modal.html',
|
|
|
+ controller: 'auditRegulpicChooseController',
|
|
|
+ size : 'md',
|
|
|
+ resolve : {
|
|
|
+ item : function() {
|
|
|
+ return item;
|
|
|
+ },
|
|
|
+ responseData: function() {
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).result;
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
/**
|
|
|
@@ -128,4 +177,136 @@ define([ 'app/app' ], function(app) {
|
|
|
$modalInstance.dismiss();
|
|
|
}
|
|
|
}]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核通过模态框控制器
|
|
|
+ */
|
|
|
+ app.register.controller('auditRegulpicpassController', ['$scope', '$modalInstance', 'toaster', 'Commodity', 'Search','item', function ($scope, $modalInstance, toaster, Commodity, Search, item) {
|
|
|
+
|
|
|
+ $scope.kindPojo = {
|
|
|
+ first: '请选择一级类目',
|
|
|
+ second: '请选择二级类目',
|
|
|
+ third: '请选择三级类目'
|
|
|
+ }
|
|
|
+ $scope.saveReason = saveReason;
|
|
|
+ $scope.dismiss = dismiss;
|
|
|
+ $scope.BrandList = []
|
|
|
+ $scope.reason = null;
|
|
|
+ $scope.keyword = ''
|
|
|
+ $scope.spec = ''
|
|
|
+ $scope.item = item
|
|
|
+ /**
|
|
|
+ * 品牌联想词
|
|
|
+ */
|
|
|
+ $scope.onBrandChange = function(name) {
|
|
|
+ if (name === '') {
|
|
|
+ $scope.BrandList = []
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if ((/[^\x00-\xff]/g).test(name)) {
|
|
|
+ $scope.keyword = ''
|
|
|
+ $scope.BrandList = []
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ $scope.BrandList = getSimilarBrands(name).$$state
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 品牌联想词失去焦点
|
|
|
+ */
|
|
|
+ $scope.onBrandBlur = function(name) {
|
|
|
+ if (name === '') {
|
|
|
+ $scope.BrandList = []
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 保存不通过原因
|
|
|
+ */
|
|
|
+ function saveReason() {
|
|
|
+ if (!$scope.keyword || $scope.keyword === '') {
|
|
|
+ toaster.pop('error', '品牌未必填项');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if ($scope.kindPojo.first === '请选择一级类目') {
|
|
|
+ toaster.pop('error', '商城类目未选择');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if ($scope.kindPojo.second === '请选择二级类目') {
|
|
|
+ toaster.pop('error', '商城类目未选择');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if ($scope.kindPojo.third === '请选择三级类目') {
|
|
|
+ toaster.pop('error', '商城类目未选择');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ // 申请品牌后,返回
|
|
|
+ $modalInstance.close({});
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 选择品牌联想词
|
|
|
+ */
|
|
|
+ $scope.setBrand = function(item) {
|
|
|
+ $scope.keyword = item
|
|
|
+ $scope.BrandList = []
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关闭模态框
|
|
|
+ */
|
|
|
+ function dismiss() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ var initKindDataInfo = function () {
|
|
|
+ Commodity.getAllKindInfo({}, function (data) {
|
|
|
+ $scope.kindInfo = data[0].children;
|
|
|
+ })
|
|
|
+ };
|
|
|
+ initKindDataInfo();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取品牌联想词
|
|
|
+ *
|
|
|
+ * @param name 品牌名称
|
|
|
+ */
|
|
|
+ function getSimilarBrands(name) {
|
|
|
+ if (name) {
|
|
|
+ return Search.getSimilarBrands({keyword: name}).$promise.then(
|
|
|
+ function (data) {
|
|
|
+ return data.map(function (item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 规格书选项
|
|
|
+ */
|
|
|
+ app.register.controller('auditRegulpicChooseController',['$scope', '$modalInstance', 'toaster', 'responseData', 'item', function($scope, $modalInstance, toaster, responseData, item) {
|
|
|
+ $scope.saveReason = saveReason;
|
|
|
+ $scope.dismiss = dismiss;
|
|
|
+ $scope.checked = 'store';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存不通过原因
|
|
|
+ */
|
|
|
+ function saveReason() {
|
|
|
+ // if (!$scope.reason || $scope.reason === '') {
|
|
|
+ // toaster.pop('error', '请填写审核不通过原因');
|
|
|
+ // return ;
|
|
|
+ // }
|
|
|
+ // 请求保存规格书接口
|
|
|
+ alert($scope.checked)
|
|
|
+ $modalInstance.close($scope.reason);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关闭模态框
|
|
|
+ */
|
|
|
+ function dismiss() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ }
|
|
|
+ }])
|
|
|
});
|