<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增处方')" />
    <th:block th:include="include :: select2-css" />
</head>
<body>
<div class="main-content">
    <form id="form-user-add" class="form-horizontal">
        <input name="deptId" type="hidden" id="treeId"/>
        <h4 class="form-header h4">配送单信息</h4>
        <div class="row">
            <div class="col-sm-3">
                <div class="form-group">
                    <label>预计配送时间</label>
                    <input type="text" class="time-input" id="expectedDeliveryTime"  name="expectedDeliveryTime" placeholder="预计配送时间" />
                </div>
            </div>
            <div class="col-sm-3">
                <div class="form-group">
                    <div class="form-group">
                            <label>实际配送时间</label>
                        <input type="text" class="time-input" id="actualDeliveryTime" placeholder="实际配送时间" name="actualDeliveryTime"/>
                    </div>
                </div>
            </div>

            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">所属连锁：</label>
                    <div class="col-sm-8">
                        <div class="input-group">
                        <input name="chainName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择门店" class="form-control">
                        <span class="input-group-addon">
                        <i class="fa fa-search"></i>
                    </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">所属门店：</label>
                    <div class="col-sm-8">
                        <select name="storeName" class="form-control" th:with="type=${@dict.getType('sys_select_store')}">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            ></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-6 control-label">是否线上签收：</label>
                    <div class="col-sm-4">
                        <select name="prescriptionType" class="form-control" th:with="type=${@dict.getType('sys_yes_no')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            ></option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4 control-label">配送状态：</label>
                    <div class="col-sm-4">
                        <select name="deliveryStatus"  class="form-control"  th:with="type=${@dict.getType('sys_select_pszt')}">
                            <option value="">全部</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4 control-label">冷链类型：</label>
                    <div class="col-sm-4">
                        <select name="coldChainType"  class="form-control"  th:with="type=${@dict.getType('sys_select_cold_type')}">
                            <option value="">全部</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                            ></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="form-group">
                    <label class="col-sm-4 control-label">订单来源：</label>
                    <div class="col-sm-4">
                        <select name="orderSource"  class="form-control"  th:with="type=${@dict.getType('sys_select_order_sources')}">
                            <option value="">全部</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                            ></option>
                        </select>
                    </div>
                </div>
            </div>

        </div>
        <div class="row">
            <div class="col-sm-4">
                <div class="form-group">
                    <label class="col-sm-4 control-label">收货人：</label>
                    <div class="col-sm-8">
                        <input id="recipientName" name="recipientName"  type="text" maxlength="100"  class="form-control" placeholder="请输入收货人">
                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="form-group">
                    <label class="col-sm-4 control-label">收货电话：</label>
                    <div class="col-sm-8">
                        <input id="recipientPhone" name="recipientPhone"  type="number" maxlength="11"  class="form-control" placeholder="请输入收货电话">
                    </div>
                </div>
            </div>

            <div class="col-sm-4">
                <div class="form-group">
                    <label class="col-sm-4 control-label">冰排编号：</label>

                    <div class="col-sm-8">
                        <input id="icePackNumber" name="icePackNumber" placeholder="请输入冰排编号" class="form-control" type="text" maxlength="50" >
                    </div>
                </div>
            </div>


        </div>
        <div class="row">
            <div class="col-sm-4">
                <div class="form-group">
                    <label class="col-sm-4 control-label">收货地址：</label>
                    <div class="col-sm-8">
                        <input id="recipientAddress" name="recipientAddress"  type="text" maxlength="1000"  class="form-control" placeholder="请输入收货地址">
                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="form-group">
                    <label class="col-sm-4 control-label">出发温度：</label>
                    <div class="col-sm-8">
                        <input id="departureTemperature" name="departureTemperature"  type="text" maxlength="10"  class="form-control" placeholder="请输入出发温度">
                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="form-group">
                    <label class="col-sm-4 control-label">送达温度：</label>
                    <div class="col-sm-8">
                        <input id="arrivalTemperature" name="arrivalTemperature"  type="text" maxlength="10"  class="form-control" placeholder="请输入送达温度">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label">签收照片：</label>
                <div class="col-sm-8">
                    <input id="signaturePhoto" name="signaturePhoto"  type="text" maxlength="1000"  class="form-control" placeholder="签收照片">
                </div>
            </div>
        </div>
            <div class="col-sm-4">
                <div class="form-group">
                    <label class="col-sm-4 control-label">配送员：</label>
                    <div class="col-sm-8">
                        <input id="deliveryPerson" name="deliveryPerson" placeholder="请输入配送员" class="form-control" type="text" maxlength="50" >
                    </div>
                </div>
            </div>


        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label">配送箱编号：</label>
                <div class="col-sm-8">
                    <input id="deliveryBoxNumber" name="deliveryBoxNumber"  type="text" maxlength="25"  class="form-control" placeholder="配送箱编号">
                </div>
            </div>
        </div>
        </div>
        <h4 class="form-header h4">其他信息</h4>
        <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">付款顺序：</label>
                        <div class="col-sm-8">
                            <select name="paymentSequence" class="form-control" th:with="type=${@dict.getType('sys_select_payment_sequence')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                ></option>
                            </select>
                        </div>
                    </div>
                </div>
        </div>

    </form>
</div>

<div class="row">
    <div class="col-sm-offset-5 col-sm-10">
        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script>
    var prefix = ctx + "dtp/cold";
    var prescriptionTypes = [
        { label: '电子处方', value: 'electronic' },
        { label: '纸质处方', value: 'paper' }
    ];


    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-user-add").serializeArray();

            $.operate.saveTab(prefix + "/add", data);
        }
    }

    /* 用户管理-新增-选择门店树 */
    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() {
        $('#post').select2({
            placeholder: "请选择岗位",
            allowClear: true
        });
    })
</script>
</body>
</html>
