【R】广告位屏蔽同行业商户

master
liuxinxin 5 years ago
parent 13df0df1c1
commit 64ea8a5d62

@ -255,10 +255,32 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
}
}]);
app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', function ($scope, $http, $state, $stateParams, commonDialog) {
app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog','industryMap','stateMap', function ($scope, $http, $state, $stateParams, commonDialog,industryMap,stateMap) {
$scope.industries = industryMap.configs();
$scope.states = stateMap.configs();
$scope.publishall = 1;
$scope.saveArticle = function () {
$scope.article.publishall = $scope.publishall;
if( $scope.publishall == 0){
if($scope.select_industries.length <= 0 || $scope.select_industries == "") {
alert("所推送的行业不能为空");
return;
}
if($scope.select_states.length <= 0 || $scope.select_states == "") {
alert("所推送的地区不能为空");
return;
}
$scope.article.selectIndustries = $scope.select_industries.join(',');
$scope.article.selectStates = $scope.select_states.join(',');
if ($scope.select_clients) {
$scope.article.selectClients = $scope.select_clients.join(',');
}
}
$scope.article.reference = $scope.reference;
$scope.article.royalpay_industry = $scope.royalpay_industry;
$http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) {
$state.go('^.article_view', {articleId: resp.data.article_id});
}, function (resp) {
@ -266,35 +288,131 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
})
};
$scope.loadRoyalpayindustry = function () {
$http.get('/static/data/rp_industry_apply.json').then(function (resp) {
$scope.royalpayindustry = resp.data;
})
$scope.params = {textType: 'all', org_name: 'ALL'};
$scope.loadPartners = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/partners', {params: params}).then(function (resp) {
$scope.partners = resp.data.data;
$scope.pagination = resp.data.pagination;
});
};
$scope.loadRoyalpayindustry();
$scope.onRoyalPayIndustrySelect = function (selectedItem) {
$scope.royalpay_label = selectedItem.label;
$scope.royalpay_industry = selectedItem.mccCode;
};
$scope.toggleSelectIndustries = function (industry) {
if (!$scope.select_industries) {
$scope.select_industries = [];
}
var $idx = $scope.select_industries.indexOf(industry);
if ($idx >= 0) {
$scope.select_industries.splice($idx, 1);
} else {
$scope.select_industries.push(industry);
$scope.select_industries.sort(compare);
}
}
$scope.selectAllIndustries = function() {
for(var i=0;i<$scope.industries.length;i++) {
$scope.toggleSelectIndustries($scope.industries[i].value)
}
}
$scope.selectAllIndustries();
$scope.toggleStates =function(state){
if (!$scope.select_states) {
$scope.select_states = [];
}
var $idx = $scope.select_states.indexOf(state);
if ($idx >= 0) {
$scope.select_states.splice($idx, 1);
} else {
$scope.select_states.push(state);
$scope.select_states.sort(compare);
}
}
$scope.selectAllIndustries = function() {
for(var i=0;i<$scope.states.length;i++) {
$scope.toggleStates($scope.states[i].value)
}
}
$scope.selectAllIndustries();
$scope.toggleClient =function(client_moniker){
if (!$scope.select_clients) {
$scope.select_clients = [];
}
var $idx = $scope.select_clients.indexOf(client_moniker);
if ($idx >= 0) {
$scope.select_clients.splice($idx, 1);
} else {
$scope.select_clients.push(client_moniker);
$scope.select_clients.sort(compare);
}
}
var compare = function (x, y) {
x = parseInt(x);
y = parseInt(y);
if (x < y) {
return -1;
} else if (x > y) {
return 1;
} else {
return 0;
}
}
}]);
app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', function ($scope, $http, $state, $stateParams, commonDialog, article) {
app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', 'industryMap','stateMap',function ($scope, $http, $state, $stateParams, commonDialog, article,industryMap,stateMap) {
$scope.article = article.data;
$scope.industries = industryMap.configs();
$scope.states = stateMap.configs();
if($scope.article.publishall){
$scope.publishall = $scope.article.publishall;
}else{
$scope.publishall = 1
}
if ($scope.article.select_industries) {
$scope.select_industries = $scope.article.select_industries.split(",");
}
if($scope.article.select_clients){
$scope.select_clients = $scope.article.select_clients.split(",");
}
if($scope.article.select_states){
$scope.select_states = $scope.article.select_states.split(",");
}
if ($scope.article.reference) {
$scope.reference = JSON.parse($scope.article.reference);
} else {
$scope.reference = {};
}
if($scope.article.royalpay_industry){
$scope.royalpay_industry = $scope.article.royalpay_industry;
}
$scope.saveArticle = function () {
$scope.article.publishall = $scope.publishall;
if( $scope.publishall == 0){
if($scope.select_industries.length <= 0 || $scope.select_industries == "") {
alert("所推送的行业不能为空");
return;
}
if($scope.select_states.length <= 0 || $scope.select_states == "") {
alert("所推送的地区不能为空");
return;
}
$scope.article.select_industries = $scope.select_industries.join(',');
$scope.article.select_states = $scope.select_states.join(',');
if ($scope.select_clients) {
$scope.article.select_clients = $scope.select_clients.join(',');
}
}
$scope.article.reference = $scope.reference;
$scope.article.royalpay_industry = $scope.royalpay_industry;
$http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) {
$state.go('^.article_view', {articleId: $stateParams.articleId});
}, function (resp) {
@ -302,17 +420,84 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
})
};
$scope.loadRoyalpayindustry = function () {
$http.get('/static/data/rp_industry_apply.json').then(function (resp) {
$scope.royalpayindustry = resp.data;
})
$scope.params = {textType: 'all', org_name: 'ALL'};
$scope.loadPartners = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/partners', {params: params}).then(function (resp) {
$scope.partners = resp.data.data;
$scope.pagination = resp.data.pagination;
});
};
$scope.loadRoyalpayindustry();
$scope.onRoyalPayIndustrySelect = function (selectedItem) {
$scope.royalpay_label = selectedItem.label;
$scope.royalpay_industry = selectedItem.mccCode;
};
$scope.toggleSelectIndustries = function (industry) {
if (!$scope.select_industries) {
$scope.select_industries = [];
}
var $idx = $scope.select_industries.indexOf(industry);
if ($idx >= 0) {
$scope.select_industries.splice($idx, 1);
} else {
$scope.select_industries.push(industry);
$scope.select_industries.sort(compare);
}
}
$scope.selectAllIndustries = function() {
for(var i=0;i<$scope.industries.length;i++) {
$scope.toggleSelectIndustries($scope.industries[i].value)
}
}
if(!$scope.article.publishall){
$scope.selectAllIndustries();
}
$scope.toggleStates =function(state){
if (!$scope.select_states) {
$scope.select_states = [];
}
var $idx = $scope.select_states.indexOf(state);
if ($idx >= 0) {
$scope.select_states.splice($idx, 1);
} else {
$scope.select_states.push(state);
$scope.select_states.sort(compare);
}
}
$scope.selectAllIndustries = function() {
for(var i=0;i<$scope.states.length;i++) {
$scope.toggleStates($scope.states[i].value)
}
}
if(!$scope.article.publishall){
$scope.selectAllIndustries();
}
$scope.toggleClient =function(client_moniker){
if (!$scope.select_clients) {
$scope.select_clients = [];
}
var $idx = $scope.select_clients.indexOf(client_moniker);
if ($idx >= 0) {
$scope.select_clients.splice($idx, 1);
} else {
$scope.select_clients.push(client_moniker);
$scope.select_clients.sort(compare);
}
}
var compare = function (x, y) {
x = parseInt(x);
y = parseInt(y);
if (x < y) {
return -1;
} else if (x > y) {
return 1;
} else {
return 0;
}
}
}]);

@ -77,21 +77,81 @@
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="royalpayindustry">*RoyalPay Industry</label>
<div class="col-sm-8">
<input class="form-control" id="royalpayindustry" required
name="royalpayindustry" readonly
ng-model="royalpay_industry|partner_royalpay_industry"
multi-level-select-popup="royalpayindustry"
on-select="onRoyalPayIndustrySelect($selected)">
<div ng-messages="partnerForm.royalpay_label.$error"
ng-if="partnerForm.royalpay_label.$dirty">
<p class="small text-danger" ng-message="required">Required
Field</p>
<label class="control-label col-sm-2">支付成功页面配置</label>
<div class="col-sm-8">
<div class="radio-inline">
<input type="radio" name="killOrder" value="1" ng-model="publishall" checked/>
<label>全量商户推送</label>
</div>
<div class="radio-inline">
<input type="radio" name="killOrder" value="0" ng-model="publishall"/>
<label>自定义商户推送</label>
</div>
</div>
</div>
<div class="form-group" ng-if="publishall == 0">
<label class="control-label col-sm-2">选择所要推送的行业(默认状态下均选上)</label>
<div class="col-sm-8">
<span ng-repeat="industry in industries">
<button class="btn btn-info" ng-click="toggleSelectIndustries(industry.value)" ng-class="{active:select_industries.indexOf('{{industry.value}}')>=0}"type="button" class="col-sm-4"><span style="color:white">{{industry.label}}</span> <i ng-if="select_industries.indexOf(industry.value)>=0" class="fa fa-check-circle" style="color: white"></i></button>&nbsp;&nbsp;
</span>
</div>
</div>
<div class="form-group" ng-if="publishall == 0">
<label class="control-label col-sm-2">选择所要推送的地区(默认状态下均选上)</label>
<div class="col-sm-8">
<span ng-repeat="state in states">
<button class="btn btn-info" ng-click="toggleStates(state.value)" ng-class="{active:select_states.indexOf('{{state.value}}')>=0}" type="button">{{state.label}} <i class="fa fa-check-circle" ng-if="select_states.indexOf(state.value)>=0" style="color: white"></i></button>&nbsp;&nbsp;
</span>
</div>
</div>
<div class="form-group" ng-if="publishall == 0">
<label class="control-label col-sm-2">选择所要推送的商户(默认状态下推送全部商户)</label>
<div class="col-sm-8">
<span ng-repeat="client in select_clients">
<button class="btn btn-info" ng-click="toggleClient(client)" ng-class="{select_clients.indexOf('{{client}}')>=0}" type="button">{{client}} <i class="fa fa-check-circle" ng-if="select_clients.indexOf(client)>=0" style="color: white"></i></button>&nbsp;&nbsp;
</span>
</div>
</div>
<div class="form-group" ng-if="publishall == 0">
<label class="col-xs-4 col-sm-2">
<select class="form-control" ng-model="params.textType">
<option value="all">ALL</option>
<option value="client_moniker">Partner Code</option>
<option value="client_name">Partner Name</option>
<option value="company_name">Company Name</option>
<option value="business_name">Business Name</option>
<option value="remark">Remark</option>
<option value="email">Email</option>
<option value="address">Address</option>
</select>
</label>
<div class="col-xs-8 col-sm-4">
<input class="form-control" placeholder="Keyword"
ng-enter="loadPartners(1)"
ng-model="params.searchText">
</div>
<button class="btn btn-primary" type="button"
ng-click="loadPartners(1)"><i
class="fa fa-search"></i> Search
</button>
</div>
<div class="form-group" ng-if="publishall == 0">
<label class="control-label col-sm-2">商户列表</label>
<div class="col-sm-8">
<span ng-repeat="partner in partners">
<button class="btn btn-info" ng-click="toggleClient(partner.client_moniker)" ng-class="{select_clients.indexOf('{{partner.client_moniker}}')>=0}" type="button">{{partner.client_moniker}} <i class="fa fa-check-circle" ng-if="select_clients.indexOf(partner.client_moniker)>=0" style="color: white"></i></button>&nbsp;&nbsp;
</span>
</div>
</div>
</form>
<div class="form-group">

Loading…
Cancel
Save