<!--##############################服务告知模态框####################################-->
<!--选择快递员模态框-->
<div>
    <div class="modal fade" id="id_order_sendMsg_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="exampleModalLabel">发送无法提供服务通知短信</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="control-label">选择无法服务地区：</label>
                        <select id="id_order_sendMsg_model_obj" class="form-control" data-live-search="true" onchange="setAddress()">
                            <option value="0" selected="selected">寄件人</option>
                            <option value="0" selected="selected">收件人</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="control-label">短信内容预览：</label>
                        <textarea id="id_order_sendMsg_model_content" class="form-control" disabled></textarea>
                    </div>
                    <div class="form-group">
                        <label class="control-label">发送给：</label>
                        <input class="form-control" id="id_order_sendMsg_model_user" value="" disabled>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="okSendServerNot()">确认发送</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    /**
     * 初始化model内容
     */
    function initSendMsgModel() {
        let clm=getTableSelectOne();
        let objSelect=$("#id_order_sendMsg_model_obj");
        objSelect.empty();
        objSelect.append("<option value='"+clm.mailingAddress.province+clm.mailingAddress.city+"'>寄件地区："+clm.mailingAddress.province+clm.mailingAddress.city+"</option>");
        objSelect.append("<option value='"+clm.receiptAddress.province+clm.receiptAddress.city+"'>收件地区："+clm.receiptAddress.province+clm.receiptAddress.city+"</option>");
        $("#id_order_sendMsg_model_content").val("尊敬的客户您好，由于"+$("#id_order_sendMsg_model_obj").val()+"的该区域运力不足，暂时无法为您提供配送服务，系统将为您取消订单，给您带来的不便敬请谅解！");
        $("#id_order_sendMsg_model_user").val("寄件人："+clm.mailingName+clm.mailingPhone);
        $("#id_order_sendMsg_model").modal("show");
    }
    function setAddress(){
        $("#id_order_sendMsg_model_content").val("尊敬的客户您好，由于"+$("#id_order_sendMsg_model_obj").val()+"的该区域运力不足，暂时无法为您提供配送服务，系统将为您取消订单，给您带来的不便敬请谅解！");
    }

    /**
     * 发送短信提交
     */
    function okSendServerNot() {
        let clm=getTableSelectOne();
        let data={
            phone:clm.mailingPhone,
            region:$("#id_order_sendMsg_model_obj").val()
        }
        sendAjax("${ctx}/order/server/not","post",data);
        $("#id_order_sendMsg_model").modal("hide");
    }
</script>