@using MySystem.Models;
@{
    OrderRefund editData = ViewBag.data as OrderRefund;
    List<OrderProduct> products = ViewBag.products as List<OrderProduct>;
}
@{
string RightInfo = ViewBag.RightInfo as string;
string right = ViewBag.right as string;
}
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>退款申请(修改)</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <script src="/admin/js/jquery-1.10.1.min.js"></script>
    <script src="/admin/js/LAreaData2.js"></script>
</head>

<body>

    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
        <input type="hidden" name="Id" value="@editData.Id" />
        <input type="hidden" name="OrderId" value="@editData.OrderId" />
        <div class="layui-card">
          <div class="layui-card-body">
        <div class="layui-tab" lay-filter="mytabbar">
            <div class="layui-tab-content mt20">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品</label>
                        <div class="layui-input-block">
                            <table width="100%">
                                <thead>
                                    <tr style="height:30px; line-height:30px; background-color:#eee;">
                                        <th style="padding:10px;">名称</th>
                                        <th style="padding:10px;">规格</th>
                                        <th style="padding:10px;">单价</th>
                                        <th style="padding:10px;">积分抵扣</th>
                                        <th style="padding:10px;">数量</th>
                                        <th style="padding:10px;">小计</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach (OrderProduct product in products)
                                    {
                                        <tr style="height:30px; line-height:30px;">
                                            <td style="padding:10px;">
                                                @product.ProductName
                                            </td>
                                            <td style="padding:10px;">
                                                @product.NormDetail
                                            </td>
                                            <td style="padding:10px;">
                                                @product.ProductPrice
                                            </td>
                                            <td style="padding:10px;">
                                                @product.ProductIntegral
                                            </td>
                                            <td style="padding:10px;">
                                                @product.ProductCount
                                            </td>
                                            <td style="padding:10px;">
                                                @product.TotalPrice 元
                                                +
                                                @product.TotalIntegral 积分
                                            </td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商家</label>
                        <div class="layui-input-block">
                            <div class="layui-upload">
                                <a class="layui-btn" lay-href="/Admin/Merchants/Edit?right=@right&Id=@editData.MerchantId">查看</a>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">订单</label>
                        <div class="layui-input-block">
                            <div class="layui-upload">
                                <a class="layui-btn" lay-href="/Admin/Orders/Edit?right=@right&Id=@editData.OrderId">查看</a>
                            </div>                            
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">退款原因</label>
                            <div class="layui-input-inline">
                                <select id="Reason" name="Reason" lay-search="">
                                    <option value="">请选择</option>
                                    @{Dictionary<string, string> OrderRefundReasonDic = new
                                        MySystem.OrderDictionary().getOrderRefundReasonDic();}
                                        @foreach (string key in OrderRefundReasonDic.Keys)
                                        {
                                        <option value="@key">@OrderRefundReasonDic[key]</option>
                                        }
                                </select>
                                <script>
                                    $("#Reason").val("@editData.Reason");
                                </script>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">退款金额</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="Amount" name="Amount" value="@editData.Amount"
                                maxlength="20" lay-verify="required|number|" autocomplete="off" placeholder="请输入退款金额">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">补充说明</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" id="Contents" name="Contents" lay-verify=""
                                placeholder="请输入补充说明">@editData.Contents</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">申请人手机号</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="Mobile" name="Mobile" value="@editData.Mobile"
                                maxlength="11" lay-verify="required|phone|" autocomplete="off" placeholder="请输入申请人手机号">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">货物状态</label>
                            <div class="layui-input-inline">
                                <select id="GoodStatus" name="GoodStatus" lay-search="">
                                    <option value="">请选择</option>
                                    <option value="1">未收到货</option>
                                    <option value="2">已收到货</option>
                                </select>
                                <script>
                                    $("#GoodStatus").val("@editData.GoodStatus");
                                </script>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">凭证</label>
                        <div class="layui-input-block">
                            <div class="layui-upload">
                                <input type="hidden" id="Photos" name="Photos" value="@editData.Photos">
                                <button class="layui-btn" type="button" id="PhotosBtn">选择图片</button>
                                <div class="layui-inline layui-word-aux"></div>
                            </div>
                            <div style="margin-top:10px;" id="PhotosImage">
                                @{string Photos = editData.Photos;}
                                @if(!string.IsNullOrEmpty(Photos))
                                {
                                string[] PhotosList = Photos.Split(new string[] { "#cut#" },
                                StringSplitOptions.None)[0].TrimEnd('|').Split('|');
                                string[] PhotosTextList = Photos.Split(new string[] { "#cut#" },
                                StringSplitOptions.None)[1].TrimEnd('|').Split('|');
                                for (int i = 0; i < PhotosList.Length; i++) { <div
                                    style="float:left; width:85px; height:120px; margin:10px; padding:10px; border:1px solid #cccccc; text-align:center;">
                                    <div style="height:85px;"><img
                                            src="@(MySystem.OssHelper.Instance.SourceHost)@PhotosList[i]"
                                            style="max-width:85px; max-height:85px;"
                                            onclick="showBigPic('@(MySystem.OssHelper.Instance.SourceHost)@PhotosList[i]')" />
                                    </div><input type="text" placeholder="图片说明" value="@PhotosTextList[i]"
                                        style="width:85px; margin-top:5px; font-size:12px;" /><br><a href="javascript:;"
                                        onclick="movePrev(this,'Photos')"
                                        style="color:#000; font-size:12px; padding:0px 2px;">左移</a><a
                                        href="javascript:;" onclick="moveNext(this,'Photos')"
                                        style="color:#000; font-size:12px; padding:0px 2px;">右移</a><a
                                        href="javascript:;" onclick="deletePic(this,'Photos')"
                                        style="color:#000; font-size:12px; padding:0px 2px;">删除</a></div>
                            }
                            }
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">快递公司</label>
                        <div class="layui-input-inline">
                            <select id="ErpCompany" name="ErpCompany" lay-search="">
                                <option value="">请选择</option>
                                @{Dictionary<string, string> ErpCompanysDic = new
                                    MySystem.OrderDictionary().getErpCompanysDic();}
                                    @foreach (string key in ErpCompanysDic.Keys)
                                    {
                                    <option value="@key">@ErpCompanysDic[key]</option>
                                    }
                            </select>
                            <script>
                                $("#ErpCompany").val("@editData.ErpCompany");
                            </script>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">快递运单号</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" id="ErpCode" name="ErpCode" value="@editData.ErpCode"
                            maxlength="50" lay-verify="" autocomplete="off" placeholder="请输入快递运单号">
                    </div>
                </div>

            </div>
            <div class="layui-tab-item">
                <div class="layui-form-item">
                    <label class="layui-form-label">网页标题</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" id="SeoTitle" name="SeoTitle" value="@editData.SeoTitle"
                            maxlength="50" autocomplete="off" placeholder="请输入网页标题">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">网页关键字</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" id="SeoKeyword" name="SeoKeyword"
                            value="@editData.SeoKeyword" maxlength="50" autocomplete="off" placeholder="请输入网页关键字">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">网页描述</label>
                    <div class="layui-input-block">
                        <textarea class="layui-textarea" name="SeoDescription" id="SeoDescription"
                            placeholder="请输入网页描述">@editData.SeoDescription</textarea>
                    </div>
                </div>

            </div>

        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit" value="确认">
    </div>
    </div>

    <script src="/layuiadmin/layui/layui.js"></script>
    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
    <script src="/other/mybjq/kindeditor-min.js"></script>
    <script src="/other/mybjq/lang/zh_CN.js"></script>
    <script>
        //编辑器
        KindEditor.ready(function (K) {

        });

        var ids = "";

        function getChildren(obj) {
            $.each(obj, function (index, value) {
                var id = obj[index].id;
                ids += id + ",";
                var children = obj[index].children;
                if (children) {
                    getChildren(children);
                }
            });
        }

        function AreasProvinceInit(tagId, areasVal, form) {
            for (var i = 0; i < provs_data.length; i++) {
                var sel = "";
                if (areasVal.indexOf(provs_data[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' +
                    provs_data[i].text + '</option>');
            }
            form.render();
        }

        function AreasProvinceSelected(tagId, areasVal, form, value) {
            $("#" + tagId + "City").html('<option value="">市</option>');
            var list = citys_data[value];
            for (var i = 0; i < list.length; i++) {
                var sel = "";
                if (areasVal.indexOf(list[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text +
                    '</option>');
            }
            $("#" + tagId + "Area").html('<option value="">县/区</option>');
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
                "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }

        function AreasCitySelected(tagId, areasVal, form, value) {
            $("#" + tagId + "Area").html('<option value="">县/区</option>');
            var list = dists_data[value];
            for (var i = 0; i < list.length; i++) {
                var sel = "";
                if (areasVal.indexOf(list[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text +
                    '</option>');
            }
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
                "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }

        function AreasAreaSelected(tagId, form) {
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
                "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }

        function movePrev(obj, tagId) {
            $(obj).parent().prev().insertAfter($(obj).parent());
            checkPics(tagId);
        }

        function moveNext(obj, tagId) {
            $(obj).parent().next().insertBefore($(obj).parent());
            checkPics(tagId);
        }

        function deletePic(obj, tagId) {
            $(obj).parent().remove();
            checkPics(tagId);
        }

        function checkPics(tagId) {
            var pics = "";
            var texts = "";
            $("#" + tagId + "Image div img").each(function (i) {
                pics += $(this).attr("src").replace(osshost, '') + "|";
            });
            $("#" + tagId + "Image div input").each(function (i) {
                texts += $(this).val() + "|";
            });
            if (pics == "") {
                $("#" + tagId).val("");
            } else {
                pics = pics.substring(0, pics.length - 1);
                texts = texts.substring(0, pics.length - 1);
                $("#" + tagId).val(pics + "#cut#" + texts);
            }
        }

        function checkBox(tagId) {
            var text = "";
            $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
                text += $(this).val() + ",";
            });
            $("#" + tagId).val(text);
        }

        function showBigPic(picpath) {
            parent.layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: ['auto', 'auto'],
                content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
            });
        }

        var tree;
        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'],
            function () {
                var $ = layui.$,
                    form = layui.form,
                    element = layui.element,
                    layer = layui.layer,
                    layedit = layui.layedit,
                    laydate = layui.laydate,
                    croppers = layui.croppers,
                    upload = layui.upload,
                    transfer = layui.transfer,
                    util = layui.util;
                tree = layui.tree;

                //Hash地址的定位
                var layid = location.hash.replace(/^#test=/, '');
                element.tabChange('test', layid);
                element.on('tab(test)', function (elem) {
                    location.hash = 'test=' + $(this).attr('lay-id');
                });

                //日期


                //上传文件
                WebUploadJs('PhotosBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', {}, {},  function (filename) {
                    $('#PhotosImage').append(
                        '<div style="float:left; width:85px; height:120px; margin:10px; padding:10px; border:1px solid #cccccc; text-align:center;"><div style="height:85px;"><img src="' +
                        osshost + filename +
                        '" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost +
                        filename +
                        '\')" /></div><input type="text" placeholder="图片说明" value="" style="width:85px; margin-top:5px; font-size:12px;" /><br><a href="javascript:;" onclick="movePrev(this,\'Photos\')" style="color:#000; font-size:12px; padding:0px 2px;">左移</a><a href="javascript:;" onclick="moveNext(this,\'Photos\')" style="color:#000; font-size:12px; padding:0px 2px;">右移</a><a href="javascript:;" onclick="deletePic(this,\'Photos\')" style="color:#000; font-size:12px; padding:0px 2px;">删除</a></div>'
                    )
                });


                //穿梭框


                //TreeView，比如权限管理


                //省市区

            })
    </script>
</body>

</html>