{js:fileUpload}
<div class="main f_r">
    <div class="uc_title">
        <label class="current"><span>售后申请</span></label>
    </div>

	<div class="box">
		<form action="{url:/ucenter/refunds_update}" method="post">
			<input type="hidden" name="order_id" value="{$this->orderRow['id']}" />
			<table class="border_table" width="100%" cellpadding="0" cellspacing="0">
				<colgroup>
					<col width="140px" />
					<col />
				</colgroup>
				<tr>
					<th>订单号：</th>
					<td>{$this->orderRow['order_no']}</td>
				</tr>

				<tr>
					<th>售后商品：</th>
					<td>
						{foreach:items=Api::run('getOrderGoodsListByGoodsid',array('#order_id#',$this->orderRow['id'])) item=$good}
						{set:$good_info = JSON::decode($good['goods_array'])}
						{if:$good['is_send'] != 2}
						<p>
							<label>
								<input type="checkbox" name="order_goods_id[]" value="{$good['id']}" checked="checked" />
								<a class="blue" href="{url:/site/products/id/$good['goods_id']}" target='_blank'>{$good_info['name']}{if:$good_info['value']}{$good_info['value']}{/if} X {$good['goods_nums']}</a>
							</label>
						</p>
						{/if}
						{/foreach}
					</td>
				</tr>

				<tr>
				    <th>服务类型：</th>
				    <td>
				        <label><input class="radio" type="radio" name="type" value="refunds" checked="checked" />退货</label>

				        {if:goods_class::isDelivery($this->orderRow['goods_type'])}
				        <label><input class="radio" type="radio" name="type" value="exchange" />换货</label>
				        <label><input class="radio" type="radio" name="type" value="fix" />维修</label>
				        {/if}
				    </td>
				</tr>

				<tr>
					<th>问题描述：</th>
					<td>
						<textarea name="content" style="width:100%;height:300px" pattern="required"></textarea>
						<p>请写明售后的申请理由</p>
					</td>
				</tr>

                <tr>
					<th>上传图片：</th>
					<td>
					    <input type='hidden' name="_imgList" value="" />
						<input id="fileUpload" type="file" accept="image/*" name="_goodsFile" data-url="{url:/ucenter/refunds_img_upload}" />
                        <p>可以上传5张图片，3K分辨率以下并且每张不得超过{echo:IUpload::getMaxSize()}</p>

                        <div id="thumbnails"></div>

                        <!--图片模板-->
                        <script type='text/html' id='picTemplate'>
                        <div class="pic" style='float:left;'>
                            <img class="img-thumbnail" style="width:100px;height:100px;border:1px solid #ccc;margin-right:10px;" src="<%=webroot(picRoot)%>" alt="<%=picRoot%>" />
                            <p style="text-align:center;">
                                <a href='javascript:;' onclick="$(this).parents('.pic').remove();">删除</a>
                            </p>
                        </div>
                        </script>
					</td>
				</tr>

				<tr>
					<th></th>
					<td>
						<label class="btn"><input type="submit" value="提交申请" /></label>
						<label class="btn"><input type="reset" value="重置" /></label>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>

<script type="text/javascript">
//jquery图片上传
$('[name="_goodsFile"]').fileupload({
    dataType: 'json',
    done: function (e, data)
    {
    	if(data.result && data.result.flag == 1)
    	{
    	    var picJson = data.result;
        	var picHtml = template.render('picTemplate',{'picRoot':picJson.img});
        	$('#thumbnails').append(picHtml);
    	}
    	else
    	{
    		alert(data.result.error);
    	}
    },
    add:function(e, data)
    {
        if($('#thumbnails .img-thumbnail').length >= 5)
        {
             alert("最多上传5张图片");
             return false;
        }
        data.submit();
    }
});

//合并图片地址信息
$("form").submit(function()
{
    var goodsPhoto = [];
    $('#thumbnails .img-thumbnail').each(function(){
        goodsPhoto.push(this.alt);
    });

    $('input[name="_imgList"]').val(goodsPhoto.join(','));
    return true;
});
</script>