Authored by wangshusheng

Merge branch 'dev_店铺vip设置' into test5.7

... ... @@ -95,7 +95,7 @@
<td width="120px"><b>说明:</b></td>
<td>
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价、VIP折扣类型、VIP价、白金价、金卡价、银卡价</span><br>
2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价</span><br>
3、第一行为表头内容,第二行开始为正式内容<br>
4、每个文件控制在2500行以内<br>
5、<a href="/ajax/link/batchUpdatePrice" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
... ... @@ -144,8 +144,6 @@
<table class="table table-striped table-bordered" style="margin: 0;border: 0">
<tr>
<th style="border-top: 0; border-left: 0">销售价</th>
<th style="border-top: 0">VIP折扣类型</th>
<th style="border-top: 0">会员价</th>
<th style="border-top: 0">学生价</th>
<th style="border-top: 0">价格生效时间</th>
<th style="border-top: 0">进货价</th>
... ... @@ -158,41 +156,6 @@
<input class="sale-price form-control" type="text" value="{sales_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')">
</td>
<td style="border-bottom: 0">
<select class="discount-select form-control" style="width: 110px">
<option value="1">正常折扣</option>
<option value="2">统一折扣</option>
<option value="3">无折扣</option>
<option value="4">固定折扣</option>
<option value="5">自定义折扣</option>
</select>
</td>
<td style="border-bottom: 0">
<div class="form-inline" style="margin-bottom: 5px">
<div class="form-group">
<label style="width: 60px; text-align: right">VIP价:</label>
<input class="vip-price form-control" type="text" value="{vip_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')">
</div>
</div>
<div class="form-inline" style="margin-bottom: 5px">
<div class="form-group">
<label style="width: 60px; text-align: right">白金价:</label>
<input class="vip3-price form-control" type="text" value="{vip3_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')" disabled>
</div>
</div>
<div class="form-inline" style="margin-bottom: 5px">
<div class="form-group">
<label style="width: 60px; text-align: right">金卡价:</label>
<input class="vip2-price form-control" type="text" value="{vip2_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')" disabled>
</div>
</div>
<div class="form-inline">
<div class="form-group">
<label style="width: 60px; text-align: right">银卡价:</label>
<input class="vip1-price form-control" type="text" value="{vip1_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')" disabled>
</div>
</div>
</td>
<td style="border-bottom: 0">
<input class="student_price form-control" type="text" value="{student_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')" disabled>
</td>
<td class="form-inline" style="border-bottom: 0">
... ...
... ... @@ -176,7 +176,7 @@
<td width="120px"><b>说明:</b></td>
<td>
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价、VIP折扣类型、VIP价、白金价、金卡价、银卡价</span><br>
2、Excel表头为:<span style="color: #67D267;">SKN、吊牌价、销售价</span><br>
3、第一行为表头内容,第二行开始为正式内容<br>
4、每个文件控制在2500行以内<br>
5、<a href="/ajax/link/batchUpdatePrice" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
... ... @@ -255,11 +255,6 @@
<table class="table table-striped table-bordered" style="margin: 0;border: 0">
<tr>
<th style="border-top: 0; border-left: 0">SKN</th>
<th style="border-top: 0">VIP折扣类型</th>
<th style="border-top: 0">VIP</th>
<th style="border-top: 0">白金</th>
<th style="border-top: 0">金卡</th>
<th style="border-top: 0">银卡</th>
<th style="border-top: 0">学生价</th>
<th style="border-top: 0">建议销售价</th>
<th style="border-top: 0">销售价</th>
... ... @@ -274,30 +269,6 @@
<input class="plan-id form-control" type="hidden" value="{planId}" >
</td>
<td style="border-bottom: 0">
<select class="discount-select form-control" style="width: 110px">
<option value="1">正常折扣</option>
<option value="2">统一折扣</option>
<option value="3">无折扣</option>
<option value="4">固定折扣</option>
<option value="5">自定义折扣</option>
</select>
</td>
<td style="border-bottom: 0">
<input class="vip-price form-control" type="text" value="{vip_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')">
</td>
<td style="border-bottom: 0">
<input class="vip3-price form-control" type="text" value="{vip3_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')" disabled>
</td>
<td style="border-bottom: 0">
<input class="vip2-price form-control" type="text" value="{vip2_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')" disabled>
</td>
<td style="border-bottom: 0">
<input class="vip1-price form-control" type="text" value="{vip1_price}" onkeyup="this.value=this.value.replace(/[^\d\.]|^\./gi,'')" disabled>
</td>
<td style="border-bottom: 0">
<div class="form-inline" style="margin-bottom: 5px">
<div class="form-group">
<!-- <input type="radio"style="margin-left: 35%" disabled>关闭<br> -->
... ...
... ... @@ -20,7 +20,7 @@
2、第一行标题栏:SKN、起购件数、折扣、促销名称、状态(1:开启,2:关闭)<br>
<span style="color: red;">3、折扣只支持 0.01-1 之间的数字,到小数点后 2 位,例如 0.85;</span><br>
4、量贩商品不可参加秒杀、限定、预售、定金预售,设定后无法生效<br/>
5、<a href="/ajax/link/productBatchImport">下载样例</a>
5、<a href="/ajax/link/vipProduct">下载样例</a>
</td>
</tr>
</table>
... ...
... ... @@ -11,6 +11,8 @@ module.exports={
{name: 'checkStatus', type: 'Number'},
{name: 'checkStatusArr', type: 'String'},
{name: 'shopsId', type: 'Number'},
{name: 'vipStatus', type: 'Number'},
{name: 'vipFlag', type: 'String'},
{name: 'size', type: 'Number'},
{name: 'page', type: 'Number'}
]
... ...
/**
* Created by yoho on 2016/6/20.
* 搜索词管理
*/
module.exports = function (app) {
/*************************************VIP管理*************************************/
app.get("/vip/index", "vip.index", function(response) {
this.$extend={
actions:response.data,
moduleName:"VIP设置",
pageName:"VIP设置"
}
});
//列表页
app.get("/vip/shop/list", "vip.ShopVip", function(response){
this.$extend={
moduleName:'VIP管理',
pageName:'店铺VIP',
gridurl:'/supplier/store/indexPage'
}
});
//店铺VIP开关
app.post("/vip/shop/trigger", "vip_shopVipTrigger");
//商品VIP设置
app.get("/vip/ProductVip", "vip.ProductVip", function(response) {
this.$extend={
actions:response.data,
moduleName:"VIP设置",
pageName:"商品VIP设置"
}
});
//修改商品VIP状态
app.post("/vip/changeStatus", "vip_changeStatus");
//批量修改商品VIP状态
app.post("/vip/batchChangeStatus", "vip_batchChangeStatus");
//获取商品VIP列表
app.post("/vip/queryProductVipList", "vip_queryProductVipList");
app.get("/vip/batch/import", "vip.Import", function(req, res) {
this.$extend = {
moduleName: "VIP设置",
pageName: "商品VIP状态导入"
}
});
};
... ...
/**
* Created by yoho on 2016/6/20.
* VIP 接口定义
*/
module.exports = {
namespace: "vip",
apis: {
/*************************************VIP管理*************************************/
queryProductVipList: {
title: "获取商品VIP列表",
url: '/vip/queryProductVipList',
params: {
productSkn: {type: Number},
shopId: {type: Number},
brandId: {type: Number},
productVipStatus: {type: Number},
page: {type: Number}
}
},
changeStatus: {
title: "修改商品VIP状态",
url: '/vip/changeStatus',
params: {
productSkn: {type: Number},
productVipStatus: {type: Number}
}
},
batchChangeStatus: {
title: "修改商品VIP状态",
url: '/vip/batchChangeStatus',
params: {
sknList: {type: String},
changeStatus: {type: Number}
}
},
shopVipTrigger: {
title: "开启关闭",
url: "/vip/shopVipTrigger",
params: [
{ name: 'shopsIds', type: 'String'},
{ name: 'vipStatus', type: 'Number'}
]
}
}
};
... ...
<%include '../../common/views/__ui/header'%>
<%include '../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<table class="table table-bordered">
<tr>
<td rowspan="2">商品VIP设置</td>
<td>上传EXCEL:</td>
<td style="position: relative;">
<input id="importProductBatch" name="file" data-type="" type="file" style="border:1px solid red; cursor: pointer; height: 37px; top: 8px;">
<a class="btn btn-default" href="/vip/index">返回</a>
</td>
</tr>
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是 .xlsx 文件<br>
2、第一行标题栏:SKN、商品VIP状态<br>
<span style="color: red;">3、商品VIP状态:1表示开启,2表示关闭;</span><br>
4、请上传自己权限内的商品SKN<br/>
5、<a href="/ajax/link/vipProduct">下载样例</a>
</td>
</tr>
</table>
</div>
<div class="panel-body">
<div class="col-md-12">
<div id="message"></div>
</div>
</div>
<div class="panel-body">
<div class="col-md-12">
<div class="dataTab_wrapper" id="basicTab" style="margin-bottom: 10px"></div>
<div id="table-box" class="table-responsive"></div>
</div>
</div>
</div>
</div>
<%include '../../common/views/__ui/footer'%>
... ...
<%include '../../common/views/__ui/header'%>
<%include '../../common/views/__partail/ListHeader'%>
<div id="productVipTab">
<%include 'ProductVip'%>
</div>
<%include '../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="row">
<div class="panel-col2">
<input name="productSkn" id="productSkn" type="text" value="" class="form-control" placeholder="SKN" />
</div>
<div class="panel-col2">
<select id="shopId" class="form-control" style="width: 280px;" tabindex="-1">
<option value="-1">请选择店铺</option>
</select>
</div>
<div class="panel-col2">
<select id="brandId" class="form-control" style="width: 280px;" tabindex="-1">
<option value="-1">请选择品牌</option>
</select>
</div>
<div class="panel-col2" style="width: 100px;">
<select id="productVipStatus" class="form-control">
<option value="-1">VIP设置</option>
<option value="1">开启</option>
<option value="2">关闭</option>
</select>
</div>
<div class="panel-col">
<a id="searchFilter" href="javascript:;" class="btn btn-info">筛选</a>
</div>
<div class="panel-col">
<a href="/vip/batch/import" class="btn btn-primary"><span class="glyphicon glyphicon-circle-arrow-up"></span>&nbsp;导入</a>
</div>
</div>
</div>
</div>
<div style="margin-left:10px;margin-bottom: 10px">
<label><input name="all" id="all" type="checkbox" onclick="DoCheck()" value=""/>选中当前页</label>
<a onclick="batchChangeStatus(1)" href="javascript:;" class="btn btn-info">开启</a>
<a onclick="batchChangeStatus(2)" href="javascript:;" class="btn btn-danger">关闭</a>
</div>
<div class="panel panel-primary-head">
<div class="dataTab_wrapper" id="productVipTable" ></div>
</div>
</div>
... ...
'use strict';
var $ = require('jquery'), common = require('../../common/common');
var importConfig = { "bizType" : "vipBatch" };
$('input[type="file"]').after('<div class="file-name btn btn-default">请选择文件</div>');
var loadModal = null;
function batchImport(el, type) {
return {
params: {
type: type,
__type: "batch-import"
},
onStart: function(params) {
console.log("params",params);
loadModal = common.dialog.load();
},
onComplete: function(response) {
if (loadModal) {
loadModal.close();
}
console.log("批量接口返回数据",response);
var msg = response.data.result;
if (response.code == 200) {
common.util.__tip(msg, 'success');
$("#message").html("");
} else if (msg) {
$("#message").html(msg);
common.util.__tip("导入失败", 'warning');
} else {
common.util.__tip("导入失败", 'warning');
}
}
}
}
common.edit.ajaxfileupload('#importProductBatch', batchImport('#sort-file', importConfig.bizType));
... ...
'use strict';
var $ = require('jquery'),
common=require('../../common/common');
// 初始化筛选框
new common.dropDown({el: "#shopId", ajax: "shopsRest"});
new common.dropDown({el: "#brandId", ajax: "brand"});
/**
* 商品VIP列表
* @type {common.grid}
*/
var g = new common.grid({
el: '#productVipTable',
parms: function () {
return {
productSkn: common.util.__input('productSkn'),
shopId: common.util.__input('shopId'),
brandId: common.util.__input('brandId'),
productVipStatus: common.util.__input('productVipStatus')
};
},
columns: [
{
display: "复选框",
width: 90,
render: function (item) {
var HtmArr = [];
HtmArr.push('<label><input name="choose" type="checkbox" value="'+item.productSKN+'"/></label>');
return HtmArr.join('');
}
},
{
display: "SKN",
name: "productSKN"
}, {
display: "店铺",
name: "shopName"
}, {
display: "品牌",
name: "brandName"
},{
display: "价格",
name: "price"
},{
display: "VIP价格",
name: "vipPrice"
}, {
display: "VIP状态",
render: function (item) {
var HtmArr = [];
if(item.productVipStatus == 1){
HtmArr.push('<label>开启</label>');
}else{
HtmArr.push('<label>关闭</label>');
}
return HtmArr.join('');
}
}, {
display: '操作',
render: function (item) {
var HtmArr = [];
if(item.productVipStatus == 1){
HtmArr.push('<a onclick="changeStatus('+item.productSKN+',2)" href="javascript:;" class="btn btn-danger">关闭</a>');
}else{
HtmArr.push('<a onclick="changeStatus('+item.productSKN+',1)" href="javascript:;" class="btn btn-info">开启</a>');
}
return HtmArr.join('');
}
}]
});
g.init('/vip/queryProductVipList');
/**
* 批量修改商品VIP状态
* @param status
*/
function batchChangeStatus(status) {
var chk_value =[];
$('input[name="choose"]:checked').each(function(){
chk_value.push($(this).val());
});
if(chk_value.length==0) {
alert("你还没有选择任何SKN!");
return;
}
var params= {
sknList: chk_value.toString(),
changeStatus: status
};
common.dialog.confirm("警告",
"确认批量修改商品VIP状态?",
function () {
common.util.__ajax({
url: '/vip/batchChangeStatus',
data: params
}, function(res) {
g.reload();
$("[name='all']").removeAttr("checked");
});
});
}
/**
* 搜索商品VIP
*/
$("#searchFilter").click(function() {
g.reload(1);
$("[name='all']").removeAttr("checked");
});
/**
* 单个修改商品VIP状态
* @param productSkn
* @param status
*/
function changeStatus(productSkn,status) {
var param = {
productSkn: productSkn,
productVipStatus: status
};
common.dialog.confirm("警告",
"确认修改商品VIP状态?",
function () {
common.util.__ajax({
url: '/vip/changeStatus',
data: param
}, function(res) {
g.reload();
$("[name='all']").removeAttr("checked");
});
});
};
/**
* 全选、反选
* @constructor
*/
function DoCheck()
{
var ch=document.getElementsByName("choose");
if(document.getElementsByName("all")[0].checked==true)
{
for(var i=0;i<ch.length;i++)
{
ch[i].checked=true;
}
}else{
for(var i=0;i<ch.length;i++)
{
ch[i].checked=false;
}
}
}
window.DoCheck = DoCheck;
window.changeStatus = changeStatus;
/**
* 切换TAB
* @param tab
*/
function changeTab(tab) {
if(tab == 1){
$("#shopVipTab").show();
$("#productVipTab").hide();
}else if(tab == 2){
$("#shopVipTab").hide();
$("#productVipTab").show();
}
}
window.changeTab = changeTab;
window.batchChangeStatus = batchChangeStatus;
... ...