提交 aece1cdf authored 作者: 吴德鹏's avatar 吴德鹏

优化落地页商品排序

上级 34c648fa
......@@ -160,6 +160,10 @@ public class AdvertisementItemController {
int res = advertisementItemService.updateAdvertisementItem(map);
if (res > 0) {
return R.ok();
} else if (res == -1) {
return R.error("参数不能为空");
} else if (res == -2) {
return R.error("序号不能跟原来相同");
}
return R.error("操作失败");
}
......
......@@ -124,20 +124,23 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
String sort = map.get("sort").toString();
Integer itemSort = Integer.parseInt(sort);
if (itemId == null || itemId == "") {
return res;
return -1;
}
if (adId == null || adId == "") {
return res;
return -1;
}
if (sort == null || sort == "") {
return res;
return -1;
}
AdvertisementItemEntity byId = advertisementItemDao.getAdItemById(itemId, adId);
if (byId == null) {
return res;
}
//情况1
String firstSort = String.valueOf(byId.getSort());
if (sort.equals(firstSort)) {
return res;
return -2;
}
//情况2
int count = advertisementItemDao.existItemSort(adId, itemSort);
......
......@@ -133,10 +133,56 @@ let vm = new Vue({
}
},
methods: {
add: function () {
vm.tempId = this.guid();
vm.showList = false;
vm.title = "新增";
vm.advertisement = {};
console.log('add-->tempId', vm.tempId)
$("#adItemjqGrid").jqGrid("clearGridData");
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + vm.tempId,
colModel: [
{label: 'itemId', name: 'itemId', key: true, index: 'item_id', hidden: true},
{label: '序号', name: 'itemSort', index: 'itemSort', width: 100},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 100, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
/* {label: '商品标题', name: 'itemBrief', index: 'item_brief', width: 120},*/
/*{label: '商品链接', name: 'itemUrl', index: 'item_url', width: 80,formatter:linkFormat},*/
{label: '商品原价', name: 'itemPrice', index: 'item_price', width: 100},
{label: '商品现价', name: 'discountPrice', index: 'discount_price', width: 100},
/*{label: '所属平台', name: 'platformCode', index: 'platform_code', width: 80},
{label: '平台名', name: 'platformName', index: 'platform_name', width: 80},*/
{label: '供应商', name: 'supplier', index: 'supplier', width: 120},
{label: '商品一级分类', name: 'goodtype', index: 'goodtype', width: 120},
{label: '商品二级分类', name: 'title', index: 'title', width: 120},
{label: '商品品名', name: 'dname', index: 'itemDescritionId', width: 120},
{
label: '操作', index: 'operate', width: 160, formatter: function (value, grid, rows) {
return '<span class="label label-info pointer" onclick="vm.delItem(\'' + rows.itemId + '\')">移除</span>&nbsp;&nbsp;' +
'<span class="label label-info pointer" onclick="vm.sortItem(\'' + rows.itemId + '\')">排序</span>&nbsp;&nbsp;'
}
} // beforeSelectRow: beforeSelectRow,
],
multiboxonly: true
// beforeSelectRow: beforeSelectRow,
});
},
sortItem(e) {
let id = getSelectedRow("#jqGrid");
let id = $("#jqGrid").getGridParam("selrow");
if (id == '' || id == null) {
id = vm.tempId;
}
vm.modal1 = true;
vm.itemId = e;
console.log('vm.tempId', vm.tempId)
console.log('sortItem-->adId', id)
console.log('sortItem-->itemId', e)
Ajax.request({
url: "../advertisementitem/getAdSort?itemId=" + e + '&adId=' + id,
type: "POST",
......@@ -147,12 +193,14 @@ let vm = new Vue({
});
},
deal() {
let id = getSelectedRow("#jqGrid");
let id = $("#jqGrid").getGridParam("selrow");
if (id == '' || id == null) {
id = vm.tempId;
}
console.log('deal-->adId', id)
console.log('deal-->itemId', vm.itemId)
let itemSort;
console.log('商品ID', vm.itemId)
console.log('广告ID', id)
itemSort = parseInt(vm.sort);
console.log('序号', itemSort)
Ajax.request({
url: "../advertisementitem/updateAdvertisementItem?itemId=" + vm.itemId + '&adId=' + id + '&sort=' + vm.sort,
type: "POST",
......@@ -196,8 +244,6 @@ let vm = new Vue({
if (id == null || id == '' || id == 'undefined') {
id = vm.tempId;
}
console.log('vm.advertisement.id', vm.advertisement.id)
console.log('vm.tempId', vm.tempId)
Ajax.request({
url: "../advertisementitem/saveBatch?aId=" + id + '&itemIds=' + ids,
type: "POST",
......@@ -248,40 +294,7 @@ let vm = new Vue({
return v.toString(32);
});
},
add: function () {
vm.tempId = this.guid();
vm.showList = false;
vm.title = "新增";
vm.advertisement = {};
$("#adItemjqGrid").jqGrid("clearGridData");
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + vm.tempId,
colModel: [
{label: 'itemId', name: 'itemId', key: true, index: 'item_id', hidden: true},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 100, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
/* {label: '商品标题', name: 'itemBrief', index: 'item_brief', width: 120},*/
/*{label: '商品链接', name: 'itemUrl', index: 'item_url', width: 80,formatter:linkFormat},*/
{label: '商品原价', name: 'itemPrice', index: 'item_price', width: 100},
{label: '商品现价', name: 'discountPrice', index: 'discount_price', width: 100},
/*{label: '所属平台', name: 'platformCode', index: 'platform_code', width: 80},
{label: '平台名', name: 'platformName', index: 'platform_name', width: 80},*/
{label: '供应商', name: 'supplier', index: 'supplier', width: 120},
{label: '商品一级分类', name: 'goodtype', index: 'goodtype', width: 120},
{label: '商品二级分类', name: 'title', index: 'title', width: 120},
{label: '商品品名', name: 'dname', index: 'itemDescritionId', width: 120},
{
label: '操作', index: 'operate', width: 120, formatter: function (value, grid, rows) {
return '<span class="label label-info pointer" onclick="vm.delItem(\'' + rows.itemId + '\')">移除</span>&nbsp;&nbsp;'
}
}
],
// beforeSelectRow: beforeSelectRow,
});
},
update: function (event) {
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").jqGrid("clearGridData");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论