Commit 37f512a2 by 施宇

Merge branch 'sy_ic_1016'

# Conflicts:
#	dist/js/quoteprice/releaseinquiry.js
parents 44837207 e38ea008
...@@ -98,17 +98,6 @@ ...@@ -98,17 +98,6 @@
{{# } }} {{# } }}
<div class=" goods_desc boxsiz"> <div class=" goods_desc boxsiz">
<div class="title"> <div class="title">
<div class="fr title_right">
{{# if(d['audit_status'] == 1){ }}
{{# if(d['status'] == 1){ }}
<span class="mark lineBlock zs"></span><span class="text">展示中</span>
{{# } else { }}
<span class="mark lineBlock xj"></span><span class="text">已下架</span>
{{# } }}
{{# } else { }}
<span class="mark lineBlock jy"></span><span class="text">禁用中</span>
{{# } }}
</div>
<div class="title_left"> <div class="title_left">
<h3 class="bold fl boxsiz goods_name">{{d.goods_name}}</h3> <h3 class="bold fl boxsiz goods_name">{{d.goods_name}}</h3>
<div class="price fl bold boxsiz"> <div class="price fl bold boxsiz">
......
...@@ -2,229 +2,186 @@ ...@@ -2,229 +2,186 @@
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<include file="Common@public/header"/> <include file="Common@public/header" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/goodmanage.css"> <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/goodmanage.css">
</head> </head>
<body> <body>
<div class="wrapper"> <div class="wrapper">
<include file="Common@public/navleft"/> <include file="Common@public/navleft" />
<div class="wrapper_right"> <div class="wrapper_right">
<include file="Common@public/top"/> <include file="Common@public/top" />
<div class="right_content good_manage_content"> <div class="right_content good_manage_content">
<div class="content"> <div class="content">
<div class="nav_title">商品管理 > 商品列表</div> <div class="nav_title">商品管理 > 商品列表</div>
<div class="good_total clr"> <div class="good_total clr">
<div class="fl my_good"> <div class="fl my_good">
<h3>--</h3> <h3>--</h3>
<p>我的商品</p> <p>我的商品</p>
</div>
<div class="fl week_good">
<h3>--</h3>
<p>本周新增</p>
</div>
<div class="fl no_good">
<h3>--</h3>
<p>等待完善</p>
</div>
<div class="center_line line1"></div>
<div class="center_line line2"></div>
</div>
<div class="filter_section layui-form clr">
<div class="fr">
<div class="btn_div fr">
<a class="cx lineBlock btn nohover btn_blue" lay-submit lay-filter="search">查询</a>
</div> </div>
<div class="date_div fr"> <div class="fl week_good">
<span class="fl">日期选择:</span> <h3>--</h3>
<div class="start_date_div fl"> <p>本周新增</p>
<div class="icon_div fl icon iconfont iconjuxing13"></div> </div>
<input type="text" name="start_time" placeholder="开始日期" class="fl boxsiz" id="start_time"> <div class="fl no_good">
<h3>--</h3>
<p>等待完善</p>
</div>
<div class="center_line line1"></div>
<div class="center_line line2"></div>
</div>
<div class="filter_section layui-form clr">
<div class="fr">
<div class="btn_div fr">
<a class="cx lineBlock btn nohover btn_blue" lay-submit lay-filter="search">查询</a>
</div> </div>
<div class="fl heng"></div> <div class="date_div fr">
<div class="end_date_div fl"> <span class="fl">日期选择:</span>
<div class="icon_div fl icon iconfont iconjuxing13"> <div class="start_date_div fl">
<div class="icon_div fl icon iconfont iconjuxing13"></div>
<input type="text" name="start_time" placeholder="开始日期" class="fl boxsiz"
id="start_time">
</div>
<div class="fl heng"></div>
<div class="end_date_div fl">
<div class="icon_div fl icon iconfont iconjuxing13">
</div>
<input type="text" name="end_time" placeholder="结束日期" class="fl boxsiz"
id="end_time">
</div> </div>
<input type="text" name="end_time" placeholder="结束日期" class="fl boxsiz" id="end_time">
</div>
</div>
</div> </div>
<div class="layui-form-style fr"> <div class="input_div boxsiz">
<span class="lineBlock">状态:</span> <span class="lineBlock">商品型号:</span>
<select name="status/eq"> <div class="boxsiz">
<option value=""></option> <input type="text" placeholder="请输入型号" class="boxsiz" name="goods_name/like">
<option value="1">上架</option> </div>
<option value="2">下架</option>
<option value="3">禁用</option>
</select>
</div> </div>
</div> </div>
<div class="input_div boxsiz"> <div class="gb">
<span class="lineBlock">商品型号:</span> <span class="icon iconfont iconjuxing19 va-m"></span>
<div class="boxsiz"> <span>目前商品sku上限为2000条,超出部分将上传失败。</span>
<input type="text" placeholder="请输入型号" class="boxsiz" name="goods_name/like">
</div>
</div> </div>
</div> <div class="btn_group clr">
<div class="gb"> <div class="fl more-delete">
<span class="icon iconfont iconjuxing19 va-m"></span> <span class="gx-status wxz"></span>
<span>目前商品sku上限为2000条,超出部分将上传失败。</span> <span class="plsc-text">批量删除</span>
</div> </div>
<div class="btn_group clr"> <div class="dgsc fr btn btn_blue">
<div class="dgsc fl btn btn_blue"> <span class="icon iconfont iconjuxing16"></span>
<span class="icon iconfont iconjuxing16"></span> 上传商品
上传商品 </div>
</div> <div class="plsc fr btn btn_green">
<div class="xz fr boxsiz btn btn_border"> <span class="icon iconfont iconjuxing16 "></span>
<a href="__PUBLIC__/ic_templet.xls">下载商品模板</a> 批量上传
</div>
<div class="xz fr boxsiz btn btn_border">
<a href="__PUBLIC__/ic_templet.xls">下载商品模板</a>
</div>
<div class="cl fr boxsiz btn disabled">
擦亮商品
</div>
</div> </div>
<div class="plsc fr btn btn_green"> <div class="good_data" id='listData'>
<span class="icon iconfont iconjuxing16 "></span>
批量上传
</div> </div>
</div> </div>
<div class="good_data" id='listData'>
<!-- <div class="data_list">
<div class="data_item">
<div class="data_detail">
<div class="type fl ellipsis boxsiz">
<span class="bold">STM32F103ZET6STM32F103ZET6</span>
<span class="icon iconfont iconjuxing17"></span>
</div>
<div class="brand fl ellipsis boxsiz">
品牌:<span>Texas Instrument</span>
</div>
<div class="num fl ellipsis boxsiz">库存:
<span>PCS10,000</span>
</div>
<div class="price fl ellipsis boxsiz bold">¥1.8835</div>
<div class="data_status fl boxsiz zs">
<span class="mark lineBlock"></span>
<span class="text">展示中</span>
</div>
<div class="time fr ellipsis boxsiz">2019-05-22 15:35</div>
</div>
<a class="xj fr">下架</a>
<a class="edit fr">编辑</a>
</div>
</div>
<div class="no_data" style="display: none">
<img src="__PUBLIC__/images/nosearchdata.png" alt="">
<p class="bold">未搜索到询价信息</p>
</div>-->
</div>
</div> </div>
</div> </div>
</div>
</div> </div>
<include file="Common@public/foot"/> <include file="Common@public/foot" />
<script src="__PUBLIC__/js/goodmanage/index.js"></script> <script src="__PUBLIC__/js/goodmanage/index.js"></script>
<script type="text/html" id="listHtml"> <script type="text/html" id="listHtml">
<div class="data_list"> <div class="data_list">
{{# layui.each(d, function(index, item){ }} {{# layui.each(d, function(index, item){ }}
<div class="data_item" goodid="{{item.goods_id}}"> <div class="data_item" goodid="{{item.goods_id}}">
<div class="data_detail"> <div class="data_detail">
<div class="type fl boxsiz"> <div class="type fl boxsiz">
<span class="text lineBlock va-m bold ellipsis">{{item.goods_name}}</span> <div class="gx-div lineBlock">
{{# if(item['goods_images']){ }} <span class="gx-status wxz" goodid="{{item.goods_id}}"></span>
<div class="icon iconfont iconjuxing17 lineBlock"> </div>
<i></i> <span class="text lineBlock va-m bold ellipsis">{{item.goods_name}}</span>
<img src="{{item.goods_images}}" alt="" class="img_show"> {{# if(item['goods_images']){ }}
<div class="icon iconfont iconjuxing17 lineBlock">
<i></i>
<img src="{{item.goods_images}}" alt="" class="img_show">
</div>
{{# } }}
</div> </div>
{{# } }} <div class="brand fl ellipsis boxsiz">
</div> 品牌:<span>{{item.brand_name}}</span>
<div class="brand fl ellipsis boxsiz"> </div>
品牌:<span>{{item.brand_name}}</span> <div class="num fl ellipsis boxsiz">库存:
</div> <span>{{item.stock}}</span>
<div class="num fl ellipsis boxsiz">库存: </div>
<span>{{item.stock}}</span> <div class="price fl ellipsis boxsiz bold">
</div> {{# if(item.currency == 1){ }}
<div class="price fl ellipsis boxsiz bold">
{{# if(item.currency == 1){ }} {{# } else { }}
$
{{# } else { }} {{# } }}
$ {{item.price}}
{{# } }} </div>
{{item.price}}
</div> {{# if(item['update_time'] > item['morning_time']){ }}
{{# if(item['audit_status'] == 1){ }}
{{# if(item['status'] == 1){ }}
<div class="data_status fl boxsiz zs"> <div class="data_status fl boxsiz zs">
<span class="mark lineBlock"></span><span class="text">展示中</span> <span class="mark lineBlock"></span><span class="text">已擦亮</span>
</div> </div>
{{# } else { }} {{# } else { }}
<div class="data_status fl boxsiz xj"> <div class="data_status fl boxsiz xj">
<span class="mark lineBlock"></span><span class="text">已下架</span> <span class="mark lineBlock"></span><span class="text">未擦亮</span>
</div> </div>
{{# } }} {{# } }}
{{# } else { }} <div class="time fr ellipsis boxsiz">{{ layui.util.toDateString(item.update_time * 1000)}}</div>
<div class="data_status fl boxsiz jy">
<span class="mark lineBlock"></span><span class="text">禁用中</span>
</div> </div>
{{# } }}
<div class="time fr ellipsis boxsiz">{{ layui.util.toDateString(item.update_time * 1000)}}</div>
</div>
{{# if(item['status'] == 1){ }}
{{# if(item['audit_status'] == 1){ }} {{# if(item['audit_status'] == 1){ }}
<a class="xj xj_status fr xj_btn">下架</a> <a class="edit fr" href="/uploadsingle?id={{item.goods_id}}">编辑</a>
{{# } else { }} {{# } else { }}
<a class="xj xj_status fr disabled xj_btn">下架</a> <a class="edit fr disabled">编辑</a>
{{# } }} {{# } }}
{{# } else { }} </div>
{{# }); }}
{{# if(item['audit_status'] == 1){ }} {{# if(d.length === 0){ }}
<a class="fb xj_status fr">发布</a> <div class="no_data">
{{# } else { }} <img src="__PUBLIC__/images/nosearchdata.png" alt="">
<a class="fb xj_status fr disabled">发布</a> <p class="bold">无商品信息</p>
{{# } }} </div>
{{# } }}
{{# if(item['audit_status'] == 1){ }}
<a class="edit fr" href="/uploadsingle?id={{item.goods_id}}">编辑</a>
{{# } else { }}
<a class="edit fr disabled">编辑</a>
{{# } }} {{# } }}
</div> </div>
{{# }); }} <div class="pagination-with" id="pagination" style="text-align: right;margin-top: 25px;"></div>
{{# if(d.length === 0){ }} </script>
<div class="no_data"> <script type="text/html" id="countHtml">
<img src="__PUBLIC__/images/nosearchdata.png" alt=""> <div class="fl my_good">
<p class="bold">无商品信息</p> <h3>{{d.mygoods}}</h3>
<p>我的商品</p>
</div> </div>
{{# } }} <div class="fl week_good">
</div> <h3>{{d.newadd}}</h3>
<div class="pagination-with" id="pagination" style="text-align: right;margin-top: 25px;"></div> <p>本周新增</p>
</script> </div>
<script type="text/html" id="countHtml"> <div class="fl no_good">
<div class="fl my_good"> <h3>{{d.imperfect}}</h3>
<h3>{{d.mygoods}}</h3> <p>等待完善</p>
<p>我的商品</p> </div>
</div> <div class="center_line line1"></div>
<div class="fl week_good"> <div class="center_line line2"></div>
<h3>{{d.newadd}}</h3> </script>
<p>本周新增</p> <script>
</div> $('.dgsc').click(function () {
<div class="fl no_good"> window.location.href = '/uploadsingle'
<h3>{{d.imperfect}}</h3> })
<p>等待完善</p> $('.plsc').click(function () {
</div> window.location.href = '/bulkupload'
<div class="center_line line1"></div> })
<div class="center_line line2"></div> $('.xz').click(function () {
</script> window.location.href = '/uploadresult'
<script> })
$('.dgsc').click(function () { $('.data_item').click(function () {
window.location.href = '/uploadsingle' window.location.href = '/gooddetail'
}) })
$('.plsc').click(function () { </script>
window.location.href = '/bulkupload'
})
$('.xz').click(function () {
window.location.href = '/uploadresult'
})
$('.data_item').click(function () {
window.location.href = '/gooddetail'
})
</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</div> </div>
</div> </div>
<div class="num input_div "> <div class="num input_div ">
<span class="input_title lineBlock">*库存:</span> <span class="input_title lineBlock">*需求数量:</span>
<div class="input_parent"> <div class="input_parent">
<input type="text" name="number" placeholder="请输入需求数量" class="input boxsiz" <input type="text" name="number" placeholder="请输入需求数量" class="input boxsiz"
lay-verify="required|number|limitStock"> lay-verify="required|number|limitStock">
......
...@@ -131,9 +131,18 @@ ...@@ -131,9 +131,18 @@
.good_manage_content .btn_group div { .good_manage_content .btn_group div {
padding: 0 19px; padding: 0 19px;
} }
.good_manage_content .btn_group div.xz { .good_manage_content .btn_group div.more-delete {
padding: 0 25px;
}
.good_manage_content .btn_group div.xz,
.good_manage_content .btn_group div.plsc,
.good_manage_content .btn_group div.dgsc {
margin-left: 20px; margin-left: 20px;
} }
.good_manage_content .btn_group div.disabled {
background-color: #DAE1E7;
cursor: not-allowed;
}
.good_manage_content .gb { .good_manage_content .gb {
height: 34px; height: 34px;
line-height: 34px; line-height: 34px;
...@@ -164,7 +173,7 @@ ...@@ -164,7 +173,7 @@
position: absolute; position: absolute;
top: 0; top: 0;
left: 25px; left: 25px;
right: 140px; right: 60px;
bottom: 0; bottom: 0;
} }
.good_manage_content .good_data .data_list .data_item .data_detail > div { .good_manage_content .good_data .data_list .data_item .data_detail > div {
...@@ -175,8 +184,11 @@ ...@@ -175,8 +184,11 @@
font-size: 16px; font-size: 16px;
width: 25%; width: 25%;
} }
.good_manage_content .good_data .data_list .data_item .type .gx-status {
margin-right: 12px;
}
.good_manage_content .good_data .data_list .data_item .type .text { .good_manage_content .good_data .data_list .data_item .type .text {
max-width: 80%; max-width: 68%;
} }
.good_manage_content .good_data .data_list .data_item .type .icon { .good_manage_content .good_data .data_list .data_item .type .icon {
position: relative; position: relative;
...@@ -288,3 +300,31 @@ ...@@ -288,3 +300,31 @@
.good_manage_content .good_data .data_list .data_item .xj_status.fb { .good_manage_content .good_data .data_list .data_item .xj_status.fb {
color: #0D84D1; color: #0D84D1;
} }
.good_manage_content .gx-div {
height: 100%;
width: 32px;
}
.good_manage_content .gx-status {
display: inline-block;
height: 20px;
width: 20px;
cursor: pointer;
vertical-align: sub;
}
.good_manage_content .gx-status.wxz {
background: url('../images/wxz-icon.png') no-repeat;
background-size: 100% 100%;
}
.good_manage_content .gx-status.xz {
background: url('../images/xz-icon.png') no-repeat;
background-size: 100% 100%;
}
.good_manage_content .plsc-text {
font-size: 14px;
color: #686E73;
cursor: pointer;
margin-left: 17px;
}
.good_manage_content .plsc-text:hover {
color: #0D84D1;
}
...@@ -170,10 +170,17 @@ ...@@ -170,10 +170,17 @@
div { div {
padding: 0 19px; padding: 0 19px;
&.more-delete{
&.xz { padding:0 25px;
}
&.xz, &.plsc, &.dgsc {
margin-left: 20px; margin-left: 20px;
} }
&.disabled{
background-color: #DAE1E7;
cursor: not-allowed;
}
} }
} }
.gb { .gb {
...@@ -209,7 +216,7 @@ ...@@ -209,7 +216,7 @@
position: absolute; position: absolute;
top: 0; top: 0;
left: 25px; left: 25px;
right: 140px; right: 60px;
bottom: 0; bottom: 0;
& > div { & > div {
...@@ -221,9 +228,11 @@ ...@@ -221,9 +228,11 @@
color: #2E3033; color: #2E3033;
font-size: 16px; font-size: 16px;
width: 25%; width: 25%;
.gx-status{
margin-right:12px;
}
.text { .text {
max-width: 80%; max-width: 68%;
} }
.icon { .icon {
...@@ -370,4 +379,33 @@ ...@@ -370,4 +379,33 @@
} }
} }
} }
.gx-div{
height:100%;
width:32px;
}
.gx-status{
display: inline-block;
height:20px;
width:20px;
cursor: pointer;
vertical-align: sub;
&.wxz{
background: url('../images/wxz-icon.png') no-repeat;
background-size: 100% 100%;
}
&.xz{
background: url('../images/xz-icon.png') no-repeat;
background-size: 100% 100%;
}
}
.plsc-text{
font-size: 14px;
color:#686E73;
cursor: pointer;
margin-left:17px;
&:hover{
color:#0D84D1;
}
}
} }
\ No newline at end of file
...@@ -198,7 +198,15 @@ ...@@ -198,7 +198,15 @@
/** /**
* 获取最新版本信息 * 获取最新版本信息
*/ */
getVersion: user_url + '/get/version' getVersion: user_url + '/get/version',
/**
* 批量删除商品
*/
goodsDelete: goods_url + '/goods/delete',
/**
* 擦亮全部商品
*/
polishAll: goods_url + '/goods/polish/all'
}; };
if (typeof define === "function" && define.amd) { if (typeof define === "function" && define.amd) {
return apis; return apis;
......
! function () { ! function () {
window.IcController = { window.IcController = {
isCl:true,//用户是否已经擦亮过商品 默认为已擦亮
init: function () { init: function () {
this.created(this).mounted(this).handleBind(this); this.created(this).mounted(this).handleBind(this);
}, },
...@@ -132,7 +133,16 @@ ...@@ -132,7 +133,16 @@
}); });
} }
//判断用户是否点击了擦亮商品的按钮
if(window.location.pathname == '/goodmanage'){
if(res.data.polish_status == 2){//未刷新
opt.isCl = false;
$('.cl').addClass('btn_yellow').removeClass('disabled')
}else{//已刷新
opt.isCl = true;
$('.cl').addClass('disabled').removeClass('btn_yellow')
}
}
} }
}); });
......
!function () { ! function () {
window.GoodManageController = { window.GoodManageController = {
token: Util.getCookie('token') || '', token: Util.getCookie('token') || '',
deleteGoods: [],
init: function () { init: function () {
this.created(this).mounted(this).render(this, { this.created(this).mounted(this).render(this, {
offset: 10, offset: 10,
...@@ -9,57 +11,60 @@ ...@@ -9,57 +11,60 @@
}, 1).handleBind(this); }, 1).handleBind(this);
}, },
created: function (opt) { created: function (opt) {
//日期控件初始化 //日期控件初始化
layui.laydate.render({ layui.laydate.render({
elem: '#start_time', elem: '#start_time',
theme: '#0D84D1' theme: '#0D84D1',
}); });
layui.laydate.render({ layui.laydate.render({
elem: '#end_time', elem: '#end_time',
theme: '#0D84D1' theme: '#0D84D1'
}); });
return this; return this;
}, },
mounted: function (opt) { mounted: function (opt) {
//商品数量获取 //商品数量获取
IcController.getData(apis.goodsCount, 'GET', { IcController.getData(apis.goodsCount, 'GET', {
token: opt.token token: opt.token
}, function (res) { }, function (res) {
if (res.errcode === 0) { if (res.errcode === 0) {
var getTpl = countHtml.innerHTML; var getTpl = countHtml.innerHTML;
layui.laytpl(getTpl).render(res.count, function (html) { layui.laytpl(getTpl).render(res.count, function (html) {
$(".good_total").empty().html(html); $(".good_total").empty().html(html);
}); });
} }
}); });
return this; return this;
}, },
render: function (opt, params, curr) { render: function (opt, params, curr) {
opt.deleteGoods = [];
var morningTime = new Date(new Date().toLocaleDateString()).getTime()/1000;//当前时间的凌晨时间
$('.more-delete .gx-status').addClass('wxz').removeClass('xz')
//商品列表初始化 //商品列表初始化
IcController.getData(apis.goodsInfo, 'GET', params, function (res) { IcController.getData(apis.goodsInfo, 'GET', params, function (res) {
var getTpl = listHtml.innerHTML; var getTpl = listHtml.innerHTML;
if (res.errcode === 0) { if (res.errcode === 0) {
for(var k in res.goods_list){//把凌晨数据加到列表数据中跟更新时间做比较
res.goods_list[k].morning_time = morningTime
};
layui.laytpl(getTpl).render(res.goods_list, function (html) { layui.laytpl(getTpl).render(res.goods_list, function (html) {
$("#listData").empty().html(html); $("#listData").empty().html(html);
layui.laypage.render({ layui.laypage.render({
elem: 'pagination', elem: 'pagination',
theme: '#1080d0', theme: '#1080d0',
...@@ -68,35 +73,34 @@ ...@@ -68,35 +73,34 @@
curr: curr, curr: curr,
layout: ['prev', 'page', 'next', 'refresh'], layout: ['prev', 'page', 'next', 'refresh'],
jump: function (obj, first) { jump: function (obj, first) {
if (!first) { if (!first) {
//分页回调调用 //分页回调调用
var json = { var json = {
p: obj.curr p: obj.curr
} }
var param = $.extend({}, params, json); var param = $.extend({}, params, json);
GoodManageController.render(opt, param, obj.curr); GoodManageController.render(opt, param, obj.curr);
} }
} }
}); });
}); });
} else if (res.errcode === 110001 || res.errcode === 103001) { } else if (res.errcode === 110001 || res.errcode === 103001) {
layui.laytpl(getTpl).render([], function (html) { layui.laytpl(getTpl).render([], function (html) {
$("#listData").empty().html(html); $("#listData").empty().html(html);
}); });
} }
}); });
return this; return this;
}, },
sxj: function (id, type) { sxj: function (id, type) {
//上下架 1上架 2下架 //上下架 1上架 2下架
...@@ -115,86 +119,188 @@ ...@@ -115,86 +119,188 @@
}); });
} else { } else {
layer.msg('操作失败') layer.msg('操作失败')
}
})
},
//批量删除商品的接口
deleteGoodsAjax: function (opt) {
IcController.getData(apis.goodsDelete, 'GET', {
"token": Util.getCookie('token') || "",
"goods_id": JSON.stringify(opt.deleteGoods),
}, function (res) {
if (res.errcode === 0) {
opt.deleteGoods = [];
layer.msg('删除成功', {
time: 600
}, function () {
opt.mounted(opt)
$('.cx').click();
});
} else {
layer.msg('删除失败')
}
})
},
//擦亮商品的接口
clGoodsAjax: function (opt) {
IcController.getData(apis.polishAll, 'GET', {
"token": Util.getCookie('token') || "",
}, function (res) {
if (res.errcode === 0) {
layer.msg('擦亮成功', {
time: 600
}, function () {
opt.mounted(opt);
IcController.isCl = true;
$('.cl').addClass('disabled').removeClass('btn_yellow')
$('.layui-icon-refresh').click();
});
} else {
layer.msg('擦亮失败');
IcController.isCl = false;
} }
}) })
}, },
handleBind: function (opt) { handleBind: function (opt) {
//搜索 //搜索
layui.form.on('submit(search)', function (data) { layui.form.on('submit(search)', function (data) {
var param = { var param = {
token: opt.token, token: opt.token,
offset: 10, offset: 10,
p: 1 p: 1
}; };
var params = $.extend({}, data.field, param); var params = $.extend({}, data.field, param);
opt.render(this, params, 1) opt.render(this, params, 1)
}); });
//上架 //上架
$('#listData').on('click', '.fb', function (e) { $('#listData').on('click', '.fb', function (e) {
e.stopPropagation(); e.stopPropagation();
var goodId = $(this).parent('.data_item').attr('goodid'); var goodId = $(this).parent('.data_item').attr('goodid');
if ($(this).hasClass('disabled')) { if ($(this).hasClass('disabled')) {
return; return;
} else { } else {
opt.sxj(goodId, 1); opt.sxj(goodId, 1);
} }
}); });
//下架 //下架
$('#listData').on('click', '.xj_btn', function (e) { $('#listData').on('click', '.xj_btn', function (e) {
e.stopPropagation(); e.stopPropagation();
var goodId = $(this).parent('.data_item').attr('goodid'); var goodId = $(this).parent('.data_item').attr('goodid');
if ($(this).hasClass('disabled')) { if ($(this).hasClass('disabled')) {
return; return;
} else { } else {
opt.sxj(goodId, 2) opt.sxj(goodId, 2)
} }
}); });
//进入详情 //进入详情
$(document).on('click', '#listData .data_item', function (e) { $(document).on('click', '#listData .data_item', function (e) {
e.stopPropagation(); e.stopPropagation();
var goodId = $(this).attr('goodid'); var goodId = $(this).attr('goodid');
window.location.href="/gooddetail?type=1&id="+goodId window.location.href = "/gooddetail?type=1&id=" + goodId
}); });
//阻止默认事件 //阻止默认事件
$(document).on('click','.data_list .disabled',function (e) { $(document).on('click', '.data_list .disabled', function (e) {
e.stopPropagation(); e.stopPropagation();
}); });
$(document).on('click', '.gx-div', function (e) {
//单个商品勾选
e.stopPropagation();
var goodid = $(this).find('.gx-status').attr('goodid')
if ($(this).find('.gx-status').hasClass('wxz')) {
//未勾选时变成勾选
$(this).find('.gx-status').removeClass('wxz').addClass('xz');
opt.deleteGoods.push(goodid);
} else {
//勾选时变为未勾选
$(this).find('.gx-status').removeClass('xz').addClass('wxz');
var index = opt.deleteGoods.indexOf(goodid);
if (index != -1) {
opt.deleteGoods.splice(index, 1)
}
}
if (opt.deleteGoods.length == 10) {
$('.more-delete .gx-status').removeClass('wxz').addClass('xz');
} else {
$('.more-delete .gx-status').removeClass('xz').addClass('wxz');
}
});
$('.more-delete').on('click', '.gx-status', function () {
//全选
opt.deleteGoods = [];
if ($(this).hasClass('wxz')) {
//未勾选时变成勾选
$(this).removeClass('wxz').addClass('xz');
$('#listData .gx-status').each(function () {
var goodid = $(this).attr('goodid')
$(this).removeClass('wxz').addClass('xz');
opt.deleteGoods.push(goodid)
})
} else {
//勾选时变为未勾选
$(this).removeClass('xz').addClass('wxz');
$('#listData .gx-status').each(function () {
$(this).removeClass('xz').addClass('wxz');
})
}
});
//批量删除
$('.plsc-text').on('click', function () {
if (opt.deleteGoods.length) {
layer.confirm('是否确认删除当前选中的商品?', {
icon: 3,
title: '提示',
move: false
}, function (index) {
opt.deleteGoodsAjax(opt)
layer.close(index);
})
}
});
//擦亮商品
$('.cl').on('click',function(){
if(!IcController.isCl){//未刷新
opt.clGoodsAjax(opt)
}
})
return this; return this;
}, },
}, $(function () { }, $(function () {
......
...@@ -218,9 +218,9 @@ ...@@ -218,9 +218,9 @@
return '品牌不能小于2个字符' return '品牌不能小于2个字符'
} }
}, },
limitStock: function (value, item) { limitStock:function(value, item){
if (value > 10000000) { if(value>10000000){
return '库存最大为10000000(一千万)' return '数量最大为10000000(一千万)'
} }
}, },
limitLengthLgThree: function (value, item) { limitLengthLgThree: function (value, item) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment