...
|
...
|
@@ -3,7 +3,7 @@ |
|
|
var $ = require('jquery'),
|
|
|
common=require('../common/common');
|
|
|
|
|
|
var pricePercent = 20; //yoho币审核比例线
|
|
|
var pricePercent = 0.2; //yoho币审核比例线
|
|
|
var loadModal = null;
|
|
|
var importYohoCoinData = null;
|
|
|
var isNeedAudit = false;
|
...
|
...
|
@@ -18,6 +18,10 @@ var ENUM = { |
|
|
1: '<b style="color:#428bca">待审核</b>',
|
|
|
2: '<b style="color:#5cb85c">通过</b>',
|
|
|
3: '<b style="color:#ff0000">驳回</b>'
|
|
|
},
|
|
|
auditor: {
|
|
|
2965: 'Tracy',
|
|
|
10235: 'David Wong'
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -56,15 +60,17 @@ var g = new common.grid({ |
|
|
sortId: select[3] ? select[3].id : ""
|
|
|
};
|
|
|
},
|
|
|
columns: [{
|
|
|
display: '',
|
|
|
render: function(item){
|
|
|
columns: [
|
|
|
{display: '', type: 'checkbox'},
|
|
|
{display: '', render: function(item){
|
|
|
var html = "";
|
|
|
if(item.__index == 0){
|
|
|
$("#yohoCoin_table").find("thead tr th").html($("#coinListHead").html());
|
|
|
$("#yohoCoin_table").find("thead tr th").eq(1).html($("#coinListHead").html());
|
|
|
}
|
|
|
item.genderName = ENUM.gender[item.gender];
|
|
|
item.statusName = ENUM.status[item.productPrice.coinStatus];
|
|
|
if(item.productPrice.auditorId){item.auditorName = ENUM.auditor[item.productPrice.auditorId];}
|
|
|
if(item.productPrice.auditDt){item.updateTime = getTime(item.productPrice.auditDt);}
|
|
|
|
|
|
html += common.util.__template2($("#coinList").html(),item);
|
|
|
return html;
|
...
|
...
|
@@ -89,8 +95,7 @@ function ajaxSave(productSkn, yohoCoin, auditorId, salesPrice){ |
|
|
"auditorId": auditorId
|
|
|
}
|
|
|
},function(rs){
|
|
|
console.log("yoho币保存返回" + rs);
|
|
|
freshYohoCoinRowData(rs.data.productSkn, rs.data.returnCoin, rs.data.coinStatus);
|
|
|
freshYohoCoinRowData(rs.data);
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -132,7 +137,6 @@ function ajaxUpload(){ |
|
|
|
|
|
//批量上传确认
|
|
|
function ajaxUploadSubmit(importAuditorId){
|
|
|
console.log(JSON.stringify(importYohoCoinData));
|
|
|
common.util.__ajax({
|
|
|
url:'/good/yohoCoin/insertBatch',
|
|
|
data: {
|
...
|
...
|
@@ -140,9 +144,12 @@ function ajaxUploadSubmit(importAuditorId){ |
|
|
productPrices: JSON.stringify(importYohoCoinData)
|
|
|
}
|
|
|
},function(rs){
|
|
|
//common.util.__tip("保存成功!");
|
|
|
//location.href = '';
|
|
|
});
|
|
|
if(rs.code == 200){
|
|
|
common.util.__tip("批量导入保存成功!", "success");
|
|
|
}else{
|
|
|
common.util.__tip(rs.message);
|
|
|
}
|
|
|
},true);
|
|
|
}
|
|
|
|
|
|
/**********************业务方法*************************/
|
...
|
...
|
@@ -221,10 +228,23 @@ function checkAuditor(auditor){ |
|
|
}
|
|
|
|
|
|
//保存单行数据刷新
|
|
|
function freshYohoCoinRowData(productSkn, yohoCoin, status){
|
|
|
function freshYohoCoinRowData(data){
|
|
|
var productSkn = data.productSkn;
|
|
|
var yohoCoin = data.returnCoin;
|
|
|
var status = data.coinStatus;
|
|
|
var founderName = data.founderName;
|
|
|
var updateTime = getTime(data.auditDt);
|
|
|
var auditorId = data.auditorId;
|
|
|
|
|
|
var SknDom = $('._' + productSkn);
|
|
|
SknDom.find(".returnYohoCoin").text(yohoCoin);
|
|
|
SknDom.find(".coinStatus").html(ENUM.status[status]);
|
|
|
|
|
|
var OperatInfoHtml = "<p>操作人:"+ founderName +"</p>";
|
|
|
if(status == 1 && auditorId) OperatInfoHtml += "<p>审核人:"+ ENUM.auditor[auditorId] +"</p>";
|
|
|
OperatInfoHtml += "<div style='color: #999; font-size: 12px'>"+ updateTime + "</div>";
|
|
|
SknDom.find(".OperatInfo").html(OperatInfoHtml);
|
|
|
|
|
|
if(status == 1){
|
|
|
SknDom.find(".operation").empty();
|
|
|
}else{
|
...
|
...
|
@@ -233,6 +253,17 @@ function freshYohoCoinRowData(productSkn, yohoCoin, status){ |
|
|
SknDom.find(".dataForEditor td").hide();
|
|
|
}
|
|
|
|
|
|
//找到以选中的商品的SKN
|
|
|
function findCheckedSknList(){
|
|
|
var sknList = new Array();
|
|
|
var checkedItems = $("#yohoCoin_table").find(".wqt_checkbox:checked");
|
|
|
$.each(checkedItems, function(index,value){
|
|
|
var skn = $(value).parent().next().find(".dataForShow").data("skn");
|
|
|
sknList.push(skn);
|
|
|
});
|
|
|
return sknList;
|
|
|
}
|
|
|
|
|
|
//关闭loading
|
|
|
function loadingClose(){
|
|
|
if (loadModal) {
|
...
|
...
|
@@ -240,6 +271,13 @@ function loadingClose(){ |
|
|
}
|
|
|
}
|
|
|
|
|
|
//时间转换
|
|
|
function getTime(time){
|
|
|
var t = new Date(time);
|
|
|
var formattedTime = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
return formattedTime;
|
|
|
}
|
|
|
|
|
|
/**********************事件*************************/
|
|
|
|
|
|
//批量导入结果列表删除
|
...
|
...
|
@@ -249,7 +287,6 @@ $(document).on('click', '.btn-delete-yohoCoin', function() { |
|
|
[].splice.call(importYohoCoinData,index,1);
|
|
|
$("#importResultTable").html(common.util.__template2($("#yohoCoinImportResultTable").html(),{"successList":importYohoCoinData}));
|
|
|
}
|
|
|
console.log(importYohoCoinData);
|
|
|
});
|
|
|
|
|
|
//批量导入结果列表确定
|
...
|
...
|
@@ -309,8 +346,24 @@ $(document).on('click', '#import-btn', function() { |
|
|
});
|
|
|
|
|
|
//导出
|
|
|
$(document).on('click', '#Outport-btn', function() {
|
|
|
|
|
|
$(document).on('click', '#export-btn', function() {
|
|
|
var exportSknList = findCheckedSknList();
|
|
|
if(exportSknList.length > 0){
|
|
|
var exportSknListShow = "";
|
|
|
for(var i=0; i<exportSknList.length; i++){
|
|
|
exportSknListShow += "<span style='margin-right: 10px; font-weight: bold; color: #5cb85c; display: inline-block'>"+ exportSknList[i] +"</span>"
|
|
|
}
|
|
|
common.dialog.confirm(
|
|
|
"批量导出确认",
|
|
|
"<div><p>请确认 <b style='color:#428bca'>导出</b> SKN为:</p><p>"+ exportSknListShow +"</p></div>",
|
|
|
function(){
|
|
|
window.open("/ajax/down?queryConf=" + exportSknList.join("|") + "&type=yohoCoin");
|
|
|
},
|
|
|
function(){}
|
|
|
);
|
|
|
}else{
|
|
|
common.util.__tip("没有选择任何商品!");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//返回列表
|
...
|
...
|
|