<script type="text/html" template lay-done="layui.data.sendParams(d);">
    <div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsGoodsComment-editForm" id="LAY-app-CoreCmsGoodsComment-editForm">
        <input type="hidden" name="id" value="{{d.params.data.id || '' }}" />
        <table class="layui-table ">
            <colgroup>
                <col width="100">
                <col>
            </colgroup>
            <tbody>

                <tr>
                    <td>
                        <label for="id">序列</label>
                    </td>
                    <td>
                        {{ d.params.data.id || '' }}
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="commentId">评价用户</label>
                    </td>
                    <td>
                        <a href="javascript:void(0);" onclick="layui.coreHelper.viewImage('{{ d.params.data.avatarImage || setter.noImagePicUrl }}')"><image style="max-width:60px;max-height:60px;border-radius: 30px;" src="{{d.params.data.avatarImage || setter.noImagePicUrl }}" /></a>   {{ d.params.data.nickName || '' }}  【{{ d.params.data.mobile || '' }}】

                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="score">评价星级</label>
                    </td>
                    <td>
                        {{ d.params.data.score || '' }}
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="goodsId">商品名称</label>
                    </td>
                    <td>
                        {{ d.params.data.goodName || '' }}
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="orderId">评价订单</label>
                    </td>
                    <td>
                        {{ d.params.data.orderId || '' }}
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="addon">货品规格</label>
                    </td>
                    <td>
                        {{ d.params.data.addon || '' }}
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="images">评价图片</label>
                    </td>
                    <td>
                        {{#  layui.each(d.params.data.imagesArr, function(index, item){ }}
                        <a href="javascript:void(0);" onclick="layui.coreHelper.viewImage('{{ item || '' }}')"><image style="max-width:128px;max-height:128px;" src="{{item || '' }}" /></a>&nbsp;
                        {{#  }); }}
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="contentBody">评价内容</label>
                    </td>
                    <td>
                        {{ d.params.data.contentBody || '' }}
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="sellerContent">商家回复</label>
                    </td>
                    <td>
                        {{ d.params.data.sellerContent || '' }}
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="isDisplay">前台显示</label>
                    </td>
                    <td>
                        <input type="checkbox" disabled name="isDisplay" value="{{d.params.data.isDisplay}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="isDisplay" {{ d.params.data.isDisplay ? 'checked' : '' }}>
                    </td>
                </tr>

                <tr>
                    <td>
                        <label for="createTime">创建时间</label>
                    </td>
                    <td>
                        {{ d.params.data.createTime || '' }}
                    </td>
                </tr>

            </tbody>
        </table>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label  layui-form-required">商家回复</label>
            <div class="layui-input-block">
                <textarea name="data" class="layui-textarea" lay-verType="tips" lay-verify="required" placeholder="请输入商家回复" lay-reqText="请输入商家回复">{{d.params.data.sellerContent || '' }}</textarea>
            </div>
        </div>


        <div class="layui-form-item text-right">
            <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsGoodsComment-editForm-submit" id="LAY-app-CoreCmsGoodsComment-editForm-submit" value="确认回复">
        </div>
    </div>
</script>
<script>
    var debug = layui.setter.debug;
    layui.data.sendParams = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d.params.data); }
        layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
            function () {
                var $ = layui.$
                    , form = layui.form
                    , admin = layui.admin
                    , laydate = layui.laydate
                    , upload = layui.upload
                    , cropperImg = layui.cropperImg
                    , coreHelper = layui.coreHelper;

                //评价图片逗号分隔最多五张图片裁剪上传
                $('#upBtnimages').click(function () {
                    cropperImg.cropImg({
                        aspectRatio: 1 / 1,
                        imgSrc: $('#viewImgBoximages').attr('src'),
                        onCrop: function (data) {
                            var loadIndex = layer.load(2);
                            coreHelper.Post("api/Tools/UploadFilesFByBase64", { base64: data }, function (res) {
                                if (0 === res.code) {
                                    $('#viewImgBoximages').attr('src', res.data.fileUrl);
                                    $("#imagesInput").val(res.data.fileUrl);
                                    layer.msg(res.msg);
                                    layer.close(loadIndex);
                                } else {
                                    layer.close(loadIndex);
                                    layer.msg(res.msg, { icon: 2, anim: 6 });
                                }
                            });
                        }
                    });
                });

                laydate.render({
                    elem: '#editTime-CoreCmsGoodsComment-createTime',
                    type: 'datetime'
                });
                form.verify({

                    verifyorderId: [/^[\S]{0,16}$/, '评价订单ID最大只允许输入16位字符，且不能出现空格'],
                });
                //重载form
                form.render(null, 'LAY-app-CoreCmsGoodsComment-editForm');
            })
    };
</script>
