Authored by 陶雨

1、资源位预发布删除现在不能删除进行中和发布时间为0的tab页了

2、时间修改不能修改发布时间为0的页面了
3、限购码详情显示sku
4、限购码编辑添加流程走通
... ... @@ -67,7 +67,7 @@ components.prototype={
//}).validate(function(obj) {
err.push("<p>" + name + "不可为空</p>");
//});
//return false;
return false;
}
});
... ...
... ... @@ -14,30 +14,35 @@ var Bll = {
$('input[name="skn_sku"]').prop('disabled', true);
$(".noEdit").prop("disabled", true);
$('input[name="userTypeLimit"]').prop('disabled', true);
if(Bll.getLocalTime(editBean.limitDateFrom) <= Bll.getLocalTime(new Date())) {
if(editBean.limitDateFrom <= new Date()) {
$("#limitDateFrom").prop("disabled", true);
}
}
},
__checkSkn:function(callback) {
var flag = false;
common.util.__ajax({
async:false,
url: "/limitCode/checkSknValidity",
data: {skn:editBean.limitSkn}
},function(res) {
if(!res.data.isExist) {
flag = true;
common.util.__tip("SKN不存在");
} else if(res.data.isConflict) {
flag = true;
common.util.__tip("SKN与其他限购冲突");
} else if(res.data.isOnSales) {
flag = true;
common.util.__tip("SKN已上架,请先下架");
}
callback && callback(res);
}, true);
if(editBean.limitSkn) {
common.util.__ajax({
async: false,
url: "/limitCode/checkSknValidity",
data: {
skn: editBean.limitSkn,
id: editBean.id
}
}, function (res) {
if (!res.data.isExist) {
flag = true;
common.util.__tip("SKN不存在");
} else if (res.data.isConflict) {
flag = true;
common.util.__tip("SKN与其他限购冲突");
} else if (res.data.isOnSales) {
flag = true;
common.util.__tip("SKN已上架,请先下架");
}
callback && callback(res);
}, true);
}
return flag;
},
getLocalTime:function(nS) {
... ... @@ -101,14 +106,14 @@ $(".number").on("keyup", function() {
//单选框点击事件
$(document).on("click", ".limitProduct", function() {
editBean.selected = $(this).val();
editBean.limitCodeType = $(this).val();
Bll.__render();
//console.log(editBean);
});
$(document).on("click", ".delSku", function () {
var index = $(this).data("index");
editBean.skusInfos.splice(index, 1);
editBean.skusInfo.splice(index, 1);
Bll.__render();
});
$(document).on("click", ".addSku", function () {
... ... @@ -139,17 +144,17 @@ $(document).on("blur", ".skus", function() {
});
$(document).on("click","#save_brand", function() {
// 限购码状态0:待审核 1:审核通过 2:驳回 3:过期 4:作废
if(e.validate() && type == "add" ? (!editBean.limitSkn || !Bll.__checkSkn()) : true) {
if(e.validate() && (type == "add" ? (!editBean.limitSkn || !Bll.__checkSkn()) : true)) {
editBean.reqDepartment = editBean.reqDepartment.join("/");
editBean.creatorId = $("#auth_id").val();
editBean.creatorName = $("#auth_name").val();
if (editBean.status != 1) {
editBean.status = 0;
}
if(editBean.selected != "SKN") {
if(editBean.limitCodeType != "N") {
editBean.skus = "";
editBean.skuTimes = "";
for(var item in editBean.skuInfo) {
for(var item in editBean.skusInfo) {
if(item != 0) {
editBean.skus+=";";
editBean.skuTimes+=";";
... ...
... ... @@ -42,9 +42,8 @@ var g = new common.grid({
}},
{display:"基本信息",render:function(item){
var arr=[];
var limitTimes = item.skus?item.skuTimes:item.limitTimes;
arr.push("<p>名称:"+item.name+"</p>");
arr.push("<p>数量:"+limitTimes+"</p>");
arr.push("<p>数量:"+item.limitTimes+"</p>");
arr.push("<p>次数:"+item.userUseLimit+"</p>");
arr.push("<p>部门:"+item.reqDepartment+"</p>");
return arr.join('');
... ...
... ... @@ -23,7 +23,7 @@ var limitcode_bean = {
id:"",
"createTime": "",
"skn": "",
selected:"SKN",
limitCodeType:"N",
"skusInfo": []
};
... ...
... ... @@ -185,9 +185,14 @@ var Bll = {
}
};
var statusArr = ["已过期", "进行中", "未发布"];
for(var i = 0; i < resources.length; i++) {
times[i] = Bll.getLocalTime(resources[i].resource.publishTime);
//status 0:已过期;1:进行中;2:未发布
var time = resources[i].resource.publishTime==0?"":Bll.getLocalTime(resources[i].resource.publishTime);
times[i] = {
time:time,
status:statusArr[resources[i].status]
}
}
/*第一步,基础模板*/
... ... @@ -269,7 +274,7 @@ $(document).on("click", ".del", function () {//删除
/*编辑*/
$(document).on("click", ".edit", function () {
var index = $(this).data("index");
var item = Bll.contentDatas[index];
var item = Bll.contentDatas[currIndex][index];
Bll.module = $.extend(true, {}, item);
Bll.toast(index, Bll.module);
});
... ... @@ -391,19 +396,27 @@ $(document).on("click", "#copyTab", function() {
url: "/resources/copyResContent",
data: {rId:resources[currIndex].resource.id}
}, function (res) {
window.location.href = window.location.href;
setTimeout(function() {
window.location.href = window.location.href;
}, 2000);
});
});
//保存时间
$(document).on("click", "#saveTime", function() {
if(!times[currIndex].time) {
common.util.__tip("该页面不能保存时间");
return;
}
common.util.__ajax({
url: "/resources/updateResPublishTime",
data: {
id:resources[currIndex].resource.id,
time:times[currIndex]
time:times[currIndex].time
}
}, function (res) {
window.location.href = window.location.href;
setTimeout(function() {
window.location.href = window.location.href;
}, 2000);
});
});
new common.edit2("#times-list").init();
... ... @@ -411,26 +424,37 @@ new common.edit2("#times-list").init();
$(document).on("click", ".timesLi", function() {
if(!$(this).hasClass("active")) {
$(this).addClass("active").siblings().removeClass("active");
var index = $(this).data("index");
currIndex = index;
currIndex = $(this).data("index");
Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas[currIndex]});
Bll.__render("#times-list", "times-template", {times: times, selected: index});
Bll.__render("#times-list", "times-template", {times: times, selected: currIndex});
new common.edit2("#times-list").init();
}
});
$(document).on("change", ".preTimes", function() {
times[$(this).data("index")] = $(this).val();
console.log(times);
times[$(this).data("index")].time = $(this).val();
});
//删除tab
$(document).on("click", "#delTab", function() {
common.util.__ajax({
url: "/resources/deleteResourceById",
data: {
id:resources[currIndex].resource.id
}
}, function (res) {
window.location.href = window.location.href;
if(times[currIndex].status == "进行中") {
common.util.__tip("进行中的页面不能删除");
return false;
}
if(!times[currIndex].time) {
common.util.__tip("该页面不能删除");
return false;
}
common.dialog.confirm("警告", "确定取消" + times[currIndex].time + "发布的页面吗?",function() {
common.util.__ajax({
url: "/resources/deleteResourceById",
data: {
id: resources[currIndex].resource.id
}
}, function (res) {
setTimeout(function() {
window.location.href = window.location.href;
}, 2000);
});
});
});
... ... @@ -655,21 +679,4 @@ $(document).on("mouseover", "#add-content .dragItem", function () {
});
$(document).on("mouseleave", "#add-content .dragItem", function () {
new common.drag("#add-content").destroy();
});
/*
$(document).on("mouseover","#sortable .dragItem",function(){
//console.log(Bll.module.contentData.data.list);
var drag = new common.drag("#sortable", Bll.module.contentData.data.list, function(data){
Bll.module.contentData.data.list = data;
console.log(Bll.module.contentData);
console.log(Bll.module);
Bll.renderDialog("paramsGroup-template");
//Bll.__render("#sortable","paramsGroup-template",{modules:Bll.module});
})
drag.Initialize();
});
$(document).on("mouseleave","#sortable .dragItem",function(){
new common.drag("#sortable").destroy();
});
*/
});
\ No newline at end of file
... ...
... ... @@ -129,14 +129,10 @@ $(document).on("click", ".delbtn", function() {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("警告", "是否确认删除?",function() {
common.util.__ajax({
url: "/resources/deleteResourceById",
data: {id: item.id}
url: "/resources/deleteAllResourceByCode",
data: {code: item.code}
}, function () {
g.reload();
});
});
});
$(document).on("click", ".contentManage", function() {
var item = g.rows[$(this).data("index")];
});
\ No newline at end of file
... ...
... ... @@ -464,16 +464,26 @@ li.sortable-placeholder {
#resourcePre li{
height: 40px;
line-height: 40px;
height: 62px;
width: 150px;
border-bottom: 1px solid #000000;
border-bottom: 2px solid #0b97c4;
float: left;
padding: 0;
margin: 0;
text-align:center;
}
#resourcePre li.active{
border: 1px solid #000000;
border-bottom: 0
border: 2px solid #0b97c4;
border-bottom: 0;
font-weight: bold;
}
#resourcePre li input{
border: 1px;
height: 30px;
line-height: 30px;
background: none;
margin: 5px 0;
}
\ No newline at end of file
... ...
... ... @@ -3,8 +3,9 @@
*/
//接口主域
exports.domain = require('../config/common.js').domain;
//exports.domain = require('../config/common.js').domain;
//exports.domain ="http://172.16.6.246:8081/platform/";
exports.domain = 'http://172.16.6.108:8088/platform';//谭玲
//路由配置
exports.res = [
{
... ...
... ... @@ -287,6 +287,12 @@ exports.res = [
}, {
name: 'reqDepartment',
type: 'String'
}, {
name: 'sku',
type: 'String'
}, {
name: 'skn',
type: 'String'
}]
}, {
//限购码管理 -> 添加限购码页面渲染
... ... @@ -352,6 +358,9 @@ exports.res = [
}, {
name: "skuTimes",
type: "string"
}, {
name: "limitCodeType",
type: "string"
}]
},{
//检查SKN的合法性并且获得其下的所有SKU
... ... @@ -359,7 +368,8 @@ exports.res = [
method: 'POST',
url: '/limitCode/checkSknValidity',
params:[
{name: "skn", type: "string"}
{name: "skn", type: "string"},
{name: "id", type: "string"}
]
}, {
//限购码管理 -> 查看限购码页面渲染
... ... @@ -461,7 +471,13 @@ exports.res = [
name: "batchNo",
type: "Number"
}, {
name: "updateType",
name: "limitCodeType",
type: "string"
}, {
name: "skuTimes",
type: "string"
}, {
name: "skus",
type: "string"
}]
}, {
... ...
... ... @@ -51,7 +51,7 @@ exports.res = [
{name: "matchCode", type: "string"}
]
},
{//删除资源位
{//根据id删除资源位
route: "/resources/deleteResourceById",
method: "POST",
url: "/resources/deleteResourceById",
... ... @@ -59,6 +59,14 @@ exports.res = [
{name: "id", type: "number"}
]
},
{//删除资源位下所有tab
route: "/resources/deleteAllResourceByCode",
method: "POST",
url: "/resources/deleteAllResourceByCode",
params: [
{name: "code", type: "string"}
]
},
{
//资源内容页面
route: '/resource/content/index/:param',
... ...
... ... @@ -25,7 +25,7 @@
<div class="form-group">
<label class="col-sm-2 control-label">数量<i class="red">*</i></label>
<div class="col-sm-8">
<input type="text" placeholder="数量" class="form-control observe noEdit number" data-field="limitTimes" [[selected=="SKU"?"":"required"]] pattern="^[0-9]+$" value="[[limitTimes]]">
<input type="text" placeholder="数量" class="form-control observe noEdit number" data-field="limitTimes" required pattern="^[0-9]+$" value="[[limitTimes]]">
</div>
</div>
... ... @@ -118,20 +118,20 @@
<label class="col-sm-2 control-label">指定商品<i class="red">*</i></label>
<div class="col-sm-4">
<div class="col-sm-10">
<input type="radio" class="limitProduct" value="SKN" name="skn_sku" checked />SKN
<input type="radio" class="limitProduct" value="SKU" name="skn_sku" />SKU
<input type="hidden" id="skn_sku" for="radio" value="[[selected]]"/><br>
<input type="radio" class="limitProduct" value="N" name="skn_sku" checked />SKN
<input type="radio" class="limitProduct" value="U" name="skn_sku" />SKU
<input type="hidden" id="skn_sku" for="radio" value="[[limitCodeType]]"/><br>
</div>
<label class="col-sm-3 control-label">SKN值:</label>
<div class="col-sm-4">
<input id="limitSkn" type="text" maxlength="8" placeholder="SKN" class="form-control observe number noEdit" data-field="limitSkn" value="[[limitSkn]]" required>
</div><br>
<div id="skus" class="col-sm-10" [[selected=="SKU"?"":"hidden"]]>
<div id="skus" class="col-sm-10" [[limitCodeType=="U"?"":"hidden"]]>
<table class="table table-bordered responsive dataTable no-footer">
[[each skusInfo as item index]]
<tr>
<td><input type="text" class="form-control observe skus number noEdit" placeholder="sku值" data-field="skusInfo.[[index]].sku" value="[[item.sku]]" [[selected=="SKN"?"":"required"]]></td>
<td><input type="text" class="form-control observe number noEdit" prompt="sku数量" placeholder="数量" data-field="skusInfo.[[index]].skuTimes" value="[[item.skuTimes]]" [[selected=="SKN"?"":"required"]]></td>
<td><input type="text" class="form-control observe skus number noEdit" placeholder="sku值" data-field="skusInfo.[[index]].sku" value="[[item.sku]]" [[limitCodeType=="N"?"":"required"]]></td>
<td><input type="text" class="form-control observe number noEdit" prompt="sku数量" placeholder="数量" data-field="skusInfo.[[index]].skuTimes" value="[[item.skuTimes]]" [[limitCodeType=="N"?"":"required"]]></td>
<td><a href="javascript:;" class="btn btn-danger btn-xs delSku noEdit" data-index="[[index]]">删除</a></td>
</tr>
[[/each]]
... ...
... ... @@ -44,6 +44,10 @@
</div>
<div class="row show-grid">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">sku :</div>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">{{skus}}</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">sku数量 :</div>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">{{skuTimes}}</div>
</div>
<div class="row show-grid">
... ...
... ... @@ -42,7 +42,8 @@
<ul class="nav" style="padding: 0; margin: 0">
[[each times as item index]]
<li class="[[index==selected?'active':'']] timesLi" data-index="[[index]]">
<input type="text" [[index==selected?"":"disabled"]] class="form-control preTimes" data-index="[[index]]" jsaction="time:start:dateFrom[[index-1<0?index:index-1]];time:end:dateFrom[[index+1]]" id="dateFrom[[index]]" placeholder="时间" value="[[item]]" readonly required>
<input type="text" [[item.time=="1970-01-01 08:00:00" ? "disabled" : (index==selected?"":"disabled")]] class="form-control preTimes" data-index="[[index]]" jsaction="time:start:dateFrom[[index-1<0?index:index-1]]" id="dateFrom[[index]]" prompt="时间" value="[[item.time]]" readonly required>
<span style="display: block; line-height: 20px">[[item.status||"默认"]]</span>
</li>
[[/each]]
</ul>
... ...