$('#orderList').on('click', '.agreement', function(){

	var orderId = $(this).parent().parent().attr('orderId');
	
	var param = {
		'orderId': orderId
	};
	
	ajax_post("/sales/order/getorderagreement", JSON.stringify(param), 'application/json',
		function(data) { 
			$('#agreementTableBody').empty();
			
			if(data.salesOrderAgreementList.length > 0){
				
				$('#agreementTable').show();
				
				// 表格数据
				var trs = '';
				
				$.each(data.salesOrderAgreementList, function(index, obj){
					var tr = '<tr>' + 
						     '<td>' + getValue(obj.agreementCode) + '</td>' + 
						     '<td>' + getValue(obj.agreementName) + '</td>' + 
						     '<td>' + getValue(obj.agreementPrice) + '</td>' + 
						     '<td>' + getValue(obj.agreementNumber) + '</td>' + 
						     '<td>' + getValue(obj.agreementAmount) + '</td>' + 
						     '<td>' + getValue(obj.agreementDiscountAmount) + '</td>' + 
						     '<td>' + getValue(obj.agreementPayAmount) + '</td>' + 
						     '<td>' + getValue(obj.agreementStartDate) + '</td>' + 
						     '<td>' + getValue(obj.agreementEndDate) + '</td>' + 
					 '+</tr>';
					
					trs += tr;
				});
				
				$('#agreementTableBody').append(trs);
				
				// 合计
				$('#agreementTotalPrice').html(data.agreementTotalPrice);
				$('#agreementTotalDiscountAmount').html(data.agreementTotalDiscountAmount);
				$('#agreementTotalPayAmount').html(data.agreementTotalPayAmount);
				
			}
		},
		function(xhr, status) { console.log('error--->' + status); }
	);
	
	$('#agreementModal').modal('show');
});

// 折让协议 - 关闭
$('#agreement_close').on('click', function(){
	$('#agreementModal').modal('hide');
});


// 导出
$('#export').on('click', function(){
	
	var orderCode = $('#orderCode').val();
	var customerName = $('#customerName').val();
	var orderStatus = $('#orderStatus').val();
	var orderStartDate = $('#orderStartDate').val();
	var orderEndDate = $('#orderEndDate').val();
	
	var param = {
		'orderCode': orderCode,
		'customerName': customerName,
		'orderStatus': orderStatus,
		'orderStartDate': orderStartDate,
		'orderEndDate': orderEndDate
	};
	
	window.location.href='/sales/order/exportorder?' + $.param(param);
});

// 打印
$('#print').on('click', function(){
	
	var orderCode = $('#orderCode').val();
	var customerName = $('#customerName').val();
	var orderStatus = $('#orderStatus').val();
	var orderStartDate = $('#orderStartDate').val();
	var orderEndDate = $('#orderEndDate').val();
	
	var param = {
		'orderCode': orderCode,
		'customerName': customerName,
		'orderStatus': orderStatus,
		'orderStartDate': orderStartDate,
		'orderEndDate': orderEndDate
	};
	
	window.location.href='/sales/order/printorder?' + $.param(param);
});

// 销售订单列表查询
$('#query').on('click', function(){
	$('#orderList').bootstrapTable('refreshOptions', {pageNumber:1});
});

// 销售订单列表重置
$('#reset').on('click', function(){
	$('#orderCode').val('');
	$('#customerName').val('');
	$('#orderStatus').val('');
	$('#orderStartDate').val('');
	$('#orderEndDate').val('');
	
	$('#orderList').bootstrapTable('refreshOptions', {pageNumber:1});
});

// 新建销售订单
$('#add').on('click', function(){
	window.location.href = '/sales/order/addorder';
});

// 修改销售订单
$('#orderList').on('click', '.edit', function(){
	
	var orderId = $(this).parent().parent().attr('orderId');
	
	window.location.href = '/sales/order/updateorder?orderId=' + orderId;
});

// 删除销售订单
$('#orderList').on('click', '.delete', function(){
	
	var orderId = $(this).parent().parent().attr('orderId');
	
	$('#deleteOrderModal').modal('show');
	$('#deleteOrderConfirm').unbind('click').on('click', function(){
		
		var param = {
			'orderId': orderId
		};
		
		ajax_post('/sales/order/deleteorderbyorderid', JSON.stringify(param), 'application/json',
			function(data) {
				$('#orderList').bootstrapTable('refreshOptions', {pageNumber:1});
				$('#deleteOrderModal').modal('hide');
			},
			function(xhr, status) { console.log('error--->' + status); }
		);
		
	});
	
});

// 改变销售订单状态
$('#orderList').on('click', '.changeOrderStatus', function(){
	
	var orderId = $(this).parent().parent().attr('orderId');
	
	$('#changeOrderStatusModal').modal('show');
	$('#changeOrderStatusConfirm').unbind('click').on('click', function(){
		
		var orderStatus = $('#changeOrderStatus').val();
		
		if(orderStatus == ''){
			showMessage('请选择订单状态', 'info');
			return;
		}
销售订单管理系统 - 折让协议

原文地址: https://www.cveoy.top/t/topic/licm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录