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

分类导航栏优化

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