Commit e38ea008 by 施宇

商品擦亮

parent 2c09b25d
......@@ -98,17 +98,6 @@
{{# } }}
<div class=" goods_desc boxsiz">
<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">
<h3 class="bold fl boxsiz goods_name">{{d.goods_name}}</h3>
<div class="price fl bold boxsiz">
......
......@@ -51,15 +51,6 @@
</div>
</div>
<div class="layui-form-style fr">
<span class="lineBlock">状态:</span>
<select name="status/eq">
<option value=""></option>
<option value="1">上架</option>
<option value="2">下架</option>
<option value="3">禁用</option>
</select>
</div>
</div>
<div class="input_div boxsiz">
<span class="lineBlock">商品型号:</span>
......@@ -88,7 +79,7 @@
<div class="xz fr boxsiz btn btn_border">
<a href="__PUBLIC__/ic_templet.xls">下载商品模板</a>
</div>
<div class="cl fr boxsiz btn btn_yellow">
<div class="cl fr boxsiz btn disabled">
擦亮商品
</div>
......@@ -133,19 +124,14 @@
{{# } }}
{{item.price}}
</div>
{{# if(item['audit_status'] == 1){ }}
{{# if(item['status'] == 1){ }}
{{# if(item['update_time'] > item['morning_time']){ }}
<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>
{{# } else { }}
<div class="data_status fl boxsiz xj">
<span class="mark lineBlock"></span><span class="text">已下架</span>
</div>
{{# } }}
{{# } else { }}
<div class="data_status fl boxsiz jy">
<span class="mark lineBlock"></span><span class="text">禁用中</span>
<span class="mark lineBlock"></span><span class="text">未擦亮</span>
</div>
{{# } }}
<div class="time fr ellipsis boxsiz">{{ layui.util.toDateString(item.update_time * 1000)}}</div>
......
......@@ -139,6 +139,10 @@
.good_manage_content .btn_group div.dgsc {
margin-left: 20px;
}
.good_manage_content .btn_group div.disabled {
background-color: #DAE1E7;
cursor: not-allowed;
}
.good_manage_content .gb {
height: 34px;
line-height: 34px;
......
......@@ -173,11 +173,13 @@
&.more-delete{
padding:0 25px;
}
&.xz, &.plsc, &.dgsc {
margin-left: 20px;
}
&.disabled{
background-color: #DAE1E7;
cursor: not-allowed;
}
}
}
......
......@@ -191,13 +191,17 @@
*/
userMarkmsg: user_url + '/user/markmsg',
/**
* 批量删除商品
* 获取最新版本信息
*/
getVersion: user_url + '/get/version',
/**
* 获取最新版本信息
* 批量删除商品
*/
goodsDelete: goods_url + '/goods/delete',
/**
* 擦亮全部商品
*/
goodsDelete: goods_url + '/goods/delete'
polishAll: goods_url + '/goods/polish/all'
};
if (typeof define === "function" && define.amd) {
return apis;
......
! function () {
window.IcController = {
isCl:true,//用户是否已经擦亮过商品 默认为已擦亮
init: function () {
this.created(this).mounted(this).handleBind(this);
},
......@@ -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 () {
window.GoodManageController = {
token: Util.getCookie('token') || '',
deleteGoods: [],
init: function () {
this.created(this).mounted(this).render(this, {
......@@ -50,13 +51,16 @@
},
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) {
var getTpl = listHtml.innerHTML;
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) {
$("#listData").empty().html(html);
......@@ -139,6 +143,27 @@
}
})
},
//擦亮商品的接口
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) {
......@@ -265,7 +290,13 @@
layer.close(index);
})
}
})
});
//擦亮商品
$('.cl').on('click',function(){
if(!IcController.isCl){//未刷新
opt.clGoodsAjax(opt)
}
})
......
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