Authored by 姜敏

Merge branch 'feature/feature_v4.6_20160525' of http://git.dev.yoho.cn/platform/…

…yohobuy-portal-fe into feature/feature_v4.6_20160525
/**
* Created by Arthur on 16/5/26.
* 品牌发券管理
*/
var $ = require('jquery');
common = require('../common/common');
var ENUM = {
StatusEnum: {
1:'失效',
2:'有效',
}
};
//下拉框
new common.dropDown({
el: "#sel-status"
});
new common.dropDown({
el: "#sel-brandName",
ajax: 'brand',
});
var g = new common.grid({
el: '#basicTable',
size: 10,
parms: function () {
return {
brandId: common.util.__input('sel-brandName'),
status: common.util.__input('sel-status'),
couponsId: common.util.__input('sel-couponsId')
};
},
columns: [
{
display: '品牌名称',
name: "brandName"
},
{
display: '优惠券ID',
name: "couponsId"
}, {
display: '状态',
render: function (item) {
return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
}
}, {
display: "创建时间",
render: function (item) {
if (item.createTime && item.createTime !== 0) {
var t = new Date(item.createTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm");
return "<p>" + formatted + "</p>";
}
else {
return "";
}
}
},{
display: "修改时间",
render: function (item) {
if (item.updateTime && item.updateTime !== 0) {
var t = new Date(item.updateTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm");
return "<p>" + formatted + "</p>";
}
else {
return "";
}
}
}, {
display: '操作',
//}
name: "status",
render: function (items) {
var HtmArr = [];
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>');
//HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
return HtmArr.join('');
}
}]
});
g.init('/brandCoupon/queryList');
//==================== 按钮点击事件 =====================//
$("#filter-btn").click(function() {
g.reload(1);
});
//添加
$(document).on('click', '#add-btn', function() {
articleCategoryOP("新增", '/brandCoupon/add', {});
});
//编辑
$(document).on('click', '.info-modify', function() {
var item = g.rows[$(this).data("index")];
articleCategoryOP("修改", '/brandCoupon/update', item);
});
////删除
//$(document).on('click', '.info-del', function() {
// var item = g.rows[$(this).data("index")];
//
// common.dialog.confirm("温馨提示","确定要删除该标签?" , function() {
// common.util.__ajax({
// url: '/guang/tags/delTag',
// data: {
// id: item.id,
// }
// }, function(res) {
// if (res.code == 200) {
// g.reload();
// }
// });
// });
//});
function articleCategoryOP(prefix, url, item) {
var a =new common.edit(".confirm");
common.dialog.confirm(prefix+'标签', common.util.__template2($("#template").html(), item), function () {
//
return a.submit(url,function(option){
var _brandName = $('#brandId').find("option[value='"+option.data.brandId+"']").text();
option.data.brandName = _brandName;
option.success=function(res){
res=res.data;
if(res.code=="200"){
a.$tip("提交成功", function() {
g.reload();
}, 'growl-success');
}else{
a.$tip(res.message);
}
return false;
},
option.error=function(res){
a.$tip(res.message);
}
});
});
a.init();
new common.dropDown({
el: "#brandId",
ajax: 'brand'
//el: "#classifyId",
//ajax: 'guangGetTagCategoryByStatus',
});
}
\ No newline at end of file
... ...
... ... @@ -22,9 +22,9 @@ var config = {
// domain: 'http://172.16.6.146:8088/platform', //玛丽
//domain:'http://172.16.6.157:8080/yohobuy-platform-web',//葛超
// domain: 'http://192.168.102.216:8086/platform',
domain: 'http://192.168.102.202:8088/platform',
//domain: 'http://192.168.102.202:8088/platform',
//domain: 'http://172.16.6.146:8088/platform',
//domain:'http://172.16.6.120:8088/platform',//曹艳
domain:'http://172.16.6.120:8080/platform',//曹艳
//domain:'http://172.16.6.231:8080/platform',//王伟
//domain: 'http://172.16.6.239:8080', //孙杰翔
//domain:'http://172.16.6.189:8088/platform', //李健1
... ...
/**
* Created by Arthur on 16/5/26.
*/
exports.domain = require('../config/common.js').domain;
exports.res = [
{// 品牌发券空白页
route: '/brandCoupons/index',
method: 'GET',
view: 'pages/operations/brandCoupon',
src: '/operations/brandCoupon',
data: {
iscreate: true
}
}, {
// 列表数据
route: '/brandCoupon/queryList',
method: 'POST',
url: '/brandCoupon/queryList',
params: [
{name: 'brandId', type: 'String'},
{name: 'status', type: 'Number'},
{name: 'couponsId', type: 'Number'},
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
]
}, {
// 新增
route: '/brandCoupon/add',
method: 'POST',
url: '/brandCoupon/add',
params: [
{name: 'brandName', type: 'String'},
{name: 'status', type: 'Number'},
{name: 'brandId', type: 'Number'},
{name: 'couponsId', type: 'Number'},
]
}, {
// 删除
route: '/brandCoupon/delete',
method: 'POST',
url: '/brandCoupon/delete',
params: [
{name: 'id', type: 'Number'},
]
},{
// 修改
route: '/brandCoupon/update',
method: 'POST',
url: '/brandCoupon/update',
params: [
{name: 'brandName', type: 'String'},
{name: 'status', type: 'Number'},
{name: 'id', type: 'Number'},
{name: 'brandId', type: 'Number'},
{name: 'couponsId', type: 'Number'},
]
}
];
\ No newline at end of file
... ...
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">运营管理</a></li>
<li>品牌发券管理</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>品牌发券列表</h4>
</div>
</div>
</div>
</div>
</div>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<a id="add-btn" href="javascript:;" class="btn btn-info">添加优惠券</a>
</div>
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select id="sel-brandName" class="form-control" >
<option value="-1">选择品牌名称</option>
</select>
</div>
<!--<div class="panel-col">-->
<!--<select id="sel-status" class="form-control" >-->
<!--<option value="-1">选择状态</option>-->
<!--</select>-->
<!--</div>-->
<div class="panel-col">
<select id="sel-status" class="form-control">
<option value="-1">选择状态</option>
<option value="1">失效</option>
<option value="2">有效</option>
</select>
</div>
<div class="panel-col">
<input type="number" id="sel-couponsId" class="form-control" placeholder="输入优惠券ID" style="height: 39px;"/>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
</div>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div id="basicTable_wrapper" class="dataTables_wrapper no-footer">
<div class="dataTables_length" id="basicTable">
</div>
<nav>
<ul id="pagination" class="pagination pagination-lg"></ul>
</nav>
</div>
</div>
</div>
<script type="text/template" id="template">
<div class="form-group">
<label for="couponsId" class="col-sm-2 control-label">优惠券ID<span style="color: red;"> *</span>:</label>
<div class="col-sm-10">
<input type="number" value="[[couponsId]]" name="content" id="couponsId" placeholder="优惠券ID" required="required" class="form-control">
</div>
</div>
<!--<div class="form-group" id="maxsord">-->
<!--<label for="brandId" class="col-sm-2 control-label">品牌<span style="color: red;"> *</span>:</label>-->
<!--<div class="col-sm-10">-->
<!--<input type="hidden" name="" value="[[id]]" id="id" required="required" class="form-control" pattern="" title="">-->
<!--<select id="brandId" value="[[brandId]]" required="required" class="form-control">-->
<!--&lt;!&ndash;<option value="-1">请选择分类</option>&ndash;&gt;-->
<!--<option value="[[brandId||-1]]">[[brandName||"请选择品牌"]]</option>-->
<!--</select>-->
<!--</div>-->
<!--</div>-->
<div class="form-group" id="maxsord">
<label for="brandId" class="col-sm-2 control-label">品牌<span style="color: red;"> *</span>:</label>
<div class="col-sm-10">
<input type="hidden" name="" value="[[id]]" id="id" class="form-control" pattern="" title="">
<select id="brandId" value="[[brandId]]" required="required" class="form-control">
<!--<option value="-1">请选择分类</option>-->
<option value="[[brandId||-1]]">[[brandName||"请选择品牌"]]</option>
</select>
</div>
</div>
<div class="form-group">
<label for="status" class="col-sm-2 control-label">是否热门<span style="color: red;"> *</span>:</label>
<div class="radio">
<label><input type="radio" value="1" name="status" kl_vkbd_parsed="true">失效</label>
<label><input type="radio" value="2" name="status" kl_vkbd_parsed="true">有效</label>
</div>
<input id="status" type="hidden" required="required" value="[[status]]" for="radio" kl_vkbd_parsed="true">
</div>
</script>
\ No newline at end of file
... ...