Authored by zhaoqing

VIP设置

... ... @@ -6,6 +6,13 @@
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={
... ... @@ -14,7 +21,17 @@ module.exports = function (app) {
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");
... ... @@ -24,14 +41,4 @@ module.exports = function (app) {
//获取商品VIP列表
app.post("/vip/queryProductVipList", "vip_queryProductVipList");
app.get("/vip/ProductVip", "vip.ProductVip", function(response) {
this.$extend={
actions:response.data,
moduleName:"VIP设置",
pageName:"商品VIP设置"
}
});
//店铺VIP开关
app.post("/vip/shop/trigger", "vip_shopVipTrigger");
};
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div>
<ul class="nav nav-pills" style="margin-bottom: 10px">
<li>
<a class="tag" href="/goods/special/index" style="font-size: 14px;padding:20px;color: black">特殊商品</a>
</li>
<li>
<a class="hand active" href="javascript:void(0)" style="font-size: 14px;padding:20px;color: #428bca">货到付款</a>
</li>
</ul>
</div>
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select id="productSkn" class="form-control">
<option value="-1">SKN</option>
</select>
</div>
<div class="panel-col">
<select id="brandId" class="form-control">
<option value="-1">请选择品牌</option>
</select>
</div>
<div class="panel-col">
<select id="isPayDelivery" class="form-control">
<option value="-1">货到付款状态</option>
<option value="1">开启</option>
<option value="0">关闭</option>
</select>
</div>
<div class="panel-col-3">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="export-btn" href="" class="btn btn-info">导出</a>
<a id="btn-input" href="/goods/cod/upload" class="btn btn-info">批量导入</a>
</div>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div class="dataTab_wrapper" id="basicTab" style="margin-bottom: 10px"></div>
<div class="dataTab_wrapper" id="basicTable" ></div>
</div>
<%include '../../common/views/__ui/header'%>
<%include '../../common/views/__partail/ListHeader'%>
<div class="tabheader">
<ul class="nav nav-tabs">
<li data-toggle="1" class="active"><a onclick="changeTab(1)" href="javascript:">店铺VIP设置</a></li>
<li data-toggle="2"><a onclick="changeTab(2)" href="javascript:">商品VIP设置</a></li>
</ul>
</div>
<script type="text/template" id="template">
<div class="rows" style="height: 100px;">
<div class="form-group">
<span class="col-sm-2 control-label">驳回原因:</span>
<div class="col-sm-8">
<textarea id="reason" class="form-control" rows="3" ></textarea>
</div>
</div>
</div>
</div>
</script>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
<div id="shopVipTab">
<%include 'ShopVip'%>
</div>
<div id="productVipTab" style="display:none">
<%include 'ProductVip'%>
</div>
<%include '../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
<%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">
<div class="row">
<div class="panel-col">
<div class="panel-col2">
<input name="productSkn" id="productSkn" type="text" value="" class="form-control" placeholder="SKN" />
</div>
<div class="panel-col">
<select id="shop-name" class="form-control">
<div class="panel-col2">
<select id="shopId" class="form-control" style="width: 280px;" tabindex="-1">
<option value="-1">请选择店铺</option>
</select>
</div>
<div class="panel-col">
<select id="brandId" class="form-control">
<div class="panel-col2">
<select id="brandId" class="form-control" style="width: 280px;" tabindex="-1">
<option value="-1">请选择品牌</option>
</select>
</div>
<div class="panel-col">
<div class="panel-col2">
<select id="productVipStatus" class="form-control">
<option value="-1">VIP设置</option>
<option value="0">跟随店铺</option>
... ... @@ -31,7 +29,7 @@
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="searchFilter" href="javascript:;" class="btn btn-info">筛选</a>
</div>
</div>
... ... @@ -44,8 +42,6 @@
<a id="close" href="javascript:;" class="btn btn-info">关闭</a>
</div>
<div class="panel panel-primary-head">
<div class="dataTab_wrapper" id="basicTable" ></div>
<div class="dataTab_wrapper" id="productVipTable" ></div>
</div>
</div>
<%include '../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
<%include '../../common/views/__ui/header'%>
<%include '../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
... ... @@ -49,5 +48,4 @@
<input type="hidden" id="gridurl" value="<%gridurl%>">
<input type="hidden" id="authority" value="<%authority%>" />
<%include '../../common/views/__ui/footer'%>
... ...
'use strict';
var $ = require('jquery'),
common=require('../../common/common');
//基础模板,经典模板切换
$(document).on("click",".tabheader .nav-tabs li",function(){
$(this).addClass('active').siblings('li').removeClass('active');
});
//店铺VIP管理
new common.dropDown({el: "#brand-name", ajax: "brand"});
new common.dropDown({el: "#supplier-name", ajax: "supplier"});
new common.dropDown({el: "#shop-name", ajax: "queryShopNames", params: function() {
return {
"checkStatus": common.util.__input("status"),
"operationStatus": 2, // 店铺表中只有创建和未创建两个状态,没有operation_status为0的店铺信息
"checkStatusArr": "200,300,900"
};
}});
$('#filter-btn').on('click', function () {
g1.reload(1);
});
var g1 = new common.grid({
el: '#basicTable',
parms: function () {
return {
"supplierId": common.util.__input("supplier-name"),
"brandId": common.util.__input("brand-name"),
"operationStatus": 2,
"checkStatusArr": "200,300,900",
"blkCheckStatus": 200,
"shopsId": common.util.__input("shop-name"),
"vipStatus": common.util.__input("vip-status")
};
},
columns: [
{display: "店铺ID", name: "shopsId"},
{display: "店铺名称", name: "shopName"},
{
display: "包含品牌", name: "shopRelationList", render: function (item) {
var brandArr = [];
if (item.shopRelationList) {
$.each(item.shopRelationList, function (index, a) {
if($.inArray(a.brandName, brandArr) === -1) {
brandArr.push(a.brandName);
}
});
}
return '<p>' + brandArr.join('</p><p>') + '</p>';
}
},
{display: "创建时间", name: "createTime"},
{display: "更新时间", name: "updateTime"},
{
display: "VIP设置", name: "vipStatus", render: function (item) {
var status = '';
if(+item.vipStatus == 1){
status = "开启";
} else {
status = "关闭";
}
return status;
}
},
{
display: "操作", name: "", render: function (item) {
var HtmArr = [];
if (+item.contractVipStatus == 1) {
if (+item.vipStatus == 1) {
HtmArr.push('<a href="javascript:void(0);" data-id="' + item.shopsId + '" data-status="2" class="btn btn-danger btn-xs delete">关闭</a>');
} else {
HtmArr.push('<a href="javascript:void(0);" data-id="' + item.shopsId + '" data-status="1" class="btn btn-success btn-xs delete">开启</a>');
}
}
return HtmArr.join('');
}
}
]
})
g1.init($('#url').val());
/**
* Created by wangqianjun on 16/2/23.
* 关闭--点击事件
*/
var $ = require('jquery'),
common = require('../../common/common');
$(document).on('click', '.delete', function () {
var shopsId = $(this).attr("data-id");
var vipStatus = $(this).attr("data-status");
var message = (vipStatus == 1 ? "开启": "关闭");
common.dialog.confirm("警告",
"确认" + message + "?",
function () {
common.util.__ajax({
url: '/vip/shop/trigger',
data: { shopsIds: shopsId, vipStatus: vipStatus }
}, function () {
g1.reload();
});
});
});
// 初始化筛选框
new common.dropDown({el: "#shopId", ajax: "shopsRest"});
new common.dropDown({el: "#brandId", ajax: "brand"});
/**
* 列表
* @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: "复选框",
// 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: "状态",
render: function (item) {
var HtmArr = [];
if(item.productVipStatus == 0){
HtmArr.push('<label>跟随店铺</label>');
}else 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 == 0){
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="1" onclick="changeStatus('+item.productSKN+',1)"/>开启</label>');
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="2" onclick="changeStatus('+item.productSKN+',2)"/>关闭</label>');
}else if(item.productVipStatus == 1){
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="0" onclick="changeStatus('+item.productSKN+',0)"/>跟随店铺</label>');
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="2" onclick="changeStatus('+item.productSKN+',2)"/>关闭</label>');
}else{
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="0" onclick="changeStatus('+item.productSKN+',0)"/>跟随店铺</label>');
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="1" onclick="changeStatus('+item.productSKN+',1)"/>开启</label>');
}
return HtmArr.join('');
}
}]
});
g.init('/vip/queryProductVipList');
$("#flowShop").click(function() {
if(!$('#all').is(':checked')) {
alert("请勾选复选框!");
return;
}
var params= {
productSkn: common.util.__input('productSkn'),
shopId: common.util.__input('shopId'),
brandId: common.util.__input('brandId'),
productVipStatus: common.util.__input('productVipStatus'),
changeStatus: 0
};
common.dialog.confirm("警告",
"确认批量修改商品VIP状态为跟随店铺?",
function () {
common.util.__ajax({
url: '/vip/batchChangeStatus',
data: params
}, function(res) {
g.reload();
});
});
});
$("#open").click(function() {
if(!$('#all').is(':checked')) {
alert("请勾选复选框!");
return;
}
var params= {
productSkn: common.util.__input('productSkn'),
shopId: common.util.__input('shopId'),
brandId: common.util.__input('brandId'),
productVipStatus: common.util.__input('productVipStatus'),
changeStatus: 1
};
common.dialog.confirm("警告",
"确认批量修改商品VIP状态为开启?",
function () {
common.util.__ajax({
url: '/vip/batchChangeStatus',
data: params
}, function(res) {
g.reload();
});
});
});
$("#close").click(function() {
if(!$('#all').is(':checked')) {
alert("请勾选复选框!");
return;
}
var params= {
productSkn: common.util.__input('productSkn'),
shopId: common.util.__input('shopId'),
brandId: common.util.__input('brandId'),
productVipStatus: common.util.__input('productVipStatus'),
changeStatus: 2
};
common.dialog.confirm("警告",
"确认批量修改商品VIP状态为关闭?",
function () {
common.util.__ajax({
url: '/vip/batchChangeStatus',
data: params
}, function(res) {
g.reload();
});
});
});
$("#searchFilter").click(function() {
g.reload(1);
});
function changeStatus(productSkn,status) {
var param = {
productSkn: productSkn,
productVipStatus: status
};
common.dialog.confirm("警告",
"确认修改状态?",
function () {
common.util.__ajax({
url: '/vip/changeStatus',
data: param
}, function(res) {
g.reload();
});
});
};
// 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;
function changeTab(tab) {
if(tab == 1){
$("#shopVipTab").show();
$("#productVipTab").hide();
}else if(tab == 2){
$("#shopVipTab").hide();
$("#productVipTab").show();
}
}
window.changeTab = changeTab;
\ No newline at end of file
... ...
/**
* Created by wangqianjun on 16/2/23.
*/
var $ = require('jquery'),
common=require('../../common/common');
// 初始化筛选框
new common.dropDown({el: "#shop-name", ajax: "shopsRest"});
new common.dropDown({el: "#brandId", ajax: "brand"});
/**
* 列表
* @type {common.grid}
*/
var g = new common.grid({
el: '#basicTable',
parms: function () {
return {
productSkn: common.util.__input('productSkn'),
shopId: common.util.__input('shop-name'),
brandId: common.util.__input('brandId'),
productVipStatus: common.util.__input('productVipStatus')
};
},
columns: [
// {
// display: "复选框",
// 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: "状态",
render: function (item) {
var HtmArr = [];
if(item.productVipStatus == 0){
HtmArr.push('<label>跟随店铺</label>');
}else 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 == 0){
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="1" onclick="changeStatus('+item.productSKN+',1)"/>开启</label>');
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="2" onclick="changeStatus('+item.productSKN+',2)"/>关闭</label>');
}else if(item.productVipStatus == 1){
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="0" onclick="changeStatus('+item.productSKN+',0)"/>跟随店铺</label>');
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="2" onclick="changeStatus('+item.productSKN+',2)"/>关闭</label>');
}else{
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="0" onclick="changeStatus('+item.productSKN+',0)"/>跟随店铺</label>');
HtmArr.push('<label><input name="'+item.productSKN+'" type="radio" value="1" onclick="changeStatus('+item.productSKN+',1)"/>开启</label>');
}
return HtmArr.join('');
}
}]
});
g.init('/vip/queryProductVipList');
$("#flowShop").click(function() {
if(!$('#all').is(':checked')) {
alert("请勾选复选框!");
return;
}
var params= {
productSkn: common.util.__input('productSkn'),
shopId: common.util.__input('shop-name'),
brandId: common.util.__input('brandId'),
productVipStatus: common.util.__input('productVipStatus'),
changeStatus: 0
};
common.dialog.confirm("警告",
"确认批量修改商品VIP状态为跟随店铺?",
function () {
common.util.__ajax({
url: '/vip/batchChangeStatus',
data: params
}, function(res) {
g.reload();
});
});
});
$("#open").click(function() {
if(!$('#all').is(':checked')) {
alert("请勾选复选框!");
return;
}
var params= {
productSkn: common.util.__input('productSkn'),
shopId: common.util.__input('shop-name'),
brandId: common.util.__input('brandId'),
productVipStatus: common.util.__input('productVipStatus'),
changeStatus: 1
};
common.dialog.confirm("警告",
"确认批量修改商品VIP状态为开启?",
function () {
common.util.__ajax({
url: '/vip/batchChangeStatus',
data: params
}, function(res) {
g.reload();
});
});
});
$("#close").click(function() {
if(!$('#all').is(':checked')) {
alert("请勾选复选框!");
return;
}
var params= {
productSkn: common.util.__input('productSkn'),
shopId: common.util.__input('shop-name'),
brandId: common.util.__input('brandId'),
productVipStatus: common.util.__input('productVipStatus'),
changeStatus: 2
};
common.dialog.confirm("警告",
"确认批量修改商品VIP状态为关闭?",
function () {
common.util.__ajax({
url: '/vip/batchChangeStatus',
data: params
}, function(res) {
g.reload();
});
});
});
$("#filter-btn").click(function() {
g.reload(1);
});
function changeStatus(productSkn,status) {
var param = {
productSkn: productSkn,
productVipStatus: status
};
common.dialog.confirm("警告",
"确认修改状态?",
function () {
common.util.__ajax({
url: '/vip/changeStatus',
data: param
}, function(res) {
g.reload();
});
});
};
// 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;
//商家管理
'use strict';
var $ = require('jquery'),
common=require('../../common/common');
new common.dropDown({el: "#brand-name", ajax: "brand"});
new common.dropDown({el: "#supplier-name", ajax: "supplier"});
new common.dropDown({el: "#shop-name", ajax: "queryShopNames", params: function() {
return {
"checkStatus": common.util.__input("status"),
"operationStatus": 2, // 店铺表中只有创建和未创建两个状态,没有operation_status为0的店铺信息
"checkStatusArr": "200,300,900"
};
}});
$('#filter-btn').on('click', function () {
g.reload(1);
});
var g = new common.grid({
el: '#basicTable',
parms: function () {
return {
"supplierId": common.util.__input("supplier-name"),
"brandId": common.util.__input("brand-name"),
"operationStatus": 2,
"checkStatusArr": "200,300,900",
"blkCheckStatus": 200,
"shopsId": common.util.__input("shop-name"),
"vipStatus": common.util.__input("vip-status")
};
},
columns: [
{display: "店铺ID", name: "shopsId"},
{display: "店铺名称", name: "shopName"},
{
display: "包含品牌", name: "shopRelationList", render: function (item) {
var brandArr = [];
if (item.shopRelationList) {
$.each(item.shopRelationList, function (index, a) {
if($.inArray(a.brandName, brandArr) === -1) {
brandArr.push(a.brandName);
}
});
}
return '<p>' + brandArr.join('</p><p>') + '</p>';
}
},
{display: "创建时间", name: "createTime"},
{display: "更新时间", name: "updateTime"},
{
display: "VIP设置", name: "vipStatus", render: function (item) {
var status = '';
if(+item.vipStatus == 1){
status = "开启";
} else {
status = "关闭";
}
return status;
}
},
{
display: "操作", name: "", render: function (item) {
var HtmArr = [];
if (+item.contractVipStatus == 1) {
if (+item.vipStatus == 1) {
HtmArr.push('<a href="javascript:void(0);" data-id="' + item.shopsId + '" data-status="2" class="btn btn-danger btn-xs delete">关闭</a>');
} else {
HtmArr.push('<a href="javascript:void(0);" data-id="' + item.shopsId + '" data-status="1" class="btn btn-success btn-xs delete">开启</a>');
}
}
return HtmArr.join('');
}
}
]
})
g.init($('#url').val());
/**
* 关闭--点击事件
*/
$(document).on('click', '.delete', function () {
var shopsId = $(this).attr("data-id");
var vipStatus = $(this).attr("data-status");
var message = (vipStatus == 1 ? "开启": "关闭");
common.dialog.confirm("警告",
"确认" + message + "?",
function () {
common.util.__ajax({
url: '/vip/shop/trigger',
data: { shopsIds: shopsId, vipStatus: vipStatus }
}, function () {
g.reload();
});
});
});