{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
    <div class="content">
        <!-- operation start -->
        <div class="am-g">
            <a href="javascript:;" class="am-btn am-btn-secondary am-btn-xs m-l-10 am-icon-cloud-upload am-radius" data-am-modal="{target: '#payment-upload-win'}"> 上传</a>
        </div>
        <!-- operation end -->

        <!-- list start -->
        <table class="am-table am-table-striped am-table-hover am-text-middle m-t-10">
            <thead>
                <tr>
                    <th>名称</th>
                    <th class="am-hide-sm-only">LOGO</th>
                    <th class="am-hide-sm-only">适用版本</th>
                    <th>适用终端</th>
                    <th class="am-hide-sm-only">作者</th>
                    <th class="am-hide-sm-only th-desc">描述</th>
                    <th>是否启用</th>
                    <th>对用户放开</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {{if !empty($data_list)}}
                    {{foreach $data_list as $v}}
                        <tr id="data-list-{{$v.payment}}" {{if $v['is_install'] eq 0}}class="am-warning"{{elseif $v['is_enable'] eq 0 /}}class="am-active"{{/if}} >
                            <td>
                                {{$v.name}}
                                {{if !empty($v['version'])}}
                                    <p class="td-version">v {{$v.version}}</p>
                                {{/if}}
                            </td>
                            <td class="am-hide-sm-only">
                                {{if !empty($v['logo'])}}
                                    <a href="{{$v['logo']}}" target="_blank">
                                        <img src="{{$v['logo']}}" class="am-radius" width="100" />
                                    </a>
                                {{else /}}
                                    <span class="cr-ddd">暂无LOGO</span>
                                {{/if}}
                            </td>
                            <td class="am-hide-sm-only">
                                {{if empty($v['apply_version'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.apply_version}}{{/if}}
                            </td>
                            <td>
                                {{if !empty($v['apply_terminal'])}}
                                    {{foreach $v.apply_terminal as $terminal_k=>$terminal_v}}
                                        {{$common_platform_type[$terminal_v]['name']}}
                                        {{if $terminal_k LT count($v['apply_terminal'])-1}}<br />{{/if}}
                                    {{/foreach}}
                                {{else /}}
                                    <span class="cr-ddd">未填写</span>
                                {{/if}}
                            </td>
                            <td class="am-hide-sm-only">
                                {{if empty($v['author'])}}
                                    <span class="cr-ddd">未填写</span>
                                {{else /}}
                                    {{$v.author}}
                                    {{if !empty($v['author_url'])}}
                                        <a href="{{$v.author_url}}" target="_blank">
                                            <i class="am-icon-external-link"></i>
                                        </a>
                                    {{/if}}
                                {{/if}}
                            </td>
                            <td class="am-hide-sm-only td-desc">
                                {{if empty($v['desc'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.desc||raw}}{{/if}}
                            </td>
                            <td>
                                {{if $v['is_install'] eq 1}}
                                    <a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_enable'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/payment/StatusUpdate')}}" data-id="{{$v.payment}}" data-field="is_enable" data-state="{{$v['is_enable']}}" data-is-update-status="1"></a>
                                {{else /}}
                                    <span class="cr-ddd">未安装</span>
                                {{/if}}
                            </td>
                            <td>
                                {{if $v['is_install'] eq 1}}
                                    <a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_open_user'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/payment/StatusUpdate')}}" data-id="{{$v.payment}}" data-field="is_open_user" data-state="{{$v['is_open_user']}}"></a>
                                {{else /}}
                                    <span class="cr-ddd">未安装</span>
                                {{/if}}
                            </td>
                            <td class="view-operation">
                                {{if $v['is_install'] eq 0}}
                                    <button class="am-btn am-btn-default am-btn-xs am-radius am-icon-cubes submit-ajax" data-url="{{:MyUrl('admin/payment/install')}}" data-id="{{$v.payment}}" data-view="reload" data-msg="安装进行中、确认操作吗？"> 安装</button>

                                    {{if !in_array($v['payment'], $cannot_deleted_list)}}
                                        <button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:MyUrl('admin/payment/delete')}}" data-id="{{$v.payment}}"> 删除</button>
                                    {{/if}}
                                {{else /}}
                                    <a href="{{:MyUrl('admin/payment/saveinfo', array('id'=>$v['id']))}}">
                                        <button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> 编辑</button>
                                    </a>

                                    <button class="am-btn am-btn-default am-btn-xs am-radius am-icon-remove submit-ajax" data-url="{{:MyUrl('admin/payment/uninstall')}}" data-id="{{$v.payment}}" data-view="reload" data-msg="卸载后不可恢复、确认操作吗？"> 卸载</button>
                                {{/if}}
                            </td>
                        </tr>
                    {{/foreach}}
                {{else /}}
                    <tr><td colspan="20" class="table-no">没有相关数据</td></tr>
                {{/if}}
            </tbody>
        </table>
        <!-- list end -->

        <!-- upload start -->
        <div class="am-popup am-radius" id="payment-upload-win">
            <div class="am-popup-inner">
                <div class="am-popup-hd">
                    <h4 class="am-popup-title">上传</h4>
                    <span data-am-modal-close class="am-close">&times;</span>
                </div>
                <div class="am-popup-bd">
                    <!-- win form start -->
                    <form class="am-form form-validation" action="{{:MyUrl('admin/payment/upload')}}" method="POST" request-type="ajax-reload" enctype="multipart/form-data">
                        <div class="am-alert am-radius am-alert-tips m-t-0" data-am-alert>
                            <p class="m-t-10">1 类名必须于文件名一致（去除 .php ），如 Alipay.php 则取 Alipay <br />2 类必须定义三个方法<br />&nbsp;&nbsp;&nbsp; 2.1 Config 配置方法<br />&nbsp;&nbsp;&nbsp; 2.2 Pay 支付方法<br />&nbsp;&nbsp;&nbsp; 2.3 Respond 回调方法</p>
                            <p class="cr-red">PS：以上条件不满足则无法查看插件</p>
                        </div>
                        <div class="am-form-group am-form-file">
                            <button type="button" class="am-btn am-btn-default am-btn-sm am-radius"><i class="am-icon-cloud-upload"></i> 选择文件</button>
                            <input type="file" name="file" class="file-event" data-tips-tag="#form-payment-tips" multiple data-validation-message="请选择需要上传的文件" accept=".php" required />
                            <div id="form-payment-tips"></div>
                        </div>
                        <div class="am-form-group">
                            <button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'处理中...'}">确认</button>
                        </div>
                    </form>
                    <!-- win form end -->
                </div>
            </div>
        </div>
        <!-- upload end -->
    </div>
</div>
<!-- right content end  -->
        
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->