<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('门店订单表新增')" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form id="form-SDdglOrderStore-add" class="customize-search-form">
        <div class="customize-form-group-container">

            <div class="customize-form-group">
                <label>配送类型</label>
                <select name="deliveryType"  class="styled-input">
                    <option value="">全部</option>
                    <option value="自提">自提</option>
                    <option value="非自提">非自提</option>
                </select>
            </div>
            <div class="customize-form-group">
                <label>手机号:</label>
                <input name="mobileNumber" placeholder="手机号"  id="mobileNumber" class="styled-input" type="number">
            </div>
            <div class="customize-form-group">
                <label>渠道名称:</label>
                <select name="channelName"  class="styled-input">
                    <option value="">全部</option>
                    <option value="药急送">药急送</option>
                    <option value="美团外卖">美团外卖</option>
                    <option value="京东到家">京东到家</option>
                    <option value="天猫商城">天猫商城</option>
                    <option value="饿了么">饿了么</option>
                </select>
            </div>

            <div class="customize-form-group">
                <label>门店名称:</label>
                <input name="storeName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择门店" class="styled-input">
            </div>
            <div class="customize-form-group">
                <label>下单人:</label>
                <input name="orderPlacer" placeholder="下单人"  id="orderPlacer" class="styled-input" type="text">
            </div>
            <div class="customize-form-group select-time">
                <label>下单时间:</label>
                <input name="orderTime" placeholder="下单时间"  id="orderTime" class="time-input time-input2" type="text">
            </div>
<!--            <div class="customize-form-group">-->
<!--                <label>结账单id:</label>-->
<!--                <input name="settlementId" placeholder="结账单id"  id="settlementId" class="styled-input" type="text">-->
<!--            </div>-->
<!--            <div class="customize-form-group">-->
<!--                <label>结账单code:</label>-->
<!--                <input name="settlementCode" placeholder="结账单code"  id="settlementCode" class="styled-input" type="text">-->
<!--            </div>-->

            <div class="customize-form-group">
                <label>药品总数量:</label>
                <input name="totalDrugQuantity" placeholder="药品总数量"  id="totalDrugQuantity" class="styled-input" type="number">
            </div>
            <div class="customize-form-group">
                <label>卡号:</label>
                <input name="cardNumber" placeholder="卡号"  id="cardNumber" class="styled-input" type="text">
            </div>
            <div class="customize-form-group">
                <label>发货地址:</label>
                <input name="shippingAddress" placeholder="发货地址"  id="shippingAddress" class="styled-input" type="text">
            </div>
            <div class="customize-form-group">
                <label>下单地址:</label>
                <input name="orderAddress" placeholder="下单地址"  id="orderAddress" class="styled-input" type="text">
            </div>
            <div class="customize-form-group">
                <label>订单类型</label>
                <select name="orderType"  class="styled-input">
                    <option value="">全部</option>
                    <option value="正向单">正向单</option>
                    <option value="逆向单">逆向单</option>
                </select>
            </div>
            <div class="customize-form-group">
                <label>订单来源:</label>
                <select name="orderSource"  class="styled-input"  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}" th:selected="${dict.dictLabel}==${orderSource}"
                    ></option>
                </select>
            </div>
            <div class="customize-form-group">
                <label>订单总金额:</label>
                <input name="totalAmount" placeholder="订单总金额"  id="totalAmount" class="styled-input" type="number">
            </div>
            <div class="customize-form-group">
                <label>订单费用外送费:</label>
                <input name="deliveryFee" placeholder="订单费用外送费"  id="deliveryFee" class="styled-input" type="text">
            </div>
            <div class="customize-form-group">
                <label>退款金额:</label>
                <input name="refundAmount" placeholder="退款金额"  id="refundAmount" class="styled-input" type="text">
            </div>
            <div class="customize-form-group">
                <label>外送提货方式:</label>
                <input name="deliveryPickupMethod" placeholder="外送提货方式"  id="deliveryPickupMethod" class="styled-input" type="text">
            </div>
            <div class="customize-form-group select-time">
                <label>外送提货时间:</label>
                <input name="deliveryPickupTime" placeholder="外送提货时间"  id="deliveryPickupTime" class="time-input time-input2" type="text">
            </div>
            <div class="customize-form-group">
                <label>备注:</label>
                <input name="remarks" placeholder="备注"  id="remarks" class="styled-input" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script type="text/javascript">

    function submitHandler() {
        if ($.validate.form()) {
            add();
        }
    }

    function add() {
        var data = $("#form-SDdglOrderStore-add").serializeArray();
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "ddgl/sddglorderstore/sDdglOrderStoreAdd",
            data : data,
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(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);
    }


</script>
</body>
</html>
