<!-- 九宫格 -->
{{if !empty($module_data['goods_list']) and is_array($module_data['goods_list'])}}
    <div class="module-goods-container module-goods-grid-container module-goods-grid-base {{if isset($goods_cover_type)}}{{$goods_cover_type}}{{/if}}">
        <!-- 基础导航 -->
        {{if !empty($module_data['base_nav'])}}
            <div class="am-container">
                <div class="base-nav am-nbfc">
                    {{if !empty($module_data['base_nav']['title'])}}
                        <p class="base-nav-title am-title-left-border">{{$module_data.base_nav.title}}</p>
                    {{/if}}
                    {{if !empty($module_data['base_nav']['vice_title'])}}
                        <p class="base-nav-desc">{{$module_data.base_nav.vice_title}}</p>
                    {{/if}}
                    {{if !empty($module_data['base_nav']['keywords_arr'])}}
                        <div class="base-nav-keywords">
                            {{foreach $module_data.base_nav.keywords_arr as $kdv}}
                                <a href="{{:MyUrl('index/search/index', ['wd'=>StrToAscii($kdv)])}}" target="_blank" rel="noopener noreferrer">{{$kdv}}</a>
                            {{/foreach}}
                        </div>
                    {{/if}}
                    {{if !empty($module_data['base_nav']['url'])}}
                        <span class="base-nav-more">
                            <a href="{{$module_data.base_nav.url}}" target="_blank" rel="noopener noreferrer">{{:MyLang('more_title')}} <i class="iconfont icon-angle-right"></i></a>
                        </span>
                    {{/if}}
                </div>
            </div>
        {{/if}}
        <!-- 列表 -->
        <ul class="
            am-avg-sm-{{if empty($module_data['sm'])}}2{{else /}}{{$module_data.sm}}{{/if}} 
            am-avg-md-{{if empty($module_data['md'])}}3{{else /}}{{$module_data.md}}{{/if}} 
            am-avg-lg-{{if empty($module_data['lg'])}}5{{else /}}{{$module_data.lg}}{{/if}} ">
            {{foreach $module_data.goods_list as $v}}
                <li>
                    <div class="item am-padding-bottom-xs am-radius
                    {{if !empty($module_data['class'])}} {{$module_data.class}}{{/if}}
                    {{if !isset($module_data['is_hover']) or $module_data['is_hover'] eq 1}} box-shadow-hover{{/if}}
                    {{if isset($module_data['is_border']) and $module_data['is_border'] eq 1}} grid-border{{/if}}
                    {{if isset($module_data['value_type']) and $module_data['value_type'] eq 1 }} item-type-btn{{/if}} theme-data-edit-event" data-id="{{$v.id}}" data-module="goods">
                        <!-- 商品信息顶部钩子 -->
                        {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                            <div class="plugins-tag">
                                <span>plugins_view_module_goods_inside_top</span>
                            </div>
                        {{/if}}
                        {{php}}
                            $hook_name = 'plugins_view_module_goods_inside_top';
                            $hook_data = MyEventTrigger($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'goods_id'=>$v['id'], 'goods'=>$v, 'module'=>'grid-base', 'type'=>empty($module_data['type']) ? '' : $module_data['type']]);
                            if(!empty($hook_data) && is_array($hook_data))
                            {
                                foreach($hook_data as $hook)
                                {
                                    if(is_string($hook) || is_int($hook))
                                    {
                                        echo htmlspecialchars_decode($hook);
                                    }
                                }
                            }
                        {{/php}}
                        <a href="{{$v.goods_url}}" target="_blank" rel="noopener noreferrer" class="am-block goods-info">
                            <img src="{{$v.images}}" alt="{{$v.title}}" class="goods-images am-radius scale-sm" />
                        </a>

                        <!-- 商品信息售价顶部钩子 -->
                        {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                            <div class="plugins-tag">
                                <span>plugins_view_module_goods_inside_price_top</span>
                            </div>
                        {{/if}}
                        {{php}}
                            $hook_name = 'plugins_view_module_goods_inside_price_top';
                            $hook_data = MyEventTrigger($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'goods_id'=>$v['id'], 'goods'=>$v, 'module'=>'grid-base', 'type'=>empty($module_data['type']) ? '' : $module_data['type']]);
                            if(!empty($hook_data) && is_array($hook_data))
                            {
                                foreach($hook_data as $hook)
                                {
                                    if(is_string($hook) || is_int($hook))
                                    {
                                        echo htmlspecialchars_decode($hook);
                                    }
                                }
                            }
                        {{/php}}
                        {{if isset($module_data['value_type']) and $module_data['value_type'] eq 1 }}
                            <div class="type-btn">
                                <p class="am-text-truncate-2 goods-title am-padding-horizontal-sm">
                                    <a href="{{$v.goods_url}}" target="_blank" rel="noopener noreferrer">{{$v.title|raw}}</a>
                                </p>
                                {{if (isset($v['show_field_original_price_status']) and $v['show_field_original_price_status'] eq 1) or (isset($v['show_field_price_status']) and $v['show_field_price_status'] eq 1)}}
                                    <div class="item-bottom am-flex am-flex-justify-between am-gap-1 am-flex-items-end am-padding-sm">
                                        <div class="price-content">
                                            {{if isset($v['show_field_original_price_status']) and $v['show_field_original_price_status'] eq 1 and (!isset($module_data['is_show_original_price']) or (isset($module_data['is_show_original_price']) and $module_data['is_show_original_price'] eq 1))}}
                                                {{if isset($module_data['original_price_key'])}}
                                                    {{if isset($v[$module_data['original_price_key']]) and $v[$module_data['original_price_key']] gt 0}}
                                                        <p class="original-price am-text-truncate">{{if !isset($module_data['is_currency_symbol']) or $module_data['is_currency_symbol'] eq 1}}{{$v.show_original_price_symbol}}{{/if}}{{$v[$module_data['original_price_key']]}}{{$v.show_original_price_unit}}</p>
                                                    {{/if}}
                                                {{else/}}
                                                    {{if isset($v['min_original_price']) and $v['min_original_price'] gt 0}}
                                                        <p class="original-price am-text-truncate">{{if !isset($module_data['is_currency_symbol']) or $module_data['is_currency_symbol'] eq 1}}{{$v.show_original_price_symbol}}{{/if}}{{$v.min_original_price}}{{$v.show_original_price_unit}}</p>
                                                    {{/if}}
                                                {{/if}}
                                            {{/if}}

                                            {{if isset($v['show_field_price_status']) and $v['show_field_price_status'] eq 1}}
                                                <p class="am-text-truncate price am-text-truncate am-font-weight am-text-lg am-text-left">
                                                    {{if isset($module_data['price_key'])}}
                                                        {{if isset($v[$module_data['price_key']])}}
                                                            {{if !isset($module_data['is_currency_symbol']) or $module_data['is_currency_symbol'] eq 1}}{{$v.show_price_symbol}}{{/if}}{{$v[$module_data['price_key']]}}
                                                        {{/if}}
                                                    {{else/}}
                                                        {{if !isset($module_data['is_currency_symbol']) or $module_data['is_currency_symbol'] eq 1}}{{$v.show_price_symbol}}{{/if}}{{$v.min_price}}
                                                    {{/if}}
                                                    <span class="am-text-grey unit">
                                                        {{if !empty($module_data['price_unit'])}}
                                                            {{$module_data['price_unit']}}
                                                        {{else /}}
                                                            {{$v.show_price_unit}}
                                                        {{/if}}
                                                    </span>
                                                </p>
                                            {{/if}}
                                        </div>
                                        {{if isset($v['show_field_price_status']) and $v['show_field_price_status'] eq 1}}
                                            <a class="am-btn {{if isset($module_data['is_disabled']) and $module_data['is_disabled'] eq 1}}am-btn-default{{else/}}am-btn-primary{{/if}} am-radius buy-btn" href="{{$v.goods_url}}" target="_blank" rel="noopener noreferrer" {{if isset($module_data['is_disabled']) and $module_data['is_disabled'] eq 1}}disabled{{/if}}>
                                                {{if isset($module_data['button_text'])}}
                                                    {{$module_data['button_text']}}
                                                {{else/}}
                                                    {{:MyLang('buy_title')}}
                                                {{/if}}
                                            </a>
                                        {{/if}}
                                    </div>
                                {{/if}}
                            </div>
                        {{else/}}
                            <div class="price-content">
                                <p class="price am-text-truncate">
                                    {{if isset($v['show_field_price_status']) and $v['show_field_price_status'] eq 1}}
                                        {{if isset($module_data['price_key'])}}
                                            {{if isset($v[$module_data['price_key']])}}
                                                <strong>{{if !isset($module_data['is_currency_symbol']) or $module_data['is_currency_symbol'] eq 1}}{{$v.show_price_symbol}}{{/if}}{{$v[$module_data['price_key']]}}</strong>
                                            {{/if}}
                                        {{else/}}
                                            <strong>{{if !isset($module_data['is_currency_symbol']) or $module_data['is_currency_symbol'] eq 1}}{{$v.show_price_symbol}}{{/if}}{{$v.min_price}}</strong>
                                        {{/if}}
                                        <span class="am-text-grey unit">{{$v.show_price_unit}}</span>
                                    {{/if}}

                                    {{if isset($v['show_field_original_price_status']) and $v['show_field_original_price_status'] eq 1}}
                                        {{if (!isset($module_data['is_show_original_price']) or (isset($module_data['is_show_original_price']) and $module_data['is_show_original_price'] eq 1))}}
                                            {{if isset($module_data['original_price_key'])}}
                                                {{if isset($v[$module_data['original_price_key']]) and $v[$module_data['original_price_key']] gt 0}}
                                                    <span class="original-price am-text-truncate">{{if !isset($module_data['is_currency_symbol']) or $module_data['is_currency_symbol'] eq 1}}{{$v.show_original_price_symbol}}{{/if}}{{$v[$module_data['original_price_key']]}}{{$v.show_original_price_unit}}</p>
                                                {{/if}}
                                            {{else/}}
                                                {{if isset($v['min_original_price']) and $v['min_original_price'] gt 0}}
                                                    <span class="original-price am-text-truncate">{{if !isset($module_data['is_currency_symbol']) or $module_data['is_currency_symbol'] eq 1}}{{$v.show_original_price_symbol}}{{/if}}{{$v.min_original_price}}{{$v.show_original_price_unit}}</span>
                                                {{/if}}
                                            {{/if}}
                                        {{/if}}
                                    {{/if}}
                                </p>
                                <p class="am-text-truncate-2-md goods-title">
                                    <a href="{{$v.goods_url}}" target="_blank" rel="noopener noreferrer">{{$v.title|raw}}</a>
                                </p>
                            </div>
                        {{/if}}

                        <!-- 商品信息底部钩子 -->
                        {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                            <div class="plugins-tag">
                                <span>plugins_view_module_goods_inside_bottom</span>
                            </div>
                        {{/if}}
                        {{php}}
                            $hook_name = 'plugins_view_module_goods_inside_bottom';
                            $hook_data = MyEventTrigger($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'goods_id'=>$v['id'], 'goods'=>$v, 'module'=>'grid-base', 'type'=>empty($module_data['type']) ? '' : $module_data['type']]);
                            if(!empty($hook_data) && is_array($hook_data))
                            {
                                foreach($hook_data as $hook)
                                {
                                    if(is_string($hook) || is_int($hook))
                                    {
                                        echo htmlspecialchars_decode($hook);
                                    }
                                }
                            }
                        {{/php}}
                    </div>
                </li>
            {{/foreach}}
        </ul>
    </div>
{{/if}}