Showing
8 changed files
with
78 additions
and
214 deletions
@@ -17,14 +17,14 @@ | @@ -17,14 +17,14 @@ | ||
17 | <label class="col-sm-2 control-label">促销名称 <span class="red">*</span></label> | 17 | <label class="col-sm-2 control-label">促销名称 <span class="red">*</span></label> |
18 | 18 | ||
19 | <div class="col-sm-10"> | 19 | <div class="col-sm-10"> |
20 | - <input type="text" id="title" class="form-control" value="<%data.title%>" placeholder="促销名称" required/> | 20 | + <input type="text" id="title" class="form-control" value="" placeholder="促销名称" required/> |
21 | </div> | 21 | </div> |
22 | </div> | 22 | </div> |
23 | 23 | ||
24 | <div class="form-group"> | 24 | <div class="form-group"> |
25 | <label class="col-sm-2 control-label">促销描述 </label> | 25 | <label class="col-sm-2 control-label">促销描述 </label> |
26 | <div class="col-sm-10"> | 26 | <div class="col-sm-10"> |
27 | - <textarea style="width: 400px; height: 90px;" name="description" id="description"><%data.description%></textarea> | 27 | + <textarea style="width: 400px; height: 90px;" name="description" id="description"></textarea> |
28 | </div> | 28 | </div> |
29 | </div> | 29 | </div> |
30 | 30 | ||
@@ -32,12 +32,12 @@ | @@ -32,12 +32,12 @@ | ||
32 | <label class="col-sm-2 control-label">渠道</label> | 32 | <label class="col-sm-2 control-label">渠道</label> |
33 | <div class="col-sm-3"> | 33 | <div class="col-sm-3"> |
34 | <label class="radio-inline" style="padding-left: 0"> | 34 | <label class="radio-inline" style="padding-left: 0"> |
35 | - <input type="checkbox" name="fit_channel" value="1">有货官网</label> | 35 | + <input type="checkbox" name="fitChannel" value="1">有货官网</label> |
36 | <label class="radio-inline"> | 36 | <label class="radio-inline"> |
37 | - <input type="checkbox" name="fit_channel" value="2">iphone</label> | 37 | + <input type="checkbox" name="fitChannel" value="2">iphone</label> |
38 | <label class="radio-inline"> | 38 | <label class="radio-inline"> |
39 | - <input type="checkbox" name="fit_channel" value="3">android</label> | ||
40 | - <input type="hidden" id="fit_channel" name="fit_channel" value="<%data.fit_channel%>" for="checkbox" placeholder="渠道" /> | 39 | + <input type="checkbox" name="fitChannel" value="3">android</label> |
40 | + <input type="hidden" id="fitChannel" name="fitChannel" value="" for="checkbox" placeholder="渠道" /> | ||
41 | </div> | 41 | </div> |
42 | </div> | 42 | </div> |
43 | 43 | ||
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | <label class="col-sm-2 control-label">起始时间 <span class="red">*</span></label> | 45 | <label class="col-sm-2 control-label">起始时间 <span class="red">*</span></label> |
46 | <div class="col-sm-4"> | 46 | <div class="col-sm-4"> |
47 | <input id="startTime" class="form-control" jsaction="time:end:endTime" type="text" placeholder="预售上架时间" | 47 | <input id="startTime" class="form-control" jsaction="time:end:endTime" type="text" placeholder="预售上架时间" |
48 | - value="<%data.startTime%>" readonly required/> | 48 | + value="" readonly required/> |
49 | </div> | 49 | </div> |
50 | </div> | 50 | </div> |
51 | 51 | ||
@@ -53,14 +53,14 @@ | @@ -53,14 +53,14 @@ | ||
53 | <label class="col-sm-2 control-label">结束时间 <span class="red">*</span></label> | 53 | <label class="col-sm-2 control-label">结束时间 <span class="red">*</span></label> |
54 | <div class="col-sm-4"> | 54 | <div class="col-sm-4"> |
55 | <input id="endTime" class="form-control" jsaction="time:start:startTime" type="text" placeholder="预售下架时间" | 55 | <input id="endTime" class="form-control" jsaction="time:start:startTime" type="text" placeholder="预售下架时间" |
56 | - value="<%data.endTime%>" readonly required/> | 56 | + value="" readonly required/> |
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | 59 | ||
60 | <div class="form-group"> | 60 | <div class="form-group"> |
61 | <label class="col-sm-2 control-label">优先级 <span class="red">*</span></label> | 61 | <label class="col-sm-2 control-label">优先级 <span class="red">*</span></label> |
62 | <div class="col-sm-10"> | 62 | <div class="col-sm-10"> |
63 | - <input type="text" id="priority" name='priority' class="form-control" value="<%data.priority%>" required/> | 63 | + <input type="text" id="priority" name='priority' class="form-control" value="" required/> |
64 | </div> | 64 | </div> |
65 | </div> | 65 | </div> |
66 | 66 | ||
@@ -71,13 +71,12 @@ | @@ -71,13 +71,12 @@ | ||
71 | <input type="radio" name="status" value="1">启用</label> | 71 | <input type="radio" name="status" value="1">启用</label> |
72 | <label class="radio-inline"> | 72 | <label class="radio-inline"> |
73 | <input type="radio" name="status" value="0" selected="selected">不启用</label> | 73 | <input type="radio" name="status" value="0" selected="selected">不启用</label> |
74 | - <input type="hidden" id="status" name="status" value="<%data.status||'0'%>" for="radio" required /> | 74 | + <input type="hidden" id="status" name="status" value="" for="radio" required /> |
75 | </div> | 75 | </div> |
76 | </div> | 76 | </div> |
77 | 77 | ||
78 | </div> | 78 | </div> |
79 | </div> | 79 | </div> |
80 | - <input type="hidden" id="id" value="<%data.id%>"> | ||
81 | 80 | ||
82 | <div class="panel-footer"> | 81 | <div class="panel-footer"> |
83 | <button class="btn btn-primary" id="save">保存</button> | 82 | <button class="btn btn-primary" id="save">保存</button> |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <div class="contentpanel"> | 4 | <div class="contentpanel"> |
5 | <div class="panel panel-default" style="margin-bottom:10px"> | 5 | <div class="panel panel-default" style="margin-bottom:10px"> |
6 | <div class="panel-body" style="padding-bottom: 0"> | 6 | <div class="panel-body" style="padding-bottom: 0"> |
7 | - <a href="/promotionInfo/addNew" class="btn btn-success "><i class="fa fa-plus"></i> 添加促销</a> | 7 | + <a href="javascript:;" id="save" class="btn btn-success "><i class="fa fa-plus"></i> 添加促销</a> |
8 | </div> | 8 | </div> |
9 | <div class="panel-body"> | 9 | <div class="panel-body"> |
10 | <div class="row"> | 10 | <div class="row"> |
@@ -53,5 +53,7 @@ | @@ -53,5 +53,7 @@ | ||
53 | </div> | 53 | </div> |
54 | </div> | 54 | </div> |
55 | </div> | 55 | </div> |
56 | - | 56 | +<script id="template_save" type="text/template"> |
57 | + <%include './Add'%> | ||
58 | +</script> | ||
57 | <%include '../../../common/views/__ui/footer'%> | 59 | <%include '../../../common/views/__ui/footer'%> |
@@ -21,12 +21,12 @@ | @@ -21,12 +21,12 @@ | ||
21 | <label class="col-sm-2 control-label">渠道</label> | 21 | <label class="col-sm-2 control-label">渠道</label> |
22 | <div class="col-sm-3"> | 22 | <div class="col-sm-3"> |
23 | <label class="radio-inline" style="padding-left: 0"> | 23 | <label class="radio-inline" style="padding-left: 0"> |
24 | - <input type="checkbox" name="fit_channel" value="1">有货官网</label> | 24 | + <input type="checkbox" name="fitChannel" value="1">有货官网</label> |
25 | <label class="radio-inline"> | 25 | <label class="radio-inline"> |
26 | - <input type="checkbox" name="fit_channel" value="2">iphone</label> | 26 | + <input type="checkbox" name="fitChannel" value="2">iphone</label> |
27 | <label class="radio-inline"> | 27 | <label class="radio-inline"> |
28 | - <input type="checkbox" name="fit_channel" value="3">android</label> | ||
29 | - <input type="hidden" id="fit_channel" name="fit_channel" value="<%data.fit_channel%>" for="checkbox" placeholder="渠道" /> | 28 | + <input type="checkbox" name="fitChannel" value="3">android</label> |
29 | + <input type="hidden" id="fitChannel" name="fitChannel" value="<%data.fitChannel%>" for="checkbox" placeholder="渠道" /> | ||
30 | </div> | 30 | </div> |
31 | </div> | 31 | </div> |
32 | 32 |
1 | +'use strict'; | ||
2 | +var $ = require('jquery'), | ||
3 | + common = require('../../../common/common'); | ||
4 | +var saveConfig={ | ||
5 | + formId:"basicForm", | ||
6 | + _btnId:"save", | ||
7 | + reloadUrl:"/promotionInfo/index", | ||
8 | + tempId:"template_save" | ||
9 | +} | ||
10 | + | ||
11 | +$(document).on('click', '#'+saveConfig._btnId, function () { | ||
12 | + | ||
13 | + var _title=common.util.__input("title"); | ||
14 | + var _description=$("#description").text(); | ||
15 | + var _fitChannel=$("#fitChannel").val(); | ||
16 | + var _startTime=common.util.__input("startTime"); | ||
17 | + var _endTime=common.util.__input("endTime"); | ||
18 | + var _priority=common.util.__input("priority"); | ||
19 | + var check=true; | ||
20 | + if (_title === '' || $.trim(_title) === ''){ | ||
21 | + common.util.__tip("名称不能为空", "warning"); | ||
22 | + check=false; | ||
23 | + } | ||
24 | + if (_startTime===''||$.trim(_startTime)===''||_startTime<1){ | ||
25 | + common.util.__tip("开始时间不能为空", "warning"); | ||
26 | + check= false; | ||
27 | + } | ||
28 | + if (_endTime===''||$.trim(_endTime)===''||_endTime<1){ | ||
29 | + common.util.__tip("结束时间不能为空", "warning"); | ||
30 | + check= false; | ||
31 | + } | ||
32 | + var _form_data={ | ||
33 | + title:_title, | ||
34 | + description:_description, | ||
35 | + fitChannel:_fitChannel, | ||
36 | + startTime:_startTime, | ||
37 | + endTime:_endTime, | ||
38 | + priority:_priority | ||
39 | + }; | ||
40 | + common.dialog.confirm("新增促销", | ||
41 | + common.util.__template2($("#"+tempId).html(),_form_data) | ||
42 | + , function () { | ||
43 | + if(check){ | ||
44 | + common.util.__ajax({ | ||
45 | + url: $("#"+saveConfig.formId).attr("action"), | ||
46 | + data: _form_data | ||
47 | + }, function () { | ||
48 | + location.href = saveConfig.reloadUrl | ||
49 | + }); | ||
50 | + }else { | ||
51 | + return false; | ||
52 | + } | ||
53 | + }); | ||
54 | +}); |
1 | 'use strict'; | 1 | 'use strict'; |
2 | var $ = require('jquery'), | 2 | var $ = require('jquery'), |
3 | - common = require('../../../common/common'); | ||
4 | - | ||
5 | -var rejectPromotions={ | ||
6 | - batchIds:[], | ||
7 | - buildCheckboxHtml:function(_class,_data_index,_checked){ | ||
8 | - var _checkBox="<input type='checkbox'"; | ||
9 | - var _end="/>"; | ||
10 | - if(_class){ | ||
11 | - _checkBox+=" class='"+_class+"'"; | ||
12 | - } | ||
13 | - if(_data_index){ | ||
14 | - _checkBox+=" data-index='"+_data_index+"'"; | ||
15 | - } | ||
16 | - if(_checked){ | ||
17 | - _checkBox+=" checked='"+_checked+"'"; | ||
18 | - } | ||
19 | - _checkBox+=_end; | ||
20 | - return _checkBox; | ||
21 | - }, | ||
22 | - getParam:function(){ | ||
23 | - var g=this; | ||
24 | - /* | ||
25 | - var _buildCheckboxHtml = function (_class,_data_index,_checked) { | ||
26 | - return this.buildCheckboxHtml(_class,_data_index,_checked); | ||
27 | - };*/ | ||
28 | - var param={ | ||
29 | - el: '#basicTable_promotion', | ||
30 | - size: 10, | ||
31 | - parms: function() { | ||
32 | - return { | ||
33 | - startTime: common.util.__input('startTime'), | ||
34 | - endTime:common.util.__input("endTime") | ||
35 | - }; | ||
36 | - }, | ||
37 | - columns: [ | ||
38 | - { | ||
39 | - display: '', | ||
40 | - type: 'checkbox', | ||
41 | - _class:"all", | ||
42 | - render: function (item) { | ||
43 | - var htmlContent = ""; | ||
44 | - var _class="promotion_checkbox"; | ||
45 | - if(g.batchIds.length === 0 ){ | ||
46 | - //htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>"; | ||
47 | - htmlContent = g.buildCheckboxHtml(_class,item.__index); | ||
48 | - }else{ | ||
49 | - $.each(g.batchIds,function(n,value) { | ||
50 | - if(item.id == value){ | ||
51 | - //htmlContent = "<input type='checkbox' checked='checked' class='wqt_checkbox' data-index='"+item.__index+"'>"; | ||
52 | - htmlContent = g.buildCheckboxHtml(_class,item.__index,"checked"); | ||
53 | - return false | ||
54 | - }else{ | ||
55 | - htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>"; | ||
56 | - htmlContent = g.buildCheckboxHtml(_class,item.__index); | ||
57 | - } | ||
58 | - }) | ||
59 | - } | ||
60 | - return htmlContent; | ||
61 | - } | ||
62 | - },{ | ||
63 | - display: "ID", | ||
64 | - name: "id" | ||
65 | - }, { | ||
66 | - display: "促销名称", | ||
67 | - name: "title" | ||
68 | - }, { | ||
69 | - display: '优先级', | ||
70 | - name: "priority" | ||
71 | - }, { | ||
72 | - display: '开始时间', | ||
73 | - name: "startTime", | ||
74 | - render: function(item) { | ||
75 | - var date = new Date(item.startTime * 1000); | ||
76 | - return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds(); | ||
77 | - } | ||
78 | - }, { | ||
79 | - display: '结束时间', | ||
80 | - name: "endTime", | ||
81 | - render: function(item) { | ||
82 | - var date = new Date(item.endTime * 1000); | ||
83 | - return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds(); | ||
84 | - } | ||
85 | - }, { | ||
86 | - display: '是否启用', | ||
87 | - name: "status", | ||
88 | - render: function(item) { | ||
89 | - if(item.status==1){ | ||
90 | - var name ="已启用" ; | ||
91 | - }else { | ||
92 | - var name ="未启用" ; | ||
93 | - } | ||
94 | - return name; | ||
95 | - } | ||
96 | - }, { | ||
97 | - display: '优惠券限制使用', | ||
98 | - name: "status", | ||
99 | - render: function(item) { | ||
100 | - if(item.status==1){ | ||
101 | - var name ="是" ; | ||
102 | - }else { | ||
103 | - var name ="否" ; | ||
104 | - } | ||
105 | - return name; | ||
106 | - } | ||
107 | - }] | ||
108 | - }; | ||
109 | - return param; | ||
110 | - }, | ||
111 | - bindGrid: function(param){ | ||
112 | - return new common.grid(param); | ||
113 | - }, | ||
114 | - grid: undefined, | ||
115 | - init: function(){ | ||
116 | - var g=this, | ||
117 | - _param=this.getParam(); | ||
118 | - this.grid=g.bindGrid(_param); | ||
119 | - this.grid.init("/promotionInfo/list"); | ||
120 | - this.bindEvent(); | ||
121 | - }, | ||
122 | - reload:function(){ | ||
123 | - var g=this, | ||
124 | - _grid=this.grid; | ||
125 | - _grid.reload(1); | ||
126 | - }, | ||
127 | - bindEvent: function() { | ||
128 | - var g = this.grid, | ||
129 | - p = this.options, | ||
130 | - _batchIds=this.batchIds; | ||
131 | - | ||
132 | - $(g.grid).on("change", ".all", function() { | ||
133 | - var selected = $(".all").prop("checked"); | ||
134 | - $(".promotion_checkbox").prop("checked", selected); | ||
135 | - g.selected.length = 0; | ||
136 | - $(".promotion_checkbox").each(function() { | ||
137 | - var checked = $(this).prop("checked"); | ||
138 | - var index = $(this).data("index"); | ||
139 | - if (checked) { | ||
140 | - /**************业务控制 特殊情况**************/ | ||
141 | - if(_batchIds){ | ||
142 | - if($.inArray(g.rows[index]['id'], _batchIds) == -1 ){ | ||
143 | - _batchIds.push(g.rows[index]['id']); | ||
144 | - } | ||
145 | - } | ||
146 | - /*********************************************/ | ||
147 | - g.selected.push(g.rows[index]); | ||
148 | - }else{ | ||
149 | - /**************业务控制 特殊情况**************/ | ||
150 | - | ||
151 | - var _index = $.inArray(g.rows[index]['id'], _batchIds); | ||
152 | - if(_batchIds && _index != -1 ){ | ||
153 | - _batchIds.splice(_index,1); | ||
154 | - } | ||
155 | - /********************************************/ | ||
156 | - } | ||
157 | - }); | ||
158 | - }); //g.selected | ||
159 | - //$(".promotion_checkbox").prop("checked",true); | ||
160 | - $(g.grid).on("change", ".promotion_checkbox", function() { | ||
161 | - $(".all").prop("checked", false); | ||
162 | - g.selected.length = 0; | ||
163 | - var selected = true; | ||
164 | - | ||
165 | - /************业务控制 特殊情况****************/ | ||
166 | - if(_batchIds){ | ||
167 | - if($(this).prop("checked")){ | ||
168 | - if($.inArray(g.rows[$(this).attr("data-index")]['id'], _batchIds) == -1 ){ | ||
169 | - _batchIds.push(g.rows[$(this).attr("data-index")]['id']); | ||
170 | - } | ||
171 | - }else{ | ||
172 | - var _index = $.inArray(g.rows[$(this).attr("data-index")]['id'], _batchIds); | ||
173 | - if(_index != -1 ){ | ||
174 | - _batchIds.splice(_index,1); | ||
175 | - } | ||
176 | - } | ||
177 | - } | ||
178 | - /********************************************/ | ||
179 | - | ||
180 | - $(".promotion_checkbox").each(function() { | ||
181 | - var checked = $(this).prop("checked"); | ||
182 | - var index = $(this).data("index"); | ||
183 | - if (checked) { | ||
184 | - g.selected.push(g.rows[index]); | ||
185 | - } else { | ||
186 | - selected = false; | ||
187 | - } | ||
188 | - }); | ||
189 | - $(".all").prop("checked", selected); | ||
190 | - }); | ||
191 | - | ||
192 | - $(g.grid).on("change",".t_size",function(){ | ||
193 | - p.size=$(this).val(); | ||
194 | - g.reload(1); | ||
195 | - }) | ||
196 | - } | ||
197 | - } | ||
198 | - | 3 | + common = require('../../../common/common'), |
4 | + rejectPromotions=require('./partials/edit_reject'); | ||
199 | 5 | ||
200 | /* | 6 | /* |
201 | * 获取业务数据 | 7 | * 获取业务数据 |
@@ -240,7 +46,7 @@ var t = new common.tab2({ | @@ -240,7 +46,7 @@ var t = new common.tab2({ | ||
240 | active: 6, | 46 | active: 6, |
241 | click: function () { | 47 | click: function () { |
242 | var columnname = t.options.columns[t.options.active].name; | 48 | var columnname = t.options.columns[t.options.active].name; |
243 | - var default_html="<a href='#'>维护中。。。</a>"; | 49 | + var default_html="<a href='#'>bad error</a>"; |
244 | if (columnname === ENUM.tabName[0].en) {//baseinfo | 50 | if (columnname === ENUM.tabName[0].en) {//baseinfo |
245 | var html_baseinfo=$("#fm_baseInfo").html(); | 51 | var html_baseinfo=$("#fm_baseInfo").html(); |
246 | $("#tab_body").html(html_baseinfo); | 52 | $("#tab_body").html(html_baseinfo); |
-
Please register or login to post a comment