提交 9481b5d9 authored 作者: 梁业锦's avatar 梁业锦 💬

Merge remote-tracking branch 'origin/master'

package com.platform.controller;
import com.platform.entity.TbCfLabelEntity;
import com.platform.service.TbCfLabelService;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
import com.platform.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 商品标签Controller
*
* @author lipengjun
* @date 2020-03-12 16:20:26
*/
@Controller
@RequestMapping("tbcflabel")
public class TbCfLabelController {
@Autowired
private TbCfLabelService tbCfLabelService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("tbcflabel:list")
@ResponseBody
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
Query query = new Query(params);
List<TbCfLabelEntity> tbCfLabelList = tbCfLabelService.queryList(query);
int total = tbCfLabelService.queryTotal(query);
PageUtils pageUtil = new PageUtils(tbCfLabelList, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
/**
* 查看信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("tbcflabel:info")
@ResponseBody
public R info(@PathVariable("id") String id) {
TbCfLabelEntity tbCfLabel = tbCfLabelService.queryObject(id);
return R.ok().put("tbCfLabel", tbCfLabel);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("tbcflabel:save")
@ResponseBody
public R save(@RequestBody TbCfLabelEntity tbCfLabel) {
tbCfLabelService.save(tbCfLabel);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("tbcflabel:update")
@ResponseBody
public R update(@RequestBody TbCfLabelEntity tbCfLabel) {
tbCfLabelService.update(tbCfLabel);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("tbcflabel:delete")
@ResponseBody
public R delete(@RequestBody String[] ids) {
tbCfLabelService.deleteBatch(ids);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@ResponseBody
public R queryAll(@RequestParam Map<String, Object> params) {
List<TbCfLabelEntity> list = tbCfLabelService.queryList(params);
return R.ok().put("list", list);
}
/**
* 查询父标签的子类
*
* @return list
*/
@RequestMapping("/queryParentLabels")
@ResponseBody
public R queryParentLabels(@RequestParam(value = "parentId",defaultValue = "0") String parentId) {
List<TbCfLabelEntity> labelList = tbCfLabelService.queryParentLabels(parentId);
return R.ok().put("list", labelList);
}
}
package com.platform.dao;
import com.platform.entity.TbCfLabelEntity;
import java.util.List;
/**
* 商品标签Dao
*
* @author lipengjun
* @date 2020-03-12 16:20:26
*/
public interface TbCfLabelDao extends BaseDao<TbCfLabelEntity> {
/**
* 查询所有父标签
*
* @return list
*/
List<TbCfLabelEntity> queryParentLabels(String parentId);
}
package com.platform.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 商品标签实体
* 表名 tb_cf_label
*
* @author lipengjun
* @date 2020-03-17 10:38:00
*/
public class TbCfLabelEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 标签ID
*/
private String id;
/**
* 父标签ID,如果没有父标签,则为:0
*/
private String parentId;
/**
* 标签名
*/
private String labelName;
/**
* 是否启用 0:不启用 1:启用
*/
private Integer enableFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 设置:标签ID
*/
public void setId(String id) {
this.id = id;
}
/**
* 获取:标签ID
*/
public String getId() {
return id;
}
/**
* 设置:父标签ID,如果没有父标签,则为:0
*/
public void setParentId(String parentId) {
this.parentId = parentId;
}
/**
* 获取:父标签ID,如果没有父标签,则为:0
*/
public String getParentId() {
return parentId;
}
/**
* 设置:标签名
*/
public void setLabelName(String labelName) {
this.labelName = labelName;
}
/**
* 获取:标签名
*/
public String getLabelName() {
return labelName;
}
/**
* 设置:是否启用 0:不启用 1:启用
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:是否启用 0:不启用 1:启用
*/
public Integer getEnableFlag() {
return enableFlag;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:更新时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:更新时间
*/
public Date getUpdateTime() {
return updateTime;
}
}
......@@ -51,9 +51,13 @@ public class TbCfStationItemEntity implements Serializable {
*/
private String itemImg;
/**
* 商品标签
* 搜索关键字
*/
private String itemTags;
/**
* 商品标签
*/
private String itemLabel;
/**
* 浏览人数
*/
......@@ -389,4 +393,12 @@ public class TbCfStationItemEntity implements Serializable {
public String getItemDescritionId() {
return itemDescritionId;
}
public String getItemLabel() {
return itemLabel;
}
public void setItemLabel(String itemLabel) {
this.itemLabel = itemLabel;
}
}
package com.platform.service;
import com.platform.entity.TbCfLabelEntity;
import java.util.List;
import java.util.Map;
/**
* 商品标签Service接口
*
* @author lipengjun
* @date 2020-03-12 16:20:26
*/
public interface TbCfLabelService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfLabelEntity queryObject(String id);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfLabelEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfLabel 实体
* @return 保存条数
*/
int save(TbCfLabelEntity tbCfLabel);
/**
* 根据主键更新实体
*
* @param tbCfLabel 实体
* @return 更新条数
*/
int update(TbCfLabelEntity tbCfLabel);
/**
* 根据主键删除
*
* @param id
* @return 删除条数
*/
int delete(String id);
/**
* 根据主键批量删除
*
* @param ids
* @return 删除条数
*/
int deleteBatch(String[] ids);
/**
* 查询父标签的子类
*
* @return list
*/
List<TbCfLabelEntity> queryParentLabels(String parentId);
}
package com.platform.service.impl;
import com.platform.dao.TbCfLabelDao;
import com.platform.entity.TbCfLabelEntity;
import com.platform.service.TbCfLabelService;
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;
/**
* 商品标签Service实现类
*
* @author lipengjun
* @date 2020-03-12 16:20:26
*/
@Service("tbCfLabelService")
public class TbCfLabelServiceImpl implements TbCfLabelService {
@Autowired
private TbCfLabelDao tbCfLabelDao;
@Override
public TbCfLabelEntity queryObject(String id) {
return tbCfLabelDao.queryObject(id);
}
@Override
public List<TbCfLabelEntity> queryList(Map<String, Object> map) {
return tbCfLabelDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfLabelDao.queryTotal(map);
}
@Override
public int save(TbCfLabelEntity tbCfLabel) {
tbCfLabel.setId(IdUtil.createIdbyUUID());
tbCfLabel.setCreateTime(new Date());
tbCfLabel.setUpdateTime(new Date());
return tbCfLabelDao.save(tbCfLabel);
}
@Override
public int update(TbCfLabelEntity tbCfLabel) {
tbCfLabel.setUpdateTime(new Date());
return tbCfLabelDao.update(tbCfLabel);
}
@Override
public int delete(String id) {
return tbCfLabelDao.delete(id);
}
@Override
public int deleteBatch(String[] ids) {
return tbCfLabelDao.deleteBatch(ids);
}
/**
* 查询父标签的子类
*
* @return list
*/
@Override
public List<TbCfLabelEntity> queryParentLabels(String parentId) {
return tbCfLabelDao.queryParentLabels(parentId);
}
}
......@@ -41,12 +41,12 @@ public class TbCfPostersServiceImpl implements TbCfPostersService {
public int save(TbCfPostersEntity tbCfPosters) {
tbCfPosters.setId(IdUtil.createIdbyUUID());
tbCfPosters.setCreateTime(new Date());
tbCfPosters.setUpdateTime(new Date());
return tbCfPostersDao.save(tbCfPosters);
}
@Override
public int update(TbCfPostersEntity tbCfPosters) {
tbCfPosters.setCreateTime(new Date());
tbCfPosters.setUpdateTime(new Date());
return tbCfPostersDao.update(tbCfPosters);
}
......
......@@ -118,6 +118,7 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
tbCfStationItem.setItemCategorytwo(itemSkus.getItemCategorytwo());
tbCfStationItem.setItemCount(count);
tbCfStationItem.setItemTags(itemSkus.getItemTags());
tbCfStationItem.setItemLabel(itemSkus.getItemLabel());
tbCfStationItem.setItemDescritionId(itemSkus.getItemDescritionId());
tbCfStationItem.setItemTop("N");
tbCfStationItem.setItemImg(itemSkus.getItemImg());
......@@ -240,6 +241,7 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
tbCfStationItem.setItemCategorytwo(itemSkus.getItemCategorytwo());
tbCfStationItem.setItemCount(count);
tbCfStationItem.setItemTags(itemSkus.getItemTags());
tbCfStationItem.setItemLabel(itemSkus.getItemLabel());
tbCfStationItem.setItemDescritionId(itemSkus.getItemDescritionId());
tbCfStationItem.setItemImg(itemSkus.getItemImg());
if (itemSkus.isPutaway()) {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.platform.dao.TbCfLabelDao">
<resultMap type="com.platform.entity.TbCfLabelEntity" id="tbCfLabelMap">
<result property="id" column="id"/>
<result property="parentId" column="parent_id"/>
<result property="labelName" column="label_name"/>
<result property="enableFlag" column="enable_flag"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfLabelEntity">
select
`id`,
`parent_id`,
`label_name`,
`enable_flag`,
`create_time`,
`update_time`
from tb_cf_label
where id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.TbCfLabelEntity">
select
`id`,
`parent_id`,
`label_name`,
`enable_flag`,
`create_time`,
`update_time`
from tb_cf_label
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryParentLabels" resultType="com.platform.entity.TbCfLabelEntity">
select
`id`,
`parent_id`,
`label_name`,
`enable_flag`,
`create_time`,
`update_time`
from tb_cf_label
WHERE parent_id=#{parentId}
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_label
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfLabelEntity">
insert into tb_cf_label(
`id`,
`parent_id`,
`label_name`,
`enable_flag`,
`create_time`,
`update_time`)
values(
#{id},
#{parentId},
#{labelName},
#{enableFlag},
#{createTime},
#{updateTime})
</insert>
<update id="update" parameterType="com.platform.entity.TbCfLabelEntity">
update tb_cf_label
<set>
<if test="parentId != null">`parent_id` = #{parentId},</if>
<if test="labelName != null">`label_name` = #{labelName},</if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag},</if>
<if test="createTime != null">`create_time` = #{createTime},</if>
<if test="updateTime != null">`update_time` = #{updateTime}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete from tb_cf_label where id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_label where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -14,6 +14,7 @@
<result property="itemUrl" column="item_url"/>
<result property="itemImg" column="item_img"/>
<result property="itemTags" column="item_tags"/>
<result property="itemLabel" column="item_label"/>
<result property="itemNum" column="item_num"/>
<result property="itemCount" column="item_count"/>
<result property="itemSku" column="item_sku"/>
......@@ -39,6 +40,7 @@
`item_url`,
`item_img`,
`item_tags`,
`item_label`,
`item_num`,
`item_count`,
`item_sku`,
......@@ -66,6 +68,7 @@
`item_url`,
`item_img`,
`item_tags`,
`item_label`,
`item_num`,
`item_count`,
`item_sku`,
......@@ -127,7 +130,7 @@
left JOIN tb_cf_express_template e ON i.item_descrition_id = e.template_id
WHERE 1=1 and i.enable_flag!=0
<if test="name != null and name.trim() != ''">
AND item_name LIKE concat('%',#{name},'%')
AND item_name LIKE concat('%',#{name},'%') or item_id LIKE concat('%',#{name},'%')
</if>
<if test="code != null and code.trim() != ''">
AND item_code=#{code}
......@@ -138,7 +141,12 @@
<if test="itemCategory != null and itemCategory.trim() != ''">
AND item_category=#{itemCategory}
</if>
<if test="typeTwo != null and typeTwo.trim() != ''">
AND item_categorytwo=#{typeTwo}
</if>
<if test="typeThree != null and typeThree.trim() != ''">
AND item_descrition_id=#{typeThree}
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
......@@ -150,7 +158,6 @@
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryItemInfoById" resultType="com.platform.entity.ItemDescSkus">
......@@ -170,7 +177,7 @@
select count(*) from tb_cf_station_item
WHERE 1=1 and enable_flag!=0
<if test="name != null and name.trim() != ''">
AND item_name LIKE concat('%',#{name},'%')
AND item_name LIKE concat('%',#{name},'%') or item_id LIKE concat('%',#{name},'%')
</if>
<if test="code != null and code.trim() != ''">
AND item_code=#{code}
......@@ -181,6 +188,12 @@
<if test="itemCategory != null and itemCategory.trim() != ''">
AND item_category=#{itemCategory}
</if>
<if test="typeTwo != null and typeTwo.trim() != ''">
AND item_categorytwo=#{typeTwo}
</if>
<if test="typeThree != null and typeThree.trim() != ''">
AND item_descrition_id=#{typeThree}
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfStationItemEntity">
......@@ -195,6 +208,7 @@
`item_url`,
`item_img`,
`item_tags`,
`item_label`,
`item_num`,
`item_count`,
`item_sku`,
......@@ -215,6 +229,7 @@
#{itemUrl},
#{itemImg},
#{itemTags},
#{itemLabel},
#{itemNum},
#{itemCount},
#{itemSku},
......@@ -238,6 +253,7 @@
<if test="itemUrl != null">`item_url` = #{itemUrl},</if>
<if test="itemImg != null">`item_img` = #{itemImg},</if>
<if test="itemTags != null">`item_tags` = #{itemTags},</if>
`item_label` = #{itemLabel},
<if test="itemNum != null">`item_num` = #{itemNum},</if>
<if test="itemCollectionNum != null">`item_collection_num` = #{itemCollectionNum},</if>
<if test="itemCount != null">`item_count` = #{itemCount},</if>
......
<!DOCTYPE html>
<html>
<head>
<title>商品标签</title>
#parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak style="height: calc(100% - 15px);">
<div v-show="showList" style="height: 100%;">
<Row :gutter="16">
<div class="search-group">
<i-col span="4">
<i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
</i-col>
<i-button @click="query">查询</i-button>
<i-button @click="reloadSearch">重置</i-button>
</div>
<div class="buttons-group">
#if($shiro.hasPermission("tbcflabel:save"))
<i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
#end
#if($shiro.hasPermission("tbcflabel:update"))
<i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
#end
#if($shiro.hasPermission("tbcflabel:delete"))
<i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
#end
</div>
</Row>
<table id="jqGrid"></table>
</div>
<Card v-show="!showList">
<p slot="title">{{title}}</p>
<i-form ref="formValidate" :model="tbCfLabel" :rules="ruleValidate" :label-width="80">
<!-- <Form-item label="标签组名" prop="parentId">
<i-input v-model="tbCfLabel.parentId" placeholder="父标签ID,如果没有父标签,则为:0"/>
</Form-item>-->
<Form-item label="标签组名" prop="parentId">
<i-select placeholder="请选择" v-model="tbCfLabel.parentId">
<i-option v-for="(el,i) in labelList" :key='el.id'
:value="el.id">{{el.labelName}}
</i-option>
</i-select>
</Form-item>
<Form-item label="标签名" prop="labelName">
<i-input v-model="tbCfLabel.labelName" placeholder="标签名"/>
</Form-item>
<Form-item label="是否启用" prop="enableFlag">
<i-input v-model="tbCfLabel.enableFlag" placeholder="是否启用 0:不启用 1:启用"/>
</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="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
</Form-item>
</i-form>
</Card>
</div>
<script src="${rc.contextPath}/js/sys/tbcflabel.js?_${date.systemTime}"></script>
</body>
</html>
\ No newline at end of file
......@@ -17,8 +17,8 @@
margin:0 auto;
}
.category-container{
width:800px;
min-height:600px;
padding-bottom: 80px;
}
.edit-container{
position: relative;
......@@ -29,13 +29,43 @@
bottom:0;
right:0;
}
.productList{
padding-bottom: 10px;
}
.productList,.search{
display: flex;
justify-content: space-between;
}.productList-style-start{
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>
</head>
<body>
......@@ -80,81 +110,81 @@
<img v-bind:src="tbCfPosters.postersPicture" v-show="!!tbCfPosters.postersPicture"/>
<input type="file" placeholder="图片" @change="tirggerFile($event)"/>
</Form-item>
<Form-item label="跳转链接" prop="redirectUrl">
<i-input v-model="tbCfPosters.redirectUrl" placeholder="跳转链接"/>
</Form-item>
<!-- <Form-item label="跳转链接" prop="redirectUrl">-->
<!-- <i-input v-model="tbCfPosters.redirectUrl" placeholder="跳转链接"/>-->
<!-- </Form-item>-->
<div id="app">
<Card class="category-container" >
<p slot="title">
<label v-for="(element,index) in items" :key='index' style="margin-left:20px;">
<input type="checkbox" :checked='element.isChecked' @click='vHandleChange(element,index)' class="v-radio"/>
{{element.name}}
</label>
<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='active==0'>
<div v-if='typeActive==0'>
<i-Input v-model="link" placeholder="请输入目标链接" />
</div>
<!-- 分类子页面 -->
<div v-else-if='active==1'>
<span>一级分类</span>
<i-Select v-model="subcategoryListsActive" style="width:200px">
<i-Option v-for="item in subCategoryLists" :value="item.value" :key="item.value">{{ item.label }}</i-Option>
</i-Select>
<!-- <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>
<!-- <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='active==2' >
<div class="productList">
<div v-else-if='typeActive==1' >
<div class="productList-style-start">
<div>
<span>一级分类</span>
<i-Select v-model="categoryListsActive1" style="width:100px">
<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="categoryListsActive2" style="width:100px">
<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="categoryListsActive3" style="width:100px">
<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>
<span style="margin-left:20px;">独立分类</span>
<i-Select v-model="categoryListsActive" style="width:100px">
<i-Option v-for="item in categoryLists" :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>
<div v-else-if="typeActive==2">
<div class="productList-style-start">
<div>
<span>一级分类</span>
<i-Select v-model="commoditycategoryListsActive1" style="width:100px">
<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" style="width:100px">
<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>
<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>
......@@ -162,22 +192,33 @@
</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-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>
表格内容。。。
<section id="showItems">
<table id="searchjqGrid"></table>
</section>
</div>
<div class="btn-container">
<i-Button type="primary" @click='submit()'>确定</i-Button>
<i-Button >取消</i-Button>
<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="isShow">
<i-input v-model="tbCfPosters.isShow" placeholder="是否展示"/>
</Form-item>
......
......@@ -255,8 +255,11 @@
<!-- <Form-item label="商品链接" prop="itemUrl">
<i-input v-model="tbCfStationItem.itemUrl" placeholder="商品链接"/>
</Form-item>-->
<Form-item label="商品标签" prop="itemTags" style="width: 800px">
<i-input v-model="tbCfStationItem.itemTags" placeholder="商品标签"/>
<Form-item label="搜索关键字" prop="itemTags" style="width: 800px">
<i-input v-model="tbCfStationItem.itemTags" placeholder="搜索关键字"/>
</Form-item>
<Form-item label="商品标签" prop="itemLabel" style="width: 800px">
<i-input v-model="tbCfStationItem.itemLabel" placeholder="商品标签"/>
</Form-item>
<Form-item label="原价" prop="itemPrice" style="width: 800px">
<i-input v-model="tbCfStationItem.itemPrice" placeholder="原价(可不填)"/>
......
......@@ -153,7 +153,6 @@ let vm = new Vue({
created() {
var that = this
$.get('../tbcfgoodstype/queryAll', function (res) {
debugger
// console.log(that,"this");
that.Goodstype = res.list;
// console.log(that.Goodstype);
......
......@@ -5,7 +5,7 @@ $(function () {
{label: 'ID', name: 'goodstypeId', index: 'goodstype_id', key: true,hidden: true},
{label: '商品一级分类', name: 'goodstypeTitle', index: 'goodstype_title', width: 80},
{label: '排序编号', name: 'goodstypeSort', index: 'goodstype_sort', width: 80},
{label: '一级分类图片', name: 'goodstwotypeUrl', index: 'goodstype_url', width: 80, formatter: imageFormat}],
{label: '一级分类图片', name: 'goodstypeUrl', index: 'goodstype_url', width: 80, formatter: imageFormat}],
shrinkToFit: true,
datatype : "json",
rowNum:15,
......
$(function () {
$("#jqGrid").Grid({
url: '../tbcflabel/list',
colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
/*{label: '标签组名', name: 'parentId', index: 'parent_id', width: 80},*/
{label: '标签名', name: 'labelName', index: 'label_name', width: 80},
{label: '是否启用', name: 'enableFlag', index: 'enable_flag', width: 80,formatter: validFormat},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80}
]
});
});
let vm = new Vue({
el: '#rrapp',
data: {
labelList:null,
showList: true,
title: null,
tbCfLabel: {},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
]
},
q: {
name: ''
}
},
methods: {
query: function () {
vm.reload();
},
add: function () {
vm.showList = false;
vm.title = "新增";
vm.tbCfLabel = {};
},
update: function (event) {
let id = getSelectedRow("#jqGrid");
if (id == null) {
return;
}
vm.showList = false;
vm.title = "修改";
vm.getInfo(id);
},
saveOrUpdate: function (event) {
let url = vm.tbCfLabel.id == null ? "../tbcflabel/save" : "../tbcflabel/update";
Ajax.request({
url: url,
params: JSON.stringify(vm.tbCfLabel),
type: "POST",
contentType: "application/json",
successCallback: function (r) {
alert('操作成功', function (index) {
vm.reload();
});
}
});
},
del: function (event) {
let ids = getSelectedRows("#jqGrid");
if (ids == null){
return;
}
confirm('确定要删除选中的记录?', function () {
Ajax.request({
url: "../tbcflabel/delete",
params: JSON.stringify(ids),
type: "POST",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
vm.reload();
});
}
});
});
},
getInfo: function(id){
Ajax.request({
url: "../tbcflabel/info/"+id,
async: true,
successCallback: function (r) {
vm.tbCfLabel = r.tbCfLabel;
}
});
},
reload: function (event) {
vm.showList = true;
let page = $("#jqGrid").jqGrid('getGridParam', 'page');
$("#jqGrid").jqGrid('setGridParam', {
postData: {'name': vm.q.name},
page: page
}).trigger("reloadGrid");
vm.handleReset('formValidate');
},
reloadSearch: function() {
vm.q = {
name: ''
};
vm.reload();
},
handleSubmit: function (name) {
handleSubmitValidate(this, name, function () {
vm.saveOrUpdate()
});
},
handleReset: function (name) {
handleResetForm(this, name);
}
},
created(){
$.get('../tbcflabel/queryParentLabels', res => {
this.labelList = JSON.parse(res).list;
this.labelList.unshift({
id: "0",
labelName: "标签组",
})
})
}
});
\ No newline at end of file
......@@ -14,30 +14,41 @@ $(function () {
});
});
let vm = new Vue({
el: '#rrapp',
data(){
return{
active:3, //显示索引
items:[
data() {
return {
typeActive: 0, //显示索引
items: [
{
name: '链接',
isChecked: true
},
// {
// name: '分类子页面',
// isChecked: false
// },
{
name:'链接',
isChecked:false
},{
name:'分类子页面',
isChecked:false
},{
name:'商品列表页',
isChecked:false
},{
name:'商品',
isChecked:true
name: '商品列表页',
isChecked: false
}, {
name: '商品',
isChecked: false
}, {
name: '标签',
isChecked: false
},
{
name:'不跳转',
isChecked: false
}
],
/*
--链接方式
*/
link:null,//链接
link: null,//链接
/*
--分类子页面
*/
......@@ -48,7 +59,7 @@ let vm = new Vue({
label: 'New'
}
],
subcategoryListsActive:null,
subcategoryListsActive: null,
// 二级分类
subsubCategoryLists: [
{
......@@ -56,7 +67,7 @@ let vm = new Vue({
label: 'York'
}
],
subsubCategoryListsActive:null,
subsubCategoryListsActive: null,
/*
--商品列表页
*/
......@@ -67,7 +78,7 @@ let vm = new Vue({
label: '一级'
}
],
categoryListsActive1:null,
categoryListsActive1: null,
//二级
CategoryLists2: [
{
......@@ -75,7 +86,7 @@ let vm = new Vue({
label: '二级'
}
],
categoryListsActive2:null,
categoryListsActive2: null,
//三级
CategoryLists3: [
{
......@@ -83,15 +94,15 @@ let vm = new Vue({
label: '三级'
}
],
categoryListsActive3:null,
categoryListsActive3: null,
// 独立
categoryLists:[
tagLists: [
{
value: '独立',
label: '独立'
}
],
categoryListsActive:null,
tagListsActive: null,
/*
--商品
*/
......@@ -101,7 +112,7 @@ let vm = new Vue({
label: '商品一级'
}
],
commoditycategoryListsActive1:null,
commoditycategoryListsActive1: null,
//二级
commodityCategoryLists2: [
{
......@@ -109,7 +120,7 @@ let vm = new Vue({
label: '商品二级'
}
],
commoditycategoryListsActive2:null,
commoditycategoryListsActive2: null,
//三级
commodityCategoryLists3: [
{
......@@ -117,9 +128,9 @@ let vm = new Vue({
label: '商品三级'
}
],
commoditycategoryListsActive3:null,
commoditycategoryListsActive3: null,
// 搜索
search:null,
search: null,
showList: true,
title: null,
tbCfPosters: {},
......@@ -134,6 +145,42 @@ let vm = new Vue({
}
},
methods: {
//获取二级分类
changeGoodstype() {
let url = "../tbcfstationitem/queryByItemType?typeId=" + this.tbCfStationItem.itemCategory;
// console.log('url',url)
let that = this;
Ajax.request({
url: url,
type: "get",
contentType: "application/json",
successCallback: function (r) {
if (r.code === 0) {
that.Goodstype2 = r.list
if (r.list.length === 0) {
that.tbCfStationItem.itemCategorytwo = null
}
}
}
});
},
changeGoodstype2() {
let url = "../tbcfstationitem/queryByItemTypeTwo?typeTwoId=" + this.tbCfStationItem.itemCategorytwo;
let that = this;
Ajax.request({
url: url,
type: "get",
contentType: "application/json",
successCallback: function (r) {
if (r.code === 0) {
that.Goodstype3 = r.descripiton
if (r.descripiton.length === 0) {
that.tbCfStationItem.itemDescritionId = null
}
}
}
});
},
query: function () {
vm.reload();
},
......@@ -141,6 +188,9 @@ let vm = new Vue({
vm.showList = false;
vm.title = "新增";
vm.tbCfPosters = {};
this.link = null;
this.typeActive = 0;
},
update: function (event) {
let id = getSelectedRow("#jqGrid");
......@@ -151,9 +201,12 @@ let vm = new Vue({
vm.title = "修改";
vm.getInfo(id);
},
saveOrUpdate: function (event) {
let url = vm.tbCfPosters.id == null ? "../tbcfposters/save" : "../tbcfposters/update";
let url = vm.tbCfPosters.id == null ? "../tbcfposters/save": "../tbcfposters/update";
vm.tbCfPosters.redirectUrl=event;
vm.tbCfPosters.postersType=this.typeActive;
Ajax.request({
url: url,
params: JSON.stringify(vm.tbCfPosters),
......@@ -166,6 +219,16 @@ let vm = new Vue({
}
});
},
getItemList: function () {
Ajax.request({
url: "../tbcfstationitem/list",
async: true,
successCallback: function (r) {
vm.itemList = r.list;
console(123456789, vm.itemList);
}
});
},
del: function (event) {
let ids = getSelectedRows("#jqGrid");
if (ids == null) {
......@@ -192,8 +255,46 @@ let vm = new Vue({
async: true,
successCallback: function (r) {
vm.tbCfPosters = r.tbCfPosters;
//数据回显
vm.typeActive = vm.tbCfPosters.postersType;
vm.vHandleChange(null,vm.typeActive)
if(vm.typeActive===0){
vm.link=vm.tbCfPosters.redirectUrl;
}else if(vm.typeActive===1){
let ARR_ids = vm.tbCfPosters.redirectUrl.split(',');
vm.CategoryLists1.forEach(item=>{
if(item.value===ARR_ids[0]) {
vm.categoryListsActive1 = item.value
}
})
if(ARR_ids[1]!='null'){
vm.changeSubCateType(()=>{
vm.CategoryLists2.forEach(item=>{
if(item.value===ARR_ids[1]){
vm.categoryListsActive2 = item.value
}
})
});
}
if(ARR_ids[2]!='null'){
vm.queryMiniCatagory(2,()=>{
vm.CategoryLists3.forEach(item=>{
if(item.value===ARR_ids[2]){
vm.categoryListsActive3 = item.value
}
})
});
}
}else if(vm.typeActive===2){
setTimeout(()=>{
vm.handleSearch(vm.tbCfPosters.redirectUrl);
},500)
}else if(vm.typeActive===3){
vm.tagListsActive = vm.tbCfPosters.redirectUrl;
}
}
});
},
reload: function (event) {
vm.showList = true;
......@@ -211,9 +312,38 @@ let vm = new Vue({
vm.reload();
},
handleSubmit: function (name) {
handleSubmitValidate(this, name, function () {
vm.saveOrUpdate()
});
let redirectUrl = null;
let postersType = this.typeActive; //海报类型
switch (this.typeActive) {
case 0:
redirectUrl = this.link;
redirectUrl?vm.saveOrUpdate(redirectUrl):this.$Message.info('请输入链接')
break;
case 1:
this.categoryListsActive1?(()=>{
redirectUrl = `${this.categoryListsActive1},${this.categoryListsActive2},${this.categoryListsActive3}`;
vm.saveOrUpdate(redirectUrl)
})():this.$Message.info('至少选择一种分类')
break;
case 2:
redirectUrl = getSelectedRows("#searchjqGrid")[0];
if(redirectUrl){
vm.saveOrUpdate(redirectUrl)
}
break;
case 3:
redirectUrl = this.tagListsActive;
if(redirectUrl){
vm.saveOrUpdate(redirectUrl)
}
break;
default :
vm.saveOrUpdate('')
break;
}
// handleSubmitValidate(this, name, function () {
// vm.saveOrUpdate()
// });
},
handleReset: function (name) {
handleResetForm(this, name);
......@@ -241,48 +371,175 @@ let vm = new Vue({
}
});
},
$(name){
$(name) {
return document.querySelectorAll(name);
},
//切换海报导航定向方式
vHandleChange(element,_index){
this.$('.v-radio').forEach((item,index)=>{
item.checked = false;
vHandleChange(element, _index) {
this.items.forEach((item, index) => {
item.isChecked = false
})
setTimeout(()=>{
this.$('.v-radio')[_index].checked = true;
_index!==3?this.$('.v-radio')[3].checked = false:null;
},0)
this.active = _index;
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;
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(){
this.search?alert('你搜索的内容是'+this.search):alert('未输入搜索内容~');
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}
],
multiselect: true,
multiboxonly:true,
beforeSelectRow: beforeSelectRow,
});
});
})() : alert('未输入搜索内容~');
},
/* 确定 */
submit(){
if(this.active===0){
this.$Message.info('你提交的内容是'+this.items[this.active].name)
}else if(this.active===1){
this.$Message.info('你提交的内容是'+this.items[this.active].name)
}else if(this.active===1){
this.$Message.info('你提交的内容是'+this.items[this.active].name)
}else {
this.$Message.info('你提交的内容是'+this.items[this.active].name)
//获取分类子页面二级分类数据
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
})
},
created(){
//查询三级分类
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
});
})
})
},
mounted(){
mounted() {
}
});
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论