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

分类导航栏优化

上级 a79db849
...@@ -11,6 +11,7 @@ import org.springframework.scheduling.annotation.Scheduled; ...@@ -11,6 +11,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -41,7 +42,13 @@ public class FeeTask { ...@@ -41,7 +42,13 @@ public class FeeTask {
} }
public static void main(String[] args) { public static void main(String[] args) {
String str = "122,253,3555"; // String str = "122,253,3555";
System.out.println(str.substring(str.lastIndexOf(",") + 1)); // System.out.println(str.substring(str.lastIndexOf(",") + 1));
// Date date = new Date();
// String formatted = String.format("%d:%02d:%02d", date.getHours(), date.getMinutes(), date.getSeconds());
// System.out.println(formatted);
BigDecimal reduceAmount = new BigDecimal("0.0");
System.out.println(reduceAmount);
} }
} }
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
<result property="isShow" column="is_show"/> <result property="isShow" column="is_show"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="type" column="type"/> <result property="type" column="type"/>
<result property="categoryId" column="category_id"/> <result property="categoryId" column="category_id"/>
</resultMap> </resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfClassificationEntity"> <select id="queryObject" resultType="com.platform.entity.TbCfClassificationEntity">
select select
`id`, `id`,
`goodtype_id`, `goodtype_id`,
...@@ -32,45 +32,51 @@ ...@@ -32,45 +32,51 @@
where id = #{id} where id = #{id}
</select> </select>
<select id="queryList" resultType="com.platform.entity.TbCfClassificationEntity"> <select id="queryList" resultType="com.platform.entity.TbCfClassificationEntity">
select select
`id`, `id`,
`goodtype_id`, `goodtype_id`,
`type`, `type`,
`category_id`, `category_id`,
`class_title`, `class_title`,
`picture`, `picture`,
`sort`, `sort`,
`is_show`, `is_show`,
`create_time`, `create_time`,
`update_time` `update_time`
from tb_cf_classification from tb_cf_classification
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>
<if test="type != null ">
AND type =#{type}
</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 sort order by type,sort
</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 tb_cf_classification select count(*) from tb_cf_classification
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> <if test="type != null ">
AND type =#{type}
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfClassificationEntity"> <insert id="save" parameterType="com.platform.entity.TbCfClassificationEntity">
insert into tb_cf_classification( insert into tb_cf_classification(
`id`, `id`,
`goodtype_id`, `goodtype_id`,
...@@ -95,32 +101,32 @@ ...@@ -95,32 +101,32 @@
#{updateTime}) #{updateTime})
</insert> </insert>
<update id="update" parameterType="com.platform.entity.TbCfClassificationEntity"> <update id="update" parameterType="com.platform.entity.TbCfClassificationEntity">
update tb_cf_classification update tb_cf_classification
<set> <set>
<if test="goodtypeId != null">`goodtype_id` = #{goodtypeId}, </if> <if test="goodtypeId != null">`goodtype_id` = #{goodtypeId},</if>
<if test="type != null">`type` = #{type}, </if> <if test="type != null">`type` = #{type},</if>
<if test="categoryId != null">`category_id` = #{categoryId}, </if> <if test="categoryId != null">`category_id` = #{categoryId},</if>
<if test="classTitle != null">`class_title` = #{classTitle}, </if> <if test="classTitle != null">`class_title` = #{classTitle},</if>
<if test="picture != null">`picture` = #{picture}, </if> <if test="picture != null">`picture` = #{picture},</if>
<if test="sort != null">`sort` = #{sort}, </if> <if test="sort != null">`sort` = #{sort},</if>
<if test="isShow != null">`is_show` = #{isShow}, </if> <if test="isShow != null">`is_show` = #{isShow},</if>
<if test="createTime != null">`create_time` = #{createTime}, </if> <if test="createTime != null">`create_time` = #{createTime},</if>
<if test="updateTime != null">`update_time` = #{updateTime}</if> <if test="updateTime != null">`update_time` = #{updateTime}</if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
<delete id="delete"> <delete id="delete">
delete from tb_cf_classification where id = #{value} delete from tb_cf_classification where id = #{value}
</delete> </delete>
<delete id="deleteBatch"> <delete id="deleteBatch">
delete from tb_cf_classification where id in delete from tb_cf_classification where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
<i-col span="4"> <i-col span="4">
<i-input v-model="q.name" @on-enter="query" placeholder="名称"/> <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
</i-col> </i-col>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<i-select v-model="q.type" @on-enter="query" placeholder="类型" style="width:160px">
<i-option value="0">APP</i-option>
<i-option value="1">MOBILE</i-option>
</i-select>
<i-button @click="query">查询</i-button> <i-button @click="query">查询</i-button>
<i-button @click="reloadSearch">重置</i-button> <i-button @click="reloadSearch">重置</i-button>
</div> </div>
...@@ -34,28 +39,53 @@ ...@@ -34,28 +39,53 @@
<p slot="title">{{title}}</p> <p slot="title">{{title}}</p>
<i-form ref="formValidate" :model="tbCfClassification" :rules="ruleValidate" :label-width="80"> <i-form ref="formValidate" :model="tbCfClassification" :rules="ruleValidate" :label-width="80">
<Form-item label="标题" prop="classTitle"> <Form-item label="标题" prop="classTitle" style="width:800px">
<i-input v-model="tbCfClassification.classTitle" placeholder="标题"/> <i-input v-model="tbCfClassification.classTitle" placeholder="标题"/>
</Form-item> </Form-item>
<!--<Form-item label="商品一级分类" prop="goodtypeId"> <!--<Form-item label="商品一级分类" prop="goodtypeId">
<i-input v-model="tbCfClassification.goodtypeId" placeholder="商品一级分类"/> <i-input v-model="tbCfClassification.goodtypeId" placeholder="商品一级分类"/>
</Form-item>--> </Form-item>-->
<Form-item label="商品一级分类" prop="goodtypeId" > <Form-item label="类型" prop="type" style="width:800px">
<i-select placeholder="请选择" v-model="tbCfClassification.goodtypeId"> <i-select placeholder="请选择" v-model="tbCfClassification.type">
<i-option v-for="(el,i) in typeList" :key='i'
:value="el.value">{{el.label}}
</i-option>
</i-select>
</Form-item>
<Form-item label="一级商品分类" prop="goodtypeId" style="width:800px">
<i-select placeholder="请选择" v-model="tbCfClassification.goodtypeId" @on-change="changeGoodstype">
<i-option v-for="(el,i) in Goodstype" :key='i' <i-option v-for="(el,i) in Goodstype" :key='i'
:value="el.goodstypeId">{{el.goodstypeTitle}} :value="el.goodstypeId">{{el.goodstypeTitle}}
</i-option> </i-option>
</i-select> </i-select>
</Form-item> </Form-item>
<Form-item label="图片" prop="picture"> <Form-item label="二级商品分类" prop="categoryIdTwo" style="width:800px">
<i-select placeholder="请选择" v-model="categoryIdTwo" @on-change="changeGoodstype2">
<i-option v-for="(el,i) in Goodstype1" :key='i'
:value="el.goodstwotypeId">{{el.goodstwotypeTitle}}
</i-option>
</i-select>
</Form-item>
<Form-item label="三级商品分类" prop="categoryIdThree" style="width:800px">
<i-select placeholder="请选择" v-model="categoryIdThree">
<i-option v-for="(el,i) in Goodstype2" :key='i'
:value="el.descripitionId">{{el.descripitionName}}
</i-option>
</i-select>
</Form-item>
<Form-item label="图片" prop="picture" style="width:800px">
<img v-bind:src="tbCfClassification.picture" v-show="!!tbCfClassification.picture"/> <img v-bind:src="tbCfClassification.picture" v-show="!!tbCfClassification.picture"/>
<input type="file" placeholder="图片" @change="tirggerFile($event)"/> <input type="file" placeholder="图片" @change="tirggerFile($event)"/>
</Form-item> </Form-item>
<Form-item label="排序" prop="sort"> <Form-item label="排序" prop="sort" style="width:800px">
<i-input v-model="tbCfClassification.sort" placeholder="排序"/> <i-input v-model="tbCfClassification.sort" placeholder="排序"/>
</Form-item> </Form-item>
<Form-item label="是否展示" prop="isShow"> <Form-item label="是否展示" prop="isShow" style="width:800px">
<i-input v-model="tbCfClassification.isShow" placeholder="是否展示"/> <i-select placeholder="请选择" v-model="tbCfClassification.isShow">
<i-option v-for="(el,i) in showList1" :key='i'
:value="el.value">{{el.label}}
</i-option>
</i-select>
</Form-item> </Form-item>
<Form-item> <Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button> <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
...@@ -69,4 +99,4 @@ ...@@ -69,4 +99,4 @@
<script src="${rc.contextPath}/js/sys/tbcfclassification.js?_${date.systemTime}"></script> <script src="${rc.contextPath}/js/sys/tbcfclassification.js?_${date.systemTime}"></script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -649,7 +649,18 @@ typeFormat = function (cellvalue) { ...@@ -649,7 +649,18 @@ typeFormat = function (cellvalue) {
return returnStr; return returnStr;
} }
typeFormat2 = function (cellvalue) {
let returnStr = "未知"
if (!!cellvalue || cellvalue == '0') {
if (cellvalue == '0') {
returnStr = "APP";
} else if (cellvalue == '1') {
returnStr = "MOBILE";
}
}
return returnStr;
}
sortFormat = function (cellvalue) { sortFormat = function (cellvalue) {
let returnStr = "未知" let returnStr = "未知"
if (!!cellvalue || cellvalue == '0') { if (!!cellvalue || cellvalue == '0') {
......
...@@ -5,6 +5,7 @@ $(function () { ...@@ -5,6 +5,7 @@ $(function () {
{label: 'id', name: 'id', index: 'id', key: true, hidden: true}, {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
/*{label: '一级分类ID', name: 'goodtypeId', index: 'goodtype_id', width: 80},*/ /*{label: '一级分类ID', name: 'goodtypeId', index: 'goodtype_id', width: 80},*/
{label: '标题', name: 'classTitle', index: 'class_title', width: 80}, {label: '标题', name: 'classTitle', index: 'class_title', width: 80},
{label: '类型', name: 'type', index: 'type', width: 80 , formatter: typeFormat},
{label: '排序', name: 'sort', index: 'sort', width: 80}, {label: '排序', name: 'sort', index: 'sort', width: 80},
{label: '图片', name: 'picture', index: 'picture', width: 80, formatter: imageFormat}, {label: '图片', name: 'picture', index: 'picture', width: 80, formatter: imageFormat},
{label: '是否展示', name: 'isShow', index: 'is_show', width: 80, formatter: validFormat}, {label: '是否展示', name: 'isShow', index: 'is_show', width: 80, formatter: validFormat},
...@@ -15,10 +16,35 @@ $(function () { ...@@ -15,10 +16,35 @@ $(function () {
let vm = new Vue({ let vm = new Vue({
el: '#rrapp', el: '#rrapp',
data: { data: {
typeList: [
{
value: 0,
label: 'APP'
},
{
value: 1,
label: 'MOBILE'
}
],
showList1: [
{
value: 1,
label: '是'
},
{
value: 0,
label: '否'
}
],
Goodstype1: null,
Goodstype2: null,
showList: true, showList: true,
title: null, title: null,
changeGoodstype: null, // changeGoodstype: null,
Goodstype: null, Goodstype: null,
categoryIdTwo: null,
categoryIdThree: null,
tbCfClassification: {}, tbCfClassification: {},
ruleValidate: { ruleValidate: {
name: [ name: [
...@@ -26,10 +52,12 @@ let vm = new Vue({ ...@@ -26,10 +52,12 @@ let vm = new Vue({
] ]
}, },
q: { q: {
name: '' name: '',
type: ''
} }
}, },
methods: { methods: {
query: function () { query: function () {
vm.reload(); vm.reload();
}, },
...@@ -50,6 +78,19 @@ let vm = new Vue({ ...@@ -50,6 +78,19 @@ let vm = new Vue({
}, },
saveOrUpdate: function (event) { saveOrUpdate: function (event) {
let url = vm.tbCfClassification.id == null ? "../tbcfclassification/save" : "../tbcfclassification/update"; let url = vm.tbCfClassification.id == null ? "../tbcfclassification/save" : "../tbcfclassification/update";
let categoryId;
let goodtypeId = vm.tbCfClassification.goodtypeId;
if (goodtypeId != null) {
categoryId = goodtypeId;
}
if (this.categoryIdTwo != null) {
categoryId = categoryId + "," + this.categoryIdTwo;
}
if (this.categoryIdThree != null) {
categoryId = categoryId + "," + this.categoryIdThree;
}
vm.tbCfClassification.categoryId = categoryId
console.log('categoryId', categoryId)
Ajax.request({ Ajax.request({
url: url, url: url,
params: JSON.stringify(vm.tbCfClassification), params: JSON.stringify(vm.tbCfClassification),
...@@ -62,6 +103,58 @@ let vm = new Vue({ ...@@ -62,6 +103,58 @@ let vm = new Vue({
} }
}); });
}, },
changeGoodstype(e) {
let url;
if (e != null) {
url = "../tbcfstationitem/queryByItemType?typeId=" + e;
} else {
url = "../tbcfstationitem/queryByItemType?typeId=" + this.tbCfClassification.goodtypeId;
}
console.log('url', url)
let that = this;
Ajax.request({
url: url,
type: "get",
contentType: "application/json",
successCallback: function (r) {
console.log('二级', r)
if (r.code === 0) {
that.Goodstype1 = r.list
e ? setTimeout(() => {
that.changeGoodstype2()
}, 0) : void (0);
if (r.list.length === 0) {
that.categoryIdTwo = null
// that.q.itemCategorytwo = null
}
}
}
});
},
changeGoodstype2(e) {
let url;
if (e != null) {
url = "../tbcfstationitem/queryByItemTypeTwo?typeTwoId=" + e;
} else {
url = "../tbcfstationitem/queryByItemTypeTwo?typeTwoId=" + this.categoryIdTwo;
}
let that = this;
Ajax.request({
url: url,
type: "get",
contentType: "application/json",
successCallback: function (r) {
console.log('三级', r.descripiton)
if (r.code === 0) {
that.Goodstype2 = r.descripiton
if (r.descripiton.length === 0) {
that.categoryIdThree = null
// that.q.itemDescritionId = null
}
}
}
});
},
del: function (event) { del: function (event) {
let ids = getSelectedRows("#jqGrid"); let ids = getSelectedRows("#jqGrid");
if (ids == null) { if (ids == null) {
...@@ -88,6 +181,18 @@ let vm = new Vue({ ...@@ -88,6 +181,18 @@ let vm = new Vue({
async: true, async: true,
successCallback: function (r) { successCallback: function (r) {
vm.tbCfClassification = r.tbCfClassification; vm.tbCfClassification = r.tbCfClassification;
vm.changeGoodstype();
vm.changeGoodstype2();
let categoryId = vm.tbCfClassification.categoryId;
let idArr = categoryId.split(',');
if (idArr.length == 2) {
vm.categoryIdTwo = idArr[1]
} else if (idArr.length == 3) {
vm.categoryIdTwo = idArr[1]
vm.categoryIdThree = idArr[2]
}
} }
}); });
}, },
...@@ -95,14 +200,15 @@ let vm = new Vue({ ...@@ -95,14 +200,15 @@ let vm = new Vue({
vm.showList = true; vm.showList = true;
let page = $("#jqGrid").jqGrid('getGridParam', 'page'); let page = $("#jqGrid").jqGrid('getGridParam', 'page');
$("#jqGrid").jqGrid('setGridParam', { $("#jqGrid").jqGrid('setGridParam', {
postData: {'name': vm.q.name}, postData: {'name': vm.q.name,'type': vm.q.type},
page: page page: page
}).trigger("reloadGrid"); }).trigger("reloadGrid");
vm.handleReset('formValidate'); vm.handleReset('formValidate');
}, },
reloadSearch: function () { reloadSearch: function () {
vm.q = { vm.q = {
name: '' name: '',
type: ''
}; };
vm.reload(); vm.reload();
}, },
...@@ -145,4 +251,4 @@ let vm = new Vue({ ...@@ -145,4 +251,4 @@ let vm = new Vue({
}) })
} }
}); });
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论