Authored by dongjunjie

yoho币

... ... @@ -3,7 +3,7 @@
var $ = require('jquery'),
common=require('../common/common');
var pricePercent = 0.2; //yoho币审核比例线
var pricePercent = 20; //yoho币审核比例线
var loadModal = null;
var importYohoCoinData = null;
var isNeedAudit = false;
... ... @@ -15,9 +15,9 @@ var ENUM = {
},
status: {
0: '未设置',
1: '<font color="#428bca">待审核</font>',
2: '<font color="#67D267">通过</font>',
3: '<font color="#d9534f">驳回</font>'
1: '<b style="color:#428bca">待审核</b>',
2: '<b style="color:#5cb85c">通过</b>',
3: '<b style="color:#ff0000">驳回</b>'
}
}
... ... @@ -107,7 +107,7 @@ function ajaxUpload(){
},
onComplete: function(response) {
console.log("批量接口返回数据",response);
if (response.code == 200 && response.data.successList.length) {
if (response.code == 200 && response.data.successList) {
loadingClose();
showImportMessage("批量导入成功!", "success");
common.util.__tip("批量导入成功!", 'success');
... ... @@ -115,7 +115,7 @@ function ajaxUpload(){
showImportTable(response.data);
return true;
}
else if(response.data && response.data.failFileReason.length){
else if(response.code == 200 && response.data.failFileReason){
loadingClose();
showImportMessage(response.data.failFileReason.join('<br/>'), "error");
common.util.__tip("上传出错!具体请看批量上传结果。", 'warning');
... ... @@ -132,6 +132,7 @@ function ajaxUpload(){
//批量上传确认
function ajaxUploadSubmit(importAuditorId){
console.log(JSON.stringify(importYohoCoinData));
common.util.__ajax({
url:'/good/yohoCoin/insertBatch',
data: {
... ... @@ -227,8 +228,9 @@ function freshYohoCoinRowData(productSkn, yohoCoin, status){
if(status == 1){
SknDom.find(".operation").empty();
}else{
SknDom.find(".operation").html("<button type='button' name='修改' class='btn btn-info btn-sm btn-modify openEditor'>收起</button>");
SknDom.find(".operation").html("<button type='button' name='修改' class='btn btn-info btn-sm btn-modify'>修改</button>");
}
SknDom.find(".dataForEditor td").hide();
}
//关闭loading
... ... @@ -306,6 +308,11 @@ $(document).on('click', '#import-btn', function() {
$('#yohoCoin_import').show();
});
//导出
$(document).on('click', '#Outport-btn', function() {
});
//返回列表
$(document).on('click', '#return-btn', function() {
$('#yohoCoin_import').hide();
... ...
... ... @@ -11,12 +11,120 @@ var ENUM = {
},
status: {
0: '未设置',
1: '<font color="#428bca">待审核</font>',
2: '<font color="#5cb85c">通过</font>',
3: '<font color="#d9534f">驳回</font>'
1: '<b style="color:#428bca">待审核</b>',
2: '<b style="color:#5cb85c">通过</b>',
3: '<b style="color:#ff0000">驳回</b>'
},
auditor: {
2965: 'Tracy',
10235: 'David Wong'
}
}
var gridParams = function() {
var select = tabTree.getAddress();
return {
auditStatus: $("#yohoCoinNav .active").data('status'),
product_skn: common.util.__input("skn"),
shop_id: common.util.__input("shop"),
brand_id: common.util.__input("brand"),
supplier_id: common.util.__input("supplier"),
gender: common.util.__input("gender"),
maxSortId: select[0] ? select[0].id : "",
middleSortId: select[1] ? select[1].id : "",
smallSortId: select[2] ? select[2].id : "",
sortId: select[3] ? select[3].id : ""
};
}
var COLUMNS = {
c1: [ //待审核列表
{display: '', type: 'checkbox'},
{display: 'SKN', name: 'productSkn'},
{display: '商品信息', name: 'info', render: function(item) {
var html = ""
html += "<p>名称:" + item.productName + "</p>" + "<p>品牌:" + item.brandName + "</p>" + "<div>类目:";
if(item.maxSortName) {html += item.maxSortName;}
if(item.middleSortName) {html += "&nbsp;>&nbsp;" + item.middleSortName;}
if(item.smallSortName) {html += "&nbsp;>&nbsp;" + item.smallSortName;}
html += "</div>";
return html;
}},
{display: '供应商 / 店铺', name: 'supplier_name', render: function(item) {
var html = '';
if (item.supplierName) {html += item.supplierName;}
if (item.shopName) {html += '&nbsp;/&nbsp;' + item.shopName;}
return html;
}},
{display: '性别', name: 'gender', render: function(item) {
return ENUM.gender[item.gender];
}},
{display: '吊牌价', name: 'retailPrice'},
{display: '销售价', name: 'salesPrice'},
{display: '执行返币数', name: 'returnCoin', render: function(item) {
return item.productPrice.returnCoin;
}},
{display: '待审核返币数', name: 'returnCoin', render: function(item) {
return item.productPrice.needAuditCoin;
}},
{display: '状态', name: 'status', render: function(item) {
return ENUM.status[item.productPrice.coinStatus];
}},
{display: '操作信息', name: 'operateInfo', render: function(item) {
var html = '';
if (item.productPrice.founder) {html += '<p>' + item.productPrice.founder + '</p>';}
if (item.productPrice.updateTime) {html += '<p>' + item.productPrice.updateTime + '</p>';}
return html;
}},
{display: '操作', render: function(item) {
return '<a href="javascript:;" class="btn btn-success btn-xs btn-checkOk" data-skn="' + item.productSkn + '">审核通过</a>' +
'<a href="javascript:;" class="btn btn-danger btn-xs btn-checkNo" data-skn="' + item.productSkn + '">驳回</a>';
}}
],
c2: [ //通过,驳回,全部列表展示
{display: 'SKN', name: 'productSkn'},
{display: '商品信息', name: 'info', render: function(item) {
var html = ""
html += "<p>名称:" + item.productName + "</p>" + "<p>品牌:" + item.brandName + "</p>" + "<div>类目:";
if(item.maxSortName) {html += item.maxSortName;}
if(item.middleSortName) {html += "&nbsp;>&nbsp;" + item.middleSortName;}
if(item.smallSortName) {html += "&nbsp;>&nbsp;" + item.smallSortName;}
html += "</div>";
return html;
}},
{display: '供应商 / 店铺', name: 'supplier_name', render: function(item) {
var html = '';
if (item.supplierName) {html += item.supplierName;}
if (item.shopName) {html += '&nbsp;/&nbsp;' + item.shopName;}
return html;
}},
{display: '性别', name: 'gender', render: function(item) {
return ENUM.gender[item.gender];
}},
{display: '吊牌价', name: 'retailPrice'},
{display: '销售价', name: 'salesPrice'},
{display: '返币数', name: 'returnCoin', render: function(item) {
return item.productPrice.needAuditCoin;
}},
{display: '状态', name: 'status', render: function(item) {
var html = ENUM.status[item.productPrice.coinStatus] + "<br>";
if(item.productPrice.coinStatus == 3){
html += '<a class="noCheckReason" href="javascript:" data-text="'+ item.productPrice.comment +'" style="color: #ec971f;text-decoration: underline">驳回理由</a>';
}
return html;
}},
{display: '审批人', name: 'auditor', render: function(item) {
return ENUM.auditor[item.productPrice.auditorName];
}},
{display: '操作信息', name: 'operateInfo', render: function(item) {
var html = '';
if (item.productPrice.founder) {html += '<p>' + item.productPrice.founder + '</p>';}
if (item.productPrice.updateTime) {html += '<p>' + item.productPrice.updateTime + '</p>';}
return html;
}}
]
}
new common.dropDown({
el: '#shop',
ajax: 'shopsRest'
... ... @@ -34,78 +142,134 @@ new common.dropDown({
var tabTree = new common.tabTree("#sortTree", {status: 1, sortLevel: 1});
tabTree.init();
var g = new common.grid({
var g1 = new common.grid({
el: "#yohoCoinAudit_table",
parms: function() {
var select = tabTree.getAddress();
return {
auditStatus: $("#yohoCoinNav .active").data('status'),
product_skn: common.util.__input("skn"),
shop_id: common.util.__input("shop"),
brand_id: common.util.__input("brand"),
supplier_id: common.util.__input("supplier"),
gender: common.util.__input("gender"),
maxSortId: select[0] ? select[0].id : "",
middleSortId: select[1] ? select[1].id : "",
smallSortId: select[2] ? select[2].id : "",
sortId: select[3] ? select[3].id : ""
};
},
columns: [
{display: '', type: 'checkbox'},
{display: 'SKN', name: 'productSkn'},
{display: '商品信息', name: 'info', render: function(item) {
var html = ""
html += "<p>名称:" + item.productName + "</p>" + "<p>品牌:" + item.brandName + "</p>" + "<div>类目:";
if(item.maxSortName) {html += item.maxSortName;}
if(item.middleSortName) {html += "&nbsp;>&nbsp;" + item.middleSortName;}
if(item.smallSortName) {html += "&nbsp;>&nbsp;" + item.smallSortName;}
html += "</div>";
return html;
}},
{display: '供应商 / 店铺', name: 'supplier_name', render: function(item) {
var html = '';
if (item.supplierName) {html += item.supplierName;}
if (item.shopName) {html += '&nbsp;/&nbsp;' + item.shopName;}
return html;
}},
{display: '性别', name: 'gender', render: function(item) {
return ENUM.gender[item.gender];
}},
{display: '吊牌价', name: 'retailPrice'},
{display: '销售价', name: 'salesPrice'},
{display: '返币数', name: 'returnCoin', render: function(item) {
return item.productPrice.returnCoin;
}},
{display: '状态', name: 'status', render: function(item) {
return ENUM.status[item.productPrice.coinStatus];
}},
{display: '操作信息', name: 'operateInfo', render: function(item) {
var html = '';
if (item.productPrice.founder) {html += '<p>' + item.productPrice.founder + '</p>';}
if (item.productPrice.updateTime) {html += '<p>' + item.productPrice.updateTime + '</p>';}
return html;
}},
{display: '操作', render: function(item) {
if(item.productPrice.coinStatus == 1){
return '<a href="javascript:;" class="btn btn-success btn-xs btn-checkOk" data-skn="' + item.productSkn + '">审核通过</a>' +
'<a href="javascript:;" class="btn btn-danger btn-xs btn-checkNo" data-skn="' + item.productSkn + '">驳回</a>';
}else{
return '无操作';
}
}}
]
parms: gridParams,
columns: COLUMNS.c1
}),
g2 = new common.grid({
el: "#yohoCoinAudit_table",
parms: gridParams,
columns: COLUMNS.c2
}),
g = null;
//审批通过
function ajaxCheckOk(productSkn){
common.util.__ajax({
url:'/good/yohoCoin/pass',
data: {
"productSkn": productSkn
}
},function(rs){
g.reload();
});
}
//批量审核通过
function ajaxCheckOkBatch(productSkns){
common.util.__ajax({
url:'/good/yohoCoin/passBatch',
data: {
"productSkns": productSkns
}
},function(rs){
g.reload();
});
}
//驳回
function ajaxCheckNo(productSkn, comment){
common.util.__ajax({
url:'/good/yohoCoin/reject',
data: {
"productSkn": productSkn,
"comment": comment
}
},function(rs){
g.reload();
});
}
//批量驳回
function ajaxCheckNoBatch(productSkns, comment){
common.util.__ajax({
url:'/good/yohoCoin/rejectBatch',
data: {
"productSkns": productSkns,
"comment": comment
}
},function(rs){
g.reload();
});
}
//找到以选中的商品的SKN
function findCheckedSknList(){
var sknList = new Array();
var checkedItems = $("#yohoCoinAudit_table").find(".wqt_checkbox:checked");
$.each(checkedItems, function(index,value){
var skn = $(value).parent().next().text();
sknList.push(skn);
});
console.log(sknList)
return sknList;
}
//批量审批通过
$(document).on('click', '#all-checkOk', function() {
var checkOkList = findCheckedSknList();
if(checkOkList.length > 0){
common.dialog.confirm(
"批量审核通过确认",
"你确认<strong style='color:#5cb85c'>&nbsp;&nbsp;批量审核通过&nbsp;&nbsp;</strong>么?",
function(){
ajaxCheckOkBatch(checkOkList);
},
function(){}
);
}else{
common.util.__tip("没有选择任何商品!");
}
});
//批量驳回
$(document).on('click', '#all-checkNo', function() {
var checkNoList = findCheckedSknList();
if(checkNoList.length > 0){
common.dialog.confirm(
"批量审核驳回确认",
"你确认<strong style='color:#d9534f'>&nbsp;&nbsp;批量审核驳回&nbsp;&nbsp;</strong>么?如果确认,<strong style='color: #f0ad4e'>请填写驳回理由!</strong> \
<textarea id='checkComment' class='form-control' rows='3' style='margin: 10px 0'></textarea> \
<div class='checkTip' style='display: none; color: #ff0000; font-weight: bold'><span>提示:请填写驳回理由!</span></div>",
function(){
var comment = $("#checkComment").val();
if(comment){
ajaxCheckNoBatch(checkNoList, comment);
}else{
$("#checkComment").focus();
$(".checkTip").show();
return false;
}
},
function(){}
);
}else{
common.util.__tip("没有选择任何商品!");
}
});
g.init($("#gridurl").val());
//选择分类
$(document).on('click', '#yohoCoinNav li', function() {
$(this).addClass("active").siblings().removeClass("active");
g.reload();
if($(this).data("status") == "1"){
$("#checkOperation").show();
g1.init($("#gridurl").val());
g = g1;
}else{
$("#checkOperation").hide();
g2.init($("#gridurl").val());
g = g2;
}
});
... ... @@ -116,14 +280,7 @@ $(document).on('click', '.btn-checkOk', function() {
"审核通过确认",
"你确认<strong style='color:#5cb85c'>&nbsp;&nbsp;审核通过&nbsp;&nbsp;</strong>么?",
function(){
common.util.__ajax({
url:'/good/yohoCoin/pass',
data: {
"productSkn": productSkn
}
},function(rs){
g.reload();
});
ajaxCheckOk(productSkn);
},
function(){}
);
... ... @@ -140,15 +297,7 @@ $(document).on('click', '.btn-checkNo', function() {
function(){
var comment = $("#checkComment").val();
if(comment){
common.util.__ajax({
url:'/good/yohoCoin/reject',
data: {
"productSkn": productSkn,
"comment": comment
}
},function(rs){
g.reload();
});
ajaxCheckNo(productSkn, comment);
}else{
$("#checkComment").focus();
$(".checkTip").show();
... ... @@ -159,6 +308,12 @@ $(document).on('click', '.btn-checkNo', function() {
);
});
//查看驳回理由
$(document).on('click', '.noCheckReason', function() {
var reason = $(this).data("text");
common.dialog.confirm("查看驳回理由", reason, function(){}, function(){});
});
//筛选
$(document).on('click', '#filter-btn', function() {
g.reload(1);
... ... @@ -166,6 +321,9 @@ $(document).on('click', '#filter-btn', function() {
//全部
$(document).on('click', '#all-btn', function() {
location.href = '';
$("#yohoCoinNav li").eq(3).click();
});
//禁页面默认在待审核列表
$("#yohoCoinNav li").eq(0).click();
... ...
... ... @@ -24,13 +24,14 @@ exports.res = [
gender: true,
sortTree: true,
returnCoinTime: false,
bulkImport: true
bulkImport: true,
bulkOutport: true
},
gridurl: '/good/yohoCoin/queryPageList'
}
},
{//查询yoho币页面
{//yoho币管理列表查询
route: "/good/yohoCoin/queryPageList",
method: "POST",
url: "/yohoCoin/queryPageList",
... ... @@ -101,10 +102,29 @@ exports.res = [
sortTree: true,
returnCoinTime: false
},
gridurl: '/good/yohoCoin/queryPageList'
gridurl: '/good/yohoCoin/queryPageList4Audit'
}
},
{//yoho币审核列表查询
route: "/good/yohoCoin/queryPageList4Audit",
method: "POST",
url: "/yohoCoin/queryPageList4Audit ",
params:[
{name: 'productSkn', type: 'Number'},
{name: 'shopId', type: 'Number'},
{name: 'brandId', type: 'Number'},
{name: 'supplierId', type: 'Number'},
{name: 'gender', type: 'String'},
{name: 'auditStatus', type: 'Number'},
{name: 'maxSortId', type: 'Number'},
{name: 'middleSortId', type: 'Number'},
{name: 'smallSortId', type: 'Number'},
{name: 'sortId', type: 'Number'},
{name: 'page', type: 'Number'}
]
},
{//审核通过
route: "/good/yohoCoin/pass",
method: "POST",
... ... @@ -114,6 +134,15 @@ exports.res = [
]
},
{//批量审核通过
route: "/good/yohoCoin/passBatch",
method: "POST",
url: "/yohoCoin/passBatch",
params:[
{name: 'productSkns', type: 'String'},
]
},
{//驳回
route: "/good/yohoCoin/reject",
method: "POST",
... ... @@ -123,4 +152,14 @@ exports.res = [
{name: 'comment', type: 'String'},
]
},
{//批量驳回
route: "/good/yohoCoin/rejectBatch",
method: "POST",
url: "/yohoCoin/rejectBatch",
params:[
{name: 'productSkns', type: 'String'},
{name: 'comment', type: 'String'},
]
}
]
... ...
... ... @@ -108,9 +108,16 @@
<div class="panel-col" style="width: auto">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="javascript:;" class="btn btn-info">全部</a>
</div>
<div class="panel-col" style="width: auto">
{{# bulkImport}}
<a id="import-btn" href="javascript:;" class="btn btn-info">批量导入</a>
{{/ bulkImport}}
{{# bulkOutport}}
<a id="Outport-btn" href="javascript:;" class="btn btn-info">导出</a>
{{/ bulkOutport}}
</div>
</div>
</div>
... ... @@ -232,19 +239,21 @@
<td class="center coinStatus" style="width: 8%">
[[statusName]]<br>
[[if productPrice.coinStatus == 3]]
<a class="noCheckReason" href="javascript:" data-text="[[productPrice.reason]]" style="color: #ff0000">驳回理由</a>
<a class="noCheckReason" href="javascript:" data-text="[[productPrice.comment]]" style="color: #ec971f;text-decoration: underline">驳回理由</a>
[[/if]]
</td>
<td style="width: 12%">
[[if productPrice.founder]]<p>[[productPrice.founder]]</p>[[/if]]
[[if productPrice.updateTime]]<p>[[productPrice.updateTime]]</p>[[/if]]
</td>
[[if productPrice.coinStatus == 0]]
<td class="center operation" style="width: 5%"><button type="button" name="设置" class="btn btn-primary btn-sm btn-modify">设置</button></td>
[[/if]]
[[if productPrice.coinStatus == 2 || productPrice.coinStatus == 3]]
<td class="center operation" style="width: 5%"><button type="button" name="修改" class="btn btn-info btn-sm btn-modify">修改</button></td>
[[/if]]
<td class="center operation" style="width: 5%">
[[if productPrice.coinStatus == 0]]
<button type="button" name="设置" class="btn btn-primary btn-sm btn-modify">设置</button>
[[/if]]
[[if productPrice.coinStatus == 2 || productPrice.coinStatus == 3]]
<button type="button" name="修改" class="btn btn-info btn-sm btn-modify">修改</button>
[[/if]]
</td>
</tr>
<tr class="dataForEditor">
... ... @@ -314,14 +323,14 @@
<td>[[item.brandName]]</td>
<td>[[item.retailPrice]]</td>
<td>
[[if item.returnCoin >= item.retailPrice * 0.2]]
[[if item.returnCoin >= item.retailPrice * 20]]
<font color="#ff0000">[[item.returnCoin]]</font><br>
[[else]]
[[item.returnCoin]]<br>
[[/if]]
<font color="#999999">([[item.preReturnCoin]])</font>
<font color="#999999">[ [[item.preReturnCoin]] ]</font>
</td>
<td><a href="javascript:;" class="btn btn-sm btn-danger btn-delete-yohoCoin" data-index="[[_index]]">删除</a></td>
<td><a href="javascript:;" class="btn btn-xs btn-danger btn-delete-yohoCoin" data-index="[[_index]]">删除</a></td>
</tr>
[[/each]]
[[else]]
... ...
... ... @@ -99,8 +99,8 @@
</div>
<div id="checkOperation" class="panel-col" style="width: auto;">
<a id="all-checkOk" href="javascript:;" class="btn btn-success">审核通过</a>
<a id="all-checkNo" href="javascript:;" class="btn btn-danger">驳回</a>
<a id="all-checkOk" href="javascript:;" class="btn btn-success">批量通过</a>
<a id="all-checkNo" href="javascript:;" class="btn btn-danger">批量驳回</a>
</div>
</div>
</div>
... ... @@ -114,7 +114,6 @@
<li data-status="3"><a href="#">驳回</a></li>
<li data-status=""><a href="#">全部</a></li>
</ul>
<div class="dataTables_wrapper no-footer" id="yohoCoinAudit_table"></div>
</div>
</div>
... ...