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

广告投放页管理

上级 6da7ef85
package com.platform.controller; package com.platform.controller;
import com.platform.entity.AdvertisementEntity; import com.platform.entity.AdvertisementEntity;
import com.platform.entity.TbCfStationItemEntity;
import com.platform.service.AdvertisementItemService; import com.platform.service.AdvertisementItemService;
import com.platform.service.AdvertisementService; import com.platform.service.AdvertisementService;
import com.platform.service.TbCfStationItemService;
import com.platform.utils.PageUtils; import com.platform.utils.PageUtils;
import com.platform.utils.Query; import com.platform.utils.Query;
import com.platform.utils.R; import com.platform.utils.R;
...@@ -31,6 +33,12 @@ public class AdvertisementController { ...@@ -31,6 +33,12 @@ public class AdvertisementController {
@Autowired @Autowired
private AdvertisementService advertisementService; private AdvertisementService advertisementService;
@Autowired
private TbCfStationItemService tbCfStationItemService;
@Autowired
private AdvertisementItemService advertisementItemService;
/** /**
* 查看列表 * 查看列表
*/ */
...@@ -68,9 +76,7 @@ public class AdvertisementController { ...@@ -68,9 +76,7 @@ public class AdvertisementController {
@RequiresPermissions("advertisement:save") @RequiresPermissions("advertisement:save")
@ResponseBody @ResponseBody
public R save(@RequestBody AdvertisementEntity advertisement) { public R save(@RequestBody AdvertisementEntity advertisement) {
int length = advertisement.getItemIds().length(); advertisementService.save(advertisement);
String itemIds = advertisement.getItemIds().substring(1, length - 1);
advertisementService.save(itemIds,advertisement);
return R.ok(); return R.ok();
} }
...@@ -82,9 +88,7 @@ public class AdvertisementController { ...@@ -82,9 +88,7 @@ public class AdvertisementController {
@RequiresPermissions("advertisement:update") @RequiresPermissions("advertisement:update")
@ResponseBody @ResponseBody
public R update(@RequestBody AdvertisementEntity advertisement) { public R update(@RequestBody AdvertisementEntity advertisement) {
int length = advertisement.getItemIds().length(); advertisementService.update(advertisement);
String itemIds = advertisement.getItemIds().substring(1, length - 1);
advertisementService.update(itemIds,advertisement);
return R.ok(); return R.ok();
} }
...@@ -112,4 +116,21 @@ public class AdvertisementController { ...@@ -112,4 +116,21 @@ public class AdvertisementController {
return R.ok().put("list", list); return R.ok().put("list", list);
} }
/**
* 查询广告投放页的所有商品
*
* @return
*/
@RequestMapping("/getAdvertisementItem")
@ResponseBody
public R getAdvertisementItem(@RequestParam Map<String, Object> params) {
Query query = new Query(params);
List<TbCfStationItemEntity> itemList = tbCfStationItemService.getAdvertisementItem(params.get("adId").toString());
int count = advertisementItemService.getAdItemCount(params.get("adId").toString(), null);
PageUtils pageUtil = new PageUtils(itemList, count, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
} }
...@@ -75,6 +75,9 @@ public class AdvertisementItemController { ...@@ -75,6 +75,9 @@ public class AdvertisementItemController {
public R saveBatch(@RequestParam("aId") String aId, @RequestParam("itemIds") String itemIds) { public R saveBatch(@RequestParam("aId") String aId, @RequestParam("itemIds") String itemIds) {
String itemIdArr[] = itemIds.split(","); String itemIdArr[] = itemIds.split(",");
for (int i = 0; i < itemIdArr.length; i++) { for (int i = 0; i < itemIdArr.length; i++) {
int count = advertisementItemService.getAdItemCount(aId, itemIdArr[i]);
if (count > 0)
continue;
AdvertisementItemEntity advertisementItem = new AdvertisementItemEntity(); AdvertisementItemEntity advertisementItem = new AdvertisementItemEntity();
advertisementItem.setAdId(aId); advertisementItem.setAdId(aId);
advertisementItem.setItemId(itemIdArr[i]); advertisementItem.setItemId(itemIdArr[i]);
...@@ -119,4 +122,14 @@ public class AdvertisementItemController { ...@@ -119,4 +122,14 @@ public class AdvertisementItemController {
return R.ok().put("list", list); return R.ok().put("list", list);
} }
@RequestMapping("/deleteByItem")
@ResponseBody
public R deleteByItem(@RequestParam("itemId") String itemId) {
int res = advertisementItemService.deleteByItem(itemId);
if (res > 0) {
return R.ok();
}
return R.error("操作失败");
}
} }
package com.platform.dao; package com.platform.dao;
import com.platform.entity.AdvertisementItemEntity; import com.platform.entity.AdvertisementItemEntity;
import org.apache.ibatis.annotations.Param;
/** /**
* Dao * Dao
...@@ -10,4 +11,7 @@ import com.platform.entity.AdvertisementItemEntity; ...@@ -10,4 +11,7 @@ import com.platform.entity.AdvertisementItemEntity;
*/ */
public interface AdvertisementItemDao extends BaseDao<AdvertisementItemEntity> { public interface AdvertisementItemDao extends BaseDao<AdvertisementItemEntity> {
int getAdItemCount(@Param("adId") String adId, @Param("itemId") String itemId);
int deleteByItem(String itemId);
} }
...@@ -40,4 +40,7 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> { ...@@ -40,4 +40,7 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> {
TbCfStationItemEntity upSortItem(Integer sort); TbCfStationItemEntity upSortItem(Integer sort);
TbCfStationItemEntity downSortItem(Integer sort); TbCfStationItemEntity downSortItem(Integer sort);
List<TbCfStationItemEntity> getAdvertisementItem(String adId);
} }
...@@ -68,4 +68,8 @@ public interface AdvertisementItemService { ...@@ -68,4 +68,8 @@ public interface AdvertisementItemService {
* @return 删除条数 * @return 删除条数
*/ */
int deleteBatch(String[] adIds); int deleteBatch(String[] adIds);
int getAdItemCount(String adId,String itemId);
int deleteByItem(String itemId);
} }
...@@ -43,7 +43,7 @@ public interface AdvertisementService { ...@@ -43,7 +43,7 @@ public interface AdvertisementService {
* @param advertisement 实体 * @param advertisement 实体
* @return 保存条数 * @return 保存条数
*/ */
int save(String itemIds, AdvertisementEntity advertisement); int save( AdvertisementEntity advertisement);
/** /**
* 根据主键更新实体 * 根据主键更新实体
...@@ -51,7 +51,7 @@ public interface AdvertisementService { ...@@ -51,7 +51,7 @@ public interface AdvertisementService {
* @param advertisement 实体 * @param advertisement 实体
* @return 更新条数 * @return 更新条数
*/ */
int update(String itemIds, AdvertisementEntity advertisement); int update( AdvertisementEntity advertisement);
/** /**
* 根据主键删除 * 根据主键删除
......
...@@ -109,4 +109,6 @@ public interface TbCfStationItemService { ...@@ -109,4 +109,6 @@ public interface TbCfStationItemService {
int itemDownward(String itemId); int itemDownward(String itemId);
int exchangeItemSort(String itemId,Integer sort); int exchangeItemSort(String itemId,Integer sort);
List<TbCfStationItemEntity> getAdvertisementItem(String adId);
} }
...@@ -38,7 +38,6 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService { ...@@ -38,7 +38,6 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
@Override @Override
public int save(AdvertisementItemEntity advertisementItem) { public int save(AdvertisementItemEntity advertisementItem) {
advertisementItem.setAdId(IdUtil.createIdbyUUID());
return advertisementItemDao.save(advertisementItem); return advertisementItemDao.save(advertisementItem);
} }
...@@ -56,4 +55,14 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService { ...@@ -56,4 +55,14 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
public int deleteBatch(String[] adIds) { public int deleteBatch(String[] adIds) {
return advertisementItemDao.deleteBatch(adIds); return advertisementItemDao.deleteBatch(adIds);
} }
@Override
public int getAdItemCount(String adId,String itemId) {
return advertisementItemDao.getAdItemCount(adId, itemId);
}
@Override
public int deleteByItem(String itemId) {
return advertisementItemDao.deleteByItem(itemId);
}
} }
...@@ -43,12 +43,9 @@ public class AdvertisementServiceImpl implements AdvertisementService { ...@@ -43,12 +43,9 @@ public class AdvertisementServiceImpl implements AdvertisementService {
} }
@Override @Override
public int save(String itemIds, AdvertisementEntity advertisement) { public int save(AdvertisementEntity advertisement) {
String aId = IdUtil.createIdbyUUID();
advertisement.setId(aId);
advertisement.setCreateTime(new Date()); advertisement.setCreateTime(new Date());
advertisement.setUpdateTime(new Date()); advertisement.setUpdateTime(new Date());
saveAd(aId, itemIds);
return advertisementDao.save(advertisement); return advertisementDao.save(advertisement);
} }
...@@ -57,17 +54,14 @@ public class AdvertisementServiceImpl implements AdvertisementService { ...@@ -57,17 +54,14 @@ public class AdvertisementServiceImpl implements AdvertisementService {
for (int i = 0; i < idArr.length; i++) { for (int i = 0; i < idArr.length; i++) {
AdvertisementItemEntity advertisementItem = new AdvertisementItemEntity(); AdvertisementItemEntity advertisementItem = new AdvertisementItemEntity();
advertisementItem.setAdId(aId); advertisementItem.setAdId(aId);
advertisementItem.setItemId(idArr[i].substring(1,idArr[i].length()-1)); advertisementItem.setItemId(idArr[i].substring(1, idArr[i].length() - 1));
advertisementItemDao.save(advertisementItem); advertisementItemDao.save(advertisementItem);
} }
} }
@Override @Override
public int update(String itemIds, AdvertisementEntity advertisement) { public int update(AdvertisementEntity advertisement) {
String aId = advertisement.getId();
advertisement.setUpdateTime(new Date()); advertisement.setUpdateTime(new Date());
advertisementItemDao.delete(advertisement.getId());
saveAd(aId, itemIds);
return advertisementDao.update(advertisement); return advertisementDao.update(advertisement);
} }
......
...@@ -564,6 +564,12 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService { ...@@ -564,6 +564,12 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
return tbCfStationItemDao.update(sourceItem); return tbCfStationItemDao.update(sourceItem);
} }
@Override
public List<TbCfStationItemEntity> getAdvertisementItem(String adId) {
return tbCfStationItemDao.getAdvertisementItem(adId);
}
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<result property="itemId" column="item_id"/> <result property="itemId" column="item_id"/>
</resultMap> </resultMap>
<select id="queryObject" resultType="com.platform.entity.AdvertisementItemEntity"> <select id="queryObject" resultType="com.platform.entity.AdvertisementItemEntity">
select select
`ad_id`, `ad_id`,
`item_id` `item_id`
...@@ -16,37 +16,49 @@ ...@@ -16,37 +16,49 @@
where ad_id = #{id} where ad_id = #{id}
</select> </select>
<select id="queryList" resultType="com.platform.entity.AdvertisementItemEntity"> <select id="getAdItemCount" resultType="int">
select select count(1) from advertisement_item where ad_id = #{adId}
`ad_id`, <if test="itemId != null and itemId.trim() != ''">
`item_id` and item_id=#{itemId}
from advertisement_item </if>
WHERE 1=1 </select>
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if> <delete id="deleteByItem">
delete from advertisement_item where item_id=#{itemId}
</delete>
<select id="queryList" resultType="com.platform.entity.AdvertisementItemEntity">
select
`ad_id`,
`item_id`
from advertisement_item
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose> <choose>
<when test="sidx != null and sidx.trim() != ''"> <when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order} order by ${sidx} ${order}
</when> </when>
<otherwise> <otherwise>
order by ad_id desc order by ad_id desc
</otherwise> </otherwise>
</choose> </choose>
<if test="offset != null and limit != null"> <if test="offset != null and limit != null">
limit #{offset}, #{limit} limit #{offset}, #{limit}
</if> </if>
</select> </select>
<select id="queryTotal" resultType="int"> <select id="queryTotal" resultType="int">
select count(*) from advertisement_item select count(*) from advertisement_item
WHERE 1=1 WHERE 1=1
<if test="name != null and name.trim() != ''"> <if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND name LIKE concat('%',#{name},'%')
</if> </if>
</select> </select>
<insert id="save" parameterType="com.platform.entity.AdvertisementItemEntity"> <insert id="save" parameterType="com.platform.entity.AdvertisementItemEntity">
insert into advertisement_item( insert into advertisement_item(
`ad_id`, `ad_id`,
`item_id`) `item_id`)
...@@ -54,24 +66,24 @@ ...@@ -54,24 +66,24 @@
#{adId}, #{adId},
#{itemId}) #{itemId})
</insert> </insert>
<update id="update" parameterType="com.platform.entity.AdvertisementItemEntity"> <update id="update" parameterType="com.platform.entity.AdvertisementItemEntity">
update advertisement_item update advertisement_item
<set> <set>
<if test="itemId != null">`item_id` = #{itemId}</if> <if test="itemId != null">`item_id` = #{itemId}</if>
</set> </set>
where ad_id = #{adId} where ad_id = #{adId}
</update> </update>
<delete id="delete"> <delete id="delete">
delete from advertisement_item where ad_id = #{value} delete from advertisement_item where ad_id = #{value}
</delete> </delete>
<delete id="deleteBatch">
delete from advertisement_item where ad_id in
<foreach item="adId" collection="array" open="(" separator="," close=")">
#{adId}
</foreach>
</delete>
</mapper> <delete id="deleteBatch">
\ No newline at end of file delete from advertisement_item where ad_id in
<foreach item="adId" collection="array" open="(" separator="," close=")">
#{adId}
</foreach>
</delete>
</mapper>
...@@ -60,6 +60,48 @@ ...@@ -60,6 +60,48 @@
from tb_cf_station_item i left join tb_cf_item_desc d on i.item_id=d.item_id from tb_cf_station_item i left join tb_cf_item_desc d on i.item_id=d.item_id
where i.item_id = #{id} where i.item_id = #{id}
</select> </select>
<select id="getAdvertisementItem" resultType="com.platform.entity.TbCfStationItemEntityExtends">
select
i.`item_id`,
i.`item_code`,
i.`item_name`,
i.`item_brief`,
i.`item_category`,
i.`item_price`,
i.`discount_price`,
i.`cost_price`,
i.`item_url`,
i.`item_img`,
i.`item_tags`,
i.`item_label`,
i.`item_num`,
i.`item_collection_num`,
i.`item_count`,
i.`item_sku`,
i.`item_top`,
i.`sort`,
i.`supplier`,
i.`template`,
i.`sku_imgs`,
i.`platform_code`,
i.`platform_name`,
i.`enable_flag`,
i.`create_time`,
i.`item_categorytwo`,
i.`item_descrition_id`,
i.`creator`,
d.descripition_name dname,
t.goodstwotype_title title,
o.goodstype_title goodtype
from advertisement_item a
left join tb_cf_station_item i on i.item_id=a.item_id
left JOIN tb_cf_goodstype o ON o.goodstype_id = i.item_category
left JOIN tb_cf_goodstwotype t ON i.item_categorytwo=t.goodstwotype_id
left JOIN tb_cf_descripiton d ON i.item_descrition_id=d.descripition_id
where a.ad_id=#{adId} and i.enable_flag!=0
</select>
<select id="queryByItems" resultType="com.platform.entity.TbCfStationItemEntityExtends"> <select id="queryByItems" resultType="com.platform.entity.TbCfStationItemEntityExtends">
SELECT SELECT
i.item_id, i.item_id,
......
...@@ -5,66 +5,85 @@ ...@@ -5,66 +5,85 @@
#parse("sys/header.html") #parse("sys/header.html")
</head> </head>
<style> <style>
body{ body {
background: #f9f9f9; background: #f9f9f9;
} }
ul li{
ul li {
list-style: none; list-style: none;
text-align: center; text-align: center;
} }
#app{
#app {
box-sizing: border-box; box-sizing: border-box;
min-width: 1200px; min-width: 1200px;
margin:0 auto; margin: 0 auto;
} }
.category-container{
min-height:600px; .category-container {
min-height: 600px;
padding-bottom: 80px; padding-bottom: 80px;
} }
.edit-container{
.edit-container {
position: relative; position: relative;
height:500px; height: 500px;
} }
.btn-container{
.btn-container {
position: absolute; position: absolute;
bottom:0; bottom: 0;
right:0; right: 0;
} }
.productList{
.productList {
padding-bottom: 10px; padding-bottom: 10px;
} }
.productList,.search{
.productList, .search {
display: flex; display: flex;
justify-content: start; justify-content: start;
} }
.productList-style-start{
.productList-style-start {
display: flex; display: flex;
justify-content: start; justify-content: start;
} }
.vRadio{
.vRadio {
display: inline-block; display: inline-block;
width:20px; width: 20px;
height:20px; height: 20px;
background:#eeeeee; background: #eeeeee;
border-radius: 4px; border-radius: 4px;
transition: all 0.4s; transition: all 0.4s;
} }
.vradio-wrapper{
.vradio-wrapper {
cursor: pointer; cursor: pointer;
} }
.vRadio-active{
background:#000; .vRadio-active {
background: #000;
opacity: 0.6; opacity: 0.6;
} }
.vradio-wrapper>i{
vertical-align:top; .vradio-wrapper > i {
vertical-align: top;
} }
#searchjqGrid{
width:100%; #searchjqGrid {
margin-top:10px; width: 100%;
margin-top: 10px;
} }
#showItems{
margin-top:20px; #adItemjqGrid {
width: 100%;
margin-top: 10px;
}
#showItems {
margin-top: 20px;
} }
</style> </style>
...@@ -104,7 +123,10 @@ ...@@ -104,7 +123,10 @@
<i-input v-model="advertisement.adLink" placeholder="广告链接" style="width: 800px"/> <i-input v-model="advertisement.adLink" placeholder="广告链接" style="width: 800px"/>
</Form-item> </Form-item>
<Form-item label="状态" prop="status"> <Form-item label="状态" prop="status">
<i-input v-model="advertisement.status" placeholder="状态" style="width: 800px"/> <!--<i-input v-model="advertisement.status" placeholder="状态" style="width: 800px"/>-->
<i-select v-model="advertisement.status" placeholder="请选择" style="width: 800px"/>
<i-option v-for="v in versionList" :value="v.value">{{v.label}}</i-option>
</i-select>
</Form-item> </Form-item>
<!--<Form-item label="banner图" prop="picture"> <!--<Form-item label="banner图" prop="picture">
<i-input v-model="advertisement.picture" placeholder="banner图"/> <i-input v-model="advertisement.picture" placeholder="banner图"/>
...@@ -225,6 +247,7 @@ ...@@ -225,6 +247,7 @@
<section id="showItems"> <section id="showItems">
<table id="searchjqGrid"></table> <table id="searchjqGrid"></table>
</section> </section>
</div> </div>
<div v-else-if="typeActive==3"> <div v-else-if="typeActive==3">
<div> <div>
...@@ -239,6 +262,12 @@ ...@@ -239,6 +262,12 @@
</section> </section>
</Card> </Card>
</div> </div>
<br/>
<i-button type="info" @click="addItems">添加商品</i-button>
<br/>
<table id="adItemjqGrid"></table>
<br/> <br/>
<Form-item label="活动开始时间" prop="startTime"> <Form-item label="活动开始时间" prop="startTime">
<Date-picker v-model="advertisement.startTime" type="datetime" placeholder="活动开始时间" <Date-picker v-model="advertisement.startTime" type="datetime" placeholder="活动开始时间"
......
...@@ -18,6 +18,17 @@ $(function () { ...@@ -18,6 +18,17 @@ $(function () {
let vm = new Vue({ let vm = new Vue({
el: '#rrapp', el: '#rrapp',
data: { data: {
versionList: [
{
value: 1,
label: '开启活动'
},
{
value: 2,
label: '关闭活动'
}
],
tempId: '',
typeActive: 2, //显示索引 typeActive: 2, //显示索引
items: [], items: [],
/* /*
...@@ -119,6 +130,52 @@ let vm = new Vue({ ...@@ -119,6 +130,52 @@ let vm = new Vue({
} }
}, },
methods: { methods: {
delItem(id) {
confirm('确定要删除选中的记录?', function () {
Ajax.request({
url: "../advertisementitem/deleteByItem?itemId=" + id,
type: "POST",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
let page = $("#adItemjqGrid").jqGrid('getGridParam', 'page');
$("#adItemjqGrid").jqGrid('setGridParam', {
page: page
}).trigger("reloadGrid");
});
}
});
});
},
addItems() {
$("#adItemjqGrid").jqGrid("clearGridData");
let ids = getSelectedRows("#searchjqGrid");
if (ids == null) {
return;
}
let id = vm.advertisement.id;
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",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
$("#searchjqGrid").jqGrid('resetSelection');
// let page = $("#adItemjqGrid").jqGrid('getGridParam', 'page');
// $("#adItemjqGrid").jqGrid('setGridParam', {
// page: page
// }).trigger("reloadGrid");
vm.btn_Search(id);
});
}
});
},
tirggerFile: function (event) { tirggerFile: function (event) {
var file = event.target.files[0]; // (利用console.log输出看file文件对象) var file = event.target.files[0]; // (利用console.log输出看file文件对象)
var formData = new FormData(); var formData = new FormData();
...@@ -145,12 +202,52 @@ let vm = new Vue({ ...@@ -145,12 +202,52 @@ let vm = new Vue({
query: function () { query: function () {
vm.reload(); vm.reload();
}, },
guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 32 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(32);
});
},
add: function () { add: function () {
this.commodityCategoryLists3 = [];
this.commodityCategoryLists2 = [];
this.commodityCategoryLists1 = [];
vm.tempId = this.guid();
vm.showList = false; vm.showList = false;
vm.title = "新增"; vm.title = "新增";
vm.advertisement = {}; vm.advertisement = {};
$("#adItemjqGrid").jqGrid("clearGridData");
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + vm.tempId,
colModel: [
{label: 'itemId', name: 'itemId', index: 'item_id', key: true, 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) { update: function (event) {
$("#searchjqGrid").jqGrid("clearGridData");
let id = getSelectedRow("#jqGrid"); let id = getSelectedRow("#jqGrid");
if (id == null) { if (id == null) {
return; return;
...@@ -163,7 +260,10 @@ let vm = new Vue({ ...@@ -163,7 +260,10 @@ let vm = new Vue({
saveOrUpdate: function (event) { saveOrUpdate: function (event) {
let url = vm.advertisement.id == null ? "../advertisement/save" : "../advertisement/update"; let url = vm.advertisement.id == null ? "../advertisement/save" : "../advertisement/update";
let ids = getSelectedRows("#searchjqGrid"); let ids = getSelectedRows("#searchjqGrid");
vm.advertisement.itemIds=ids; vm.advertisement.itemIds = ids;
if (vm.advertisement.id == null || vm.advertisement.id == '' || vm.advertisement.id == 'undefined') {
vm.advertisement.id = vm.tempId;
}
Ajax.request({ Ajax.request({
url: url, url: url,
params: JSON.stringify(vm.advertisement), params: JSON.stringify(vm.advertisement),
...@@ -205,6 +305,42 @@ let vm = new Vue({ ...@@ -205,6 +305,42 @@ let vm = new Vue({
vm.advertisement = r.advertisement; vm.advertisement = r.advertisement;
} }
}); });
this.getItems(id);
this.btn_Search(id);
},
btn_Search(id) {
$("#adItemjqGrid").jqGrid('setGridParam', {
url: '../advertisement/getAdvertisementItem?adId=' + id, page: 1
}).trigger('reloadGrid');
},
getItems(id) {
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + id,
colModel: [
{label: 'itemId', name: 'itemId', index: 'item_id', key: true, 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,
});
}, },
reload: function (event) { reload: function (event) {
vm.showList = true; vm.showList = true;
...@@ -316,8 +452,10 @@ let vm = new Vue({ ...@@ -316,8 +452,10 @@ let vm = new Vue({
}); });
}); });
})() : alert('未输入搜索内容~'); })() : alert('未输入搜索内容~');
}, },
//获取分类子页面二级分类数据 //获取分类子页面二级分类数据
changeSubCateType(callback = null) { changeSubCateType(callback = null) {
let ID = null; let ID = null;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论