Authored by xuhongyun

Merge branch 'hotfix_0926_leo' into test

... ... @@ -2,22 +2,22 @@ module.exports = function (app){
app.get("/shop/shopCategory/index", "shop.ShopCategory.Index", function (req,res){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理"
pageName:"店铺商品分类"
}
});
app.get("/shop/shopCategory/index/:shopId", "shop.ShopCategory.Index", function (req,res){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理"
pageName:"店铺商品分类"
}
});
app.get("/shop/shopCategory/edit/:shopId/:categoryId/", "shop.ShopCategory.Edit", ["shopCategory_selectShopNameById", "shopCategory_selectCategoryNameById"], function (rs1, rs2){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理",
subPageName:"店铺销售类目编辑",
pageName:"店铺商品分类",
subPageName:"店铺商品分类编辑",
shopName: rs1.data,
categoryName: rs2.data
}
... ... @@ -26,19 +26,26 @@ module.exports = function (app){
app.get("/shop/shopCategory/info/:shopId/:categoryId/", "shop.ShopCategory.Info", ["shopCategory_selectShopNameById", "shopCategory_selectCategoryNameById"], function (rs1, rs2){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理",
subPageName:"店铺销售类目详情",
pageName:"店铺商品分类",
subPageName:"店铺商品分类详情",
shopName: rs1.data,
categoryName: rs2.data
}
});
app.get("/shop/shopCategory/batch", "shop.ShopCategory.Batch", function (req,res){
this.$extend={
moduleName:"店铺管理",
pageName:"批量设置"
}
});
/*****************************Vue单页面写法*****************************/
app.vue("/shop/shopCategory", "shop.ShopCategory", function (req,res){
this.$extend={
moduleName:"店铺管理",
pageName:"店铺销售类目管理"
pageName:"店铺商品分类"
}
});
... ...
... ... @@ -60,7 +60,7 @@ module.exports={
{name:"shopId",type:"Number"},
{name:"categoryId",type:"Number"},
{name:"productSKN",type:"Number"},
{name:"factoryCode",type:"String"},
{name:"productName",type:"String"},
{name:"page",type:"Number"}
]
},
... ... @@ -72,7 +72,7 @@ module.exports={
{name:"shopId",type:"Number"},
{name:"categoryId",type:"Number"},
{name:"productSKN",type:"Number"},
{name:"factoryCode",type:"String"},
{name:"productName",type:"String"},
{name:"page",type:"Number"}
]
},
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div class="panel" style="margin-bottom:10px;">
<a href="javascript:;" class="btn btn-info btn-return">返回列表</a>
<table class="table table-bordered" style="border:1px solid #ddd; margin-top: 10px">
<tr>
<td rowspan="2">商品关联导表</td>
<td>上传EXCEL:</td>
<td style="position: relative;"><input id="shop-category-skn" name="file" data-type="shopCategorySkn" type="file" style="cursor: pointer; height: 37px; top: 8px;"></td>
</tr>
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、Excel表头为:<span style="color: #67D267;">类目ID,SKN</span><br>
3、第一行为表头内容,第二行开始为正式内容<br>
4、每个文件控制在2500行以内<br>
5、<a href="/ajax/link/categoryLinkProduct">下载样例</a>
</td>
</tr>
</table>
</div>
</div>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
... ... @@ -7,7 +7,7 @@
<div id="shopInfo">
<span id="shopId"><font color="#999">店铺ID:</font><b>--</b></span>
<span id="shopName" style="margin: 0 20px"><font color="#999">店铺名称:</font><b><%shopName%></b></span>
<span id="categoryName"><font color="#999">销售类目名称:</font><b><%categoryName%></b></span>
<span id="categoryName"><font color="#999">商品分类名称:</font><b><%categoryName%></b></span>
<a href="javascript:" class="btn btn-default btn-return" style="float: right">返回</a>
</div>
</div>
... ... @@ -21,7 +21,7 @@
<div class="mainTable" style="padding: 20px 20px 60px; 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;
<input id="productName" type="text" class="form-control" placeholder="商品名称" />&nbsp;&nbsp;
<a href="javascript:" class="btn btn-info filter-btn">查询</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
<a href="javascript:" class="btn btn-danger cancelAll" style="float: right;display: none">全部取消</a>
... ...
... ... @@ -27,7 +27,7 @@
<script type="text/template" id="addTemplate">
<div class="form-horizontal" id="shopCategoryAdd">
<div class="form-group">
<label for="categoryName" class="col-sm-3 control-label">销售类目名称:</label>
<label for="categoryName" class="col-sm-3 control-label">商品分类名称:</label>
<div class="col-sm-5">
<input type="text" id="categoryName" value="[[data]]" class="form-control" maxlength="30" />
</div>
... ... @@ -38,9 +38,10 @@
<script type="text/template" id="listTemplate">
<div class="addCategory" style="margin-bottom: 20px">
<a class="btn btn-success addBtn"><i class="fa fa-plus"></i> 新增销售类目</a>
<a class="btn btn-success addBtn"><i class="fa fa-plus"></i> 新增商品分类</a>
<a href="javascript:;" class="btn btn-primary large btn-batch-import">批量(关联商品分类)</a>
<span style="float: right;font-size: 16px;line-height:37px;font-family:'simhei'">
当前店铺共有:<b style="color: #5cb85c;font-size: 20px">[[data.length]]</b>&nbsp;条销售类目,<font color="#f0ad4e">最多可以添加20条</font>
当前店铺共有:<b style="color: #5cb85c;font-size: 20px">[[data.length]]</b>&nbsp;条商品分类,<font color="#f0ad4e">最多可以添加20条</font>
</span>
</div>
<table class="table table-striped table-bordered responsive dataTable no-footer" style="text-align: center">
... ... @@ -70,7 +71,7 @@
</tr>
[[/each]]
[[else]]
<tr><td colspan="6">当前店铺暂无销售类目</td></tr>
<tr><td colspan="6">当前店铺暂无商品分类</td></tr>
[[/if]]
</tbody>
</table>
... ...
... ... @@ -7,7 +7,7 @@
<div id="shopInfo">
<span id="shopId"><font color="#999">店铺ID:</font><b>--</b></span>
<span id="shopName" style="margin: 0 20px"><font color="#999">店铺名称:</font><b><%shopName%></b></span>
<span id="categoryName"><font color="#999">销售类目名称:</font><b><%categoryName%></b></span>
<span id="categoryName"><font color="#999">商品分类名称:</font><b><%categoryName%></b></span>
<a href="javascript:" class="btn btn-default btn-return" style="float: right">返回</a>
</div>
</div>
... ...
'use strict';
var $ = require('jquery'),
common = require('../../../common/common');
$('input[type="file"]').after('<div class="file-name btn btn-default">请选择文件</div>');
function batchExport(el, type) {
var loadModal = null;
var shopId = getShopIdInUri();
return {
params: {
type: type,
__type: "batch-import",
args: shopId
},
onStart: function() {
loadModal = common.dialog.load();
$(el).parents('td').find('.file-name').text($(el).val().replace("C:\\fakepath\\", ""));
},
onComplete: function(response) {
console.log(response);
if (loadModal) {
loadModal.close();
}
if (response.code == 200) {
common.util.__tip(response.message, 'success');
} else {
common.util.__tip(response.message, 'warning');
}
$(el).parents('td').find('.file-name').text("请选择文件");
}
}
}
common.edit.ajaxfileupload('#shop-category-skn', batchExport('#shop-category-skn', 'categoryLinkProduct'));
function getShopIdInUri() {
var shopId = null;
// shop/shopCategory/batch?shopId=15
var uri = location.href + "";
var param = uri.substring(uri.indexOf('?shopId'));
var paramList = param.split("=");
if(paramList.length > 0) {
shopId = paramList[1];
}
return shopId;
}
// 返回至index页面,并选择店铺
$(document).on('click', '.btn-return', function() {
var shopId = getShopIdInUri();
location.href = "/shop/shopCategory/index/" + shopId;
})
\ No newline at end of file
... ...
... ... @@ -14,7 +14,7 @@ var g1 = new common.grid({
shopId: curShopId,
categoryId: curCategoryId,
productSKN: common.util.__input("productSKN"),
factoryCode: common.util.__input("factoryCode")
productName: common.util.__input("productName")
};
},
columns: [
... ... @@ -22,11 +22,10 @@ var g1 = new common.grid({
return item.productPic ? '<img src="'+item.productPic+'?imageView/0/w/40/h/60">' : '';
}},
{display: "SKN", name: "productSKN"},
{display: "厂家编号", name: "factoryCode"},
{display: "商品名称", name: "productName"},
{display: "销售价(元)", name: "salePrice"},
{display: "分类", name: "productSort"},
{display: "销售类目", render: function (item) {
{display: "商品分类", render: function (item) {
var name = item.categoryName ? item.categoryName : '未分类';
var categoryList = '<span class="name" style="display: block; text-align: center">'+ name +'</span>';
if(item.saleCategory && item.saleCategory.length > 1){
... ... @@ -61,7 +60,7 @@ var g2 = new common.grid({
shopId: curShopId,
categoryId: curCategoryId,
productSKN: common.util.__input("productSKN"),
factoryCode: common.util.__input("factoryCode")
productName: common.util.__input("productName")
};
},
columns: [
... ... @@ -69,11 +68,10 @@ var g2 = new common.grid({
return item.productPic ? '<img src="'+item.productPic+'?imageView/0/w/40/h/60">' : '';
}},
{display: "SKN", name: "productSKN"},
{display: "厂家编号", name: "factoryCode"},
{display: "商品名称", name: "productName"},
{display: "销售价(元)", name: "salePrice"},
{display: "分类", name: "productSort"},
{display: "销售类目", render: function (item) {
{display: "商品分类", render: function (item) {
var name = item.categoryName ? item.categoryName : '未分类';
var categoryList = '<span class="name" style="display: block; text-align: center">'+ name +'</span>';
if(item.saleCategory && item.saleCategory.length > 1){
... ... @@ -192,7 +190,7 @@ $(document).on("click", ".cancelAll", function () {
);
});
//查看更多销售类目
//查看更多商品分类
$(document).on("click", ".moreCategory", function () {
var num = $(this).data('num');
if($(this).hasClass('open')){
... ...
... ... @@ -27,11 +27,11 @@ var Bll = {
Bll.showList(0);
}
},
//新增,编辑销售类目名称
//新增,编辑商品分类名称
toast: function (type, url, name, id) {
var self = this;
common.dialog.confirm(
type == 0 ? "新增销售类目" : "编辑销售类目",
type == 0 ? "新增商品分类" : "编辑商品分类",
common.util.__template2($("#addTemplate").html(),{data:name}),
function () {
var categoryName = $('#categoryName').val();
... ... @@ -47,7 +47,7 @@ var Bll = {
self.showList(0);
});
}else{
common.util.__tip('店铺销售类目名称不能为空!');
common.util.__tip('店铺商品分类名称不能为空!');
return false;
}
}
... ... @@ -124,7 +124,7 @@ $(document).on('click', '.addBtn', function () {
if(currentShopCategoryNum < 20){
Bll.toast(0, '/shops/shopCategory/add', '', null);
}else {
common.util.__tip('店铺最多添加只能添加20个销售类目!');
common.util.__tip('店铺最多添加只能添加20个商品分类!');
}
});
... ... @@ -141,10 +141,17 @@ $(document).on('click', '.deleteBtn', function () {
var categoryId = $(this).data('categoryid');
common.dialog.confirm(
"删除店铺销售类目",
"你确定<b style='color: #ff0000'>&nbsp;删除&nbsp;</b>销售类目<b style='color:#428bca'>&nbsp;"+categoryName+"&nbsp;</b>么?",
"删除店铺商品分类",
"你确定<b style='color: #ff0000'>&nbsp;删除&nbsp;</b>商品分类<b style='color:#428bca'>&nbsp;"+categoryName+"&nbsp;</b>么?",
function () {
Bll.deleteCategory(categoryId);
}
)
});
\ No newline at end of file
});
// 跳转到批量操作页面,此处需要在URL中追加当前选择的ShopId
$(document).on('click', '.btn-batch-import', function () {
var uri = "/shop/shopCategory/batch?shopId=" + currentShopId;
location.href = uri;
})
\ No newline at end of file
... ...