<div class="header_menu">
    <div class="container">
        <div class="header-nav clearfix">
            <?php echo $this->partial('shop/layout/headerMenu'); ?>
        </div>
    </div>
</div>
</div>
<div class="container breadcrumbs">
    <a href="<?php echo $this->url('shop'); ?>"><?php echo $this->translate('首页'); ?></a>
    <span class="sep">/</span><span><?php echo $this->translate('我要退款(无需退货)'); ?></span>
</div>
<?php
$form = $this->form;
$form->prepare();

$form->setAttributes(['class' => 'form-horizontal']);

$form->get('returnInfo')->setAttributes(['placeholder' => $this->translate('申请说明')]);
?>
<div class="container">
    <div class="uc-full-box">
        <div class="row">
            <div class="span4">
                <?php echo $this->partial('shop/partial/home/leftMenu'); ?>
            </div>
            <div class="span16">
                <div class="xm-line-box uc-box uc-order-detail-box">
                    <div class="box-hd">
                        <h3 class="title">
                            <?php echo $this->translate('我要退款(无需退货)'); ?>
                            &nbsp;&nbsp;
                            <a href="<?php echo $this->url('shop-service', ['id' => $this->orderGoods->getOrderGoodsId()]); ?>" class="btn btn-default"><?php echo $this->translate('返回'); ?></a>
                        </h3>
                    </div>

                    <div class="box-bd">
                        <?php echo $this->partial('shop/message'); ?>

                        <div class="uc-order-list-box">
                            <ul class="uc-order-detail-list">
                                <li class="uc-order-detail-item">
                                    <table class="order-detail-table">
                                        <tbody>
                                        <tr>
                                            <td class="column-detail column-l">
                                                <ul class="order-goods-list">
                                                    <li class="first">
                                                        <a href="<?php echo $this->url('shop-goods', ['id' => $this->orderGoods->getGoodsId()]); ?>" target="_blank">
                                                            <img src="<?php echo $this->shopHelper()->baseGoodsImagePath($this->orderGoods->getGoodsImage()); ?>" class="goods-thumb">
                                                        </a>
                                                        <a class="goods-name" href="<?php echo $this->url('shop-goods', ['id' => $this->orderGoods->getGoodsId()]); ?>" target="_blank"><?php echo $this->escapeHtml($this->orderGoods->getGoodsName()); ?></a>
                                                        <span class="goods-price"><?php echo $this->shopHelper()->orderCurrency($this->orderGoods->getGoodsPrice(), $this->orderInfo->getCurrencySymbol()); ?> x <?php echo $this->orderGoods->getBuyNum(); ?> = <strong><?php echo $this->shopHelper()->orderCurrency($this->orderGoods->getGoodsAmount(), $this->orderInfo->getCurrencySymbol()); ?></strong></span>
                                                        <span style="display: block;"><?php echo $this->escapeHtml($this->orderGoods->getInSpecGoodsStr()); ?></span>
                                                    </li>
                                                </ul>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </li>
                            </ul>
                        </div>

                        <?php echo $this->form()->openTag($form); ?>
                        <div class="control-group">
                            <label class="control-label"><?php echo $this->translate('退款原因'); ?>：</label>
                            <div class="controls">
                                <?php echo $this->formElement($form->get('returnReason')->setAttributes(['class' => 'span4'])); ?>
                                <?php echo $this->formElementErrors($form->get('returnReason'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('退款方式'); ?>：</label>
                            <div class="controls">
                                <?php echo $this->formElement($form->get('refundPayType')->setAttributes(['class' => 'span4'])); ?>
                                <?php echo $this->formElementErrors($form->get('refundPayType'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                        <div class="control-group other-pay" style="display: none;">
                            <label for="input01" class="control-label"><?php echo $this->translate('支付名称(开户行)'); ?>：</label>
                            <div class="controls">
                                <?php echo $this->formElement($form->get('refundPayName')->setAttributes(['class' => 'span4', 'placeholder' => $this->translate('支付名称(开户行)')])); ?>
                                <?php echo $this->formElementErrors($form->get('refundPayName'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                        <div class="control-group other-pay" style="display: none;">
                            <label for="input01" class="control-label"><?php echo $this->translate('姓名'); ?>：</label>
                            <div class="controls">
                                <?php echo $this->formElement($form->get('refundUser')->setAttributes(['class' => 'span4', 'placeholder' => $this->translate('姓名')])); ?>
                                <?php echo $this->formElementErrors($form->get('refundUser'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                        <div class="control-group other-pay" style="display: none;">
                            <label for="input01" class="control-label"><?php echo $this->translate('收款账号(卡号)'); ?>：</label>
                            <div class="controls">
                                <?php echo $this->formElement($form->get('refundAccount')->setAttributes(['class' => 'span4', 'placeholder' => $this->translate('收款账号(卡号)')])); ?>
                                <?php echo $this->formElementErrors($form->get('refundAccount'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('退款金额'); ?>：</label>
                            <div class="controls">
                                <?php echo $this->orderInfo->getCurrencySymbol(); ?>
                                <?php echo $this->formElement($form->get('returnAmount')->setValue($this->returnMaxAmount)->setAttributes(['class' => 'span2'])); ?>
                                <?php echo $this->formElementErrors($form->get('returnAmount'), ['class'=>'error-message']); ?>
                                <small><?php echo $this->translate('最多退款'); ?><?php echo $this->orderInfo->getCurrencySymbol() . $this->returnMaxAmount; ?></small>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><?php echo $this->translate('申请说明'); ?>：</label>
                            <div class="controls">
                                <?php echo $this->formElement($form->get('returnInfo')->setAttributes(['class' => 'span6'])); ?>
                                <?php echo $this->formElementErrors($form->get('returnInfo'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                        <div class="offset3">
                            <button class="btn btn-primary" type="submit"><?php echo $this->translate('提交'); ?></button>
                        </div>
                        <?php echo $this->form()->closeTag(); ?>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                returnReason: {
                    required: true
                },
                returnInfo: {
                    required: true
                },
                returnAmount: {
                    required: true,
                    number : true,
                    max: <?php echo $this->returnMaxAmount; ?>
                }
            },
            messages: {
                returnReason: {
                    required: "<?php echo $this->translate('请选择退款原因!'); ?>"
                },
                returnInfo: {
                    required: "<?php echo $this->translate('申请说明不能为空!'); ?>"
                },
                returnAmount: {
                    required: "<?php echo $this->translate('请输入退款金额!'); ?>",
                    number: "<?php echo $this->translate('退款金额必须为数字!'); ?>",
                    max: "<?php echo $this->translate('超过最多退款金额!'); ?>"
                }
            }
        });
    });

    $('#refundPayType').change(function () {
        if(this.value == 'otherPay') {
            $('.other-pay').show();
        } else {
            $('.other-pay').hide();
        }
    });
</script>