Authored by weiqingting

Merge branch 'feature/feature_v4.6_20160525' into yohobuy_portal_dev_v4.6_20160601

... ... @@ -71,13 +71,24 @@ components.prototype={
//});
return false;
}
if ($(this).attr("match") && value) {
new Validator.init($(this)[0], {
rules: {
match: $(this).attr("match")
}
}).validate(function() {
err.push("<p>" + name + "请输入正确的格式</p>");
});
}
});
//文件上传
$("input[type=file]", that.el).each(function() {
var value = $.trim($(this).attr("value"));
if ($(this).attr("required") && !value) {
err.push("<p>请上传文件</p>");
var prompt = $.trim($(this).attr("prompt"));
if(!prompt) err.push("<p>请上传文件</p>");
else err.push("<p>请上传"+ prompt +"</p>");
return false;
}
});
... ... @@ -105,7 +116,7 @@ components.prototype={
$('input[type="file"]', that.el).each(function() {
var bucket= $(this).data("bucket")||that.option.bucket;
var bucket= $(this).data("bucket")||that.option.bucket||$(this).attr("bucket");
if(!bucket){
alert("bucket 不存在");
... ...
... ... @@ -193,7 +193,7 @@ tabTree.prototype= {
param.sortLevel = p.sortLevel;
var ajaxOptions = {
type: "POST",
url:url,
url:url+"?_datetime_="+new Date(),
data: param,
dataType: 'json',
beforeSend: function(msg) {
... ...
... ... @@ -61,7 +61,6 @@ g.init("/couponSendManager/queryList1");
/*验证*/
var edit = new common.edit2(".modal-body");
var Bll = {
contentDatas: [],
module: null,
__render: function (selecter, templater, data) {
$(selecter).html(common.util.__template2($("#" + templater).html(), data));
... ...
... ... @@ -99,6 +99,38 @@ var Bll = {
} else {
$('.sort-wrap').find('.row:first').find('.add-sort-btn').show().end().find('.del-sort-btn').hide();
}
},
setTabTree:function () {
var data={},NUMN={};
common.util.__ajax({
url:'/product/class/queryAllProductSortList',
data:{}
},function(res){
data=res.data;
},true);
NUMN={
columns: [{
state: "prov",
text: "一级分类",
hide: false,
addclass: ""
}, {
state: "city",
text: "二级分类",
hide: false,
addclass: ""
}],
datas: [{
sortName: data.sortName,
code: "",
id: data.id
}, {
sortName: data.subList,
code: "",
id: data.subList
}]
};
return NUMN;
}
};
/**
... ... @@ -164,7 +196,7 @@ $(document).on("click", "#save_brand", function () {
common.util.__ajax({
url: action,
data: couponBean
}, function (res) {
}, function () {
location.href = "/market/couponList/index";
});
}
... ... @@ -173,21 +205,24 @@ $(document).on("click", "#save_brand", function () {
/********************************************************分类相关****************************************/
var tabTreeArr = [], tabTree;
//选择分类
$(document).on('click', "#addSorts", function () {
var data = {};
var data1 = {};
common.dialog({
title: "选择分类",
width: "60%",
content: common.util.__template2($('#editTemp').html(), data),
content: common.util.__template2($('#editTemp').html(), data1),
button: [{
value: "保存",
callback: function () {
var ids = [];
if (tabTreeArr.length > 0) {
for (var i = 0; i < tabTreeArr.length; i++) {
for (var key in tabTreeArr[i].selected) {
ids.push(tabTreeArr[i].selected[key].id);
for(var j=0;j<tabTreeArr[i].selected.length;j++){
if(j<=1){
ids.push(tabTreeArr[i].selected[j].id);
}
}
}
couponBean.sortLimit = ids.join(',');
... ... @@ -199,9 +234,7 @@ $(document).on('click', "#addSorts", function () {
}]
});
tabTreeArr = [];
tabTree = new common.tabTree(".sortTree", {
sortLevel: 1
});
tabTree = new common.tabTree(".sortTree",Bll.setTabTree());
tabTree.init();
tabTreeArr.push(tabTree);
Bll.checkSortNum();
... ... @@ -211,9 +244,7 @@ $(document).on('click', "#addSorts", function () {
$(document).on('click', '.add-sort-btn', function () {
var $sortGroup = $($('#sortWrap').html());
$sortGroup.appendTo($('.sort-wrap'));
tabTree = new common.tabTree(".sortTree:last", {
sortLevel: 1
});
tabTree = new common.tabTree(".sortTree:last", Bll.setTabTree());
tabTreeArr.push(tabTree);
tabTree.init();
Bll.checkSortNum();
... ...
... ... @@ -17,7 +17,7 @@ var couponBean = {
brandLimit:"",
sortLimit:"",
customType:"",
useRange:1
useRange:0
};
module.exports = couponBean;
\ No newline at end of file
... ...
... ... @@ -72,7 +72,6 @@ var g = new common.grid({
}
}, {
display: '操作',
//}
name: "status",
render: function (items) {
var HtmArr = [];
... ... @@ -88,45 +87,90 @@ g.init('/brandCoupon/queryList');
$("#filter-btn").click(function () {
g.reload(1);
});
/**
* 监听输入框变化
*/
$(document).on("change", ".observe", function () {
var $this = $(this);
var name = $this.data("field");
Bll.module = common.util.__buildobj(name, '.', Bll.module, function (obj, name1) {
obj[name1] = $this.val();
});
Bll.module.brandName = $('#brandId').find("option[value='" + Bll.module.brandId + "']").text();
});
//添加
$(document).on('click', '#add-btn', function () {
articleCategoryOP("新增", '/brandCoupon/add', {});
/*验证*/
var edit = new common.edit2(".modal-body");
var Bll = {
module: null,
//弹框
toast: function (module, hint, url) {
Bll.module = module;
var d = new common.dialog({
title: hint + "品牌优惠券",
content: common.util.__template2($("#template").html(), Bll.module),
width: '40%',
button: [
{
value: "保存",
callback: function () {
if (edit.validate()) {
common.util.__ajax({
url: url,
data: Bll.module
}, function (res) {
if (res.code == '200') {
g.reload();
d.close();
}
else {
common.util.__tip(res.message, "warning");
}
}, true);
}
return false;
},
css: "btn-primary"
},
{
"value": "取消",
"css": "btn-info"
}
]
});
Bll.__editRender();
},
__editRender: function () {
edit.init();
new common.dropDown({
el: "#brandId",
ajax: 'brand'
});
}
};
/**
* 添加--点击事件
*/
$(document).on('click', '#add-btn', function () {
var item = {
"couponsId": "",
"brandId": "",
"brandName": "",
"status": 1
};
Bll.toast(item, "添加", '/brandCoupon/add');
});
//编辑
/**
* 编辑--点击事件
*/
$(document).on('click', '.info-modify', function () {
var item = g.rows[$(this).data("index")];
articleCategoryOP("修改", '/brandCoupon/update', item);
});
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'
});
}
\ No newline at end of file
common.util.__ajax({
url: "/brandCoupon/queryByParam",
data: {id: item.id}
}, function (res) {
Bll.toast(res.data, "修改", '/brandCoupon/update');
}, true);
});
\ No newline at end of file
... ...
... ... @@ -81,14 +81,19 @@ $(document).on("click", "#addUrl", function () {
});
$(document).on("click", "#saveBtn", function () {
if(!edit.validate()) {
return false;
}
var isNew = $("#isNew").val();
var isHot = $("#isHot").val();
var separativeSign = $("#separativeSign").val();
var isNewPage = $("#isNewPage").val();
var platform = $("#platform").val();
Category.isNew = !!isNew ? isNew : Category.isNew;
Category.isHot = !!isHot ? isHot : Category.isHot;
Category.separativeSign = !!separativeSign ? separativeSign : Category.separativeSign;
Category.isNewPage = !!isNewPage ? isNewPage : Category.isNewPage;
Category.platform = platform.replace(/\|/g, ",");
delete Category.categories;
//console.log(Category);
... ...
... ... @@ -539,7 +539,7 @@ li.sortable-placeholder {
}
.dd-handle:hover {background: #fff; }
.dd-item > button { display: block; position: relative; cursor: pointer; float: left; width: 25px; height: 20px; margin: 5px 0; padding: 0; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 0; background: transparent; font-size: 12px; line-height: 1; text-align: center; font-weight: bold; }
.dd-item > button { display: block; position: relative; cursor: pointer; float: left; width: 25px; height: 20px; margin: 16px 0; padding: 0; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 0; background: transparent; font-size: 12px; line-height: 1; text-align: center; font-weight: bold;font-size: 20px; }
.dd-item > button:before { content: '+'; display: block; position: absolute; width: 100%; text-align: center; text-indent: 0; }
.dd-item > button[data-action="collapse"]:before { content: '-'; }
... ...
... ... @@ -25,7 +25,16 @@ exports.res = [
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
]
}, {
},
{
route: '/brandCoupon/queryByParam',
method: 'POST',
url: '/brandCoupon/queryByParam',
params: [
{name: 'id', type: 'Number'}
]
},
{
// 新增
route: '/brandCoupon/add',
method: 'POST',
... ... @@ -34,7 +43,7 @@ exports.res = [
{name: 'brandName', type: 'String'},
{name: 'status', type: 'Number'},
{name: 'brandId', type: 'Number'},
{name: 'couponsId', type: 'Number'},
{name: 'couponsId', type: 'Number'}
]
}, {
// 删除
... ... @@ -42,7 +51,7 @@ exports.res = [
method: 'POST',
url: '/brandCoupon/delete',
params: [
{name: 'id', type: 'Number'},
{name: 'id', type: 'Number'}
]
},{
// 修改
... ... @@ -54,7 +63,7 @@ exports.res = [
{name: 'status', type: 'Number'},
{name: 'id', type: 'Number'},
{name: 'brandId', type: 'Number'},
{name: 'couponsId', type: 'Number'},
{name: 'couponsId', type: 'Number'}
]
}
];
\ No newline at end of file
... ...
... ... @@ -2,11 +2,11 @@
* Created by ty on 2016/5/26.
* 分类管理路由
*/
exports.domain = require('../config/common.js').domain;
//exports.domain = require('../config/common.js').domain;
//exports.domain = 'http://172.16.6.115:8080/platform';//王伟
//exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境
//exports.domain = 'http://172.16.6.231:8080/platform';
//exports.domain = 'http://172.16.6.225:8080/platform';
exports.domain = 'http://172.16.6.225:8080/platform';
//exports.domain = 'http://192.168.102.216:8086/platform';
exports.res = [
... ...
... ... @@ -188,8 +188,8 @@
<label class="col-sm-1 control-label">面额</label>
<div class="col-sm-4">
<input type="text" id="couponAmount" class="form-control observe number" data-field="couponAmount"
value="[[couponAmount]]" >
<input type="text" match="numbers" class="form-control observe " data-field="couponAmount"
value="[[couponAmount]]" required placeholder="面额">
</div>
<label class="col-sm-1 control-label"></label>
</div>
... ... @@ -201,14 +201,13 @@
<div class="col-sm-4">
<div class="col-sm-10">
<select id="useRange" class="form-control input-form" value="[[useRange]]">
<option value="1" >品牌</option>
<option value="0">分类</option>
<option value="1" >品牌</option>
</select>&emsp;&emsp;
[[if useRange==0]]
<a class="btn btn-primary btn-xs" href="javascript:;" id="addSorts">添加分类</a>
[[/if]]
[[if useRange==1]]
<a class="btn btn-primary btn-xs" href="javascript:;" id="addBrands">添加品牌</a>
[[else]]
<a class="btn btn-primary btn-xs" href="javascript:;" id="addSorts">添加分类</a>
[[/if]]
</div>
</div>
... ...
... ... @@ -71,29 +71,29 @@
<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>
<label 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">
<input type="text" match="numbers" value="[[couponsId]]" class="form-control observe" placeholder="优惠券ID" required="required" data-field="couponsId">
</div>
</div>
<div class="form-group" id="maxsord">
<label for="brandId" class="col-sm-2 control-label">品牌<span style="color: red;"> *</span>:</label>
<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">
<input type="hidden" name="" value="[[id]]" id="id" class="form-control observe" data-field="brandId">
<select id="brandId" value="[[brandId]]" class="form-control observe" data-field="brandId">
<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>
<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" checked>失效</label>
<label><input type="radio" value="2" name="status" kl_vkbd_parsed="true">有效</label>
<label><input type="radio" value="1" class=" observe" name="status" kl_vkbd_parsed="true" data-field="status" checked>失效</label>
<label><input type="radio" value="2" class=" observe" name="status" kl_vkbd_parsed="true" data-field="status">有效</label>
</div>
<input id="status" type="hidden" required="required" value="[[status||'1']]" for="radio" kl_vkbd_parsed="true">
<input id="status" type="hidden" required="required" class="form-control observe" value="[[status||'1']]" for="radio" kl_vkbd_parsed="true" data-field="status">
</div>
... ...
... ... @@ -75,7 +75,7 @@
<div class="form-group">
<label class="col-sm-1 control-label">分类图标</label>
<div class="col-sm-9">
<input type="file" name="file" prompt="分类图标" value="[[sortIco]]" class="observe" data-field="sortIco">
<input type="file" name="file" prompt="分类图标" value="[[sortIco]]" class="observe" data-field="sortIco" required>
</div>
</div>
... ... @@ -136,15 +136,15 @@
<div class="form-group">
<label class="col-sm-1 control-label">显示平台</label>
<div class="col-sm-8">
<input type="checkbox" value="iphone" style="width:18px;height:18px;margin-left:5px;" name="platform" id="checkboxiphone"> IOS手机
<input type="checkbox" value="ipad" style="width:18px;height:18px;margin-left:5px;" name="platform" id="checkboxipad"> IOS Pad
<input type="checkbox" value="android" style="width:18px;height:18px;margin-left:5px;" name="platform" id="checkboxandroid"> 安卓手机
<input type="checkbox" value="androidpad" style="width:18px;height:18px;margin-left:5px;" name="platform" id="checkboxandroidpad"> 安卓Pad
<input type="checkbox" value="h5" style="width:18px;height:18px;margin-left:5px;" name="platform" id="checkboxh5"> 手机网站
<input type="checkbox" value="web" style="width:18px;height:18px;margin-left:5px;" name="platform" id="checkboxweb"> 网站
<input type="checkbox" value="platform" style="width:18px;height:18px;margin-left:5px;" name="platform" id="checkboxplatform"> 平台
</div>
<input type="hidden" id="platform" for="radio" value="[[platform]]">
<input type="checkbox" value="iphone" style="width:18px;height:18px;margin-left:5px;" name="platform"> IOS手机
<input type="checkbox" value="ipad" style="width:18px;height:18px;margin-left:5px;" name="platform"> IOS Pad
<input type="checkbox" value="android" style="width:18px;height:18px;margin-left:5px;" name="platform"> 安卓手机
<input type="checkbox" value="androidpad" style="width:18px;height:18px;margin-left:5px;" name="platform"> 安卓Pad
<input type="checkbox" value="h5" style="width:18px;height:18px;margin-left:5px;" name="platform"> 手机网站
<input type="checkbox" value="web" style="width:18px;height:18px;margin-left:5px;" name="platform"> 网站
<input type="checkbox" value="platform" style="width:18px;height:18px;margin-left:5px;" name="platform"> 平台
</div>
<input type="hidden" id="platform" for="checkbox" value="[[platform]]">
</div><!-- form-group -->
<div class="form-group">
<label class="col-sm-1 control-label">排序</label>
... ...