Authored by leo

Merge branch 'dev_优惠券优化'

@@ -6,89 +6,7 @@ @@ -6,89 +6,7 @@
6 <div class="panel panel-default" style="margin-bottom:10px;"> 6 <div class="panel panel-default" style="margin-bottom:10px;">
7 <div class="panel-body"> 7 <div class="panel-body">
8 <div class="row"> 8 <div class="row">
9 - <div class="panel-col">  
10 - <select id="filter-department" tabindex="-1" class="select2-offscreen brandBtn-group">  
11 - <option value="-1">申请部门</option>  
12 - <option value="20"> 资源发展部</option>  
13 - <option value="21"> 广告部</option>  
14 - <option value="22"> 招商部</option>  
15 - <option value="23"> 男生媒体部</option>  
16 - <option value="24"> 女生媒体部</option>  
17 - <option value="25"> 流程运营部</option>  
18 - <option value="26"> 发行设计部</option>  
19 - <option value="27"> 设计部</option>  
20 - <option value="28"> 商品一部(羊头+轻奢)</option>  
21 - <option value="29"> 商品二部(男装)</option>  
22 - <option value="30"> 商品三部(女装)</option>  
23 - <option value="31"> 商品四部(户外运动)</option>  
24 - <option value="32"> 商品五部(自主)</option>  
25 - <option value="33"> 商品六部(明星/KOL)</option>  
26 - <option value="34"> 商品七部(童装)</option>  
27 - <option value="35"> 商品八部(创意生活+玩具)</option>  
28 - <option value="36"> 商品九部(彩妆)</option>  
29 - <option value="37"> 商品十部(全球购)</option>  
30 - <option value="38"> 运营支持部</option>  
31 - <option value="39"> 类目及活动运营部</option>  
32 - <option value="40"> 内容运营部</option>  
33 - <option value="41"> 营销策划部</option>  
34 - <option value="42"> 设计部</option>  
35 - <option value="43"> 售后服务部</option>  
36 - <option value="44"> 客户关系部</option>  
37 - <option value="45"> 运营部</option>  
38 - <option value="46"> 泛渠道部</option>  
39 - <option value="47"> 运营统筹部</option>  
40 - <option value="48"> 南京艾尚店</option>  
41 - <option value="49"> 仓储部</option>  
42 - <option value="50"> 物流部</option>  
43 - <option value="51"> 运营部</option>  
44 - <option value="52"> 公关部</option>  
45 - <option value="53"> 运营部</option>  
46 - <option value="54"> 生产部</option>  
47 - <option value="55"> 商品部</option>  
48 - <option value="56"> 销售部</option>  
49 - <option value="57"> 市场部</option>  
50 - <option value="58"> 运营部</option>  
51 - <option value="59"> 人事部</option>  
52 - <option value="60"> 财务部</option>  
53 - <option value="61"> 陈列部</option>  
54 - <option value="62"> 会员数据部</option>  
55 - <option value="63"> 会员营销部</option>  
56 - <option value="64"> 会员运营部</option>  
57 - <option value="65"> 品牌营销部</option>  
58 - <option value="66"> 效果营销部</option>  
59 - <option value="67"> PR营销部</option>  
60 - <option value="68"> 设计部</option>  
61 - <option value="69"> 零售产品部</option>  
62 - <option value="70"> 媒体产品部</option>  
63 - <option value="71"> 设计部</option>  
64 - <option value="72"> 前端系统部</option>  
65 - <option value="73"> 核心系统部</option>  
66 - <option value="74"> 后台系统部</option>  
67 - <option value="75"> 测试部</option>  
68 - <option value="76"> 研究发展部</option>  
69 - <option value="77"> 大数据部</option>  
70 - <option value="78"> 运维部</option>  
71 - <option value="79"> 财务部</option>  
72 - <option value="80"> 内审部</option>  
73 - <option value="81"> 行政部</option>  
74 - <option value="82"> 数据部</option>  
75 - <option value="83"> 公共关系部</option>  
76 - <option value="84"> 人力资源部</option>  
77 - <option value="85"> 总裁办</option>  
78 - <option value="86"> 火星项目部</option>  
79 -  
80 - <option value="1">渠道二部</option>  
81 - <option value="2">渠道一部</option>  
82 - <option value="3">零售部</option>  
83 - <option value="4">品牌资源部</option>  
84 - <option value="5">店铺运营部</option>  
85 - <option value="6">类目运营部</option>  
86 - <option value="7">营销部</option>  
87 - <option value="8">市场部</option>  
88 - <option value="9">会员部</option>  
89 - <option value="10">客服部</option>  
90 - <option value="11">内容营销部</option>  
91 - </select> 9 + <div class="panel-col" id="departments">
92 </div> 10 </div>
93 <div class="panel-col"> 11 <div class="panel-col">
94 <select id="filter-couponType" tabindex="-1" class="select2-offscreen brandBtn-group"> 12 <select id="filter-couponType" tabindex="-1" class="select2-offscreen brandBtn-group">
@@ -125,4 +43,13 @@ @@ -125,4 +43,13 @@
125 </div> 43 </div>
126 </div> 44 </div>
127 45
  46 +<script type="text/template" id="search-department">
  47 + <select id="choose-department" title="" class=" select2-offscreen form-control">
  48 + <option value="-1">申请部门</option>
  49 + [[each data as item index]]
  50 + <option value="[[item.department]]">[[item.departmentName]]</option>
  51 + [[/each]]
  52 + </select>
  53 +</script>
  54 +
128 <%include '../../../common/views/__ui/footer'%> 55 <%include '../../../common/views/__ui/footer'%>
@@ -5,18 +5,6 @@ @@ -5,18 +5,6 @@
5 var $ = require('jquery'), 5 var $ = require('jquery'),
6 common=require('../../../common/common'); 6 common=require('../../../common/common');
7 7
8 -var departments =[  
9 - "渠道二部", "渠道一部", "零售部", "品牌资源部", "店铺运营部", "类目运营部", "营销部", "市场部", "会员部 ", "客服部", "内容营销部",  
10 - "", "", "", "", "", "", "", "",  
11 - "资源发展部", "广告部", "招商部", "男生媒体部", "女生媒体部 ", "流程运营部", "发行设计部", "设计部", "商品一部(羊头+轻奢)",  
12 - "商品二部(男装)", "商品三部(女装)", "商品四部(户外运动)", "商品五部(自主)", "商品六部(明星/KOL)",  
13 - "商品七部(童装)", "商品八部(创意生活+玩具)", "商品九部(彩妆", "商品十部(全球购", "运营支持部", "类目及活动运营部",  
14 - "内容运营部", "营销策划部", "设计部", "售后服务部", "客户关系部 ", "运营部", "泛渠道部", "运营统筹部", "南京艾尚店",  
15 - "仓储部", "物流部", "运营部 ", "公关部", "运营部", "生产部", "商品部", "销售部", "市场部", "运营部", "人事部", "财务部",  
16 - "陈列部", "会员数据部", "会员营销部", "会员运营部", "品牌营销部", "效果营销部", "PR营销部", "设计部", "零售产品部",  
17 - "媒体产品部", "设计部", "前端系统部", "核心系统部", "后台系统部", "测试部", "研究发展部", "大数据部", "运维部", "财务部",  
18 - "内审部", "行政部", "数据部", "公共关系部", "人力资源部", "总裁办", "火星项目部 "  
19 -];  
20 var couponTypes = ["A券", "B券", "公开券", "生日券", "免邮券"]; 8 var couponTypes = ["A券", "B券", "公开券", "生日券", "免邮券"];
21 var startTimeObj; 9 var startTimeObj;
22 var endTimeObj; 10 var endTimeObj;
@@ -30,7 +18,23 @@ endTimeObj = $("#filter-endTimeStr").fdatepicker({ @@ -30,7 +18,23 @@ endTimeObj = $("#filter-endTimeStr").fdatepicker({
30 }).data("datepicker"); 18 }).data("datepicker");
31 //下拉框 19 //下拉框
32 new common.dropDown({el: '#filter-couponType'}); 20 new common.dropDown({el: '#filter-couponType'});
33 -new common.dropDown({el: '#filter-department'}); 21 +new common.dropDown({el: '#choose-department'});
  22 +
  23 +common.util.__ajax({
  24 + url: "/coupon/getAllDepartment",//获取所有部门
  25 + data: {size: 1000}
  26 +}, function (res) {
  27 + var data=res.data;
  28 + var newData=data.filter(function(v,i){
  29 + if(v.status==1){
  30 + return v;
  31 + }
  32 + });
  33 + res.data=newData;
  34 + console.log(res);
  35 + $("#departments").html(common.util.__template2($("#search-department").html(), res));
  36 + new common.dropDown({el: "#choose-department"});
  37 +}, true);
34 38
35 //grid 39 //grid
36 var g = new common.grid({ 40 var g = new common.grid({
@@ -40,7 +44,7 @@ var g = new common.grid({ @@ -40,7 +44,7 @@ var g = new common.grid({
40 couponType: common.util.__input("filter-couponType"), 44 couponType: common.util.__input("filter-couponType"),
41 couponId: common.util.__input("filter-couponId"), 45 couponId: common.util.__input("filter-couponId"),
42 couponName:common.util.__input("filter-couponName"), 46 couponName:common.util.__input("filter-couponName"),
43 - department:common.util.__input("filter-department"), 47 + department:common.util.__input("choose-department"),
44 startTimeStr:common.util.__input("filter-startTimeStr"), 48 startTimeStr:common.util.__input("filter-startTimeStr"),
45 endTimeStr:common.util.__input("filter-endTimeStr") 49 endTimeStr:common.util.__input("filter-endTimeStr")
46 }; 50 };
@@ -49,10 +53,18 @@ var g = new common.grid({ @@ -49,10 +53,18 @@ var g = new common.grid({
49 {display:"优惠券ID", name:"id"}, 53 {display:"优惠券ID", name:"id"},
50 {display:"优惠券名称",name:"couponName"}, 54 {display:"优惠券名称",name:"couponName"},
51 {display: '申请部门', render: function(item) { 55 {display: '申请部门', render: function(item) {
52 - return '<p class="audit-time">' + departments[item.department-1] + '</p>'; 56 + var deptName = item.departmentName;
  57 + if(deptName === undefined) {
  58 + deptName = '';
  59 + }
  60 + return '<p class="audit-time">' + deptName + '</p>';
53 }}, 61 }},
54 {display: '优惠券类型', render: function(item) { 62 {display: '优惠券类型', render: function(item) {
55 - return '<p class="audit-time">' + couponTypes[item.couponType-1] + '</p>'; 63 + var couponType = couponTypes[item.couponType-1];
  64 + if(couponType === undefined) {
  65 + couponType = '';
  66 + }
  67 + return '<p class="audit-time">' + couponType + '</p>';
56 }}, 68 }},
57 {display: '数量', name: "couponNum"}, 69 {display: '数量', name: "couponNum"},
58 {display: '面额', name: "couponAmount"}, 70 {display: '面额', name: "couponAmount"},