...
|
...
|
@@ -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 |
...
|
...
|
|