Authored by chenchao

temp save

@@ -6,14 +6,14 @@ module.exports = function (app){ @@ -6,14 +6,14 @@ module.exports = function (app){
6 pageName:"促销管理" 6 pageName:"促销管理"
7 } 7 }
8 }); 8 });
9 - //新增基本信息 9 + //新增促销基本信息
10 app.get("/promotionInfo/addNew", "customService.promotion.Add", function (req,res){ 10 app.get("/promotionInfo/addNew", "customService.promotion.Add", function (req,res){
11 this.$extend={ 11 this.$extend={
12 moduleName:"客服管理", 12 moduleName:"客服管理",
13 pageName:"促销编辑" 13 pageName:"促销编辑"
14 } 14 }
15 }); 15 });
16 - //编辑页 16 + //促销编辑页
17 app.get("/promotionInfo/edit/:brandId", "customService.promotion.Edit","promotion_getPromotionInfo", function (rs,req,res){ 17 app.get("/promotionInfo/edit/:brandId", "customService.promotion.Edit","promotion_getPromotionInfo", function (rs,req,res){
18 this.$extend={ 18 this.$extend={
19 action: '/promotion/update', 19 action: '/promotion/update',
@@ -22,12 +22,23 @@ module.exports = function (app){ @@ -22,12 +22,23 @@ module.exports = function (app){
22 return rs.data; 22 return rs.data;
23 }); 23 });
24 24
25 - //列表 25 + //促销列表
26 app.post("/promotionInfo/list","promotion_getPromotionInfoList"); 26 app.post("/promotionInfo/list","promotion_getPromotionInfoList");
27 - //新增 27 + //新增促销信息
28 app.post("/promotionInfo/add","promotion_addPromotionInfo"); 28 app.post("/promotionInfo/add","promotion_addPromotionInfo");
29 - //编辑 29 + //编辑促销信息
30 app.post("/promotionInfo/update","promotion_updatePromotionInfo"); 30 app.post("/promotionInfo/update","promotion_updatePromotionInfo");
31 - //删除 31 + //删除促销信息
32 app.post("/promotionInfo/delete","promotion_deletePromotionInfo"); 32 app.post("/promotionInfo/delete","promotion_deletePromotionInfo");
  33 +
  34 + //参数-促销条件
  35 +
  36 + //参数-促销操作
  37 +
  38 + //参数- 促销限制
  39 +
  40 + //参数-互斥促销
  41 +
  42 + //参数-促销显示
  43 +
33 } 44 }
  1 +<%include '../../../common/views/__ui/header'%>
  2 +<%include '../../../common/views/__partail/ListHeader'%>
  3 +<div class="contentpanel">
  4 + <div class="row">
  5 + <div class="col-md-12">
  6 + <form id="basicForm" role="form" class="form-horizontal form-bordered" method="post" action="<%action%>">
  7 +
  8 + <div class="panel panel-default">
  9 + <div class="panel-heading">
  10 + <h4 class="panel-title">基本信息</h4>
  11 + </div>
  12 +
  13 + <div class="panel-body" id="basicInfo">
  14 + <div class="row">
  15 +
  16 + <div class="form-group">
  17 + <label class="col-sm-2 control-label">促销名称&nbsp;&nbsp;<span class="red">*</span></label>
  18 +
  19 + <div class="col-sm-10">
  20 + <input type="text" id="title" class="form-control" value="<%data.title%>" placeholder="促销名称" required/>
  21 + </div>
  22 + </div>
  23 +
  24 + <div class="form-group">
  25 + <label class="col-sm-2 control-label">促销描述 </label>
  26 + <div class="col-sm-10">
  27 + <textarea style="width: 400px; height: 90px;" name="description" id="description"><%data.description%></textarea>
  28 + </div>
  29 + </div>
  30 +
  31 + <div class="form-group">
  32 + <label class="col-sm-2 control-label">渠道</label>
  33 + <div class="col-sm-3">
  34 + <label class="radio-inline" style="padding-left: 0">
  35 + <input type="checkbox" name="fit_channel" value="1">有货官网</label>
  36 + <label class="radio-inline">
  37 + <input type="checkbox" name="fit_channel" value="2">iphone</label>
  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="渠道" />
  41 + </div>
  42 + </div>
  43 +
  44 + <div class="form-group">
  45 + <label class="col-sm-2 control-label">起始时间&nbsp;&nbsp;<span class="red">*</span></label>
  46 + <div class="col-sm-4">
  47 + <input id="startTime" class="form-control" jsaction="time:end:endTime" type="text" placeholder="预售上架时间"
  48 + value="<%data.startTime%>" readonly required/>
  49 + </div>
  50 + </div>
  51 +
  52 + <div class="form-group">
  53 + <label class="col-sm-2 control-label">结束时间&nbsp;&nbsp;<span class="red">*</span></label>
  54 + <div class="col-sm-4">
  55 + <input id="endTime" class="form-control" jsaction="time:start:startTime" type="text" placeholder="预售下架时间"
  56 + value="<%data.endTime%>" readonly required/>
  57 + </div>
  58 + </div>
  59 +
  60 + <div class="form-group">
  61 + <label class="col-sm-2 control-label">优先级&nbsp;&nbsp;<span class="red">*</span></label>
  62 + <div class="col-sm-10">
  63 + <input type="text" id="priority" name='priority' class="form-control" value="<%data.priority%>" required/>
  64 + </div>
  65 + </div>
  66 +
  67 + <div class="form-group">
  68 + <label class="col-sm-2 control-label">状态 <span class="red">*</span></label>
  69 + <div class="col-sm-2">
  70 + <label class="radio-inline">
  71 + <input type="radio" name="status" value="1">启用</label>
  72 + <label class="radio-inline">
  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 />
  75 + </div>
  76 + </div>
  77 +
  78 + </div>
  79 + </div>
  80 + <input type="hidden" id="id" value="<%data.id%>">
  81 +
  82 + <div class="panel-footer">
  83 + <button class="btn btn-primary" id="save">保存</button>
  84 + </div>
  85 + </div>
  86 +
  87 + </form>
  88 + </div>
  89 + </div>
  90 +</div>
  91 +<%include '../../../common/views/__ui/footer'%>
  1 +<%include '../../../common/views/__ui/header'%>
  2 +<%include '../../../common/views/__partail/ListHeader'%>
  3 +<div class="contentpanel">
  4 + <div class="row">
  5 + <div class="col-md-12">
  6 +
  7 +
  8 + <div class="panel panel-default">
  9 + <div class="panel-heading">
  10 + <h4 class="panel-title">基本信息</h4>
  11 + </div>
  12 + <div class="dataTab_wrapper" id="basicTab" style="margin-bottom: 10px"></div>
  13 + <div class="panel-body" id="tab_body"></div>
  14 +
  15 + </div>
  16 +
  17 +
  18 + </div>
  19 + </div>
  20 +</div>
  21 +<script type="text/template" id="fm_baseInfo">
  22 + <%include './__fragement/base_info'%>
  23 +</script>
  24 +<script type="text/template" id="fm_reject">
  25 + <div class="dataTables_length" id="basicTable_promotion">
  26 + </div>
  27 +</script>
  28 +<%include '../../../common/views/__ui/footer'%>
  1 +
  2 +
  3 + <div class="row">
  4 +
  5 + <div class="form-group">
  6 + <label class="col-sm-2 control-label">促销名称&nbsp;&nbsp;<span class="red">*</span></label>
  7 +
  8 + <div class="col-sm-10">
  9 + <input type="text" id="title" class="form-control" value="<%data.title%>" placeholder="促销名称" required/>
  10 + </div>
  11 + </div>
  12 +
  13 + <div class="form-group">
  14 + <label class="col-sm-2 control-label">促销描述 </label>
  15 + <div class="col-sm-10">
  16 + <textarea style="width: 400px; height: 90px;" name="description" id="description"><%data.description%></textarea>
  17 + </div>
  18 + </div>
  19 +
  20 + <div class="form-group">
  21 + <label class="col-sm-2 control-label">渠道</label>
  22 + <div class="col-sm-3">
  23 + <label class="radio-inline" style="padding-left: 0">
  24 + <input type="checkbox" name="fit_channel" value="1">有货官网</label>
  25 + <label class="radio-inline">
  26 + <input type="checkbox" name="fit_channel" value="2">iphone</label>
  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="渠道" />
  30 + </div>
  31 + </div>
  32 +
  33 + <div class="form-group">
  34 + <label class="col-sm-2 control-label">起始时间&nbsp;&nbsp;<span class="red">*</span></label>
  35 + <div class="col-sm-4">
  36 + <input id="startTime" class="form-control" jsaction="time:end:endTime" type="text" placeholder="预售上架时间"
  37 + value="<%data.startTime%>" readonly required/>
  38 + </div>
  39 + </div>
  40 +
  41 + <div class="form-group">
  42 + <label class="col-sm-2 control-label">结束时间&nbsp;&nbsp;<span class="red">*</span></label>
  43 + <div class="col-sm-4">
  44 + <input id="endTime" class="form-control" jsaction="time:start:startTime" type="text" placeholder="预售下架时间"
  45 + value="<%data.endTime%>" readonly required/>
  46 + </div>
  47 + </div>
  48 +
  49 + <div class="form-group">
  50 + <label class="col-sm-2 control-label">优先级&nbsp;&nbsp;<span class="red">*</span></label>
  51 + <div class="col-sm-10">
  52 + <input type="text" id="priority" name='priority' class="form-control" value="<%data.priority%>" required/>
  53 + </div>
  54 + </div>
  55 +
  56 + <div class="form-group">
  57 + <label class="col-sm-2 control-label">状态 <span class="red">*</span></label>
  58 + <div class="col-sm-2">
  59 + <label class="radio-inline">
  60 + <input type="radio" name="status" value="1">启用</label>
  61 + <label class="radio-inline">
  62 + <input type="radio" name="status" value="0" selected="selected">不启用</label>
  63 + <input type="hidden" id="status" name="status" value="<%data.status||'0'%>" for="radio" required />
  64 + </div>
  65 + </div>
  66 +
  67 + </div>
  68 +
  69 +<input type="hidden" id="id" value="<%data.id%>">
  70 +
  71 +<div class="panel-footer">
  72 + <button class="btn btn-primary" id="save">保存</button>
  73 +</div>
  1 +'use strict';
  2 +var $ = require('jquery'),
  3 + common = require('../../../common/common');
  4 +//require('../util/custom.js');
  5 +/*
  6 + * 获取业务数据
  7 + */
  8 +window.NETSALEDATA= window.ViewModel.data;
  9 +console.log(window.NETSALEDATA);
  10 +
  11 +var ENUM = {
  12 + status: {
  13 + '0': '已下架',
  14 + '1': '已上架',
  15 + '2': '待审核',
  16 + '3': '上架驳回',
  17 + '4': '通过',
  18 + '5': '再上架待审核',
  19 + '6': '再上架驳回',
  20 + '7': '再上架通过',
  21 + '8': '待上架',
  22 + '9': '下架驳回',
  23 + '10':'下架待审核'
  24 + },
  25 + tab: {
  26 + '1': 0,
  27 + '2': 0,
  28 + '3': 0,
  29 + '4': 0,
  30 + '5': 0
  31 + },
  32 +
  33 + tabName:[
  34 + {en:"baseinfo",cn:"基本信息"},
  35 + {en:"condition",cn:"促销条件"},
  36 + {en:"operation",cn:"促销操作"},
  37 + {en:"limit",cn:"促销限制"},
  38 + {en:"reject",cn:"互斥促销"},
  39 + {en:"display",cn:"促销显示"},]
  40 +};
  41 +//tab 页组件
  42 +var t = new common.tab2({
  43 + el: "#basicTab",
  44 + active: 6,
  45 + click: function () {
  46 + var columnname = t.options.columns[t.options.active].name;
  47 +
  48 + if (columnname === ENUM.tabName[0].en) {
  49 + var html_baseinfo=$("#fm_baseInfo").html();
  50 + $("#tab_body").html(html_baseinfo);
  51 + }else if(columnname === ENUM.tabName[1].en) {
  52 +
  53 + } else if(columnname === ENUM.tabName[2].en) {
  54 +
  55 + }else if(columnname === ENUM.tabName[3].en) {
  56 +
  57 + }else if(columnname === ENUM.tabName[4].en) {
  58 + //todo 加载促销列表
  59 + grid_promotions.init("/promotionInfo/list");
  60 + }else if(columnname === ENUM.tabName[5].en) {
  61 +
  62 + }
  63 +
  64 + },
  65 + columns: [{
  66 + name: ENUM.tabName[0].en,
  67 + value: '8',
  68 + display: ENUM.tabName[0].cn
  69 + }, {
  70 + name: ENUM.tabName[1].en,
  71 + value: '1',
  72 + display: ENUM.tabName[1].cn
  73 + }, {
  74 + name: ENUM.tabName[2].en,
  75 + value: '1',
  76 + display: ENUM.tabName[2].cn
  77 + }, {
  78 + name: ENUM.tabName[3].en,
  79 + value: '1',
  80 + display: ENUM.tabName[3].cn
  81 + }, {
  82 + name: ENUM.tabName[4].en,
  83 + value: '0',
  84 + display: ENUM.tabName[4].cn
  85 + },{
  86 + name: ENUM.tabName[5].en,
  87 + value: 'all',
  88 + display: ENUM.tabName[5].cn
  89 + }]
  90 +}).init(ENUM.tab);
  91 +
  92 +//促销列表
  93 +var grid_promotions = new common.grid({
  94 + el: '#basicTable_promotion',
  95 + size: 10,
  96 + parms: function() {
  97 + return {
  98 + startTime: common.util.__input('startTime'),
  99 + endTime:common.util.__input("endTime")
  100 + };
  101 + },
  102 + columns: [{
  103 + display: "ID",
  104 + name: "id"
  105 + }, {
  106 + display: "促销名称",
  107 + name: "title"
  108 + }, {
  109 + display: '优先级',
  110 + name: "priority"
  111 + }, {
  112 + display: '开始时间',
  113 + name: "startTime",
  114 + render: function(item) {
  115 + var date = new Date(item.startTime * 1000);
  116 + return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
  117 + }
  118 + }, {
  119 + display: '结束时间',
  120 + name: "endTime",
  121 + render: function(item) {
  122 + var date = new Date(item.endTime * 1000);
  123 + return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
  124 + }
  125 + }, {
  126 + display: '是否启用',
  127 + name: "status",
  128 + render: function(item) {
  129 + if(item.status==1){
  130 + var name ="已启用" ;
  131 + }else {
  132 + var name ="未启用" ;
  133 + }
  134 + return name;
  135 + }
  136 + }, {
  137 + display: '优惠券限制使用',
  138 + name: "status",
  139 + render: function(item) {
  140 + if(item.status==1){
  141 + var name ="是" ;
  142 + }else {
  143 + var name ="否" ;
  144 + }
  145 + return name;
  146 + }
  147 + }]
  148 +})