Authored by dongjunjie

提交

... ... @@ -13,34 +13,36 @@ module.exports = function (app){
}
});
app.vue("/shop/shopCategory", "shop.ShopCategory", function (req,res){
app.get("/shop/shopCategory/info/:shopId/:categoryId", "shop.ShopCategory.Info", function (rs,req,res){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理"
pageName:"店铺销售类目管理",
subPageName:"店铺销售类目详情"
}
});
app.vue("/shop/shopCategory/add", "shop.ShopCategory.Info", function (rs,req,res){
app.get("/shop/shopCategory/edit/:shopId/:categoryId", "shop.ShopCategory.Edit", function (rs,req,res){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理",
subPageName:"新增店铺销售类目"
subPageName:"店铺销售类目编辑"
}
});
app.get("/shop/shopCategory/info/:shopId", "shop.ShopCategory.Info", function (rs,req,res){
/*****************************Vue单页面写法*****************************/
app.vue("/shop/shopCategory", "shop.ShopCategory", function (req,res){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理",
subPageName:"店铺销售类目详情"
pageName:"店铺销售类目管理"
}
});
app.get("/shop/shopCategory/edit/:shopId", "shop.ShopCategory.Edit", function (rs,req,res){
app.vue("/shop/shopCategory/add", "shop.ShopCategory.Info", function (rs,req,res){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理",
subPageName:"店铺销售类目编辑"
subPageName:"新增店铺销售类目"
}
});
... ... @@ -56,5 +58,11 @@ module.exports = function (app){
//删除店铺销售类目
app.post("/shops/shopCategory/delete","shopCategory_deleteShopsCategory");
//获取店铺下该类目所有商品接口
app.post("/shops/shopCategory/allProducts","shopCategory_selectAllProduct");
//获取店铺下该类目已选商品接口
app.post("/shops/shopCategory/selectedProducts","shopCategory_selectCheckedProduct");
}
... ...
... ... @@ -37,6 +37,28 @@ module.exports={
{name:"shopsId",type:"Number"},
{name:"categoryId",type:"Number"}
]
},
selectAllProduct:{
title:"获取店铺下该类目所有商品接口",
url:"/ShopsSalesCategoryRest/selectAllProduct",
params:[
{name:"shopsId",type:"Number"},
{name:"categoryId",type:"Number"},
{name:"productSKN",type:"Number"},
{name:"factoryCode",type:"String"}
]
},
selectCheckedProduct:{
title:"获取店铺下该类目已选商品接口",
url:"/ShopsSalesCategoryRest/selectCheckedProduct",
params:[
{name:"shopsId",type:"Number"},
{name:"categoryId",type:"Number"},
{name:"productSKN",type:"Number"},
{name:"factoryCode",type:"String"}
]
}
}
}
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div class="panel">
<div class="selectShop" style="font-family:'microsoft yahei';font-size: 18px;line-height: 40px;margin-bottom: 20px">
<div id="shopInfo">
<span id="shopId"><font color="#999">店铺ID:</font><b>--</b></span>
<span id="shopName" style="margin-left: 20px"><font color="#999">店铺名称:</font><b>--</b></span>
</div>
</div>
<div class="panel-body" style="background: #eeeeee">
<div class="setCategoryName form-inline" style="margin-bottom: 20px">
<div class="form-group">
<label>销售类目名称:</label>
<input type="text" class="form-control" />
</div>
<div class="submit form-group" style="float: right">
<a href="javascript:" class="btn btn-success btn-save">保存</a>
<a href="javascript:" class="btn btn-default">返回</a>
</div>
</div>
<div class="tabheader">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:">全部商品</a></li>
<li><a href="javascript:">已选(<b class="selectedProductsNum">0</b>)</a></li>
</ul>
</div>
<div class="mainTable" style="padding: 20px; border: 1px solid #ddd; background: #FFFFFF">
<div class="filter form-inline" style="margin-bottom: 20px">
<input id="productSKN" type="text" class="form-control" placeholder="SKN" />&nbsp;&nbsp;
<input id="factoryCode" type="text" class="form-control" placeholder="商家编码" />&nbsp;&nbsp;
<a href="javascript:" class="btn btn-primary filter-btn">查询</a>
<a href="javascript:" class="btn btn-warning cancelAll" style="float: right;display: none">全部取消</a>
</div>
<div id="productTable"></div>
</div>
</div>
</div>
</div>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
... ... @@ -50,8 +50,8 @@
<td style="line-height: 27px">[[item.createTime]]</td>
<td style="line-height: 27px">[[item.productNum]]</td>
<td style="line-height: 27px">
<a href='/shop/shopCategory/edit/[[item.id]]' class='btn btn-xs btn-primary'>编辑</a>
<a href='/shop/shopCategory/info/[[item.id]]' class='btn btn-xs btn-info'>查看</a>
<a href='/shop/shopCategory/edit/[[shopId]]/[[item.categoryId]]' class='btn btn-xs btn-primary'>编辑</a>
<a href='/shop/shopCategory/info/[[shopId]]/[[item.categoryId]]' class='btn btn-xs btn-info'>查看</a>
<a href='javascript:' class='btn btn-xs btn-danger deleteBtn' data-index='"+_index+"'>删除</a>
</td>
</tr>
... ...
... ... @@ -42,8 +42,8 @@ var Iaccount = {
var apiCofig = {
//root:__dirname,
EnvConst:{
domain:"http://192.168.102.210:8088/platform",
//domain:"http://172.16.6.200:8088/platform",
//domain:"http://192.168.102.210:8088/platform",
domain:"http://172.16.6.164:8088/platform",
yohoSearch: 'http://192.168.102.216:8080/yohosearch',
system:Iaccount
},
... ...
'use strict';
var $ = require('jquery'),
common = require('../../../common/common');
var curShopId = -1,
curCategoryId = 0,
selectedList = [], //店铺下改类目所有已选商品
selectedSknList = []; //店铺下改类目所有已选商品skn
var g1 = new common.grid({
el: '#productTable',
parms: function() {
return {
shopsId: curShopId,
categoryId: curCategoryId,
productSKN: common.util.__input("productSKN"),
factoryCode: common.util.__input("factoryCode")
};
},
columns: [
{display: "商品图片", render: function (item) {
return item.imageUrl ? '<img src="'+item.imageUrl+'?imageView/0/w/78/h/78">' : '';
}},
{display: "SKN", name: "productSKN"},
{display: "商品名称", name: "productName"},
{display: "销售价(元)", name: "salePrice"},
{display: "分类", name: "productSort"},
{display: "操作", render: function (item) {
if(item.checked){
return '<a href="javascript:" class="btn btn-warning btn-xs cancelProduct" data-index="'+item.__index+'">取消选择</a>'
}else{
return '<a href="javascript:" class="btn btn-info btn-xs selectProduct" data-index="'+item.__index+'">选择</a>'
}
}}
]
});
var g2 = new common.grid({
el: '#productTable',
parms: function() {
return {
shopsId: curShopId,
categoryId: curCategoryId,
productSKN: common.util.__input("productSKN"),
factoryCode: common.util.__input("factoryCode")
};
},
columns: [
{display: "商品图片", render: function (item) {
return item.imageUrl ? '<img src="'+item.imageUrl+'?imageView/0/w/78/h/78">' : '';
}},
{display: "SKN", name: "productSKN"},
{display: "商品名称", name: "productName"},
{display: "销售价(元)", name: "salePrice"},
{display: "分类", name: "productSort"},
{display: "操作", render: function (item) {
return '<a href="javascript:" class="btn btn-warning btn-xs cancelProduct" data-index="'+item.__index+'">取消选择</a>'
}}
]
});
var Bll = {
init: function () {
this.getParamsInUrl();
g1.init('/shops/shopCategory/allProducts');
},
getParamsInUrl: function () {
var paramUrl = location.href + "";
var param = paramUrl.substring(paramUrl.indexOf("edit"));
var paramList = param.split("/");
if(paramList.length > 1){
curShopId = paramList[1];
curCategoryId = paramList[2];
}
}
};
Bll.init();
//tab切换
$(document).on("click", ".nav-tabs li", function () {
if($(this).hasClass('active')) return false;
$(this).addClass('active').siblings().removeClass('active');
var _index = $(this).index();
switch (_index){
case 0:
$('.cancelAll').hide();
g1.init('/shops/shopCategory/allProducts');
break;
case 1:
$('.cancelAll').show();
g2.init('/shops/shopCategory/selectedProducts');
break;
}
});
//选择商品
$(document).on("click", ".selectProduct", function () {
var index = $(this).data("index");
var item = g1.rows[index];
});
//在全部商品中,取消选择商品
$(document).on("click", ".cancelProduct2", function () {
var index = $(this).data("index");
var item = g1.rows[index];
});
//在已选商品中,取消选择商品
$(document).on("click", ".cancelProduct", function () {
var index = $(this).data("index");
var item = g2.rows[index];
});
//筛选
$(document).on("click", ".filter-btn", function () {
var _index = $('.nav-tabs li.active').index();
if(_index == 0){
g1.reload();
}else{
g2.reload();
}
});
\ No newline at end of file
... ...
... ... @@ -34,7 +34,7 @@ var Bll = {
console.log(data);
currentShopCategoryNum = data.length;
$('#initCategory').hide();
$('#showCategory').html(common.util.__template2($("#listTemplate").html(),{data:data})).show();
$('#showCategory').html(common.util.__template2($("#listTemplate").html(),{shopId:currentShopId, data:data})).show();
},true)
},
//删除销售类目
... ... @@ -84,11 +84,8 @@ $(document).on('change', '#shop-select', function () {
$('#shopName b').text(shopName);
Bll.showList(shopId,1);
// $('#initCategory').hide();
// $('#showCategory').html(common.util.__template2($("#listTemplate").html(),{data:[{id:'1',name:'dada',date:'ff',num:'23'}]})).show();
}else{
alert(1)
Bll.deleteCategory();
Bll.destoryCategory();
}
});
... ...