Authored by 陶雨

Merge branch 'release/1.6' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into release/1.6

... ... @@ -6,6 +6,7 @@ var $ = require('jquery'),
var pricePercent = 0.2; //yoho币审核比例线
var loadModal = null;
var importYohoCoinData = null;
var isNeedAudit = false;
var ENUM = {
gender: {
1: '男',
... ... @@ -15,7 +16,7 @@ var ENUM = {
status: {
0: '未设置',
1: '<font color="#428bca">待审核</font>',
2: '<font color="#5cb85c">通过</font>',
2: '<font color="#67D267">通过</font>',
3: '<font color="#d9534f">驳回</font>'
}
}
... ... @@ -89,9 +90,7 @@ function ajaxSave(productSkn, yohoCoin, auditorId, salesPrice){
}
},function(rs){
console.log("yoho币保存返回" + rs);
if(yohoCoin < (salesPrice * pricePercent)){
}
freshYohoCoinRowData(rs.data.productSkn, rs.data.returnCoin, rs.data.coinStatus);
});
}
... ... @@ -108,8 +107,12 @@ function ajaxUpload(){
},
onComplete: function(response) {
console.log("批量接口返回数据",response);
if (response.code == 200 && response.data.taskId) {
ajaxExeclByTaskId(response.data.taskId);
if (response.code == 200 && response.data.successList.length) {
loadingClose();
showImportMessage("批量导入成功!", "success");
common.util.__tip("批量导入成功!", 'success');
//显示导入列表数据
showImportTable(response.data);
return true;
}
else if(response.data && response.data.failFileReason.length){
... ... @@ -127,37 +130,17 @@ function ajaxUpload(){
});
}
//异步批量上传接口
function ajaxExeclByTaskId(taskId){
//异步调用的接口importResult/queryBatchImportResult 参数名param
//批量上传确认
function ajaxUploadSubmit(importAuditorId){
common.util.__ajax({
url: '/yohoCoin/importResult/queryBatchImportResult',
url:'/good/yohoCoin/insertBatch',
data: {
param:taskId
auditorId: importAuditorId,
productPrices: JSON.stringify(importYohoCoinData)
}
},function(res){
console.log("异步返回接口",res);
if(res.data.length){
loadingClose();
importYohoCoinData = res.data;
showImportTable(res);
showImportMessage("批量导入成功!", "success");
common.util.__tip("批量导入成功!", 'success');
}else{
setTimeout(function(){
ajaxExeclByTaskId.call(null,taskId);
},5000);
}
},true);
}
//批量上传确认
function ajaxUploadSubmit(data){
common.util.__ajax({
url:'',
data: data
},function(rs){
location.href = '';
//common.util.__tip("保存成功!");
//location.href = '';
});
}
... ... @@ -166,11 +149,14 @@ function ajaxUploadSubmit(data){
//显示批量导入结果
function showImportMessage(message, statue){
$("#yohoCoinImportMessage").removeAttr("class").addClass(statue).show();
$("#detailMassage").text(message);
$("#detailMassage").html(message);
}
//显示批量导入数据表
function showImportTable(data){
importYohoCoinData = data.successList;
isNeedAudit = data.isNeedAudit;
$("#importResultTable").html(common.util.__template2($("#yohoCoinImportResultTable").html(),data));
$("#yohoCoinImportResultSet").show();
$("#yohoCoinImportResult").show();
... ... @@ -237,7 +223,12 @@ function checkAuditor(auditor){
function freshYohoCoinRowData(productSkn, yohoCoin, status){
var SknDom = $('._' + productSkn);
SknDom.find(".returnYohoCoin").text(yohoCoin);
SknDom.find(".coinStatus").text(ENUM.status[status]);
SknDom.find(".coinStatus").html(ENUM.status[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>");
}
}
//关闭loading
... ... @@ -254,13 +245,20 @@ $(document).on('click', '.btn-delete-yohoCoin', function() {
var index = $(this).data("index");
if(importYohoCoinData){
[].splice.call(importYohoCoinData,index,1);
$("#importResultTable").html(common.util.__template2($("#yohoCoinImportResultTable").html(),data));
$("#importResultTable").html(common.util.__template2($("#yohoCoinImportResultTable").html(),{"successList":importYohoCoinData}));
}
console.log(importYohoCoinData);
});
//批量导入结果列表确定
$(document).on('click', '.btn-submit-yohoCoin', function() {
ajaxUploadSubmit();
var importAuditorIdInput = $("#importAuditor");
if(isNeedAudit){
if(!checkAuditor(importAuditorIdInput)){
return false;
}
}
ajaxUploadSubmit(importAuditorIdInput.val());
});
//保存操作
... ... @@ -284,7 +282,7 @@ $(document).on('click', '.btn-save', function() {
//显示修改
$(document).on('click', '.btn-modify', function() {
if($(this).hasClass("openEditor")){
$(this).text("修改").removeClass("openEditor");
$(this).text($(this).attr("name")).removeClass("openEditor");
var dataForShow = $(this).parents(".dataForShow");
dataForShow.find(".dataForEditor td").hide();
dataForShow.find(".editor-yohoCoin").val(dataForShow.find(".returnYohoCoin").text());
... ... @@ -295,6 +293,12 @@ $(document).on('click', '.btn-modify', function() {
}
});
//查看驳回理由
$(document).on('click', '.noCheckReason', function() {
var reason = $(this).data("text");
common.dialog.confirm("查看驳回理由", reason, function(){}, function(){});
});
//显示批量导入
$(document).on('click', '#import-btn', function() {
$('#yohoCoin_table').hide();
... ... @@ -320,6 +324,6 @@ $(document).on('click', '#all-btn', function() {
});
//校验失败编辑
$(document).on('change', '#yohoCoin_table .error', function() {
$(document).on('change', '.error', function() {
$(this).removeClass('error');
});
\ No newline at end of file
... ...
... ... @@ -51,13 +51,10 @@ var g = new common.grid({
sortId: select[3] ? select[3].id : ""
};
},
columns: [{
display: 'SKN',
name: 'productSkn'
}, {
display: '商品信息',
name: 'info',
render: function(item) {
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;}
... ... @@ -65,56 +62,39 @@ var g = new common.grid({
if(item.smallSortName) {html += "&nbsp;>&nbsp;" + item.smallSortName;}
html += "</div>";
return html;
}
}, {
display: '供应商 / 店铺',
name: 'supplier_name',
render: function(item) {
}},
{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 html;
}},
{display: '性别', name: 'gender', render: function(item) {
return ENUM.gender[item.gender];
}
}, {
display: '吊牌价',
name: 'retailPrice'
}, {
display: '销售价',
name: 'salesPrice'
}, {
display: '返币数',
name: 'returnCoin',
render: function(item) {
}},
{display: '吊牌价', name: 'retailPrice'},
{display: '销售价', name: 'salesPrice'},
{display: '返币数', name: 'returnCoin', render: function(item) {
return item.productPrice.returnCoin;
}
}, {
display: '状态',
name: 'status',
render: function(item) {
}},
{display: '状态', name: 'status', render: function(item) {
return ENUM.status[item.productPrice.coinStatus];
}
},{
display: '操作信息',
name: 'operateInfo',
render: function(item) {
}},
{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>';
}
}]
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 '无操作';
}
}}
]
});
g.init($("#gridurl").val());
... ... @@ -122,6 +102,11 @@ 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();
}else{
$("#checkOperation").hide();
}
});
//审核通过
... ... @@ -174,5 +159,13 @@ $(document).on('click', '.btn-checkNo', function() {
);
});
//筛选
$(document).on('click', '#filter-btn', function() {
g.reload(1);
});
//全部
$(document).on('click', '#all-btn', function() {
location.href = '';
});
... ...
... ... @@ -420,20 +420,17 @@ $(document).on("click", ".edit", function () {
var goodsgird = new common.grid({
el: '#goodsgird',
parms: function () {
var beginPrice = 0, endPrice = 1000000;
if (common.util.__input('beginPrice')) {
beginPrice = common.util.__input('beginPrice');
var price = "";
if (common.util.__input('beginPrice')&&common.util.__input('endPrice')) {
price = common.util.__input('beginPrice')+","+common.util.__input('endPrice');
}
if (common.util.__input('endPrice')) {
endPrice = common.util.__input('endPrice')
}
return {//status=1&sales=Y&stocknumber=1&attribute_not=2
return {
status:1,
sales:"Y",
stocknumber:"1",
attribute_not:"2",
query: common.util.__input('skns'),
price: beginPrice + "," + endPrice
price: price
};
},
columns: [
... ...
... ... @@ -57,6 +57,10 @@
background: #ccc;
color: #ffffff;
}
#yohoCoinImportMessage b, #yohoCoinImportMessage span{
display: block;
float: left;
}
#yohoCoin_import .success{
background:#449d44;
... ... @@ -66,6 +70,11 @@
background:#ff0000;
}
#yohoCoin_import select.error{
border: 2px solid #ff0000;
background: none;
}
#yohoCoin_import .title{
padding: 5px 10px;
background: #5bc0de;
... ... @@ -94,4 +103,4 @@
#importResultTable th, #importResultTable td{
text-align: center;
vertical-align: inherit;
}
}
\ No newline at end of file
... ...
... ... @@ -44,7 +44,8 @@ exports.res = [
{name: 'maxSortId', type: 'Number'},
{name: 'middleSortId', type: 'Number'},
{name: 'smallSortId', type: 'Number'},
{name: 'sortId', type: 'Number'}
{name: 'sortId', type: 'Number'},
{name: 'page', type: 'Number'}
]
},
... ... @@ -60,7 +61,7 @@ exports.res = [
]
},
{//批量上传
{//批量上传TaskId查询
route: "/yohoCoin/importResult/queryBatchImportResult",
method: "POST",
url: "/importResult/queryBatchImportResult",
... ... @@ -68,6 +69,16 @@ exports.res = [
{name: 'param', type: 'String'},
]
},
{//批量确认提交
route: "/good/yohoCoin/insertBatch",
method: "POST",
url: "/yohoCoin/insertBatch",
params:[
{name: 'auditorId', type: 'Number'},
{name: 'productPrices', type: 'String'}
]
},
/*************************yoho币审核页面接口*******************************/
{//yoho币审核页面渲染
... ...
... ... @@ -14,7 +14,6 @@ exports.search = function (req, res) {
params.push(key + "=" + encodeURI(req.body[key]));
}
var url = searchDomain + "/search.json?viewNum=" + size + "&" + params.join('&');
//console.log("请求url",url);
request({url: url}, function (error, response, body) {
var data = {};
data.list = [];
... ...
... ... @@ -121,14 +121,14 @@
<div class="dataTables_wrapper no-footer" id="yohoCoin_table"></div>
<div class="panel bulk-import" id="yohoCoin_import">
<a id="return-btn" href="javascript:;" class="btn btn-info">返回列表</a>
<a id="return-btn" href="javascript:;" class="btn btn-primary">返回列表</a>
<table class="table table-bordered" style="border:1px solid #ddd; margin-top: 10px">
<tr>
<td width="120px" style="line-height: 37px"><b>上传EXCEL:</b></td>
<td style="position: relative;">
<input id="yohoCoinUpload" name="file" type="file" style="cursor: pointer; height: 37px; top: 8px;">
<div class="file-name btn btn-primary">请选择文件</div>
<div class="file-name btn btn-info">请选择文件</div>
</td>
</tr>
<tr>
... ... @@ -144,7 +144,9 @@
</table>
<div id="yohoCoinImportMessage">
<b>批量上传结果:</b><span id="detailMassage"></span>
<b>批量上传结果:</b>
<span id="detailMassage"></span>
<div class="clearfix"></div>
</div>
<div id="yohoCoinImportResultSet">
... ... @@ -227,13 +229,21 @@
<td class="center retailPrice" style="width: 5%">[[retailPrice]]</td>
<td class="center salesPrice" style="width: 5%">[[salesPrice]]</td>
<td class="center returnYohoCoin" style="width: 5%">[[productPrice.returnCoin]]</td>
<td class="center coinStatus" style="width: 8%">[[statusName]]</td>
<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>
[[/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 != 1]]
<td class="center" style="width: 5%"><button type="button" class="btn btn-info btn-sm btn-modify">修改</button></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]]
</tr>
... ... @@ -247,7 +257,7 @@
<td width="20%"><b>操作</b></td>
</tr>
<tr>
<td style="display: none">
<!--td>
<div class="radio" style="margin-top: 0">
<label><input type="radio" name="returnCoinTime" value="option1" checked>永久</label>
</div>
... ... @@ -260,7 +270,7 @@
</form>
</label>
</div>
</td>
</td-->
<td class="center">
<input type="text" class="form-control center editor-yohoCoin" placeholder="YOHO币数量" value="[[productPrice.returnCoin]]" style="width: 100px">
</td>
... ... @@ -272,7 +282,7 @@
</select>
</td>
<td class="center">
<button type="submit" class="btn btn-primary btn-sm btn-save" data-productskn="[[productSkn]]">保存</button>
<button type="submit" class="btn btn-success btn-sm btn-save" data-productskn="[[productSkn]]">保存</button>
</td>
</tr>
<tr>
... ... @@ -297,15 +307,28 @@
</tr>
</thead>
<tbody>
[[each data as item _index]]
<tr>
<td>[[item.productSkn]]</td>
<td>[[item.brandName]]</td>
<td>[[item.retailPrice]]</td>
<td>[[item.returnCoin]]</td>
<td><a href="javascript:;" class="btn btn-sm btn-danger btn-delete-yohoCoin" data-index="[[_index]]">删除</a></td>
</tr>
[[/each]]
[[if successList.length > 0]]
[[each successList as item _index]]
<tr>
<td>[[item.productSkn]]</td>
<td>[[item.brandName]]</td>
<td>[[item.retailPrice]]</td>
<td>
[[if item.returnCoin >= item.retailPrice * 0.2]]
<font color="#ff0000">[[item.returnCoin]]</font><br>
[[else]]
[[item.returnCoin]]<br>
[[/if]]
<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>
</tr>
[[/each]]
[[else]]
<tr>
<td colspan="5">无数据!</td>
</tr>
[[/if]]
</tbody>
</table>
</script>
... ...
... ... @@ -97,6 +97,11 @@
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="javascript:;" class="btn btn-info">全部</a>
</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>
</div>
</div>
</div>
{{/ filter}}
... ...