Authored by 王钱钧

完善货到付款功能。

... ... @@ -7,16 +7,16 @@ var $ = require('jquery'),
common = require('../common/common');
var ENUM = {
enum: {
1: '待审核',
2: '驳回',
3: '通过',
all: "全部商品"
},
tips: {
"100": 0,
"300": 0,
"400": 0
"all": 0
},
status: {
'1': "开启",
'0': "关闭",
}
}
... ... @@ -24,14 +24,16 @@ var ENUM = {
/*下拉选择*/
common.dropDown({
el: "#brandId",
ajax: "queryBrand"
ajax: "codGetBrandList"
});
new common.dropDown({
el: "#status",
el: "#isPayDelivery",
ajax: ""
});
var currentBtnType;
var currentSelItem;
var t = new common.tab({
el: "#basicTab",
... ... @@ -39,27 +41,30 @@ var t = new common.tab({
var columnname = $(this).find('a').attr('columnname');
if (columnname == '400') {
if (columnname == 'all') {
g.options.columns[1].hidden = false;
g.options.columns[2].hidden = true;
g.options.columns[3].hidden = true;
g.options.columns[4].hidden = true;
g.options.columns[5].hidden = false;
g.options.columns[6].hidden = true;
} else if(columnname == 100) {
g.options.columns[1].hidden = true;
g.options.columns[2].hidden = false;
g.options.columns[3].hidden = false;
g.options.columns[4].hidden = true;
g.options.columns[5].hidden = false;
g.options.columns[5].hidden = true;
g.options.columns[6].hidden = false;
} else {
g.options.columns[1].hidden = true;
g.options.columns[2].hidden = false;
g.options.columns[3].hidden = false;
g.options.columns[4].hidden = false;
g.options.columns[5].hidden = true;
g.options.columns[6].hidden = true;
}
g.init('/supplier/baseproduct/ajax/index');
g.init('/payDelivery/queryTotalBrandPayDelivery');
},
columns: [{
name: "100",
... ... @@ -70,7 +75,7 @@ var t = new common.tab({
display: "驳回({2})",
value: ''
}, {
name: "400",
name: "all",
display: "全部",
value: ''
}]
... ... @@ -81,33 +86,22 @@ var g = new common.grid({
el: '#basicTable',
parms: function() {
return {
//productSkn: common.util.__input("productSkn"),
//productSkc: common.util.__input("productSkc"),
//productSku: common.util.__input("productSku"),
//productName: common.util.__input("productName"),
//shopId: common.util.__input("shopId"),
brandId: common.util.__input("brandId"),
isPayDelivery: common.util.__input("isPayDelivery"),
//gender: common.util.__input("gender"),
//maxSortId: tabTree.selected.length > 0 ? tabTree.selected[0].id : "", // 一级类目
//middleSortId: tabTree.selected.length > 1 ? tabTree.selected[1].id : "", // 二级类目
//smallSortId: tabTree.selected.length > 2 ? tabTree.selected[2].id : "", // 三级类目
//size: common.util.__input("size"),
checkStatus: 100
checkStatus: (t.active && t.active!='all') ? t.active : 400
};
},
columns: [{
display: '品牌',
type: 'brandName'
name: 'brandName'
},
// 审核状态(全部商品是显示) 1
{
display: "状态",
render: function(item) {
var html = [];
html.push("<p>" + ENUM.status[item.status] + "</p>");
html.push("<p>" + ENUM.status[item.isPayDelivery] + "</p>");
//if (item.status == 3 || item.status == 6) {
// html.push("<p style='color:red;'>" + filterNull(item, 'rejectReason') + "</p>");
... ... @@ -122,7 +116,7 @@ var g = new common.grid({
render: function(item) {
var html = [];
html.push("<p>" + common.util.__filterNull(item, 'founderName') + "</p>");
html.push("<p>" + common.util.__filterNull(item, 'applicant') + "</p>");
return html.join('');
}
... ... @@ -132,7 +126,7 @@ var g = new common.grid({
render: function(item) {
var html = [];
html.push("<p>" + common.util.__filterNull(item, 'editTime') + "</p>");
html.push("<p>" + common.util.__filterNull(item, 'createTime') + "</p>");
return html.join('');
}
... ... @@ -142,30 +136,31 @@ var g = new common.grid({
hidden: true,
name: 'status', // 8待上架,2待审核,3驳回,4通过,1已上架,0已下架,5再上架待审核,6再上架驳回,7再上架通过
render: function(item) {
var html = '';
html += ENUM.status[item.status];
if (item.status == 3 || item.status == 6) {
html += '<p style="color:red;">' + common.util.__filterNull(item, 'rejectReason') + '</p>'
}
return html;
return '<p style="color:red;">' + common.util.__filterNull(item, 'rejectReason') + '</p>' ;
}
}, { // 5
display: "操作",
render: function(item) {
var html = [];
if (item.isPayDelivery == 1) { // 待审核
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-close" data-type="close">关闭</a>');
} else {
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-open" data-type="open">开启</a>');
}
//html.push('<a data-index="'+ item.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn" id="btn-item-info">查看</a>');
html.push('<a href="/goods/audit/info/' + item.productSkn + '" class="btn btn-info btn-xs info-btn">查看</a>');
return html.join('');
}
},{ // 6
display: "操作",
hidden: true,
render: function(item) {
var html = [];
//if (item.status == 3 || item.status == 6) { // 驳回
// html.push('<a data-index="'+ item.__index+ '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-pass">通过</a>');
//}
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-reject" data-type="reject">驳回</a>');
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-pass" data-type="pass">通过</a>');
if (item.status == 2 || item.status == 5) { // 待审核
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-pass">通过</a>');
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-reject">驳回</a>');
}
return html.join('');
... ... @@ -173,14 +168,14 @@ var g = new common.grid({
},
]
});
g.init('/payDelivery/queryAllBrandPayDelivery');
g.init('/payDelivery/queryTotalBrandPayDelivery');
// tab初始化
var loadTab = function() {
t.active = undefined;
setTimeout(function() {
common.util.__ajax({
url: "/supplier/baseproduct/auditCount",
url: "/payDelivery/queryCountBrandPayDelivery",
data: g.options.parms()
}, function(res) {
var __dt = $.extend({}, ENUM.tips, res.data);
... ... @@ -196,118 +191,83 @@ $(document).on('click', "#filter-btn", function() {
g.reload();
});
var Bll = {
toast: function(content, fn) {
common.dialog.confirm("温馨提示", content, function() {
common.util.__ajax({
url: '/supplier/baseproduct/auditReject',
data: fn()
}, function() {
g.reload();
loadTab();
});
});
}
}
$(document).on('click', ".edit-class-btn", function() {
console.log($(this).data('type'));
currentBtnType = $(this).data('type');
//批量驳回
$(document).on("click", "#reject-btn", function() {
var url = '';
var alertContent;
currentSelItem = g.rows[$(this).data("index")];
var data = function() {
var selectedArr = g.selected,
len = selectedArr.length,
sknList = [];
if (len <= 0) {
common.util.__tip('请选择要驳回的商品', 'warning');
return;
}
var data = function() {
var reason = $('#reason').val();
if (reason === '' || $.trim(reason) === '') {
return "请填写驳回原因";
if(currentBtnType == 'reject') {
return "请填写驳回原因";
}
}
$.each(selectedArr, function(i, value) {
sknList.push(value['productSkn']);
});
console.log(sknList);
return {
productSknList: JSON.stringify(sknList),
targetStatus: 3, // 驳回
rejectReason: reason
};
}
Bll.toast($("#template").html(), data);
});
brandName: currentSelItem.brandName,
brandId: currentSelItem.brandId,
rejectReason: reason,
isPayDelivery: currentBtnType=='open'?1:0,
checkStatus: currentBtnType=='pass'?200:300,
id: currentSelItem.id,
//批量通过
$(document).on("click", "#pass-btn", function() {
var selectedArr = g.selected,
len = selectedArr.length,
sknList = [];
if (len <= 0) {
common.util.__tip('请选择审核通过的商品', 'warning');
return;
}
var data = function() {
$.each(selectedArr, function(i, value) {
sknList.push(value['productSkn']);
});
console.log(sknList);
return {
productSknList: JSON.stringify(sknList),
targetStatus: 4, // 通过
rejectReason: ""
};
}
Bll.toast("确定要通过该申请吗?", data);
});
// 单个驳回
$(document).on("click", "#btn-item-reject", function() {
//auditOperation([],3,)
var item = g.rows[$(this).data("index")];
var data = function() {
var reason = $('#reason').val();
if (reason === '' || $.trim(reason) === '') {
return "请填写驳回原因";
switch (currentBtnType) {
case 'open':
{
url = '/payDelivery/addPayDeliveryCheck';
alertContent = '开启货到付款需组长审核,您确定提交此申请吗?';
}
break;
return {
productSknList: JSON.stringify([item.productSkn]),
targetStatus: 3, // 驳回
rejectReason: reason
};
}
Bll.toast($("#template").html(), data);
});
case 'close':
{
url = '/payDelivery/addPayDeliveryCheck';
alertContent = '关闭货到付款需组长审核,您确定提交此申请吗?';
}
break;
// 单个通过
$(document).on("click", "#btn-item-pass", function() {
//auditOperation([],3,)
var item = g.rows[$(this).data("index")];
case 'pass':
{
url = '/payDelivery/reviewPayDeliveryCheck';
alertContent = '您确定要通过申请吗?';
}
break;
var data = function() {
case 'reject':
{
url = '/payDelivery/reviewPayDeliveryCheck';
alertContent = $("#template").html();
}
break;
return {
productSknList: JSON.stringify([item.productSkn]),
targetStatus: 4, //通过
rejectReason: ""
};
default :
{
url = '';
alertContent = '未知弹框~';
}
break;
}
Bll.toast("确定要通过该申请吗?", data);
common.dialog.confirm("温馨提示", alertContent, function() {
common.util.__ajax({
url: url,
data: data()
}, function() {
g.reload();
loadTab();
});
});
});
$('#export-btn').on('click', function() {
window.open("/ajax/down?queryConf=" + JSON.stringify(g.options.parms()) + "&type=brandPayDeliveryExport");
});
... ...
... ... @@ -6,12 +6,7 @@ var $ = require('jquery'),
common = require('../common/common');
var ENUM = {
enum: {
1: '待审核',
2: '驳回',
3: '通过',
all: "全部商品"
},
tips: {
"100": 0,
"300": 0,
... ... @@ -24,6 +19,8 @@ var ENUM = {
}
}
var currentSelItem;
/*下拉选择*/
common.dropDown({
... ... @@ -182,7 +179,7 @@ var loadTab = function() {
t.active = undefined;
setTimeout(function() {
common.util.__ajax({
url: "/supplier/baseproduct/auditCount",
url: "/payDelivery/queryCountProductPayDelivery",
data: g.options.parms()
}, function(res) {
var __dt = $.extend({}, ENUM.tips, res.data);
... ... @@ -205,7 +202,7 @@ $(document).on('click', ".edit-class-btn", function() {
var url = '';
var alertContent;
var item = g.rows[$(this).data("index")];
currentSelItem = g.rows[$(this).data("index")];
var data = function() {
var reason = $('#reason').val();
... ... @@ -215,10 +212,11 @@ $(document).on('click', ".edit-class-btn", function() {
}
}
return {
productSkn: item.productSkn,
brandName: item.brandName,
brandId: item.brandId,
rejectReason: reason
productSkn: currentSelItem.productSkn,
brandName: currentSelItem.brandName,
brandId: currentSelItem.brandId,
rejectReason: reason,
id:currentSelItem.id
};
}
... ... @@ -271,29 +269,6 @@ $(document).on('click', ".edit-class-btn", function() {
});
});
// 单个驳回
$(document).on("click", "#btn-item-reject", function() {
//auditOperation([],3,)
BllClose.toast($("#template").html(), data);
});
// 单个通过
$(document).on("click", "#btn-item-pass", function() {
//auditOperation([],3,)
var item = g.rows[$(this).data("index")];
var data = function() {
return {
//productSknList: JSON.stringify([item.productSkn]),
productSkn: item.productSkn, //通过
brandName: item.brandName,
brandId: item.brandId,
rejectReason: ""
};
}
BllOpen.toast("确定要通过该申请吗?", data);
});
$('#export-btn').on('click', function() {
window.open("/ajax/down?queryConf=" + JSON.stringify(g.options.parms()) + "&type=productPayDeliveryExport");
});
\ No newline at end of file
... ...
/**
* Created by wangqianjun on 16/4/13.
*/
'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;
return {
params: {
type: type,
__type: "batch-import"
},
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');
}
}
}
}
common.edit.ajaxfileupload('#sort-file', batchExport('#sort-file', 'payDeliveryModify'));
... ...
... ... @@ -10,19 +10,54 @@ exports.res = [{
route: '/goods/cod/brand/index',
method: 'GET',
view: 'pages/goods/cod-brand',
src: '/goods/cod',
src: '/goods/cod-brand',
}, {
route: '/payDelivery/queryAllBrandPayDelivery',
route: '/payDelivery/queryTotalBrandPayDelivery',
method: 'POST',
url: '/payDelivery/queryAllBrandPayDelivery',
url: '/payDelivery/queryTotalBrandPayDelivery',
params: [
{name: 'brandId', type: 'Number'},
{name: 'brandName', type: 'String'},
{name: 'isPayDelivery', type: 'Number'},
{name: 'checkStatus', type: 'Number'},
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'},
],
}, {
// 开启 & 关闭 货到付款
route: '/payDelivery/addPayDeliveryCheck',
method: 'POST',
url: '/payDelivery/addPayDeliveryCheck',
params: [
{name: 'isPayDelivery', type: 'Number'},
{name: 'brandName', type: 'String'},
{name: 'brandId', type: 'Number'},
],
},{
// 通过 & 驳回申请
route: '/payDelivery/reviewPayDeliveryCheck',
method: 'POST',
url: '/payDelivery/reviewPayDeliveryCheck',
params: [
{name: 'brandName', type: 'String'},
{name: 'brandId', type: 'Number'},
{name: 'rejectReason', type: 'String'},
{name: 'isPayDelivery', type: 'Number'},
{name: 'checktatus', type: 'Number'},
{name: 'id', type: 'Number'},
],
},
// 获取tab上的数量
{
route: '/payDelivery/queryCountBrandPayDelivery',
method: 'POST',
url: '/payDelivery/queryCountBrandPayDelivery',
params: [
{name: 'brandId', type: 'Number'},
{name: 'isPayDelivery', type: 'Number'},
],
},
// ====================== 单品货到付款限制页面路由 ===================
{
route: '/goods/cod/goods/index',
... ... @@ -34,10 +69,11 @@ exports.res = [{
method: 'POST',
url: '/payDelivery/queryPayDeliveryList',
params: [
{name: 'id', type: 'Number'},
{name: 'brandId', type: 'Number'},
{name: 'brandName', type: 'String'},
{name: 'isPayDelivery', type: 'Number'},
{name: 'status', type:'Number'},
{name: 'productSkn', type:'Number'},
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'},
],
... ... @@ -71,6 +107,7 @@ exports.res = [{
{name: 'productSkn', type: 'String'},
{name: 'brandName', type: 'String'},
{name: 'brandId', type: 'Number'},
{name: 'id', type: 'Number'},
],
},{
// 驳回申请
... ... @@ -82,6 +119,7 @@ exports.res = [{
{name: 'brandName', type: 'String'},
{name: 'rejectReason', type: 'String'},
{name: 'brandId', type: 'Number'},
{name: 'id', type: 'Number'},
],
},
// 获取skn列表
... ... @@ -92,6 +130,16 @@ exports.res = [{
params: [
{name: 'idName', type: 'String'}
],
}, // 获取tab上的数量
{
route: '/payDelivery/queryCountProductPayDelivery',
method: 'POST',
url: '/payDelivery/queryCountProductPayDelivery',
params: [
{name: 'productSkn', type: 'String'},
{name: 'brandId', type: 'Number'},
{name: 'isPayDelivery', type: 'Number'},
],
}, { // 获取品牌列表
route: '/payDelivery/queryPayDeliveryBrandName',
method: 'POST',
... ... @@ -99,7 +147,12 @@ exports.res = [{
params: [
{name: 'idName', type: 'String'}
],
},
}, { // 批量导入
route: '/goods/cod/upload',
method: 'GET',
view: 'pages/goods/cod-upload',
src: '/goods/cod-upload',
}
];
\ No newline at end of file
... ...
... ... @@ -34,14 +34,14 @@
<div class="panel-col">
<select id="isPayDelivery" class="form-control">
<option value="-1">状态</option>
<option value="Y">开启</option>
<option value="N">关闭</option>
<option value="1">开启</option>
<option value="0">关闭</option>
</select>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">导出</a>
<a id="export-btn" href="" class="btn btn-info">导出</a>
</div>
</div>
... ... @@ -57,7 +57,8 @@
<script type="text/template" id="template">
<div class="rows" style="height: 100px;">
<div class="form-group">
<span class="col-sm-2 control-label">驳回原因:</span>
<p>您确定要驳回申请吗?</p>
<span class="col-sm-2 control-label" style="color:red;">* 驳回原因:</span>
<div class="col-sm-8">
<textarea id="reason" class="form-control" rows="3" ></textarea>
</div>
... ...
... ... @@ -48,9 +48,11 @@
</div>
<div class="panel-col">
<div class="panel-col-3">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" 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 class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">商品管理</a></li>
<li>货到付款限制</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>批量导入</h4>
</div>
</div>
</div>
</div>
</div>
<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">单品设置</td>
<td>上传EXCEL:</td>
<td style="position: relative;"><input id="sort-file" name="file" data-type="searchSort" type="file" style="cursor: pointer; height: 37px; top: 8px;">
<!--<p style="background: darkgray; text-align: center;">选择文件</p>-->
</td>
</tr>
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、Excel表头为:<span style="color: #67D267;">SKN、操作(关闭:0;开启:1)</span><br>
3、第一行为表头内容,第二行开始为正式内容<br>
4、每个文件控制在2500行以内<br>
5、<a href="{{domain}}/common/payDelivery.xlsx">下载样例</a>
</td>
</tr>
</table>
</div>
</div>
</div>
\ No newline at end of file
... ...