<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('配送单列表')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
	<div class="ui-layout-center">
		<div class="container-div">
			<div class="row">
				<div class="col-sm-12 search-collapse">
					<div class="query-condition-container">
						<h4 class="query-condition-title">查询条件</h4>
						<div class="query-buttons">
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</div>
					</div>
					<form id="user-form" class="customize-search-form">
						<div class="customize-form-group-container">
							<div class="customize-form-group select-time">
								<label>创建日期:</label>
								<input type="text" class="time-input" id="creationTimeStart" placeholder="开始时间" name="creationTimeStart"/>
								<span>-</span>
								<input type="text" class="time-input" id="creationTimeEnd" placeholder="结束时间" name="creationTimeEnd"/>
							</div>
							<div class="customize-form-group select-time">
								<label>实际送达:</label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="actualDeliveryTimeStart"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="actualDeliveryTimeEnd"/>
							</div>
							<div class="customize-form-group">
								<label>订单号:</label>
								<input type="text" class="styled-input" placeholder="请输入订单号" name="orderNumber"/>
							</div>
							<div class="customize-form-group">
								<label>配送员:</label>
								<input type="text" class="styled-input" placeholder="请输入配送员" name="deliveryPerson"/>
							</div>
							<div class="customize-form-group">
								<label>收货人:</label>
								<input type="text" class="styled-input" placeholder="请输入收货人" name="recipientName"/>
							</div>
							<div class="customize-form-group">
								<label>收货电话:</label>
								<input type="text" class="styled-input" placeholder="请输入收货电话" name="recipientPhone"/>
							</div>
							<div class="customize-form-group">
								<label>配送状态:</label>
								<select name="deliveryStatus"  th:with="type=${@dict.getType('sys_select_pszt')}" class="styled-input">
									<option value="">全部</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
								</select>
							</div>
							<div class="customize-form-group">
								<label>所属连锁:</label>
								<input name="chainName" class="styled-input" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择门店">
							</div>
							<div class="customize-form-group">
								<label>冷链类型:</label>
								<select name="coldChainType"  th:with="type=${@dict.getType('sys_select_cold_type')}" class="styled-input">
									<option value="">全部</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
									></option>
								</select>
							</div>
							<div class="customize-form-group">
								<label>付款顺序:</label>
								<select name="paymentSequence"  th:with="type=${@dict.getType('sys_select_payment_sequence')}" class="styled-input">
									<option value="">全部</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
									></option>
								</select>
							</div>
						</div>
					</form>
				</div>

		        <div class="btn-group-sm" id="toolbar" role="group">
		        	<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="dtp:cold:add">
		                <i class="fa fa-plus"></i> 新增
		            </a>
		             <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="dtp:cold:edit">
			            <i class="fa fa-edit"></i> 修改
			        </a>
		            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sdtp:cold:remove">
		                <i class="fa fa-remove"></i> 删除
		            </a>
<!--		            <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="dtp:recipe:import">-->
<!--			            <i class="fa fa-upload"></i> 导入-->
<!--			        </a>-->
<!--		            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="dtp:cold:export">-->
<!--			            <i class="fa fa-download"></i> 导出-->
<!--			        </a>-->
		        </div>

				<div class="col-sm-12 select-table table-striped" style="width: 100%; overflow-x: hidden;">
					<table id="bootstrap-table" class="fixed-layout-table"></table>
				</div>
			</div>
		</div>
	</div>

	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<th:block th:include="include :: bootstrap-table-fixed-columns-js" />
	<th:block th:include="include :: ztree-js" />
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('dtp:cold:edit')}]];
		var removeFlag = [[${@permission.hasPermi('dtp:cold:remove')}]];
		var prefix = ctx + "dtp/cold";


		$(function() {
		    var panehHidden = false;
		    if ($(this).width() < 1590) {
		        panehHidden = true;
		    }
		    $('body').layout({ initClosed: panehHidden, west__size: 185, resizeWithWindow: false });
	     	// 回到顶部绑定
	    	if ($.fn.toTop !== undefined) {
	    		var opt = {
	    			win:$('.ui-layout-center'),
	    			doc:$('.ui-layout-center')
	    		};
	    		$('#scroll-up').toTop(opt);
	    	}
		    queryUserList();
		});

		function queryUserList() {
		    var options = {
		        url: prefix + "/list",
		        viewUrl: prefix + "/view/{id}",
		        createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        removeUrl: prefix + "/remove",
		        exportUrl: prefix + "/export",
		        //importUrl: prefix + "/importData",
		        importTemplateUrl: prefix + "/importTemplate",
		        sortName: "createTime",
		        sortOrder: "desc",
		        modalName: "配送单列表",
				fitColumns: true,
				striped: true,
				autoRowHeight: true,
				rowNumbers: true,
				showFooter:true,  //是否显示表格底部区域。
				clickToSelect: true, //是否启用点击行时选中整行的功能。
				singleSelect: false, //是否仅允许选择一行
				fixedColumns: true,
				//fixedNumber: 3,
				fixedRightNumber: 1,
		        columns: [{
		            checkbox: true
		        },
					{
						field: "id",
						title: "id",
						//hidden:false
						visible: false,
					},
					// {
					// 	"field": "createdBy",
					// 	"title": "创建人"
					// },
					{
						"field": "orderNumber",
						"title": "订单号"
					},
					{
						"field": "createdDate",
						"title": "创建日期"
					},

					{
						"field": "creationTime",
						"title": "订单创建时间"
					},
					{
						"field": "expectedDeliveryTime",
						"title": "预计配送时间"
					},
					{
						"field": "actualDeliveryTime",
						"title": "实际配送时间"
					},
					{
						"field": "chainName",
						"title": "所属连锁"
					},
					{
						"field": "storeName",
						"title": "所属门店"
					},
					{
						"field": "deliveryStatus",
						"title": "配送状态"
					},
					{
						"field": "coldChainType",
						"title": "冷链类型"
					},
					{
						"field": "orderSource",
						"title": "订单来源"
					},
					{
						"field": "deliveryPerson",
						"title": "配送员"
					},
					{
						"field": "recipientName",
						"title": "收货人"
					},
					{
						"field": "recipientPhone",
						"title": "收货电话"
					},
					{
						"field": "recipientAddress",
						"title": "收货地址"
					},
					{
						"field": "departureTemperature",
						"title": "出发温度"
					},
					{
						"field": "arrivalTemperature",
						"title": "送达温度"
					},
					{
						"field": "signaturePhoto",
						"title": "签收照片"
					},
					{
						"field": "isOnlineSignature",
						"title": "是否线上签收"
					},
					{
						"field": "deliveryBoxNumber",
						"title": "配送箱编号"
					},
					{
						"field": "icePackNumber",
						"title": "冰排编号"

					},
					// {
					// 	"field": "paymentSequence",
					// 	"title": "付款顺序"
					// },
					// {
					// 	"field": "create_time",
					// 	"title": "创建时间"
					// },
					// {
					// 	"field": "updatedTime",
					// 	"title": "更新时间"
					// },

		        {
		            title: '操作',
		            align: 'center',
					fixed: true, // 固定列
		            formatter: function(value, row, index) {
		                if (row.id) {
		                	var actions = [];
			                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
			                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
			                return actions.join('');
		            	} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		}

		/* 用户管理-新增-选择门店树 */
		function selectDeptTree() {
			var treeId = $("#treeId").val();
			var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
			var url = ctx + "system/user/selectDeptTree/" + deptId;
			var options = {
				title: '选择门店',
				width: "380",
				url: url,
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}

		function doSubmit(index, layero){
			var body = $.modal.getChildFrame(index);
			$("#treeId").val(body.find('#treeId').val());
			$("#treeName").val(body.find('#treeName').val());
			$.modal.close(index);
		}
		/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
		function resetPre() {
			resetDate();
			$("#user-form")[0].reset();
			$("#deptId").val("");
			$("#parentId").val("");
			$(".curSelectedNode").removeClass("curSelectedNode");
			$.table.search();
		}
	</script>

</body>

</html>
