Authored by chenchao

debug

@@ -37,6 +37,7 @@ var ENUM = { @@ -37,6 +37,7 @@ var ENUM = {
37 {en:"reject",cn:"互斥促销"}, 37 {en:"reject",cn:"互斥促销"},
38 {en:"display",cn:"促销显示"},] 38 {en:"display",cn:"促销显示"},]
39 }; 39 };
  40 +var _promotion=new promotionEdit();
40 //tab 页组件 41 //tab 页组件
41 var t = new common.tab2({ 42 var t = new common.tab2({
42 el: "#basicTab", 43 el: "#basicTab",
@@ -55,7 +56,7 @@ var t = new common.tab2({ @@ -55,7 +56,7 @@ var t = new common.tab2({
55 56
56 }else if(columnname === ENUM.tabName[4].en) { 57 }else if(columnname === ENUM.tabName[4].en) {
57 // 加载促销列表 58 // 加载促销列表
58 - var html_promotions=$(promotionEdit.param.el).html(); 59 + var html_promotions=$(_promotion.param.el).html();
59 $("#tab_body").html(html_promotions); 60 $("#tab_body").html(html_promotions);
60 grid_promotions.init("/promotionInfo/list"); 61 grid_promotions.init("/promotionInfo/list");
61 }else if(columnname === ENUM.tabName[5].en) { 62 }else if(columnname === ENUM.tabName[5].en) {
1 var $ = require('jquery'), 1 var $ = require('jquery'),
2 common = require('../../../../common/common'); 2 common = require('../../../../common/common');
3 -var param={  
4 - el: '#basicTable_promotion',  
5 - size: 10,  
6 - parms: function() {  
7 - return {  
8 - startTime: common.util.__input('startTime'),  
9 - endTime:common.util.__input("endTime")  
10 - };  
11 - },  
12 - columns: [{  
13 - display: "ID",  
14 - name: "id"  
15 - }, {  
16 - display: "促销名称",  
17 - name: "title"  
18 - }, {  
19 - display: '优先级',  
20 - name: "priority"  
21 - }, {  
22 - display: '开始时间',  
23 - name: "startTime",  
24 - render: function(item) {  
25 - var date = new Date(item.startTime * 1000);  
26 - return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();  
27 - }  
28 - }, {  
29 - display: '结束时间',  
30 - name: "endTime",  
31 - render: function(item) {  
32 - var date = new Date(item.endTime * 1000);  
33 - return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();  
34 - }  
35 - }, {  
36 - display: '是否启用',  
37 - name: "status",  
38 - render: function(item) {  
39 - if(item.status==1){  
40 - var name ="已启用" ;  
41 - }else {  
42 - var name ="未启用" ; 3 +
  4 +var promotionEdit=function(){
  5 + var param={
  6 + el: '#basicTable_promotion',
  7 + size: 10,
  8 + parms: function() {
  9 + return {
  10 + startTime: common.util.__input('startTime'),
  11 + endTime:common.util.__input("endTime")
  12 + };
  13 + },
  14 + columns: [{
  15 + display: "ID",
  16 + name: "id"
  17 + }, {
  18 + display: "促销名称",
  19 + name: "title"
  20 + }, {
  21 + display: '优先级',
  22 + name: "priority"
  23 + }, {
  24 + display: '开始时间',
  25 + name: "startTime",
  26 + render: function(item) {
  27 + var date = new Date(item.startTime * 1000);
  28 + return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
43 } 29 }
44 - return name;  
45 - }  
46 - }, {  
47 - display: '优惠券限制使用',  
48 - name: "status",  
49 - render: function(item) {  
50 - if(item.status==1){  
51 - var name ="是" ;  
52 - }else {  
53 - var name ="否" ; 30 + }, {
  31 + display: '结束时间',
  32 + name: "endTime",
  33 + render: function(item) {
  34 + var date = new Date(item.endTime * 1000);
  35 + return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
54 } 36 }
55 - return name;  
56 - }  
57 - }]  
58 -};  
59 -var grid_promotions = new common.grid(param);  
  37 + }, {
  38 + display: '是否启用',
  39 + name: "status",
  40 + render: function(item) {
  41 + if(item.status==1){
  42 + var name ="已启用" ;
  43 + }else {
  44 + var name ="未启用" ;
  45 + }
  46 + return name;
  47 + }
  48 + }, {
  49 + display: '优惠券限制使用',
  50 + name: "status",
  51 + render: function(item) {
  52 + if(item.status==1){
  53 + var name ="是" ;
  54 + }else {
  55 + var name ="否" ;
  56 + }
  57 + return name;
  58 + }
  59 + }]
  60 + };
  61 + promotionEdit.param=param;
  62 + this.grid=$.extend({}, {}, promotionEdit.getGrid(param));
  63 +
  64 + return this;
  65 +}
  66 +promotionEdit.prototype={
  67 + constructor: promotionEdit,
  68 + param: {},
  69 + getGrid: function(param){
  70 + return new common.grid(param);
  71 + }
  72 +
  73 +}
  74 +
  75 +
  76 +
  77 +module.exports = promotionEdit;