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

广告投放页管理

上级 f35bb26a
package com.platform.controller;
import com.platform.entity.AdvertisementEntity;
import com.platform.service.AdvertisementItemService;
import com.platform.service.AdvertisementService;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
......@@ -67,7 +68,9 @@ public class AdvertisementController {
@RequiresPermissions("advertisement:save")
@ResponseBody
public R save(@RequestBody AdvertisementEntity advertisement) {
advertisementService.save(advertisement);
int length = advertisement.getItemIds().length();
String itemIds = advertisement.getItemIds().substring(1, length - 1);
advertisementService.save(itemIds,advertisement);
return R.ok();
}
......@@ -79,7 +82,9 @@ public class AdvertisementController {
@RequiresPermissions("advertisement:update")
@ResponseBody
public R update(@RequestBody AdvertisementEntity advertisement) {
advertisementService.update(advertisement);
int length = advertisement.getItemIds().length();
String itemIds = advertisement.getItemIds().substring(1, length - 1);
advertisementService.update(itemIds,advertisement);
return R.ok();
}
......
......@@ -63,14 +63,27 @@ public class AdvertisementItemController {
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("advertisementitem:save")
@ResponseBody
public R save(@RequestBody AdvertisementItemEntity advertisementItem) {
advertisementItemService.save(advertisementItem);
return R.ok();
}
@RequestMapping("/saveBatch")
@ResponseBody
public R saveBatch(@RequestParam("aId") String aId, @RequestParam("itemIds") String itemIds) {
String itemIdArr[] = itemIds.split(",");
for (int i = 0; i < itemIdArr.length; i++) {
AdvertisementItemEntity advertisementItem = new AdvertisementItemEntity();
advertisementItem.setAdId(aId);
advertisementItem.setItemId(itemIdArr[i]);
advertisementItemService.save(advertisementItem);
}
return R.ok();
}
/**
* 修改
*/
......@@ -102,8 +115,8 @@ public class AdvertisementItemController {
@ResponseBody
public R queryAll(@RequestParam Map<String, Object> params) {
List<AdvertisementItemEntity> list = advertisementItemService.queryList(params);
List<AdvertisementItemEntity> list = advertisementItemService.queryList(params);
return R.ok().put("list", list);
return R.ok().put("list", list);
}
}
......@@ -8,7 +8,7 @@ import java.util.Date;
* 表名 advertisement
*
* @author lipengjun
* @date 2020-09-25 16:34:49
* @date 2020-09-28 17:54:01
*/
public class AdvertisementEntity implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -17,6 +17,8 @@ public class AdvertisementEntity implements Serializable {
* 广告投放ID
*/
private String id;
private String itemIds;
/**
* 广告名
*/
......@@ -26,7 +28,11 @@ public class AdvertisementEntity implements Serializable {
*/
private String adLink;
/**
* 状态
* banner图
*/
private String picture;
/**
* 状态 0:已删除 1:活动进行中 2:活动已关闭 3:活动已结束
*/
private Integer status;
/**
......@@ -90,14 +96,27 @@ public class AdvertisementEntity implements Serializable {
return adLink;
}
/**
* 设置:状态
* 设置:banner图
*/
public void setPicture(String picture) {
this.picture = picture;
}
/**
* 获取:banner图
*/
public String getPicture() {
return picture;
}
/**
* 设置:状态 0:已删除 1:活动进行中 2:活动已关闭 3:活动已结束
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 获取:状态
* 获取:状态 0:已删除 1:活动进行中 2:活动已关闭 3:活动已结束
*/
public Integer getStatus() {
return status;
......@@ -167,4 +186,12 @@ public class AdvertisementEntity implements Serializable {
public String getRemark() {
return remark;
}
public String getItemIds() {
return itemIds;
}
public void setItemIds(String itemIds) {
this.itemIds = itemIds;
}
}
......@@ -43,7 +43,7 @@ public interface AdvertisementService {
* @param advertisement 实体
* @return 保存条数
*/
int save(AdvertisementEntity advertisement);
int save(String itemIds, AdvertisementEntity advertisement);
/**
* 根据主键更新实体
......@@ -51,7 +51,7 @@ public interface AdvertisementService {
* @param advertisement 实体
* @return 更新条数
*/
int update(AdvertisementEntity advertisement);
int update(String itemIds, AdvertisementEntity advertisement);
/**
* 根据主键删除
......
package com.platform.service.impl;
import com.platform.dao.AdvertisementDao;
import com.platform.dao.AdvertisementItemDao;
import com.platform.entity.AdvertisementEntity;
import com.platform.entity.AdvertisementItemEntity;
import com.platform.service.AdvertisementService;
import com.platform.utils.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -21,6 +24,9 @@ public class AdvertisementServiceImpl implements AdvertisementService {
@Autowired
private AdvertisementDao advertisementDao;
@Autowired
private AdvertisementItemDao advertisementItemDao;
@Override
public AdvertisementEntity queryObject(String id) {
return advertisementDao.queryObject(id);
......@@ -37,13 +43,31 @@ public class AdvertisementServiceImpl implements AdvertisementService {
}
@Override
public int save(AdvertisementEntity advertisement) {
advertisement.setId(IdUtil.createIdbyUUID());
public int save(String itemIds, AdvertisementEntity advertisement) {
String aId = IdUtil.createIdbyUUID();
advertisement.setId(aId);
advertisement.setCreateTime(new Date());
advertisement.setUpdateTime(new Date());
saveAd(aId, itemIds);
return advertisementDao.save(advertisement);
}
public void saveAd(String aId, String itemIds) {
String[] idArr = itemIds.split(",");
for (int i = 0; i < idArr.length; i++) {
AdvertisementItemEntity advertisementItem = new AdvertisementItemEntity();
advertisementItem.setAdId(aId);
advertisementItem.setItemId(idArr[i].substring(1,idArr[i].length()-1));
advertisementItemDao.save(advertisementItem);
}
}
@Override
public int update(AdvertisementEntity advertisement) {
public int update(String itemIds, AdvertisementEntity advertisement) {
String aId = advertisement.getId();
advertisement.setUpdateTime(new Date());
advertisementItemDao.delete(advertisement.getId());
saveAd(aId, itemIds);
return advertisementDao.update(advertisement);
}
......
......@@ -7,6 +7,7 @@
<result property="id" column="id"/>
<result property="adName" column="ad_name"/>
<result property="adLink" column="ad_link"/>
<result property="picture" column="picture"/>
<result property="status" column="status"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
......@@ -20,6 +21,7 @@
`id`,
`ad_name`,
`ad_link`,
`picture`,
`status`,
`start_time`,
`end_time`,
......@@ -35,6 +37,7 @@
`id`,
`ad_name`,
`ad_link`,
`picture`,
`status`,
`start_time`,
`end_time`,
......@@ -72,6 +75,7 @@
`id`,
`ad_name`,
`ad_link`,
`picture`,
`status`,
`start_time`,
`end_time`,
......@@ -82,6 +86,7 @@
#{id},
#{adName},
#{adLink},
#{picture},
#{status},
#{startTime},
#{endTime},
......@@ -95,6 +100,7 @@
<set>
<if test="adName != null">`ad_name` = #{adName}, </if>
<if test="adLink != null">`ad_link` = #{adLink}, </if>
<if test="picture != null">`picture` = #{picture}, </if>
<if test="status != null">`status` = #{status}, </if>
<if test="startTime != null">`start_time` = #{startTime}, </if>
<if test="endTime != null">`end_time` = #{endTime}, </if>
......
<!DOCTYPE html>
<html>
<html xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<title></title>
#parse("sys/header.html")
</head>
<style>
body{
background: #f9f9f9;
}
ul li{
list-style: none;
text-align: center;
}
#app{
box-sizing: border-box;
min-width: 1200px;
margin:0 auto;
}
.category-container{
min-height:600px;
padding-bottom: 80px;
}
.edit-container{
position: relative;
height:500px;
}
.btn-container{
position: absolute;
bottom:0;
right:0;
}
.productList{
padding-bottom: 10px;
}
.productList,.search{
display: flex;
justify-content: start;
}
.productList-style-start{
display: flex;
justify-content: start;
}
.vRadio{
display: inline-block;
width:20px;
height:20px;
background:#eeeeee;
border-radius: 4px;
transition: all 0.4s;
}
.vradio-wrapper{
cursor: pointer;
}
.vRadio-active{
background:#000;
opacity: 0.6;
}
.vradio-wrapper>i{
vertical-align:top;
}
#searchjqGrid{
width:100%;
margin-top:10px;
}
#showItems{
margin-top:20px;
}
</style>
<body>
<div id="rrapp" v-cloak style="height: calc(100% - 15px);">
<div v-show="showList" style="height: 100%;">
<div v-show="showList" style="height: 100%;">
<Row :gutter="16">
<div class="search-group">
<i-col span="4">
......@@ -27,45 +91,176 @@
#end
</div>
</Row>
<table id="jqGrid"></table>
<table id="jqGrid"></table>
</div>
<Card v-show="!showList">
<p slot="title">{{title}}</p>
<i-form ref="formValidate" :model="advertisement" :rules="ruleValidate" :label-width="80">
<i-form ref="formValidate" :model="advertisement" :rules="ruleValidate" :label-width="80">
<Form-item label="广告名" prop="adName">
<i-input v-model="advertisement.adName" placeholder="广告名"/>
<i-input v-model="advertisement.adName" placeholder="广告名" style="width: 800px"/>
</Form-item>
<Form-item label="广告链接" prop="adLink">
<i-input v-model="advertisement.adLink" placeholder="广告链接"/>
<i-input v-model="advertisement.adLink" placeholder="广告链接" style="width: 800px"/>
</Form-item>
<Form-item label="状态" prop="status">
<i-input v-model="advertisement.status" placeholder="状态"/>
<i-input v-model="advertisement.status" placeholder="状态" style="width: 800px"/>
</Form-item>
<!--<Form-item label="banner图" prop="picture">
<i-input v-model="advertisement.picture" placeholder="banner图"/>
</Form-item>-->
<Form-item label="banner图" prop="picture">
<img v-bind:src="advertisement.picture" v-show="!!advertisement.picture"/>
<input type="file" placeholder="图片" @change="tirggerFile($event)"/>
</Form-item>
<div id="app">
<Card class="category-container">
<p slot="title">
<span
v-for="(element,index) in items" :key='index'
@click='vHandleChange(element,index)'
style="margin-left:20px;"
class="vradio-wrapper"
>
<span class="vRadio" :class="[element.isChecked?'vRadio-active':null]"></span>
<i>{{element.name}}</i>
</span>
</p>
<section class="edit-container">
<!-- 链接 -->
<div v-if='typeActive==0'>
<i-Input v-model="link" placeholder="请输入目标链接"/>
</div>
<!-- 分类子页面 -->
<!-- <div v-else-if='typeActive==1'>-->
<!-- <span>一级分类</span>-->
<!-- <i-Select v-model="subcategoryListsActive" style="width:200px" @on-change="changeSubCateType">-->
<!-- <i-Option v-for="item in subCategoryLists" :value="item.value" :key="item.value">{{ item.label }}</i-Option>-->
<!-- </i-Select>-->
<!-- <span style="margin-left:20px;">二级分类</span>-->
<!-- <i-Select v-model="subsubCategoryListsActive" style="width:200px">-->
<!-- <i-Option v-for="item in subsubCategoryLists" :value="item.value" :key="item.value">{{ item.label }}</i-Option>-->
<!-- </i-Select>-->
<!-- </div>-->
<!-- 商品列表页 -->
<div v-else-if='typeActive==1'>
<div class="productList-style-start">
<div>
<span>一级分类</span>
<i-Select v-model.sync="categoryListsActive1" style="width:100px"
@on-change="changeSubCateType">
<i-Option v-for="item in CategoryLists1" :value="item.value" :key="item.value">
{{ item.label }}
</i-Option>
</i-Select>
</div>
<div>
<span style="margin-left:20px;">二级分类</span>
<i-Select v-model.sync="categoryListsActive2" @on-change="queryMiniCatagory(2)"
style="width:100px">
<i-Option v-for="item in CategoryLists2" :value="item.value" :key="item.value">
{{ item.label }}
</i-Option>
</i-Select>
</div>
<div>
<span style="margin-left:20px;">三级分类</span>
<i-Select v-model.sync="categoryListsActive3" style="width:100px">
<i-Option v-for="item in CategoryLists3" :value="item.value" :key="item.value">
{{ item.label }}
</i-Option>
</i-Select>
</div>
</div>
<i-Button type="warning" style="float: right;margin-top:30px;width:100px;"
@click='resetSelectedCategory'>重置
</i-Button>
</div>
<!-- 商品 -->
<div v-else-if="typeActive==2">
<div class="productList-style-start">
<div>
<span>一级分类</span>
<i-Select v-model="commoditycategoryListsActive1" style="width:100px"
@on-change="changeSubCateType">
<i-Option v-for="item in commodityCategoryLists1" :value="item.value"
:key="item.value">{{ item.label }}
</i-Option>
</i-Select>
</div>
<div>
<span style="margin-left:20px;">二级分类</span>
<i-Select v-model="commoditycategoryListsActive2" @on-change="queryMiniCatagory(3)"
style="width:100px">
<i-Option v-for="item in commodityCategoryLists2" :value="item.value"
:key="item.value">{{ item.label }}
</i-Option>
</i-Select>
</div>
<div>
<span style="margin-left:20px;">三级分类</span>
<i-Select v-model="commoditycategoryListsActive3" style="width:100px">
<i-Option v-for="item in commodityCategoryLists3" :value="item.value"
:key="item.value">{{ item.label }}
</i-Option>
</i-Select>
</div>
</div>
<div class="search" style="margin-top:20px;">
<div>
<i-Input v-model="search"
placeholder="请输入搜索内容(可选)"
style="width:500px;"/>
</div>
<i-Button
type="primary"
style="width:100px;"
@click='handleSearch()'
>搜索
</i-Button>
<i-Button style="width:100px;" @click="resetSelectedCategory('commodity')">重置</i-Button>
</div>
<section id="showItems">
<table id="searchjqGrid"></table>
</section>
</div>
<div v-else-if="typeActive==3">
<div>
<span style="margin-left:20px;">商品标签</span>
<i-Select v-model="tagListsActive" style="width:100px">
<i-Option v-for="item in tagLists" :value="item.value" :key="item.value">{{
item.label }}
</i-Option>
</i-Select>
</div>
</div>
</section>
</Card>
</div>
<br/>
<Form-item label="活动开始时间" prop="startTime">
<i-input v-model="advertisement.startTime" placeholder="活动开始时间"/>
<Date-picker v-model="advertisement.startTime" type="datetime" placeholder="活动开始时间"
style="width: 800px"></Date-picker>
</Form-item>
<Form-item label="活动结束时间" prop="endTime">
<i-input v-model="advertisement.endTime" placeholder="活动结束时间"/>
</Form-item>
<Form-item label="创建时间" prop="createTime">
<i-input v-model="advertisement.createTime" placeholder="创建时间"/>
</Form-item>
<Form-item label="更新时间" prop="updateTime">
<i-input v-model="advertisement.updateTime" placeholder="更新时间"/>
<Date-picker type="datetime" v-model="advertisement.endTime" placeholder="活动结束时间"
style="width: 800px"></Date-picker>
</Form-item>
<Form-item label="备注" prop="remark">
<i-input v-model="advertisement.remark" placeholder="备注"/>
<textarea v-model="advertisement.remark" style="width: 800px;height: 300px;"></textarea>
</Form-item>
<Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
<i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
<i-button type="warning" @click="reload" style="margin-left: 8px"/>
返回</i-button>
<i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
</Form-item>
</i-form>
</Card>
</Card>
</div>
<script src="${rc.contextPath}/js/sys/advertisement.js?_${date.systemTime}"></script>
</body>
</html>
\ No newline at end of file
</html>
......@@ -2,105 +2,221 @@ $(function () {
$("#jqGrid").Grid({
url: '../advertisement/list',
colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '广告名', name: 'adName', index: 'ad_name', width: 80},
{label: '广告链接', name: 'adLink', index: 'ad_link', width: 80},
{label: '状态', name: 'status', index: 'status', width: 80,formatter:adStatus},
{label: '活动开始时间', name: 'startTime', index: 'start_time', width: 80},
{label: '活动结束时间', name: 'endTime', index: 'end_time', width: 80},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80},
/*{label: '更新时间', name: 'updateTime', index: 'update_time', width: 80},*/
{label: '备注', name: 'remark', index: 'remark', width: 80}]
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '广告名', name: 'adName', index: 'ad_name', width: 80},
{label: '广告链接', name: 'adLink', index: 'ad_link', width: 80},
{label: 'banner图', name: 'picture', index: 'picture', width: 80, formatter: imageFormat},
{label: '状态', name: 'status', index: 'status', width: 80, formatter: adStatus},
{label: '活动开始时间', name: 'startTime', index: 'start_time', width: 80},
{label: '活动结束时间', name: 'endTime', index: 'end_time', width: 80},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80},
/*{label: '更新时间', name: 'updateTime', index: 'update_time', width: 80},*/
{label: '备注', name: 'remark', index: 'remark', width: 80}]
});
});
let vm = new Vue({
el: '#rrapp',
data: {
el: '#rrapp',
data: {
typeActive: 2, //显示索引
items: [],
/*
--链接方式
*/
link: null,//链接
/*
--分类子页面
*/
// 一级分类
subCategoryLists: [
{
value: 'New',
label: 'New'
}
],
subcategoryListsActive: null,
// 二级分类
subsubCategoryLists: [
{
value: 'York',
label: 'York'
}
],
subsubCategoryListsActive: null,
/*
--商品列表页
*/
//一级
CategoryLists1: [
{
value: '一级',
label: '一级'
}
],
categoryListsActive1: null,
//二级
CategoryLists2: [
{
value: '二级',
label: '二级'
}
],
categoryListsActive2: null,
//三级
CategoryLists3: [
{
value: '三级',
label: '三级'
}
],
categoryListsActive3: null,
// 独立
tagLists: [
{
value: '独立',
label: '独立'
}
],
tagListsActive: null,
/*
--商品
*/
commodityCategoryLists1: [
{
value: '商品一级',
label: '商品一级'
}
],
commoditycategoryListsActive1: null,
//二级
commodityCategoryLists2: [
{
value: '商品二级',
label: '商品二级'
}
],
commoditycategoryListsActive2: null,
//三级
commodityCategoryLists3: [
{
value: '商品三级',
label: '商品三级'
}
],
commoditycategoryListsActive3: null,
// 搜索
search: null,
showList: true,
title: null,
advertisement: {},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
]
},
q: {
name: ''
}
},
methods: {
query: function () {
vm.reload();
},
add: function () {
vm.showList = false;
vm.title = "新增";
vm.advertisement = {};
},
update: function (event) {
advertisement: {},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
]
},
q: {
name: ''
}
},
methods: {
tirggerFile: function (event) {
var file = event.target.files[0]; // (利用console.log输出看file文件对象)
var formData = new FormData();
formData.append("file", file);
$.ajax({
url: "../api/upload/image/",
type: "POST",
data: formData,
cache: false, //不设置缓存
processData: false, // 不处理数据
contentType: false,// 不设置内容类型
success: function (result) {
result = JSON.parse(result);
//console.log(result)
if (result.errno == 0) {//成功
vm.advertisement.picture = result.data;
vm.$forceUpdate();
} else {
iview.Message.error(result.errmsg);
}
}
});
},
query: function () {
vm.reload();
},
add: function () {
vm.showList = false;
vm.title = "新增";
vm.advertisement = {};
},
update: function (event) {
let id = getSelectedRow("#jqGrid");
if (id == null) {
return;
}
vm.showList = false;
if (id == null) {
return;
}
vm.showList = false;
vm.title = "修改";
vm.getInfo(id);
},
saveOrUpdate: function (event) {
},
saveOrUpdate: function (event) {
let url = vm.advertisement.id == null ? "../advertisement/save" : "../advertisement/update";
let ids = getSelectedRows("#searchjqGrid");
// url = url + '?itemIds=' + ids;
vm.advertisement.itemIds=ids;
Ajax.request({
url: url,
url: url,
params: JSON.stringify(vm.advertisement),
type: "POST",
contentType: "application/json",
contentType: "application/json",
successCallback: function (r) {
alert('操作成功', function (index) {
vm.reload();
});
}
});
},
del: function (event) {
});
},
del: function (event) {
let ids = getSelectedRows("#jqGrid");
if (ids == null){
return;
}
if (ids == null) {
return;
}
confirm('确定要删除选中的记录?', function () {
confirm('确定要删除选中的记录?', function () {
Ajax.request({
url: "../advertisement/delete",
url: "../advertisement/delete",
params: JSON.stringify(ids),
type: "POST",
contentType: "application/json",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
vm.reload();
});
}
});
});
},
getInfo: function(id){
}
});
});
},
getInfo: function (id) {
Ajax.request({
url: "../advertisement/info/"+id,
url: "../advertisement/info/" + id,
async: true,
successCallback: function (r) {
vm.advertisement = r.advertisement;
}
});
},
reload: function (event) {
vm.showList = true;
},
reload: function (event) {
vm.showList = true;
let page = $("#jqGrid").jqGrid('getGridParam', 'page');
$("#jqGrid").jqGrid('setGridParam', {
$("#jqGrid").jqGrid('setGridParam', {
postData: {'name': vm.q.name},
page: page
}).trigger("reloadGrid");
vm.handleReset('formValidate');
},
reloadSearch: function() {
},
reloadSearch: function () {
vm.q = {
name: ''
};
......@@ -113,6 +229,202 @@ let vm = new Vue({
},
handleReset: function (name) {
handleResetForm(this, name);
},
tirggerFile: function (event) {
var file = event.target.files[0];
var formData = new FormData();
formData.append("file", file);
$.ajax({
url: "../api/upload/image/",
type: "POST",
data: formData,
cache: false, //不设置缓存
processData: false, // 不处理数据
contentType: false,// 不设置内容类型
success: function (result) {
result = JSON.parse(result);
//console.log(result)
if (result.errno == 0) {//成功
vm.advertisement.picture = result.data;
vm.$forceUpdate();
} else {
iview.Message.error(result.errmsg);
}
}
});
},
$(name) {
return document.querySelectorAll(name);
},
//切换海报导航定向方式
vHandleChange(element, _index) {
this.items.forEach((item, index) => {
item.isChecked = false
})
this.typeActive = _index;
this.items[_index].isChecked = true;
},
/* 重置选中的类别 */
resetSelectedCategory(e) {
if (e === 'commodity') {
this.search = this.commoditycategoryListsActive1 = this.commoditycategoryListsActive2 = this.commoditycategoryListsActive3 = null;
} else {
this.categoryListsActive = this.categoryListsActive3 = this.categoryListsActive2 = this.categoryListsActive1 = null;
}
},
/* 搜索 */
handleSearch(e) {
1 == 1 ? (() => {
$('#showItems').children().remove();
$('#showItems').append(`<table id="searchjqGrid"></table>`);
function beforeSelectRow() {
$("#searchjqGrid").jqGrid('resetSelection');
return (true);
}
let _this = this;
$(function () {
$("#searchjqGrid").Grid({
url: `../tbcfstationitem/list?itemCategory=${_this.commoditycategoryListsActive1 || ''}&typeTwo=${_this.commoditycategoryListsActive2 || ''}&typeThree=${_this.commoditycategoryListsActive3 || ''}&name=${vm.search || e || ''}`,
colModel: [
{label: 'itemId', name: 'itemId', index: 'item_id', key: true, hidden: true},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 50, 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: 65},
{label: '商品现价', name: 'discountPrice', index: 'discount_price', width: 55},
{label: '库存', name: 'itemCount', index: 'item_count', width: 55},
{label: '点击量', name: 'itemNum', index: 'item_num', width: 55},
/*{label: '所属平台', name: 'platformCode', index: 'platform_code', width: 80},
{label: '平台名', name: 'platformName', index: 'platform_name', width: 80},*/
{label: '供应商', name: 'supplier', index: 'supplier', width: 80},
{label: '商品一级分类', name: 'goodtype', index: 'goodtype', width: 80},
{label: '商品二级分类', name: 'title', index: 'title', width: 80},
{label: '商品品名', name: 'dname', index: 'itemDescritionId', width: 120},
{
label: '状态',
name: 'enableFlag',
index: 'enable_flag',
width: 120,
formatter: itemStatusFormat
},
{label: '创建日期', name: 'createTime', index: 'create_time', width: 160}
],
// beforeSelectRow: beforeSelectRow,
});
});
})() : alert('未输入搜索内容~');
},
//获取分类子页面二级分类数据
changeSubCateType(callback = null) {
let ID = null;
if (this.typeActive === 1000) {
ID = this.subcategoryListsActive
} else if (this.typeActive === 1) {
ID = this.categoryListsActive1
} else {
ID = this.commoditycategoryListsActive1
}
this.subsubCategoryLists = [];
this.CategoryLists2 = [];
this.commodityCategoryLists2 = [];
$.get('../tbcfstationitem/queryByItemType?typeId=' + ID, res => {
let _res = JSON.parse(res);
_res.code === 0 ? (() => {
if (this.typeActive === 1000) {
_res.list.forEach((item) => {
this.subsubCategoryLists.push({
label: item.goodstwotypeTitle,
value: item.goodstwotypeId
})
})
} else if (this.typeActive === 1) {
_res.list.forEach((item) => {
this.CategoryLists2.push({
label: item.goodstwotypeTitle,
value: item.goodstwotypeId
})
})
} else {
_res.list.forEach((item) => {
this.commodityCategoryLists2.push({
label: item.goodstwotypeTitle,
value: item.goodstwotypeId
})
})
}
callback ? callback() : null;
})() : null
})
},
//查询三级分类
queryMiniCatagory(status, callback = null) {
let ID = null
status === 2 ? ID = this.categoryListsActive2 : ID = this.commoditycategoryListsActive2
$.get('../tbcfstationitem/queryByItemTypeTwo?typeTwoId=' + ID, res => {
this.CategoryLists3 = [];
this.commodityCategoryLists3 = [];
let _res = JSON.parse(res);
_res.code === 0 ? (() => {
_res.descripiton.forEach((item) => {
this.CategoryLists3.push({
label: item.descripitionName,
value: item.descripitionId
})
this.commodityCategoryLists3.push({
label: item.descripitionName,
value: item.descripitionId
})
})
callback ? callback() : null;
})() : null
})
}
}
},
created() {
document.onkeydown = (e) => {
if (this.search && e.keyCode === 13) {
this.handleSearch()
}
}
//获取分类子页面一级分类数据
$.get('../tbcfgoodstype/queryAll', res => {
res.code === 0 ? (() => {
this.subCategoryLists = [];
this.commodityCategoryLists1 = [];
this.CategoryLists1 = [];
res.list.forEach((item) => {
this.subCategoryLists.push({
label: item.goodstypeTitle,
value: item.goodstypeId
});
this.commodityCategoryLists1.push({
label: item.goodstypeTitle,
value: item.goodstypeId
});
this.CategoryLists1.push({
label: item.goodstypeTitle,
value: item.goodstypeId
})
})
})() : null
})
//获取标签
$.get('../tbcflabel/queryAll?timestamp=' + new Date().getTime(), res => {
this.tagLists = [];
let OBJ_res = JSON.parse(res);
OBJ_res.list.forEach((item) => {
console.log('labelName', item.labelName)
this.tagLists.push({
label: item.labelName,
value: item.id
});
})
})
},
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论