提交 e9f3383b authored 作者: 陆's avatar

复制广告投放

上级 95d82be3
......@@ -118,6 +118,7 @@
#if($shiro.hasPermission("advertisement:delete"))
<i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
#end
<i-button type="info" @click="copy"><i class="fa fa-plus"></i>&nbsp;复制</i-button>
</div>
</Row>
<table id="jqGrid"></table>
......
......@@ -130,9 +130,11 @@ let vm = new Vue({
},
q: {
name: ''
}
},
iscopy:0,//是否为复制
},
methods: {
//新增广告
add: function () {
vm.tempId = this.guid();
vm.showList = false;
......@@ -297,7 +299,7 @@ let vm = new Vue({
return v.toString(32);
});
},
//修改广告
update: function (event) {
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").jqGrid("clearGridData");
......@@ -330,6 +332,53 @@ let vm = new Vue({
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
});
});
vm.btn_Search(id);
vm.getInfo(id);
},
//复制广告
copy: function (event) {
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").jqGrid("clearGridData");
let id = getSelectedRow("#jqGrid");
if (id == null) {
return;
}
vm.tempId = this.guid();
vm.iscopy = 1
vm.showList = false;
vm.title = "复制";
$(function () {
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + id,
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;'
}
......@@ -384,18 +433,33 @@ let vm = new Vue({
alert("结束时间不能比开始时间早")
return;
}
let url = vm.advertisement.id == null ? "../advertisement/save" : "../advertisement/update";
// let url = vm.advertisement.id == null ? "../advertisement/save" : "../advertisement/update";
var url;
if (vm.iscopy == 1){
url = "../advertisement/save"
}else if (vm.advertisement.id == null && vm.iscopy == 0){
url = "../advertisement/save"
}else if (vm.advertisement.id != null && vm.iscopy == 0){
url = "../advertisement/update"
}
let ids = $("#searchjqGrid").getGridParam("selarrrow");
vm.advertisement.itemIds = ids;
if (vm.advertisement.id == null || vm.advertisement.id == '' || vm.advertisement.id == 'undefined') {
vm.advertisement.id = vm.tempId;
}
if (vm.iscopy == 1){
vm.advertisement.id = vm.tempId
}
Ajax.request({
url: url,
params: JSON.stringify(vm.advertisement),
type: "POST",
contentType: "application/json",
successCallback: function (r) {
vm.iscopy == 0
alert('操作成功', function (index) {
vm.reload();
});
......@@ -429,6 +493,10 @@ let vm = new Vue({
async: true,
successCallback: function (r) {
vm.advertisement = r.advertisement;
if(vm.iscopy == 1){
vm.advertisement.adName = r.advertisement.adName + '(1)'
vm.advertisement.adLink = r.advertisement.adLink + '(1)'
}
}
});
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论