更新前端

This commit is contained in:
季圣华
2018-12-19 23:51:59 +08:00
parent 609756e9e7
commit 91a6b722b9
1149 changed files with 124088 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
[
{
"id": 1,
"text": "导入导出"
},
{
"id": 2,
"text": "启用禁用"
},
{
"id": 3,
"text": "审核反审核"
},
{
"id": 4,
"text": "打印"
},
{
"id": 5,
"text": "作废"
}
]

View File

@@ -0,0 +1,704 @@
//初始化界面
$(function() {
var listTitle = ""; //单据标题
var listType = ""; //类型
var listTypeEn = ""; //英文类型
getType();
getPersonList(); //获取业务员
initTableData();
ininPager();
bindEvent();
});
//根据名称获取类型
function getType(){
listTitle = $("#tablePanel").prev().text();
if(listTitle === "供应商信息列表"){
listType = "供应商";
listTypeEn = "Vendor";
}
else if(listTitle === "客户信息列表"){
listType = "客户";
listTypeEn = "Customer";
}
else if(listTitle === "会员信息列表"){
listType = "会员";
listTypeEn = "Member";
}
}
//获取业务员
function getPersonList(){
$.ajax({
type:"post",
url: "/person/getBasicData.action",
dataType: "json",
success: function (systemInfo)
{
var msgTip = systemInfo.showModel.msgTip;
if(msgTip !== "exceptoin"){
var personList = systemInfo.showModel.map.personList;
var personID,options;
if(personList !=null)
{
for(var i = 0 ;i < personList.length;i++)
{
var person = personList[i];
if(0 == i)
{
personID = person.id;
}
if(person.type=="仓管员")
{
options += '<option value="' + person.id + '">' + person.name + '</option>';
}
}
$("#personId").empty().append('<option>不关联业务员</option>').append(options);
}
}
else {
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化表格数据
function initTableData() {
//改变宽度和高度
$("#searchPanel").panel({width:webW-2});
$("#tablePanel").panel({width:webW-2});
$('#tableData').datagrid({
//title:'单位列表',
//iconCls:'icon-save',
//width:700,
height:heightInfo,
nowrap: false,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
checkOnSelect : false,
//交替出现背景
striped : true,
pagination: true,
//自动截取数据
//nowrap : true,
//loadFilter: pagerFilter,
pageSize: initPageSize,
pageList: initPageNum,
columns:[[
{ field: 'id',width:35,align:"center",checkbox:true},
{ title: '操作',field: 'op',align:"center",width:60,formatter:function(value,rec)
{
var str = '';
var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.beginneedget + 'AaBb'+ rec.beginneedpay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type
+ 'AaBb' + rec.fax + 'AaBb' + rec.telephone + 'AaBb' + rec.address + 'AaBb' + rec.taxnum + 'AaBb' + rec.bankname + 'AaBb' + rec.accountnumber + 'AaBb' + rec.taxrate;
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSupplier(\'' + rowInfo + '\');"/>&nbsp;&nbsp;&nbsp;';
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSupplier(\'' + rowInfo + '\');"/>';
return str;
}
},
{ title: '名称',field: 'supplier',width:150},
{ title: '联系人', field: 'contacts',width:50,align:"center"},
{ title: '手机号码', field: 'telephone',width:100,align:"center"},
{ title: '电子邮箱',field: 'email',width:80,align:"center"},
{ title: '联系电话', field: 'phonenum',width:100,align:"center"},
{ title: '传真', field: 'fax',width:100,align:"center"},
{ title: '预付款',field: 'advancein',width:70,align:"center"},
{ title: '期初应收',field: 'beginneedget',width:70,align:"center"},
{ title: '期初应付',field: 'beginneedpay',width:70,align:"center"},
{ title: '税率', field: 'taxrate',width:50,align:"center"},
{ title: '状态',field: 'enabled',width:70,align:"center",formatter:function(value){
return value? "启用":"禁用";
}}
]],
toolbar:[
{
id:'addSupplier',
text:'增加',
iconCls:'icon-add',
handler:function() {
addSuppler();
}
},'-',
{
id:'deleteSupplier',
text:'删除',
iconCls:'icon-remove',
handler:function() {
batDeleteSupplier();
}
},'-',
{
id:'setEnable',
text:'启用',
iconCls:'icon-ok',
handler:function() {
setEnableFun();
}
},'-',
{
id:'setDisEnable',
text:'禁用',
iconCls:'icon-no',
handler:function() {
setDisEnableFun();
}
},'-',
{
id:'setInput',
text:'导入',
iconCls:'icon-excel',
handler:function() {
setInputFun();
}
},'-',
{
id:'setOutput',
text:'导出',
iconCls:'icon-excel',
handler:function() {
setOutputFun();
}
}
],
onLoadError:function() {
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
showSupplierDetails(1,initPageSize);
}
//分页信息处理
function ininPager() {
try {
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
pager.pagination({
onSelectPage:function(pageNum, pageSize)
{
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh', {
pageNumber:pageNum,
pageSize:pageSize
});
showSupplierDetails(pageNum,pageSize);
}
});
}
catch (e) {
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
}
}
//删除信息
function deleteSupplier(supplierInfo) {
$.messager.confirm('删除确认','确定要删除此条信息吗?',function(r) {
if (r) {
var supplierTotalInfo = supplierInfo.split("AaBb");
$.ajax({
type:"post",
url: "/supplier/" + supplierTotalInfo[0] + "/delete",
dataType: "json",
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
} else {
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
}
},
//此处添加错误处理
error:function() {
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
return;
}
});
}
});
}
//批量删除单位
function batDeleteSupplier() {
var row = $('#tableData').datagrid('getChecked');
if(row.length == 0) {
$.messager.alert('删除提示','没有记录被选中!','info');
return;
}
if(row.length > 0) {
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条信息吗?',function(r) {
if (r) {
var ids = "";
for(var i = 0;i < row.length; i ++) {
if(i == row.length-1)
{
ids += row[i].id;
break;
}
ids += row[i].id + ",";
}
$.ajax({
type:"post",
url: "/supplier/batchDelete",
dataType: "json",
async : false,
data: ({
ids : ids
}),
success: function (res) {
if(res && res.code === 200) {
$("#searchBtn").click();
$(":checkbox").attr("checked", false);
} else {
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
}
},
//此处添加错误处理
error:function() {
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
return;
}
});
}
});
}
}
//批量启用
function setEnableFun() {
var row = $('#tableData').datagrid('getChecked');
if(row.length == 0) {
$.messager.alert('启用提示','没有记录被选中!','info');
return;
}
if(row.length > 0) {
$.messager.confirm('启用确认','确定要启用选中的' + row.length + '条信息吗?',function(r) {
if (r) {
var ids = "";
for(var i = 0;i < row.length; i ++) {
if(i == row.length-1) {
ids += row[i].id;
break;
}
ids += row[i].id + ",";
}
$.ajax({
type:"post",
url: "/supplier/batchSetEnable.action",
dataType: "json",
async : false,
data: ({
enabled: true,
supplierIDs : ids
}),
success: function (tipInfo) {
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
$(":checkbox").attr("checked",false);
}
else
$.messager.alert('启用提示','启用信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function() {
$.messager.alert('启用提示','启用信息异常,请稍后再试!','error');
return;
}
});
}
});
}
}
//批量禁用
function setDisEnableFun() {
var row = $('#tableData').datagrid('getChecked');
if(row.length == 0) {
$.messager.alert('禁用提示','没有记录被选中!','info');
return;
}
if(row.length > 0) {
$.messager.confirm('禁用确认','确定要禁用选中的' + row.length + '条信息吗?',function(r) {
if (r) {
var ids = "";
for(var i = 0;i < row.length; i ++) {
if(i == row.length-1) {
ids += row[i].id;
break;
}
ids += row[i].id + ",";
}
$.ajax({
type:"post",
url: "/supplier/batchSetEnable.action",
dataType: "json",
async : false,
data: ({
enabled: false,
supplierIDs : ids
}),
success: function (tipInfo) {
var msg = tipInfo.showModel.msgTip;
if(msg == '成功') {
//加载完以后重新初始化
$("#searchBtn").click();
$(":checkbox").attr("checked",false);
}
else
$.messager.alert('禁用提示','禁用信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function() {
$.messager.alert('禁用提示','禁用信息异常,请稍后再试!','error');
return;
}
});
}
});
}
}
//导入数据
function setInputFun(){
//IE下不允许编辑 input=file的值 解决思路重新克隆input=file把这个input元素复制一个然后将原来的删除。
//在IE下复制元素的时候其中的值是不会被复制的所以就达到了清空文件域的目的了。
//而在Firefox下其中的值也会被一同复制清空一下就做到兼容
var fileUploadInput = $("#supplierFile");
fileUploadInput.after(fileUploadInput.clone().val(""));
fileUploadInput.remove();
$("#isCheck").val(1);
$('#importExcelDlg').dialog('open').dialog('setTitle','导入' + listType + '信息');
$(".window-mask").css({ width: webW-20 ,height: webH});
$("#supplierFile").focus();
}
//导出数据
function setOutputFun(){
window.location.href = "/supplier/exportExcel.action?browserType=" + getOs() + "&type=" + listTypeEn;
}
//增加单位
var url;
var supplierID = 0;
//保存编辑前的名称
var oldSupplier = "";
function addSuppler() {
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/>&nbsp;增加'+listType+"信息");
$(".window-mask").css({ width: webW ,height: webH});
$("#supplier").focus();
$('#supplierFM').form('clear');
oldSupplier = "";
supplierID = 0;
url = '/supplier/add';
}
function bindEvent(){
//导入excel对话框
$('#importExcelDlg').dialog({
width: 400,
closed: true,
cache: false,
modal: true,
collapsible:false,
closable: true,
buttons:'#dlg-buttons5'
});
//导入excel表格
$("#saveimport").unbind().bind({
click:function() {
if($("#supplierFile").val().length == 0)
{
$.messager.alert('提示','请选择文件!','info');
return;
}
$("#importExcelFM").submit();
$('#importExcelDlg').dialog('close');
$.messager.progress({
title:'请稍候',
msg:'数据处理ing...'
});
setTimeout(function(){
$.messager.progress('close');
var opts = $("#tableData").datagrid('options');
showSupplierDetails(opts.pageNumber,opts.pageSize);
},3300);
}
});
//保存信息
$("#saveSupplier").off("click").on("click", function () {
if (checkSupplierName()) {
return;
}
var reg = /^([0-9])+$/;
var phonenum = $.trim($("#phonenum").val());
if(phonenum.length>0 && !reg.test(phonenum)) {
$.messager.alert('提示','电话号码只能是数字','info');
$("#phonenum").val("").focus();
return;
}
var beginNeedGet = $.trim($("#BeginNeedGet").val());
var beginNeedPay = $.trim($("#BeginNeedPay").val());
if(beginNeedGet && beginNeedPay) {
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
return;
}
var obj = $("#supplierFM").serializeObject();
obj.type = listType;
obj.enabled = 1;
$.ajax({
url: url,
type:"post",
dataType: "json",
data:{
info: JSON.stringify(obj)
},
success: function(res) {
if(res && res.code === 200) {
$('#supplierDlg').dialog('close');
//加载完以后重新初始化
var opts = $("#tableData").datagrid('options');
showSupplierDetails(opts.pageNumber, opts.pageSize);
}
}
});
});
//初始化键盘enter事件
$(document).keydown(function(event) {
//兼容 IE和firefox 事件
var e = window.event || event;
var k = e.keyCode||e.which||e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件
if(k == "13"&&(obj.id=="supplier" || obj.id=="contacts"|| obj.id=="phonenum"
|| obj.id=="email" || obj.id=="description" ))
{
$("#saveSupplier").click();
}
//搜索按钮添加快捷键
if(k == "13"&&(obj.id=="searchSupplier" || obj.id=="searchContacts"|| obj.id=="searchPhonenum"
|| obj.id=="searchEmail" || obj.id=="searchDesc" ))
{
$("#searchBtn").click();
}
});
//搜索处理
$("#searchBtn").unbind().bind({
click:function() {
showSupplierDetails(1,initPageSize);
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
opts.pageNumber = 1;
opts.pageSize = initPageSize;
pager.pagination('refresh',
{
pageNumber:1,
pageSize:initPageSize
});
}
});
$("#searchBtn").click();
//重置按钮
$("#searchResetBtn").unbind().bind({
click:function(){
$("#searchSupplier").val("");
$("#searchType").val("");
$("#searchPhonenum").val("");
$("#searchTelephone").val("");
$("#searchDesc").val("");
//加载完以后重新初始化
$("#searchBtn").click();
}
});
}
//编辑信息
function editSupplier(supplierTotalInfo) {
var supplierInfo = supplierTotalInfo.split("AaBb");
var row = {
supplier : supplierInfo[1],
contacts : supplierInfo[2].replace("undefined",""),
phonenum : supplierInfo[3].replace("undefined",""),
email : supplierInfo[4].replace("undefined",""),
BeginNeedGet : supplierInfo[5],
BeginNeedPay : supplierInfo[6],
AllNeedGet: "",
AllNeedPay: "",
description : supplierInfo[8].replace("undefined",""),
type : supplierInfo[9],
fax : supplierInfo[10].replace("undefined",""),
telephone : supplierInfo[11].replace("undefined",""),
address : supplierInfo[12].replace("undefined",""),
taxNum : supplierInfo[13].replace("undefined",""),
bankName : supplierInfo[14].replace("undefined",""),
accountNumber : supplierInfo[15].replace("undefined",""),
taxRate : supplierInfo[16].replace("undefined","")
};
oldSupplier = supplierInfo[1];
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑'+listType +"信息");
$(".window-mask").css({ width: webW ,height: webH});
$('#supplierFM').form('load',row);
supplierID = supplierInfo[0];
//焦点在名称输入框==定焦在输入文字后面
$("#supplier").val("").focus().val(supplierInfo[1]);
url = '/supplier/update?id=' + supplierInfo[0];
//显示累计应收和累计应付
var thisDateTime = getNowFormatDateTime(); //当前时间
var supType = "customer";
if(listType === "客户"){
supType = "customer"
}
else if(listType === "供应商"){
supType = "vendor"
}
$.ajax({
type:"post",
url: "/depotHead/findTotalPay.action",
dataType: "json",
async: false,
data: ({
supplierId: supplierInfo[0],
EndTime:thisDateTime,
supType: supType
}),
success: function(res){
if(res) {
var moneyA = res.getAllMoney.toFixed(2)-0;
$.ajax({
type:"post",
url: path +"/accountHead/findTotalPay.action",
dataType: "json",
async: false,
data: ({
supplierId: supplierInfo[0],
EndTime:thisDateTime,
supType: supType
}),
success: function(res){
if(res) {
var moneyB = res.getAllMoney.toFixed(2)-0;
var money = moneyA+moneyB;
var moneyBeginNeedGet = $("#BeginNeedGet").val()-0; //期初应收
var moneyBeginNeedPay = $("#BeginNeedPay").val()-0; //期初应付
if(listType === "客户"){
money = (money + moneyBeginNeedGet - moneyBeginNeedPay).toFixed(2);
$("#AllNeedGet").val(money); //累计应收
}
else if(listType === "供应商"){
money = (money + moneyBeginNeedPay - moneyBeginNeedGet).toFixed(2);
$("#AllNeedPay").val(money); //累计应付
}
}
},
error: function(){
$.messager.alert('提示','网络异常请稍后再试!','error');
return;
}
});
}
},
error: function(){
$.messager.alert('提示','网络异常请稍后再试!','error');
return;
}
});
}
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
function checkSupplierName() {
var supplierName = $.trim($("#supplier").val());
//表示是否存在 true == 存在 false = 不存在
var flag = false;
//开始ajax名称检验不能重名
if(supplierName.length > 0 &&( oldSupplier.length ==0 || supplierName != oldSupplier)) {
$.ajax({
type:"get",
url: "/supplier/checkIsNameExist",
dataType: "json",
async : false,
data: ({
id : supplierID,
name : supplierName
}),
success: function (res) {
if(res && res.code === 200) {
if(res.data && res.data.status) {
flag = res.data.status;
if (flag) {
$.messager.alert('提示', '单位名称已经存在', 'info');
return;
}
}
}
},
//此处添加错误处理
error:function() {
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
return;
}
});
}
return flag;
}
function showSupplierDetails(pageNo,pageSize) {
var supplier = $.trim($("#searchSupplier").val());
var phonenum = $.trim($("#searchPhonenum").val());
var telephone = $.trim($("#searchTelephone").val());
var description = $.trim($("#searchDesc").val());
$.ajax({
type:"get",
url: "/supplier/list",
dataType: "json",
data: ({
search: JSON.stringify({
supplier: supplier,
type: listType,
phonenum: phonenum,
telephone: telephone,
description: description
}),
currentPage: pageNo,
pageSize: pageSize
}),
success: function (res) {
if(res && res.code === 200){
if(res.data && res.data.page) {
$("#tableData").datagrid('loadData', res.data.page);
}
}
},
//此处添加错误处理
error:function() {
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}

View File

@@ -0,0 +1,476 @@
var accountList; //账户列表
var listSubType = ""; //采购 销售等
var depotHeadID = 0; //主表id
var mPropertyList = ""; //商品属性列表
var outItemList; //支出项目列表
var otherColumns = true; //明细中的‘别名’列是否显示
var payTypeTitle = "";//收入 支出
var itemType = true; //隐藏当前列
var moneyType = true; //隐藏当前列
$(function() {
initSystemData_account(); //获取账户信息
initMProperty(); //初始化商品属性
initOutItemList(); //初始化支出项目
initialize();//初始化系统基础信息
});
//获取账户信息
function initSystemData_account(){
$.ajax({
type:"get",
url: "/account/getAccount",
//设置为同步
async:false,
dataType: "json",
success: function (res) {
if(res && res.code === 200){
accountList = res.data.accountList;
}
}
});
}
//初始化商品属性
function initMProperty(){
$.ajax({
type: "get",
url: "/materialProperty/list",
dataType: "json",
data: ({
search: JSON.stringify({
name: ""
}),
currentPage: 1,
pageSize: 100
}),
//设置为同步
async:false,
success: function (res) {
if(res && res.code === 200){
if(res.data && res.data.page) {
var thisRows = res.data.page.rows;
for (var i = 0; i < thisRows.length; i++) {
if (thisRows[i].enabled) {
mPropertyList += thisRows[i].nativename + ",";
}
}
if (mPropertyList) {
mPropertyList = mPropertyList.substring(0, mPropertyList.length - 1);
}
}
}
},
//此处添加错误处理
error:function() {
$.messager.alert('查询提示','查询信息异常,请稍后再试!','error');
return;
}
});
}
//初始化收入项目列表
function initOutItemList(){
$.ajax({
type:"get",
url: "/inOutItem/findBySelect?type=out",
//设置为同步
async:false,
dataType: "json",
success: function (res){
if(res){
outItemList = res;
}
},
error:function(){
}
});
}
function initialize() {
var url = location.href; //获取浏览器地址
var params = url.substring(url.indexOf("?")+1);
var number = params.substring(params.indexOf("n=")+2, params.indexOf("&"));
var billType = "";
var listSubType = params.substring(params.indexOf("&type=")+6);
if(listSubType) {
listSubType = decodeURI(listSubType);
}
if(listSubType == "采购入库") {
billType = "material";
$("#bill .purchase_in").show();
}
else if(listSubType == "采购退货出库") {
billType = "material";
$("#bill .purchase_back").show();
}
else if(listSubType == "销售出库") {
billType = "material";
$("#bill .sale_out").show();
}
else if(listSubType == "销售退货入库") {
billType = "material";
$("#bill .sale_back").show();
}
else if(listSubType == "零售出库") {
billType = "material";
$("#bill .retail_out").show();
}
else if(listSubType == "零售退货入库") {
billType = "material";
$("#bill .retail_back").show();
}
else if(listSubType == "其它入库") {
billType = "material";
$("#bill .other_in").show();
}
else if(listSubType == "其它出库") {
billType = "material";
$("#bill .other_out").show();
}
else if(listSubType == "调拨出库") {
billType = "material";
$("#bill .allocation_out").show();
}
else if(listSubType == "礼品充值") {
billType = "material";
$("#bill .gift_recharge").show();
}
else if(listSubType == "礼品销售出库") {
billType = "material";
$("#bill .gift_out").show();
}
else if(listSubType == "收入") {
billType = "account";
payTypeTitle = "收入项目";
itemType = false; //显示当前列
moneyType = true; //隐藏当前列
$("#bill .item_in").show();
}
else if(listSubType == "支出") {
billType = "account";
payTypeTitle = "支出项目";
itemType = false; //显示当前列
moneyType = true; //隐藏当前列
$("#bill .item_out").show();
}
else if(listSubType == "收款") {
billType = "account";
payTypeTitle = "无标题";
itemType = true; //隐藏当前列
moneyType = false; //显示当前列
$("#bill .money_in").show();
}
else if(listSubType == "付款") {
billType = "account";
payTypeTitle = "无标题";
itemType = true; //隐藏当前列
moneyType = false; //显示当前列
$("#bill .money_out").show();
}
else if(listSubType == "转账") {
billType = "account";
payTypeTitle = "无标题";
itemType = true; //隐藏当前列
moneyType = false; //显示当前列
$("#bill .giro").show();
}
else if(listSubType == "收预付款") {
billType = "account";
payTypeTitle = "无标题";
itemType = true; //隐藏当前列
moneyType = false; //显示当前列
$("#bill .advance_in").show();
}
//如果是进货、销售
if(billType == "material"){
$.ajax({
url: "/depotHead/getDetailByNumber",
data: {
number: number
},
type: "get",
success: function (res) {
if(res && res.code === 200){
var data = res.data;
var manyAccountMoney = 0; //多账户合计-零售
if(data.accountName){
$("#bill .AccountIdShow").text(data.accountName); //结算账户
}
else if(data.accountidlist && data.accountmoneylist) {
var accountArr = data.accountidlist; //账户id列表
var accountMoneyArr = data.accountmoneylist; //账户金额列表
var accountIdShow = "";
for (var j = 0; j < accountArr.length; j++) {
if (accountList != null) {
for (var i = 0; i < accountList.length; i++) {
var account = accountList[i];
if (accountArr[j] == account.id) {
var currentAccountMoney = accountMoneyArr[j] - 0;
if (currentAccountMoney < 0) {
currentAccountMoney = 0 - currentAccountMoney;
}
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney + "元) ";
manyAccountMoney += accountMoneyArr[j] - 0; //多账户合计-零售
}
}
}
}
$("#bill .AccountIdShow").text(accountIdShow);
}
$("#bill .OrganIdShow").text(data.organName);
$("#bill .OperTimeShow").text(data.opertime);
$("#bill .NumberShow").text(data.number);
$("#bill .RemarkShow").text(data.remark);
$("#bill .DiscountShow").text(data.discount);
$("#bill .DiscountMoneyShow").text(data.discountmoney);
$("#bill .DiscountLastMoneyShow").text(data.discountlastmoney);
$("#bill .ChangeAmountShow").text(data.changeamount);
$("#bill .DebtShow").text((data.discountlastmoney-data.changeamount).toFixed(2));
$("#bill .OtherMoneyShow").text(data.othermoney);
$("#bill .AccountDayShow").text(data.accountday); //结算天数
var otherMoney = data.othermoney + "";
var otherMoneyList = data.othermoneylist + "";
var otherMoneyItem = data.othermoneyitem + "";
if(otherMoneyList && otherMoneyItem){
var itemArr = otherMoneyList.split(","); //支出项目id列表
var itemMoneyArr = otherMoneyItem.split(","); //支出项目金额列表
var otherMoneyShow = "";
for(var j =0;j<itemArr.length; j++) {
if (outItemList != null) {
for (var i = 0; i < outItemList.length; i++) {
var money = outItemList[i];
if(itemArr[j] == money.Id) {
otherMoneyShow = otherMoneyShow + money.InOutItemName + "(" + itemMoneyArr[j] +"元) ";
}
}
}
}
$("#bill .OtherMoneyShow:visible").text(otherMoneyShow +"总计:"+ otherMoney.replace("undefined","0") + "元 "); //采购费用、销售费用
}
$("#bill .payTypeShow").text(data.payType);
var TotalPrice = data.totalprice;
depotHeadID = data.id;
initTableData_material_show(TotalPrice,listSubType); //商品列表-查看状态
//零售单据展示数据
if(listSubType == "零售出库" || listSubType == "零售退货入库"){
$("#bill .change-amount-show").text(data.changeamount);
var changeAccount = $("#bill .change-amount-show:visible").text() - 0;
if(manyAccountMoney!==0){
$("#bill .get-amount-show").text((manyAccountMoney).toFixed(2));
$("#bill .back-amount-show").text((manyAccountMoney -changeAccount).toFixed(2));
}
else {
$("#bill .get-amount-show").text((changeAccount).toFixed(2));
$("#bill .back-amount-show").text(0);
}
}
if(listSubType === "销售出库" || listSubType === "销售退货"){
var salesManInfo = data.salesman;
if(salesManInfo){
var arr = salesManInfo.split(",");
var salesmanStr = "";
for(var i=0;i<arr.length;i++){
if(arr[i]){
if(i === arr.length-1){
salesmanStr += arr[i].replace("<","").replace(">","");
}
else {
salesmanStr += arr[i].replace("<","").replace(">","") + ",";
}
}
}
$.ajax({
type: "get",
url: "/person/getPersonByIds",
data: {
personIDs: salesmanStr
},
success:function(res){
if(res && res.code === 200 && res.data){
$("#bill .SalesmanShow").text(res.data.names); //销售人员列表
}
},
error:function(){
}
});
}
}
}
}
});
}
//如果是财务单据
else if(billType == "account"){
$.ajax({
url: "/accountHead/getDetailByNumber",
data: {
billNo: number
},
type: "get",
success: function (res) {
if(res && res.code === 200){
var data = res.data;
$("#bill .BillNoShow").text(data.billno);
$("#bill .BillTimeShow").text(data.billtime);
$("#bill .RemarkShow").text(data.remark);
$("#bill .AccountIdShow").text(data.accountname);
$('#bill .OrganIdShow').text(data.organname);
$("#bill .HandsPersonIdShow").text(data.handspersonname);
$("#bill .ChangeAmountShow").text(data.changeamount);
var totalprice = data.totalprice;
var accountHeadID = data.id;
initTableData_account_show(totalprice, accountHeadID); //明细列表-查看状态
}
}
});
}
}
//初始化表格数据-商品列表-查看状态
function initTableData_material_show(TotalPrice,listSubType){
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
var anotherDepotHeadName = ""; //对方仓库的列的标题
var depotHeadName = ""; //仓库的列的标题
if(listSubType == "调拨出库"){
isShowAnotherDepot = false; //调拨时候显示对方仓库
anotherDepotHeadName = "调入仓库";
}
if(listSubType == "礼品充值"){
isShowAnotherDepot = false; //礼品充值时候显示礼品卡
anotherDepotHeadName = "礼品卡";
}
if(listSubType == "礼品销售"){
depotHeadName = "礼品卡";
}
else {
depotHeadName = "仓库名称";
}
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
if(listSubType == "调拨出库" || listSubType == "其它出库" || listSubType == "其它入库" || listSubType == "零售出库" || listSubType == "零售退货入库" || listSubType == "礼品充值" || listSubType == "礼品销售"){
isShowTaxColumn = true; //隐藏
}
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
if(listSubType == "组装单" || listSubType == "拆卸单"){
isShowMaterialTypeColumn = false; //显示
}
$('#bill .materialDataShow').datagrid({
height:245,
rownumbers: true,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
pagination: false,
//交替出现背景
striped : true,
showFooter: true,
columns:[[
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
{ title: '品名(型号)(扩展信息)(单位)',field: 'MaterialName',width:230},
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:75},
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
{ title: '税率',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
{ title: '备注',field: 'Remark',editor:'validatebox',width:120},
{ title: '品名-别',field: 'OtherField1',editor:'validatebox',hidden:otherColumns,width:60},
{ title: '型号-别',field: 'OtherField2',editor:'validatebox',hidden:otherColumns,width:60},
{ title: '颜色-别',field: 'OtherField3',editor:'validatebox',hidden:otherColumns,width:60},
{ title: '备注1',field: 'OtherField4',editor:'validatebox',hidden:true,width:60},
{ title: '备注2',field: 'OtherField5',editor:'validatebox',hidden:true,width:60}
]],
onLoadError:function() {
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
$.ajax({
type:"get",
url: '/depotItem/getDetailList',
data: {
headerId: depotHeadID,
mpList: mPropertyList
},
dataType: "json",
success: function (res) {
if(res && res.code === 200) {
var data = res.data;
var AllPrice = TotalPrice;
var DiscountMoney = $("#bill .DiscountMoneyShow:visible").text() - 0; //优惠金额
var DiscountLastMoney = $("#bill .DiscountLastMoneyShow:visible").text() - 0; //优惠后金额
var array = [];
array.push({
"AllPrice": AllPrice,
"TaxLastMoney": DiscountMoney + DiscountLastMoney
});
data.footer = array;
$("#bill .materialDataShow").datagrid('loadData', data);
}
},
error:function() {
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
}
});
}
//初始化表格数据-明细列表-查看状态
function initTableData_account_show(totalprice, accountHeadID){
$('#bill .accountDataShow').datagrid({
height:280,
rownumbers: true,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//单击行是否选中
checkOnSelect : false,
pagination: false,
//交替出现背景
striped : true,
showFooter: true,
columns:[[
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
{ title: '金额',field: 'EachAmount',width:70},
{ title: '备注',field: 'Remark',width:150}
]],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
$.ajax({
type:"get",
url: '/accountItem/getDetailList',
data: {
headerId: accountHeadID
},
dataType: "json",
success: function (res) {
if(res && res.code === 200) {
var data = res.data;
var EachAmount = totalprice;
var array = [];
array.push({
"EachAmount": EachAmount
});
data.footer = array;
$("#bill .accountDataShow").datagrid('loadData', data);
}
},
error:function() {
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
}
});
}

File diff suppressed because it is too large Load Diff